diff --git a/pages/Mine/minecomponents/recompose/recompose.vue b/pages/Mine/minecomponents/recompose/recompose.vue
index 994c7ef..d900b30 100644
--- a/pages/Mine/minecomponents/recompose/recompose.vue
+++ b/pages/Mine/minecomponents/recompose/recompose.vue
@@ -148,6 +148,7 @@
type="textarea"
v-model="remarks"
placeholder="备注"
+ :maxlength="50"
>
diff --git a/pages/NewAddedPk/NewAddedPk.vue b/pages/NewAddedPk/NewAddedPk.vue
index 9a0b1ae..503fb67 100644
--- a/pages/NewAddedPk/NewAddedPk.vue
+++ b/pages/NewAddedPk/NewAddedPk.vue
@@ -133,7 +133,7 @@
type="textarea"
v-model="remarks"
placeholder="备注"
- maxlength="-1"
+ :maxlength="50"
>
diff --git a/pages/Setting/Setting.vue b/pages/Setting/Setting.vue
index ccaffea..390e84b 100644
--- a/pages/Setting/Setting.vue
+++ b/pages/Setting/Setting.vue
@@ -29,7 +29,7 @@ export default {
name: "",
id: "",
info: {},
- userSig: "",
+ useravatar: "",
};
},
onLoad(option) {
@@ -38,13 +38,7 @@ export default {
success: (res) => {
this.id = res.data.id;
this.name = res.data.nickName;
- this.userinfo = res.data.headerIcon;
- },
- });
- uni.getStorage({
- key: "userSig",
- success: (res) => {
- this.userSig = res.data;
+ this.userinfo = this.useravatar = res.data.headerIcon;
},
});
},
@@ -70,7 +64,36 @@ export default {
title: "修改中...",
mask: true,
});
-
+ if (this.useravatar == this.userinfo) {
+ request({
+ url: "user/updateUserInfo",
+ method: "POST",
+ data: {
+ id: this.id,
+ headerIcon: this.userinfo.split("/").pop(),
+ nickName: this.name,
+ },
+ userInfo: true,
+ }).then((ress) => {
+ if (ress.code === 200) {
+ uni.showToast({
+ title: "修改成功",
+ icon: "success",
+ });
+ uni.setStorageSync("userinfo", ress.data.info);
+ goEasylogin(this.$goeasy,String(ress.data.info.id),ress.data.info.headerIcon,ress.data.info.nickName);
+ uni.hideLoading();
+ uni.navigateBack({
+ delta: 1,
+ });
+ } else {
+ uni.showToast({
+ title: "修改失败",
+ icon: "none",
+ });
+ }
+ });
+ }else{
postFile({
path: this.userinfo,
name: generateFileName(),
@@ -83,10 +106,10 @@ export default {
id: this.id,
headerIcon: res.split("/").pop(),
nickName: this.name,
- usersig: this.userSig.userSig,
},
userInfo: true,
}).then((ress) => {
+ console.log("修改调用返回",ress);
if (ress.code === 200) {
uni.showToast({
title: "修改成功",
@@ -109,8 +132,9 @@ export default {
});
})
.catch((err) => {
- console.log(err);
+ console.log('上传失败', err);
});
+ }
},
},
};
diff --git a/pages/index/chat/chat.vue b/pages/index/chat/chat.vue
index 862b1e9..7635d64 100644
--- a/pages/index/chat/chat.vue
+++ b/pages/index/chat/chat.vue
@@ -379,6 +379,9 @@ export default {
onHide() {
this.onPage = false;
},
+ onUnload() {
+ this.onPage = false;
+ },
onLoad(options) {
this.recorderManager.onStop((res) => {
console.log("录音结束", res);
@@ -933,12 +936,14 @@ export default {
top: 120rpx;
width: 46rpx;
height: 46rpx;
- z-index: 1;
+ z-index: 2;
}
.title {
position: fixed;
top: 120rpx;
- left: 325rpx;
+ left:0;
+ right: 0;
+ text-align: center;
font-size: 34rpx;
color: #100e0f;
font-weight: bold;
diff --git a/pages/pkDetail/pkDetail.vue b/pages/pkDetail/pkDetail.vue
index 8d43c04..1c80e7c 100644
--- a/pages/pkDetail/pkDetail.vue
+++ b/pages/pkDetail/pkDetail.vue
@@ -77,20 +77,17 @@
+
+
@@ -122,7 +119,7 @@
mode="scaleToFill"
/>
- {{ TimeFormatting(item.pkTime) }}
+ {{ TimeFormatting(item.pkTime*1000) }}
({genders:0,Gender:[{label:"男",value:1},{label:"女",value:2}],Country:t.optionsArray,countrys:"",nameAnchor:"",numberCoins:"",session:"",remarks:"",Display:!1,Hint:!1,datetimesingle:"",id:null,sendingTime:"",filterable:!0,AnchorProfilePicture:"",AnchorList:[],selectedId:null,selectedIddata:null}),mounted(){e.index.getStorage({key:"userinfo",success:e=>{this.id=e.data.id}})},methods:{close(){this.$refs.popup.close()},invite(){this.selectedId?(this.nameAnchor=this.selectedIddata.anchorId,this.AnchorProfilePicture=this.selectedIddata.headerIcon.split("/").pop(),this.genders=this.selectedIddata.gender,this.countrys=this.selectedIddata.country,this.close()):e.index.showToast({title:"请选择主播",icon:"none",duration:2e3})},Select(e,t){this.selectedId!==e?(this.selectedId=e,this.selectedIddata=t):(this.selectedId=null,this.selectedIddata=null)},getAnchorList(){n.request({url:"anchor/list",method:"POST",data:{id:this.id},userInfo:!0}).then((e=>{this.triggered=!1,200==e.code?this.AnchorList=e.data:console.log(e.msg)}))},chooseMyStreamer(){this.$refs.popup.open("center"),this.getAnchorList()},gender(e){this.genders=e.value},country(e){this.countrys=e.value},handleOverlayClick(e){e.target===this.$el&&(this.Display=!1,this.Hint=!1)},open(){this.Display?(this.Display=!1,this.Hint=!1,this.nameAnchor="",this.genders=0,this.numberCoins="",this.remarks="",this.datetimesingle="",this.countrys="",this.session=""):this.Display=!0},blur(t){this.nameAnchor!==t.target.value&&(this.nameAnchor=t.target.value,e.index.showLoading({title:"正在验证主播",mask:!0}),e.index.request({url:"https://python.yolojt.com/api/"+this.nameAnchor,success:t=>{200===t.data.code?(e.index.hideLoading(),e.index.showToast({title:"查询成功",icon:"none",duration:3e3}),this.AnchorProfilePicture=t.data.data):(e.index.hideLoading(),e.index.showToast({title:"未查询到该主播",icon:"none",duration:3e3}))},fail:function(t){e.index.hideLoading(),e.index.showToast({title:"网络请求失败",icon:"none",duration:3e3})}}))},async Publish(){if(""===this.nameAnchor||0===this.genders||""===this.numberCoins||""===this.countrys||""===this.datetimesingle||""===this.session||""===this.AnchorProfilePicture)return void(this.Hint=!0);if(this.remarks.includes(this.nameAnchor))return void e.index.showToast({title:"备注中不能包含主播昵称",icon:"none",duration:2e3});const t=this.datetimesingle.replace(" ","T"),i=Date.parse(t);if(isNaN(i))throw new Error(`Invalid date format: ${this.datetimesingle}`);this.sendingTime=Math.floor(i/1e3);const s=Math.floor(Date.now()/1e3);if(this.sendingTime"./uni_modules/wht-select/components/wht-select/wht-select.js")+(()=>"./uni_modules/uni-number-box/components/uni-number-box/uni-number-box.js")+(()=>"./uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js")+(()=>"./uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js")+(()=>"./uni_modules/uni-popup/components/uni-popup/uni-popup.js"))();const s=e._export_sfc(i,[["render",function(t,n,i,s,o,r){return e.e({a:o.Display},o.Display?e.e({b:e.o((e=>r.open())),c:e.o(((...e)=>t.NameAnchor&&t.NameAnchor(...e))),d:e.o(((...e)=>r.blur&&r.blur(...e))),e:o.nameAnchor,f:""===o.nameAnchor&&!0===o.Hint},(""===o.nameAnchor&&o.Hint,{}),{g:e.o(((...e)=>r.chooseMyStreamer&&r.chooseMyStreamer(...e))),h:e.o(r.country),i:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:o.Country,filterable:o.filterable,placeholder:"请选择国家",value:o.countrys}),j:""===o.countrys&&!0===o.Hint},(""===o.countrys&&o.Hint,{}),{k:e.o(r.gender),l:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:o.Gender,placeholder:"性别",value:o.genders}),m:0===o.genders},(o.genders,{}),{n:1===o.genders},(o.genders,{}),{o:2===o.genders},(o.genders,{}),{p:0===o.genders&&!0===o.Hint},(0===o.genders&&o.Hint,{}),{q:e.o((e=>o.numberCoins=e)),r:e.p({max:9999999999,background:"#03ABA8",modelValue:o.numberCoins}),s:""===o.numberCoins&&!0===o.Hint},(""===o.numberCoins&&o.Hint,{}),{t:e.o((e=>o.datetimesingle=e)),v:e.p({type:"datetime","hide-second":"true",modelValue:o.datetimesingle}),w:""===o.datetimesingle&&!0===o.Hint},(""===o.datetimesingle&&o.Hint,{}),{x:e.o((e=>o.session=e)),y:e.p({background:"#03ABA8",modelValue:o.session}),z:""===o.session&&!0===o.Hint},(""===o.session&&o.Hint,{}),{A:e.o((e=>o.remarks=e)),B:e.p({type:"textarea",placeholder:"备注",maxlength:"-1",modelValue:o.remarks}),C:e.o((e=>r.Publish())),D:e.o((()=>{})),E:e.n(o.Display?"create-module":"close-animation "),F:e.o((e=>r.open()))}):{},{G:0!==o.AnchorList.length},0!==o.AnchorList.length?{H:e.f(o.AnchorList,((t,n,i)=>({a:t.headerIcon,b:e.t(t.anchorId),c:e.t(t.country),d:e.o((e=>r.Select(t.id,t)),n),e:o.selectedId===t.id?"#b8ff8c74":"#ffffff",f:n})))}:{},{I:0===o.AnchorList.length},(o.AnchorList.length,{}),{J:e.o((e=>r.invite())),K:e.o((e=>r.close())),L:e.sr("popup","ce54c7bb-6"),M:e.p({type:"center","border-radius":"10px 10px 0 0"})})}],["__scopeId","data-v-ce54c7bb"]]);exports.MiniProgramPage=s;
+"use strict";const e=require("./common/vendor.js"),t=require("./components/NationalDictionary.js"),n=require("./components/request.js"),i={data:()=>({genders:0,Gender:[{label:"男",value:1},{label:"女",value:2}],Country:t.optionsArray,countrys:"",nameAnchor:"",numberCoins:"",session:"",remarks:"",Display:!1,Hint:!1,datetimesingle:"",id:null,sendingTime:"",filterable:!0,AnchorProfilePicture:"",AnchorList:[],selectedId:null,selectedIddata:null}),mounted(){e.index.getStorage({key:"userinfo",success:e=>{this.id=e.data.id}})},methods:{close(){this.$refs.popup.close()},invite(){this.selectedId?(this.nameAnchor=this.selectedIddata.anchorId,this.AnchorProfilePicture=this.selectedIddata.headerIcon.split("/").pop(),this.genders=this.selectedIddata.gender,this.countrys=this.selectedIddata.country,this.close()):e.index.showToast({title:"请选择主播",icon:"none",duration:2e3})},Select(e,t){this.selectedId!==e?(this.selectedId=e,this.selectedIddata=t):(this.selectedId=null,this.selectedIddata=null)},getAnchorList(){n.request({url:"anchor/list",method:"POST",data:{id:this.id},userInfo:!0}).then((e=>{this.triggered=!1,200==e.code?this.AnchorList=e.data:console.log(e.msg)}))},chooseMyStreamer(){this.$refs.popup.open("center"),this.getAnchorList()},gender(e){this.genders=e.value},country(e){this.countrys=e.value},handleOverlayClick(e){e.target===this.$el&&(this.Display=!1,this.Hint=!1)},open(){this.Display?(this.Display=!1,this.Hint=!1,this.nameAnchor="",this.genders=0,this.numberCoins="",this.remarks="",this.datetimesingle="",this.countrys="",this.session=""):this.Display=!0},blur(t){this.nameAnchor!==t.target.value&&(this.nameAnchor=t.target.value,e.index.showLoading({title:"正在验证主播",mask:!0}),e.index.request({url:"https://python.yolojt.com/api/"+this.nameAnchor,success:t=>{200===t.data.code?(e.index.hideLoading(),e.index.showToast({title:"查询成功",icon:"none",duration:3e3}),this.AnchorProfilePicture=t.data.data):(e.index.hideLoading(),e.index.showToast({title:"未查询到该主播",icon:"none",duration:3e3}))},fail:function(t){e.index.hideLoading(),e.index.showToast({title:"网络请求失败",icon:"none",duration:3e3})}}))},async Publish(){if(""===this.nameAnchor||0===this.genders||""===this.numberCoins||""===this.countrys||""===this.datetimesingle||""===this.session||""===this.AnchorProfilePicture)return void(this.Hint=!0);if(this.remarks.includes(this.nameAnchor))return void e.index.showToast({title:"备注中不能包含主播昵称",icon:"none",duration:2e3});const t=this.datetimesingle.replace(" ","T"),i=Date.parse(t);if(isNaN(i))throw new Error(`Invalid date format: ${this.datetimesingle}`);this.sendingTime=Math.floor(i/1e3);const s=Math.floor(Date.now()/1e3);if(this.sendingTime"./uni_modules/wht-select/components/wht-select/wht-select.js")+(()=>"./uni_modules/uni-number-box/components/uni-number-box/uni-number-box.js")+(()=>"./uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js")+(()=>"./uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js")+(()=>"./uni_modules/uni-popup/components/uni-popup/uni-popup.js"))();const s=e._export_sfc(i,[["render",function(t,n,i,s,o,r){return e.e({a:o.Display},o.Display?e.e({b:e.o((e=>r.open())),c:e.o(((...e)=>t.NameAnchor&&t.NameAnchor(...e))),d:e.o(((...e)=>r.blur&&r.blur(...e))),e:o.nameAnchor,f:""===o.nameAnchor&&!0===o.Hint},(""===o.nameAnchor&&o.Hint,{}),{g:e.o(((...e)=>r.chooseMyStreamer&&r.chooseMyStreamer(...e))),h:e.o(r.country),i:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:o.Country,filterable:o.filterable,placeholder:"请选择国家",value:o.countrys}),j:""===o.countrys&&!0===o.Hint},(""===o.countrys&&o.Hint,{}),{k:e.o(r.gender),l:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:o.Gender,placeholder:"性别",value:o.genders}),m:0===o.genders},(o.genders,{}),{n:1===o.genders},(o.genders,{}),{o:2===o.genders},(o.genders,{}),{p:0===o.genders&&!0===o.Hint},(0===o.genders&&o.Hint,{}),{q:e.o((e=>o.numberCoins=e)),r:e.p({max:9999999999,background:"#03ABA8",modelValue:o.numberCoins}),s:""===o.numberCoins&&!0===o.Hint},(""===o.numberCoins&&o.Hint,{}),{t:e.o((e=>o.datetimesingle=e)),v:e.p({type:"datetime","hide-second":"true",modelValue:o.datetimesingle}),w:""===o.datetimesingle&&!0===o.Hint},(""===o.datetimesingle&&o.Hint,{}),{x:e.o((e=>o.session=e)),y:e.p({background:"#03ABA8",modelValue:o.session}),z:""===o.session&&!0===o.Hint},(""===o.session&&o.Hint,{}),{A:e.o((e=>o.remarks=e)),B:e.p({type:"textarea",placeholder:"备注",maxlength:50,modelValue:o.remarks}),C:e.o((e=>r.Publish())),D:e.o((()=>{})),E:e.n(o.Display?"create-module":"close-animation "),F:e.o((e=>r.open()))}):{},{G:0!==o.AnchorList.length},0!==o.AnchorList.length?{H:e.f(o.AnchorList,((t,n,i)=>({a:t.headerIcon,b:e.t(t.anchorId),c:e.t(t.country),d:e.o((e=>r.Select(t.id,t)),n),e:o.selectedId===t.id?"#b8ff8c74":"#ffffff",f:n})))}:{},{I:0===o.AnchorList.length},(o.AnchorList.length,{}),{J:e.o((e=>r.invite())),K:e.o((e=>r.close())),L:e.sr("popup","1cddacd5-6"),M:e.p({type:"center","border-radius":"10px 10px 0 0"})})}],["__scopeId","data-v-1cddacd5"]]);exports.MiniProgramPage=s;
diff --git a/unpackage/dist/build/mp-weixin/common/vendor.js b/unpackage/dist/build/mp-weixin/common/vendor.js
index 183ad91..6a6172a 100644
--- a/unpackage/dist/build/mp-weixin/common/vendor.js
+++ b/unpackage/dist/build/mp-weixin/common/vendor.js
@@ -4,30 +4,16 @@
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
-function e(e,t){const n=new Set(e.split(","));return t?e=>n.has(e.toLowerCase()):e=>n.has(e)}const t={},n=[],i=()=>{},o=()=>!1,s=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),a=e=>e.startsWith("onUpdate:"),r=Object.assign,c=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},u=Object.prototype.hasOwnProperty,l=(e,t)=>u.call(e,t),d=Array.isArray,p=e=>"[object Map]"===I(e),h=e=>"[object Set]"===I(e),g=e=>"function"==typeof e,f=e=>"string"==typeof e,m=e=>"symbol"==typeof e,_=e=>null!==e&&"object"==typeof e,v=e=>(_(e)||g(e))&&g(e.then)&&g(e.catch),y=Object.prototype.toString,I=e=>y.call(e),M=e=>"[object Object]"===I(e),C=e=>f(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,S=e(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),E=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},T=/-(\w)/g,k=E((e=>e.replace(T,((e,t)=>t?t.toUpperCase():"")))),D=/\B([A-Z])/g,R=E((e=>e.replace(D,"-$1").toLowerCase())),O=E((e=>e.charAt(0).toUpperCase()+e.slice(1))),b=E((e=>e?`on${O(e)}`:"")),A=(e,t)=>!Object.is(e,t),L=(e,t)=>{for(let n=0;n{const t=parseFloat(e);return isNaN(t)?e:t};function N(e){if(d(e)){const t={};for(let n=0;n{if(e){const n=e.split(U);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function F(e){let t="";if(f(e))t=e;else if(d(e))for(let n=0;nt&&t.__v_isRef?B(e,t.value):p(t)?{[`Map(${t.size})`]:[...t.entries()].reduce(((e,[t,n],i)=>(e[q(t,i)+" =>"]=n,e)),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map((e=>q(e)))}:m(t)?q(t):!_(t)||d(t)||M(t)?t:String(t),q=(e,t="")=>{var n;return m(e)?`Symbol(${null!=(n=e.description)?n:t})`:e},V="onShow",j="onHide",H="onLaunch",K="onError",z="onThemeChange",W="onPageNotFound",Y="onUnhandledRejection",$="onLoad",J="onReady",X="onUnload",Q="onInit",Z="onSaveExitState",ee="onResize",te="onBackPress",ne="onPageScroll",ie="onTabItemTap",oe="onReachBottom",se="onPullDownRefresh",ae="onShareTimeline",re="onShareChat",ce="onAddToFavorites",ue="onShareAppMessage",le="onNavigationBarButtonTap",de="onNavigationBarSearchInputClicked",pe="onNavigationBarSearchInputChanged",he="onNavigationBarSearchInputConfirmed",ge="onNavigationBarSearchInputFocusChanged",fe="virtualHostId";function me(e,t=null){let n;return(...i)=>(e&&(n=e.apply(t,i),e=null),n)}function _e(e,t){if(!f(t))return;const n=(t=t.replace(/\[(\d+)\]/g,".$1")).split(".");let i=n[0];return e||(e={}),1===n.length?e[i]:_e(e[i],n.slice(1).join("."))}function ve(e){let t={};return M(e)&&Object.keys(e).sort().forEach((n=>{const i=n;t[i]=e[i]})),Object.keys(t)?t:e}const ye=/:/g;const Ie=encodeURIComponent;function Me(e,t=Ie){const n=e?Object.keys(e).map((n=>{let i=e[n];return void 0===typeof i||null===i?i="":M(i)&&(i=JSON.stringify(i)),t(n)+"="+t(i)})).filter((e=>e.length>0)).join("&"):null;return n?`?${n}`:""}const Ce=[Q,$,V,j,X,te,ne,ie,oe,se,ae,ue,re,ce,Z,le,de,pe,he,ge];const Se=[V,j,H,K,z,W,Y,"onExit",Q,$,J,X,ee,te,ne,ie,oe,se,ae,ce,ue,re,Z,le,de,pe,he,ge],Ee=(()=>({onPageScroll:1,onShareAppMessage:2,onShareTimeline:4}))();function Te(e,t,n=!0){return!(n&&!g(t))&&(Se.indexOf(e)>-1||0===e.indexOf("on"))}let ke;const De=[];const Re=me(((e,t)=>t(e))),Oe=function(){};Oe.prototype={_id:1,on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n,_id:this._id}),this._id++},once:function(e,t,n){var i=this;function o(){i.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,o=n.length;i=0;s--)if(i[s].fn===t||i[s].fn._===t||i[s]._id===t){i.splice(s,1);break}o=i}return o.length?n[e]=o:delete n[e],this}};var be=Oe;const Ae=["{","}"];const Le=/^(?:\d)+/,Pe=/^(?:\w)+/;const Ne="zh-Hans",we="zh-Hant",Ue="en",Ge=Object.prototype.hasOwnProperty,xe=(e,t)=>Ge.call(e,t),Fe=new class{constructor(){this._caches=Object.create(null)}interpolate(e,t,n=Ae){if(!t)return[e];let i=this._caches[e];return i||(i=function(e,[t,n]){const i=[];let o=0,s="";for(;o-1?Ne:e.indexOf("-hant")>-1?we:(n=e,["-tw","-hk","-mo","-cht"].find((e=>-1!==n.indexOf(e)))?we:Ne);var n;let i=[Ue,"fr","es"];t&&Object.keys(t).length>0&&(i=Object.keys(t));const o=function(e,t){return t.find((t=>0===e.indexOf(t)))}(e,i);return o||void 0}class qe{constructor({locale:e,fallbackLocale:t,messages:n,watcher:i,formater:o}){this.locale=Ue,this.fallbackLocale=Ue,this.message={},this.messages={},this.watchers=[],t&&(this.fallbackLocale=t),this.formater=o||Fe,this.messages=n||{},this.setLocale(e||Ue),i&&this.watchLocale(i)}setLocale(e){const t=this.locale;this.locale=Be(e,this.messages)||this.fallbackLocale,this.messages[this.locale]||(this.messages[this.locale]={}),this.message=this.messages[this.locale],t!==this.locale&&this.watchers.forEach((e=>{e(this.locale,t)}))}getLocale(){return this.locale}watchLocale(e){const t=this.watchers.push(e)-1;return()=>{this.watchers.splice(t,1)}}add(e,t,n=!0){const i=this.messages[e];i?n?Object.assign(i,t):Object.keys(t).forEach((e=>{xe(i,e)||(i[e]=t[e])})):this.messages[e]=t}f(e,t,n){return this.formater.interpolate(e,t,n).join("")}t(e,t,n){let i=this.message;return"string"==typeof t?(t=Be(t,this.messages))&&(i=this.messages[t]):n=t,xe(i,e)?this.formater.interpolate(i[e],n).join(""):(console.warn(`Cannot translate the value of keypath ${e}. Use the value of keypath as default.`),e)}}function Ve(e){return function(){try{return e.apply(e,arguments)}catch(Yr){console.error(Yr)}}}let je=1;const He={};function Ke(e,t,n){if("number"==typeof e){const i=He[e];if(i)return i.keepAlive||delete He[e],i.callback(t,n)}return t}const ze="success",We="fail",Ye="complete";function $e(e,t={},{beforeAll:n,beforeSuccess:i}={}){M(t)||(t={});const{success:o,fail:s,complete:a}=function(e){const t={};for(const n in e){const i=e[n];g(i)&&(t[n]=Ve(i),delete e[n])}return t}(t),r=g(o),c=g(s),u=g(a),l=je++;return function(e,t,n,i=!1){He[e]={name:t,keepAlive:i,callback:n}}(l,e,(l=>{(l=l||{}).errMsg=function(e,t){return e&&-1!==e.indexOf(":fail")?t+e.substring(e.indexOf(":fail")):t+":ok"}(l.errMsg,e),g(n)&&n(l),l.errMsg===e+":ok"?(g(i)&&i(l,t),r&&o(l)):c&&s(l),u&&a(l)})),l}const Je="success",Xe="fail",Qe="complete",Ze={},et={};function nt(e,t){return function(n){return e(n,t)||n}}function it(e,t,n){let i=!1;for(let o=0;oe(t),catch(){}}}function ot(e,t={}){return[Je,Xe,Qe].forEach((n=>{const i=e[n];if(!d(i))return;const o=t[n];t[n]=function(e){it(i,e,t).then((e=>g(o)&&o(e)||e))}})),t}function st(e,t){const n=[];d(Ze.returnValue)&&n.push(...Ze.returnValue);const i=et[e];return i&&d(i.returnValue)&&n.push(...i.returnValue),n.forEach((e=>{t=e(t)||t})),t}function at(e){const t=Object.create(null);Object.keys(Ze).forEach((e=>{"returnValue"!==e&&(t[e]=Ze[e].slice())}));const n=et[e];return n&&Object.keys(n).forEach((e=>{"returnValue"!==e&&(t[e]=(t[e]||[]).concat(n[e]))})),t}function rt(e,t,n,i){const o=at(e);if(o&&Object.keys(o).length){if(d(o.invoke)){return it(o.invoke,n).then((n=>t(ot(at(e),n),...i)))}return t(ot(o,n),...i)}return t(n,...i)}function ct(e,t){return(n={},...i)=>function(e){return!(!M(e)||![ze,We,Ye].find((t=>g(e[t]))))}(n)?st(e,rt(e,t,r({},n),i)):st(e,new Promise(((o,s)=>{rt(e,t,r({},n,{success:o,fail:s}),i)})))}function ut(e,t,n,i={}){const o=t+":fail";let s="";return s=n?0===n.indexOf(o)?n:o+" "+n:o,delete i.errCode,Ke(e,r({errMsg:s},i))}function lt(e,t,n,i){const o=function(e){e[0]}(t);if(o)return o}function dt(e,t,n,i){return n=>{const o=$e(e,n,i),s=lt(0,[n]);return s?ut(o,e,s):t(n,{resolve:t=>function(e,t,n){return Ke(e,r(n||{},{errMsg:t+":ok"}))}(o,e,t),reject:(t,n)=>ut(o,e,function(e){return!e||f(e)?e:e.stack?("undefined"!=typeof globalThis&&globalThis.harmonyChannel||console.error(e.message+"\n"+e.stack),e.message):e}(t),n)})}}function pt(e,t,n,i){return function(e,t){return(...e)=>{const n=lt(0,e);if(n)throw new Error(n);return t.apply(null,e)}}(0,t)}let ht=!1,gt=0,ft=0;const mt=pt(0,((e,t)=>{if(0===gt&&function(){var e,t;let n,i,o;{const s=(null===(e=wx.getWindowInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync(),a=(null===(t=wx.getDeviceInfo)||void 0===t?void 0:t.call(wx))||wx.getSystemInfoSync();n=s.windowWidth,i=s.pixelRatio,o=a.platform}gt=n,ft=i,ht="ios"===o}(),0===(e=Number(e)))return 0;let n=e/750*(t||gt);return n<0&&(n=-n),n=Math.floor(n+1e-4),0===n&&(n=1!==ft&&ht?.5:1),e<0?-n:n}));function _t(e,t){Object.keys(t).forEach((n=>{g(t[n])&&(e[n]=function(e,t){const n=t?e?e.concat(t):d(t)?t:[t]:e;return n?function(e){const t=[];for(let n=0;n{const i=e[n],o=t[n];d(i)&&g(o)&&c(i,o)}))}const yt=pt(0,((e,t)=>{f(e)&&M(t)?_t(et[e]||(et[e]={}),t):M(e)&&_t(Ze,e)})),It=pt(0,((e,t)=>{f(e)?M(t)?vt(et[e],t):delete et[e]:M(e)&&vt(Ze,e)}));const Mt=new class{constructor(){this.$emitter=new be}on(e,t){return this.$emitter.on(e,t)}once(e,t){return this.$emitter.once(e,t)}off(e,t){e?this.$emitter.off(e,t):this.$emitter.e={}}emit(e,...t){this.$emitter.emit(e,...t)}},Ct=pt(0,((e,t)=>(Mt.on(e,t),()=>Mt.off(e,t)))),St=pt(0,((e,t)=>(Mt.once(e,t),()=>Mt.off(e,t)))),Et=pt(0,((e,t)=>{d(e)||(e=e?[e]:[]),e.forEach((e=>{Mt.off(e,t)}))})),Tt=pt(0,((e,...t)=>{Mt.emit(e,...t)}));let kt,Dt,Rt;function Ot(e){try{return JSON.parse(e)}catch(Yr){}return e}const bt=[];function At(e,t){bt.forEach((n=>{n(e,t)})),bt.length=0}const Lt=ct(Pt="getPushClientId",function(e,t,n,i){return dt(e,t,0,i)}(Pt,((e,{resolve:t,reject:n})=>{Promise.resolve().then((()=>{void 0===Rt&&(Rt=!1,kt="",Dt="uniPush is not enabled"),bt.push(((e,i)=>{e?t({cid:e}):n(i)})),void 0!==kt&&At(kt,Dt)}))}),0,Nt));var Pt,Nt;const wt=[],Ut=/^\$|__f__|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|rpx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/,Gt=/^create|Manager$/,xt=["createBLEConnection"],Ft=["request","downloadFile","uploadFile","connectSocket"],Bt=["createBLEConnection"],qt=/^on|^off/;function Vt(e){return Gt.test(e)&&-1===xt.indexOf(e)}function jt(e){return Ut.test(e)&&-1===Bt.indexOf(e)}function Ht(e){return-1!==Ft.indexOf(e)}function Kt(e){return!(Vt(e)||jt(e)||function(e){return qt.test(e)&&"onPush"!==e}(e))}function zt(e,t){return Kt(e)&&g(t)?function(n={},...i){return g(n.success)||g(n.fail)||g(n.complete)?st(e,rt(e,t,r({},n),i)):st(e,new Promise(((o,s)=>{rt(e,t,r({},n,{success:o,fail:s}),i)})))}:t}Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e&&e()).then((()=>n))),(n=>t.resolve(e&&e()).then((()=>{throw n}))))});const Wt=["success","fail","cancel","complete"];const Yt=()=>{const e=g(getApp)&&getApp({allowDefault:!0});return e&&e.$vm?e.$vm.$locale:function(){var e;let t="";{const n=(null===(e=wx.getAppBaseInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync();t=Be(n&&n.language?n.language:Ue)||Ue}return t}()},$t=[];"undefined"!=typeof global&&(global.getLocale=Yt);const Jt="__DC_STAT_UUID";let Xt;function Qt(e=wx){return function(t,n){Xt=Xt||e.getStorageSync(Jt),Xt||(Xt=Date.now()+""+Math.floor(1e7*Math.random()),wx.setStorage({key:Jt,data:Xt})),n.deviceId=Xt}}function Zt(e,t){if(e.safeArea){const n=e.safeArea;t.safeAreaInsets={top:n.top,left:n.left,right:e.windowWidth-n.right,bottom:e.screenHeight-n.bottom}}}function en(e,t){let n="",i="";switch(n=e.split(" ")[0]||t,i=e.split(" ")[1]||"",n=n.toLowerCase(),n){case"harmony":case"ohos":case"openharmony":n="harmonyos";break;case"iphone os":n="ios";break;case"mac":case"darwin":n="macos";break;case"windows_nt":n="windows"}return{osName:n,osVersion:i}}function tn(e,t){let n=e.deviceType||"phone";{const e={ipad:"pad",windows:"pc",mac:"pc"},i=Object.keys(e),o=t.toLowerCase();for(let t=0;t{Zt(e,t),Qt()(e,t),function(e,t){const{brand:n="",model:i="",system:o="",language:s="",theme:a,version:c,platform:u,fontSizeSetting:l,SDKVersion:d,pixelRatio:p,deviceOrientation:h}=e,{osName:g,osVersion:f}=en(o,u);let m=c,_=tn(e,i),v=nn(n),y=sn(e),I=h,M=p,C=d;const S=(s||"").replace(/_/g,"-"),E={appId:"__UNI__A6CDB98",appName:"tk-mini-program",appVersion:"1.0.0",appVersionCode:"100",appLanguage:on(S),uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75",uniPlatform:"mp-weixin",deviceBrand:v,deviceModel:i,deviceType:_,devicePixelRatio:M,deviceOrientation:I,osName:g,osVersion:f,hostTheme:a,hostVersion:m,hostLanguage:S,hostName:y,hostSDKVersion:C,hostFontSizeSetting:l,windowTop:0,windowBottom:0,osLanguage:void 0,osTheme:void 0,ua:void 0,hostPackageName:void 0,browserName:void 0,browserVersion:void 0,isUniAppX:!1};r(t,E)}(e,t)}},rn=an,cn={args(e,t){let n=parseInt(e.current);if(isNaN(n))return;const i=e.urls;if(!d(i))return;const o=i.length;return o?(n<0?n=0:n>=o&&(n=o-1),n>0?(t.current=i[n],t.urls=i.filter(((e,t)=>!(t{const{brand:n,model:i,system:o="",platform:s=""}=e;let a=tn(e,i),c=nn(n);Qt()(e,t);const{osName:u,osVersion:l}=en(o,s);t=ve(r(t,{deviceType:a,deviceBrand:c,deviceModel:i,osName:u,osVersion:l}))}},dn={returnValue:(e,t)=>{const{version:n,language:i,SDKVersion:o,theme:s}=e;let a=sn(e),c=(i||"").replace(/_/g,"-");const u={hostVersion:n,hostLanguage:c,hostName:a,hostSDKVersion:o,hostTheme:s,appId:"__UNI__A6CDB98",appName:"tk-mini-program",appVersion:"1.0.0",appVersionCode:"100",appLanguage:on(c),isUniAppX:!1,uniPlatform:"mp-weixin",uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75"};r(t,u)}},pn={returnValue:(e,t)=>{Zt(e,t),t=ve(r(t,{windowTop:0,windowBottom:0}))}},hn={args(e){const t=getApp({allowDefault:!0})||{};t.$vm?Zo(K,e,t.$vm.$):(wx.$onErrorHandlers||(wx.$onErrorHandlers=[]),wx.$onErrorHandlers.push(e))}},gn={args(e){const t=getApp({allowDefault:!0})||{};if(t.$vm){if(e.__weh){const n=t.$vm.$[K];if(n){const t=n.indexOf(e.__weh);t>-1&&n.splice(t,1)}}}else{if(!wx.$onErrorHandlers)return;const t=wx.$onErrorHandlers.findIndex((t=>t===e));-1!==t&&wx.$onErrorHandlers.splice(t,1)}}},fn={args(){if(wx.__uni_console__){if(wx.__uni_console_warned__)return;wx.__uni_console_warned__=!0,console.warn("开发模式下小程序日志回显会使用 socket 连接,为了避免冲突,建议使用 SocketTask 的方式去管理 WebSocket 或手动关闭日志回显功能。[详情](https://uniapp.dcloud.net.cn/tutorial/run/mp-log.html)")}}},mn=fn,_n={$on:Ct,$off:Et,$once:St,$emit:Tt,upx2px:mt,rpx2px:mt,interceptors:{},addInterceptor:yt,removeInterceptor:It,onCreateVueApp:function(e){if(ke)return e(ke);De.push(e)},invokeCreateVueAppHook:function(e){ke=e,De.forEach((t=>t(e)))},getLocale:Yt,setLocale:e=>{const t=g(getApp)&&getApp();if(!t)return!1;return t.$vm.$locale!==e&&(t.$vm.$locale=e,$t.forEach((t=>t({locale:e}))),!0)},onLocaleChange:e=>{-1===$t.indexOf(e)&&$t.push(e)},getPushClientId:Lt,onPushMessage:e=>{-1===wt.indexOf(e)&&wt.push(e)},offPushMessage:e=>{if(e){const t=wt.indexOf(e);t>-1&&wt.splice(t,1)}else wt.length=0},invokePushCallback:function(e){if("enabled"===e.type)Rt=!0;else if("clientId"===e.type)kt=e.cid,Dt=e.errMsg,At(kt,e.errMsg);else if("pushMsg"===e.type){const t={type:"receive",data:Ot(e.message)};for(let e=0;e{t({type:"click",data:Ot(e.message)})}))},__f__:function(e,t,...n){t&&n.push(t),console[e].apply(console,n)}};const vn=["qy","env","error","version","lanDebug","cloud","serviceMarket","router","worklet","__webpack_require_UNI_MP_PLUGIN__"],yn=["lanDebug","router","worklet"],In=wx.getLaunchOptionsSync?wx.getLaunchOptionsSync():null;function Mn(e){return(!In||1154!==In.scene||!yn.includes(e))&&(vn.indexOf(e)>-1||"function"==typeof wx[e])}function Cn(){const e={};for(const t in wx)Mn(t)&&(e[t]=wx[t]);return"undefined"!=typeof globalThis&&"undefined"==typeof requireMiniProgram&&(globalThis.wx=e),e}const Sn=["__route__","__wxExparserNodeId__","__wxWebviewId__"],En=(Tn={oauth:["weixin"],share:["weixin"],payment:["wxpay"],push:["weixin"]},function({service:e,success:t,fail:n,complete:i}){let o;Tn[e]?(o={errMsg:"getProvider:ok",service:e,provider:Tn[e]},g(t)&&t(o)):(o={errMsg:"getProvider:fail:服务["+e+"]不存在"},g(n)&&n(o)),g(i)&&i(o)});var Tn;const kn=Cn();kn.canIUse("getAppBaseInfo")||(kn.getAppBaseInfo=kn.getSystemInfoSync),kn.canIUse("getWindowInfo")||(kn.getWindowInfo=kn.getSystemInfoSync),kn.canIUse("getDeviceInfo")||(kn.getDeviceInfo=kn.getSystemInfoSync);let Dn=kn.getAppBaseInfo&&kn.getAppBaseInfo();Dn||(Dn=kn.getSystemInfoSync());const Rn=Dn?Dn.host:null,On=Rn&&"SAAASDK"===Rn.env?kn.miniapp.shareVideoMessage:kn.shareVideoMessage;var bn=Object.freeze({__proto__:null,createSelectorQuery:function(){const e=kn.createSelectorQuery(),t=e.in;return e.in=function(e){return e.$scope?t.call(this,e.$scope):t.call(this,function(e){const t=Object.create(null);return Sn.forEach((n=>{t[n]=e[n]})),t}(e))},e},getProvider:En,shareVideoMessage:On});const An={args(e,t){e.compressedHeight&&!t.compressHeight&&(t.compressHeight=e.compressedHeight),e.compressedWidth&&!t.compressWidth&&(t.compressWidth=e.compressedWidth)}};var Ln=Object.freeze({__proto__:null,compressImage:An,getAppAuthorizeSetting:{returnValue:function(e,t){const{locationReducedAccuracy:n}=e;t.locationAccuracy="unsupported",!0===n?t.locationAccuracy="reduced":!1===n&&(t.locationAccuracy="full")}},getAppBaseInfo:dn,getDeviceInfo:ln,getSystemInfo:an,getSystemInfoSync:rn,getWindowInfo:pn,offError:gn,onError:hn,onSocketMessage:mn,onSocketOpen:fn,previewImage:cn,redirectTo:{},showActionSheet:un});const Pn=Cn();var Nn=function(e,t,n=wx){const i=function(e){function t(e,t,n){return function(o){return t(i(e,o,n))}}function n(e,n,i={},o={},s=!1){if(M(n)){const a=!0===s?n:{};g(i)&&(i=i(n,a)||{});for(const r in n)if(l(i,r)){let t=i[r];g(t)&&(t=t(n[r],n,a)),t?f(t)?a[t]=n[r]:M(t)&&(a[t.name?t.name:r]=t.value):console.warn(`微信小程序 ${e} 暂不支持 ${r}`)}else if(-1!==Wt.indexOf(r)){const i=n[r];g(i)&&(a[r]=t(e,i,o))}else s||l(a,r)||(a[r]=n[r]);return a}return g(n)&&(g(i)&&i(n,{}),n=t(e,n,o)),n}function i(t,i,o,s=!1){return g(e.returnValue)&&(i=e.returnValue(t,i)),n(t,i,o,{},s||!1)}return function(t,o){const s=l(e,t);if(!s&&"function"!=typeof wx[t])return o;const a=s||g(e.returnValue)||Vt(t)||Ht(t),r=s||g(o);if(!s&&!o)return function(){console.error(`微信小程序 暂不支持${t}`)};if(!a||!r)return o;const c=e[t];return function(e,o){let s=c||{};g(c)&&(s=c(e));const a=[e=n(t,e,s.args,s.returnValue)];void 0!==o&&a.push(o);const r=wx[s.name||t].apply(wx,a);return(Vt(t)||Ht(t))&&r&&!r.__v_skip&&(r.__v_skip=!0),jt(t)?i(t,r,s.returnValue,Vt(t)):r}}}(t);return new Proxy({},{get:(t,o)=>l(t,o)?t[o]:l(e,o)?zt(o,e[o]):l(_n,o)?zt(o,_n[o]):zt(o,i(o,n[o]))})}(bn,Ln,Pn);let wn,Un;class Gn{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=wn,!e&&wn&&(this.index=(wn.scopes||(wn.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=wn;try{return wn=this,e()}finally{wn=t}}}on(){wn=this}off(){wn=this.parent}stop(e){if(this._active){let t,n;for(t=0,n=this.effects.length;t=4))break}1===this._dirtyLevel&&(this._dirtyLevel=0),Yn()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=Hn,t=Un;try{return Hn=!0,Un=this,this._runnings++,qn(this),this.fn()}finally{Vn(this),this._runnings--,Un=t,Hn=e}}stop(){var e;this.active&&(qn(this),Vn(this),null==(e=this.onStop)||e.call(this),this.active=!1)}}function qn(e){e._trackId++,e._depsLength=0}function Vn(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t{const n=new Map;return n.cleanup=e,n.computed=t,n},ti=new WeakMap,ni=Symbol(""),ii=Symbol("");function oi(e,t,n){if(Hn&&Un){let t=ti.get(e);t||ti.set(e,t=new Map);let i=t.get(n);i||t.set(n,i=ei((()=>t.delete(n)))),Xn(Un,i)}}function si(e,t,n,i,o,s){const a=ti.get(e);if(!a)return;let r=[];if("clear"===t)r=[...a.values()];else if("length"===n&&d(e)){const e=Number(i);a.forEach(((t,n)=>{("length"===n||!m(n)&&n>=e)&&r.push(t)}))}else switch(void 0!==n&&r.push(a.get(n)),t){case"add":d(e)?C(n)&&r.push(a.get("length")):(r.push(a.get(ni)),p(e)&&r.push(a.get(ii)));break;case"delete":d(e)||(r.push(a.get(ni)),p(e)&&r.push(a.get(ii)));break;case"set":p(e)&&r.push(a.get(ni))}$n();for(const c of r)c&&Zn(c,4);Jn()}const ai=e("__proto__,__v_isRef,__isVue"),ri=new Set(Object.getOwnPropertyNames(Symbol).filter((e=>"arguments"!==e&&"caller"!==e)).map((e=>Symbol[e])).filter(m)),ci=ui();function ui(){const e={};return["includes","indexOf","lastIndexOf"].forEach((t=>{e[t]=function(...e){const n=$i(this);for(let t=0,o=this.length;t{e[t]=function(...e){Wn(),$n();const n=$i(this)[t].apply(this,e);return Jn(),Yn(),n}})),e}function li(e){const t=$i(this);return oi(t,0,e),t.hasOwnProperty(e)}class di{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){const i=this._isReadonly,o=this._isShallow;if("__v_isReactive"===t)return!i;if("__v_isReadonly"===t)return i;if("__v_isShallow"===t)return o;if("__v_raw"===t)return n===(i?o?qi:Bi:o?Fi:xi).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const s=d(e);if(!i){if(s&&l(ci,t))return Reflect.get(ci,t,n);if("hasOwnProperty"===t)return li}const a=Reflect.get(e,t,n);return(m(t)?ri.has(t):ai(t))?a:(i||oi(e,0,t),o?a:no(a)?s&&C(t)?a:a.value:_(a)?i?Hi(a):ji(a):a)}}class pi extends di{constructor(e=!1){super(!1,e)}set(e,t,n,i){let o=e[t];if(!this._isShallow){const t=Wi(o);if(Yi(n)||Wi(n)||(o=$i(o),n=$i(n)),!d(e)&&no(o)&&!no(n))return!t&&(o.value=n,!0)}const s=d(e)&&C(t)?Number(t)e,vi=e=>Reflect.getPrototypeOf(e);function yi(e,t,n=!1,i=!1){const o=$i(e=e.__v_raw),s=$i(t);n||(A(t,s)&&oi(o,0,t),oi(o,0,s));const{has:a}=vi(o),r=i?_i:n?Qi:Xi;return a.call(o,t)?r(e.get(t)):a.call(o,s)?r(e.get(s)):void(e!==o&&e.get(t))}function Ii(e,t=!1){const n=this.__v_raw,i=$i(n),o=$i(e);return t||(A(e,o)&&oi(i,0,e),oi(i,0,o)),e===o?n.has(e):n.has(e)||n.has(o)}function Mi(e,t=!1){return e=e.__v_raw,!t&&oi($i(e),0,ni),Reflect.get(e,"size",e)}function Ci(e){e=$i(e);const t=$i(this);return vi(t).has.call(t,e)||(t.add(e),si(t,"add",e,e)),this}function Si(e,t){t=$i(t);const n=$i(this),{has:i,get:o}=vi(n);let s=i.call(n,e);s||(e=$i(e),s=i.call(n,e));const a=o.call(n,e);return n.set(e,t),s?A(t,a)&&si(n,"set",e,t):si(n,"add",e,t),this}function Ei(e){const t=$i(this),{has:n,get:i}=vi(t);let o=n.call(t,e);o||(e=$i(e),o=n.call(t,e)),i&&i.call(t,e);const s=t.delete(e);return o&&si(t,"delete",e,void 0),s}function Ti(){const e=$i(this),t=0!==e.size,n=e.clear();return t&&si(e,"clear",void 0,void 0),n}function ki(e,t){return function(n,i){const o=this,s=o.__v_raw,a=$i(s),r=t?_i:e?Qi:Xi;return!e&&oi(a,0,ni),s.forEach(((e,t)=>n.call(i,r(e),r(t),o)))}}function Di(e,t,n){return function(...i){const o=this.__v_raw,s=$i(o),a=p(s),r="entries"===e||e===Symbol.iterator&&a,c="keys"===e&&a,u=o[e](...i),l=n?_i:t?Qi:Xi;return!t&&oi(s,0,c?ii:ni),{next(){const{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:r?[l(e[0]),l(e[1])]:l(e),done:t}},[Symbol.iterator](){return this}}}}function Ri(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}function Oi(){const e={get(e){return yi(this,e)},get size(){return Mi(this)},has:Ii,add:Ci,set:Si,delete:Ei,clear:Ti,forEach:ki(!1,!1)},t={get(e){return yi(this,e,!1,!0)},get size(){return Mi(this)},has:Ii,add:Ci,set:Si,delete:Ei,clear:Ti,forEach:ki(!1,!0)},n={get(e){return yi(this,e,!0)},get size(){return Mi(this,!0)},has(e){return Ii.call(this,e,!0)},add:Ri("add"),set:Ri("set"),delete:Ri("delete"),clear:Ri("clear"),forEach:ki(!0,!1)},i={get(e){return yi(this,e,!0,!0)},get size(){return Mi(this,!0)},has(e){return Ii.call(this,e,!0)},add:Ri("add"),set:Ri("set"),delete:Ri("delete"),clear:Ri("clear"),forEach:ki(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((o=>{e[o]=Di(o,!1,!1),n[o]=Di(o,!0,!1),t[o]=Di(o,!1,!0),i[o]=Di(o,!0,!0)})),[e,n,t,i]}const[bi,Ai,Li,Pi]=Oi();function Ni(e,t){const n=t?e?Pi:Li:e?Ai:bi;return(t,i,o)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(l(n,i)&&i in t?n:t,i,o)}const wi={get:Ni(!1,!1)},Ui={get:Ni(!1,!0)},Gi={get:Ni(!0,!1)},xi=new WeakMap,Fi=new WeakMap,Bi=new WeakMap,qi=new WeakMap;function Vi(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((e=>I(e).slice(8,-1))(e))}function ji(e){return Wi(e)?e:Ki(e,!1,gi,wi,xi)}function Hi(e){return Ki(e,!0,fi,Gi,Bi)}function Ki(e,t,n,i,o){if(!_(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const s=o.get(e);if(s)return s;const a=Vi(e);if(0===a)return e;const r=new Proxy(e,2===a?i:n);return o.set(e,r),r}function zi(e){return Wi(e)?zi(e.__v_raw):!(!e||!e.__v_isReactive)}function Wi(e){return!(!e||!e.__v_isReadonly)}function Yi(e){return!(!e||!e.__v_isShallow)}function $i(e){const t=e&&e.__v_raw;return t?$i(t):e}function Ji(e){return Object.isExtensible(e)&&((e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})})(e,"__v_skip",!0),e}const Xi=e=>_(e)?ji(e):e,Qi=e=>_(e)?Hi(e):e;class Zi{constructor(e,t,n,i){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new Bn((()=>e(this._value)),(()=>to(this,2===this.effect._dirtyLevel?2:3))),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=n}get value(){const e=$i(this);return e._cacheable&&!e.effect.dirty||!A(e._value,e._value=e.effect.run())||to(e,4),eo(e),e.effect._dirtyLevel>=2&&to(e,2),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function eo(e){var t;Hn&&Un&&(e=$i(e),Xn(Un,null!=(t=e.dep)?t:e.dep=ei((()=>e.dep=void 0),e instanceof Zi?e:void 0)))}function to(e,t=4,n){const i=(e=$i(e)).dep;i&&Zn(i,t)}function no(e){return!(!e||!0!==e.__v_isRef)}function io(e){return function(e,t){if(no(e))return e;return new oo(e,t)}(e,!1)}class oo{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:$i(e),this._value=t?e:Xi(e)}get value(){return eo(this),this._value}set value(e){const t=this.__v_isShallow||Yi(e)||Wi(e);e=t?e:$i(e),A(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:Xi(e),to(this,4))}}function so(e){return no(e)?e.value:e}const ao={get:(e,t,n)=>so(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const o=e[t];return no(o)&&!no(n)?(o.value=n,!0):Reflect.set(e,t,n,i)}};function ro(e){return zi(e)?e:new Proxy(e,ao)}class co{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0}get value(){const e=this._object[this._key];return void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return e=$i(this._object),t=this._key,null==(n=ti.get(e))?void 0:n.get(t);var e,t,n}}function uo(e,t,n){const i=e[t];return no(i)?i:new co(e,t,n)}function lo(e,t,n,i){try{return i?e(...i):e()}catch(o){ho(o,t,n)}}function po(e,t,n,i){if(g(e)){const o=lo(e,t,n,i);return o&&v(o)&&o.catch((e=>{ho(e,t,n)})),o}const o=[];for(let s=0;s>>1,o=_o[i],s=Oo(o);snull==e.id?1/0:e.id,bo=(e,t)=>{const n=Oo(e)-Oo(t);if(0===n){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function Ao(e){mo=!1,fo=!0,_o.sort(bo);try{for(vo=0;vo<_o.length;vo++){const e=_o[vo];e&&!1!==e.active&&lo(e,null,14)}}finally{vo=0,_o.length=0,function(){if(yo.length){const e=[...new Set(yo)].sort(((e,t)=>Oo(e)-Oo(t)));if(yo.length=0,Io)return void Io.push(...e);for(Io=e,Mo=0;Mof(e)?e.trim():e))),n&&(s=i.map(P))}let c,u=o[c=b(n)]||o[c=b(k(n))];!u&&a&&(u=o[c=b(R(n))]),u&&po(u,e,6,s);const l=o[c+"Once"];if(l){if(e.emitted){if(e.emitted[c])return}else e.emitted={};e.emitted[c]=!0,po(l,e,6,s)}}function Po(e,t,n=!1){const i=t.emitsCache,o=i.get(e);if(void 0!==o)return o;const s=e.emits;let a={},c=!1;if(!g(e)){const i=e=>{const n=Po(e,t,!0);n&&(c=!0,r(a,n))};!n&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}return s||c?(d(s)?s.forEach((e=>a[e]=null)):r(a,s),_(e)&&i.set(e,a),a):(_(e)&&i.set(e,null),null)}function No(e,t){return!(!e||!s(t))&&(t=t.slice(2).replace(/Once$/,""),l(e,t[0].toLowerCase()+t.slice(1))||l(e,R(t))||l(e,t))}let wo=null;function Uo(e){const t=wo;return wo=e,e&&e.type.__scopeId,t}const Go="components";function xo(e,t){return e&&(e[t]||e[k(t)]||e[O(k(t))])}const Fo={};function Bo(e,t,n){return qo(e,t,n)}function qo(e,n,{immediate:o,deep:s,flush:a,once:r,onTrack:u,onTrigger:l}=t){if(n&&r){const e=n;n=(...t)=>{e(...t),T()}}const p=qs,h=e=>!0===s?e:Ho(e,!1===s?1:void 0);let f,m,_=!1,v=!1;if(no(e)?(f=()=>e.value,_=Yi(e)):zi(e)?(f=()=>h(e),_=!0):d(e)?(v=!0,_=e.some((e=>zi(e)||Yi(e))),f=()=>e.map((e=>no(e)?e.value:zi(e)?h(e):g(e)?lo(e,p,2):void 0))):f=g(e)?n?()=>lo(e,p,2):()=>(m&&m(),po(e,p,3,[y])):i,n&&s){const e=f;f=()=>Ho(e())}let y=e=>{m=S.onStop=()=>{lo(e,p,4),m=S.onStop=void 0}},I=v?new Array(e.length).fill(Fo):Fo;const M=()=>{if(S.active&&S.dirty)if(n){const e=S.run();(s||_||(v?e.some(((e,t)=>A(e,I[t]))):A(e,I)))&&(m&&m(),po(n,p,3,[e,I===Fo?void 0:v&&I[0]===Fo?[]:I,y]),I=e)}else S.run()};let C;M.allowRecurse=!!n,"sync"===a?C=M:"post"===a?C=()=>Us(M,p&&p.suspense):(M.pre=!0,p&&(M.id=p.uid),C=()=>To(M));const S=new Bn(f,i,C),E=Fn(),T=()=>{S.stop(),E&&c(E.effects,S)};return n?o?M():I=S.run():"post"===a?Us(S.run.bind(S),p&&p.suspense):S.run(),T}function Vo(e,t,n){const i=this.proxy,o=f(e)?e.includes(".")?jo(i,e):()=>i[e]:e.bind(i,i);let s;g(t)?s=t:(s=t.handler,n=t);const a=Ks(this),r=qo(o,s.bind(i),n);return a(),r}function jo(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e0){if(n>=t)return e;n++}if((i=i||new Set).has(e))return e;if(i.add(e),no(e))Ho(e.value,t,n,i);else if(d(e))for(let o=0;o{Ho(e,t,n,i)}));else if(M(e))for(const o in e)Ho(e[o],t,n,i);return e}function Ko(){return{app:null,config:{isNativeTag:o,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let zo=0;let Wo=null;function Yo(e,t,n=!1){const i=qs||wo;if(i||Wo){const o=i?null==i.parent?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:Wo._context.provides;if(o&&e in o)return o[e];if(arguments.length>1)return n&&g(t)?t.call(i&&i.proxy):t}}function $o(e,t){Xo(e,"a",t)}function Jo(e,t){Xo(e,"da",t)}function Xo(e,t,n=qs){const i=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Zo(t,i,n),n){let e=n.parent;for(;e&&e.parent;)e.parent.vnode.type.__isKeepAlive&&Qo(i,t,n,e),e=e.parent}}function Qo(e,t,n,i){const o=Zo(t,e,i,!0);as((()=>{c(i[t],o)}),n)}function Zo(e,t,n=qs,i=!1){if(n){(function(e){return Ce.indexOf(e)>-1})(e)&&(n=n.root);const o=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;Wn();const o=Ks(n),s=po(t,n,e,i);return o(),Yn(),s});return i?o.unshift(s):o.push(s),s}}const es=e=>(t,n=qs)=>(!Ys||"sp"===e)&&Zo(e,((...e)=>t(...e)),n),ts=es("bm"),ns=es("m"),is=es("bu"),os=es("u"),ss=es("bum"),as=es("um"),rs=es("sp"),cs=es("rtg"),us=es("rtc");function ls(e,t=qs){Zo("ec",e,t)}const ds=e=>e?Ws(e)?Xs(e)||e.proxy:ds(e.parent):null;const ps=r(Object.create(null),{$:function(e){return e},$el:e=>e.__$el||(e.__$el={}),$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ds(e.parent),$root:e=>ds(e.root),$emit:e=>e.emit,$options:e=>Is(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,To(e.update)}),$watch:e=>Vo.bind(e)}),hs=(e,n)=>e!==t&&!e.__isScriptSetup&&l(e,n),gs={get({_:e},n){const{ctx:i,setupState:o,data:s,props:a,accessCache:r,type:c,appContext:u}=e;let d;if("$"!==n[0]){const c=r[n];if(void 0!==c)switch(c){case 1:return o[n];case 2:return s[n];case 4:return i[n];case 3:return a[n]}else{if(hs(o,n))return r[n]=1,o[n];if(s!==t&&l(s,n))return r[n]=2,s[n];if((d=e.propsOptions[0])&&l(d,n))return r[n]=3,a[n];if(i!==t&&l(i,n))return r[n]=4,i[n];ms&&(r[n]=0)}}const p=ps[n];let h,g;return p?("$attrs"===n&&oi(e,0,n),p(e)):(h=c.__cssModules)&&(h=h[n])?h:i!==t&&l(i,n)?(r[n]=4,i[n]):(g=u.config.globalProperties,l(g,n)?g[n]:void 0)},set({_:e},n,i){const{data:o,setupState:s,ctx:a}=e;return hs(s,n)?(s[n]=i,!0):o!==t&&l(o,n)?(o[n]=i,!0):!l(e.props,n)&&(("$"!==n[0]||!(n.slice(1)in e))&&(a[n]=i,!0))},has({_:{data:e,setupState:n,accessCache:i,ctx:o,appContext:s,propsOptions:a}},r){let c;return!!i[r]||e!==t&&l(e,r)||hs(n,r)||(c=a[0])&&l(c,r)||l(o,r)||l(ps,r)||l(s.config.globalProperties,r)},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:l(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function fs(e){return d(e)?e.reduce(((e,t)=>(e[t]=null,e)),{}):e}let ms=!0;function _s(e){const t=Is(e),n=e.proxy,o=e.ctx;ms=!1,t.beforeCreate&&vs(t.beforeCreate,e,"bc");const{data:s,computed:a,methods:r,watch:c,provide:u,inject:l,created:p,beforeMount:h,mounted:f,beforeUpdate:m,updated:v,activated:y,deactivated:I,beforeDestroy:M,beforeUnmount:C,destroyed:S,unmounted:E,render:T,renderTracked:k,renderTriggered:D,errorCaptured:R,serverPrefetch:O,expose:b,inheritAttrs:A,components:L,directives:P,filters:N}=t;if(l&&function(e,t){d(e)&&(e=Es(e));for(const n in e){const i=e[n];let o;o=_(i)?"default"in i?Yo(i.from||n,i.default,!0):Yo(i.from||n):Yo(i),no(o)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>o.value,set:e=>o.value=e}):t[n]=o}}(l,o),r)for(const i in r){const e=r[i];g(e)&&(o[i]=e.bind(n))}if(s){const t=s.call(n,n);_(t)&&(e.data=ji(t))}if(ms=!0,a)for(const d in a){const e=a[d],t=g(e)?e.bind(n,n):g(e.get)?e.get.bind(n,n):i,s=!g(e)&&g(e.set)?e.set.bind(n):i,r=Qs({get:t,set:s});Object.defineProperty(o,d,{enumerable:!0,configurable:!0,get:()=>r.value,set:e=>r.value=e})}if(c)for(const i in c)ys(c[i],o,n,i);function w(e,t){d(t)?t.forEach((t=>e(t.bind(n)))):t&&e(t.bind(n))}if(function(){if(u){const e=g(u)?u.call(n):u;Reflect.ownKeys(e).forEach((t=>{!function(e,t){if(qs){let n=qs.provides;const i=qs.parent&&qs.parent.provides;i===n&&(n=qs.provides=Object.create(i)),n[e]=t,"app"===qs.type.mpType&&qs.appContext.app.provide(e,t)}}(t,e[t])}))}}(),p&&vs(p,e,"c"),w(ts,h),w(ns,f),w(is,m),w(os,v),w($o,y),w(Jo,I),w(ls,R),w(us,k),w(cs,D),w(ss,C),w(as,E),w(rs,O),d(b))if(b.length){const t=e.exposed||(e.exposed={});b.forEach((e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t})}))}else e.exposed||(e.exposed={});T&&e.render===i&&(e.render=T),null!=A&&(e.inheritAttrs=A),L&&(e.components=L),P&&(e.directives=P),e.ctx.$onApplyOptions&&e.ctx.$onApplyOptions(t,e,n)}function vs(e,t,n){po(d(e)?e.map((e=>e.bind(t.proxy))):e.bind(t.proxy),t,n)}function ys(e,t,n,i){const o=i.includes(".")?jo(n,i):()=>n[i];if(f(e)){const n=t[e];g(n)&&Bo(o,n)}else if(g(e))Bo(o,e.bind(n));else if(_(e))if(d(e))e.forEach((e=>ys(e,t,n,i)));else{const i=g(e.handler)?e.handler.bind(n):t[e.handler];g(i)&&Bo(o,i,e)}}function Is(e){const t=e.type,{mixins:n,extends:i}=t,{mixins:o,optionsCache:s,config:{optionMergeStrategies:a}}=e.appContext,r=s.get(t);let c;return r?c=r:o.length||n||i?(c={},o.length&&o.forEach((e=>Ms(c,e,a,!0))),Ms(c,t,a)):c=t,_(t)&&s.set(t,c),c}function Ms(e,t,n,i=!1){const{mixins:o,extends:s}=t;s&&Ms(e,s,n,!0),o&&o.forEach((t=>Ms(e,t,n,!0)));for(const a in t)if(i&&"expose"===a);else{const i=Cs[a]||n&&n[a];e[a]=i?i(e[a],t[a]):t[a]}return e}const Cs={data:Ss,props:Ds,emits:Ds,methods:ks,computed:ks,beforeCreate:Ts,created:Ts,beforeMount:Ts,mounted:Ts,beforeUpdate:Ts,updated:Ts,beforeDestroy:Ts,beforeUnmount:Ts,destroyed:Ts,unmounted:Ts,activated:Ts,deactivated:Ts,errorCaptured:Ts,serverPrefetch:Ts,components:ks,directives:ks,watch:function(e,t){if(!e)return t;if(!t)return e;const n=r(Object.create(null),e);for(const i in t)n[i]=Ts(e[i],t[i]);return n},provide:Ss,inject:function(e,t){return ks(Es(e),Es(t))}};function Ss(e,t){return t?e?function(){return r(g(e)?e.call(this,this):e,g(t)?t.call(this,this):t)}:t:e}function Es(e){if(d(e)){const t={};for(let n=0;n{h=!0;const[t,n]=As(e,i,!0);r(u,t),n&&p.push(...n)};!o&&i.mixins.length&&i.mixins.forEach(t),e.extends&&t(e.extends),e.mixins&&e.mixins.forEach(t)}if(!c&&!h)return _(e)&&s.set(e,n),n;if(d(c))for(let n=0;n-1,i[1]=n<0||t-1||l(i,"default"))&&p.push(e)}}}const f=[u,p];return _(e)&&s.set(e,f),f}function Ls(e){return"$"!==e[0]&&!S(e)}function Ps(e){if(null===e)return"null";if("function"==typeof e)return e.name||"";if("object"==typeof e){return e.constructor&&e.constructor.name||""}return""}function Ns(e,t){return Ps(e)===Ps(t)}function ws(e,t){return d(t)?t.findIndex((t=>Ns(t,e))):g(t)&&Ns(t,e)?0:-1}const Us=Do;function Gs(e){return e?zi(t=e)||Wi(t)||"__vInternal"in e?r({},e):e:null;var t}const xs=Ko();let Fs=0;function Bs(e,n,i){const o=e.type,s=(n?n.appContext:e.appContext)||xs,a={uid:Fs++,vnode:e,type:o,parent:n,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,scope:new Gn(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:n?n.provides:Object.create(s.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:As(o,s),emitsOptions:Po(o,s),emit:null,emitted:null,propsDefaults:t,inheritAttrs:o.inheritAttrs,ctx:t,data:t,props:t,attrs:t,slots:t,refs:t,setupState:t,setupContext:null,attrsProxy:null,slotsProxy:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null,$uniElements:new Map,$templateUniElementRefs:[],$templateUniElementStyles:{},$eS:{},$eA:{}};return a.ctx={_:a},a.root=n?n.root:a,a.emit=Lo.bind(null,a),e.ce&&e.ce(a),a}let qs=null;const Vs=()=>qs||wo;let js,Hs;js=e=>{qs=e},Hs=e=>{Ys=e};const Ks=e=>{const t=qs;return js(e),e.scope.on(),()=>{e.scope.off(),js(t)}},zs=()=>{qs&&qs.scope.off(),js(null)};function Ws(e){return 4&e.vnode.shapeFlag}let Ys=!1;function $s(e,t=!1){t&&Hs(t);const{props:n}=e.vnode,i=Ws(e);Rs(e,n,i,t);const o=i?function(e){const t=e.type;e.accessCache=Object.create(null),e.proxy=Ji(new Proxy(e.ctx,gs));const{setup:n}=t;if(n){const t=e.setupContext=n.length>1?function(e){const t=t=>{e.exposed=t||{}};return{get attrs(){return function(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get:(t,n)=>(oi(e,0,"$attrs"),t[n])}))}(e)},slots:e.slots,emit:e.emit,expose:t}}(e):null,i=Ks(e);Wn();const o=lo(n,e,0,[e.props,t]);Yn(),i(),v(o)?o.then(zs,zs):function(e,t){g(t)?e.render=t:_(t)&&(e.setupState=ro(t));Js(e)}(e,o)}else Js(e)}(e):void 0;return t&&Hs(!1),o}function Js(e,t,n){const o=e.type;e.render||(e.render=o.render||i);{const t=Ks(e);Wn();try{_s(e)}finally{Yn(),t()}}}function Xs(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(ro(Ji(e.exposed)),{get:(t,n)=>n in t?t[n]:e.proxy[n],has:(e,t)=>t in e||t in ps}))}const Qs=(e,t)=>{const n=function(e,t,n=!1){let o,s;const a=g(e);return a?(o=e,s=i):(o=e.get,s=e.set),new Zi(o,s,a||!s,n)}(e,0,Ys);return n},Zs="3.4.21";function ea(e){return so(e)}const ta="[object Array]",na="[object Object]";function ia(e,t){const n={};return oa(e,t),sa(e,t,"",n),n}function oa(e,t){if((e=ea(e))===t)return;const n=I(e),i=I(t);if(n==na&&i==na)for(let o in t){const n=e[o];void 0===n?e[o]=null:oa(n,t[o])}else n==ta&&i==ta&&e.length>=t.length&&t.forEach(((t,n)=>{oa(e[n],t)}))}function sa(e,t,n,i){if((e=ea(e))===t)return;const o=I(e),s=I(t);if(o==na)if(s!=na||Object.keys(e).length{sa(e,s[t],(""==n?"":n+".")+a+"["+t+"]",i)}));else if(r==na)if(c!=na||Object.keys(o).length{sa(e,t[o],n+"["+o+"]",i)})):aa(i,n,e)}function aa(e,t,n){e[t]=n}function ra(e){const t=e.ctx.__next_tick_callbacks;if(t&&t.length){const e=t.slice(0);t.length=0;for(let t=0;t{t?lo(t.bind(e.proxy),e,14):i&&i(e.proxy)})),new Promise((e=>{i=e}))}function ua(e,t){const n=typeof(e=ea(e));if("object"===n&&null!==e){let n=t.get(e);if(void 0!==n)return n;if(d(e)){const i=e.length;n=new Array(i),t.set(e,n);for(let o=0;o{i[e]=n[e]})),i}(o,s));Object.keys(a).length?(i.__next_tick_pending=!0,o.setData(a,(()=>{i.__next_tick_pending=!1,ra(e)})),Ro()):ra(e)}}function pa(e,t,n){t.appContext.config.globalProperties.$applyOptions(e,t,n);const i=e.computed;if(i){const e=Object.keys(i);if(e.length){const n=t.ctx;n.$computedKeys||(n.$computedKeys=[]),n.$computedKeys.push(...e)}}delete t.ctx.$onApplyOptions}function ha(e,t=!1){const{setupState:n,$templateRefs:i,$templateUniElementRefs:o,ctx:{$scope:s,$mpPlatform:a}}=e;if("mp-alipay"===a)return;if(!s||!i&&!o)return;if(t)return i&&i.forEach((e=>ga(e,null,n))),void(o&&o.forEach((e=>ga(e,null,n))));const r="mp-baidu"===a||"mp-toutiao"===a,c=e=>{if(0===e.length)return[];const t=(s.selectAllComponents(".r")||[]).concat(s.selectAllComponents(".r-i-f")||[]);return e.filter((e=>{const i=function(e,t){const n=e.find((e=>e&&(e.properties||e.props).uI===t));if(n){const e=n.$vm;return e?Xs(e.$)||e:function(e){_(e)&&Ji(e);return e}(n)}return null}(t,e.i);return!(!r||null!==i)||(ga(e,i,n),!1)}))},u=()=>{if(i){const t=c(i);t.length&&e.proxy&&e.proxy.$scope&&e.proxy.$scope.setData({r1:1},(()=>{c(t)}))}};o&&o.length&&ca(e,(()=>{o.forEach((e=>{d(e.v)?e.v.forEach((t=>{ga(e,t,n)})):ga(e,e.v,n)}))})),s._$setRef?s._$setRef(u):ca(e,u)}function ga({r:e,f:t},n,i){if(g(e))e(n,{});else{const o=f(e),s=no(e);if(o||s)if(t){if(!s)return;d(e.value)||(e.value=[]);const t=e.value;if(-1===t.indexOf(n)){if(t.push(n),!n)return;n.$&&ss((()=>c(t,n)),n.$)}}else o?l(i,e)&&(i[e]=n):no(e)&&(e.value=n)}}const fa=Do;function ma(e,t){const n=e.component=Bs(e,t.parentComponent,null);return n.renderer=t.mpType?t.mpType:"component",n.ctx.$onApplyOptions=pa,n.ctx.$children=[],"app"===t.mpType&&(n.render=i),t.onBeforeSetup&&t.onBeforeSetup(n,t),$s(n),t.parentComponent&&n.proxy&&t.parentComponent.ctx.$children.push(Xs(n)||n.proxy),function(e){const t=Ma.bind(e);e.$updateScopedSlots=()=>Eo((()=>To(t)));const n=()=>{if(e.isMounted){const{next:t,bu:n,u:i}=e;Ca(e,!1),Ia(),n&&L(n),Ca(e,!0),da(e,va(e)),i&&fa(i)}else ss((()=>{ha(e,!0)}),e),da(e,va(e))},o=e.effect=new Bn(n,i,(()=>To(s)),e.scope),s=e.update=()=>{o.dirty&&o.run()};s.id=e.uid,Ca(e,!0),s()}(n),n.proxy}const _a=e=>{let t;for(const n in e)("class"===n||"style"===n||s(n))&&((t||(t={}))[n]=e[n]);return t};function va(e){const{type:t,vnode:n,proxy:i,withProxy:o,props:s,propsOptions:[a],slots:r,attrs:c,emit:u,render:l,renderCache:d,data:p,setupState:h,ctx:g,uid:f,appContext:{app:{config:{globalProperties:{pruneComponentPropsCache:m}}}},inheritAttrs:_}=e;let v;e.$uniElementIds=new Map,e.$templateRefs=[],e.$templateUniElementRefs=[],e.$templateUniElementStyles={},e.$ei=0,m(f),e.__counter=0===e.__counter?1:0;const y=Uo(e);try{if(4&n.shapeFlag){ya(_,s,a,c);const e=o||i;v=l.call(e,e,d,s,h,p,g)}else{ya(_,s,a,t.props?c:_a(c));const e=t;v=e.length>1?e(s,{attrs:c,slots:r,emit:u}):e(s,null)}}catch(I){ho(I,e,1),v=!1}return ha(e),Uo(y),v}function ya(e,t,n,i){if(t&&i&&!1!==e){const e=Object.keys(i).filter((e=>"class"!==e&&"style"!==e));if(!e.length)return;n&&e.some(a)?e.forEach((e=>{a(e)&&e.slice(9)in n||(t[e]=i[e])})):e.forEach((e=>t[e]=i[e]))}}const Ia=e=>{Wn(),Ro(),Yn()};function Ma(){const e=this.$scopedSlotsData;if(!e||0===e.length)return;const t=this.ctx.$scope,n=t.data,i=Object.create(null);e.forEach((({path:e,index:t,data:o})=>{const s=_e(n,e),a=f(t)?`${e}.${t}`:`${e}[${t}]`;if(void 0===s||void 0===s[t])i[a]=o;else{const e=ia(o,s[t]);Object.keys(e).forEach((t=>{i[a+"."+t]=e[t]}))}})),e.length=0,Object.keys(i).length&&t.setData(i)}function Ca({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}const Sa=function(e,t=null){g(e)||(e=r({},e)),null==t||_(t)||(t=null);const n=Ko(),i=new WeakSet,o=n.app={_uid:zo++,_component:e,_props:t,_container:null,_context:n,_instance:null,version:Zs,get config(){return n.config},set config(e){},use:(e,...t)=>(i.has(e)||(e&&g(e.install)?(i.add(e),e.install(o,...t)):g(e)&&(i.add(e),e(o,...t))),o),mixin:e=>(n.mixins.includes(e)||n.mixins.push(e),o),component:(e,t)=>t?(n.components[e]=t,o):n.components[e],directive:(e,t)=>t?(n.directives[e]=t,o):n.directives[e],mount(){},unmount(){},provide:(e,t)=>(n.provides[e]=t,o),runWithContext(e){const t=Wo;Wo=o;try{return e()}finally{Wo=t}}};return o};function Ea(e,t=null){("undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof my?my:void 0).__VUE__=!0;const n=Sa(e,t),o=n._context;o.config.globalProperties.$nextTick=function(e){return ca(this.$,e)};const s=e=>(e.appContext=o,e.shapeFlag=6,e),a=function(e,t){return ma(s(e),t)},r=function(e){return e&&function(e){const{bum:t,scope:n,update:i,um:o}=e;t&&L(t);{const t=e.parent;if(t){const n=t.ctx.$children,i=Xs(e)||e.proxy,o=n.indexOf(i);o>-1&&n.splice(o,1)}}n.stop(),i&&(i.active=!1),o&&fa(o),fa((()=>{e.isUnmounted=!0}))}(e.$)};return n.mount=function(){e.render=i;const t=ma(s({type:e}),{mpType:"app",mpInstance:null,parentComponent:null,slots:[],props:null});return n._instance=t.$,t.$app=n,t.$createComponent=a,t.$destroyComponent=r,o.$appInstance=t,t},n.unmount=function(){},n}function Ta(e,t,n,i){g(t)&&Zo(e,t.bind(n),i)}function ka(e,t,n){!function(e,t,n){const i=e.mpType||n.$mpType;!i||"component"===i||"page"===i&&"component"===t.renderer||Object.keys(e).forEach((i=>{if(Te(i,e[i],!1)){const o=e[i];d(o)?o.forEach((e=>Ta(i,e,n,t))):Ta(i,o,n,t)}}))}(e,t,n)}function Da(e,t,n){return e[t]=n}function Ra(e,...t){const n=this[e];return n?n(...t):(console.error(`method ${e} not found`),null)}function Oa(e){const t=e.config.errorHandler;return function(n,i,o){t&&t(n,i,o);const s=e._instance;if(!s||!s.proxy)throw n;s[K]?s.proxy.$callHook(K,n):go(n,0,i&&i.$.vnode,!1)}}function ba(e,t){return e?[...new Set([].concat(e,t))]:t}let Aa;const La="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Pa=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Na(){const e=Nn.getStorageSync("uni_id_token")||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let n;try{n=JSON.parse((i=t[1],decodeURIComponent(Aa(i).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(o){throw new Error("获取当前用户信息出错,详细错误信息为:"+o.message)}var i;return n.tokenExpired=1e3*n.exp,delete n.exp,delete n.iat,n}function wa(e){const t=e.config;var n;t.errorHandler=Re(e,Oa),n=t.optionMergeStrategies,Se.forEach((e=>{n[e]=ba}));const i=t.globalProperties;!function(e){e.uniIDHasRole=function(e){const{role:t}=Na();return t.indexOf(e)>-1},e.uniIDHasPermission=function(e){const{permission:t}=Na();return this.uniIDHasRole("admin")||t.indexOf(e)>-1},e.uniIDTokenValid=function(){const{tokenExpired:e}=Na();return e>Date.now()}}(i),i.$set=Da,i.$applyOptions=ka,i.$callMethod=Ra,Nn.invokeCreateVueAppHook(e)}Aa="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Pa.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,i,o="",s=0;s>16&255):64===i?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o}:atob;const Ua=Object.create(null);function Ga(e){delete Ua[e]}function xa(e){if(!e)return;const[t,n]=e.split(",");return Ua[t]?Ua[t][parseInt(n)]:void 0}var Fa={install(e){wa(e),e.config.globalProperties.pruneComponentPropsCache=Ga;const t=e.mount;e.mount=function(n){const i=t.call(e,n),o=function(){const e="createApp";if("undefined"!=typeof global&&void 0!==global[e])return global[e];if("undefined"!=typeof my)return my[e]}();return o?o(i):"undefined"!=typeof createMiniProgramApp&&createMiniProgramApp(i),i}}};function Ba(e){return f(e)?e:function(e){let t="";if(!e||f(e))return t;for(const n in e)t+=`${n.startsWith("--")?n:R(n)}:${e[n]};`;return t}(N(e))}function qa(e,t){const n=Vs(),o=n.ctx,s=void 0===t||"mp-weixin"!==o.$mpPlatform&&"mp-qq"!==o.$mpPlatform&&"mp-xhs"!==o.$mpPlatform||!f(t)&&"number"!=typeof t?"":"_"+t,a="e"+n.$ei+++s,c=o.$scope;if(!e)return delete c[a],a;const u=c[a];return u?u.value=e:c[a]=function(e,t){const n=e=>{var o;(o=e).type&&o.target&&(o.preventDefault=i,o.stopPropagation=i,o.stopImmediatePropagation=i,l(o,"detail")||(o.detail={}),l(o,"markerId")&&(o.detail="object"==typeof o.detail?o.detail:{},o.detail.markerId=o.markerId),M(o.detail)&&l(o.detail,"checked")&&!l(o.detail,"value")&&(o.detail.value=o.detail.checked),M(o.detail)&&(o.target=r({},o.target,o.detail)));let s=[e];t&&t.ctx.$getTriggerEventDetail&&"number"==typeof e.detail&&(e.detail=t.ctx.$getTriggerEventDetail(e.detail)),e.detail&&e.detail.__args__&&(s=e.detail.__args__);const a=n.value,c=()=>po(function(e,t){if(d(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n&&n.call(e),e._stopped=!0},t.map((e=>t=>!t._stopped&&e(t)))}return t}(e,a),t,5,s),u=e.target,p=!!u&&(!!u.dataset&&"true"===String(u.dataset.eventsync));if(!Va.includes(e.type)||p){const t=c();if("input"===e.type&&(d(t)||v(t)))return;return t}setTimeout(c)};return n.value=e,n}(e,n),a}const Va=["tap","longpress","longtap","transitionend","animationstart","animationiteration","animationend","touchforcechange"];const ja=function(e,t=null){return e&&(e.mpType="app"),Ea(e,t).use(Fa)};const Ha=["externalClasses"];const Ka=/_(.*)_worklet_factory_/;function za(e,t){const n=e.$children;for(let o=n.length-1;o>=0;o--){const e=n[o];if(e.$scope._$vueId===t)return e}let i;for(let o=n.length-1;o>=0;o--)if(i=za(n[o],t),i)return i}const Wa=["createSelectorQuery","createIntersectionObserver","selectAllComponents","selectComponent"];function Ya(e,t){const n=e.ctx;n.mpType=t.mpType,n.$mpType=t.mpType,n.$mpPlatform="mp-weixin",n.$scope=t.mpInstance,Object.defineProperties(n,{[fe]:{get(){const e=this.$scope.data[fe];return void 0===e?"":e}}}),n.$mp={},n._self={},e.slots={},d(t.slots)&&t.slots.length&&(t.slots.forEach((t=>{e.slots[t]=!0})),e.slots.d&&(e.slots.default=!0)),n.getOpenerEventChannel=function(){return t.mpInstance.getOpenerEventChannel()},n.$hasHook=$a,n.$callHook=Ja,e.emit=function(e,t){return function(n,...i){const o=t.$scope;if(o&&n){const e={__args__:i};o.triggerEvent(n,e)}return e.apply(this,[n,...i])}}(e.emit,n)}function $a(e){const t=this.$[e];return!(!t||!t.length)}function Ja(e,t){"mounted"===e&&(Ja.call(this,"bm"),this.$.isMounted=!0,e="m");const n=this.$[e];return n&&((e,t)=>{let n;for(let i=0;i{Te(n,e[n])&&t.add(n)}));{const{extends:n,mixins:i}=e;i&&i.forEach((e=>Qa(e,t))),n&&Qa(n,t)}}return t}function Za(e,t,n){-1!==n.indexOf(t)||l(e,t)||(e[t]=function(e){return this.$vm&&this.$vm.$callHook(t,e)})}const er=[J];function tr(e,t,n=er){t.forEach((t=>Za(e,t,n)))}function nr(e,t,n=er){Qa(t).forEach((t=>Za(e,t,n)))}const ir=me((()=>{const e=[],t=g(getApp)&&getApp({allowDefault:!0});if(t&&t.$vm&&t.$vm.$){const n=t.$vm.$.appContext.mixins;if(d(n)){const t=Object.keys(Ee);n.forEach((n=>{t.forEach((t=>{l(n,t)&&!e.includes(t)&&e.push(t)}))}))}}return e}));const or=[V,j,K,z,W,Y];function sr(e,t){const n=e.$,i={globalData:e.$options&&e.$options.globalData||{},$vm:e,onLaunch(t){this.$vm=e;const i=n.ctx;this.$vm&&i.$scope&&i.$callHook||(Ya(n,{mpType:"app",mpInstance:this,slots:[]}),i.globalData=this.globalData,e.$callHook(H,t))}},o=wx.$onErrorHandlers;o&&(o.forEach((e=>{Zo(K,e,n)})),o.length=0),function(e){const t=io(function(){var e;let t="";{const n=(null===(e=wx.getAppBaseInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync();t=Be(n&&n.language?n.language:Ue)||Ue}return t}());Object.defineProperty(e,"$locale",{get:()=>t.value,set(e){t.value=e}})}(e);const s=e.$.type;tr(i,or),nr(i,s);{const e=s.methods;e&&r(i,e)}return i}function ar(e,t){if(g(e.onLaunch)){const t=wx.getLaunchOptionsSync&&wx.getLaunchOptionsSync();e.onLaunch(t)}g(e.onShow)&&wx.onAppShow&&wx.onAppShow((e=>{t.$callHook("onShow",e)})),g(e.onHide)&&wx.onAppHide&&wx.onAppHide((e=>{t.$callHook("onHide",e)}))}const rr=["eO","uR","uRIF","uI","uT","uP","uS"];function cr(e){e.properties||(e.properties={}),r(e.properties,function(e,t=!1){const n={};if(!t){let e=function(e){const t=Object.create(null);e&&e.forEach((e=>{t[e]=!0})),this.setData({$slots:t})};rr.forEach((e=>{n[e]={type:null,value:""}})),n.uS={type:null,value:[]},n.uS.observer=e}return e.behaviors&&e.behaviors.includes("wx://form-field")&&(e.properties&&e.properties.name||(n.name={type:null,value:""}),e.properties&&e.properties.value||(n.value={type:null,value:""})),n}(e),function(e){const t={};return e&&e.virtualHost&&(t.virtualHostStyle={type:null,value:""},t.virtualHostClass={type:null,value:""},t.virtualHostHidden={type:null,value:""},t[fe]={type:null,value:""}),t}(e.options))}const ur=[String,Number,Boolean,Object,Array,null];function lr(e,t){const n=function(e){return d(e)&&1===e.length?e[0]:e}(e);return-1!==ur.indexOf(n)?n:null}function dr(e,t){return(t?function(e){const t={};M(e)&&Object.keys(e).forEach((n=>{-1===rr.indexOf(n)&&(t[n]=e[n])}));return t}(e):xa(e.uP))||{}}function pr(e){const t=function(){const e=this.properties.uP;e&&(this.$vm?function(e,t){const n=$i(t.props),i=xa(e)||{};hr(n,i)&&(!function(e,t,n,i){const{props:o,attrs:s,vnode:{patchFlag:a}}=e,r=$i(o),[c]=e.propsOptions;let u=!1;if(!(i||a>0)||16&a){let i;Os(e,t,o,s)&&(u=!0);for(const s in r)t&&(l(t,s)||(i=R(s))!==s&&l(t,i))||(c?!n||void 0===n[s]&&void 0===n[i]||(o[s]=bs(c,r,s,void 0,e,!0)):delete o[s]);if(s!==r)for(const e in s)t&&l(t,e)||(delete s[e],u=!0)}else if(8&a){const n=e.vnode.dynamicProps;for(let i=0;i-1&&function(e){const t=_o.indexOf(e);t>vo&&_o.splice(t,1)}(t.update),t.update());var o}(e,this.$vm.$):"m"===this.properties.uT&&function(e,t){const n=t.properties,i=xa(e)||{};hr(n,i,!1)&&t.setData(i)}(e,this))};e.observers||(e.observers={}),e.observers.uP=t}function hr(e,t,n=!0){const i=Object.keys(t);if(n&&i.length!==Object.keys(e).length)return!0;for(let o=0;o{i.push(e.replace("uni://","wx://")),"uni://form-field"===e&&(d(n)?(n.push("name"),n.push("modelValue")):(n.name={type:String,default:""},n.modelValue={type:[String,Number,Boolean,Array,Object,Date],default:""}))})),i}(t)}function fr(e,{parse:t,mocks:n,isPage:i,isPageInProject:o,initRelation:s,handleLink:a,initLifetimes:c}){e=e.default||e;const u={multipleSlots:!0,addGlobalClass:!0,pureDataPattern:/^uP$/};d(e.mixins)&&e.mixins.forEach((e=>{_(e.options)&&r(u,e.options)})),e.options&&r(u,e.options);const p={options:u,lifetimes:c({mocks:n,isPage:i,initRelation:s,vueOptions:e}),pageLifetimes:{show(){this.$vm&&this.$vm.$callHook("onPageShow")},hide(){this.$vm&&this.$vm.$callHook("onPageHide")},resize(e){this.$vm&&this.$vm.$callHook("onPageResize",e)}},methods:{__l:a}};var h,g,f,m;return gr(p,e),cr(p),pr(p),function(e,t){Ha.forEach((n=>{l(t,n)&&(e[n]=t[n])}))}(p,e),h=p.methods,g=e.wxsCallMethods,d(g)&&g.forEach((e=>{h[e]=function(t){return this.$vm[e](t)}})),f=p.methods,(m=e.methods)&&Object.keys(m).forEach((e=>{const t=e.match(Ka);if(t){const n=t[1];f[e]=m[e],f[n]=m[n]}})),t&&t(p,{handleLink:a}),p}let mr,_r;function vr(){return getApp().$vm}function yr(e,t){const{parse:n,mocks:i,isPage:o,initRelation:s,handleLink:a,initLifetimes:r}=t,c=fr(e,{mocks:i,isPage:o,isPageInProject:!0,initRelation:s,handleLink:a,initLifetimes:r});!function({properties:e},t){d(t)?t.forEach((t=>{e[t]={type:String,value:""}})):M(t)&&Object.keys(t).forEach((n=>{const i=t[n];if(M(i)){let t=i.default;g(t)&&(t=t());const o=i.type;i.type=lr(o),e[n]={type:i.type,value:t}}else e[n]={type:lr(i)}}))}(c,(e.default||e).props);const u=c.methods;return u.onLoad=function(e){var t;return this.options=e,this.$page={fullPath:(t=this.route+Me(e),function(e){return 0===e.indexOf("/")}(t)?t:"/"+t)},this.$vm&&this.$vm.$callHook($,e)},tr(u,Xa),nr(u,e),function(e,t){if(!t)return;Object.keys(Ee).forEach((n=>{t&Ee[n]&&Za(e,n,[])}))}(u,e.__runtimeHooks),tr(u,ir()),n&&n(c,{handleLink:a}),c}const Ir=Page,Mr=Component;function Cr(e){const t=e.triggerEvent,n=function(n,...i){return t.apply(e,[(o=n,k(o.replace(ye,"-"))),...i]);var o};try{e.triggerEvent=n}catch(i){e._triggerEvent=n}}function Sr(e,t,n){const i=t[e];t[e]=i?function(...e){return Cr(this),i.apply(this,e)}:function(){Cr(this)}}Page=function(e){return Sr($,e),Ir(e)},Component=function(e){Sr("created",e);return e.properties&&e.properties.uP||(cr(e),pr(e)),Mr(e)};var Er=Object.freeze({__proto__:null,handleLink:function(e){const t=e.detail||e.value,n=t.vuePid;let i;n&&(i=za(this.$vm,n)),i||(i=this.$vm),t.parent=i},initLifetimes:function({mocks:e,isPage:t,initRelation:n,vueOptions:i}){return{attached(){let o=this.properties;!function(e,t){if(!e)return;const n=e.split(","),i=n.length;1===i?t._$vueId=n[0]:2===i&&(t._$vueId=n[0],t._$vuePid=n[1])}(o.uI,this);const s={vuePid:this._$vuePid};n(this,s);const a=this,r=t(a);let c=o;this.$vm=function(e,t){mr||(mr=vr().$createComponent);const n=mr(e,t);return Xs(n.$)||n}({type:i,props:dr(c,r)},{mpType:r?"page":"component",mpInstance:a,slots:o.uS||{},parentComponent:s.parent&&s.parent.$,onBeforeSetup(t,n){!function(e,t){Object.defineProperty(e,"refs",{get(){const e={};return function(e,t,n){e.selectAllComponents(t).forEach((e=>{const t=e.properties.uR;n[t]=e.$vm||e}))}(t,".r",e),t.selectAllComponents(".r-i-f").forEach((t=>{const n=t.properties.uR;n&&(e[n]||(e[n]=[]),e[n].push(t.$vm||t))})),e}})}(t,a),function(e,t,n){const i=e.ctx;n.forEach((n=>{l(t,n)&&(e[n]=i[n]=t[n])}))}(t,a,e),function(e,t){Ya(e,t);const n=e.ctx;Wa.forEach((e=>{n[e]=function(...t){const i=n.$scope;if(i&&i[e])return i[e].apply(i,t)}}))}(t,n)}}),r||function(e){const t=e.$options;d(t.behaviors)&&t.behaviors.includes("uni://form-field")&&e.$watch("modelValue",(()=>{e.$scope&&e.$scope.setData({name:e.name,value:e.modelValue})}),{immediate:!0})}(this.$vm)},ready(){this.$vm&&(this.$vm.$callHook("mounted"),this.$vm.$callHook(J))},detached(){var e;this.$vm&&(Ga(this.$vm.$.uid),e=this.$vm,_r||(_r=vr().$destroyComponent),_r(e))}}},initRelation:function(e,t){e.triggerEvent("__l",t)},isPage:function(e){return!!e.route},mocks:["__route__","__wxExparserNodeId__","__wxWebviewId__"]});const Tr=function(e){return App(sr(e))},kr=(Dr=Er,function(e){return Component(yr(e,Dr))});var Dr;const Rr=function(e){return function(t){return Component(fr(t,e))}}(Er),Or=function(e){ar(sr(e),e)},br=function(e){const t=sr(e),n=g(getApp)&&getApp({allowDefault:!0});if(!n)return;e.$.ctx.$scope=n;const i=n.globalData;i&&Object.keys(t.globalData).forEach((e=>{l(i,e)||(i[e]=t.globalData[e])})),Object.keys(t).forEach((e=>{l(n,e)||(n[e]=t[e])})),ar(t,e)};wx.createApp=global.createApp=Tr,wx.createPage=kr,wx.createComponent=Rr,wx.createPluginApp=global.createPluginApp=Or,wx.createSubpackageApp=global.createSubpackageApp=br;
+function e(e,t){const n=new Set(e.split(","));return t?e=>n.has(e.toLowerCase()):e=>n.has(e)}const t={},n=[],i=()=>{},o=()=>!1,s=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),r=e=>e.startsWith("onUpdate:"),a=Object.assign,c=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},l=Object.prototype.hasOwnProperty,u=(e,t)=>l.call(e,t),p=Array.isArray,d=e=>"[object Map]"===x(e),h=e=>"[object Set]"===x(e),f=e=>"function"==typeof e,m=e=>"string"==typeof e,g=e=>"symbol"==typeof e,v=e=>null!==e&&"object"==typeof e,y=e=>(v(e)||f(e))&&f(e.then)&&f(e.catch),b=Object.prototype.toString,x=e=>b.call(e),S=e=>"[object Object]"===x(e),k=e=>m(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,C=e(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),w=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},E=/-(\w)/g,T=w((e=>e.replace(E,((e,t)=>t?t.toUpperCase():"")))),I=/\B([A-Z])/g,_=w((e=>e.replace(I,"-$1").toLowerCase())),O=w((e=>e.charAt(0).toUpperCase()+e.slice(1))),A=w((e=>e?`on${O(e)}`:"")),R=(e,t)=>!Object.is(e,t),P=(e,t)=>{for(let n=0;n{const t=parseFloat(e);return isNaN(t)?e:t};function N(e){if(p(e)){const t={};for(let n=0;n{if(e){const n=e.split(B);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function U(e){let t="";if(m(e))t=e;else if(p(e))for(let n=0;nt&&t.__v_isRef?F(e,t.value):d(t)?{[`Map(${t.size})`]:[...t.entries()].reduce(((e,[t,n],i)=>(e[G(t,i)+" =>"]=n,e)),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map((e=>G(e)))}:g(t)?G(t):!v(t)||p(t)||S(t)?t:String(t),G=(e,t="")=>{var n;return g(e)?`Symbol(${null!=(n=e.description)?n:t})`:e},q="onShow",z="onHide",H="onLaunch",$="onError",V="onThemeChange",K="onPageNotFound",W="onUnhandledRejection",X="onLoad",J="onReady",Q="onUnload",Y="onInit",Z="onSaveExitState",ee="onResize",te="onBackPress",ne="onPageScroll",ie="onTabItemTap",oe="onReachBottom",se="onPullDownRefresh",re="onShareTimeline",ae="onShareChat",ce="onAddToFavorites",le="onShareAppMessage",ue="onNavigationBarButtonTap",pe="onNavigationBarSearchInputClicked",de="onNavigationBarSearchInputChanged",he="onNavigationBarSearchInputConfirmed",fe="onNavigationBarSearchInputFocusChanged",me="virtualHostId";function ge(e,t=null){let n;return(...i)=>(e&&(n=e.apply(t,i),e=null),n)}function ve(e,t){if(!m(t))return;const n=(t=t.replace(/\[(\d+)\]/g,".$1")).split(".");let i=n[0];return e||(e={}),1===n.length?e[i]:ve(e[i],n.slice(1).join("."))}function ye(e){let t={};return S(e)&&Object.keys(e).sort().forEach((n=>{const i=n;t[i]=e[i]})),Object.keys(t)?t:e}const be=/:/g;const xe=encodeURIComponent;function Se(e,t=xe){const n=e?Object.keys(e).map((n=>{let i=e[n];return void 0===typeof i||null===i?i="":S(i)&&(i=JSON.stringify(i)),t(n)+"="+t(i)})).filter((e=>e.length>0)).join("&"):null;return n?`?${n}`:""}const ke=[Y,X,q,z,Q,te,ne,ie,oe,se,re,le,ae,ce,Z,ue,pe,de,he,fe];const Ce=[q,z,H,$,V,K,W,"onExit",Y,X,J,Q,ee,te,ne,ie,oe,se,re,ce,le,ae,Z,ue,pe,de,he,fe],we=(()=>({onPageScroll:1,onShareAppMessage:2,onShareTimeline:4}))();function Ee(e,t,n=!0){return!(n&&!f(t))&&(Ce.indexOf(e)>-1||0===e.indexOf("on"))}let Te;const Ie=[];const _e=ge(((e,t)=>t(e))),Oe=function(){};Oe.prototype={_id:1,on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n,_id:this._id}),this._id++},once:function(e,t,n){var i=this;function o(){i.off(e,o),t.apply(n,arguments)}return o._=t,this.on(e,o,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,o=n.length;i=0;s--)if(i[s].fn===t||i[s].fn._===t||i[s]._id===t){i.splice(s,1);break}o=i}return o.length?n[e]=o:delete n[e],this}};var Ae=Oe;const Re=["{","}"];const Pe=/^(?:\d)+/,Me=/^(?:\w)+/;const Ne="zh-Hans",De="zh-Hant",Be="en",Le=Object.prototype.hasOwnProperty,je=(e,t)=>Le.call(e,t),Ue=new class{constructor(){this._caches=Object.create(null)}interpolate(e,t,n=Re){if(!t)return[e];let i=this._caches[e];return i||(i=function(e,[t,n]){const i=[];let o=0,s="";for(;o-1?Ne:e.indexOf("-hant")>-1?De:(n=e,["-tw","-hk","-mo","-cht"].find((e=>-1!==n.indexOf(e)))?De:Ne);var n;let i=[Be,"fr","es"];t&&Object.keys(t).length>0&&(i=Object.keys(t));const o=function(e,t){return t.find((t=>0===e.indexOf(t)))}(e,i);return o||void 0}class Ge{constructor({locale:e,fallbackLocale:t,messages:n,watcher:i,formater:o}){this.locale=Be,this.fallbackLocale=Be,this.message={},this.messages={},this.watchers=[],t&&(this.fallbackLocale=t),this.formater=o||Ue,this.messages=n||{},this.setLocale(e||Be),i&&this.watchLocale(i)}setLocale(e){const t=this.locale;this.locale=Fe(e,this.messages)||this.fallbackLocale,this.messages[this.locale]||(this.messages[this.locale]={}),this.message=this.messages[this.locale],t!==this.locale&&this.watchers.forEach((e=>{e(this.locale,t)}))}getLocale(){return this.locale}watchLocale(e){const t=this.watchers.push(e)-1;return()=>{this.watchers.splice(t,1)}}add(e,t,n=!0){const i=this.messages[e];i?n?Object.assign(i,t):Object.keys(t).forEach((e=>{je(i,e)||(i[e]=t[e])})):this.messages[e]=t}f(e,t,n){return this.formater.interpolate(e,t,n).join("")}t(e,t,n){let i=this.message;return"string"==typeof t?(t=Fe(t,this.messages))&&(i=this.messages[t]):n=t,je(i,e)?this.formater.interpolate(i[e],n).join(""):(console.warn(`Cannot translate the value of keypath ${e}. Use the value of keypath as default.`),e)}}function qe(e){return function(){try{return e.apply(e,arguments)}catch(Wa){console.error(Wa)}}}let ze=1;const He={};function $e(e,t,n){if("number"==typeof e){const i=He[e];if(i)return i.keepAlive||delete He[e],i.callback(t,n)}return t}const Ve="success",Ke="fail",We="complete";function Xe(e,t={},{beforeAll:n,beforeSuccess:i}={}){S(t)||(t={});const{success:o,fail:s,complete:r}=function(e){const t={};for(const n in e){const i=e[n];f(i)&&(t[n]=qe(i),delete e[n])}return t}(t),a=f(o),c=f(s),l=f(r),u=ze++;return function(e,t,n,i=!1){He[e]={name:t,keepAlive:i,callback:n}}(u,e,(u=>{(u=u||{}).errMsg=function(e,t){return e&&-1!==e.indexOf(":fail")?t+e.substring(e.indexOf(":fail")):t+":ok"}(u.errMsg,e),f(n)&&n(u),u.errMsg===e+":ok"?(f(i)&&i(u,t),a&&o(u)):c&&s(u),l&&r(u)})),u}const Je="success",Qe="fail",Ye="complete",Ze={},et={};function nt(e,t){return function(n){return e(n,t)||n}}function it(e,t,n){let i=!1;for(let o=0;oe(t),catch(){}}}function ot(e,t={}){return[Je,Qe,Ye].forEach((n=>{const i=e[n];if(!p(i))return;const o=t[n];t[n]=function(e){it(i,e,t).then((e=>f(o)&&o(e)||e))}})),t}function st(e,t){const n=[];p(Ze.returnValue)&&n.push(...Ze.returnValue);const i=et[e];return i&&p(i.returnValue)&&n.push(...i.returnValue),n.forEach((e=>{t=e(t)||t})),t}function rt(e){const t=Object.create(null);Object.keys(Ze).forEach((e=>{"returnValue"!==e&&(t[e]=Ze[e].slice())}));const n=et[e];return n&&Object.keys(n).forEach((e=>{"returnValue"!==e&&(t[e]=(t[e]||[]).concat(n[e]))})),t}function at(e,t,n,i){const o=rt(e);if(o&&Object.keys(o).length){if(p(o.invoke)){return it(o.invoke,n).then((n=>t(ot(rt(e),n),...i)))}return t(ot(o,n),...i)}return t(n,...i)}function ct(e,t){return(n={},...i)=>function(e){return!(!S(e)||![Ve,Ke,We].find((t=>f(e[t]))))}(n)?st(e,at(e,t,a({},n),i)):st(e,new Promise(((o,s)=>{at(e,t,a({},n,{success:o,fail:s}),i)})))}function lt(e,t,n,i={}){const o=t+":fail";let s="";return s=n?0===n.indexOf(o)?n:o+" "+n:o,delete i.errCode,$e(e,a({errMsg:s},i))}function ut(e,t,n,i){const o=function(e){e[0]}(t);if(o)return o}function pt(e,t,n,i){return n=>{const o=Xe(e,n,i),s=ut(0,[n]);return s?lt(o,e,s):t(n,{resolve:t=>function(e,t,n){return $e(e,a(n||{},{errMsg:t+":ok"}))}(o,e,t),reject:(t,n)=>lt(o,e,function(e){return!e||m(e)?e:e.stack?("undefined"!=typeof globalThis&&globalThis.harmonyChannel||console.error(e.message+"\n"+e.stack),e.message):e}(t),n)})}}function dt(e,t,n,i){return function(e,t){return(...e)=>{const n=ut(0,e);if(n)throw new Error(n);return t.apply(null,e)}}(0,t)}let ht=!1,ft=0,mt=0;const gt=dt(0,((e,t)=>{if(0===ft&&function(){var e,t;let n,i,o;{const s=(null===(e=wx.getWindowInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync(),r=(null===(t=wx.getDeviceInfo)||void 0===t?void 0:t.call(wx))||wx.getSystemInfoSync();n=s.windowWidth,i=s.pixelRatio,o=r.platform}ft=n,mt=i,ht="ios"===o}(),0===(e=Number(e)))return 0;let n=e/750*(t||ft);return n<0&&(n=-n),n=Math.floor(n+1e-4),0===n&&(n=1!==mt&&ht?.5:1),e<0?-n:n}));function vt(e,t){Object.keys(t).forEach((n=>{f(t[n])&&(e[n]=function(e,t){const n=t?e?e.concat(t):p(t)?t:[t]:e;return n?function(e){const t=[];for(let n=0;n{const i=e[n],o=t[n];p(i)&&f(o)&&c(i,o)}))}const bt=dt(0,((e,t)=>{m(e)&&S(t)?vt(et[e]||(et[e]={}),t):S(e)&&vt(Ze,e)})),xt=dt(0,((e,t)=>{m(e)?S(t)?yt(et[e],t):delete et[e]:S(e)&&yt(Ze,e)}));const St=new class{constructor(){this.$emitter=new Ae}on(e,t){return this.$emitter.on(e,t)}once(e,t){return this.$emitter.once(e,t)}off(e,t){e?this.$emitter.off(e,t):this.$emitter.e={}}emit(e,...t){this.$emitter.emit(e,...t)}},kt=dt(0,((e,t)=>(St.on(e,t),()=>St.off(e,t)))),Ct=dt(0,((e,t)=>(St.once(e,t),()=>St.off(e,t)))),wt=dt(0,((e,t)=>{p(e)||(e=e?[e]:[]),e.forEach((e=>{St.off(e,t)}))})),Et=dt(0,((e,...t)=>{St.emit(e,...t)}));let Tt,It,_t;function Ot(e){try{return JSON.parse(e)}catch(Wa){}return e}const At=[];function Rt(e,t){At.forEach((n=>{n(e,t)})),At.length=0}const Pt=ct(Mt="getPushClientId",function(e,t,n,i){return pt(e,t,0,i)}(Mt,((e,{resolve:t,reject:n})=>{Promise.resolve().then((()=>{void 0===_t&&(_t=!1,Tt="",It="uniPush is not enabled"),At.push(((e,i)=>{e?t({cid:e}):n(i)})),void 0!==Tt&&Rt(Tt,It)}))}),0,Nt));var Mt,Nt;const Dt=[],Bt=/^\$|__f__|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|rpx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/,Lt=/^create|Manager$/,jt=["createBLEConnection"],Ut=["request","downloadFile","uploadFile","connectSocket"],Ft=["createBLEConnection"],Gt=/^on|^off/;function qt(e){return Lt.test(e)&&-1===jt.indexOf(e)}function zt(e){return Bt.test(e)&&-1===Ft.indexOf(e)}function Ht(e){return-1!==Ut.indexOf(e)}function $t(e){return!(qt(e)||zt(e)||function(e){return Gt.test(e)&&"onPush"!==e}(e))}function Vt(e,t){return $t(e)&&f(t)?function(n={},...i){return f(n.success)||f(n.fail)||f(n.complete)?st(e,at(e,t,a({},n),i)):st(e,new Promise(((o,s)=>{at(e,t,a({},n,{success:o,fail:s}),i)})))}:t}Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((n=>t.resolve(e&&e()).then((()=>n))),(n=>t.resolve(e&&e()).then((()=>{throw n}))))});const Kt=["success","fail","cancel","complete"];const Wt=()=>{const e=f(getApp)&&getApp({allowDefault:!0});return e&&e.$vm?e.$vm.$locale:function(){var e;let t="";{const n=(null===(e=wx.getAppBaseInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync();t=Fe(n&&n.language?n.language:Be)||Be}return t}()},Xt=[];"undefined"!=typeof global&&(global.getLocale=Wt);const Jt="__DC_STAT_UUID";let Qt;function Yt(e=wx){return function(t,n){Qt=Qt||e.getStorageSync(Jt),Qt||(Qt=Date.now()+""+Math.floor(1e7*Math.random()),wx.setStorage({key:Jt,data:Qt})),n.deviceId=Qt}}function Zt(e,t){if(e.safeArea){const n=e.safeArea;t.safeAreaInsets={top:n.top,left:n.left,right:e.windowWidth-n.right,bottom:e.screenHeight-n.bottom}}}function en(e,t){let n="",i="";switch(n=e.split(" ")[0]||t,i=e.split(" ")[1]||"",n=n.toLowerCase(),n){case"harmony":case"ohos":case"openharmony":n="harmonyos";break;case"iphone os":n="ios";break;case"mac":case"darwin":n="macos";break;case"windows_nt":n="windows"}return{osName:n,osVersion:i}}function tn(e,t){let n=e.deviceType||"phone";{const e={ipad:"pad",windows:"pc",mac:"pc"},i=Object.keys(e),o=t.toLowerCase();for(let t=0;t{Zt(e,t),Yt()(e,t),function(e,t){const{brand:n="",model:i="",system:o="",language:s="",theme:r,version:c,platform:l,fontSizeSetting:u,SDKVersion:p,pixelRatio:d,deviceOrientation:h}=e,{osName:f,osVersion:m}=en(o,l);let g=c,v=tn(e,i),y=nn(n),b=sn(e),x=h,S=d,k=p;const C=(s||"").replace(/_/g,"-"),w={appId:"__UNI__A6CDB98",appName:"tk-mini-program",appVersion:"1.0.0",appVersionCode:"100",appLanguage:on(C),uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75",uniPlatform:"mp-weixin",deviceBrand:y,deviceModel:i,deviceType:v,devicePixelRatio:S,deviceOrientation:x,osName:f,osVersion:m,hostTheme:r,hostVersion:g,hostLanguage:C,hostName:b,hostSDKVersion:k,hostFontSizeSetting:u,windowTop:0,windowBottom:0,osLanguage:void 0,osTheme:void 0,ua:void 0,hostPackageName:void 0,browserName:void 0,browserVersion:void 0,isUniAppX:!1};a(t,w)}(e,t)}},an=rn,cn={args(e,t){let n=parseInt(e.current);if(isNaN(n))return;const i=e.urls;if(!p(i))return;const o=i.length;return o?(n<0?n=0:n>=o&&(n=o-1),n>0?(t.current=i[n],t.urls=i.filter(((e,t)=>!(t{const{brand:n,model:i,system:o="",platform:s=""}=e;let r=tn(e,i),c=nn(n);Yt()(e,t);const{osName:l,osVersion:u}=en(o,s);t=ye(a(t,{deviceType:r,deviceBrand:c,deviceModel:i,osName:l,osVersion:u}))}},pn={returnValue:(e,t)=>{const{version:n,language:i,SDKVersion:o,theme:s}=e;let r=sn(e),c=(i||"").replace(/_/g,"-");const l={hostVersion:n,hostLanguage:c,hostName:r,hostSDKVersion:o,hostTheme:s,appId:"__UNI__A6CDB98",appName:"tk-mini-program",appVersion:"1.0.0",appVersionCode:"100",appLanguage:on(c),isUniAppX:!1,uniPlatform:"mp-weixin",uniCompileVersion:"4.75",uniCompilerVersion:"4.75",uniRuntimeVersion:"4.75"};a(t,l)}},dn={returnValue:(e,t)=>{Zt(e,t),t=ye(a(t,{windowTop:0,windowBottom:0}))}},hn={args(e){const t=getApp({allowDefault:!0})||{};t.$vm?Zo($,e,t.$vm.$):(wx.$onErrorHandlers||(wx.$onErrorHandlers=[]),wx.$onErrorHandlers.push(e))}},fn={args(e){const t=getApp({allowDefault:!0})||{};if(t.$vm){if(e.__weh){const n=t.$vm.$[$];if(n){const t=n.indexOf(e.__weh);t>-1&&n.splice(t,1)}}}else{if(!wx.$onErrorHandlers)return;const t=wx.$onErrorHandlers.findIndex((t=>t===e));-1!==t&&wx.$onErrorHandlers.splice(t,1)}}},mn={args(){if(wx.__uni_console__){if(wx.__uni_console_warned__)return;wx.__uni_console_warned__=!0,console.warn("开发模式下小程序日志回显会使用 socket 连接,为了避免冲突,建议使用 SocketTask 的方式去管理 WebSocket 或手动关闭日志回显功能。[详情](https://uniapp.dcloud.net.cn/tutorial/run/mp-log.html)")}}},gn=mn,vn={$on:kt,$off:wt,$once:Ct,$emit:Et,upx2px:gt,rpx2px:gt,interceptors:{},addInterceptor:bt,removeInterceptor:xt,onCreateVueApp:function(e){if(Te)return e(Te);Ie.push(e)},invokeCreateVueAppHook:function(e){Te=e,Ie.forEach((t=>t(e)))},getLocale:Wt,setLocale:e=>{const t=f(getApp)&&getApp();if(!t)return!1;return t.$vm.$locale!==e&&(t.$vm.$locale=e,Xt.forEach((t=>t({locale:e}))),!0)},onLocaleChange:e=>{-1===Xt.indexOf(e)&&Xt.push(e)},getPushClientId:Pt,onPushMessage:e=>{-1===Dt.indexOf(e)&&Dt.push(e)},offPushMessage:e=>{if(e){const t=Dt.indexOf(e);t>-1&&Dt.splice(t,1)}else Dt.length=0},invokePushCallback:function(e){if("enabled"===e.type)_t=!0;else if("clientId"===e.type)Tt=e.cid,It=e.errMsg,Rt(Tt,e.errMsg);else if("pushMsg"===e.type){const t={type:"receive",data:Ot(e.message)};for(let e=0;e{t({type:"click",data:Ot(e.message)})}))},__f__:function(e,t,...n){t&&n.push(t),console[e].apply(console,n)}};const yn=["qy","env","error","version","lanDebug","cloud","serviceMarket","router","worklet","__webpack_require_UNI_MP_PLUGIN__"],bn=["lanDebug","router","worklet"],xn=wx.getLaunchOptionsSync?wx.getLaunchOptionsSync():null;function Sn(e){return(!xn||1154!==xn.scene||!bn.includes(e))&&(yn.indexOf(e)>-1||"function"==typeof wx[e])}function kn(){const e={};for(const t in wx)Sn(t)&&(e[t]=wx[t]);return"undefined"!=typeof globalThis&&"undefined"==typeof requireMiniProgram&&(globalThis.wx=e),e}const Cn=["__route__","__wxExparserNodeId__","__wxWebviewId__"],wn=(En={oauth:["weixin"],share:["weixin"],payment:["wxpay"],push:["weixin"]},function({service:e,success:t,fail:n,complete:i}){let o;En[e]?(o={errMsg:"getProvider:ok",service:e,provider:En[e]},f(t)&&t(o)):(o={errMsg:"getProvider:fail:服务["+e+"]不存在"},f(n)&&n(o)),f(i)&&i(o)});var En;const Tn=kn();Tn.canIUse("getAppBaseInfo")||(Tn.getAppBaseInfo=Tn.getSystemInfoSync),Tn.canIUse("getWindowInfo")||(Tn.getWindowInfo=Tn.getSystemInfoSync),Tn.canIUse("getDeviceInfo")||(Tn.getDeviceInfo=Tn.getSystemInfoSync);let In=Tn.getAppBaseInfo&&Tn.getAppBaseInfo();In||(In=Tn.getSystemInfoSync());const _n=In?In.host:null,On=_n&&"SAAASDK"===_n.env?Tn.miniapp.shareVideoMessage:Tn.shareVideoMessage;var An=Object.freeze({__proto__:null,createSelectorQuery:function(){const e=Tn.createSelectorQuery(),t=e.in;return e.in=function(e){return e.$scope?t.call(this,e.$scope):t.call(this,function(e){const t=Object.create(null);return Cn.forEach((n=>{t[n]=e[n]})),t}(e))},e},getProvider:wn,shareVideoMessage:On});const Rn={args(e,t){e.compressedHeight&&!t.compressHeight&&(t.compressHeight=e.compressedHeight),e.compressedWidth&&!t.compressWidth&&(t.compressWidth=e.compressedWidth)}};var Pn=Object.freeze({__proto__:null,compressImage:Rn,getAppAuthorizeSetting:{returnValue:function(e,t){const{locationReducedAccuracy:n}=e;t.locationAccuracy="unsupported",!0===n?t.locationAccuracy="reduced":!1===n&&(t.locationAccuracy="full")}},getAppBaseInfo:pn,getDeviceInfo:un,getSystemInfo:rn,getSystemInfoSync:an,getWindowInfo:dn,offError:fn,onError:hn,onSocketMessage:gn,onSocketOpen:mn,previewImage:cn,redirectTo:{},showActionSheet:ln});const Mn=kn();var Nn=function(e,t,n=wx){const i=function(e){function t(e,t,n){return function(o){return t(i(e,o,n))}}function n(e,n,i={},o={},s=!1){if(S(n)){const r=!0===s?n:{};f(i)&&(i=i(n,r)||{});for(const a in n)if(u(i,a)){let t=i[a];f(t)&&(t=t(n[a],n,r)),t?m(t)?r[t]=n[a]:S(t)&&(r[t.name?t.name:a]=t.value):console.warn(`微信小程序 ${e} 暂不支持 ${a}`)}else if(-1!==Kt.indexOf(a)){const i=n[a];f(i)&&(r[a]=t(e,i,o))}else s||u(r,a)||(r[a]=n[a]);return r}return f(n)&&(f(i)&&i(n,{}),n=t(e,n,o)),n}function i(t,i,o,s=!1){return f(e.returnValue)&&(i=e.returnValue(t,i)),n(t,i,o,{},s||!1)}return function(t,o){const s=u(e,t);if(!s&&"function"!=typeof wx[t])return o;const r=s||f(e.returnValue)||qt(t)||Ht(t),a=s||f(o);if(!s&&!o)return function(){console.error(`微信小程序 暂不支持${t}`)};if(!r||!a)return o;const c=e[t];return function(e,o){let s=c||{};f(c)&&(s=c(e));const r=[e=n(t,e,s.args,s.returnValue)];void 0!==o&&r.push(o);const a=wx[s.name||t].apply(wx,r);return(qt(t)||Ht(t))&&a&&!a.__v_skip&&(a.__v_skip=!0),zt(t)?i(t,a,s.returnValue,qt(t)):a}}}(t);return new Proxy({},{get:(t,o)=>u(t,o)?t[o]:u(e,o)?Vt(o,e[o]):u(vn,o)?Vt(o,vn[o]):Vt(o,i(o,n[o]))})}(An,Pn,Mn);let Dn,Bn;class Ln{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Dn,!e&&Dn&&(this.index=(Dn.scopes||(Dn.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=Dn;try{return Dn=this,e()}finally{Dn=t}}}on(){Dn=this}off(){Dn=this.parent}stop(e){if(this._active){let t,n;for(t=0,n=this.effects.length;t=4))break}1===this._dirtyLevel&&(this._dirtyLevel=0),Wn()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=Hn,t=Bn;try{return Hn=!0,Bn=this,this._runnings++,Gn(this),this.fn()}finally{qn(this),this._runnings--,Bn=t,Hn=e}}stop(){var e;this.active&&(Gn(this),qn(this),null==(e=this.onStop)||e.call(this),this.active=!1)}}function Gn(e){e._trackId++,e._depsLength=0}function qn(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t{const n=new Map;return n.cleanup=e,n.computed=t,n},ti=new WeakMap,ni=Symbol(""),ii=Symbol("");function oi(e,t,n){if(Hn&&Bn){let t=ti.get(e);t||ti.set(e,t=new Map);let i=t.get(n);i||t.set(n,i=ei((()=>t.delete(n)))),Qn(Bn,i)}}function si(e,t,n,i,o,s){const r=ti.get(e);if(!r)return;let a=[];if("clear"===t)a=[...r.values()];else if("length"===n&&p(e)){const e=Number(i);r.forEach(((t,n)=>{("length"===n||!g(n)&&n>=e)&&a.push(t)}))}else switch(void 0!==n&&a.push(r.get(n)),t){case"add":p(e)?k(n)&&a.push(r.get("length")):(a.push(r.get(ni)),d(e)&&a.push(r.get(ii)));break;case"delete":p(e)||(a.push(r.get(ni)),d(e)&&a.push(r.get(ii)));break;case"set":d(e)&&a.push(r.get(ni))}Xn();for(const c of a)c&&Zn(c,4);Jn()}const ri=e("__proto__,__v_isRef,__isVue"),ai=new Set(Object.getOwnPropertyNames(Symbol).filter((e=>"arguments"!==e&&"caller"!==e)).map((e=>Symbol[e])).filter(g)),ci=li();function li(){const e={};return["includes","indexOf","lastIndexOf"].forEach((t=>{e[t]=function(...e){const n=Xi(this);for(let t=0,o=this.length;t{e[t]=function(...e){Kn(),Xn();const n=Xi(this)[t].apply(this,e);return Jn(),Wn(),n}})),e}function ui(e){const t=Xi(this);return oi(t,0,e),t.hasOwnProperty(e)}class pi{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){const i=this._isReadonly,o=this._isShallow;if("__v_isReactive"===t)return!i;if("__v_isReadonly"===t)return i;if("__v_isShallow"===t)return o;if("__v_raw"===t)return n===(i?o?Gi:Fi:o?Ui:ji).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const s=p(e);if(!i){if(s&&u(ci,t))return Reflect.get(ci,t,n);if("hasOwnProperty"===t)return ui}const r=Reflect.get(e,t,n);return(g(t)?ai.has(t):ri(t))?r:(i||oi(e,0,t),o?r:no(r)?s&&k(t)?r:r.value:v(r)?i?Hi(r):zi(r):r)}}class di extends pi{constructor(e=!1){super(!1,e)}set(e,t,n,i){let o=e[t];if(!this._isShallow){const t=Ki(o);if(Wi(n)||Ki(n)||(o=Xi(o),n=Xi(n)),!p(e)&&no(o)&&!no(n))return!t&&(o.value=n,!0)}const s=p(e)&&k(t)?Number(t)e,yi=e=>Reflect.getPrototypeOf(e);function bi(e,t,n=!1,i=!1){const o=Xi(e=e.__v_raw),s=Xi(t);n||(R(t,s)&&oi(o,0,t),oi(o,0,s));const{has:r}=yi(o),a=i?vi:n?Yi:Qi;return r.call(o,t)?a(e.get(t)):r.call(o,s)?a(e.get(s)):void(e!==o&&e.get(t))}function xi(e,t=!1){const n=this.__v_raw,i=Xi(n),o=Xi(e);return t||(R(e,o)&&oi(i,0,e),oi(i,0,o)),e===o?n.has(e):n.has(e)||n.has(o)}function Si(e,t=!1){return e=e.__v_raw,!t&&oi(Xi(e),0,ni),Reflect.get(e,"size",e)}function ki(e){e=Xi(e);const t=Xi(this);return yi(t).has.call(t,e)||(t.add(e),si(t,"add",e,e)),this}function Ci(e,t){t=Xi(t);const n=Xi(this),{has:i,get:o}=yi(n);let s=i.call(n,e);s||(e=Xi(e),s=i.call(n,e));const r=o.call(n,e);return n.set(e,t),s?R(t,r)&&si(n,"set",e,t):si(n,"add",e,t),this}function wi(e){const t=Xi(this),{has:n,get:i}=yi(t);let o=n.call(t,e);o||(e=Xi(e),o=n.call(t,e)),i&&i.call(t,e);const s=t.delete(e);return o&&si(t,"delete",e,void 0),s}function Ei(){const e=Xi(this),t=0!==e.size,n=e.clear();return t&&si(e,"clear",void 0,void 0),n}function Ti(e,t){return function(n,i){const o=this,s=o.__v_raw,r=Xi(s),a=t?vi:e?Yi:Qi;return!e&&oi(r,0,ni),s.forEach(((e,t)=>n.call(i,a(e),a(t),o)))}}function Ii(e,t,n){return function(...i){const o=this.__v_raw,s=Xi(o),r=d(s),a="entries"===e||e===Symbol.iterator&&r,c="keys"===e&&r,l=o[e](...i),u=n?vi:t?Yi:Qi;return!t&&oi(s,0,c?ii:ni),{next(){const{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:a?[u(e[0]),u(e[1])]:u(e),done:t}},[Symbol.iterator](){return this}}}}function _i(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}function Oi(){const e={get(e){return bi(this,e)},get size(){return Si(this)},has:xi,add:ki,set:Ci,delete:wi,clear:Ei,forEach:Ti(!1,!1)},t={get(e){return bi(this,e,!1,!0)},get size(){return Si(this)},has:xi,add:ki,set:Ci,delete:wi,clear:Ei,forEach:Ti(!1,!0)},n={get(e){return bi(this,e,!0)},get size(){return Si(this,!0)},has(e){return xi.call(this,e,!0)},add:_i("add"),set:_i("set"),delete:_i("delete"),clear:_i("clear"),forEach:Ti(!0,!1)},i={get(e){return bi(this,e,!0,!0)},get size(){return Si(this,!0)},has(e){return xi.call(this,e,!0)},add:_i("add"),set:_i("set"),delete:_i("delete"),clear:_i("clear"),forEach:Ti(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((o=>{e[o]=Ii(o,!1,!1),n[o]=Ii(o,!0,!1),t[o]=Ii(o,!1,!0),i[o]=Ii(o,!0,!0)})),[e,n,t,i]}const[Ai,Ri,Pi,Mi]=Oi();function Ni(e,t){const n=t?e?Mi:Pi:e?Ri:Ai;return(t,i,o)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(u(n,i)&&i in t?n:t,i,o)}const Di={get:Ni(!1,!1)},Bi={get:Ni(!1,!0)},Li={get:Ni(!0,!1)},ji=new WeakMap,Ui=new WeakMap,Fi=new WeakMap,Gi=new WeakMap;function qi(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((e=>x(e).slice(8,-1))(e))}function zi(e){return Ki(e)?e:$i(e,!1,fi,Di,ji)}function Hi(e){return $i(e,!0,mi,Li,Fi)}function $i(e,t,n,i,o){if(!v(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const s=o.get(e);if(s)return s;const r=qi(e);if(0===r)return e;const a=new Proxy(e,2===r?i:n);return o.set(e,a),a}function Vi(e){return Ki(e)?Vi(e.__v_raw):!(!e||!e.__v_isReactive)}function Ki(e){return!(!e||!e.__v_isReadonly)}function Wi(e){return!(!e||!e.__v_isShallow)}function Xi(e){const t=e&&e.__v_raw;return t?Xi(t):e}function Ji(e){return Object.isExtensible(e)&&((e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})})(e,"__v_skip",!0),e}const Qi=e=>v(e)?zi(e):e,Yi=e=>v(e)?Hi(e):e;class Zi{constructor(e,t,n,i){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new Fn((()=>e(this._value)),(()=>to(this,2===this.effect._dirtyLevel?2:3))),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=n}get value(){const e=Xi(this);return e._cacheable&&!e.effect.dirty||!R(e._value,e._value=e.effect.run())||to(e,4),eo(e),e.effect._dirtyLevel>=2&&to(e,2),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function eo(e){var t;Hn&&Bn&&(e=Xi(e),Qn(Bn,null!=(t=e.dep)?t:e.dep=ei((()=>e.dep=void 0),e instanceof Zi?e:void 0)))}function to(e,t=4,n){const i=(e=Xi(e)).dep;i&&Zn(i,t)}function no(e){return!(!e||!0!==e.__v_isRef)}function io(e){return function(e,t){if(no(e))return e;return new oo(e,t)}(e,!1)}class oo{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:Xi(e),this._value=t?e:Qi(e)}get value(){return eo(this),this._value}set value(e){const t=this.__v_isShallow||Wi(e)||Ki(e);e=t?e:Xi(e),R(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:Qi(e),to(this,4))}}function so(e){return no(e)?e.value:e}const ro={get:(e,t,n)=>so(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const o=e[t];return no(o)&&!no(n)?(o.value=n,!0):Reflect.set(e,t,n,i)}};function ao(e){return Vi(e)?e:new Proxy(e,ro)}class co{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0}get value(){const e=this._object[this._key];return void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return e=Xi(this._object),t=this._key,null==(n=ti.get(e))?void 0:n.get(t);var e,t,n}}function lo(e,t,n){const i=e[t];return no(i)?i:new co(e,t,n)}function uo(e,t,n,i){try{return i?e(...i):e()}catch(o){ho(o,t,n)}}function po(e,t,n,i){if(f(e)){const o=uo(e,t,n,i);return o&&y(o)&&o.catch((e=>{ho(e,t,n)})),o}const o=[];for(let s=0;s>>1,o=vo[i],s=Oo(o);snull==e.id?1/0:e.id,Ao=(e,t)=>{const n=Oo(e)-Oo(t);if(0===n){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function Ro(e){go=!1,mo=!0,vo.sort(Ao);try{for(yo=0;yoOo(e)-Oo(t)));if(bo.length=0,xo)return void xo.push(...e);for(xo=e,So=0;Som(e)?e.trim():e))),n&&(s=i.map(M))}let c,l=o[c=A(n)]||o[c=A(T(n))];!l&&r&&(l=o[c=A(_(n))]),l&&po(l,e,6,s);const u=o[c+"Once"];if(u){if(e.emitted){if(e.emitted[c])return}else e.emitted={};e.emitted[c]=!0,po(u,e,6,s)}}function Mo(e,t,n=!1){const i=t.emitsCache,o=i.get(e);if(void 0!==o)return o;const s=e.emits;let r={},c=!1;if(!f(e)){const i=e=>{const n=Mo(e,t,!0);n&&(c=!0,a(r,n))};!n&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}return s||c?(p(s)?s.forEach((e=>r[e]=null)):a(r,s),v(e)&&i.set(e,r),r):(v(e)&&i.set(e,null),null)}function No(e,t){return!(!e||!s(t))&&(t=t.slice(2).replace(/Once$/,""),u(e,t[0].toLowerCase()+t.slice(1))||u(e,_(t))||u(e,t))}let Do=null;function Bo(e){const t=Do;return Do=e,e&&e.type.__scopeId,t}const Lo="components";function jo(e,t){return e&&(e[t]||e[T(t)]||e[O(T(t))])}const Uo={};function Fo(e,t,n){return Go(e,t,n)}function Go(e,n,{immediate:o,deep:s,flush:r,once:a,onTrack:l,onTrigger:u}=t){if(n&&a){const e=n;n=(...t)=>{e(...t),E()}}const d=Gs,h=e=>!0===s?e:Ho(e,!1===s?1:void 0);let m,g,v=!1,y=!1;if(no(e)?(m=()=>e.value,v=Wi(e)):Vi(e)?(m=()=>h(e),v=!0):p(e)?(y=!0,v=e.some((e=>Vi(e)||Wi(e))),m=()=>e.map((e=>no(e)?e.value:Vi(e)?h(e):f(e)?uo(e,d,2):void 0))):m=f(e)?n?()=>uo(e,d,2):()=>(g&&g(),po(e,d,3,[b])):i,n&&s){const e=m;m=()=>Ho(e())}let b=e=>{g=C.onStop=()=>{uo(e,d,4),g=C.onStop=void 0}},x=y?new Array(e.length).fill(Uo):Uo;const S=()=>{if(C.active&&C.dirty)if(n){const e=C.run();(s||v||(y?e.some(((e,t)=>R(e,x[t]))):R(e,x)))&&(g&&g(),po(n,d,3,[e,x===Uo?void 0:y&&x[0]===Uo?[]:x,b]),x=e)}else C.run()};let k;S.allowRecurse=!!n,"sync"===r?k=S:"post"===r?k=()=>Bs(S,d&&d.suspense):(S.pre=!0,d&&(S.id=d.uid),k=()=>Eo(S));const C=new Fn(m,i,k),w=Un(),E=()=>{C.stop(),w&&c(w.effects,C)};return n?o?S():x=C.run():"post"===r?Bs(C.run.bind(C),d&&d.suspense):C.run(),E}function qo(e,t,n){const i=this.proxy,o=m(e)?e.includes(".")?zo(i,e):()=>i[e]:e.bind(i,i);let s;f(t)?s=t:(s=t.handler,n=t);const r=$s(this),a=Go(o,s.bind(i),n);return r(),a}function zo(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e0){if(n>=t)return e;n++}if((i=i||new Set).has(e))return e;if(i.add(e),no(e))Ho(e.value,t,n,i);else if(p(e))for(let o=0;o{Ho(e,t,n,i)}));else if(S(e))for(const o in e)Ho(e[o],t,n,i);return e}function $o(){return{app:null,config:{isNativeTag:o,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Vo=0;let Ko=null;function Wo(e,t,n=!1){const i=Gs||Do;if(i||Ko){const o=i?null==i.parent?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:Ko._context.provides;if(o&&e in o)return o[e];if(arguments.length>1)return n&&f(t)?t.call(i&&i.proxy):t}}function Xo(e,t){Qo(e,"a",t)}function Jo(e,t){Qo(e,"da",t)}function Qo(e,t,n=Gs){const i=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Zo(t,i,n),n){let e=n.parent;for(;e&&e.parent;)e.parent.vnode.type.__isKeepAlive&&Yo(i,t,n,e),e=e.parent}}function Yo(e,t,n,i){const o=Zo(t,e,i,!0);rs((()=>{c(i[t],o)}),n)}function Zo(e,t,n=Gs,i=!1){if(n){(function(e){return ke.indexOf(e)>-1})(e)&&(n=n.root);const o=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;Kn();const o=$s(n),s=po(t,n,e,i);return o(),Wn(),s});return i?o.unshift(s):o.push(s),s}}const es=e=>(t,n=Gs)=>(!Ws||"sp"===e)&&Zo(e,((...e)=>t(...e)),n),ts=es("bm"),ns=es("m"),is=es("bu"),os=es("u"),ss=es("bum"),rs=es("um"),as=es("sp"),cs=es("rtg"),ls=es("rtc");function us(e,t=Gs){Zo("ec",e,t)}const ps=e=>e?Ks(e)?Qs(e)||e.proxy:ps(e.parent):null;const ds=a(Object.create(null),{$:function(e){return e},$el:e=>e.__$el||(e.__$el={}),$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ps(e.parent),$root:e=>ps(e.root),$emit:e=>e.emit,$options:e=>xs(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,Eo(e.update)}),$watch:e=>qo.bind(e)}),hs=(e,n)=>e!==t&&!e.__isScriptSetup&&u(e,n),fs={get({_:e},n){const{ctx:i,setupState:o,data:s,props:r,accessCache:a,type:c,appContext:l}=e;let p;if("$"!==n[0]){const c=a[n];if(void 0!==c)switch(c){case 1:return o[n];case 2:return s[n];case 4:return i[n];case 3:return r[n]}else{if(hs(o,n))return a[n]=1,o[n];if(s!==t&&u(s,n))return a[n]=2,s[n];if((p=e.propsOptions[0])&&u(p,n))return a[n]=3,r[n];if(i!==t&&u(i,n))return a[n]=4,i[n];gs&&(a[n]=0)}}const d=ds[n];let h,f;return d?("$attrs"===n&&oi(e,0,n),d(e)):(h=c.__cssModules)&&(h=h[n])?h:i!==t&&u(i,n)?(a[n]=4,i[n]):(f=l.config.globalProperties,u(f,n)?f[n]:void 0)},set({_:e},n,i){const{data:o,setupState:s,ctx:r}=e;return hs(s,n)?(s[n]=i,!0):o!==t&&u(o,n)?(o[n]=i,!0):!u(e.props,n)&&(("$"!==n[0]||!(n.slice(1)in e))&&(r[n]=i,!0))},has({_:{data:e,setupState:n,accessCache:i,ctx:o,appContext:s,propsOptions:r}},a){let c;return!!i[a]||e!==t&&u(e,a)||hs(n,a)||(c=r[0])&&u(c,a)||u(o,a)||u(ds,a)||u(s.config.globalProperties,a)},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:u(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function ms(e){return p(e)?e.reduce(((e,t)=>(e[t]=null,e)),{}):e}let gs=!0;function vs(e){const t=xs(e),n=e.proxy,o=e.ctx;gs=!1,t.beforeCreate&&ys(t.beforeCreate,e,"bc");const{data:s,computed:r,methods:a,watch:c,provide:l,inject:u,created:d,beforeMount:h,mounted:m,beforeUpdate:g,updated:y,activated:b,deactivated:x,beforeDestroy:S,beforeUnmount:k,destroyed:C,unmounted:w,render:E,renderTracked:T,renderTriggered:I,errorCaptured:_,serverPrefetch:O,expose:A,inheritAttrs:R,components:P,directives:M,filters:N}=t;if(u&&function(e,t){p(e)&&(e=ws(e));for(const n in e){const i=e[n];let o;o=v(i)?"default"in i?Wo(i.from||n,i.default,!0):Wo(i.from||n):Wo(i),no(o)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>o.value,set:e=>o.value=e}):t[n]=o}}(u,o),a)for(const i in a){const e=a[i];f(e)&&(o[i]=e.bind(n))}if(s){const t=s.call(n,n);v(t)&&(e.data=zi(t))}if(gs=!0,r)for(const p in r){const e=r[p],t=f(e)?e.bind(n,n):f(e.get)?e.get.bind(n,n):i,s=!f(e)&&f(e.set)?e.set.bind(n):i,a=Ys({get:t,set:s});Object.defineProperty(o,p,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e})}if(c)for(const i in c)bs(c[i],o,n,i);function D(e,t){p(t)?t.forEach((t=>e(t.bind(n)))):t&&e(t.bind(n))}if(function(){if(l){const e=f(l)?l.call(n):l;Reflect.ownKeys(e).forEach((t=>{!function(e,t){if(Gs){let n=Gs.provides;const i=Gs.parent&&Gs.parent.provides;i===n&&(n=Gs.provides=Object.create(i)),n[e]=t,"app"===Gs.type.mpType&&Gs.appContext.app.provide(e,t)}}(t,e[t])}))}}(),d&&ys(d,e,"c"),D(ts,h),D(ns,m),D(is,g),D(os,y),D(Xo,b),D(Jo,x),D(us,_),D(ls,T),D(cs,I),D(ss,k),D(rs,w),D(as,O),p(A))if(A.length){const t=e.exposed||(e.exposed={});A.forEach((e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t})}))}else e.exposed||(e.exposed={});E&&e.render===i&&(e.render=E),null!=R&&(e.inheritAttrs=R),P&&(e.components=P),M&&(e.directives=M),e.ctx.$onApplyOptions&&e.ctx.$onApplyOptions(t,e,n)}function ys(e,t,n){po(p(e)?e.map((e=>e.bind(t.proxy))):e.bind(t.proxy),t,n)}function bs(e,t,n,i){const o=i.includes(".")?zo(n,i):()=>n[i];if(m(e)){const n=t[e];f(n)&&Fo(o,n)}else if(f(e))Fo(o,e.bind(n));else if(v(e))if(p(e))e.forEach((e=>bs(e,t,n,i)));else{const i=f(e.handler)?e.handler.bind(n):t[e.handler];f(i)&&Fo(o,i,e)}}function xs(e){const t=e.type,{mixins:n,extends:i}=t,{mixins:o,optionsCache:s,config:{optionMergeStrategies:r}}=e.appContext,a=s.get(t);let c;return a?c=a:o.length||n||i?(c={},o.length&&o.forEach((e=>Ss(c,e,r,!0))),Ss(c,t,r)):c=t,v(t)&&s.set(t,c),c}function Ss(e,t,n,i=!1){const{mixins:o,extends:s}=t;s&&Ss(e,s,n,!0),o&&o.forEach((t=>Ss(e,t,n,!0)));for(const r in t)if(i&&"expose"===r);else{const i=ks[r]||n&&n[r];e[r]=i?i(e[r],t[r]):t[r]}return e}const ks={data:Cs,props:Is,emits:Is,methods:Ts,computed:Ts,beforeCreate:Es,created:Es,beforeMount:Es,mounted:Es,beforeUpdate:Es,updated:Es,beforeDestroy:Es,beforeUnmount:Es,destroyed:Es,unmounted:Es,activated:Es,deactivated:Es,errorCaptured:Es,serverPrefetch:Es,components:Ts,directives:Ts,watch:function(e,t){if(!e)return t;if(!t)return e;const n=a(Object.create(null),e);for(const i in t)n[i]=Es(e[i],t[i]);return n},provide:Cs,inject:function(e,t){return Ts(ws(e),ws(t))}};function Cs(e,t){return t?e?function(){return a(f(e)?e.call(this,this):e,f(t)?t.call(this,this):t)}:t:e}function ws(e){if(p(e)){const t={};for(let n=0;n{h=!0;const[t,n]=Rs(e,i,!0);a(l,t),n&&d.push(...n)};!o&&i.mixins.length&&i.mixins.forEach(t),e.extends&&t(e.extends),e.mixins&&e.mixins.forEach(t)}if(!c&&!h)return v(e)&&s.set(e,n),n;if(p(c))for(let n=0;n-1,i[1]=n<0||t-1||u(i,"default"))&&d.push(e)}}}const m=[l,d];return v(e)&&s.set(e,m),m}function Ps(e){return"$"!==e[0]&&!C(e)}function Ms(e){if(null===e)return"null";if("function"==typeof e)return e.name||"";if("object"==typeof e){return e.constructor&&e.constructor.name||""}return""}function Ns(e,t){return Ms(e)===Ms(t)}function Ds(e,t){return p(t)?t.findIndex((t=>Ns(t,e))):f(t)&&Ns(t,e)?0:-1}const Bs=Io;function Ls(e){return e?Vi(t=e)||Ki(t)||"__vInternal"in e?a({},e):e:null;var t}const js=$o();let Us=0;function Fs(e,n,i){const o=e.type,s=(n?n.appContext:e.appContext)||js,r={uid:Us++,vnode:e,type:o,parent:n,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,scope:new Ln(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:n?n.provides:Object.create(s.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Rs(o,s),emitsOptions:Mo(o,s),emit:null,emitted:null,propsDefaults:t,inheritAttrs:o.inheritAttrs,ctx:t,data:t,props:t,attrs:t,slots:t,refs:t,setupState:t,setupContext:null,attrsProxy:null,slotsProxy:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null,$uniElements:new Map,$templateUniElementRefs:[],$templateUniElementStyles:{},$eS:{},$eA:{}};return r.ctx={_:r},r.root=n?n.root:r,r.emit=Po.bind(null,r),e.ce&&e.ce(r),r}let Gs=null;const qs=()=>Gs||Do;let zs,Hs;zs=e=>{Gs=e},Hs=e=>{Ws=e};const $s=e=>{const t=Gs;return zs(e),e.scope.on(),()=>{e.scope.off(),zs(t)}},Vs=()=>{Gs&&Gs.scope.off(),zs(null)};function Ks(e){return 4&e.vnode.shapeFlag}let Ws=!1;function Xs(e,t=!1){t&&Hs(t);const{props:n}=e.vnode,i=Ks(e);_s(e,n,i,t);const o=i?function(e){const t=e.type;e.accessCache=Object.create(null),e.proxy=Ji(new Proxy(e.ctx,fs));const{setup:n}=t;if(n){const t=e.setupContext=n.length>1?function(e){const t=t=>{e.exposed=t||{}};return{get attrs(){return function(e){return e.attrsProxy||(e.attrsProxy=new Proxy(e.attrs,{get:(t,n)=>(oi(e,0,"$attrs"),t[n])}))}(e)},slots:e.slots,emit:e.emit,expose:t}}(e):null,i=$s(e);Kn();const o=uo(n,e,0,[e.props,t]);Wn(),i(),y(o)?o.then(Vs,Vs):function(e,t){f(t)?e.render=t:v(t)&&(e.setupState=ao(t));Js(e)}(e,o)}else Js(e)}(e):void 0;return t&&Hs(!1),o}function Js(e,t,n){const o=e.type;e.render||(e.render=o.render||i);{const t=$s(e);Kn();try{vs(e)}finally{Wn(),t()}}}function Qs(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(ao(Ji(e.exposed)),{get:(t,n)=>n in t?t[n]:e.proxy[n],has:(e,t)=>t in e||t in ds}))}const Ys=(e,t)=>{const n=function(e,t,n=!1){let o,s;const r=f(e);return r?(o=e,s=i):(o=e.get,s=e.set),new Zi(o,s,r||!s,n)}(e,0,Ws);return n},Zs="3.4.21";function er(e){return so(e)}const tr="[object Array]",nr="[object Object]";function ir(e,t){const n={};return or(e,t),sr(e,t,"",n),n}function or(e,t){if((e=er(e))===t)return;const n=x(e),i=x(t);if(n==nr&&i==nr)for(let o in t){const n=e[o];void 0===n?e[o]=null:or(n,t[o])}else n==tr&&i==tr&&e.length>=t.length&&t.forEach(((t,n)=>{or(e[n],t)}))}function sr(e,t,n,i){if((e=er(e))===t)return;const o=x(e),s=x(t);if(o==nr)if(s!=nr||Object.keys(e).length{sr(e,s[t],(""==n?"":n+".")+r+"["+t+"]",i)}));else if(a==nr)if(c!=nr||Object.keys(o).length{sr(e,t[o],n+"["+o+"]",i)})):rr(i,n,e)}function rr(e,t,n){e[t]=n}function ar(e){const t=e.ctx.__next_tick_callbacks;if(t&&t.length){const e=t.slice(0);t.length=0;for(let t=0;t{t?uo(t.bind(e.proxy),e,14):i&&i(e.proxy)})),new Promise((e=>{i=e}))}function lr(e,t){const n=typeof(e=er(e));if("object"===n&&null!==e){let n=t.get(e);if(void 0!==n)return n;if(p(e)){const i=e.length;n=new Array(i),t.set(e,n);for(let o=0;o{i[e]=n[e]})),i}(o,s));Object.keys(r).length?(i.__next_tick_pending=!0,o.setData(r,(()=>{i.__next_tick_pending=!1,ar(e)})),_o()):ar(e)}}function dr(e,t,n){t.appContext.config.globalProperties.$applyOptions(e,t,n);const i=e.computed;if(i){const e=Object.keys(i);if(e.length){const n=t.ctx;n.$computedKeys||(n.$computedKeys=[]),n.$computedKeys.push(...e)}}delete t.ctx.$onApplyOptions}function hr(e,t=!1){const{setupState:n,$templateRefs:i,$templateUniElementRefs:o,ctx:{$scope:s,$mpPlatform:r}}=e;if("mp-alipay"===r)return;if(!s||!i&&!o)return;if(t)return i&&i.forEach((e=>fr(e,null,n))),void(o&&o.forEach((e=>fr(e,null,n))));const a="mp-baidu"===r||"mp-toutiao"===r,c=e=>{if(0===e.length)return[];const t=(s.selectAllComponents(".r")||[]).concat(s.selectAllComponents(".r-i-f")||[]);return e.filter((e=>{const i=function(e,t){const n=e.find((e=>e&&(e.properties||e.props).uI===t));if(n){const e=n.$vm;return e?Qs(e.$)||e:function(e){v(e)&&Ji(e);return e}(n)}return null}(t,e.i);return!(!a||null!==i)||(fr(e,i,n),!1)}))},l=()=>{if(i){const t=c(i);t.length&&e.proxy&&e.proxy.$scope&&e.proxy.$scope.setData({r1:1},(()=>{c(t)}))}};o&&o.length&&cr(e,(()=>{o.forEach((e=>{p(e.v)?e.v.forEach((t=>{fr(e,t,n)})):fr(e,e.v,n)}))})),s._$setRef?s._$setRef(l):cr(e,l)}function fr({r:e,f:t},n,i){if(f(e))e(n,{});else{const o=m(e),s=no(e);if(o||s)if(t){if(!s)return;p(e.value)||(e.value=[]);const t=e.value;if(-1===t.indexOf(n)){if(t.push(n),!n)return;n.$&&ss((()=>c(t,n)),n.$)}}else o?u(i,e)&&(i[e]=n):no(e)&&(e.value=n)}}const mr=Io;function gr(e,t){const n=e.component=Fs(e,t.parentComponent,null);return n.renderer=t.mpType?t.mpType:"component",n.ctx.$onApplyOptions=dr,n.ctx.$children=[],"app"===t.mpType&&(n.render=i),t.onBeforeSetup&&t.onBeforeSetup(n,t),Xs(n),t.parentComponent&&n.proxy&&t.parentComponent.ctx.$children.push(Qs(n)||n.proxy),function(e){const t=Sr.bind(e);e.$updateScopedSlots=()=>wo((()=>Eo(t)));const n=()=>{if(e.isMounted){const{next:t,bu:n,u:i}=e;kr(e,!1),xr(),n&&P(n),kr(e,!0),pr(e,yr(e)),i&&mr(i)}else ss((()=>{hr(e,!0)}),e),pr(e,yr(e))},o=e.effect=new Fn(n,i,(()=>Eo(s)),e.scope),s=e.update=()=>{o.dirty&&o.run()};s.id=e.uid,kr(e,!0),s()}(n),n.proxy}const vr=e=>{let t;for(const n in e)("class"===n||"style"===n||s(n))&&((t||(t={}))[n]=e[n]);return t};function yr(e){const{type:t,vnode:n,proxy:i,withProxy:o,props:s,propsOptions:[r],slots:a,attrs:c,emit:l,render:u,renderCache:p,data:d,setupState:h,ctx:f,uid:m,appContext:{app:{config:{globalProperties:{pruneComponentPropsCache:g}}}},inheritAttrs:v}=e;let y;e.$uniElementIds=new Map,e.$templateRefs=[],e.$templateUniElementRefs=[],e.$templateUniElementStyles={},e.$ei=0,g(m),e.__counter=0===e.__counter?1:0;const b=Bo(e);try{if(4&n.shapeFlag){br(v,s,r,c);const e=o||i;y=u.call(e,e,p,s,h,d,f)}else{br(v,s,r,t.props?c:vr(c));const e=t;y=e.length>1?e(s,{attrs:c,slots:a,emit:l}):e(s,null)}}catch(x){ho(x,e,1),y=!1}return hr(e),Bo(b),y}function br(e,t,n,i){if(t&&i&&!1!==e){const e=Object.keys(i).filter((e=>"class"!==e&&"style"!==e));if(!e.length)return;n&&e.some(r)?e.forEach((e=>{r(e)&&e.slice(9)in n||(t[e]=i[e])})):e.forEach((e=>t[e]=i[e]))}}const xr=e=>{Kn(),_o(),Wn()};function Sr(){const e=this.$scopedSlotsData;if(!e||0===e.length)return;const t=this.ctx.$scope,n=t.data,i=Object.create(null);e.forEach((({path:e,index:t,data:o})=>{const s=ve(n,e),r=m(t)?`${e}.${t}`:`${e}[${t}]`;if(void 0===s||void 0===s[t])i[r]=o;else{const e=ir(o,s[t]);Object.keys(e).forEach((t=>{i[r+"."+t]=e[t]}))}})),e.length=0,Object.keys(i).length&&t.setData(i)}function kr({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}const Cr=function(e,t=null){f(e)||(e=a({},e)),null==t||v(t)||(t=null);const n=$o(),i=new WeakSet,o=n.app={_uid:Vo++,_component:e,_props:t,_container:null,_context:n,_instance:null,version:Zs,get config(){return n.config},set config(e){},use:(e,...t)=>(i.has(e)||(e&&f(e.install)?(i.add(e),e.install(o,...t)):f(e)&&(i.add(e),e(o,...t))),o),mixin:e=>(n.mixins.includes(e)||n.mixins.push(e),o),component:(e,t)=>t?(n.components[e]=t,o):n.components[e],directive:(e,t)=>t?(n.directives[e]=t,o):n.directives[e],mount(){},unmount(){},provide:(e,t)=>(n.provides[e]=t,o),runWithContext(e){const t=Ko;Ko=o;try{return e()}finally{Ko=t}}};return o};function wr(e,t=null){("undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof my?my:void 0).__VUE__=!0;const n=Cr(e,t),o=n._context;o.config.globalProperties.$nextTick=function(e){return cr(this.$,e)};const s=e=>(e.appContext=o,e.shapeFlag=6,e),r=function(e,t){return gr(s(e),t)},a=function(e){return e&&function(e){const{bum:t,scope:n,update:i,um:o}=e;t&&P(t);{const t=e.parent;if(t){const n=t.ctx.$children,i=Qs(e)||e.proxy,o=n.indexOf(i);o>-1&&n.splice(o,1)}}n.stop(),i&&(i.active=!1),o&&mr(o),mr((()=>{e.isUnmounted=!0}))}(e.$)};return n.mount=function(){e.render=i;const t=gr(s({type:e}),{mpType:"app",mpInstance:null,parentComponent:null,slots:[],props:null});return n._instance=t.$,t.$app=n,t.$createComponent=r,t.$destroyComponent=a,o.$appInstance=t,t},n.unmount=function(){},n}function Er(e,t,n,i){f(t)&&Zo(e,t.bind(n),i)}function Tr(e,t,n){!function(e,t,n){const i=e.mpType||n.$mpType;!i||"component"===i||"page"===i&&"component"===t.renderer||Object.keys(e).forEach((i=>{if(Ee(i,e[i],!1)){const o=e[i];p(o)?o.forEach((e=>Er(i,e,n,t))):Er(i,o,n,t)}}))}(e,t,n)}function Ir(e,t,n){return e[t]=n}function _r(e,...t){const n=this[e];return n?n(...t):(console.error(`method ${e} not found`),null)}function Or(e){const t=e.config.errorHandler;return function(n,i,o){t&&t(n,i,o);const s=e._instance;if(!s||!s.proxy)throw n;s[$]?s.proxy.$callHook($,n):fo(n,0,i&&i.$.vnode,!1)}}function Ar(e,t){return e?[...new Set([].concat(e,t))]:t}let Rr;const Pr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Mr=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function Nr(){const e=Nn.getStorageSync("uni_id_token")||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let n;try{n=JSON.parse((i=t[1],decodeURIComponent(Rr(i).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(o){throw new Error("获取当前用户信息出错,详细错误信息为:"+o.message)}var i;return n.tokenExpired=1e3*n.exp,delete n.exp,delete n.iat,n}function Dr(e){const t=e.config;var n;t.errorHandler=_e(e,Or),n=t.optionMergeStrategies,Ce.forEach((e=>{n[e]=Ar}));const i=t.globalProperties;!function(e){e.uniIDHasRole=function(e){const{role:t}=Nr();return t.indexOf(e)>-1},e.uniIDHasPermission=function(e){const{permission:t}=Nr();return this.uniIDHasRole("admin")||t.indexOf(e)>-1},e.uniIDTokenValid=function(){const{tokenExpired:e}=Nr();return e>Date.now()}}(i),i.$set=Ir,i.$applyOptions=Tr,i.$callMethod=_r,Nn.invokeCreateVueAppHook(e)}Rr="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Mr.test(e))throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,i,o="",s=0;s>16&255):64===i?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o}:atob;const Br=Object.create(null);function Lr(e){delete Br[e]}function jr(e){if(!e)return;const[t,n]=e.split(",");return Br[t]?Br[t][parseInt(n)]:void 0}var Ur={install(e){Dr(e),e.config.globalProperties.pruneComponentPropsCache=Lr;const t=e.mount;e.mount=function(n){const i=t.call(e,n),o=function(){const e="createApp";if("undefined"!=typeof global&&void 0!==global[e])return global[e];if("undefined"!=typeof my)return my[e]}();return o?o(i):"undefined"!=typeof createMiniProgramApp&&createMiniProgramApp(i),i}}};function Fr(e){return m(e)?e:function(e){let t="";if(!e||m(e))return t;for(const n in e)t+=`${n.startsWith("--")?n:_(n)}:${e[n]};`;return t}(N(e))}function Gr(e,t){const n=qs(),o=n.ctx,s=void 0===t||"mp-weixin"!==o.$mpPlatform&&"mp-qq"!==o.$mpPlatform&&"mp-xhs"!==o.$mpPlatform||!m(t)&&"number"!=typeof t?"":"_"+t,r="e"+n.$ei+++s,c=o.$scope;if(!e)return delete c[r],r;const l=c[r];return l?l.value=e:c[r]=function(e,t){const n=e=>{var o;(o=e).type&&o.target&&(o.preventDefault=i,o.stopPropagation=i,o.stopImmediatePropagation=i,u(o,"detail")||(o.detail={}),u(o,"markerId")&&(o.detail="object"==typeof o.detail?o.detail:{},o.detail.markerId=o.markerId),S(o.detail)&&u(o.detail,"checked")&&!u(o.detail,"value")&&(o.detail.value=o.detail.checked),S(o.detail)&&(o.target=a({},o.target,o.detail)));let s=[e];t&&t.ctx.$getTriggerEventDetail&&"number"==typeof e.detail&&(e.detail=t.ctx.$getTriggerEventDetail(e.detail)),e.detail&&e.detail.__args__&&(s=e.detail.__args__);const r=n.value,c=()=>po(function(e,t){if(p(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n&&n.call(e),e._stopped=!0},t.map((e=>t=>!t._stopped&&e(t)))}return t}(e,r),t,5,s),l=e.target,d=!!l&&(!!l.dataset&&"true"===String(l.dataset.eventsync));if(!qr.includes(e.type)||d){const t=c();if("input"===e.type&&(p(t)||y(t)))return;return t}setTimeout(c)};return n.value=e,n}(e,n),r}const qr=["tap","longpress","longtap","transitionend","animationstart","animationiteration","animationend","touchforcechange"];const zr=function(e,t=null){return e&&(e.mpType="app"),wr(e,t).use(Ur)};const Hr=["externalClasses"];const $r=/_(.*)_worklet_factory_/;function Vr(e,t){const n=e.$children;for(let o=n.length-1;o>=0;o--){const e=n[o];if(e.$scope._$vueId===t)return e}let i;for(let o=n.length-1;o>=0;o--)if(i=Vr(n[o],t),i)return i}const Kr=["createSelectorQuery","createIntersectionObserver","selectAllComponents","selectComponent"];function Wr(e,t){const n=e.ctx;n.mpType=t.mpType,n.$mpType=t.mpType,n.$mpPlatform="mp-weixin",n.$scope=t.mpInstance,Object.defineProperties(n,{[me]:{get(){const e=this.$scope.data[me];return void 0===e?"":e}}}),n.$mp={},n._self={},e.slots={},p(t.slots)&&t.slots.length&&(t.slots.forEach((t=>{e.slots[t]=!0})),e.slots.d&&(e.slots.default=!0)),n.getOpenerEventChannel=function(){return t.mpInstance.getOpenerEventChannel()},n.$hasHook=Xr,n.$callHook=Jr,e.emit=function(e,t){return function(n,...i){const o=t.$scope;if(o&&n){const e={__args__:i};o.triggerEvent(n,e)}return e.apply(this,[n,...i])}}(e.emit,n)}function Xr(e){const t=this.$[e];return!(!t||!t.length)}function Jr(e,t){"mounted"===e&&(Jr.call(this,"bm"),this.$.isMounted=!0,e="m");const n=this.$[e];return n&&((e,t)=>{let n;for(let i=0;i{Ee(n,e[n])&&t.add(n)}));{const{extends:n,mixins:i}=e;i&&i.forEach((e=>Yr(e,t))),n&&Yr(n,t)}}return t}function Zr(e,t,n){-1!==n.indexOf(t)||u(e,t)||(e[t]=function(e){return this.$vm&&this.$vm.$callHook(t,e)})}const ea=[J];function ta(e,t,n=ea){t.forEach((t=>Zr(e,t,n)))}function na(e,t,n=ea){Yr(t).forEach((t=>Zr(e,t,n)))}const ia=ge((()=>{const e=[],t=f(getApp)&&getApp({allowDefault:!0});if(t&&t.$vm&&t.$vm.$){const n=t.$vm.$.appContext.mixins;if(p(n)){const t=Object.keys(we);n.forEach((n=>{t.forEach((t=>{u(n,t)&&!e.includes(t)&&e.push(t)}))}))}}return e}));const oa=[q,z,$,V,K,W];function sa(e,t){const n=e.$,i={globalData:e.$options&&e.$options.globalData||{},$vm:e,onLaunch(t){this.$vm=e;const i=n.ctx;this.$vm&&i.$scope&&i.$callHook||(Wr(n,{mpType:"app",mpInstance:this,slots:[]}),i.globalData=this.globalData,e.$callHook(H,t))}},o=wx.$onErrorHandlers;o&&(o.forEach((e=>{Zo($,e,n)})),o.length=0),function(e){const t=io(function(){var e;let t="";{const n=(null===(e=wx.getAppBaseInfo)||void 0===e?void 0:e.call(wx))||wx.getSystemInfoSync();t=Fe(n&&n.language?n.language:Be)||Be}return t}());Object.defineProperty(e,"$locale",{get:()=>t.value,set(e){t.value=e}})}(e);const s=e.$.type;ta(i,oa),na(i,s);{const e=s.methods;e&&a(i,e)}return i}function ra(e,t){if(f(e.onLaunch)){const t=wx.getLaunchOptionsSync&&wx.getLaunchOptionsSync();e.onLaunch(t)}f(e.onShow)&&wx.onAppShow&&wx.onAppShow((e=>{t.$callHook("onShow",e)})),f(e.onHide)&&wx.onAppHide&&wx.onAppHide((e=>{t.$callHook("onHide",e)}))}const aa=["eO","uR","uRIF","uI","uT","uP","uS"];function ca(e){e.properties||(e.properties={}),a(e.properties,function(e,t=!1){const n={};if(!t){let e=function(e){const t=Object.create(null);e&&e.forEach((e=>{t[e]=!0})),this.setData({$slots:t})};aa.forEach((e=>{n[e]={type:null,value:""}})),n.uS={type:null,value:[]},n.uS.observer=e}return e.behaviors&&e.behaviors.includes("wx://form-field")&&(e.properties&&e.properties.name||(n.name={type:null,value:""}),e.properties&&e.properties.value||(n.value={type:null,value:""})),n}(e),function(e){const t={};return e&&e.virtualHost&&(t.virtualHostStyle={type:null,value:""},t.virtualHostClass={type:null,value:""},t.virtualHostHidden={type:null,value:""},t[me]={type:null,value:""}),t}(e.options))}const la=[String,Number,Boolean,Object,Array,null];function ua(e,t){const n=function(e){return p(e)&&1===e.length?e[0]:e}(e);return-1!==la.indexOf(n)?n:null}function pa(e,t){return(t?function(e){const t={};S(e)&&Object.keys(e).forEach((n=>{-1===aa.indexOf(n)&&(t[n]=e[n])}));return t}(e):jr(e.uP))||{}}function da(e){const t=function(){const e=this.properties.uP;e&&(this.$vm?function(e,t){const n=Xi(t.props),i=jr(e)||{};ha(n,i)&&(!function(e,t,n,i){const{props:o,attrs:s,vnode:{patchFlag:r}}=e,a=Xi(o),[c]=e.propsOptions;let l=!1;if(!(i||r>0)||16&r){let i;Os(e,t,o,s)&&(l=!0);for(const s in a)t&&(u(t,s)||(i=_(s))!==s&&u(t,i))||(c?!n||void 0===n[s]&&void 0===n[i]||(o[s]=As(c,a,s,void 0,e,!0)):delete o[s]);if(s!==a)for(const e in s)t&&u(t,e)||(delete s[e],l=!0)}else if(8&r){const n=e.vnode.dynamicProps;for(let i=0;i-1&&function(e){const t=vo.indexOf(e);t>yo&&vo.splice(t,1)}(t.update),t.update());var o}(e,this.$vm.$):"m"===this.properties.uT&&function(e,t){const n=t.properties,i=jr(e)||{};ha(n,i,!1)&&t.setData(i)}(e,this))};e.observers||(e.observers={}),e.observers.uP=t}function ha(e,t,n=!0){const i=Object.keys(t);if(n&&i.length!==Object.keys(e).length)return!0;for(let o=0;o{i.push(e.replace("uni://","wx://")),"uni://form-field"===e&&(p(n)?(n.push("name"),n.push("modelValue")):(n.name={type:String,default:""},n.modelValue={type:[String,Number,Boolean,Array,Object,Date],default:""}))})),i}(t)}function ma(e,{parse:t,mocks:n,isPage:i,isPageInProject:o,initRelation:s,handleLink:r,initLifetimes:c}){e=e.default||e;const l={multipleSlots:!0,addGlobalClass:!0,pureDataPattern:/^uP$/};p(e.mixins)&&e.mixins.forEach((e=>{v(e.options)&&a(l,e.options)})),e.options&&a(l,e.options);const d={options:l,lifetimes:c({mocks:n,isPage:i,initRelation:s,vueOptions:e}),pageLifetimes:{show(){this.$vm&&this.$vm.$callHook("onPageShow")},hide(){this.$vm&&this.$vm.$callHook("onPageHide")},resize(e){this.$vm&&this.$vm.$callHook("onPageResize",e)}},methods:{__l:r}};var h,f,m,g;return fa(d,e),ca(d),da(d),function(e,t){Hr.forEach((n=>{u(t,n)&&(e[n]=t[n])}))}(d,e),h=d.methods,f=e.wxsCallMethods,p(f)&&f.forEach((e=>{h[e]=function(t){return this.$vm[e](t)}})),m=d.methods,(g=e.methods)&&Object.keys(g).forEach((e=>{const t=e.match($r);if(t){const n=t[1];m[e]=g[e],m[n]=g[n]}})),t&&t(d,{handleLink:r}),d}let ga,va;function ya(){return getApp().$vm}function ba(e,t){const{parse:n,mocks:i,isPage:o,initRelation:s,handleLink:r,initLifetimes:a}=t,c=ma(e,{mocks:i,isPage:o,isPageInProject:!0,initRelation:s,handleLink:r,initLifetimes:a});!function({properties:e},t){p(t)?t.forEach((t=>{e[t]={type:String,value:""}})):S(t)&&Object.keys(t).forEach((n=>{const i=t[n];if(S(i)){let t=i.default;f(t)&&(t=t());const o=i.type;i.type=ua(o),e[n]={type:i.type,value:t}}else e[n]={type:ua(i)}}))}(c,(e.default||e).props);const l=c.methods;return l.onLoad=function(e){var t;return this.options=e,this.$page={fullPath:(t=this.route+Se(e),function(e){return 0===e.indexOf("/")}(t)?t:"/"+t)},this.$vm&&this.$vm.$callHook(X,e)},ta(l,Qr),na(l,e),function(e,t){if(!t)return;Object.keys(we).forEach((n=>{t&we[n]&&Zr(e,n,[])}))}(l,e.__runtimeHooks),ta(l,ia()),n&&n(c,{handleLink:r}),c}const xa=Page,Sa=Component;function ka(e){const t=e.triggerEvent,n=function(n,...i){return t.apply(e,[(o=n,T(o.replace(be,"-"))),...i]);var o};try{e.triggerEvent=n}catch(i){e._triggerEvent=n}}function Ca(e,t,n){const i=t[e];t[e]=i?function(...e){return ka(this),i.apply(this,e)}:function(){ka(this)}}Page=function(e){return Ca(X,e),xa(e)},Component=function(e){Ca("created",e);return e.properties&&e.properties.uP||(ca(e),da(e)),Sa(e)};var wa=Object.freeze({__proto__:null,handleLink:function(e){const t=e.detail||e.value,n=t.vuePid;let i;n&&(i=Vr(this.$vm,n)),i||(i=this.$vm),t.parent=i},initLifetimes:function({mocks:e,isPage:t,initRelation:n,vueOptions:i}){return{attached(){let o=this.properties;!function(e,t){if(!e)return;const n=e.split(","),i=n.length;1===i?t._$vueId=n[0]:2===i&&(t._$vueId=n[0],t._$vuePid=n[1])}(o.uI,this);const s={vuePid:this._$vuePid};n(this,s);const r=this,a=t(r);let c=o;this.$vm=function(e,t){ga||(ga=ya().$createComponent);const n=ga(e,t);return Qs(n.$)||n}({type:i,props:pa(c,a)},{mpType:a?"page":"component",mpInstance:r,slots:o.uS||{},parentComponent:s.parent&&s.parent.$,onBeforeSetup(t,n){!function(e,t){Object.defineProperty(e,"refs",{get(){const e={};return function(e,t,n){e.selectAllComponents(t).forEach((e=>{const t=e.properties.uR;n[t]=e.$vm||e}))}(t,".r",e),t.selectAllComponents(".r-i-f").forEach((t=>{const n=t.properties.uR;n&&(e[n]||(e[n]=[]),e[n].push(t.$vm||t))})),e}})}(t,r),function(e,t,n){const i=e.ctx;n.forEach((n=>{u(t,n)&&(e[n]=i[n]=t[n])}))}(t,r,e),function(e,t){Wr(e,t);const n=e.ctx;Kr.forEach((e=>{n[e]=function(...t){const i=n.$scope;if(i&&i[e])return i[e].apply(i,t)}}))}(t,n)}}),a||function(e){const t=e.$options;p(t.behaviors)&&t.behaviors.includes("uni://form-field")&&e.$watch("modelValue",(()=>{e.$scope&&e.$scope.setData({name:e.name,value:e.modelValue})}),{immediate:!0})}(this.$vm)},ready(){this.$vm&&(this.$vm.$callHook("mounted"),this.$vm.$callHook(J))},detached(){var e;this.$vm&&(Lr(this.$vm.$.uid),e=this.$vm,va||(va=ya().$destroyComponent),va(e))}}},initRelation:function(e,t){e.triggerEvent("__l",t)},isPage:function(e){return!!e.route},mocks:["__route__","__wxExparserNodeId__","__wxWebviewId__"]});const Ea=function(e){return App(sa(e))},Ta=(Ia=wa,function(e){return Component(ba(e,Ia))});var Ia;const _a=function(e){return function(t){return Component(ma(t,e))}}(wa),Oa=function(e){ra(sa(e),e)},Aa=function(e){const t=sa(e),n=f(getApp)&&getApp({allowDefault:!0});if(!n)return;e.$.ctx.$scope=n;const i=n.globalData;i&&Object.keys(t.globalData).forEach((e=>{u(i,e)||(i[e]=t.globalData[e])})),Object.keys(t).forEach((e=>{u(n,e)||(n[e]=t[e])})),ra(t,e)};wx.createApp=global.createApp=Ea,wx.createPage=Ta,wx.createComponent=_a,wx.createPluginApp=global.createPluginApp=Oa,wx.createSubpackageApp=global.createSubpackageApp=Aa;
/*!
* pinia v2.1.7
* (c) 2023 Eduardo San Martin Morote
* @license MIT
*/
-let Ar;const Lr=e=>Ar=e,Pr=Symbol();function Nr(e){return e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)&&"function"!=typeof e.toJSON}var wr,Ur;(Ur=wr||(wr={})).direct="direct",Ur.patchObject="patch object",Ur.patchFunction="patch function";const Gr=()=>{};function xr(e,t,n,i=Gr){e.push(t);const o=()=>{const n=e.indexOf(t);n>-1&&(e.splice(n,1),i())};return!n&&Fn()&&function(e){wn&&wn.cleanups.push(e)}(o),o}function Fr(e,...t){e.slice().forEach((e=>{e(...t)}))}const Br=e=>e();function qr(e,t){e instanceof Map&&t instanceof Map&&t.forEach(((t,n)=>e.set(n,t))),e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const i=t[n],o=e[n];Nr(o)&&Nr(i)&&e.hasOwnProperty(n)&&!no(i)&&!zi(i)?e[n]=qr(o,i):e[n]=i}return e}const Vr=Symbol();const{assign:jr}=Object;function Hr(e,t,n,i){const{state:o,actions:s,getters:a}=t,r=n.state.value[e];let c;return c=Kr(e,(function(){r||(n.state.value[e]=o?o():{});const t=function(e){const t=d(e)?new Array(e.length):{};for(const n in e)t[n]=uo(e,n);return t}(n.state.value[e]);return jr(t,s,Object.keys(a||{}).reduce(((t,i)=>(t[i]=Ji(Qs((()=>{Lr(n);const t=n._s.get(e);return a[i].call(t,t)}))),t)),{}))}),t,n,i,!0),c}function Kr(e,t,n={},i,o,s){let a;const r=jr({actions:{}},n),c={deep:!0};let u,l,d,p=[],h=[];const g=i.state.value[e];let f;function m(t){let n;u=l=!1,"function"==typeof t?(t(i.state.value[e]),n={type:wr.patchFunction,storeId:e,events:d}):(qr(i.state.value[e],t),n={type:wr.patchObject,payload:t,storeId:e,events:d});const o=f=Symbol();Eo().then((()=>{f===o&&(u=!0)})),l=!0,Fr(p,n,i.state.value[e])}s||g||(i.state.value[e]={}),io({});const _=s?function(){const{state:e}=n,t=e?e():{};this.$patch((e=>{jr(e,t)}))}:Gr;function v(t,n){return function(){Lr(i);const o=Array.from(arguments),s=[],a=[];let r;Fr(h,{args:o,name:t,store:y,after:function(e){s.push(e)},onError:function(e){a.push(e)}});try{r=n.apply(this&&this.$id===e?this:y,o)}catch(c){throw Fr(a,c),c}return r instanceof Promise?r.then((e=>(Fr(s,e),e))).catch((e=>(Fr(a,e),Promise.reject(e)))):(Fr(s,r),r)}}const y=ji({_p:i,$id:e,$onAction:xr.bind(null,h),$patch:m,$reset:_,$subscribe(t,n={}){const o=xr(p,t,n.detached,(()=>s())),s=a.run((()=>Bo((()=>i.state.value[e]),(i=>{("sync"===n.flush?l:u)&&t({storeId:e,type:wr.direct,events:d},i)}),jr({},c,n))));return o},$dispose:function(){a.stop(),p=[],h=[],i._s.delete(e)}});i._s.set(e,y);const I=(i._a&&i._a.runWithContext||Br)((()=>i._e.run((()=>(a=xn()).run(t)))));for(const S in I){const t=I[S];if(no(t)&&(!no(C=t)||!C.effect)||zi(t))s||(!g||Nr(M=t)&&M.hasOwnProperty(Vr)||(no(t)?t.value=g[S]:qr(t,g[S])),i.state.value[e][S]=t);else if("function"==typeof t){const e=v(S,t);I[S]=e,r.actions[S]=t}}var M,C;return jr(y,I),jr($i(y),I),Object.defineProperty(y,"$state",{get:()=>i.state.value[e],set:e=>{m((t=>{jr(t,e)}))}}),i._p.forEach((e=>{jr(y,a.run((()=>e({store:y,app:i._a,pinia:i,options:r}))))})),g&&s&&n.hydrate&&n.hydrate(y.$state,g),u=!0,l=!0,y}var zr,Wr,Yr;(Yr=zr||(zr={})).UNIAPP="uniapp",Yr.REACT_NATIVE="rn",Yr.COCOS="cocos",Yr.UNKNOWN="unknown";let $r=class e{constructor(){this.framework=null,this.methods={[zr.UNIAPP]:this.isUniApp,[zr.REACT_NATIVE]:this.isReactNative,[zr.COCOS]:this.isCocos};const e=this.methods,t=Object.keys(e);for(const n of t)if((0,e[n])()){this.framework=n;break}this.framework=this.framework||zr.UNKNOWN,this.framework}static currentFramework(){return this.instance||(this.instance=new e),this.instance.framework}isUniApp(){try{return"function"==typeof Nn.getSystemInfoSync}catch(Yr){return!1}}isReactNative(){try{return"object"==typeof navigator&&"ReactNative"===navigator.product}catch(Yr){return!1}}isTaro(){try{return void 0!==process.env.TARO_ENV}catch(Yr){return!1}}isCocos(){try{return void 0!==cc.sys.localStorage}catch(Yr){return!1}}},Jr=class{static init(e){$r.currentFramework()===zr.REACT_NATIVE&&(this.validate(e),this.platform=e.platform,this.asyncStorage=e.asyncStorage)}static validate(e){if(!e)throw new Error("'reactNativeOptions' is missing when calling GoEasy.getInstance()");if(!e.platform)throw new Error("'platform' is missing in GoEasy 'reactNativeOptions'");if(!e.asyncStorage)throw new Error("'asyncStorage' is missing in GoEasy 'reactNativeOptions'")}};!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTING="connecting",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.RECONNECTED="reconnected",e.EXPIRED_RECONNECTED="reconnected",e.CONNECT_FAILED="connect_failed"}(Wr||(Wr={}));const Xr="2.13.17";var Qr,Zr;!function(e){e.PRIVATE="private",e.GROUP="group",e.SYSTEM="system",e.CS="cs"}(Qr||(Qr={})),function(e){e.NEW="new",e.SENDING="sending",e.SUCCESS="success",e.FAIL="fail"}(Zr||(Zr={}));let ec=class{},tc=class{constructor(e,t){this.id=e,this.data=t}},nc=new class{isDef(e){return!this.isUndef(e)}isUndef(e){return null==e}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}isObject(e){return null!==e&&"object"==typeof e}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}isValidArrayIndex(e){let t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}isString(e){return"string"==typeof e}isNumber(e){return"number"==typeof e}isStringOrNumber(e){return this.isString(e)||this.isNumber(e)}isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}isEmpty(e){return this.isArray(e)?0===e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""===e.trim():!this.isDef(e))}isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}isFunction(e){return"function"==typeof e}isBoolean(e){return"boolean"==typeof e}isTrue(e){return!0===e}isFalse(e){return!1===e}isNull(e){return null===e}};var ic;!function(e){e.MP_WX="mp-wx",e.MP_WGAME="mp-wgame",e.MP_BYTE="mp-byte",e.MP_BAIDU="mp-baidu",e.MP_ALI="mp-ali",e.BROWSER="browser",e.NODE="node",e.UNI_IOS="uni-ios",e.UNI_ANDROID="uni-android",e.COCOS_IOS="cocos-ios",e.COCOS_ANDROID="cocos-android",e.RN_IOS="rn-ios",e.RN_ANDROID="rn-android",e.UNKNOWN="unknown"}(ic||(ic={}));let oc=class e{constructor(){this.platform=null,this.methods={[ic.BROWSER]:this.isBrowser,[ic.MP_WX]:this.isMPWX,[ic.MP_WGAME]:this.isMPWeGame,[ic.MP_BYTE]:this.isMPByte,[ic.MP_BAIDU]:this.isMPBaidu,[ic.MP_ALI]:this.isMPAli,[ic.NODE]:this.isNode,[ic.UNI_IOS]:this.isUniAppIOS,[ic.UNI_ANDROID]:this.isUniAppAndroid,[ic.COCOS_IOS]:this.isCocosIOS,[ic.COCOS_ANDROID]:this.isCocosAndroid,[ic.RN_IOS]:this.isRNiOS,[ic.RN_ANDROID]:this.isRNAndroid};const e=this.methods,t=Object.keys(e);for(const n of t)if((0,e[n])()){this.platform=n;break}this.platform=this.platform||ic.UNKNOWN,this.platform}static currentPlatform(){return this.instance||(this.instance=new e),e.instance.platform}isBrowser(){return"undefined"!=typeof navigator&&"Taro"!==navigator.product&&"ReactNative"!==navigator.product&&"undefined"==typeof GameGlobal&&("undefined"==typeof cc||null!==cc.sys.browserType)&&"undefined"==typeof my&&"undefined"==typeof tt&&"undefined"==typeof swan}isMPWX(){return"object"==typeof Pn&&"function"==typeof Pn.getSystemInfoSync&&"undefined"==typeof WebSocket&&"undefined"==typeof XMLHttpRequest&&"undefined"==typeof plus&&"undefined"==typeof tt}isMPWeGame(){return"object"==typeof GameGlobal}isMPByte(){return"object"==typeof tt&&"function"==typeof tt.getSystemInfoSync}isMPBaidu(){return"object"==typeof swan&&"function"==typeof swan.getSystemInfoSync}isMPAli(){return"object"==typeof my&&"function"==typeof my.getSystemInfoSync}isNode(){try{return"node"===process.release.name}catch(Yr){return!1}}isUniAppIOS(){try{return"ios"===Nn.getSystemInfoSync().platform&&"app"===Nn.getSystemInfoSync().uniPlatform}catch(Yr){return!1}}isUniAppAndroid(){try{return"android"===Nn.getSystemInfoSync().platform&&"app"===Nn.getSystemInfoSync().uniPlatform}catch(Yr){return!1}}isCocosIOS(){try{return"iOS"===cc.sys.os}catch(Yr){return!1}}isCocosAndroid(){try{return"Android"===cc.sys.os}catch(Yr){return!1}}isRNiOS(){try{return"ios"===Jr.platform.OS}catch(Yr){return!1}}isRNAndroid(){try{return"android"===Jr.platform.OS}catch(Yr){return!1}}},sc=class{};sc.type=ic,sc.current=oc.currentPlatform();let ac=class{onFrontend(e){this.onFrontendCallback=e}},rc=class extends ac{constructor(){super(...arguments),this.runningBackend=!1}startCheck(){"object"==typeof plus&&(plus.globalEvent.addEventListener("resume",(()=>{this.runningBackend=!1,this.runningBackend,this.onFrontendCallback&&this.onFrontendCallback()}),!1),plus.globalEvent.addEventListener("pause",(()=>{this.runningBackend=!0,this.runningBackend}),!1))}isBackend(){return this.runningBackend}support(){const e=oc.currentPlatform();return[ic.UNI_IOS,ic.UNI_ANDROID].includes(e)}},uc=class extends ac{constructor(){super(...arguments),this.runningBackend=!1}startCheck(){Pn.onAppShow((()=>{this.runningBackend=!1})),Pn.onAppHide((()=>{this.runningBackend=!0}))}isBackend(){return this.runningBackend}support(){return oc.currentPlatform()===ic.MP_WX}};const lc=new class{constructor(){[new rc,new uc].forEach((e=>{if(e.support())return this.checker=e,void this.checker.startCheck()}))}isBackend(){return this.checker&&this.checker.isBackend()}onFrontend(e){this.checker.onFrontend(e)}};var dc,pc,hc=Object.freeze({__proto__:null,runStatus:lc});!function(e){e.authorize="authorize",e.manualDisconnect="manualDisconnect",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.publish="publish",e.ack="ack",e.historyMessages="historyMessages",e.hereNow="hereNow",e.hereNowByUserIds="hereNowByUserIds",e.PUBSUB_PRESENCE_SUBSCRIBE="PUBSUB_PRESENCE_SUBSCRIBE",e.PUBSUB_PRESENCE_UNSUBSCRIBE="PUBSUB_PRESENCE_UNSUBSCRIBE",e.PUBSUB_PRESENCE_HERENOW="PUBSUB_PRESENCE_HERENOW",e.imLastConversations="imLastConversations",e.markPrivateMessageAsRead="markPrivateMessageAsRead",e.markGroupMessageAsRead="markGroupMessageAsRead",e.imGroupOnlineCount="imGroupOnlineCount",e.imHereNow="imHereNow",e.imGroupHereNow="imGroupHereNow",e.publishIM="publishIM",e.subscribeUserPresence="subscribeUserPresence",e.unsubscribeUserPresence="unsubscribeUserPresence",e.subscribeGroupPresence="subscribeGroupPresence",e.unsubscribeGroupPresence="unsubscribeGroupPresence",e.removeConversation="removeConversation",e.topConversation="topConversation",e.imData="imData",e.subscribeGroups="subscribeGroups",e.unsubscribeGroup="unsubscribeGroup",e.IM_DELETE_MESSAGE="IM_DELETE_MESSAGE",e.IM_HISTORY="IM_HISTORY",e.IM_HISTORY_CHANGE="IM_HISTORY_CHANGE",e.IM_RECALL_MESSAGE="IM_RECALL_MESSAGE",e.IM_MARK_AS_READ="IM_MARK_AS_READ",e.CS_PENDING_CONVERSATION="CS_PENDING_CONVERSATION",e.CS_ACCEPT="CS_ACCEPT",e.CS_END="CS_END",e.CS_TRANSFER="CS_TRANSFER",e.CS_AGENTS="CS_AGENTS",e.CS_CUSTOMER_STATUS="CS_CUSTOMER_STATUS",e.CS_MY_TEAMS="CS_MY_TEAMS",e.CS_ONLINE="CS_ONLINE",e.CS_OFFLINE="CS_OFFLINE",e.CS_LIVE_SESSION="CS_LIVE_SESSION",e.CS_QUIT_LIVE="CS_QUIT_LIVE",e.SET_IOS_BADGE="SET_IOS_BADGE",e.MD_CMD="MD_CMD"}(dc||(dc={})),function(e){e[e.connect=3e3]="connect",e[e.reconnectionDelayMax=3e3]="reconnectionDelayMax",e[e.commonQuerySingle=2500]="commonQuerySingle",e[e.commonQueryTotal=12e3]="commonQueryTotal",e[e.commonRequestSingle=1700]="commonRequestSingle",e[e.commonRequestTotal=12e3]="commonRequestTotal",e[e.commonInfiniteSingle=1700]="commonInfiniteSingle",e[e.commonInfiniteTotal=864e5]="commonInfiniteTotal"}(pc||(pc={}));let gc=class{static onSuccess(e,t){nc.isFunction(e.onSuccess)&&e.onSuccess(t)}static onFailed(e,t){if(!nc.isObject(e)||!nc.isFunction(e.onFailed))throw t;e.onFailed(t)}};function fc(e,t,n,i){return new(n||(n=Promise))((function(o,s){function a(e){try{c(i.next(e))}catch(t){s(t)}}function r(e){try{c(i.throw(e))}catch(t){s(t)}}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,r)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var mc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _c(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})})),t}var vc={exports:{}};!function(){function e(t){if(t)return function(t){for(var n in e.prototype)t[n]=e.prototype[n];return t}(t)}vc.exports=e,e.prototype.on=e.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},e.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o>>((3&t)<<3)&255;return Sc}}for(var Ec=[],Tc=0;Tc<256;++Tc)Ec[Tc]=(Tc+256).toString(16).substr(1);var kc,Dc,Rc=function(e,t){var n=t||0,i=Ec;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")},Oc=Ic.exports,bc=Rc,Ac=0,Lc=0,Pc=Ic.exports,Nc=Rc,wc=function(e,t,n){var i=t&&n||0,o=t||[],s=(e=e||{}).node||kc,a=void 0!==e.clockseq?e.clockseq:Dc;if(null==s||null==a){var r=Oc();null==s&&(s=kc=[1|r[0],r[1],r[2],r[3],r[4],r[5]]),null==a&&(a=Dc=16383&(r[6]<<8|r[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),u=void 0!==e.nsecs?e.nsecs:Lc+1,l=c-Ac+(u-Lc)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||c>Ac)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ac=c,Lc=u,Dc=a;var d=(1e4*(268435455&(c+=122192928e5))+u)%4294967296;o[i++]=d>>>24&255,o[i++]=d>>>16&255,o[i++]=d>>>8&255,o[i++]=255&d;var p=c/4294967296*1e4&268435455;o[i++]=p>>>8&255,o[i++]=255&p,o[i++]=p>>>24&15|16,o[i++]=p>>>16&255,o[i++]=a>>>8|128,o[i++]=255&a;for(var h=0;h<6;++h)o[i+h]=s[h];return t||bc(o)},Uc=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||Pc)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[i+s]=o[s];return t||Nc(o)},Gc=Uc;Gc.v1=wc,Gc.v4=Uc;var xc=Gc;let Fc=class{support(){return!0}getParams(){return this.params}setData(e){this.active=e.a,this.data=e.d}preConnect(e){}postConnect(){}},Bc=class{static initModule(e){e.support()&&this.modules.set(e.name,e)}static getParams(){return fc(this,void 0,void 0,(function*(){let e={};for(const[t,n]of this.modules)e[t]=(yield n.getParams())||null;return e}))}static setDatas(e){Object.keys(e).forEach((t=>{this.modules.get(t).setData(e[t])}))}static preConnect(e){this.modules.forEach(((t,n)=>{t.preConnect(e)}))}static postConnect(){this.modules.forEach(((e,t)=>{e.postConnect()}))}};Bc.Module=Fc,Bc.modules=new Map;const qc=yc;let Vc=class{constructor(){this.emitter=new qc}on(e,t){return this.emitter.on(e,t),this}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}fire(e,t){return this.emitter.emit(e,t),this}},jc=class{constructor(){this.eventDriver=new Vc}on(e,t){this.eventDriver.on(e,t)}off(e,t){this.eventDriver.off(e,t)}fire(e,t){this.eventDriver.fire(e,t)}},Hc=new class{isDef(e){return!this.isUndef(e)}isUndef(e){return null==e}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}isObject(e){return null!==e&&"object"==typeof e}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}isValidArrayIndex(e){let t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}isString(e){return"string"==typeof e}isNumber(e){return"number"==typeof e}isStringOrNumber(e){return this.isString(e)||this.isNumber(e)}isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}isEmpty(e){return this.isArray(e)?0===e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""===e.trim():!this.isDef(e))}isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}isFunction(e){return"function"==typeof e}isBoolean(e){return"boolean"==typeof e}isTrue(e){return!0===e}isFalse(e){return!1===e}isNull(e){return null===e}};const Kc=yc;let zc=class{constructor(){this.emitter=new Kc}on(e,t){if(!Hc.isString(e))throw Error("event require a string.");if(!Hc.isFunction(t))throw Error("callback must be a function");this.emitter.on(e,t)}fire(e,t){this.emitter.emit(e,t)}off(e,t){this.emitter.off(e,t)}},Wc=class{static init(e,t,n,i,o,s){this.Socket=e,this.N=t,this.Member=n,this.v=i,this.Platform=o,this.GModules=s}};const Yc=xc;let $c=class{static get(){return Yc.v1().replace(/-/g,"")}};var Jc,Xc;(Xc=Jc||(Jc={})).WRITE="WRITE",Xc.READ="READ",Xc.NONE="NONE";let Qc=class{constructor(e){this.permission=Jc.NONE,this.singleTimeout=0,this.totalTimeout=0,this.startTime=0,this.complete=!1,this.retried=0,this.unique=!1,this.uuid=$c.get(),this.name=e.name,this.params=e.params,this.permission=e.permission,this.totalTimeout=e.totalTimeout,this.singleTimeout=e.singleTimeout,e.unique&&(this.unique=e.unique),this.success=t=>{this.complete||(this.end(),e.success(t))},this.fail=t=>{this.complete||(this.end(),e.fail(t))}}start(){this.startTime=Date.now(),this.initAutoTimeout()}end(){this.complete=!0,clearTimeout(this.timeoutHandler)}initAutoTimeout(){this.timeoutHandler=setTimeout((()=>{this.complete||this.fail({resultCode:408,content:"Host unreachable or timeout"})}),this.totalTimeout)}},Zc=class e extends Fc{static init(){return this.module=new e,this.module.name=this.GN_MODULE_NAME,this.module}static setRegId(e,t){if(e){this.module.regIdPromise=e;let n=t;this.module.params={v:{npv:n}}}}preConnect(e){this.wxmpId=e.wxmpId}getParams(){return fc(this,void 0,void 0,(function*(){if(this.params=this.params||{},this.regIdPromise)try{const e=new Promise(((e,t)=>{setTimeout((()=>t("timeout")),1e3)}));this.params.regId=yield Promise.race([this.regIdPromise,e])}catch(Yr){console.warn("Failed to register the Manufacturers Push service:"+JSON.stringify(Yr))}return this.params.wxmpId=this.wxmpId,this.params}))}};Zc.GN_MODULE_NAME="GN";let eu=class e{static init(e){this.allowNotification=!0===e;let t=Zc.init();Bc.initModule(t),this.supportAppNotification()&&(this.uniappPlugin=Nn.requireNativePlugin("GoEasy-Uniapp"),this.uniappPlugin?(this.regIdPromise=this.askRegId(),this.v=this.uniappPlugin.v(),Zc.setRegId(this.regIdPromise,this.v)):console.warn("No GoEasy-Uniapp Native Plugin."),this.setClientBadge(0))}static addAssembler(e){this.payloadAssemblers.push(e)}static assemblePayload(e){let t=this.payloadAssemblers.find((t=>t.support(e)));return t?t.assemble(e):e}static createLocalNotification(t,n,i,o,s){lc.isBackend()&&(i.g=1,"undefined"!=typeof plus&&(o?(this.uniappPlugin&&this.uniappPlugin.playSound(o),plus.push.createMessage(n,JSON.stringify(i),{title:t,sound:"none"})):plus.push.createMessage(n,JSON.stringify(i),{title:t}),"+1"===s&&this.setClientBadge(e.badge+1)))}static setBadge(t){if(!Number.isInteger(t.badge)||t.badge<0)gc.onFailed(t,"badge must be an integer greater than or equal to 0.");else if(e.supportAppNotification())if(this.uniappPlugin&&oc.currentPlatform()===ic.UNI_IOS){let e=new Qc({name:dc.SET_IOS_BADGE,params:{badge:t.badge},unique:!0,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,permission:Jc.WRITE,success:()=>{gc.onSuccess(t),this.setClientBadge(t.badge)},fail:e=>{gc.onFailed(t,e.content)}});Wc.Socket.e(e)}else gc.onSuccess(t),this.setClientBadge(t.badge)}static setClientBadge(t){"vivo"!==plus.device.vendor&&(e.badge=t,plus.runtime.setBadgeNumber(t))}static askRegId(){let e=null,t=0;const n=()=>new Promise(((i,o)=>{this.uniappPlugin.regId((e=>{i(e)}),(i=>{if(!(1e6===i.data.code&&t<=10))return clearTimeout(e),o(i);e=setTimeout((()=>{t++,this.regIdPromise=n()}),3500)}))}));return n()}static getRegIdPromise(){return this.regIdPromise}static supportAppNotification(){const e=oc.currentPlatform();return this.allowNotification&&(e===ic.UNI_ANDROID||e===ic.UNI_IOS)}static listenPlusClickNotification(){plus.push.addEventListener("click",(e=>{try{if(e){const t="string"==typeof e.payload?JSON.parse(e.payload):e.payload;if(this.availableIntent(t)){let e=this.assemblePayload(t);plus.push.clear(),this.onClickNotificationCallback(e)}}}catch(t){}}))}static availableIntent(e){return e&&Object.keys(e).length&&e.g&&1===parseInt(e.g)}static getIntentData(){this.uniappPlugin.getIntentData((e=>{if(!this.availableIntent(e))return;let t=this.assemblePayload(e);const n=oc.currentPlatform();plus.push.clear(),n===ic.UNI_ANDROID&&this.uniappPlugin.clearAll(),this.onClickNotificationCallback(t)}))}static listenClick(){this.listenPlusClickNotification();const e=oc.currentPlatform();this.uniappPlugin&&e===ic.UNI_ANDROID&&(this.getIntentData(),lc.onFrontend((()=>{this.getIntentData()})))}static onClickNotification(t){if(e.supportAppNotification()){if(!nc.isFunction(t))throw new Error("The arguments must be a function.");null===this.onClickNotificationCallback?(this.onClickNotificationCallback=t,this.listenClick()):console.warn("The onClickNotification event has been listened on. Please do not listen to it more than once.")}else console.warn("The current environment doesn't support or allowNotification is false.")}};function tu(...e){}eu.uniappPlugin=null,eu.v=null,eu.regIdPromise=null,eu.onClickNotificationCallback=null,eu.payloadAssemblers=new Array;const nu=new class{validateId(e,t){if(nc.isEmpty(e))throw{code:400,content:` ${t} is required.`};if(!nc.isString(e))throw{code:400,content:`TypeError: ${t} require string.`}}validateIdArray(e,t){if(!Array.isArray(e)||0===e.length)throw{code:400,content:`TypeError: ${t} require array.`};if(e.length>100)throw{code:400,content:`${t} is over max length 100.`};for(let n=0;n1e4)throw{code:400,content:"Message over max length 10000."};if(e.qos&&!(e.qos in[0,1]))throw{code:400,content:"Qos must be 0 or 1."};e.wxmpTemplateMsg&&nu.validateWXMPTemplateMsg(e.wxmpTemplateMsg),nc.isDef(e.notification)&&nu.validateNotification(e.notification)}},su=class{constructor(e){if(this.options=e,this.channels=e.channels||[e.channel],!nc.isEmpty(e.channel)){let t=e.channel.toString();this.channels=[t]}nc.isEmpty(e.channels)||(this.channels=e.channels.toString().split(","))}};var au,ru,cu;!function(e){e.message="message",e.imMessage="imMessage",e.userPresence="userPresence",e.groupPresence="groupPresence",e.PS_PRESENCE_EVENT="PS_PRESENCE_EVENT",e.IM_MSG_READ="IM_MSG_READ",e.IM_MSG_DELETED="IM_MSG_DELETED",e.IM_MSG_RECALLED="IM_MSG_RECALLED",e.CS_ONLINE_CHANGED="CS_ONLINE_CHANGED"}(au||(au={})),function(e){e.CONNECTED="CONNECTED",e.RECONNECTED="RECONNECTED",e.DISCONNECTED="DISCONNECTED",e.LOST="LOST",e.EXPIRED_RECONNECTED="EXPIRED_RECONNECTED",e.NEW_MESSAGE="NEW_MESSAGE",e.CONNECTING="CONNECTING"}(ru||(ru={}));let uu=class{constructor(){this.subscriptions=[],Wc.Socket.onMessage(au.message,this.onNewMessage.bind(this)),Wc.Socket.on(ru.EXPIRED_RECONNECTED,this.expiredResubscribe.bind(this)),Wc.Socket.on(ru.RECONNECTED,this.resubscribePresenceChannel.bind(this))}expiredResubscribe(){this.subscriptions.forEach((e=>{this.doSubscribe(e,!1)}))}resubscribePresenceChannel(){this.subscriptions.forEach((e=>{let t=e.options;t.presence&&t.presence.enable&&this.doSubscribe(e,!0)}))}onNewMessage(e){if(e.n.indexOf("_presence")>-1)return;e.a&&Wc.Socket.sendAck("ack",{i:e.i,c:e.n});let t={time:e.t,channel:e.n,content:e.c};this.createNotification(e),this.findSubscriptionByChannel(t.channel).options.onMessage(t)}createNotification(e){const t=Wc.N.supportAppNotification();if(!nc.isObject(e.nt)||!t)return;const n={ch:e.n,ctt:e.c};Wc.N.createLocalNotification(e.nt.t,e.nt.c,n,e.nt.sound,e.nt.badge)}subscribe(e){if(nu.validateChannelAndChannels(e.channel,e.channels),nc.isDef(e.presence)){let t=e.presence.enable;if(!nc.isBoolean(t))throw{code:400,content:"Subscription failed. presence.enable must be a boolean"};if(t&&!Wc.Socket.user().id)throw{code:400,content:"Subscription failed. If presence is enable, the id must be specified when calling the connect method"}}let t=new su(e);this.doSubscribe(t,!1).then((()=>{this.subscriptions.push(t),gc.onSuccess(e,{code:200,content:"ok"})})).catch((t=>{gc.onFailed(e,{code:t.resultCode,content:t.content})}))}doSubscribe(e,t){let n=e.options;return new Promise(((i,o)=>{let s=new Qc({name:dc.subscribe,permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,params:{channels:e.channels,accessToken:n.accessToken,presence:n.presence,resubscribe:t},success:()=>{i()},fail:e=>{o(e)}});Wc.Socket.e(s)}))}unsubscribe(e){nu.validateChannel(e.channel,"channel"),e.channel=e.channel.toString();const t=this.findSubscriptionByChannel(e.channel);if(!t)return void e.onFailed({code:400,content:"channel["+e.channel+"] is not subscribed"});let n=new Qc({name:dc.unsubscribe,params:{channel:e.channel,presence:t.options.presence},permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:()=>{e.onSuccess({code:200,content:"ok"}),this.removeChannel(e.channel)},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});Wc.Socket.e(n)}removeChannel(e){for(let t=this.subscriptions.length-1;t>=0;t--){const n=this.subscriptions[t].channels,i=n.indexOf(e);if(i>-1){n.splice(i,1),0===n.length&&this.subscriptions.splice(t,1);break}}}findSubscriptionByChannel(e){let t=!1,n=null;for(let i=this.subscriptions.length-1;i>=0;i--){let o=this.subscriptions[i].channels;for(let s=0;s{e.onSuccess({code:t.resultCode||t.code||200,content:t.content})},fail:t=>{e.onFailed({code:t.resultCode||t.code,content:t.content})}});Wc.Socket.e(t)}},du=class{constructor(){this.channelPresenceMap=new Map,this.onPresenceEvent=e=>{let t=this.channelPresenceMap.get(e.channel);null==t||t.onPresence(e)},this.expireAllChannelPresences=()=>{this.channelPresenceMap.forEach(((e,t)=>{e.expire()}))},this.resubscribe=()=>{this.channelPresenceMap.forEach(((e,t)=>{e.subscribed()&&e.doSubscribe()}))},Wc.Socket.on(ru.LOST,this.expireAllChannelPresences),Wc.Socket.on(ru.RECONNECTED,this.resubscribe),Wc.Socket.onMessage(au.PS_PRESENCE_EVENT,this.onPresenceEvent)}hereNow(e){nu.validateChannel(e.channel,"channel");let t,n=this.channelPresenceMap.get(e.channel.toString());n&&n.queryPromise?(e.limit&&e.limit>n.membersLimit&&n.doQuery(e.limit),t=n.queryPromise):t=hu(e.channel,e.limit),t.then((t=>{e.onSuccess(t)})).catch((t=>{e.onFailed(t)}))}subscribe(e){if(nu.validateChannel(e.channel,"channel"),nc.isUndef(e.onPresence)||!nc.isFunction(e.onPresence))throw{code:400,content:"Subscription Presence failed. onPresence callback function is required"};let t=e.channel.toString(),n=this.channelPresenceMap.get(t);n||(n=new pu(t),this.channelPresenceMap.set(t,n)),n.subscribe(e)}unsubscribe(e){nu.validateChannel(e.channel,"channel");let t=e.channel.toString();if(this.channelPresenceMap.get(t)){let n=new Qc({name:dc.PUBSUB_PRESENCE_UNSUBSCRIBE,permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,params:{channel:t},success:n=>{this.channelPresenceMap.delete(t),e.onSuccess()},fail:t=>{e.onFailed(t)}});Wc.Socket.e(n)}else e.onSuccess()}},pu=class{constructor(e){this.membersLimit=10,this.queried=!1,this.channel=e}onPresence(e){return fc(this,void 0,void 0,(function*(){this.queried?this.update(e):yield this.queryPromise,this.on({channel:this.channel,action:e.action,member:e.member,time:e.time,amount:this.amount,members:this.membersByLimit()})}))}membersByLimit(){return this.members.slice(0,this.membersLimit)}subscribe(e){return fc(this,void 0,void 0,(function*(){if(e.membersLimit&&(this.membersLimit=Math.min(e.membersLimit,300)),!this.subscribed())try{yield this.doSubscribe()}catch(t){return void e.onFailed(t)}this.on=e.onPresence,e.onSuccess()}))}doSubscribe(){return this.doQuery(this.membersLimit),new Promise(((e,t)=>{let n=new Qc({name:dc.PUBSUB_PRESENCE_SUBSCRIBE,permission:Jc.READ,params:{channel:this.channel},singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:t=>{e()},fail:e=>{t(e)}});Wc.Socket.e(n)}))}doQuery(e){this.queryPromise=hu(this.channel,e),this.queryPromise.then((e=>{this.members=e.content.members,this.amount=e.content.amount,this.queried=!0})).catch((e=>{throw e}))}update(e){if(["join","back"].includes(e.action))this.members.unshift(e.member);else if(["leave","timeout"].includes(e.action)){let t=this.members.findIndex((t=>t.id===e.member.id));t>-1&&this.members.splice(t,1)}this.amount=e.amount}expire(){this.queried=!1,this.queryPromise=null}subscribed(){return void 0!==this.on}};function hu(e,t){return t||(t=10),new Promise(((n,i)=>{let o={channel:e,limit:t},s=new Qc({name:dc.PUBSUB_PRESENCE_HERENOW,permission:Jc.READ,params:o,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:e=>{n(e)},fail:e=>{i(e)}});Wc.Socket.e(s)}))}let gu=class e{constructor(){this.publisher=new ou,this.subscriber=new uu,this.presence2=new du,this.histories=new lu}static init(){this.instance=new e}publish(e){this.publisher.publish(e)}subscribe(e){this.subscriber.subscribe(e)}unsubscribe(e){this.subscriber.unsubscribe(e)}subscribePresence(e){this.presence2.subscribe(e)}unsubscribePresence(e){this.presence2.unsubscribe(e)}history(e){this.histories.get(e)}hereNow(e){this.presence2.hereNow(e)}},fu=class e extends Fc{static init(){return this.module=new e,this.module.name=this.GWS_MODULE_NAME,this.initGN(),this.module}static initGN(){eu.addAssembler(new class{assemble(e){return{channel:e.ch,content:e.ctt}}support(e){return!!e.ch}})}postConnect(){gu.init()}static check(){if(!this.module)throw{code:400,content:"PubSub not initialized. Please include 'PUBSUB' in the 'modules' during GoEasy initialization."}}};fu.GWS_MODULE_NAME="GWS";let mu=class{constructor(){}};!function(e){e.aliYun="ALI",e.qiNiu="QN",e.tencent="TX",e.s3="S3"}(cu||(cu={}));let _u=new class extends mu{constructor(){super()}upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{Nn.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.tempFilePath||t.fullPath||t.path}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(e);Nn.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{const i=this.getTempFilePath(e);if("undefined"!=typeof plus)plus.io.resolveLocalFileSystemURL(i,(e=>{e.file((e=>{let i=new plus.io.FileReader;i.onloadend=e=>{const n=Nn.base64ToArrayBuffer(e.target.result.split(",")[1]);t(n)},i.onerror=function(e){n(e)},i.readAsDataURL(e)}))}),(e=>{n("Resolve file URL failed: "+e.message)}));else if("undefined"!=typeof FileReader){const i=new FileReader;i.onload=()=>{t(i.result)},i.onerror=e=>{n(e)},i.readAsArrayBuffer(e.file)}else if("object"==typeof Pn&&Pn.canIUse("getFileSystemManager"))try{const e=Pn.getFileSystemManager().readFileSync(i);t(e)}catch(o){n(o)}}))}};const vu=new class extends mu{upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):new Promise(((n,i)=>{Pn.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))}))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file||e.fileRes;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));Pn.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{try{t(Pn.getFileSystemManager().readFileSync(e))}catch(i){n(i)}}))}},yu=new class extends mu{constructor(){super()}upload(e,t){return new Promise(((n,i)=>{try{const o=new XMLHttpRequest,s=e.storageLocation===cu.s3,a=s?"PUT":"POST",r=s?e.url:e.host;o.open(a,r,!0);for(let t in e.headers)o.setRequestHeader(t,e.headers[t]);o.upload.onprogress=function(e){t&&t(e)},o.upload.onloadstart=function(e){t&&t(e)},o.upload.onloadend=function(e){t&&t(e)};let c=new FormData;for(let t in e.parameters)"fileRes"==t?c.append("file",e.parameters[t]):c.append(t,e.parameters[t]);const u=s?e.file:c;o.send(u),o.onreadystatechange=function(){4==o.readyState&&(o.status>=200&&o.status<300||304==o.status?(s&&(e.url=e.url.split("?")[0]),n()):i({code:o.status,content:o.responseText}))}}catch(o){i({code:500,content:o})}}))}fileToArrayBuffer(e){return new Promise(((t,n)=>{const i=new FileReader;i.onload=()=>{t(i.result)},i.onerror=e=>{n(e)},i.readAsArrayBuffer(e)}))}},Iu=new class extends mu{upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{my.uploadFile({url:e.host,filePath:this.getTempFilePath(e),fileType:"image",name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));my.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{my.getFileSystemManager().readFile({filePath:e,success:e=>{t(e.data)},fail(e){n(e)}})}))}},Mu=new class extends mu{upload(e,t){try{return e.storageLocation===cu.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{swan.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>fc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));swan.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cu.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{swan.getFileSystemManager().readFile({filePath:e,success:e=>{t(e.data)},fail:e=>{n(e)}})}))}};let Cu=class{constructor(e,t,n){this.storageLocation=e,this.url=t,this.name=n}};const Su=new class{constructor(){this.uploader={[zr.UNIAPP]:_u,[ic.MP_WX]:vu,[ic.BROWSER]:yu,[ic.MP_ALI]:Iu,[ic.MP_BAIDU]:Mu,[zr.REACT_NATIVE]:yu,[ic.MP_BYTE]:vu}}upload(e,t){return fc(this,void 0,void 0,(function*(){const n=$r.currentFramework(),i=oc.currentPlatform(),o=n===zr.UNKNOWN?i:n;let s=this.uploader[o];return yield s.upload(e,t),new Cu(e.storageLocation,e.url,e.newFileName)}))}};let Eu=class{resolve(e){return new Promise(((t,n)=>{let i=new Qc({name:"uploadToken",params:{filename:e},permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail(e){n(e.content)},success(e){200===e.code?t(e.content):n(e.content)}});Wc.Socket.e(i)}))}},Tu=class{constructor(e,t,n,i,o,s,a){this.storageLocation=e,this.host=t,this.headers=n,this.parameters=i,this.file=o,this.newFileName=s,this.url=a}},ku=class{constructor(){}newFileName(e){return e&&e.newFilename||""}},Du=new class extends ku{constructor(){super()}url(e){return e.host+"/"+e.dir+"/"+this.newFileName(e)}build(e,t,n){let i,o=this.newFileName(e);return i={key:e.dir+"/"+o,OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200",fileRes:t},n&&(i={key:e.dir+"/"+o,OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200","Content-Disposition":"attachment;filename="+t.name,fileRes:t}),new Tu(cu.aliYun,e.host,null,i,t,o,this.url(e))}},Ru=new class extends ku{constructor(){super()}url(e){return e.host+"/"+e.key}build(e,t,n){let i={"q-sign-algorithm":e.qSignAlgorithm,"q-ak":e.qAk,"q-key-time":e.qKeyTime,"q-signature":e.qSignature,policy:e.policy,"x-cos-security-token":e.xCosSecurityToken,success_action_status:"200",key:e.key,fileRes:t};return n&&(i={"q-sign-algorithm":e.qSignAlgorithm,"q-ak":e.qAk,"q-key-time":e.qKeyTime,"q-signature":e.qSignature,policy:e.policy,"x-cos-security-token":e.xCosSecurityToken,success_action_status:"200",key:e.key,"Content-Disposition":`attachment;filename=${t.name}`,fileRes:t}),new Tu(cu.tencent,e.host,null,i,t,e.key,this.url(e))}},Ou=new class extends ku{constructor(){super()}url(e){return e.uploadUrl}build(e,t,n){const i={file:t};return new Tu(cu.s3,null,{"Content-Type":"application/octet-stream"},i,t,t.name,this.url(e))}},bu=class{constructor(){this.uploadTokenResolver=new Eu}builder(e){if(e===cu.aliYun)return Du;if(e===cu.tencent)return Ru;if(e===cu.s3)return Ou;throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e)}build(e,t,n){return fc(this,void 0,void 0,(function*(){try{let i=yield this.uploadTokenResolver.resolve(t),o=this.builder(i.vendor).build(i,e,n);return Promise.resolve(o)}catch(i){return Promise.reject(i)}}))}},Au=class{constructor(){this.requestBuilder=new bu,this.fileUploader=Su}upload(e,t,n,i){return fc(this,void 0,void 0,(function*(){try{let o=yield this.requestBuilder.build(e,t,i);return this.fileUploader.upload(o,n)}catch(o){return Promise.reject(o)}}))}};var Lu,Pu,Nu,wu;!function(e){e.MESSAGE_SENDING="IM_INTERNAL_MESSAGE_SENDING",e.MESSAGE_SEND_SUCCESS="IM_INTERNAL_MESSAGE_SEND_SUCCESS",e.MESSAGE_SEND_FAILED="IM_INTERNAL_MESSAGE_SEND_FAILED",e.MESSAGE_RECEIVED="IM_INTERNAL_MESSAGE_RECEIVED",e.MESSAGE_RECALLED="IM_INTERNAL_MESSAGE_RECALLED",e.MAX_MESSAGE_CHANGED="IM_INTERNAL_MAX_MESSAGE_CHANGED",e.MAX_MESSAGE_DELETED="IM_INTERNAL_MAX_MESSAGE_DELETED",e.UNREAD_AMOUNT_CHANGED="IM_INTERNAL_UNREAD_MESSAGE_CHANGED",e.CS_ONLINE_SUCCESS="CS_ONLINE_SUCCESS",e.CS_OFFLINE_SUCCESS="CS_OFFLINE_SUCCESS",e.CS_ACCEPTED="CS_ACCEPTED",e.CS_ENDED="CS_ENDED",e.CS_TRANSFER="CS_TRANSFER",e.CS_AGENT_MESSAGE_RECEIVED="CS_AGENT_MESSAGE_RECEIVED"}(Lu||(Lu={}));let Uu=class{clearUseLessAttribute(){delete this.buildOptions}isOtherSent(){return this.senderId!==Wc.Socket.user().id}getToData(){return this.buildOptions.createOptions.to.data}},Gu=class{};!function(e){e.TEXT="text",e.IMAGE="image",e.FILE="file",e.VIDEO="video",e.AUDIO="audio"}(Pu||(Pu={}));let xu=class extends Gu{constructor(){super(...arguments),this.goEasyUploader=new Au}improve(e){let t=e.message;return new Promise(((e,n)=>{let i,o,s=t.buildOptions.createOptions;t.type===Pu.VIDEO?(o=t.payload,i=o.video.name):(o=t.payload,i=o.name),this.goEasyUploader.upload(s.file,i,s.onProgress,t.type===Pu.FILE).then((n=>{n.storageLocation!==cu.s3&&(n.url=encodeURI(n.url)),this.setPayload(n,t),e()})).catch((e=>{n(e)}))}))}setPayload(e,t){t.payload.url=e.url}},Fu=class extends xu{setPayload(e,t){let n,i=t.payload;switch(i.video.url=e.url,i.video.name=e.name,i.thumbnail.height>200&&(i.thumbnail.height=200,i.thumbnail.width=200*i.video.width/i.video.height),e.storageLocation){case cu.aliYun:n="?x-oss-process=video/snapshot,t_0000,f_jpg,h_"+i.thumbnail.height+",m_fast,ar_auto";break;case cu.tencent:n="?ci-process=snapshot&time=1&format=jpg&height="+i.thumbnail.height;break;case cu.s3:n="?process=video&height="+i.thumbnail.height;break;default:throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e.storageLocation)}i.thumbnail.url=e.url+n}},Bu=class extends xu{setPayload(e,t){let n,i=t.payload;i.url=e.url;const o=i.height>200?200:i.height;switch(e.storageLocation){case cu.aliYun:n="?x-oss-process=image/resize,m_lfit,h_"+o;break;case cu.tencent:n=`?imageMogr2/thumbnail/x${o}`;break;case cu.s3:n=`?process=image&height=${o}`;break;default:throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e.storageLocation)}i.thumbnail=e.url+n}},qu=class{constructor(){this.improvers={[Pu.FILE]:new xu,[Pu.AUDIO]:new xu,[Pu.IMAGE]:new Bu,[Pu.VIDEO]:new Fu}}improve(e){let t=this.improvers[e.message.type];if(t)try{return t.improve(e)}catch(n){return Promise.reject(n)}return Promise.resolve()}},Vu=class e extends jc{static init(){this.i=new e}},ju=class{constructor(e,t,n,i,o){this.validate(e),this.mt=e.type,this.to=t.id.toString(),this.d=JSON.stringify(t.data),this.p=JSON.stringify(e.payload),n&&(this.nt=n),o&&(this.at=o),i&&(this.wxmpTemplateMsg=iu(i),this.wxmpTemplateMsg.data=JSON.stringify(this.wxmpTemplateMsg.data));let s=t.type;if(this.t=s,s===Qr.CS){let t=e;this.tid=t.teamId}this.guid=e.messageId}validate(e){if(e.type===Pu.TEXT&&JSON.stringify(e.payload).length>3072)throw Error("message-length limit 3kb")}},Hu=class{constructor(){this.payloadImprover=new qu}send(e){this.validate(e);let t=e.message,n=e.accessToken,i=t.buildOptions,o=i.createOptions,s=o.notification,a=o.wxmpTemplateMsg,r=o.to;r.data||(r.data={}),t.status=Zr.SENDING;let c=i.complete,u=this.payloadImprover.improve(e);Promise.all([c,u]).then((()=>fc(this,void 0,void 0,(function*(){if(o.beforeSend){const e=JSON.parse(JSON.stringify(t));yield o.beforeSend(e)}this.doSend(t,r,s,a,n,e)})))).catch((n=>{t.status=Zr.FAIL,gc.onFailed(e,{code:n&&n.code||400,content:n&&n.content||n})}))}doSend(e,t,n,i,o,s){let a=new ju(e,t,n,i,o);Vu.i.fire(Lu.MESSAGE_SENDING,e);let r=new Qc({name:dc.publishIM,params:a,unique:!0,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:t=>{e.status=Zr.FAIL,Vu.i.fire(Lu.MESSAGE_SEND_FAILED,e),gc.onFailed(s,{code:t.resultCode,content:t.content})},success:t=>{if(e.status=Zr.SUCCESS,e.timestamp=t.content.timestamp,e.messageId=JSON.stringify(t.content.id),e.scene()===Qr.CS){let n=e;n.customerId()!==Wc.Socket.user().id&&(n.sessionId=t.content.sessionId)}e.clearUseLessAttribute(),Vu.i.fire(Lu.MESSAGE_SEND_SUCCESS,e),gc.onSuccess(s,e)}});Wc.Socket.e(r)}validate(e){let t=e.message;if(!(t instanceof Uu))throw new Error("it is invalid message");if(t.status!==Zr.NEW)throw new Error("Please create a new message, a message can only be sent once")}},Ku=class{insert(e,t){let n=this.binarySearch(e,t);if(n>=0)e.splice(n,1,t);else{let i=-n-1;e.splice(i,0,t)}}binarySearch(e,t){let n=0,i=e.length-1;for(;n<=i;){let o=i+n>>1,s=this.compare(t,e[o]);if(s>0)n=o+1;else{if(!(s<0))return o;i=o-1}}return-n-1}},zu=class e{constructor(e){this.messages=new Array,this.allLoaded=!1,this.target=e}all(){return this.messages}sliceOverLengthMessages(){this.messages.length>e.CACHE_MAX_LENGTH&&(this.messages=this.messages.slice(-e.CACHE_MAX_LENGTH),!0===this.allLoaded&&(this.allLoaded=!1))}getMaxMessage(){return this.messages[this.messages.length-1]}loadLocalMessages(e,t){let n=[],i=this.messages.length;if(t){if(i>0){let o=this.messages[0].timestamp,s=this.messages[i-1].timestamp;if(t>=o&&t<=s)for(let a=i-1;a>=0;a--){let i=this.messages[a];if(i.timestamp0&&i.timestamp===t.lastTimestamp)&&(n.forEach((t=>{e.sortedInserter.insert(this.messages,t)})),n.lengthe===t.timestamp))}findMessagesByTimes(e){let t=[];return e.forEach((e=>{let n=this.findMessageByTime(e);nc.isDef(n)&&t.push(n)})),t}existsMessage(e){return this.findMessageIndexById(e)>-1}findMessageIndexById(e){return this.messages.findIndex((t=>e===t.messageId))}deleteMessage(e){let t=this.findMessageIndexById(e);t>=0&&this.messages.splice(t,1)}recallMessage(e){return e.times.map((e=>this.findMessageByTime(e))).filter((e=>nc.isDef(e))).map((t=>(t.recalled=!0,t.recaller=e.recaller,t)))}isEmpty(){return 0===this.messages.length}deleteMessages(e){e.forEach((e=>{this.deleteMessage(e.messageId)}))}saveMessage(t){e.sortedInserter.insert(this.messages,t),this.deleteGroupConversationMessage(),this.sliceOverLengthMessages()}deleteGroupConversationMessage(){this.target.scene===Qr.GROUP&&this.messages.length>=2&&1===this.messages[0].x&&this.messages.shift()}maxSuccessMessageTime(){for(let e=this.messages.length-1;e>=0;e--)if(this.messages[e].status===Zr.SUCCESS)return this.messages[e].timestamp;return 0}minTime(){return this.isEmpty()?0:this.messages[0].timestamp}correctPosition(e){this.deleteMessage(e.messageId),this.saveMessage(e)}};zu.CACHE_MAX_LENGTH=200,zu.sortedInserter=new class extends Ku{compare(e,t){let n=e.timestamp-t.timestamp;return n>0?1:0===n?0:-1}};let Wu=class e{constructor(e,t,n){this.scene=e,this.id=t,nc.isDef(n)&&(this.teamId=n)}toString(){return Qr.PRIVATE===this.scene||Qr.GROUP===this.scene?this.scene+"#"+this.id:this.scene+"#"+this.id+"#"+this.teamId}customerId(){if(Qr.CS===this.scene)return this.id===this.teamId?Wc.Socket.user().id:this.id}static byScene(t,n,i){return new e(t,n,i)}static byIMMessage(t){let n,i,o=t.scene();if(o===Qr.PRIVATE){let e=t.senderId,n=t.targetId();i=Wc.Socket.user().id===e?n:e}else if(o===Qr.GROUP)i=t.targetId();else{if(o!==Qr.CS)throw{code:400,content:`scene ${o} not exists`};i=t.targetId(),n=t.teamId}return new e(o,i,n)}static byMessageReadRemoteEvent(t){let n,i=t.scene,o=t.targetId,s=t.markerId,a=t.teamId;return i===Qr.PRIVATE?n=Wc.Socket.user().id===s?o:s:i===Qr.GROUP?n=o:i===Qr.CS&&(n=o===a?s===Wc.Socket.user().id?a:s:s===Wc.Socket.user().id?o:a),new e(i,n,a)}static byIMMessageDeletedEvent(t){let n=t.scene,i=t.deleterId;if(n===Qr.PRIVATE){let o=Wc.Socket.user().id===i?t.targetId:i;return new e(n,o)}if(n===Qr.GROUP)return new e(n,t.targetId)}static byConversationDTO(e){let t=e.lastMessage;return this.byIMMessage(t)}static byConversationId(t,n){let i;if(t===Qr.PRIVATE){let e=n.split(":",2);i=e[0]===Wc.Socket.user().id?e[1]:e[0]}else i=n;return new e(t,i)}},Yu=class{constructor(e){this.times=new Array;let t=e[0],n=Wu.byIMMessage(t);this.scene=n.scene,this.targetId=n.id,e.forEach((e=>{e.status===Zr.SUCCESS&&this.times.push(e.timestamp)})),this.times.sort(((e,t)=>e{let i=new Qc({name:dc.IM_DELETE_MESSAGE,params:t,permission:Jc.WRITE,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:t=>{200===t.code?e(t):n(t)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}static validate(e){let t=e.messages;for(let n=0;n{let n=new Qc({name:dc.IM_HISTORY_CHANGE,params:s,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{t(e)},success:t=>{let n=t.content;e(n)}});Wc.Socket.e(n)}))}loadServerMessages(e,t){return new Promise(((n,i)=>{let o=new Qc({name:dc.IM_HISTORY,params:t,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{i(e)},success:t=>{let i=t.content;i.messages=this.convertServerMessages(e,i.messages),n(i)}});Wc.Socket.e(o)}))}convertServerMessages(e,t){let n=[],i=e.scene,o=e.id;return t.forEach((t=>{if(t.t=i,Qr.PRIVATE===i)t.r=t.s===Wc.Socket.user().id?o:Wc.Socket.user().id;else if(Qr.GROUP===i)t.r=o;else if(Qr.CS===i){let n=e.customerId(),i=e.teamId;n===Wc.Socket.user().id?t.r=i:t.r=n}let s=this.builder.build(t);n.push(s)})),n}updateServerOffsets(e,t){return fc(this,void 0,void 0,(function*(){let n=new Xu(t.id,t.scene,e,t.teamId);return new Promise(((e,t)=>{let i=new Qc({name:dc.IM_MARK_AS_READ,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:t=>{e(t)},fail:e=>{t(e)}});Wc.Socket.e(i)}))}))}};nl.instance=new nl;let il=class{constructor(){this.offsetMap=new Map,this.markingTime=0,this.userId=Wc.Socket.user().id}updateOffset(e,t){let n=this.offsetMap.get(e);return nc.isDef(n)?t>n&&(this.offsetMap.set(e,t),!0):(this.offsetMap.set(e,t),!0)}updateUserOffsets(e){e.forEach((e=>{let t=e.userId,n=e.offset;this.updateOffset(t,n)}))}updateMyOffset(e){return this.updateOffset(this.userId,e)}myOffset(){return this.getOffset(this.userId)}getOffset(e){return this.offsetMap.get(e)||0}},ol=class{constructor(e,t,n,i,o){this.id=e,this.scene=t,this.lastTimestamp=n,this.limit=i,this.teamId=o}},sl=class{constructor(e){this.history=e}pre(){this.oldLastMessage=this.history.getMaxMessage(),this.oldUnreadAmount=this.history.unreadAmount(),this.oldLastMessage&&(this.oldLastMessageRecalled=this.oldLastMessage.recalled,this.oldLastMessageRead=this.oldLastMessage.read,this.oldLastMessageStatus=this.oldLastMessage.status)}post(){let e,t,n,i=this.history.unreadAmount(),o=this.history.getMaxMessage();o&&(n=o.status,e=o.read,t=o.recalled);let s=this.history.target;this.oldLastMessage!==o||this.oldLastMessageRead!==e||this.oldLastMessageRecalled!==t||this.oldLastMessageStatus!==n?o?Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,o):Vu.i.fire(Lu.MAX_MESSAGE_DELETED,s):this.oldUnreadAmount!==i&&Vu.i.fire(Lu.UNREAD_AMOUNT_CHANGED,s)}},al=class{constructor(e,t,n,i){this.scene=e,this.conversationId=t,this.recaller=n,this.times=i}},rl=class{static init(){this.eventCenter=new zc}static on(e,t){this.eventCenter.on(e,t)}static fire(e,t){this.eventCenter.fire(e,t)}static off(e,t){this.eventCenter.off(e,t)}};!function(e){e.PRIVATE_MESSAGE_RECEIVED="PRIVATE_MESSAGE_RECEIVED",e.GROUP_MESSAGE_RECEIVED="GROUP_MESSAGE_RECEIVED",e.SYSTEM_MESSAGE_RECEIVED="SYSTEM_MESSAGE_RECEIVED",e.CONVERSATIONS_UPDATED="CONVERSATIONS_UPDATED",e.HISTORY_EXPIRED="HISTORY_EXPIRED",e.USER_PRESENCE="USER_PRESENCE",e.GROUP_PRESENCE="GROUP_PRESENCE",e.MESSAGE_DELETED="MESSAGE_DELETED",e.MESSAGE_READ="MESSAGE_READ",e.MESSAGE_RECALLED="MESSAGE_RECALLED",e.CS_MESSAGE_RECEIVED="CS_MESSAGE_RECEIVED",e.PENDING_CONVERSATIONS_UPDATED="PENDING_CONVERSATIONS_UPDATED"}(wu||(wu={}));let cl=class{constructor(e){this.expiredTime=0,this.remoteHistory=nl.instance,this.target=e,this.userOffsets=new il,this.messageCache=new zu(e)}initMaxMessageAndOffsets(e,t){this.existsMessage(e)||(this.messageCache.saveMessage(e),t.forEach((e=>{this.markLocalMessagesRead(this.messageCache.all(),e.userId,e.offset,!1)})))}existsMessage(e){return this.messageCache.existsMessage(e.messageId)}loadHistory(e,t){return fc(this,void 0,void 0,(function*(){return this.expiredTime>0&&!this.messageCache.isEmpty()&&(yield this.updateByServerChange()),nc.isUndef(t)?t=10:t>30&&(t=30),yield this.loadServerMessages(e,t)}))}loadServerMessages(e,t){return fc(this,void 0,void 0,(function*(){let n=this.messageCache.loadLocalMessages(t,e);if(!1===this.messageCache.allLoaded&&n.length!==t){let i=t-n.length,o=n[0]?n[0].timestamp:e,s=new ol(this.target.id.toString(),this.target.scene,o,i,this.target.teamId),a=yield this.remoteHistory.loadServerMessages(this.target,s),r=a.messages;n=r.concat(n),this.messageCache.cacheServerMessages(s,r),a.userOffsets.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),this.userOffsets.offsetMap.forEach(((e,t)=>{this.markLocalMessagesRead(r,t,e,!1)}))}return n}))}deleteMessages(e){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){let t=e.messages;yield $u.deleteServerMessages(t),this.messageCache.deleteMessages(t),gc.onSuccess(e)}))))}))}syncDeletedMessage(e,t){this.aopUnreadAmountMaxMessage((()=>{this.doSyncDeletedMessage(e,t)}))}doSyncDeletedMessage(e,t){if(e===Wc.Socket.user().id){let e=this.messageCache.findMessagesByTimes(t);this.messageCache.deleteMessages(e),e.length>0&&rl.fire(wu.MESSAGE_DELETED,e)}}recallMessages(e){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){this.doRecall(e)}))))}))}doRecall(e){let t=this.messageCache.recallMessage(e);t.length>0&&rl.fire(wu.MESSAGE_RECALLED,t)}expire(){this.messageCache.isEmpty()||(this.expiredTime=this.messageCache.maxSuccessMessageTime())}updateByServerChange(){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){let e=yield this.remoteHistory.sync(this.target.scene,this.target.id,this.expiredTime,this.messageCache.minTime(),this.target.teamId);e.userOffsets.forEach((e=>{this.markLocalMessagesRead(this.messageCache.all(),e.userId,e.offset,!0)}));let t=e.deletedMessageTimes;t.length>0&&this.doSyncDeletedMessage(Wc.Socket.user().id,t);let n=e.recalledMessages;n.length>0&&n.forEach((e=>{let t=new al(this.target.scene,this.target.id,e.recaller,e.times);this.doRecall(t)})),this.expiredTime=0}))))}))}markRead(){return fc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>fc(this,void 0,void 0,(function*(){let e=this.messageCache.maxSuccessMessageTime();e>this.userOffsets.myOffset()&&(this.userOffsets.markingTime=e,yield this.remoteHistory.updateServerOffsets(e,this.target),e===this.userOffsets.markingTime&&this.markLocalMessagesRead(this.messageCache.all(),Wc.Socket.user().id,e,!0))}))))}))}syncMarkedMessage(e){this.aopUnreadAmountMaxMessage((()=>{this.markLocalMessagesRead(this.messageCache.all(),e.markerId,e.time,!0)}))}onMessageSending(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.saveMessage(e)}))}onMessageSendSuccess(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.correctPosition(e),this.markLocalMessagesRead(this.messageCache.all(),Wc.Socket.user().id,e.timestamp,!0)}))}onMessageSendFailed(e){this.getMaxMessage()===e&&Vu.i.fire(Lu.MAX_MESSAGE_CHANGED,e)}onMessageReceived(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.saveMessage(e),this.markLocalMessagesRead(this.messageCache.all(),e.senderId,e.timestamp,!0)}))}aopUnreadAmountMaxMessage(e,t){return fc(this,void 0,void 0,(function*(){try{let t=new sl(this);t.pre(),yield e(),t.post()}catch(n){gc.onFailed(t,n)}}))}markLocalMessagesRead(e,t,n,i){if(this.userOffsets.updateOffset(t,n),this.isOtherUserId(t)){let t=this.markMySentRead(e,n);i&&t.length>0&&rl.fire(wu.MESSAGE_READ,t)}else t===Wc.Socket.user().id&&this.markOthersSentRead(e,n)}markOthersSentRead(e,t){if(this.target.scene===Qr.PRIVATE)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.isOtherSent()&&i.timestamp<=t){if(i.read)break;i.read=!0}}}markMySentRead(e,t){let n=new Array;if(this.target.scene===Qr.PRIVATE)for(let i=e.length-1;i>=0;i--){let o=e[i];if(!o.isOtherSent()&&o.timestamp<=t&&o.status===Zr.SUCCESS){if(o.read)break;o.read=!0,n.push(o)}}return n}isOtherUserId(e){if(this.target.scene===Qr.CS){let t=this.target.customerId();return Wc.Socket.user().id===t?e!==Wc.Socket.user().id:e===t}return e!==Wc.Socket.user().id}unreadAmount(e){let t=0,n=this.userOffsets.myOffset(),i=this.messageCache.all();for(const o of i)o.isOtherSent()&&!1===o.recalled&&o.timestamp>n&&(t+=1);return t}getMaxMessage(e){return this.messageCache.getMaxMessage()}maxTime(e){let t=this.getMaxMessage();return nc.isDef(t)?t.timestamp:0}},ul=class{constructor(e,t){this.teamId=e,this.customerId=t}},ll=class{},dl=class{constructor(e,t,n){this.teamId=e,this.teamData=JSON.stringify(t),this.agentData=JSON.stringify(n)}},pl=class{constructor(e){this.teamId=e}},hl=class{constructor(e){this.teamId=e}};var gl={exports:{}},fl=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ml=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],_l=function(e){var t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));for(var o=fl.exec(e||""),s={},a=14;a--;)s[ml[a]]=o[a]||"";return-1!=n&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s},vl={exports:{}},yl={exports:{}},Il=1e3,Ml=6e4,Cl=36e5,Sl=24*Cl,El=function(e,t){t=t||{};var n,i=typeof e;if("string"===i&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"days":case"day":case"d":return n*Sl;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Cl;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ml;case"seconds":case"second":case"secs":case"sec":case"s":return n*Il;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===i&&!1===isNaN(e))return t.long?Tl(n=e,Sl,"day")||Tl(n,Cl,"hour")||Tl(n,Ml,"minute")||Tl(n,Il,"second")||n+" ms":function(e){return e>=Sl?Math.round(e/Sl)+"d":e>=Cl?Math.round(e/Cl)+"h":e>=Ml?Math.round(e/Ml)+"m":e>=Il?Math.round(e/Il)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Tl(e,t,n){if(!(e=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(n())}(vl,vl.exports);var kl=_l,Dl=vl.exports("socket.io-client:url"),Rl=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(Dl("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),Dl("parse %s",e),n=kl(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port,n.href=n.protocol+"://"+i+(t&&t.port===n.port?"":":"+n.port),n},Ol={},bl={}.toString,Al=Array.isArray||function(e){return"[object Array]"==bl.call(e)};!function(e){vl.exports("socket.io-parser");var t=vc.exports,n=Al;function i(){}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=i,e.Decoder=s;var o=e.ERROR+'"encode error"';function s(){this.reconstructor=null}function a(t){return{type:e.ERROR,data:"parser error: "+t}}i.prototype.encode=function(t,n){n([function(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var i=function(e){try{return JSON.stringify(e)}catch(t){return!1}}(t.data);if(!1===i)return o;n+=i}return n}(t)])},t(s.prototype),s.prototype.add=function(t){var i;if("string"!=typeof t)throw new Error("Unknown type: "+t);i=function(t){var i=0,o={type:Number(t.charAt(0))};if(null==e.types[o.type])return a("unknown packet type "+o.type);if(e.BINARY_EVENT===o.type||e.BINARY_ACK===o.type){for(var s="";"-"!==t.charAt(++i)&&(s+=t.charAt(i),i!=t.length););if(s!=Number(s)||"-"!==t.charAt(i))throw new Error("Illegal attachments");o.attachments=Number(s)}if("/"===t.charAt(i+1))for(o.nsp="";++i&&","!==(c=t.charAt(i))&&(o.nsp+=c,i!==t.length););else o.nsp="/";var r=t.charAt(i+1);if(""!==r&&Number(r)==r){for(o.id="";++i;){var c;if(null==(c=t.charAt(i))||Number(c)!=c){--i;break}if(o.id+=t.charAt(i),i===t.length)break}o.id=Number(o.id)}if(t.charAt(++i)){var u=function(e){try{return JSON.parse(e)}catch(t){return!1}}(t.substr(i));if(!1===u||o.type!==e.ERROR&&!n(u))return a("invalid payload");o.data=u}return o}(t),this.emit("decoded",i)},s.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}(Ol);var Ll={exports:{}},Pl={},Nl={},wl=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var i in e)n.call(e,i)&&t.push(i);return t},Ul=Al,Gl=Object.prototype.toString,xl="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Gl.call(Blob),Fl="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Gl.call(File),Bl=function e(t){if(!t||"object"!=typeof t)return!1;if(Ul(t)){for(var n=0,i=t.length;n=55296&&t<=56319&&o=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function $l(e,t){return zl(e>>t&63|128)}function Jl(e,t){if(!(4294967168&e))return zl(e);var n="";return 4294965248&e?4294901760&e?!(4292870144&e)&&(n=zl(e>>18&7|240),n+=$l(e,12),n+=$l(e,6)):(Yl(e,t)||(e=65533),n=zl(e>>12&15|224),n+=$l(e,6)):n=zl(e>>6&31|192),n+zl(63&e|128)}function Xl(){if(Kl>=Hl)throw Error("Invalid byte index");var e=255&jl[Kl];if(Kl++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function Ql(e){var t,n;if(Kl>Hl)throw Error("Invalid byte index");if(Kl==Hl)return!1;if(t=255&jl[Kl],Kl++,!(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|Xl())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|Xl()<<6|Xl())>=2048)return Yl(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|Xl()<<12|Xl()<<6|Xl())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var Zl={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,i=Wl(e),o=i.length,s=-1,a="";++s65535&&(o+=zl((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=zl(t);return o}(o)}},ed=void 0!==ed?ed:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,td=function(){try{return 2===new Blob(["hi"]).size}catch(Yr){return!1}}(),nd=td&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(Yr){return!1}}(),id=ed&&ed.prototype.append&&ed.prototype.getBlob;function od(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e}))}function sd(e,t){t=t||{};var n=new ed;return od(e).forEach((function(e){n.append(e)})),t.type?n.getBlob(t.type):n.getBlob()}function ad(e,t){return new Blob(od(e),t||{})}"undefined"!=typeof Blob&&(sd.prototype=Blob.prototype,ad.prototype=Blob.prototype);var rd=td?nd?Blob:ad:id?sd:void 0;!function(e){var t=wl,n=Bl,i=ql,o=Zl;e.protocol=3;var s=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},a=t(s),r={type:"error",data:"parser error"},c=rd;e.encodePacket=function(e,t,n,i){"function"==typeof t&&(i=t,t=!1),"function"==typeof n&&(i=n,n=null),void 0===e.data||e.data.buffer||e.data;var a=s[e.type];return void 0!==e.data&&(a+=n?o.encode(String(e.data),{strict:!1}):String(e.data)),i(""+a)},e.decodePacket=function(e,t,n){if(void 0===e)return r;if("string"==typeof e){if(n&&!1===(e=function(e){try{e=o.decode(e,{strict:!1})}catch(t){return!1}return e}(e)))return r;var i=e.charAt(0);return Number(i)==i&&a[i]?e.length>1?{type:a[i],data:e.substring(1)}:{type:a[i]}:r}i=new Uint8Array(e)[0];var s=sliceBuffer(e,1);return c&&"blob"===t&&(s=new c([s])),{type:a[i],data:s}},e.encodePayload=function(t,o,s){"function"==typeof o&&(s=o,o=null);var a=n(t);if(!t.length)return s("0:");!function(t){for(var n=new Array(t.length),r=i(t.length,(function(e,t){return s(t.join(""))})),c=function(t,i,s){!function(t,n){e.encodePacket(t,!!a&&o,!0,(function(e){n(null,function(e){return e.length+":"+e}(e))}))}(i,(function(e,i){n[t]=i,s(e,n)}))},u=0;u0);return t}function yd(){var e=vd(+new Date);return e!==dd?(md=0,dd=e):e+"."+vd(md++)}for(;_d<64;_d++)fd[gd[_d]]=_d;yd.encode=vd,yd.decode=function(e){var t=0;for(_d=0;_d';i=document.createElement(e)}catch(t){(i=document.createElement("iframe")).name=n.iframeId,i.src="javascript:0"}i.id=n.iframeId,n.form.appendChild(i),n.iframe=i}this.form.action=this.uri(),c(),e=e.replace(Ud,"\\\n"),this.area.value=e.replace(wd,"\\n");try{this.form.submit()}catch(u){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&r()}:this.iframe.onload=r};var Fd,Bd,qd=ud,Vd=Nl,Hd=pd,Kd=hd,zd=Id,Wd=vl.exports("engine.io-client:websocket");(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&("undefined"!=typeof WebSocket?Fd=WebSocket:"undefined"!=typeof self&&(Fd=self.WebSocket||self.MozWebSocket));var Yd=Fd||Bd;(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&"undefined"==typeof GameGlobal||(Yd=function(e){var t=this;if(t.onopen=function(){},t.onclose=function(){},t.onmessage=function(e){},t.onerror=function(e){},"object"==typeof tt&&tt.getSystemInfo){let n=tt.connectSocket({url:e});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen((function(){t.onopen()})),n.onError((function(e){t.onerror(e)})),n.onMessage((function(e){t.onmessage(e)})),n.onClose((function(){t.onclose()}))}else if("undefined"!=typeof my)my.connectSocket({url:e}),t.send=function(e){my.sendSocketMessage({data:e})},t.close=function(e){my.closeSocket()},my.onSocketOpen((function(e){t.onopen()})),my.onSocketError((function(e){t.onerror(e)})),my.onSocketMessage((function(e){t.onmessage(e)})),my.onSocketClose((e=>{t.onclose(e)}));else if("undefined"!=typeof swan)swan.connectSocket({url:e}),t.send=function(e){swan.sendSocketMessage({data:e})},t.close=function(e){swan.closeSocket()},swan.onSocketOpen((function(e){t.onopen()})),swan.onSocketError((function(e){t.onerror(e)})),swan.onSocketMessage((function(e){t.onmessage(e)})),swan.onSocketClose((e=>{t.onclose(e)}));else if(void 0!==Nn){var n=Nn.connectSocket({url:e,complete:()=>{}});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen((function(e){t.onopen()})),n.onError((function(e){t.onerror(e)})),n.onMessage((function(e){t.onmessage(e)})),n.onClose((function(e){t.onclose()}))}else{var i=Pn.connectSocket({url:e});t.send=function(e){i.send({data:e})},t.close=function(e){i.close({code:1e3})},i.onOpen((function(){t.onopen()})),i.onError((function(e){t.onerror(e)})),i.onMessage((function(e){t.onmessage(e)})),i.onClose((function(e){t.onclose(e)}))}});var $d=Jd;function Jd(e){e&&e.forceBase64&&(this.supportsBinary=!1),(void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&(this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=Fd&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(Yd=Bd)),qd.call(this,e)}Kd(Jd,qd),Jd.prototype.name="websocket",Jd.prototype.supportsBinary=!1,Jd.prototype.doOpen=function(){if(this.check()){var e,t,n=this.uri();if((void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&(e=this.protocols),(t=void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket?{agent:this.agent,perMessageDeflate:this.perMessageDeflate}:{agent:this.agent}).pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,"object"==typeof navigator&&"ReactNative"===navigator.product&&(t={}),this.extraHeaders&&(t.headers=this.extraHeaders),this.localAddress&&(t.localAddress=this.localAddress),"undefined"!=typeof cc&&"Windows"===cc.sys.os)cc.resources.load("cacert",((e,t)=>{const i=t.nativeUrl;this.ws=new Yd(n,[],i),this.ws.binaryType="arraybuffer",this.addEventListeners()}));else{try{void 0===Nn&&void 0===Pn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket?this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new Yd(n,e):new Yd(n):new Yd(n,e,t):this.ws=new Yd(n)}catch(i){return this.emit("error",i)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}}},Jd.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},Jd.prototype.write=function(e){var t=this;this.writable=!1;for(var n=e.length,i=0,o=n;i0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}up.priorWebsocketSuccess=!1,np(up.prototype),up.protocol=sp.protocol,up.Socket=up,up.Transport=ud,up.transports=Pl,up.parser=Nl,up.prototype.createTransport=function(e){ip('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=sp.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new tp[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},up.prototype.open=function(){var e;if(this.rememberUpgrade&&up.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(n){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},up.prototype.setTransport=function(e){ip("setting transport %s",e.name);var t=this;this.transport&&(ip("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},up.prototype.probe=function(e){ip('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,i=this;function o(){if(i.onlyBinaryUpgrades){var o=!this.supportsBinary&&i.transport.supportsBinary;n=n||o}n||(ip('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(o){if(!n)if("pong"===o.type&&"probe"===o.data){if(ip('probe transport "%s" pong',e),i.upgrading=!0,i.emit("upgrading",t),!t)return;up.priorWebsocketSuccess="websocket"===t.name,ip('pausing current transport "%s"',i.transport.name),i.transport.pause((function(){n||"closed"!==i.readyState&&(ip("changing transport and sending upgrade packet"),l(),i.setTransport(t),t.send([{type:"upgrade"}]),i.emit("upgrade",t),t=null,i.upgrading=!1,i.flush())}))}else{ip('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,i.emit("upgradeError",s)}})))}function s(){n||(n=!0,l(),t.close(),t=null)}function a(n){var o=new Error("probe error: "+n);o.transport=t.name,s(),ip('probe transport "%s" failed because of error: %s',e,n),i.emit("upgradeError",o)}function r(){a("transport closed")}function c(){a("socket closed")}function u(e){t&&e.name!==t.name&&(ip('"%s" works - aborting "%s"',e.name,t.name),s())}function l(){t.removeListener("open",o),t.removeListener("error",a),t.removeListener("close",r),i.removeListener("close",c),i.removeListener("upgrading",u)}up.priorWebsocketSuccess=!1,t.once("open",o),t.once("error",a),t.once("close",r),this.once("close",c),this.once("upgrading",u),t.open()},up.prototype.onOpen=function(){if(ip("socket open"),this.readyState="open",up.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){ip("starting upgrade probes");for(var e=0,t=this.upgrades.length;e0&&e.jitter<=1?e.jitter:0,this.attempts=0}mp.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},mp.prototype.reset=function(){this.attempts=0},mp.prototype.setMin=function(e){this.ms=e},mp.prototype.setMax=function(e){this.max=e},mp.prototype.setJitter=function(e){this.jitter=e};class _p{static init(e,t,n){this.host=e,(void 0!==t&&!1===t||!0===n)&&(this.https=!1)}static isMP(){return[ic.MP_WX,ic.MP_ALI,ic.MP_BYTE,ic.MP_WGAME,ic.MP_BAIDU].includes(oc.currentPlatform())}static uri(){let e="http";return this.https&&(e+="s"),e+"://"+this.index()+this.host}static index(){return 0==this.i?this.i=Math.floor(Math.random()*this.max)+1:this.i=this.i%this.max+1,this.i}}_p.i=0,_p.max=5,_p.https=!0;var vp=_c(Object.freeze({__proto__:null,URIResolver:_p})),yp=_c(hc),Ip=Ll.exports,Mp=lp.exports,Cp=vc.exports,Sp=Ol,Ep=pp,Tp=gp,kp=(vl.exports("socket.io-client:manager"),ep),Dp=fp;const{URIResolver:Rp}=vp;var Op=yp.runStatus,bp=Object.prototype.hasOwnProperty,Ap=Lp;function Lp(e,t){if(!(this instanceof Lp))return new Lp(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new Dp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||Sp;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}Lp.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)bp.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},Lp.prototype.updateSocketIds=function(){for(var e in this.nsps)bp.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},Lp.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},Cp(Lp.prototype),Lp.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},Lp.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},Lp.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},Lp.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},Lp.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},Lp.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},Lp.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},Lp.prototype.open=Lp.prototype.connect=function(e,t){if(this.readyState,~this.readyState.indexOf("open"))return this;this.uri,this.engine=Ip(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=Ep(n,"open",(function(){i.onopen(),e&&e()})),s=Ep(n,"error",(async function(t){if(i.uri=Rp.uri(),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else i.maybeReconnectOnOpen()}));if(!1!==this._timeout){var a=this._timeout,r=setTimeout((function(){o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",a)}),a);this.subs.push({destroy:function(){clearTimeout(r)}})}return this.subs.push(o),this.subs.push(s),this},Lp.prototype.onopen=function(){this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(Ep(e,"data",Tp(this,"ondata"))),this.subs.push(Ep(e,"ping",Tp(this,"onping"))),this.subs.push(Ep(e,"pong",Tp(this,"onpong"))),this.subs.push(Ep(e,"error",Tp(this,"onerror"))),this.subs.push(Ep(e,"close",Tp(this,"onclose"))),this.subs.push(Ep(this.decoder,"decoded",Tp(this,"ondecoded")))},Lp.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},Lp.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},Lp.prototype.ondata=function(e){this.decoder.add(e)},Lp.prototype.ondecoded=function(e){this.emit("packet",e)},Lp.prototype.onerror=function(e){this.emitAll("error",e)},Lp.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new Mp(this,e,t),this.nsps[e]=n;var i=this;n.on("connecting",o),n.on("connect",(function(){n.id=i.generateId(e)})),this.autoConnect&&o()}function o(){~kp(i.connecting,n)||i.connecting.push(n)}return n},Lp.prototype.destroy=function(e){var t=kp(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},Lp.prototype.packet=function(e){var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(n){for(var i=0;i0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},Lp.prototype.cleanup=function(){for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();this.reconnecting=!0;var n=setTimeout((function(){if(Op.isBackend())return e.reconnecting=!1,e.reconnect(),void e.emitAll("reconnect_error","Uniapp running backend, skipped reconnect...");e.skipReconnect||(e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):e.onreconnect()})))}),t);this.subs.push({destroy:function(){clearTimeout(n)}})}},Lp.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var n=Rl,i=Ol,o=Ap;vl.exports("socket.io-client"),e.exports=t=a;var s=t.managers={};function a(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,a=n(e),r=a.source,c=a.id,u=a.path,l=s[c]&&u in s[c].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||l?i=o(r,t):(s[c]||(s[c]=o(r,t)),i=s[c]),a.query&&!t.query&&(t.query=a.query),i.socket(a.path,t)}t.protocol=i.protocol,t.connect=a,t.Manager=Ap,t.Socket=lp.exports}(gl,gl.exports);const Pp=gl.exports;class Np{constructor(){this.io=Pp,this.status=Wr.DISCONNECTED,this.permissions=[Jc.NONE],this.connectedObservers=[],this.disconnectedObservers=[]}connect(){this.status=Wr.CONNECTING}socketio(){return this.io}on(e,t){this.io.on(e,t)}disconnect(){this.io.disconnect()}getStatus(){return this.status}addConnectedObserver(e){nc.isFunction(e)&&this.connectedObservers.push(e)}addDisconnectedObserver(e){nc.isFunction(e)&&this.disconnectedObservers.push(e)}notify(e,t){for(let n=0;n{this.status=Wr.CONNECTED,this.notify(this.connectedObservers)})),this.io.on("reconnecting",(e=>{this.status=Wr.CONNECTING,this.notify(this.reconnectingObservers,e)})),this.io.on("disconnect",(()=>{this.status=Wr.DISCONNECTED,this.notify(this.disconnectedObservers)})),this.io.on("connect_error",(function(e){}))}addReconnectingObserver(e){this.reconnectingObservers.push(e)}}class Up{static get(e){const t=encodeURIComponent(e)+"=",n=document.cookie.split("; ");for(const i of n)if(i.startsWith(t))return decodeURIComponent(i.substring(t.length));return null}static set(e,t,n,i,o="/",s=!1){let a=encodeURIComponent(e)+"="+encodeURIComponent(t);n instanceof Date&&(a+="; expires="+n.toGMTString()),o&&(a+="; path="+o),i&&(a+="; domain="+i),s&&(a+="; secure"),document.cookie=a}static remove(e,t,n="/",i=!1){Up.set(e,"",new Date(0),t,n,i)}}class Gp{asyncGet(e){let t=this.get(e);return Promise.resolve(t)}asyncPut(e,t){return this.put(e,t),Promise.resolve()}get(e){let t=this.doGet(e);return t=JSON.parse(t),t}put(e,t){this.doPut(e,JSON.stringify(t))}}class xp extends Gp{constructor(){super(),this.domain=null,this.domain="undefined"!=typeof location&&/^(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/.test(location.host)?location.host.split(".").slice(-2).join("."):null}doGet(e){return Up.get(e)||null}doPut(e,t){const n=new Date(2030,12,31,0,0,0,0),i=this.domain;Up.set(e,t,n,i)}remove(e){const t=this.domain;Up.remove(e,t)}support(){return"undefined"!=typeof navigator&&!0===navigator.cookieEnabled}}class Fp extends Gp{doGet(e){return localStorage.getItem(e)||null}doPut(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}support(){return!("undefined"!=typeof GameGlobal||"undefined"==typeof localStorage||!localStorage.setItem)}}class Bp extends Gp{doGet(e){return Nn.getStorageSync(e)||null}doPut(e,t){Nn.setStorageSync(e,t)}remove(e){Nn.removeStorageSync(e)}support(){return!("object"!=typeof Nn||!Nn.getStorageSync)}}class qp extends Gp{doGet(e){return cc.sys.localStorage.getItem(e)||null}doPut(e,t){cc.sys.localStorage.setItem(e,t)}remove(e){cc.sys.localStorage.removeItem(e)}support(){return"undefined"!=typeof cc&&void 0!==cc.sys.localStorage}}class Vp extends Gp{doGet(e){return Pn.getStorageSync(e)||null}doPut(e,t){Pn.setStorageSync(e,t)}remove(e){Pn.removeStorageSync(e)}support(){return!("object"!=typeof Pn||!Pn.getStorageSync||"undefined"!=typeof tt)}}class jp extends Gp{asyncGet(e){return fc(this,void 0,void 0,(function*(){const t=yield Jr.asyncStorage.getItem(e);return JSON.parse(t)}))}asyncPut(e,t){return Jr.asyncStorage.setItem(e,JSON.stringify(t))}doPut(e,t){throw new Error("Method not implemented.")}remove(e){Jr.asyncStorage.removeItem(e)}support(){return $r.currentFramework()===zr.REACT_NATIVE}doGet(e){throw new Error("Method not implemented.")}}class Hp extends Gp{doGet(e){const t=my.getStorageSync({key:e}).data||null;return"string"==typeof JSON.parse(t)?JSON.parse(t):t}doPut(e,t){my.setStorageSync({key:e,data:JSON.stringify(t)})}remove(e){my.removeStorageSync({key:e})}support(){return!("undefined"==typeof my||!my.getStorageSync)}}class Kp extends Gp{doGet(e){return tt.getStorageSync(e)||null}doPut(e,t){tt.setStorageSync(e,t)}remove(e){tt.removeStorageSync(e)}support(){return!("object"!=typeof tt||!tt.getStorageSync)}}class zp extends Gp{doGet(e){return swan.getStorageSync(e)||null}doPut(e,t){swan.setStorageSync(e,t)}remove(e){swan.removeStorageSync(e)}support(){return!("undefined"==typeof swan||!swan.getStorageSync)}}class Wp{constructor(){this.supportedStorage=null;const e=Wp.storages;e.push(new Bp),e.push(new qp),e.push(new Fp),e.push(new Vp),e.push(new jp),e.push(new Hp),e.push(new zp),e.push(new Kp),e.push(new xp),this.dispatch(),this.supportedStorage}static localStorage(){return this.instance.supportedStorage}dispatch(){for(let e of Wp.storages)if(e.support()){this.supportedStorage=e;break}}}Wp.storages=new Array,Wp.instance=new Wp;class Yp{static get(){return fc(this,void 0,void 0,(function*(){let e,t=Wp.localStorage();return null!==t&&(e=yield t.asyncGet(Yp.SM_KEY)),e}))}static put(e){return fc(this,void 0,void 0,(function*(){var t=Wp.localStorage();let n=e.sm;null!==t&&n&&t.asyncPut(Yp.SM_KEY,n)}))}}Yp.SM_KEY="GE-SM";class $p{static e(e,t){let n="";for(let s=0;s=32&&o<=126?String.fromCharCode(function(e){let n=e+t;return n>126?n-126+32:n}(i)):String.fromCharCode(i));var i,o;return n}}class Jp{static initRNUniqueId(){if($r.currentFramework()===zr.REACT_NATIVE){let e=Jr.platform,t=e.constants,n={os:e.OS};return"android"===n.os?n.f=t.Fingerprint:n.v=e.Version,JSON.stringify(n)}return null}static initPlusDeviceId(){return new Promise(((e,t)=>{"undefined"!=typeof plus?plus.device.getInfo({success:t=>{e(t.uuid)},fail:e=>{t(e)}}):e(null)}))}static getVideoCard(){var e;if(oc.currentPlatform()===ic.BROWSER&&"undefined"!=typeof document){const t=document.createElement("canvas"),n=null!==(e=t.getContext("webgl"))&&void 0!==e?e:t.getContext("experimental-webgl");if(n&&"getExtension"in n){let e=0,t=0;if(navigator.userAgent.indexOf("Firefox")>-1)t=n.VENDOR,e=n.RENDERER;else{let i=n.getExtension("WEBGL_debug_renderer_info");if(!i)return null;t=i.UNMASKED_VENDOR_WEBGL,e=i.UNMASKED_RENDERER_WEBGL}const i={vendor:(n.getParameter(t)||"").toString(),renderer:(n.getParameter(e)||"").toString()};return JSON.stringify(i)}}return null}static z(){return fc(this,void 0,void 0,(function*(){const e={p:oc.currentPlatform(),f:$r.currentFramework(),vc:this.getVideoCard(),rfp:this.initRNUniqueId()};return $p.e(JSON.stringify(e),5)}))}}class Xp{constructor(e){this.rocketsBuffer=new Set,this.socket=e,this.socket.addConnectedObserver(this.onSocketConnected.bind(this))}emit(e){this.socket.status!==Wr.DISCONNECTED?(e.start(),this.doEmit(e)):e.fail({resultCode:"409",content:"Please connect first"})}doEmit(e){if(!e.complete)if(this.socket.status!==Wr.CONNECT_FAILED)if(this.isConnected())if(this.hasPermission(e)){let t=setTimeout((()=>{this.doEmit(e)}),e.singleTimeout);e.unique&&(e.params.retried=e.retried),this.socket.socketio().emit(e.name,e.params,(n=>{clearTimeout(t),200===n.resultCode||200==n.code?e.success(n):e.fail(n)})),e.retried++}else e.fail({resultCode:401,content:"No permission"});else this.isConnecting()&&this.rocketsBuffer.add(e);else e.fail({resultCode:408,content:"Failed to connect GoEasy."})}hasPermission(e){return!!this.socket.permissions.find((t=>t===e.permission))}isConnected(){return[Wr.CONNECTED,Wr.RECONNECTED,Wr.EXPIRED_RECONNECTED,Wr.DISCONNECTING].includes(this.socket.status)}isConnecting(){return[Wr.CONNECTING,Wr.RECONNECTING].includes(this.socket.status)}onSocketConnected(){this.emitBuffer()}emitBuffer(){Array.from(this.rocketsBuffer).forEach((e=>{this.rocketsBuffer.delete(e),this.doEmit(e)}))}}class Qp extends jc{static init(){Qp.i=new Qp}static fire(e,t){this.i.fire(e,t)}static on(e,t){this.i.on(e,t)}static off(e,t){this.i.off(e,t)}}class Zp extends Np{constructor(e,t){super(),this.ioSocket=null,this.sid=null,this.anonymous=!1,this.userId=null,this.artifactVersion=Xr,this.vname=null,this.uri=null,this.ioOpts=null,this.reconnectingTimes=0,this.messageObservers=new Map,this.connectFailedObservers=[],this.connectingObservers=[],this.expiredReconnectedObservers=[],this.options=e,this.ioSocket=new wp({onDisconnected:this.onIoDisconnected.bind(this),onReconnecting:this.onIoReconnecting.bind(this)}),this.ioSocketEmitter=new Xp(this.ioSocket),this.ioSocket.addConnectedObserver(this.onIoReconnected.bind(this)),this.initOptions(t),this.connect()}initUserId(){let e=this.connectOptions.id;nc.isEmpty(e)?this.anonymous=!0:this.userId=e.toString()}socketio(){return this.ioSocket.socketio()}extendOptions(){let e=this.connectOptions;if(nc.isNull(e.data)||nc.isDef(e.data)&&!nc.isObject(e.data))throw{code:400,content:"TypeError: data requires an object."};if((nc.isDef(e.data)?String(e.data).length:0)>300&&nc.isObject(e)&&nc.isFunction(e.onFailed))throw{code:400,content:"user.data-length limit 300 byte."};if(nc.isObject(e.wxmpId)){if(nc.isEmpty(e.wxmpId.appid))throw{code:400,content:"wxmpId.appid is required."};if(nc.isEmpty(e.wxmpId.openid))throw{code:400,content:"wxmpId.openid is required. requires string."}}else if(nc.isPrimitive(e.wxmpId))throw{code:400,content:"TypeError: wxmpId requires an object."}}initUriAndOpts(){let e=this.options;_p.init(e.host,e.forceTLS,e.supportOldBrowser),this.uri=_p.uri();let t=["websocket"];!0===e.supportOldBrowser&&t.push("polling"),this.ioOpts={transports:t,timeout:pc.connect,reconnectionDelayMax:pc.reconnectionDelayMax}}onIoReconnected(){this.status===Wr.RECONNECTING&&this.authorize()}sendAck(e,t){this.ioSocket.io.emit(e,t)}initOptions(e){this.connectOptions=e,this.addConnectedObserver(e.onSuccess),this.addConnectFailedObserver(e.onFailed),this.addConnectingObserver(e.onProgress),this.initUserId()}connect(){this.initUriAndOpts(),this.extendOptions(),super.connect(),this.onConnecting(),this.ioSocket.connect({uri:this.uri,opts:this.ioOpts}),this.authorize()}disconnect(){return new Promise(((e,t)=>{this.status=Wr.DISCONNECTING;let n=()=>{this.ioSocket.disconnect(),this.status=Wr.DISCONNECTED,Qp.fire(ru.DISCONNECTED),e()};const i=Bc.modules.get("GN");if(i&&(i.params.regId||this.connectOptions.wxmpId)){let e=e=>{t(e)},i=new Qc({name:dc.manualDisconnect,params:{},permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e,success:n});Wc.Socket.e(i)}else n()}))}authorize(){return fc(this,void 0,void 0,(function*(){let e=this.connectOptions,t={appkey:this.options.appkey,userId:this.userId,userData:JSON.stringify(e.data),otp:e.otp,artifactVersion:this.artifactVersion,sid:this.sid,mP:yield Bc.getParams(),a:this.anonymous,z:yield Jp.z(),sm:yield Yp.get(),c:{n:this.vname,v:this.artifactVersion}};JSON.stringify(t);let n=new Qc({name:dc.authorize,params:t,permission:Jc.NONE,singleTimeout:pc.commonInfiniteSingle,totalTimeout:pc.commonInfiniteTotal,success:e=>{this.onAuthorizeSuccess(e)},fail:e=>{this.onAuthorizeFailed(e)}});this.ioSocketEmitter.emit(n)}))}onConnecting(){Qp.fire(ru.CONNECTING,this.reconnectingTimes),this.notify(this.connectingObservers,this.reconnectingTimes)}onIoReconnecting(){this.reconnectingTimes++,this.status==Wr.CONNECTED||this.status==Wr.EXPIRED_RECONNECTED||this.status==Wr.RECONNECTING?this.status=Wr.RECONNECTING:this.status=Wr.CONNECTING,this.onConnecting()}onIoDisconnected(){this.status!==Wr.DISCONNECTING&&(this.status=Wr.RECONNECTING,Qp.fire(ru.LOST),this.notify(this.disconnectedObservers))}onAuthorizeSuccess(e){Yp.put(e),Bc.setDatas(e.mD),this.status===Wr.RECONNECTING?this.sid!==e.sid?(this.status=Wr.EXPIRED_RECONNECTED,this.sid=e.sid,Qp.fire(ru.EXPIRED_RECONNECTED),this.notify(this.expiredReconnectedObservers)):(this.status=Wr.RECONNECTED,Qp.fire(ru.RECONNECTED)):(this.status=Wr.CONNECTED,this.sid=e.sid),e.enablePublish&&(this.permissions.find((e=>e==Jc.WRITE))||this.permissions.push(Jc.WRITE)),e.enableSubscribe&&(this.permissions.find((e=>e==Jc.READ))||this.permissions.push(Jc.READ)),this.reconnectingTimes=0,Qp.fire(ru.CONNECTED),this.notify(this.connectedObservers)}onAuthorizeFailed(e){this.ioSocket.disconnect(),this.status=Wr.CONNECT_FAILED;let t={code:e.resultCode||408,content:e.content||"Host unreachable or timeout"};this.notify(this.connectFailedObservers,t)}addConnectingObserver(e){nc.isFunction(e)&&this.connectingObservers.push(e)}addConnectFailedObserver(e){nc.isFunction(e)&&this.connectFailedObservers.push(e)}addExpiredReconnectedObserver(e){nc.isFunction(e)&&this.expiredReconnectedObservers.push(e)}onMessage(e,t){this.ioSocket.io._callbacks.hasOwnProperty("$"+e)||this.ioSocket.io.on(e,t)}user(){let e=this.connectOptions;return e?{id:e.id,data:e.data}:null}}class eh{constructor(e){this.guidList=[],this.socket=e}offMessage(e,t){Qp.off(ru.NEW_MESSAGE+"_"+e,t)}onMessage(e,t){Qp.on(ru.NEW_MESSAGE+"_"+e,t),this.socket.onMessage(e,(t=>{this.fire(e,t)}))}fire(e,t){let n=this.filter(t);n&&Qp.fire(ru.NEW_MESSAGE+"_"+e,n)}filter(e){if("string"==typeof e&&(e=JSON.parse(e)),e.i){if(this.guidList.findIndex((t=>t===e.i))>-1)return;this.guidList.unshift(e.i),this.guidList.length>300&&this.guidList.pop()}return e}}class th{static init(e){this.i=new th(e)}constructor(e){this.goeasyOptions=e}static connect(e,t){if(this.status()!==Wr.DISCONNECTED&&nc.isObject(e)&&nc.isFunction(e.onFailed))return void e.onFailed({code:408,content:"It is already connected, don't try again until disconnect() is called. "});this.confirmUserIdAndData(e),Qp.init();let n=this.i;Bc.preConnect(e),n.socket=new Zp(n.goeasyOptions,e),n.socket.vname=t,n.emitter=new Xp(n.socket),n.messageListener=new eh(n.socket),Bc.postConnect()}static confirmUserIdAndData(e){if(Bc.modules.get("GIM"))nu.validateId(e.id,"id"),nu.validateObject(e.data,"data");else if("string"==typeof e.id&&e.id.length>60)throw{code:400,content:"id over max length 60"}}static e(e){this.i.emitter.emit(e)}static sendAck(e,t){this.i.socket.sendAck(e,t)}static status(){return this.i&&this.i.socket?this.i.socket.getStatus():Wr.DISCONNECTED}static on(e,t){Qp.on(e,t)}static off(e,t){Qp.off(e,t)}static offMessage(e,t){this.i.messageListener.offMessage(e,t)}static onMessage(e,t){this.i.messageListener.onMessage(e,t)}static disconnect(e){this.status()===Wr.CONNECTED||this.status()===Wr.RECONNECTED?this.i.socket.disconnect().then((()=>{gc.onSuccess(e)})).catch((t=>{gc.onFailed(e,t)})):gc.onFailed(e,{code:408,content:"Host unreachable or timeout"})}static user(){return this.i.socket.user()}}th.EVENT=ru;class nh{static getInstance(){return nh.instance||(nh.instance=new nh),nh.instance}constructor(){this.synchronized=!0,this.onlineChanged=e=>{e.online?this.teamIds.add(e.teamId):this.teamIds.delete(e.teamId)},this.onDisconnected=()=>{this.queryMyTeamPromise=null,this.teamIds=null},this.onConnected=()=>{this.synchronized&&(this.queryMyTeamPromise=this.queryTeams())},th.on(th.EVENT.LOST,this.onDisconnected),th.on(th.EVENT.RECONNECTED,this.onConnected),th.onMessage(au.CS_ONLINE_CHANGED,this.onlineChanged)}queryTeams(){return this.queryMyTeamPromise||(this.queryMyTeamPromise=new Promise(((e,t)=>{let n=new Qc({name:dc.CS_MY_TEAMS,params:{},permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{t(e)},success:t=>{this.teamIds=new Set(t.content),this.synchronized=!0,e(this.teamIds)}});Wc.Socket.e(n)}))),this.queryMyTeamPromise}myTeams(){if(this.synchronized&&this.queryMyTeamPromise)return this.teamIds;throw"please query team first."}isOnline(e,t){return fc(this,void 0,void 0,(function*(){yield this.queryTeams(),gc.onSuccess(t,this.teamIds.has(e))}))}online(e,t){if(!nc.isObject(t.agentData)||!nc.isObject(t.teamData))throw{code:400,content:"agentData and teamData require an object"};let n=new dl(e,t.teamData,t.agentData),i=new Qc({name:dc.CS_ONLINE,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:n=>{this.teamIds.add(e),gc.onSuccess(t),Vu.i.fire(Lu.CS_ONLINE_SUCCESS)}});Wc.Socket.e(i)}offline(e,t){let n=new pl(e),i=new Qc({name:dc.CS_OFFLINE,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:n=>{this.teamIds.delete(e),gc.onSuccess(t),Vu.i.fire(Lu.CS_OFFLINE_SUCCESS)}});Wc.Socket.e(i)}agents(e,t){let n=new hl(e),i=new Qc({name:dc.CS_AGENTS,params:n,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{e.content.forEach((e=>{e.data=JSON.parse(e.data)})),gc.onSuccess(t,e)}});Wc.Socket.e(i)}}class ih{constructor(e){this.onMessageReceived=e=>{let t=ih.session;if(e.scene()===Qr.CS&&t.liveOptions){let n=e,i=t.liveOptions.customerId;t.teamId===n.teamId&&n.customerId()===i&&(t.tryUpdateStatus(n),t.liveOptions.onNewMessage(n))}},this.teamId=e,Vu.i.on(Lu.CS_AGENT_MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.CS_ACCEPTED,this.onMessageReceived),Vu.i.on(Lu.CS_ENDED,this.onMessageReceived),Vu.i.on(Lu.CS_TRANSFER,this.onMessageReceived),th.on(ru.DISCONNECTED,ih.destroy)}static live(e,t){return fc(this,void 0,void 0,(function*(){let n=t.customerId;nu.validateId(n,"customerId");let i=new ul(e,n);yield nh.getInstance().queryTeams();let o=new Qc({name:dc.CS_LIVE_SESSION,params:i,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:n=>{ih.destroy(),this.session=new ih(e),this.session.liveOptions=t;let i=n.content.customerStatus;"ACCEPTED"===i.status&&(i.agent.data=JSON.parse(i.agent.data)),this.session.status=i,this.session.liveOptions.onStatusUpdated(this.session.status),gc.onSuccess(t)}});Wc.Socket.e(o)}))}customerId(){return this.liveOptions.customerId}static isMyCustomer(e){let t=ih.session;if(t&&t.teamId===e.teamId&&t.customerId()===e.customerId()){let n=nh.getInstance().myTeams(),i=t.status.agent;return n.has(e.teamId)&&(!i||i.id===Wc.Socket.user().id)}return!0}static isMyMessage(e){let t=Wu.byIMMessage(e);return e.type===Nu.TRANSFER&&e.payload.transferTo.id===Wc.Socket.user().id||this.isMyCustomer(t)}static quit(e){let t=ih.session;if(t){let n=t.liveOptions.customerId;nu.validateId(n,"customerId");let i=new ul(t.teamId,n),o=new Qc({name:dc.CS_QUIT_LIVE,params:i,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:t=>{gc.onFailed(e,t)},success:t=>{ih.destroy(),gc.onSuccess(e)}});Wc.Socket.e(o)}}tryUpdateStatus(e){if("FREE"!==this.status.status&&this.status.sessionId>e.sessionId)return;let t;switch(e.type){case Nu.ACCEPT:t=new ll,t.status="ACCEPTED",t.start=e.payload.sessionStart,t.sessionId=e.sessionId,t.agent=new tc(e.senderId,e.senderData);break;case Nu.END:t=new ll,t.status="FREE";break;case Nu.TRANSFER:t=new ll,t.status="ACCEPTED",t.start=e.payload.sessionStart,t.sessionId=e.sessionId,t.agent=e.payload.transferTo;break;default:"FREE"===this.status.status&&(t=new ll,t.status="PENDING",t.start=e.timestamp,t.sessionId=e.sessionId)}t&&(this.status=t,this.liveOptions.onStatusUpdated(t))}}ih.destroy=()=>{let e=ih.session;e&&(Vu.i.off(Lu.CS_AGENT_MESSAGE_RECEIVED,e.onMessageReceived),Vu.i.off(Lu.CS_ACCEPTED,e.onMessageReceived),Vu.i.off(Lu.CS_ENDED,e.onMessageReceived),Vu.i.off(Lu.CS_TRANSFER,e.onMessageReceived),th.off(ru.DISCONNECTED,ih.destroy),ih.session=null)};class oh extends cl{constructor(e){super(e),this.unread=0,this.markingAmount=0}loadHistory(e,t){return fc(this,void 0,void 0,(function*(){return nc.isUndef(t)?t=10:t>30&&(t=30),yield this.loadServerMessages(e,t)}))}loadServerMessages(e,t){return fc(this,void 0,void 0,(function*(){let n=new ol(this.target.id.toString(),this.target.scene,e,t,this.target.teamId),i=yield this.remoteHistory.loadServerMessages(this.target,n);return i.userOffsets.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),i.messages}))}deleteMessages(e){return fc(this,void 0,void 0,(function*(){gc.onFailed(e,"Delete CS message is not supported yet")}))}initMaxMessageAndOffsets(e,t){t.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),(nc.isUndef(this.acceptedMaxMessage)||this.acceptedMaxMessage.timestamp{this.userOffsets.updateOffset(e.userId,e.offset)})),this.savePendingMessage(e)}savePendingMessage(e){this.pendingMaxMessage?this.pendingMaxMessage.timestampthis.userOffsets.markingTime&&e>t&&(this.userOffsets.markingTime=e,this.markingAmount=this.unread,!0)}postMark(e){e===this.userOffsets.markingTime&&(this.unread-=this.markingAmount,this.markingAmount=0,this.userOffsets.updateOffset(Wc.Socket.user().id,e),Vu.i.fire(Lu.UNREAD_AMOUNT_CHANGED,this.target))}syncMarkedMessage(e){}getMaxMessage(e){return e?this.acceptedMaxMessage:this.pendingMaxMessage}unreadAmount(e){return e?this.unread:0}existsMessage(e){return this.acceptedMaxMessage&&this.acceptedMaxMessage.messageId===e.messageId||this.pendingMaxMessage&&this.pendingMaxMessage.messageId===e.messageId}maxAcceptedMessageTime(){return this.acceptedMaxMessage?this.acceptedMaxMessage.timestamp:0}maxTime(e){let t=this.getMaxMessage(e);return t?t.timestamp:0}}class sh extends cl{constructor(e){super(e)}deleteMessages(e){return fc(this,void 0,void 0,(function*(){gc.onFailed(e,"Delete CS message is not supported yet")}))}}class ah{static validateMessageArray(e){if(!nc.isArray(e)||nc.isEmpty(e))throw{code:400,content:"messages requires non empty array"};if(e.length>20)throw{code:400,content:"The maximum number of messages is 20"};let t=Wu.byIMMessage(e[0]);for(let n=0;n0){let e=Wu.byIMMessage(i);if(e.scene!==t.scene||e.id!==t.id)throw{code:400,content:"each message must be from the same friend or group"}}}}}class rh{static init(){return rh.instance=new rh,rh.instance}constructor(){this.map=new Map,this.onMessageSending=e=>{let t=Wu.byIMMessage(e);this.findOrCreateHistory(t).onMessageSending(e)},this.onMessageSendSuccess=e=>{let t=Wu.byIMMessage(e);this.findHistory(t).onMessageSendSuccess(e)},this.onMessageSendFailed=e=>{let t=Wu.byIMMessage(e);this.findHistory(t).onMessageSendFailed(e)},this.onMessageReceived=e=>{let t=Wu.byIMMessage(e),n=this.findOrCreateHistory(t);n.expiredTime>0&&(this.map.delete(t.toString()),n=this.findOrCreateHistory(t)),n.onMessageReceived(e)},this.onRemoteMarkRead=e=>{let t=Wu.byMessageReadRemoteEvent(e),n=this.findHistory(t);n&&n.syncMarkedMessage(e)},this.onRemoteMessageDeleted=e=>{let t=Wu.byIMMessageDeletedEvent(e),n=this.findHistory(t);n&&n.syncDeletedMessage(e.deleterId,e.times)},this.onMessageRecalled=e=>{let t=Wu.byConversationId(e.scene,e.conversationId),n=this.findHistory(t);n&&n.recallMessages(e)},this.onDisconnected=()=>{this.map.forEach(((e,t)=>{e.expire()}))},this.onReconnected=()=>{rl.fire(wu.HISTORY_EXPIRED)},this.destroy=()=>{},this.initialListeners()}initialListeners(){Vu.i.on(Lu.MESSAGE_SENDING,this.onMessageSending),Vu.i.on(Lu.MESSAGE_SEND_SUCCESS,this.onMessageSendSuccess),Vu.i.on(Lu.MESSAGE_SEND_FAILED,this.onMessageSendFailed),Vu.i.on(Lu.MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.CS_AGENT_MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.CS_ACCEPTED,this.onMessageReceived),Vu.i.on(Lu.CS_ENDED,this.onMessageReceived),Vu.i.on(Lu.CS_TRANSFER,this.onMessageReceived),Vu.i.on(Lu.MESSAGE_RECALLED,this.onMessageRecalled),th.onMessage(au.IM_MSG_READ,this.onRemoteMarkRead),th.onMessage(au.IM_MSG_DELETED,this.onRemoteMessageDeleted),th.on(th.EVENT.LOST,this.onDisconnected),th.on(th.EVENT.RECONNECTED,this.onReconnected)}loadHistory(e,t){return fc(this,void 0,void 0,(function*(){let n=this.queryToTarget(e,t),i=this.findOrCreateHistory(n);i.expiredTime>0&&(this.map.delete(n.toString()),i=this.findOrCreateHistory(n));let o=yield i.loadHistory(e.lastTimestamp,e.limit);gc.onSuccess(e,{code:200,content:o})}))}queryToTarget(e,t){if(nc.isDef(e.userId))return new Wu(Qr.PRIVATE,e.userId);if(nc.isDef(e.groupId))return new Wu(Qr.GROUP,e.groupId);if(nc.isDef(e.type)){if(!Object.values(Qr).includes(e.type))throw new Error("incorrect type, must be: "+Object.values(Qr));if(nc.isUndef(e.id))throw new Error("If type is not empty, id is required.");return Qr.CS==e.type&&nc.isUndef(t)&&(t=e.id),new Wu(e.type,e.id,t)}throw new Error("incorrect query options.")}privateMarkAsRead(e){return fc(this,void 0,void 0,(function*(){if(nc.isUndef(e.userId))throw new Error("userId could not be empty.");let t=Wu.byScene(Qr.PRIVATE,e.userId);yield this.markAsRead(t,e)}))}groupMarkAsRead(e){return fc(this,void 0,void 0,(function*(){if(nc.isUndef(e.groupId))throw new Error("groupId could not be empty.");let t=Wu.byScene(Qr.GROUP,e.groupId);yield this.markAsRead(t,e)}))}markMessageAsRead(e,t){return fc(this,void 0,void 0,(function*(){if(nc.isUndef(e.id))throw new Error("id could not be empty.");if(!Object.values(Qr).includes(e.type))throw new Error("incorrect type, must be: "+Object.values(Qr));Qr.CS==e.type&&nc.isUndef(t)&&(t=e.id);let n=Wu.byScene(e.type,e.id,t);yield this.markAsRead(n,e)}))}markAsRead(e,t){return fc(this,void 0,void 0,(function*(){let n=this.findHistory(e);n&&(yield n.markRead()),gc.onSuccess(t)}))}deleteMessage(e){return fc(this,void 0,void 0,(function*(){this.validateMessageArray(e.messages),$u.validate(e);let t=e.messages[0],n=Wu.byIMMessage(t),i=this.findHistory(n);if(!i)throw{code:400,content:"No message that could be deleted"};yield i.deleteMessages(e)}))}findOrCreateHistory(e){let t=this.findHistory(e);return t||(t=e.scene===Qr.CS?Wc.Socket.user().id===e.customerId()?new sh(e):new oh(e):new cl(e),this.map.set(e.toString(),t),t)}static get(e){return rh.instance.findOrCreateHistory(e)}findHistory(e){return this.map.get(e.toString())}validateMessageArray(e){ah.validateMessageArray(e)}}class ch{constructor(e){this.top=!1,this.data=null,this.dataLoaded=!1,this.target=e}toDto(){let e=this.target.scene,t=this.target.id,n=new ec;return e===Qr.PRIVATE?n.userId=t:e===Qr.GROUP?n.groupId=t:e===Qr.CS&&(n.id=this.target.teamId),n.type=e,n.lastMessage=this.getMaxMessage(),n.unread=this.getUnreadAmount(),n.top=this.top,n.data=this.data,n}getMaxMessage(){return rh.get(this.target).getMaxMessage()}getUnreadAmount(){return rh.get(this.target).unreadAmount()}maxMessageTime(){return rh.get(this.target).maxTime()}}class uh extends ch{constructor(e){super(e),this.accepted=!1}toDto(){let e=new ec,t=this.target.scene,n=this.target.id,i=this.target.teamId;return e.id=n,e.teamId=i,e.type=t,e.lastMessage=this.getMaxMessage(),e.unread=this.getUnreadAmount(),e.top=this.top,e.data=this.data,e.ended=this.isEnded(),e}isEnded(){let e=this.getMaxMessage(),t=e.type,n=e.payload;return t===Nu.END||t===Nu.TRANSFER&&n.transferTo.id!==Wc.Socket.user().id}getMaxMessage(){return rh.get(this.target).getMaxMessage(this.accepted)}getUnreadAmount(){return rh.get(this.target).unreadAmount(this.accepted)}maxMessageTime(){return rh.get(this.target).maxTime(this.accepted)}}class lh{constructor(e,t,n,i){this.type=e,this.top=t,this.targetId=n,this.teamId=i}}class dh{constructor(e,t,n){this.type=e,this.targetId=t,this.teamId=n}}class ph{constructor(e,t,n){this.type=e,this.targetId=t,this.teamId=n}}class hh{top(e,t){let n=new lh(e.scene,t,e.id,e.teamId);return new Promise(((e,t)=>{let i=new Qc({name:dc.topConversation,params:n,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:n=>{200===n.code?e(n):t(n)},fail:e=>{t(e)}});Wc.Socket.e(i)}))}remove(e){let t=new dh(e.scene,e.id,e.teamId);return new Promise(((e,n)=>{let i=new Qc({name:dc.removeConversation,params:t,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:t=>{200==t.code?e(t):n(t)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}query(e){return new Promise(((t,n)=>{let i=new Qc({name:e,params:{},permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{n(e)},success:e=>fc(this,void 0,void 0,(function*(){t(e)}))});Wc.Socket.e(i)}))}loadData(e){let t=new ph(e.scene,e.id,e.teamId);return new Promise(((e,n)=>{let i=new Qc({name:dc.imData,params:t,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,success:t=>{let n=JSON.parse(t.content);e(n)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}}hh.instance=new hh;class gh{constructor(){this.list=new Array,this.builder=new tl,this.remoteConversations=hh.instance,this.synchronized=!1,Vu.i.on(Lu.MAX_MESSAGE_CHANGED,this.onMaxMessageChanged.bind(this)),Vu.i.on(Lu.UNREAD_AMOUNT_CHANGED,this.onUnreadMessageChanged.bind(this)),Vu.i.on(Lu.MAX_MESSAGE_DELETED,this.onMaxMessageDeleted.bind(this))}onUnreadMessageChanged(e){this.findConversation(e)&&this.fireUpdated()}fireUpdated(){this.debounce(this.triggerUpdate.bind(this))}triggerUpdate(){let e=this.loadLocalConversations(),t=this.getUpdatedEventName();rl.fire(t,{unreadTotal:e.content.unreadTotal,conversations:e.content.conversations})}getUpdatedEventName(){return wu.CONVERSATIONS_UPDATED}latestConversations(e){return fc(this,void 0,void 0,(function*(){this.synchronized||(yield this.loadServerConversations());let t=this.loadLocalConversations();gc.onSuccess(e,t)}))}loadServerConversations(){return fc(this,void 0,void 0,(function*(){let e=this.rocketName(),t=yield this.remoteConversations.query(e);this.convertAbbrConversation(t.content),this.synchronized=!0}))}rocketName(){return dc.imLastConversations}convertAbbrConversation(e){let t=e;for(const n of t){let e=n.t,t=n.top,i=n.d?JSON.parse(n.d):{},o=n.userOffsets;n.lmsg.t=e;let s=n.lmsg,a=this.builder.build(s),r=Wu.byIMMessage(a),c=this.findConversation(r);nc.isUndef(c)?(c=this.buildByAbbr(n,a),this.insertOne(c)):(c.top=t,c.data=i),r.scene===Qr.GROUP&&(a.x=1),rh.get(r).initMaxMessageAndOffsets(a,o),this.correctPosition(c)}}onMaxMessageDeleted(e){this.removeConversation(e)}onMaxMessageChanged(e){return fc(this,void 0,void 0,(function*(){if(e.scene()===Qr.CS){let t=e;if(Wc.Socket.user().id!=t.customerId()&&(!1===t.accepted||t.type===Nu.ACCEPT&&t.senderId!=Wc.Socket.user().id))return}yield this.saveOrUpdateConversation(e)}))}saveOrUpdateConversation(e){return fc(this,void 0,void 0,(function*(){let t=e.status,n=Wu.byIMMessage(e),i=this.findConversation(n);nc.isUndef(i)&&t!==Zr.FAIL&&(i=this.buildByMessage(e),this.insertOne(i),t===Zr.SUCCESS&&(i.data=yield this.remoteConversations.loadData(n),i.dataLoaded=!0)),t===Zr.SENDING&&(i.data=e.getToData(),i.dataLoaded=!0),i&&i.dataLoaded&&(this.correctPosition(i),this.fireUpdated())}))}debounce(e){clearTimeout(this.timer),this.timer=setTimeout((()=>{e()}),500)}loadLocalConversations(){let e=0,t=new Array;for(const n of this.list)if(n.dataLoaded&&n.getMaxMessage()){e+=n.getUnreadAmount();let i=n.toDto();t.push(i)}return{code:200,content:{unreadTotal:e,conversations:t}}}findConversationIndex(e){return this.list.findIndex((t=>e.toString()===t.target.toString()))}findConversation(e){let t=this.findConversationIndex(e);return this.list[t]}removeLocalConversation(e){let t=this.findConversationIndex(e.target);this.list.splice(t,1)}insertOne(e){gh.sortedInserter.insert(this.list,e),this.list.length>gh.CONVERSATIONS_MAX_LENGTH&&0===this.list[this.list.length-1].getUnreadAmount()&&this.list.pop()}correctPosition(e){this.removeLocalConversation(e),this.insertOne(e)}removeConversation(e){let t=this.findConversation(e);t&&(this.removeLocalConversation(t),this.fireUpdated())}top(e,t,n){return fc(this,void 0,void 0,(function*(){if(!nc.isBoolean(t))throw new Error("top must be boolean.");let i=this.findConversation(e);if(!i)throw new Error("conversation does not exist.");i.top!=t&&(yield this.remoteConversations.top(e,t),i.top=t,this.correctPosition(i)),this.fireUpdated(),gc.onSuccess(n)}))}remove(e,t){return fc(this,void 0,void 0,(function*(){let n=this.findConversation(e);if(!n)throw new Error("conversation does not exist.");if(n instanceof uh&&!n.isEnded())throw new Error("CS conversation can only be deleted after it ends");yield this.remoteConversations.remove(e),this.removeLocalConversation(n),this.fireUpdated(),gc.onSuccess(t)}))}buildByAbbr(e,t){let n,i=Wu.byIMMessage(t);if(e.t===Qr.CS){let e=t;Wc.Socket.user().id===e.customerId()?n=new ch(i):(n=new uh(i),n.accepted=e.accepted)}else n=new ch(i);return n.dataLoaded=!0,n.top=e.top,n.data=e.d?JSON.parse(e.d):{},n}buildByMessage(e){let t,n=Wu.byIMMessage(e);if(e.scene()===Qr.CS){let i=e;Wc.Socket.user().id===i.customerId()?t=new ch(n):(t=new uh(n),t.accepted=i.accepted)}else t=new ch(n);return t}}gh.CONVERSATIONS_MAX_LENGTH=200,gh.sortedInserter=new class extends Ku{compare(e,t){let n;if(e.top==t.top){let i=e.maxMessageTime();n=t.maxMessageTime()-i}else n=e.top?-1:1;return 0===n?0:n>0?1:-1}};class fh extends Fc{static init(){return this.module=new fh,this.module.name=this.GIM_MODULE_NAME,this.initGN(),this.module}static initGN(){eu.addAssembler(new class{assemble(e){let t={messageId:e.id,timestamp:e.tm,type:e.t,senderId:e.sid,toType:e.tt};return e.tt===Qr.GROUP&&(t.groupId=e.gid),t}support(e){return!!e.sid}})}postConnect(){vg.init()}static check(){if(!this.module)throw{code:400,content:"IM not initialized. Please include 'IM' in the 'modules' during GoEasy initialization."}}}fh.GIM_MODULE_NAME="GIM";class mh extends gh{constructor(){super(),this.expired=!1,Vu.i.on(Lu.CS_ONLINE_SUCCESS,this.onCSOnlineSuccess.bind(this)),Vu.i.on(Lu.CS_OFFLINE_SUCCESS,this.onCSOfflineSuccess.bind(this)),th.on(th.EVENT.LOST,this.onDisconnected.bind(this)),th.on(th.EVENT.RECONNECTED,this.onConnected.bind(this))}onMaxMessageChanged(e){return fc(this,void 0,void 0,(function*(){if(e.scene()===Qr.CS){let t=e;if(t.customerId()!=Wc.Socket.user().id&&(!1===t.accepted||t.type===Nu.ACCEPT))if(Nu.ACCEPT===e.type){let t=Wu.byIMMessage(e);this.removeConversation(t)}else yield this.saveOrUpdateConversation(e)}}))}latestConversations(e){const t=Object.create(null,{latestConversations:{get:()=>super.latestConversations}});return fc(this,void 0,void 0,(function*(){let n=this.synchronized;yield t.latestConversations.call(this,e),this.list.length>0&&!n&&this.fireUpdated()}))}onUnreadMessageChanged(e){}onCSOnlineSuccess(){return fc(this,void 0,void 0,(function*(){yield this.loadServerConversations(),this.fireUpdated()}))}onCSOfflineSuccess(){this.list=[],this.fireUpdated()}getUpdatedEventName(){return wu.PENDING_CONVERSATIONS_UPDATED}rocketName(){return dc.CS_PENDING_CONVERSATION}convertAbbrConversation(e){return fc(this,void 0,void 0,(function*(){let t=e;for(const e of t){e.lastMessage.t=Qr.CS;let t=e.customerData,n=e.lastMessage,i=e.userOffsets,o=t?JSON.parse(t):{},s=this.builder.build(n),a=Wu.byIMMessage(s),r=this.findConversation(a);nc.isUndef(r)&&(r=new uh(a),r.accepted=s.accepted,r.dataLoaded=!0,this.insertOne(r)),r.top=!1,r.data=o,rh.get(a).initPendingMaxMessageAndOffsets(s,i),this.correctPosition(r)}}))}onDisconnected(){this.expired=!0}onConnected(){return fc(this,void 0,void 0,(function*(){this.expired&&fh.module&&fh.module.active&&(this.expired=!1,this.list=[],yield this.loadServerConversations(),this.fireUpdated())}))}}class _h{constructor(){this.conversations=new gh,this.pendingConversations=new mh}latestConversations(e){this.conversations.latestConversations(e)}latestPendingConversations(e){this.pendingConversations.latestConversations(e)}topPrivateConversation(e){let t=Wu.byScene(Qr.PRIVATE,e.userId);this.conversations.top(t,e.top,e)}topGroupConversation(e){let t=Wu.byScene(Qr.GROUP,e.groupId);this.conversations.top(t,e.top,e)}topConversation(e){let t=e.conversation;this.validateConversationDTO(t);let n=Wu.byConversationDTO(t);this.conversations.top(n,e.top,e)}removePrivateConversation(e){let t=Wu.byScene(Qr.PRIVATE,e.userId);this.conversations.remove(t,e)}removeGroupConversation(e){let t=Wu.byScene(Qr.GROUP,e.groupId);this.conversations.remove(t,e)}removeConversation(e){let t=e.conversation;this.validateConversationDTO(t);let n=Wu.byConversationDTO(t);this.conversations.remove(n,e)}validateConversationDTO(e){if(!(e instanceof ec))throw new Error("Incorrect conversation object.");{let t=e.lastMessage;if(t instanceof el&&t.customerId()!==Wc.Socket.user().id&&!1===t.accepted)throw new Error("pending conversation cannot be topped or removed.")}}}class vh{constructor(){this.builder=new tl,Wc.Socket.onMessage(au.imMessage,this.onMessageReceived.bind(this))}onMessageReceived(e){if(e.t!==Qr.CS){let t=this.builder.build(e);this.sendAck(t);let n=Wu.byIMMessage(t),i=n.scene;rh.get(n).existsMessage(t)||(this.createNotification(e),Vu.i.fire(Lu.MESSAGE_RECEIVED,t),i===Qr.PRIVATE?rl.fire(wu.PRIVATE_MESSAGE_RECEIVED,t):i===Qr.GROUP&&rl.fire(wu.GROUP_MESSAGE_RECEIVED,t))}}sendAck(e){Wc.Socket.sendAck("imAck",{publishGuid:e.messageId})}createNotification(e){const t=Wc.N.supportAppNotification();if(!nc.isObject(e.nt)||e.s===Wc.Socket.user().id||!t)return;let n={id:e.i,tm:e.ts,t:e.mt,sid:e.s,tt:e.t};n.tt===Qr.GROUP&&(n.gid=e.r),Wc.N.createLocalNotification(e.nt.t,e.nt.c,n,e.nt.sound,e.nt.badge)}}class yh{constructor(){this.subscribedGroups=[],Wc.Socket.on(ru.EXPIRED_RECONNECTED,this.expiredResubscribeGroups.bind(this))}expiredResubscribeGroups(){this.subscribedGroups.forEach((e=>fc(this,void 0,void 0,(function*(){yield this.doSubscribeGroup(e)}))))}subscribe(e){let t=e.groupIds;nu.validateIdArray(t,"groupIds");let n=new Ih(t,e.accessToken);this.doSubscribeGroup(n).then((()=>{this.subscribedGroups.push(n),gc.onSuccess(e,{code:200,content:"ok"})})).catch((t=>{gc.onFailed(e,{code:t.resultCode||408,content:t.content||"Failed to subscribe group message"})}))}doSubscribeGroup(e){return new Promise(((t,n)=>{let i=e.groupIds.toString().split(","),o=new Qc({name:dc.subscribeGroups,params:{groupIds:i,at:e.accessToken},permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:()=>{t()},fail:e=>{n(e)}});Wc.Socket.e(o)}))}unsubscribe(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t=new Qc({name:dc.unsubscribeGroup,params:{groupId:e.groupId},permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,success:()=>{this.deleteSubscriptionByGroupId(e.groupId),gc.onSuccess(e,{code:200,content:"ok"})},fail:t=>{gc.onFailed(e,{code:t.resultCode||408,content:t.content||"Failed to unsubscribe group message"})}});Wc.Socket.e(t)}deleteSubscriptionByGroupId(e){this.subscribedGroups=this.subscribedGroups.filter((t=>{const n=t.groupIds.findIndex((t=>t==e));return n>-1&&t.groupIds.splice(n,1),t.groupIds.length>0}))}}class Ih{constructor(e,t){this.groupIds=e,this.accessToken=t}}class Mh{constructor(){this.newMessageReceived=e=>{let t=null;e.c&&(t=JSON.parse(e.c)),t&&t.events&&t.events.map((e=>{let n=e.userData?JSON.parse(e.userData):{},i={time:e.time,action:e.action,groupOnlineCount:t.userAmount,groupId:t.groupId,id:e.userId,data:n};rl.fire(wu.GROUP_PRESENCE,i)}))},th.onMessage(au.groupPresence,this.newMessageReceived)}presence(e){nu.validateIdArray(e.groupIds,"groupIds"),e.groupIds.toString().split(",");let t={groupIds:e.groupIds};this.emitRocket(dc.subscribeGroupPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to subscribe group message"})}),pc.commonRequestSingle,pc.commonRequestTotal)}unPresence(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t={groupId:e.groupId};this.emitRocket(dc.unsubscribeGroupPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to unsubscribe presence"})}),pc.commonRequestSingle,pc.commonRequestTotal)}emitRocket(e,t,n,i,o,s){let a=new Qc({name:e,params:t,singleTimeout:o,totalTimeout:s,permission:Jc.WRITE,success:n,fail:i});Wc.Socket.e(a)}}class Ch{get(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t=new Qc({name:dc.imGroupOnlineCount,params:{groupId:e.groupId},permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:function(t){gc.onFailed(e,t||{code:408,content:"Failed to query online group users"})},success:function(t){200==t.code?gc.onSuccess(e,t):gc.onFailed(e,t)}});Wc.Socket.e(t)}}class Sh{doHereNow(e,t,n){let i=new Qc({name:e,params:t,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{gc.onFailed(n,e)},success:e=>{let t=e.content;e.content=t.map((e=>{let t=e.userData?JSON.parse(e.userData):{};return{id:e.userId,data:t}})),gc.onSuccess(n,e)}});Wc.Socket.e(i)}}class Eh extends Sh{hereNow(e){nu.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t={groupId:e.groupId};this.doHereNow(dc.imGroupHereNow,t,e)}}class Th{constructor(){this.newMessageReceived=e=>{let t=[];e.c&&(t=JSON.parse(e.c).events||[]),t.map((e=>{let t=e.userData?JSON.parse(e.userData):{},n={time:e.time,action:e.action,id:e.userId,data:t};rl.fire(wu.USER_PRESENCE,n)}))},th.onMessage(au.userPresence,this.newMessageReceived)}presence(e){nu.validateIdArray(e.userIds,"userIds"),e.userIds.toString().split(",");let t={userIds:e.userIds};this.emitRocket(dc.subscribeUserPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to subscribe group message"})}),pc.commonRequestSingle,pc.commonRequestTotal)}unPresence(e){nu.validateId(e.userId,"userId"),e.userId=e.userId.toString();let t={userId:e.userId};this.emitRocket(dc.unsubscribeUserPresence,t,(()=>{gc.onSuccess(e,{code:200,content:"ok"})}),(t=>{gc.onFailed(e,{code:t.code||408,content:t.content||"Failed to unsubscribe presence"})}),pc.commonRequestSingle,pc.commonRequestTotal)}emitRocket(e,t,n,i,o,s){let a=new Qc({name:e,params:t,singleTimeout:o,totalTimeout:s,permission:Jc.WRITE,success:n,fail:i});Wc.Socket.e(a)}}class kh extends Sh{hereNow(e){let t=e.userIds;nu.validateIdArray(t,"userIds"),t.toString().split(","),this.doHereNow(dc.imHereNow,e,e)}}const Dh=new class{fileExtension(e,t){if(nc.isString(e))try{let n=e.split(t);return n[n.length-1]}catch(n){throw Error(n)}}};class Rh{}class Oh extends Rh{constructor(){super(...arguments),this.contentType="",this.name="",this.size=0,this.url=""}}class bh extends Oh{constructor(){super(...arguments),this.width=0,this.height=0}}class Ah{build(e){this.validate(e.createOptions);let t=this.create();return this.setPayload(e,t),t}}class Lh extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.name=i.name,n.size=i.size,n.contentType=i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Ph extends Lh{create(){return new bh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=n.path||n.tempFilePath,s=nc.isEmpty(n.name)||void 0===n.name?o:n.name;i.name="wx-image."+Dh.fileExtension(s,"."),i.contentType="image/"+Dh.fileExtension(s,"."),i.url=o,i.size=n.size,e.complete=new Promise(((e,t)=>{Pn.getImageInfo({src:i.url,success(t){i.width=t.width,i.height=t.height,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Nh extends Oh{constructor(){super(...arguments),this.duration=0}}class wh extends Lh{create(){return new Nh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=n.tempFilePath,s=nc.isEmpty(n.name)||null==n.name?o:n.name,a=n.duration,r=n.fileSize;i.url=o,i.size=r,i.duration=a/1e3,i.name="wx-audio."+Dh.fileExtension(s,"."),i.contentType="audio/"+Dh.fileExtension(s,"."),e.complete=Promise.resolve()}validate(e){super.validate(e)}}class Uh extends Rh{constructor(){super(...arguments),this.text=""}}class Gh extends Ah{create(){return new Uh}setPayload(e,t){let n=t,i=e.createOptions;n.text=i.text,e.complete=Promise.resolve()}validate(e){if(nc.isEmpty(e.text))throw{code:400,content:"text is empty"};if(!nc.isString(e.text))throw{code:400,content:"TypeError: text requires string."};if(""===e.text.trim())throw{code:400,content:"text is empty"};if(e.text.length>2500)throw{code:400,content:"Message text over max length 2500"}}}class xh extends Rh{constructor(){super(...arguments),this.video=new Bh,this.thumbnail=new Fh}}class Fh{constructor(){this.name="",this.url="",this.width=0,this.height=0,this.contentType=""}initURL(e){oc.currentPlatform()===ic.BROWSER&&this.htmlUrl(e)}htmlUrl(e){let t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.url=t.toDataURL("image/png")}}class Bh{constructor(){this.name="",this.url="",this.width=0,this.height=0,this.contentType="",this.size=0,this.duration=0}}class qh extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,thumbTempFilePath:l,width:d,name:p=""}=n,h=nc.isEmpty(p)?u:p;o.contentType="video/"+Dh.fileExtension(h,"."),o.name="wx-video."+Dh.fileExtension(h,"."),o.url=u,o.width=s.width=d,o.height=s.height=r,o.size=c,o.duration=a,s.url=l,s.contentType="image/jpg",s.name="wx-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Vh extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.fullPath||i.path,n.name=i.name,n.size=i.size,n.contentType=i.type,i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class jh extends Vh{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size;let o=nc.isEmpty(i.name)||void 0===i.name?i.path:i.name;n.contentType="image/"+Dh.fileExtension(o,"."),n.name="uni-image."+Dh.fileExtension(o,"."),e.complete=new Promise(((e,t)=>{Nn.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Hh extends Vh{create(){return new Nh}setPayload(e,t){let n=e.createOptions,i=t,o=n.file,s=o.tempFilePath,a=nc.isEmpty(o.name)||null==o.name?s:o.name;i.url=s,i.name="uni-audio."+Dh.fileExtension(a,"."),i.contentType="audio/"+Dh.fileExtension(a,"."),e.complete=new Promise(((e,t)=>{Nn.getFileInfo({filePath:s,success:o=>{let a=o.size;if(i.size=a,0===a)e();else if(nc.isDef(n.file.duration))i.duration=n.file.duration/1e3,e();else{const n=Nn.createInnerAudioContext();n.src=s,n.onCanplay((function(o){o.errCode?(n.destroy(),t(o)):(i.duration=n.duration,n.destroy(),e())})),n.onError((i=>{n.destroy(),-99===i.errCode?e():t(i)}))}},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Kh extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,width:l,name:d=""}=n,p=nc.isEmpty(d)?u:d;o.size=c,o.width=l,o.height=r,o.url=u,o.duration=a,o.contentType="video/"+Dh.fileExtension(p,"."),o.name="uni-video."+Dh.fileExtension(p,"."),s.url=u,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",s.name="uni-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class zh extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file,o=window.URL||window.webkitURL;n.url=o.createObjectURL(i),n.name=i.name,n.size=i.size,n.contentType=i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!(e.file instanceof File))throw Error("wrong file type.");if(0==e.file.size)throw Error("File size is 0.");if(e.file.size>524288e3)throw Error("message-length limit 30mib")}}class Wh extends zh{create(){return new bh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=window.URL||window.webkitURL,s=new Image;s.src=o.createObjectURL(n),e.complete=new Promise(((e,t)=>{s.onload=function(){i.width=s.width,i.height=s.height,o.revokeObjectURL(s.src),e()},s.onerror=function(e){o.revokeObjectURL(s.src),t(e)}}))}validate(e){super.validate(e);let t=["gif","jpg","png","jpeg"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported image.")}}class Yh extends zh{create(){return new Nh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=window.URL||window.webkitURL,s=document.createElement("audio");s.src=o.createObjectURL(n),e.complete=new Promise(((e,t)=>{s.onloadedmetadata=()=>{i.duration=s.duration,o.revokeObjectURL(s.src),e()},s.onerror=e=>{o.revokeObjectURL(s.src),t(e)}}))}validate(e){super.validate(e);let t=["mp3","ogg","wav","wma","ape","acc","mpeg"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported audio.")}}class $h extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,a=window.URL||window.webkitURL,r=document.createElement("video");r.src=a.createObjectURL(n),o.size=n.size,o.name=n.name,o.contentType=n.type,o.url=r.src,s.name=n.name,s.contentType="image/jpg",e.complete=new Promise(((e,t)=>{r.onloadedmetadata=()=>{o.duration=r.duration,o.width=r.videoWidth,o.height=r.videoHeight,s.width=r.videoWidth,s.height=r.videoHeight,s.url=this.getThumbnailUrl(r),a.revokeObjectURL(r.src),e()},r.onerror=function(e){a.revokeObjectURL(r.src),t(e)}}))}getThumbnailUrl(e){let t=document.createElement("canvas");return t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),t.toDataURL("image/png")}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!(e.file instanceof File))throw Error("wrong file type.");if(0==e.file.size)throw Error("File size is 0.");if(e.file.size>31457280)throw Error("message-length limit 30mib");let t=["avi","mov","rmvb","rm","flv","mp4","3gp","quicktime"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported video.")}}class Jh extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,tempVideoThumbPath:l,width:d}=n;o.size=c,o.width=d,o.height=r,o.url=u,o.duration=a,o.contentType="video/mp4",o.name="ali-video.mp4",s.url=l,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",s.name="ali-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Xh extends Ah{create(){return new Oh}setPayload(e,t){e.complete=Promise.reject("Alipay not support file message.")}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Qh extends Xh{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size,e.complete=new Promise(((e,t)=>{my.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,n.contentType="image/"+t.type,n.name="ali-image."+t.type,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Zh extends Xh{create(){return new Nh}setPayload(e,t){let n=t,i=e.createOptions.file,o=i.tempFilePath;n.url=o,n.name="ali-audio."+Dh.fileExtension(o,"."),n.contentType="audio/"+Dh.fileExtension(o,"."),n.duration=i.duration,n.size=i.fileSize,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class eg extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:a,height:r,size:c,tempFilePath:u,thumbTempFilePath:l,width:d}=n;o.size=c,o.width=d,o.height=r,o.url=u,o.duration=a,o.contentType="video/"+Dh.fileExtension(u,"."),o.name="baidu-video."+Dh.fileExtension(u,"."),s.url=l,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/"+Dh.fileExtension(l,"."),s.name="baidu-thumbnail."+Dh.fileExtension(u,"."),e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class tg extends Ah{create(){return new Oh}setPayload(e,t){e.complete=Promise.reject("Baidu app not support file message.")}validate(e){}}class ng extends tg{create(){return new Nh}setPayload(e,t){let n=t,i=e.createOptions.file,o=i.tempFilePath;n.url=o,n.name="baidu-audio."+Dh.fileExtension(o,"."),n.contentType="audio/"+Dh.fileExtension(o,"."),n.duration=i.duration/1e3,n.size=i.fileSize,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class ig extends tg{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size,e.complete=new Promise(((e,t)=>{swan.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,n.contentType="image/"+t.type,n.name="baidu-image."+t.type,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class og extends Ah{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;const{uri:o,type:s,size:a,name:r}=i;n.url=decodeURIComponent(o),n.name=r,n.size=a,n.contentType=s,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class sg extends og{create(){return new bh}setPayload(e,t){let n=t,i=e.createOptions.file;const{uri:o,fileSize:s,type:a,fileName:r,width:c,height:u}=i;n.url=o,n.size=s,n.contentType=a,n.name=r,n.width=c,n.height=u,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class ag extends Ah{create(){return new xh}setPayload(e,t){let n=e.createOptions.file;const i=t,{video:o,thumbnail:s}=i,{uri:a,type:r,fileSize:c,fileName:u,duration:l,height:d,width:p}=n;o.size=c,o.width=p,o.height=d,o.url=a,o.duration=l,o.contentType=r,o.name=u,s.url=a,s.name="rn-thumbnail.jpg",s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class rg extends og{create(){return new Nh}setPayload(e,t){let n=e.createOptions,i=t,o=n.file;const{uri:s,name:a,duration:r,size:c}=o;i.url=s,i.duration=Number((r/1e3).toFixed(2)),i.size=c,i.name=a||"rn-audio."+Dh.fileExtension(s,"."),i.contentType="audio/"+Dh.fileExtension(s,"."),n.file={uri:s,type:i.contentType,name:i.name},e.complete=Promise.resolve()}validate(e){super.validate(e)}}class cg extends Rh{}class ug extends Ah{create(){return new cg}setPayload(e,t){let n=e.createOptions;t.payload=n.payload,e.complete=Promise.resolve()}validate(e){let t=e.type,n=e.payload;if(nc.isEmpty(t))throw Error("type is empty.");if(!nc.isString(t))throw Error("type require a string");if(nc.isEmpty(n))throw Error("payload is empty.");if(!nc.isPlainObject(n)&&!nc.isStringOrNumber(n))throw Error("payload require object | string | number.")}}class lg{constructor(e,t){this.type=e,this.createOptions=t}}class dg{constructor(){this.framework=$r.currentFramework(),this.platform=oc.currentPlatform(),this.payloadBuilders={[zr.UNIAPP]:{image:new jh,file:new Vh,audio:new Hh,video:new Kh,text:new Gh},[ic.MP_WX]:{image:new Ph,file:new Lh,audio:new wh,video:new qh,text:new Gh},[ic.BROWSER]:{image:new Wh,file:new zh,audio:new Yh,video:new $h,text:new Gh},[ic.MP_ALI]:{image:new Qh,file:new Xh,audio:new Zh,video:new Jh,text:new Gh},[ic.MP_BAIDU]:{image:new ig,file:new tg,audio:new ng,video:new eg,text:new Gh},[zr.REACT_NATIVE]:{image:new sg,file:new og,audio:new rg,video:new ag,text:new Gh},[ic.MP_BYTE]:{image:new Ph,file:new Lh,audio:new wh,video:new qh,text:new Gh}}}buildMessage(e,t){const n=this.framework===zr.UNKNOWN?this.platform:this.framework;let i=this.payloadBuilders[n][e],o=new lg(e,t);if(i){let e=i.build(o);o.payload=e}else{let e=(new ug).build(o);o.payload=e.payload}let s=this.build(o);return o.complete.then((()=>{gc.onSuccess(t,s)})).catch((e=>{gc.onFailed(t,e)})),s}build(e){let t,n=e.type,i=e.payload,o=e.createOptions,s=o.to,a=s.type;return this.validate(o),a===Qr.GROUP?(t=new Zu,t.groupId=s.id.toString(),t.senderData=Wc.Socket.user().data):a===Qr.PRIVATE?(t=new Qu,t.read=!1,t.receiverId=s.id.toString()):a===Qr.CS&&(t=new el,t.to=s.id.toString(),t.teamId=s.id.toString(),t.senderData=Wc.Socket.user().data),t.senderId=Wc.Socket.user().id,t.messageId=$c.get(),t.payload=i,t.timestamp=Date.now(),t.type=n,t.recalled=!1,t.status=Zr.NEW,t.buildOptions=e,t}validate(e){const t=e.to;if(!t)throw new Error("message require property to.");if(!nc.isObject(t))throw new Error("TypeError: to requires an object.");if(!nc.isObject(t.data))throw new Error("TypeError: to.data requires an object.");if(!t.type||t.type!==Qr.GROUP&&t.type!==Qr.PRIVATE&&t.type!==Qr.CS)throw new Error("message require property to.type");if(nu.validateId(t.id,"to.id"),Wc.Socket.user().id===t.id)throw new Error("to.id can not be the same as your id.");nc.isDef(e.notification)&&nu.validateNotification(e.notification),e.wxmpTemplateMsg&&nu.validateWXMPTemplateMsg(e.wxmpTemplateMsg)}}class pg extends vh{onMessageReceived(e){if(e.t===Qr.CS){let t=this.builder.build(e);this.sendAck(t);let n=Wu.byIMMessage(t);rh.get(n).existsMessage(t)||(t.customerId()===Wc.Socket.user().id?(this.createNotification(e),Vu.i.fire(Lu.MESSAGE_RECEIVED,t),rl.fire(wu.CS_MESSAGE_RECEIVED,t)):nh.getInstance().queryTeams().then((()=>{ih.isMyMessage(t)&&this.createNotification(e),Vu.i.fire(Lu.CS_AGENT_MESSAGE_RECEIVED,t)})))}}}class hg{constructor(e){this.times=new Array;let t=e[0],n=Wu.byIMMessage(t);this.scene=n.scene,this.targetId=n.id,e.forEach((e=>{this.times.push(e.timestamp)})),this.times.sort(((e,t)=>e{Vu.i.fire(Lu.MESSAGE_RECALLED,e)},th.onMessage(au.IM_MSG_RECALLED,this.onRemoteRecalled)}recallMessage(e){return fc(this,void 0,void 0,(function*(){ah.validateMessageArray(e.messages),this.validate(e);let t=e.messages;yield this.recallServerMessages(t);let n=t[0],i=n.scene(),o=this.toConversationId(i,n.senderId,n.targetId()),s={id:Wc.Socket.user().id,data:Wc.Socket.user().data},a=t.map((e=>e.timestamp)),r=new al(i,o,s,a);Vu.i.fire(Lu.MESSAGE_RECALLED,r),gc.onSuccess(e)}))}toConversationId(e,t,n){if(Qr.PRIVATE===e)return o=n,(i=t).localeCompare(o)>0?`${i}:${o}`:`${o}:${i}`;var i,o;if(Qr.GROUP===e)return n;throw{code:400,content:`scene: ${e} not support`}}recallServerMessages(e){let t=new hg(e);return 0===t.times.length?Promise.resolve():new Promise(((e,n)=>{let i=new Qc({name:dc.IM_RECALL_MESSAGE,params:t,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{n(e)},success:t=>{200===t.code?e(t):n(t)}});Wc.Socket.e(i)}))}validate(e){let t=e.messages;for(let n=0;n{let i=this.dataCache.getData(e);i?n.set(e,i):t.push(e)})),0===t.length||(yield this.fetchData(...t)).forEach(((e,t)=>{this.dataCache.setData(t,e),n.set(t,e)})),Promise.resolve(n)}))}fetchData(...e){return new Promise(((t,n)=>{let i=new Qc({name:dc.MD_CMD,permission:Jc.READ,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,params:{name:"GET",data:{ids:e}},success:e=>{if(200===e.code){const n=new Map;e.content.forEach((e=>{n.set(e.id,e.data)})),t(n)}else n(e)},fail:e=>{n(e)}});Wc.Socket.e(i)}))}setData(e,t){this.dataCache.setData(e,t)}}class _g{constructor(){Vu.i.on(Lu.MESSAGE_RECEIVED,this.onMessageReceived),Vu.i.on(Lu.MESSAGE_SENDING,this.onMessageSending)}onMessageSending(e){let t=Wu.byIMMessage(e);t.scene===Qr.PRIVATE&&mg.i.setData(t.id,e.getToData())}onMessageReceived(e){if(Wu.byIMMessage(e).scene===Qr.GROUP){let t=e;mg.i.setData(t.senderId,t.senderData)}}}class vg{constructor(){this._iMReceiver=new vh,this.csMessageReceiver=new pg,this.memberDataUpdator=new _g,this._userHereNow=new kh,this.goEasyUploader=new Au,this._groupHereNow=new Eh,this._groupOnlineCount=new Ch,this.groupMessageSubscriber=new yh,this.messageBuilder=new dg,this.messageSender=new Hu,this.recaller=new gg,this._groupPresenceSubscriber=new Mh,this._userPresenceSubscriber=new Th,this.conversations=new _h,this.histories=rh.init()}static init(){Vu.init(),rl.init(),vg.instance=new vg}static i(){if(vg.instance)return vg.instance;throw Error("Please connect first.")}validateModules(){if(th.status()===Wr.DISCONNECTED)throw Error("Please call connect() first.");fh.check()}catch(e,t){return fc(this,void 0,void 0,(function*(){try{this.validateModules(),nu.validateCallbackOptions(t),yield e()}catch(n){gc.onFailed(t,n)}}))}on(e,t){rl.on(e,t)}off(e,t){rl.off(e,t)}createTextMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.TEXT,e)}createImageMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.IMAGE,e)}createFileMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.FILE,e)}createAudioMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.AUDIO,e)}createVideoMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Pu.VIDEO,e)}createCustomMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(e.type,e)}sendMessage(e){this.catch((()=>{this.messageSender.send(e)}),e)}recallMessage(e){this.catch((()=>{this.recaller.recallMessage(e)}),e)}deleteMessage(e){this.catch((()=>{this.histories.deleteMessage(e)}),e)}markGroupMessageAsRead(e){this.catch((()=>fc(this,void 0,void 0,(function*(){yield this.histories.groupMarkAsRead(e)}))),e)}markPrivateMessageAsRead(e){this.catch((()=>fc(this,void 0,void 0,(function*(){yield this.histories.privateMarkAsRead(e)}))),e)}markMessageAsRead(e,t){this.catch((()=>fc(this,void 0,void 0,(function*(){yield this.histories.markMessageAsRead(e,t)}))),e)}latestConversations(e){this.validateModules(),this.conversations.latestConversations(e)}removePrivateConversation(e){this.catch((()=>this.conversations.removePrivateConversation(e)),e)}removeGroupConversation(e){this.catch((()=>this.conversations.removeGroupConversation(e)),e)}topPrivateConversation(e){this.catch((()=>this.conversations.topPrivateConversation(e)),e)}topGroupConversation(e){this.catch((()=>this.conversations.topGroupConversation(e)),e)}history(e,t){this.catch((()=>{this.histories.loadHistory(e,t)}),e)}subscribeUserPresence(e){this.catch((()=>this._userPresenceSubscriber.presence(e)),e)}unsubscribeUserPresence(e){this.catch((()=>this._userPresenceSubscriber.unPresence(e)),e)}hereNow(e){this.catch((()=>this._userHereNow.hereNow(e)),e)}subscribeGroup(e){this.catch((()=>this.groupMessageSubscriber.subscribe(e)),e)}unsubscribeGroup(e){this.catch((()=>this.groupMessageSubscriber.unsubscribe(e)),e)}subscribeGroupPresence(e){this.catch((()=>this._groupPresenceSubscriber.presence(e)),e)}unsubscribeGroupPresence(e){this.catch((()=>this._groupPresenceSubscriber.unPresence(e)),e)}groupHereNow(e){this.catch((()=>this._groupHereNow.hereNow(e)),e)}groupOnlineCount(e){this.catch((()=>this._groupOnlineCount.get(e)),e)}latestPendingConversations(e){this.validateModules(),this.conversations.latestPendingConversations(e)}topConversation(e){this.validateModules(),this.conversations.topConversation(e)}removeConversation(e){this.validateModules(),this.conversations.removeConversation(e)}}class yg{constructor(e,t){this.customerId=e,this.teamId=t}}class Ig{constructor(e,t){this.teamId=e;let n=new tc(t.id.toString(),JSON.stringify(t.data));this.customer=n}}class Mg{constructor(e,t,n){this.customerId=e,this.teamId=t,this.agentId=n}}class Cg{constructor(e,t){this.customerId=e,this.teamId=t}}class Sg{constructor(e){this.builder=new tl,this.teamId=e}accept(e,t){let n=t.customer;if(nc.isUndef(n))throw{code:400,content:"customer is required."};nu.validateId(n.id,"customer.id");let i=n.data;if(nc.isUndef(i)||!nc.isObject(i))throw{code:400,content:"customer data must be non-empty object."};let o=new Ig(e,n),s=new Qc({name:dc.CS_ACCEPT,params:o,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);Vu.i.fire(Lu.CS_ACCEPTED,n),gc.onSuccess(t)}});Wc.Socket.e(s)}end(e,t){nu.validateId(t.id,"id");let n=t.id.toString(),i=new Cg(n,e),o=new Qc({name:dc.CS_END,params:i,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);Vu.i.fire(Lu.CS_ENDED,n),gc.onSuccess(t)}});Wc.Socket.e(o)}queryCustomerStatus(e,t){return fc(this,void 0,void 0,(function*(){nu.validateId(t.id,"id");let n=yield this.doCustomerStatus(e,t.id);this.activeCustomerStatus=n,this.activeCustomerStatusOptions=t,gc.onSuccess(t,n)}))}doCustomerStatus(e,t){let n=t.toString(),i=new yg(n,e);return new Promise(((e,t)=>{let n=new Qc({name:dc.CS_CUSTOMER_STATUS,params:i,permission:Jc.READ,singleTimeout:pc.commonQuerySingle,totalTimeout:pc.commonQueryTotal,fail:e=>{t(e)},success:t=>{let n=t.content;n.agent&&(n.agent.data=JSON.parse(n.agent.data)),e(n)}});Wc.Socket.e(n)}))}transfer(e,t){nu.validateId(t.customerId,"customerId"),nu.validateId(t.agentId,"agentId");let n=t.customerId.toString(),i=t.agentId.toString(),o=new Mg(n,e,i),s=new Qc({name:dc.CS_TRANSFER,params:o,permission:Jc.WRITE,singleTimeout:pc.commonRequestSingle,totalTimeout:pc.commonRequestTotal,fail:e=>{gc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);Vu.i.fire(Lu.CS_TRANSFER,n),gc.onSuccess(t)}});Wc.Socket.e(s)}}class Eg{createTextMessage(e,t){let n=vg.i().createTextMessage(t);this.extendProps(e,n)}createImageMessage(e,t){let n=vg.i().createImageMessage(t);this.extendProps(e,n)}createFileMessage(e,t){let n=vg.i().createFileMessage(t);this.extendProps(e,n)}createAudioMessage(e,t){let n=vg.i().createAudioMessage(t);this.extendProps(e,n)}createVideoMessage(e,t){let n=vg.i().createVideoMessage(t);this.extendProps(e,n)}createCustomMessage(e,t){let n=vg.i().createCustomMessage(t);this.extendProps(e,n)}extendProps(e,t){if(t.scene()===Qr.CS){let n=t;n.teamId=e,n.accepted=!0}}}class Tg{constructor(e){this.teamId=e,this.agentStatus=nh.getInstance(),this.conversationHandler=new Sg(e),this.messageCreator=new Eg}catch(e,t){return fc(this,void 0,void 0,(function*(){try{nu.validateCallbackOptions(t),yield e()}catch(n){gc.onFailed(t,n)}}))}isOnline(e){this.catch((()=>{this.agentStatus.isOnline(this.teamId,e)}),e)}online(e){this.catch((()=>{this.agentStatus.online(this.teamId,e)}),e)}offline(e){this.catch((()=>{this.agentStatus.offline(this.teamId,e)}),e)}customerStatus(e){this.catch((()=>{this.conversationHandler.queryCustomerStatus(this.teamId,e)}),e)}accept(e){this.catch((()=>{this.conversationHandler.accept(this.teamId,e)}),e)}end(e){this.catch((()=>{this.conversationHandler.end(this.teamId,e)}),e)}history(e){vg.i().history(e,this.teamId)}markMessageAsRead(e){vg.i().markMessageAsRead(e,this.teamId)}createTextMessage(e){this.messageCreator.createTextMessage(this.teamId,e)}createImageMessage(e){this.messageCreator.createImageMessage(this.teamId,e)}createFileMessage(e){this.messageCreator.createFileMessage(this.teamId,e)}createAudioMessage(e){this.messageCreator.createAudioMessage(this.teamId,e)}createVideoMessage(e){this.messageCreator.createVideoMessage(this.teamId,e)}createCustomMessage(e){this.messageCreator.createCustomMessage(this.teamId,e)}transfer(e){this.catch((()=>{this.conversationHandler.transfer(this.teamId,e)}),e)}agents(e){this.catch((()=>{this.agentStatus.agents(this.teamId,e)}),e)}liveSession(e){this.catch((()=>{ih.live(this.teamId,e)}),e)}quitLiveSession(e){this.catch((()=>{ih.quit(e)}),e)}listenCustomer(e){let t={customerId:e.id,onNewMessage:e.onNewMessage,onStatusUpdated:e.onStatusUpdated,onFailed:e.onFailed,onSuccess:e.onSuccess};this.catch((()=>{ih.live(this.teamId,t)}),e)}cancelListenCustomer(e){this.catch((()=>{ih.quit(e)}),e)}}class kg{static team(e){nu.validateId(e,"teamId");let t=this.teams.get(e);return t||(t=new Tg(e.toString()),this.teams.set(e.toString(),t)),t}}kg.teams=new Map;class Dg{constructor(e){this.id=e}isOnline(e){kg.team(this.id).isOnline(e)}online(e){kg.team(this.id).online(e)}offline(e){kg.team(this.id).offline(e)}customerStatus(e){kg.team(this.id).customerStatus(e)}accept(e){kg.team(this.id).accept(e)}end(e){kg.team(this.id).end(e)}history(e){kg.team(this.id).history(e)}markMessageAsRead(e){kg.team(this.id).markMessageAsRead(e)}createTextMessage(e){kg.team(this.id).createTextMessage(e)}createImageMessage(e){kg.team(this.id).createImageMessage(e)}createFileMessage(e){kg.team(this.id).createFileMessage(e)}createAudioMessage(e){kg.team(this.id).createAudioMessage(e)}createVideoMessage(e){kg.team(this.id).createVideoMessage(e)}createCustomMessage(e){kg.team(this.id).createCustomMessage(e)}transfer(e){kg.team(this.id).transfer(e)}agents(e){kg.team(this.id).agents(e)}liveSession(e){kg.team(this.id).liveSession(e)}quitLiveSession(e){kg.team(this.id).quitLiveSession(e)}listenCustomer(e){kg.team(this.id).listenCustomer(e)}cancelListenCustomer(e){kg.team(this.id).cancelListenCustomer(e)}}class Rg{static getInstance(e){return this.init(e),Rg}static init(e){if(this.getConnectionStatus()!==Wr.DISCONNECTED)throw new Error("Initialization failed. Please disconnect and try again.");this.validateOptions(e),Jr.init(e.reactNativeOptions),this.options=e,th.init(e),e.allowNotification&&eu.init(e.allowNotification),e.modules&&(e.modules.includes("PUBSUB")&&Bc.initModule(fu.init()),e.modules.includes("IM")&&Bc.initModule(fh.init())),mg.init(),Wc.init(th,eu,mg,Xr,sc,Bc)}static setBadge(e){eu.setBadge(e)}static connect(e){th.connect(e,"JS")}static disconnect(e){th.disconnect(e)}static getConnectionStatus(){return th.status()}static validateOptions(e){let t="";if(!nc.isObject(e))throw t="options is require an object.",Error(t);if(!nc.isPrimitive(e.appkey)||0==e.appkey.length)throw t="Invalid options:'appkey' is empty.",Error(t);if(!nc.isPrimitive(e.host)||0==e.host.length)throw t="Invalid options:'host' is empty.",Error(t);if(!nc.isArray(e.modules))throw t="Invalid options: 'modules' must be nonempty array",Error(t);if(!e.modules.includes("im")&&!e.modules.includes("pubsub"))throw t="Invalid options: 'modules' must include at least one of 'im' or 'pubsub'.",Error(t);e.modules=e.modules.map((e=>e.toUpperCase()))}static onClickNotification(e){eu.onClickNotification(e)}static c(e){e.init(Wc.Socket,Wc.N,Wc.Member,Wc.v,Wc.Platform,Bc)}}Rg.version=Xr,Rg.IM_EVENT=wu,Rg.IM_SCENE=Qr,Rg.im=class{static on(e,t){vg.i().on(e,t)}static off(e,t){vg.i().off(e,t)}static createTextMessage(e){return vg.i().createTextMessage(e)}static createImageMessage(e){return vg.i().createImageMessage(e)}static createFileMessage(e){return vg.i().createFileMessage(e)}static createAudioMessage(e){return vg.i().createAudioMessage(e)}static createVideoMessage(e){return vg.i().createVideoMessage(e)}static createCustomMessage(e){return vg.i().createCustomMessage(e)}static sendMessage(e){vg.i().sendMessage(e)}static recallMessage(e){vg.i().recallMessage(e)}static deleteMessage(e){vg.i().deleteMessage(e)}static markGroupMessageAsRead(e){vg.i().markGroupMessageAsRead(e)}static markPrivateMessageAsRead(e){vg.i().markPrivateMessageAsRead(e)}static latestConversations(e){vg.i().latestConversations(e)}static removePrivateConversation(e){vg.i().removePrivateConversation(e)}static removeGroupConversation(e){vg.i().removeGroupConversation(e)}static topPrivateConversation(e){vg.i().topPrivateConversation(e)}static topGroupConversation(e){vg.i().topGroupConversation(e)}static history(e){vg.i().history(e)}static subscribeUserPresence(e){vg.i().subscribeUserPresence(e)}static unsubscribeUserPresence(e){vg.i().unsubscribeUserPresence(e)}static hereNow(e){vg.i().hereNow(e)}static subscribeGroup(e){vg.i().subscribeGroup(e)}static unsubscribeGroup(e){vg.i().unsubscribeGroup(e)}static subscribeGroupPresence(e){vg.i().subscribeGroupPresence(e)}static unsubscribeGroupPresence(e){vg.i().unsubscribeGroupPresence(e)}static groupHereNow(e){vg.i().groupHereNow(e)}static groupOnlineCount(e){vg.i().groupOnlineCount(e)}static markMessageAsRead(e){vg.i().markMessageAsRead(e)}static csteam(e){return new Dg(e)}static pendingConversations(e){vg.i().latestPendingConversations(e)}static topConversation(e){vg.i().topConversation(e)}static removeConversation(e){vg.i().removeConversation(e)}},Rg.pubsub=class{static publish(e){this.catch((()=>{gu.instance.publish(e)}),e)}static subscribe(e){this.catch((()=>{gu.instance.subscribe(e)}),e)}static unsubscribe(e){this.catch((()=>{gu.instance.unsubscribe(e)}),e)}static subscribePresence(e){this.catch((()=>{gu.instance.subscribePresence(e)}),e)}static unsubscribePresence(e){this.catch((()=>{gu.instance.unsubscribePresence(e)}),e)}static history(e){this.catch((()=>{gu.instance.history(e)}),e)}static hereNow(e){this.catch((()=>{gu.instance.hereNow(e)}),e)}static catch(e,t){try{if(fu.check(),[Wr.DISCONNECTED,Wr.DISCONNECTING,Wr.CONNECT_FAILED].includes(Wc.Socket.status()))throw new Error("Please call connect() first.");e()}catch(n){gc.onFailed(t,n)}}};var Og="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function bg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ag={exports:{}};window,Ag.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},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="/Users/chrisftian/Documents/projects/cos-sdk/cos-wx-sdk-v5/dist",n(n.s=8)}([function(e,t,n){function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){c=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);nRa=e,Ma=Symbol();function Na(e){return e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)&&"function"!=typeof e.toJSON}var Da,Ba;(Ba=Da||(Da={})).direct="direct",Ba.patchObject="patch object",Ba.patchFunction="patch function";const La=()=>{};function ja(e,t,n,i=La){e.push(t);const o=()=>{const n=e.indexOf(t);n>-1&&(e.splice(n,1),i())};return!n&&Un()&&function(e){Dn&&Dn.cleanups.push(e)}(o),o}function Ua(e,...t){e.slice().forEach((e=>{e(...t)}))}const Fa=e=>e();function Ga(e,t){e instanceof Map&&t instanceof Map&&t.forEach(((t,n)=>e.set(n,t))),e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const i=t[n],o=e[n];Na(o)&&Na(i)&&e.hasOwnProperty(n)&&!no(i)&&!Vi(i)?e[n]=Ga(o,i):e[n]=i}return e}const qa=Symbol();const{assign:za}=Object;function Ha(e,t,n,i){const{state:o,actions:s,getters:r}=t,a=n.state.value[e];let c;return c=$a(e,(function(){a||(n.state.value[e]=o?o():{});const t=function(e){const t=p(e)?new Array(e.length):{};for(const n in e)t[n]=lo(e,n);return t}(n.state.value[e]);return za(t,s,Object.keys(r||{}).reduce(((t,i)=>(t[i]=Ji(Ys((()=>{Pa(n);const t=n._s.get(e);return r[i].call(t,t)}))),t)),{}))}),t,n,i,!0),c}function $a(e,t,n={},i,o,s){let r;const a=za({actions:{}},n),c={deep:!0};let l,u,p,d=[],h=[];const f=i.state.value[e];let m;function g(t){let n;l=u=!1,"function"==typeof t?(t(i.state.value[e]),n={type:Da.patchFunction,storeId:e,events:p}):(Ga(i.state.value[e],t),n={type:Da.patchObject,payload:t,storeId:e,events:p});const o=m=Symbol();wo().then((()=>{m===o&&(l=!0)})),u=!0,Ua(d,n,i.state.value[e])}s||f||(i.state.value[e]={}),io({});const v=s?function(){const{state:e}=n,t=e?e():{};this.$patch((e=>{za(e,t)}))}:La;function y(t,n){return function(){Pa(i);const o=Array.from(arguments),s=[],r=[];let a;Ua(h,{args:o,name:t,store:b,after:function(e){s.push(e)},onError:function(e){r.push(e)}});try{a=n.apply(this&&this.$id===e?this:b,o)}catch(c){throw Ua(r,c),c}return a instanceof Promise?a.then((e=>(Ua(s,e),e))).catch((e=>(Ua(r,e),Promise.reject(e)))):(Ua(s,a),a)}}const b=zi({_p:i,$id:e,$onAction:ja.bind(null,h),$patch:g,$reset:v,$subscribe(t,n={}){const o=ja(d,t,n.detached,(()=>s())),s=r.run((()=>Fo((()=>i.state.value[e]),(i=>{("sync"===n.flush?u:l)&&t({storeId:e,type:Da.direct,events:p},i)}),za({},c,n))));return o},$dispose:function(){r.stop(),d=[],h=[],i._s.delete(e)}});i._s.set(e,b);const x=(i._a&&i._a.runWithContext||Fa)((()=>i._e.run((()=>(r=jn()).run(t)))));for(const C in x){const t=x[C];if(no(t)&&(!no(k=t)||!k.effect)||Vi(t))s||(!f||Na(S=t)&&S.hasOwnProperty(qa)||(no(t)?t.value=f[C]:Ga(t,f[C])),i.state.value[e][C]=t);else if("function"==typeof t){const e=y(C,t);x[C]=e,a.actions[C]=t}}var S,k;return za(b,x),za(Xi(b),x),Object.defineProperty(b,"$state",{get:()=>i.state.value[e],set:e=>{g((t=>{za(t,e)}))}}),i._p.forEach((e=>{za(b,r.run((()=>e({store:b,app:i._a,pinia:i,options:a}))))})),f&&s&&n.hydrate&&n.hydrate(b.$state,f),l=!0,u=!0,b}var Va,Ka,Wa;(Wa=Va||(Va={})).UNIAPP="uniapp",Wa.REACT_NATIVE="rn",Wa.COCOS="cocos",Wa.UNKNOWN="unknown";class Xa{constructor(){this.framework=null,this.methods={[Va.UNIAPP]:this.isUniApp,[Va.REACT_NATIVE]:this.isReactNative,[Va.COCOS]:this.isCocos};const e=this.methods,t=Object.keys(e);for(const n of t)if((0,e[n])()){this.framework=n;break}this.framework=this.framework||Va.UNKNOWN,this.framework}static currentFramework(){return this.instance||(this.instance=new Xa),this.instance.framework}isUniApp(){try{return"function"==typeof Nn.getSystemInfoSync}catch(Wa){return!1}}isReactNative(){try{return"object"==typeof navigator&&"ReactNative"===navigator.product}catch(Wa){return!1}}isTaro(){try{return void 0!==process.env.TARO_ENV}catch(Wa){return!1}}isCocos(){try{return void 0!==cc.sys.localStorage}catch(Wa){return!1}}}class Ja{static init(e){Xa.currentFramework()===Va.REACT_NATIVE&&(this.validate(e),this.platform=e.platform,this.asyncStorage=e.asyncStorage)}static validate(e){if(!e)throw new Error("'reactNativeOptions' is missing when calling GoEasy.getInstance()");if(!e.platform)throw new Error("'platform' is missing in GoEasy 'reactNativeOptions'");if(!e.asyncStorage)throw new Error("'asyncStorage' is missing in GoEasy 'reactNativeOptions'")}}!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTING="connecting",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.RECONNECTED="reconnected",e.EXPIRED_RECONNECTED="reconnected",e.CONNECT_FAILED="connect_failed"}(Ka||(Ka={}));const Qa="2.13.17";var Ya,Za;!function(e){e.PRIVATE="private",e.GROUP="group",e.SYSTEM="system",e.CS="cs"}(Ya||(Ya={})),function(e){e.NEW="new",e.SENDING="sending",e.SUCCESS="success",e.FAIL="fail"}(Za||(Za={}));class ec{}class tc{constructor(e,t){this.id=e,this.data=t}}let nc=new class{isDef(e){return!this.isUndef(e)}isUndef(e){return null==e}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}isObject(e){return null!==e&&"object"==typeof e}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}isValidArrayIndex(e){let t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}isString(e){return"string"==typeof e}isNumber(e){return"number"==typeof e}isStringOrNumber(e){return this.isString(e)||this.isNumber(e)}isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}isEmpty(e){return this.isArray(e)?0===e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""===e.trim():!this.isDef(e))}isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}isFunction(e){return"function"==typeof e}isBoolean(e){return"boolean"==typeof e}isTrue(e){return!0===e}isFalse(e){return!1===e}isNull(e){return null===e}};var ic;!function(e){e.MP_WX="mp-wx",e.MP_WGAME="mp-wgame",e.MP_BYTE="mp-byte",e.MP_BAIDU="mp-baidu",e.MP_ALI="mp-ali",e.BROWSER="browser",e.NODE="node",e.UNI_IOS="uni-ios",e.UNI_ANDROID="uni-android",e.COCOS_IOS="cocos-ios",e.COCOS_ANDROID="cocos-android",e.RN_IOS="rn-ios",e.RN_ANDROID="rn-android",e.UNKNOWN="unknown"}(ic||(ic={}));class oc{constructor(){this.platform=null,this.methods={[ic.BROWSER]:this.isBrowser,[ic.MP_WX]:this.isMPWX,[ic.MP_WGAME]:this.isMPWeGame,[ic.MP_BYTE]:this.isMPByte,[ic.MP_BAIDU]:this.isMPBaidu,[ic.MP_ALI]:this.isMPAli,[ic.NODE]:this.isNode,[ic.UNI_IOS]:this.isUniAppIOS,[ic.UNI_ANDROID]:this.isUniAppAndroid,[ic.COCOS_IOS]:this.isCocosIOS,[ic.COCOS_ANDROID]:this.isCocosAndroid,[ic.RN_IOS]:this.isRNiOS,[ic.RN_ANDROID]:this.isRNAndroid};const e=this.methods,t=Object.keys(e);for(const n of t)if((0,e[n])()){this.platform=n;break}this.platform=this.platform||ic.UNKNOWN,this.platform}static currentPlatform(){return this.instance||(this.instance=new oc),oc.instance.platform}isBrowser(){return"undefined"!=typeof navigator&&"Taro"!==navigator.product&&"ReactNative"!==navigator.product&&"undefined"==typeof GameGlobal&&("undefined"==typeof cc||null!==cc.sys.browserType)&&"undefined"==typeof my&&"undefined"==typeof tt&&"undefined"==typeof swan}isMPWX(){return"object"==typeof Mn&&"function"==typeof Mn.getSystemInfoSync&&"undefined"==typeof WebSocket&&"undefined"==typeof XMLHttpRequest&&"undefined"==typeof plus&&"undefined"==typeof tt}isMPWeGame(){return"object"==typeof GameGlobal}isMPByte(){return"object"==typeof tt&&"function"==typeof tt.getSystemInfoSync}isMPBaidu(){return"object"==typeof swan&&"function"==typeof swan.getSystemInfoSync}isMPAli(){return"object"==typeof my&&"function"==typeof my.getSystemInfoSync}isNode(){try{return"node"===process.release.name}catch(Wa){return!1}}isUniAppIOS(){try{return"ios"===Nn.getSystemInfoSync().platform&&"app"===Nn.getSystemInfoSync().uniPlatform}catch(Wa){return!1}}isUniAppAndroid(){try{return"android"===Nn.getSystemInfoSync().platform&&"app"===Nn.getSystemInfoSync().uniPlatform}catch(Wa){return!1}}isCocosIOS(){try{return"iOS"===cc.sys.os}catch(Wa){return!1}}isCocosAndroid(){try{return"Android"===cc.sys.os}catch(Wa){return!1}}isRNiOS(){try{return"ios"===Ja.platform.OS}catch(Wa){return!1}}isRNAndroid(){try{return"android"===Ja.platform.OS}catch(Wa){return!1}}}class sc{}sc.type=ic,sc.current=oc.currentPlatform();class rc{onFrontend(e){this.onFrontendCallback=e}}class ac extends rc{constructor(){super(...arguments),this.runningBackend=!1}startCheck(){"object"==typeof plus&&(plus.globalEvent.addEventListener("resume",(()=>{this.runningBackend=!1,this.runningBackend,this.onFrontendCallback&&this.onFrontendCallback()}),!1),plus.globalEvent.addEventListener("pause",(()=>{this.runningBackend=!0,this.runningBackend}),!1))}isBackend(){return this.runningBackend}support(){const e=oc.currentPlatform();return[ic.UNI_IOS,ic.UNI_ANDROID].includes(e)}}class lc extends rc{constructor(){super(...arguments),this.runningBackend=!1}startCheck(){Mn.onAppShow((()=>{this.runningBackend=!1})),Mn.onAppHide((()=>{this.runningBackend=!0}))}isBackend(){return this.runningBackend}support(){return oc.currentPlatform()===ic.MP_WX}}const uc=new class{constructor(){[new ac,new lc].forEach((e=>{if(e.support())return this.checker=e,void this.checker.startCheck()}))}isBackend(){return this.checker&&this.checker.isBackend()}onFrontend(e){this.checker.onFrontend(e)}};var pc,dc,hc=Object.freeze({__proto__:null,runStatus:uc});!function(e){e.authorize="authorize",e.manualDisconnect="manualDisconnect",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.publish="publish",e.ack="ack",e.historyMessages="historyMessages",e.hereNow="hereNow",e.hereNowByUserIds="hereNowByUserIds",e.PUBSUB_PRESENCE_SUBSCRIBE="PUBSUB_PRESENCE_SUBSCRIBE",e.PUBSUB_PRESENCE_UNSUBSCRIBE="PUBSUB_PRESENCE_UNSUBSCRIBE",e.PUBSUB_PRESENCE_HERENOW="PUBSUB_PRESENCE_HERENOW",e.imLastConversations="imLastConversations",e.markPrivateMessageAsRead="markPrivateMessageAsRead",e.markGroupMessageAsRead="markGroupMessageAsRead",e.imGroupOnlineCount="imGroupOnlineCount",e.imHereNow="imHereNow",e.imGroupHereNow="imGroupHereNow",e.publishIM="publishIM",e.subscribeUserPresence="subscribeUserPresence",e.unsubscribeUserPresence="unsubscribeUserPresence",e.subscribeGroupPresence="subscribeGroupPresence",e.unsubscribeGroupPresence="unsubscribeGroupPresence",e.removeConversation="removeConversation",e.topConversation="topConversation",e.imData="imData",e.subscribeGroups="subscribeGroups",e.unsubscribeGroup="unsubscribeGroup",e.IM_DELETE_MESSAGE="IM_DELETE_MESSAGE",e.IM_HISTORY="IM_HISTORY",e.IM_HISTORY_CHANGE="IM_HISTORY_CHANGE",e.IM_RECALL_MESSAGE="IM_RECALL_MESSAGE",e.IM_MARK_AS_READ="IM_MARK_AS_READ",e.CS_PENDING_CONVERSATION="CS_PENDING_CONVERSATION",e.CS_ACCEPT="CS_ACCEPT",e.CS_END="CS_END",e.CS_TRANSFER="CS_TRANSFER",e.CS_AGENTS="CS_AGENTS",e.CS_CUSTOMER_STATUS="CS_CUSTOMER_STATUS",e.CS_MY_TEAMS="CS_MY_TEAMS",e.CS_ONLINE="CS_ONLINE",e.CS_OFFLINE="CS_OFFLINE",e.CS_LIVE_SESSION="CS_LIVE_SESSION",e.CS_QUIT_LIVE="CS_QUIT_LIVE",e.SET_IOS_BADGE="SET_IOS_BADGE",e.MD_CMD="MD_CMD"}(pc||(pc={})),function(e){e[e.connect=3e3]="connect",e[e.reconnectionDelayMax=3e3]="reconnectionDelayMax",e[e.commonQuerySingle=2500]="commonQuerySingle",e[e.commonQueryTotal=12e3]="commonQueryTotal",e[e.commonRequestSingle=1700]="commonRequestSingle",e[e.commonRequestTotal=12e3]="commonRequestTotal",e[e.commonInfiniteSingle=1700]="commonInfiniteSingle",e[e.commonInfiniteTotal=864e5]="commonInfiniteTotal"}(dc||(dc={}));class fc{static onSuccess(e,t){nc.isFunction(e.onSuccess)&&e.onSuccess(t)}static onFailed(e,t){if(!nc.isObject(e)||!nc.isFunction(e.onFailed))throw t;e.onFailed(t)}}function mc(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{c(i.next(e))}catch(t){s(t)}}function a(e){try{c(i.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var gc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function vc(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})})),t}var yc={exports:{}};!function(){function e(t){if(t)return function(t){for(var n in e.prototype)t[n]=e.prototype[n];return t}(t)}yc.exports=e,e.prototype.on=e.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},e.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o>>((3&t)<<3)&255;return Cc}}for(var wc=[],Ec=0;Ec<256;++Ec)wc[Ec]=(Ec+256).toString(16).substr(1);var Tc,Ic,_c=function(e,t){var n=t||0,i=wc;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")},Oc=xc.exports,Ac=_c,Rc=0,Pc=0,Mc=xc.exports,Nc=_c,Dc=function(e,t,n){var i=t&&n||0,o=t||[],s=(e=e||{}).node||Tc,r=void 0!==e.clockseq?e.clockseq:Ic;if(null==s||null==r){var a=Oc();null==s&&(s=Tc=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==r&&(r=Ic=16383&(a[6]<<8|a[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),l=void 0!==e.nsecs?e.nsecs:Pc+1,u=c-Rc+(l-Pc)/1e4;if(u<0&&void 0===e.clockseq&&(r=r+1&16383),(u<0||c>Rc)&&void 0===e.nsecs&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Rc=c,Pc=l,Ic=r;var p=(1e4*(268435455&(c+=122192928e5))+l)%4294967296;o[i++]=p>>>24&255,o[i++]=p>>>16&255,o[i++]=p>>>8&255,o[i++]=255&p;var d=c/4294967296*1e4&268435455;o[i++]=d>>>8&255,o[i++]=255&d,o[i++]=d>>>24&15|16,o[i++]=d>>>16&255,o[i++]=r>>>8|128,o[i++]=255&r;for(var h=0;h<6;++h)o[i+h]=s[h];return t||Ac(o)},Bc=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||Mc)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[i+s]=o[s];return t||Nc(o)},Lc=Bc;Lc.v1=Dc,Lc.v4=Bc;var jc=Lc;class Uc{support(){return!0}getParams(){return this.params}setData(e){this.active=e.a,this.data=e.d}preConnect(e){}postConnect(){}}class Fc{static initModule(e){e.support()&&this.modules.set(e.name,e)}static getParams(){return mc(this,void 0,void 0,(function*(){let e={};for(const[t,n]of this.modules)e[t]=(yield n.getParams())||null;return e}))}static setDatas(e){Object.keys(e).forEach((t=>{this.modules.get(t).setData(e[t])}))}static preConnect(e){this.modules.forEach(((t,n)=>{t.preConnect(e)}))}static postConnect(){this.modules.forEach(((e,t)=>{e.postConnect()}))}}Fc.Module=Uc,Fc.modules=new Map;const Gc=bc;class qc{constructor(){this.emitter=new Gc}on(e,t){return this.emitter.on(e,t),this}once(e,t){return this.emitter.once(e,t),this}off(e,t){return this.emitter.off(e,t),this}fire(e,t){return this.emitter.emit(e,t),this}}class zc{constructor(){this.eventDriver=new qc}on(e,t){this.eventDriver.on(e,t)}off(e,t){this.eventDriver.off(e,t)}fire(e,t){this.eventDriver.fire(e,t)}}let Hc=new class{isDef(e){return!this.isUndef(e)}isUndef(e){return null==e}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}isObject(e){return null!==e&&"object"==typeof e}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}isValidArrayIndex(e){let t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}isString(e){return"string"==typeof e}isNumber(e){return"number"==typeof e}isStringOrNumber(e){return this.isString(e)||this.isNumber(e)}isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}isEmpty(e){return this.isArray(e)?0===e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""===e.trim():!this.isDef(e))}isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}isFunction(e){return"function"==typeof e}isBoolean(e){return"boolean"==typeof e}isTrue(e){return!0===e}isFalse(e){return!1===e}isNull(e){return null===e}};const $c=bc;class Vc{constructor(){this.emitter=new $c}on(e,t){if(!Hc.isString(e))throw Error("event require a string.");if(!Hc.isFunction(t))throw Error("callback must be a function");this.emitter.on(e,t)}fire(e,t){this.emitter.emit(e,t)}off(e,t){this.emitter.off(e,t)}}class Kc{static init(e,t,n,i,o,s){this.Socket=e,this.N=t,this.Member=n,this.v=i,this.Platform=o,this.GModules=s}}const Wc=jc;class Xc{static get(){return Wc.v1().replace(/-/g,"")}}var Jc,Qc;(Qc=Jc||(Jc={})).WRITE="WRITE",Qc.READ="READ",Qc.NONE="NONE";class Yc{constructor(e){this.permission=Jc.NONE,this.singleTimeout=0,this.totalTimeout=0,this.startTime=0,this.complete=!1,this.retried=0,this.unique=!1,this.uuid=Xc.get(),this.name=e.name,this.params=e.params,this.permission=e.permission,this.totalTimeout=e.totalTimeout,this.singleTimeout=e.singleTimeout,e.unique&&(this.unique=e.unique),this.success=t=>{this.complete||(this.end(),e.success(t))},this.fail=t=>{this.complete||(this.end(),e.fail(t))}}start(){this.startTime=Date.now(),this.initAutoTimeout()}end(){this.complete=!0,clearTimeout(this.timeoutHandler)}initAutoTimeout(){this.timeoutHandler=setTimeout((()=>{this.complete||this.fail({resultCode:408,content:"Host unreachable or timeout"})}),this.totalTimeout)}}class Zc extends Uc{static init(){return this.module=new Zc,this.module.name=this.GN_MODULE_NAME,this.module}static setRegId(e,t){if(e){this.module.regIdPromise=e;let n=t;this.module.params={v:{npv:n}}}}preConnect(e){this.wxmpId=e.wxmpId}getParams(){return mc(this,void 0,void 0,(function*(){if(this.params=this.params||{},this.regIdPromise)try{const e=new Promise(((e,t)=>{setTimeout((()=>t("timeout")),1e3)}));this.params.regId=yield Promise.race([this.regIdPromise,e])}catch(Wa){console.warn("Failed to register the Manufacturers Push service:"+JSON.stringify(Wa))}return this.params.wxmpId=this.wxmpId,this.params}))}}Zc.GN_MODULE_NAME="GN";class el{static init(e){this.allowNotification=!0===e;let t=Zc.init();Fc.initModule(t),this.supportAppNotification()&&(this.uniappPlugin=Nn.requireNativePlugin("GoEasy-Uniapp"),this.uniappPlugin?(this.regIdPromise=this.askRegId(),this.v=this.uniappPlugin.v(),Zc.setRegId(this.regIdPromise,this.v)):console.warn("No GoEasy-Uniapp Native Plugin."),this.setClientBadge(0))}static addAssembler(e){this.payloadAssemblers.push(e)}static assemblePayload(e){let t=this.payloadAssemblers.find((t=>t.support(e)));return t?t.assemble(e):e}static createLocalNotification(e,t,n,i,o){uc.isBackend()&&(n.g=1,"undefined"!=typeof plus&&(i?(this.uniappPlugin&&this.uniappPlugin.playSound(i),plus.push.createMessage(t,JSON.stringify(n),{title:e,sound:"none"})):plus.push.createMessage(t,JSON.stringify(n),{title:e}),"+1"===o&&this.setClientBadge(el.badge+1)))}static setBadge(e){if(!Number.isInteger(e.badge)||e.badge<0)fc.onFailed(e,"badge must be an integer greater than or equal to 0.");else if(el.supportAppNotification())if(this.uniappPlugin&&oc.currentPlatform()===ic.UNI_IOS){let t=new Yc({name:pc.SET_IOS_BADGE,params:{badge:e.badge},unique:!0,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,permission:Jc.WRITE,success:()=>{fc.onSuccess(e),this.setClientBadge(e.badge)},fail:t=>{fc.onFailed(e,t.content)}});Kc.Socket.e(t)}else fc.onSuccess(e),this.setClientBadge(e.badge)}static setClientBadge(e){"vivo"!==plus.device.vendor&&(el.badge=e,plus.runtime.setBadgeNumber(e))}static askRegId(){let e=null,t=0;const n=()=>new Promise(((i,o)=>{this.uniappPlugin.regId((e=>{i(e)}),(i=>{if(!(1e6===i.data.code&&t<=10))return clearTimeout(e),o(i);e=setTimeout((()=>{t++,this.regIdPromise=n()}),3500)}))}));return n()}static getRegIdPromise(){return this.regIdPromise}static supportAppNotification(){const e=oc.currentPlatform();return this.allowNotification&&(e===ic.UNI_ANDROID||e===ic.UNI_IOS)}static listenPlusClickNotification(){plus.push.addEventListener("click",(e=>{try{if(e){const t="string"==typeof e.payload?JSON.parse(e.payload):e.payload;if(this.availableIntent(t)){let e=this.assemblePayload(t);plus.push.clear(),this.onClickNotificationCallback(e)}}}catch(t){}}))}static availableIntent(e){return e&&Object.keys(e).length&&e.g&&1===parseInt(e.g)}static getIntentData(){this.uniappPlugin.getIntentData((e=>{if(!this.availableIntent(e))return;let t=this.assemblePayload(e);const n=oc.currentPlatform();plus.push.clear(),n===ic.UNI_ANDROID&&this.uniappPlugin.clearAll(),this.onClickNotificationCallback(t)}))}static listenClick(){this.listenPlusClickNotification();const e=oc.currentPlatform();this.uniappPlugin&&e===ic.UNI_ANDROID&&(this.getIntentData(),uc.onFrontend((()=>{this.getIntentData()})))}static onClickNotification(e){if(el.supportAppNotification()){if(!nc.isFunction(e))throw new Error("The arguments must be a function.");null===this.onClickNotificationCallback?(this.onClickNotificationCallback=e,this.listenClick()):console.warn("The onClickNotification event has been listened on. Please do not listen to it more than once.")}else console.warn("The current environment doesn't support or allowNotification is false.")}}function tl(...e){}el.uniappPlugin=null,el.v=null,el.regIdPromise=null,el.onClickNotificationCallback=null,el.payloadAssemblers=new Array;const nl=new class{validateId(e,t){if(nc.isEmpty(e))throw{code:400,content:` ${t} is required.`};if(!nc.isString(e))throw{code:400,content:`TypeError: ${t} require string.`}}validateIdArray(e,t){if(!Array.isArray(e)||0===e.length)throw{code:400,content:`TypeError: ${t} require array.`};if(e.length>100)throw{code:400,content:`${t} is over max length 100.`};for(let n=0;n1e4)throw{code:400,content:"Message over max length 10000."};if(e.qos&&!(e.qos in[0,1]))throw{code:400,content:"Qos must be 0 or 1."};e.wxmpTemplateMsg&&nl.validateWXMPTemplateMsg(e.wxmpTemplateMsg),nc.isDef(e.notification)&&nl.validateNotification(e.notification)}}class sl{constructor(e){if(this.options=e,this.channels=e.channels||[e.channel],!nc.isEmpty(e.channel)){let t=e.channel.toString();this.channels=[t]}nc.isEmpty(e.channels)||(this.channels=e.channels.toString().split(","))}}var rl,al,cl;!function(e){e.message="message",e.imMessage="imMessage",e.userPresence="userPresence",e.groupPresence="groupPresence",e.PS_PRESENCE_EVENT="PS_PRESENCE_EVENT",e.IM_MSG_READ="IM_MSG_READ",e.IM_MSG_DELETED="IM_MSG_DELETED",e.IM_MSG_RECALLED="IM_MSG_RECALLED",e.CS_ONLINE_CHANGED="CS_ONLINE_CHANGED"}(rl||(rl={})),function(e){e.CONNECTED="CONNECTED",e.RECONNECTED="RECONNECTED",e.DISCONNECTED="DISCONNECTED",e.LOST="LOST",e.EXPIRED_RECONNECTED="EXPIRED_RECONNECTED",e.NEW_MESSAGE="NEW_MESSAGE",e.CONNECTING="CONNECTING"}(al||(al={}));class ll{constructor(){this.subscriptions=[],Kc.Socket.onMessage(rl.message,this.onNewMessage.bind(this)),Kc.Socket.on(al.EXPIRED_RECONNECTED,this.expiredResubscribe.bind(this)),Kc.Socket.on(al.RECONNECTED,this.resubscribePresenceChannel.bind(this))}expiredResubscribe(){this.subscriptions.forEach((e=>{this.doSubscribe(e,!1)}))}resubscribePresenceChannel(){this.subscriptions.forEach((e=>{let t=e.options;t.presence&&t.presence.enable&&this.doSubscribe(e,!0)}))}onNewMessage(e){if(e.n.indexOf("_presence")>-1)return;e.a&&Kc.Socket.sendAck("ack",{i:e.i,c:e.n});let t={time:e.t,channel:e.n,content:e.c};this.createNotification(e),this.findSubscriptionByChannel(t.channel).options.onMessage(t)}createNotification(e){const t=Kc.N.supportAppNotification();if(!nc.isObject(e.nt)||!t)return;const n={ch:e.n,ctt:e.c};Kc.N.createLocalNotification(e.nt.t,e.nt.c,n,e.nt.sound,e.nt.badge)}subscribe(e){if(nl.validateChannelAndChannels(e.channel,e.channels),nc.isDef(e.presence)){let t=e.presence.enable;if(!nc.isBoolean(t))throw{code:400,content:"Subscription failed. presence.enable must be a boolean"};if(t&&!Kc.Socket.user().id)throw{code:400,content:"Subscription failed. If presence is enable, the id must be specified when calling the connect method"}}let t=new sl(e);this.doSubscribe(t,!1).then((()=>{this.subscriptions.push(t),fc.onSuccess(e,{code:200,content:"ok"})})).catch((t=>{fc.onFailed(e,{code:t.resultCode,content:t.content})}))}doSubscribe(e,t){let n=e.options;return new Promise(((i,o)=>{let s=new Yc({name:pc.subscribe,permission:Jc.READ,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,params:{channels:e.channels,accessToken:n.accessToken,presence:n.presence,resubscribe:t},success:()=>{i()},fail:e=>{o(e)}});Kc.Socket.e(s)}))}unsubscribe(e){nl.validateChannel(e.channel,"channel"),e.channel=e.channel.toString();const t=this.findSubscriptionByChannel(e.channel);if(!t)return void e.onFailed({code:400,content:"channel["+e.channel+"] is not subscribed"});let n=new Yc({name:pc.unsubscribe,params:{channel:e.channel,presence:t.options.presence},permission:Jc.READ,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,success:()=>{e.onSuccess({code:200,content:"ok"}),this.removeChannel(e.channel)},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});Kc.Socket.e(n)}removeChannel(e){for(let t=this.subscriptions.length-1;t>=0;t--){const n=this.subscriptions[t].channels,i=n.indexOf(e);if(i>-1){n.splice(i,1),0===n.length&&this.subscriptions.splice(t,1);break}}}findSubscriptionByChannel(e){let t=!1,n=null;for(let i=this.subscriptions.length-1;i>=0;i--){let o=this.subscriptions[i].channels;for(let s=0;s{e.onSuccess({code:t.resultCode||t.code||200,content:t.content})},fail:t=>{e.onFailed({code:t.resultCode||t.code,content:t.content})}});Kc.Socket.e(t)}}class pl{constructor(){this.channelPresenceMap=new Map,this.onPresenceEvent=e=>{let t=this.channelPresenceMap.get(e.channel);null==t||t.onPresence(e)},this.expireAllChannelPresences=()=>{this.channelPresenceMap.forEach(((e,t)=>{e.expire()}))},this.resubscribe=()=>{this.channelPresenceMap.forEach(((e,t)=>{e.subscribed()&&e.doSubscribe()}))},Kc.Socket.on(al.LOST,this.expireAllChannelPresences),Kc.Socket.on(al.RECONNECTED,this.resubscribe),Kc.Socket.onMessage(rl.PS_PRESENCE_EVENT,this.onPresenceEvent)}hereNow(e){nl.validateChannel(e.channel,"channel");let t,n=this.channelPresenceMap.get(e.channel.toString());n&&n.queryPromise?(e.limit&&e.limit>n.membersLimit&&n.doQuery(e.limit),t=n.queryPromise):t=hl(e.channel,e.limit),t.then((t=>{e.onSuccess(t)})).catch((t=>{e.onFailed(t)}))}subscribe(e){if(nl.validateChannel(e.channel,"channel"),nc.isUndef(e.onPresence)||!nc.isFunction(e.onPresence))throw{code:400,content:"Subscription Presence failed. onPresence callback function is required"};let t=e.channel.toString(),n=this.channelPresenceMap.get(t);n||(n=new dl(t),this.channelPresenceMap.set(t,n)),n.subscribe(e)}unsubscribe(e){nl.validateChannel(e.channel,"channel");let t=e.channel.toString();if(this.channelPresenceMap.get(t)){let n=new Yc({name:pc.PUBSUB_PRESENCE_UNSUBSCRIBE,permission:Jc.READ,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,params:{channel:t},success:n=>{this.channelPresenceMap.delete(t),e.onSuccess()},fail:t=>{e.onFailed(t)}});Kc.Socket.e(n)}else e.onSuccess()}}class dl{constructor(e){this.membersLimit=10,this.queried=!1,this.channel=e}onPresence(e){return mc(this,void 0,void 0,(function*(){this.queried?this.update(e):yield this.queryPromise,this.on({channel:this.channel,action:e.action,member:e.member,time:e.time,amount:this.amount,members:this.membersByLimit()})}))}membersByLimit(){return this.members.slice(0,this.membersLimit)}subscribe(e){return mc(this,void 0,void 0,(function*(){if(e.membersLimit&&(this.membersLimit=Math.min(e.membersLimit,300)),!this.subscribed())try{yield this.doSubscribe()}catch(t){return void e.onFailed(t)}this.on=e.onPresence,e.onSuccess()}))}doSubscribe(){return this.doQuery(this.membersLimit),new Promise(((e,t)=>{let n=new Yc({name:pc.PUBSUB_PRESENCE_SUBSCRIBE,permission:Jc.READ,params:{channel:this.channel},singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,success:t=>{e()},fail:e=>{t(e)}});Kc.Socket.e(n)}))}doQuery(e){this.queryPromise=hl(this.channel,e),this.queryPromise.then((e=>{this.members=e.content.members,this.amount=e.content.amount,this.queried=!0})).catch((e=>{throw e}))}update(e){if(["join","back"].includes(e.action))this.members.unshift(e.member);else if(["leave","timeout"].includes(e.action)){let t=this.members.findIndex((t=>t.id===e.member.id));t>-1&&this.members.splice(t,1)}this.amount=e.amount}expire(){this.queried=!1,this.queryPromise=null}subscribed(){return void 0!==this.on}}function hl(e,t){return t||(t=10),new Promise(((n,i)=>{let o={channel:e,limit:t},s=new Yc({name:pc.PUBSUB_PRESENCE_HERENOW,permission:Jc.READ,params:o,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,success:e=>{n(e)},fail:e=>{i(e)}});Kc.Socket.e(s)}))}class fl{constructor(){this.publisher=new ol,this.subscriber=new ll,this.presence2=new pl,this.histories=new ul}static init(){this.instance=new fl}publish(e){this.publisher.publish(e)}subscribe(e){this.subscriber.subscribe(e)}unsubscribe(e){this.subscriber.unsubscribe(e)}subscribePresence(e){this.presence2.subscribe(e)}unsubscribePresence(e){this.presence2.unsubscribe(e)}history(e){this.histories.get(e)}hereNow(e){this.presence2.hereNow(e)}}class ml extends Uc{static init(){return this.module=new ml,this.module.name=this.GWS_MODULE_NAME,this.initGN(),this.module}static initGN(){el.addAssembler(new class{assemble(e){return{channel:e.ch,content:e.ctt}}support(e){return!!e.ch}})}postConnect(){fl.init()}static check(){if(!this.module)throw{code:400,content:"PubSub not initialized. Please include 'PUBSUB' in the 'modules' during GoEasy initialization."}}}ml.GWS_MODULE_NAME="GWS";class gl{constructor(){}}!function(e){e.aliYun="ALI",e.qiNiu="QN",e.tencent="TX",e.s3="S3"}(cl||(cl={}));let vl=new class extends gl{constructor(){super()}upload(e,t){try{return e.storageLocation===cl.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{Nn.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.tempFilePath||t.fullPath||t.path}uploadToS3(e,t){return new Promise(((t,n)=>mc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(e);Nn.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cl.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{const i=this.getTempFilePath(e);if("undefined"!=typeof plus)plus.io.resolveLocalFileSystemURL(i,(e=>{e.file((e=>{let i=new plus.io.FileReader;i.onloadend=e=>{const n=Nn.base64ToArrayBuffer(e.target.result.split(",")[1]);t(n)},i.onerror=function(e){n(e)},i.readAsDataURL(e)}))}),(e=>{n("Resolve file URL failed: "+e.message)}));else if("undefined"!=typeof FileReader){const i=new FileReader;i.onload=()=>{t(i.result)},i.onerror=e=>{n(e)},i.readAsArrayBuffer(e.file)}else if("object"==typeof Mn&&Mn.canIUse("getFileSystemManager"))try{const e=Mn.getFileSystemManager().readFileSync(i);t(e)}catch(o){n(o)}}))}};const yl=new class extends gl{upload(e,t){try{return e.storageLocation===cl.s3?this.uploadToS3(e,t):new Promise(((n,i)=>{Mn.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))}))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file||e.fileRes;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>mc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));Mn.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cl.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{try{t(Mn.getFileSystemManager().readFileSync(e))}catch(i){n(i)}}))}},bl=new class extends gl{constructor(){super()}upload(e,t){return new Promise(((n,i)=>{try{const o=new XMLHttpRequest,s=e.storageLocation===cl.s3,r=s?"PUT":"POST",a=s?e.url:e.host;o.open(r,a,!0);for(let t in e.headers)o.setRequestHeader(t,e.headers[t]);o.upload.onprogress=function(e){t&&t(e)},o.upload.onloadstart=function(e){t&&t(e)},o.upload.onloadend=function(e){t&&t(e)};let c=new FormData;for(let t in e.parameters)"fileRes"==t?c.append("file",e.parameters[t]):c.append(t,e.parameters[t]);const l=s?e.file:c;o.send(l),o.onreadystatechange=function(){4==o.readyState&&(o.status>=200&&o.status<300||304==o.status?(s&&(e.url=e.url.split("?")[0]),n()):i({code:o.status,content:o.responseText}))}}catch(o){i({code:500,content:o})}}))}fileToArrayBuffer(e){return new Promise(((t,n)=>{const i=new FileReader;i.onload=()=>{t(i.result)},i.onerror=e=>{n(e)},i.readAsArrayBuffer(e)}))}},xl=new class extends gl{upload(e,t){try{return e.storageLocation===cl.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{my.uploadFile({url:e.host,filePath:this.getTempFilePath(e),fileType:"image",name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>mc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));my.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cl.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{my.getFileSystemManager().readFile({filePath:e,success:e=>{t(e.data)},fail(e){n(e)}})}))}},Sl=new class extends gl{upload(e,t){try{return e.storageLocation===cl.s3?this.uploadToS3(e,t):(delete e.parameters.fileRes,new Promise(((n,i)=>{swan.uploadFile({url:e.host,filePath:this.getTempFilePath(e),name:"file",formData:e.parameters,success(e){200===e.statusCode?n():i({code:e.statusCode,content:e.errMsg})},fail(e){i({code:500,content:e.errMsg})}}).onProgressUpdate((e=>{t&&t(e)}))})))}catch(n){return new Promise(((e,t)=>{t({code:500,content:n})}))}}getTempFilePath(e){let t=e.file;return t.path||t.tempFilePath}uploadToS3(e,t){return new Promise(((t,n)=>mc(this,void 0,void 0,(function*(){const i=yield this.fileToArrayBuffer(this.getTempFilePath(e));swan.request({url:e.url,method:"PUT",header:e.headers,data:i,success(i){200===i.statusCode?(e.storageLocation===cl.s3&&(e.url=e.url.split("?")[0]),t()):n({code:i.statusCode,content:i.errMsg})},fail(e){n({code:500,content:e.errMsg})}})}))))}fileToArrayBuffer(e){return new Promise(((t,n)=>{swan.getFileSystemManager().readFile({filePath:e,success:e=>{t(e.data)},fail:e=>{n(e)}})}))}};class kl{constructor(e,t,n){this.storageLocation=e,this.url=t,this.name=n}}const Cl=new class{constructor(){this.uploader={[Va.UNIAPP]:vl,[ic.MP_WX]:yl,[ic.BROWSER]:bl,[ic.MP_ALI]:xl,[ic.MP_BAIDU]:Sl,[Va.REACT_NATIVE]:bl,[ic.MP_BYTE]:yl}}upload(e,t){return mc(this,void 0,void 0,(function*(){const n=Xa.currentFramework(),i=oc.currentPlatform(),o=n===Va.UNKNOWN?i:n;let s=this.uploader[o];return yield s.upload(e,t),new kl(e.storageLocation,e.url,e.newFileName)}))}};class wl{resolve(e){return new Promise(((t,n)=>{let i=new Yc({name:"uploadToken",params:{filename:e},permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail(e){n(e.content)},success(e){200===e.code?t(e.content):n(e.content)}});Kc.Socket.e(i)}))}}class El{constructor(e,t,n,i,o,s,r){this.storageLocation=e,this.host=t,this.headers=n,this.parameters=i,this.file=o,this.newFileName=s,this.url=r}}class Tl{constructor(){}newFileName(e){return e&&e.newFilename||""}}let Il=new class extends Tl{constructor(){super()}url(e){return e.host+"/"+e.dir+"/"+this.newFileName(e)}build(e,t,n){let i,o=this.newFileName(e);return i={key:e.dir+"/"+o,OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200",fileRes:t},n&&(i={key:e.dir+"/"+o,OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200","Content-Disposition":"attachment;filename="+t.name,fileRes:t}),new El(cl.aliYun,e.host,null,i,t,o,this.url(e))}},_l=new class extends Tl{constructor(){super()}url(e){return e.host+"/"+e.key}build(e,t,n){let i={"q-sign-algorithm":e.qSignAlgorithm,"q-ak":e.qAk,"q-key-time":e.qKeyTime,"q-signature":e.qSignature,policy:e.policy,"x-cos-security-token":e.xCosSecurityToken,success_action_status:"200",key:e.key,fileRes:t};return n&&(i={"q-sign-algorithm":e.qSignAlgorithm,"q-ak":e.qAk,"q-key-time":e.qKeyTime,"q-signature":e.qSignature,policy:e.policy,"x-cos-security-token":e.xCosSecurityToken,success_action_status:"200",key:e.key,"Content-Disposition":`attachment;filename=${t.name}`,fileRes:t}),new El(cl.tencent,e.host,null,i,t,e.key,this.url(e))}},Ol=new class extends Tl{constructor(){super()}url(e){return e.uploadUrl}build(e,t,n){const i={file:t};return new El(cl.s3,null,{"Content-Type":"application/octet-stream"},i,t,t.name,this.url(e))}};class Al{constructor(){this.uploadTokenResolver=new wl}builder(e){if(e===cl.aliYun)return Il;if(e===cl.tencent)return _l;if(e===cl.s3)return Ol;throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e)}build(e,t,n){return mc(this,void 0,void 0,(function*(){try{let i=yield this.uploadTokenResolver.resolve(t),o=this.builder(i.vendor).build(i,e,n);return Promise.resolve(o)}catch(i){return Promise.reject(i)}}))}}class Rl{constructor(){this.requestBuilder=new Al,this.fileUploader=Cl}upload(e,t,n,i){return mc(this,void 0,void 0,(function*(){try{let o=yield this.requestBuilder.build(e,t,i);return this.fileUploader.upload(o,n)}catch(o){return Promise.reject(o)}}))}}var Pl,Ml,Nl,Dl;!function(e){e.MESSAGE_SENDING="IM_INTERNAL_MESSAGE_SENDING",e.MESSAGE_SEND_SUCCESS="IM_INTERNAL_MESSAGE_SEND_SUCCESS",e.MESSAGE_SEND_FAILED="IM_INTERNAL_MESSAGE_SEND_FAILED",e.MESSAGE_RECEIVED="IM_INTERNAL_MESSAGE_RECEIVED",e.MESSAGE_RECALLED="IM_INTERNAL_MESSAGE_RECALLED",e.MAX_MESSAGE_CHANGED="IM_INTERNAL_MAX_MESSAGE_CHANGED",e.MAX_MESSAGE_DELETED="IM_INTERNAL_MAX_MESSAGE_DELETED",e.UNREAD_AMOUNT_CHANGED="IM_INTERNAL_UNREAD_MESSAGE_CHANGED",e.CS_ONLINE_SUCCESS="CS_ONLINE_SUCCESS",e.CS_OFFLINE_SUCCESS="CS_OFFLINE_SUCCESS",e.CS_ACCEPTED="CS_ACCEPTED",e.CS_ENDED="CS_ENDED",e.CS_TRANSFER="CS_TRANSFER",e.CS_AGENT_MESSAGE_RECEIVED="CS_AGENT_MESSAGE_RECEIVED"}(Pl||(Pl={}));class Bl{clearUseLessAttribute(){delete this.buildOptions}isOtherSent(){return this.senderId!==Kc.Socket.user().id}getToData(){return this.buildOptions.createOptions.to.data}}class Ll{}!function(e){e.TEXT="text",e.IMAGE="image",e.FILE="file",e.VIDEO="video",e.AUDIO="audio"}(Ml||(Ml={}));class jl extends Ll{constructor(){super(...arguments),this.goEasyUploader=new Rl}improve(e){let t=e.message;return new Promise(((e,n)=>{let i,o,s=t.buildOptions.createOptions;t.type===Ml.VIDEO?(o=t.payload,i=o.video.name):(o=t.payload,i=o.name),this.goEasyUploader.upload(s.file,i,s.onProgress,t.type===Ml.FILE).then((n=>{n.storageLocation!==cl.s3&&(n.url=encodeURI(n.url)),this.setPayload(n,t),e()})).catch((e=>{n(e)}))}))}setPayload(e,t){t.payload.url=e.url}}class Ul extends jl{setPayload(e,t){let n,i=t.payload;switch(i.video.url=e.url,i.video.name=e.name,i.thumbnail.height>200&&(i.thumbnail.height=200,i.thumbnail.width=200*i.video.width/i.video.height),e.storageLocation){case cl.aliYun:n="?x-oss-process=video/snapshot,t_0000,f_jpg,h_"+i.thumbnail.height+",m_fast,ar_auto";break;case cl.tencent:n="?ci-process=snapshot&time=1&format=jpg&height="+i.thumbnail.height;break;case cl.s3:n="?process=video&height="+i.thumbnail.height;break;default:throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e.storageLocation)}i.thumbnail.url=e.url+n}}class Fl extends jl{setPayload(e,t){let n,i=t.payload;i.url=e.url;const o=i.height>200?200:i.height;switch(e.storageLocation){case cl.aliYun:n="?x-oss-process=image/resize,m_lfit,h_"+o;break;case cl.tencent:n=`?imageMogr2/thumbnail/x${o}`;break;case cl.s3:n=`?process=image&height=${o}`;break;default:throw new Error("Only Ali OSS and Tencent COS are supported, unknown storage location:"+e.storageLocation)}i.thumbnail=e.url+n}}class Gl{constructor(){this.improvers={[Ml.FILE]:new jl,[Ml.AUDIO]:new jl,[Ml.IMAGE]:new Fl,[Ml.VIDEO]:new Ul}}improve(e){let t=this.improvers[e.message.type];if(t)try{return t.improve(e)}catch(n){return Promise.reject(n)}return Promise.resolve()}}class ql extends zc{static init(){this.i=new ql}}class zl{constructor(e,t,n,i,o){this.validate(e),this.mt=e.type,this.to=t.id.toString(),this.d=JSON.stringify(t.data),this.p=JSON.stringify(e.payload),n&&(this.nt=n),o&&(this.at=o),i&&(this.wxmpTemplateMsg=il(i),this.wxmpTemplateMsg.data=JSON.stringify(this.wxmpTemplateMsg.data));let s=t.type;if(this.t=s,s===Ya.CS){let t=e;this.tid=t.teamId}this.guid=e.messageId}validate(e){if(e.type===Ml.TEXT&&JSON.stringify(e.payload).length>3072)throw Error("message-length limit 3kb")}}class Hl{constructor(){this.payloadImprover=new Gl}send(e){this.validate(e);let t=e.message,n=e.accessToken,i=t.buildOptions,o=i.createOptions,s=o.notification,r=o.wxmpTemplateMsg,a=o.to;a.data||(a.data={}),t.status=Za.SENDING;let c=i.complete,l=this.payloadImprover.improve(e);Promise.all([c,l]).then((()=>mc(this,void 0,void 0,(function*(){if(o.beforeSend){const e=JSON.parse(JSON.stringify(t));yield o.beforeSend(e)}this.doSend(t,a,s,r,n,e)})))).catch((n=>{t.status=Za.FAIL,fc.onFailed(e,{code:n&&n.code||400,content:n&&n.content||n})}))}doSend(e,t,n,i,o,s){let r=new zl(e,t,n,i,o);ql.i.fire(Pl.MESSAGE_SENDING,e);let a=new Yc({name:pc.publishIM,params:r,unique:!0,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:t=>{e.status=Za.FAIL,ql.i.fire(Pl.MESSAGE_SEND_FAILED,e),fc.onFailed(s,{code:t.resultCode,content:t.content})},success:t=>{if(e.status=Za.SUCCESS,e.timestamp=t.content.timestamp,e.messageId=JSON.stringify(t.content.id),e.scene()===Ya.CS){let n=e;n.customerId()!==Kc.Socket.user().id&&(n.sessionId=t.content.sessionId)}e.clearUseLessAttribute(),ql.i.fire(Pl.MESSAGE_SEND_SUCCESS,e),fc.onSuccess(s,e)}});Kc.Socket.e(a)}validate(e){let t=e.message;if(!(t instanceof Bl))throw new Error("it is invalid message");if(t.status!==Za.NEW)throw new Error("Please create a new message, a message can only be sent once")}}class $l{insert(e,t){let n=this.binarySearch(e,t);if(n>=0)e.splice(n,1,t);else{let i=-n-1;e.splice(i,0,t)}}binarySearch(e,t){let n=0,i=e.length-1;for(;n<=i;){let o=i+n>>1,s=this.compare(t,e[o]);if(s>0)n=o+1;else{if(!(s<0))return o;i=o-1}}return-n-1}}class Vl{constructor(e){this.messages=new Array,this.allLoaded=!1,this.target=e}all(){return this.messages}sliceOverLengthMessages(){this.messages.length>Vl.CACHE_MAX_LENGTH&&(this.messages=this.messages.slice(-Vl.CACHE_MAX_LENGTH),!0===this.allLoaded&&(this.allLoaded=!1))}getMaxMessage(){return this.messages[this.messages.length-1]}loadLocalMessages(e,t){let n=[],i=this.messages.length;if(t){if(i>0){let o=this.messages[0].timestamp,s=this.messages[i-1].timestamp;if(t>=o&&t<=s)for(let r=i-1;r>=0;r--){let i=this.messages[r];if(i.timestamp0&&n.timestamp===e.lastTimestamp)&&(t.forEach((e=>{Vl.sortedInserter.insert(this.messages,e)})),t.lengthe===t.timestamp))}findMessagesByTimes(e){let t=[];return e.forEach((e=>{let n=this.findMessageByTime(e);nc.isDef(n)&&t.push(n)})),t}existsMessage(e){return this.findMessageIndexById(e)>-1}findMessageIndexById(e){return this.messages.findIndex((t=>e===t.messageId))}deleteMessage(e){let t=this.findMessageIndexById(e);t>=0&&this.messages.splice(t,1)}recallMessage(e){return e.times.map((e=>this.findMessageByTime(e))).filter((e=>nc.isDef(e))).map((t=>(t.recalled=!0,t.recaller=e.recaller,t)))}isEmpty(){return 0===this.messages.length}deleteMessages(e){e.forEach((e=>{this.deleteMessage(e.messageId)}))}saveMessage(e){Vl.sortedInserter.insert(this.messages,e),this.deleteGroupConversationMessage(),this.sliceOverLengthMessages()}deleteGroupConversationMessage(){this.target.scene===Ya.GROUP&&this.messages.length>=2&&1===this.messages[0].x&&this.messages.shift()}maxSuccessMessageTime(){for(let e=this.messages.length-1;e>=0;e--)if(this.messages[e].status===Za.SUCCESS)return this.messages[e].timestamp;return 0}minTime(){return this.isEmpty()?0:this.messages[0].timestamp}correctPosition(e){this.deleteMessage(e.messageId),this.saveMessage(e)}}Vl.CACHE_MAX_LENGTH=200,Vl.sortedInserter=new class extends $l{compare(e,t){let n=e.timestamp-t.timestamp;return n>0?1:0===n?0:-1}};class Kl{constructor(e,t,n){this.scene=e,this.id=t,nc.isDef(n)&&(this.teamId=n)}toString(){return Ya.PRIVATE===this.scene||Ya.GROUP===this.scene?this.scene+"#"+this.id:this.scene+"#"+this.id+"#"+this.teamId}customerId(){if(Ya.CS===this.scene)return this.id===this.teamId?Kc.Socket.user().id:this.id}static byScene(e,t,n){return new Kl(e,t,n)}static byIMMessage(e){let t,n,i=e.scene();if(i===Ya.PRIVATE){let t=e.senderId,i=e.targetId();n=Kc.Socket.user().id===t?i:t}else if(i===Ya.GROUP)n=e.targetId();else{if(i!==Ya.CS)throw{code:400,content:`scene ${i} not exists`};n=e.targetId(),t=e.teamId}return new Kl(i,n,t)}static byMessageReadRemoteEvent(e){let t,n=e.scene,i=e.targetId,o=e.markerId,s=e.teamId;return n===Ya.PRIVATE?t=Kc.Socket.user().id===o?i:o:n===Ya.GROUP?t=i:n===Ya.CS&&(t=i===s?o===Kc.Socket.user().id?s:o:o===Kc.Socket.user().id?i:s),new Kl(n,t,s)}static byIMMessageDeletedEvent(e){let t=e.scene,n=e.deleterId;if(t===Ya.PRIVATE){let i=Kc.Socket.user().id===n?e.targetId:n;return new Kl(t,i)}if(t===Ya.GROUP)return new Kl(t,e.targetId)}static byConversationDTO(e){let t=e.lastMessage;return this.byIMMessage(t)}static byConversationId(e,t){let n;if(e===Ya.PRIVATE){let e=t.split(":",2);n=e[0]===Kc.Socket.user().id?e[1]:e[0]}else n=t;return new Kl(e,n)}}class Wl{constructor(e){this.times=new Array;let t=e[0],n=Kl.byIMMessage(t);this.scene=n.scene,this.targetId=n.id,e.forEach((e=>{e.status===Za.SUCCESS&&this.times.push(e.timestamp)})),this.times.sort(((e,t)=>e{let i=new Yc({name:pc.IM_DELETE_MESSAGE,params:t,permission:Jc.WRITE,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,success:t=>{200===t.code?e(t):n(t)},fail:e=>{n(e)}});Kc.Socket.e(i)}))}static validate(e){let t=e.messages;for(let n=0;n{let n=new Yc({name:pc.IM_HISTORY_CHANGE,params:s,permission:Jc.READ,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,fail:e=>{t(e)},success:t=>{let n=t.content;e(n)}});Kc.Socket.e(n)}))}loadServerMessages(e,t){return new Promise(((n,i)=>{let o=new Yc({name:pc.IM_HISTORY,params:t,permission:Jc.READ,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,fail:e=>{i(e)},success:t=>{let i=t.content;i.messages=this.convertServerMessages(e,i.messages),n(i)}});Kc.Socket.e(o)}))}convertServerMessages(e,t){let n=[],i=e.scene,o=e.id;return t.forEach((t=>{if(t.t=i,Ya.PRIVATE===i)t.r=t.s===Kc.Socket.user().id?o:Kc.Socket.user().id;else if(Ya.GROUP===i)t.r=o;else if(Ya.CS===i){let n=e.customerId(),i=e.teamId;n===Kc.Socket.user().id?t.r=i:t.r=n}let s=this.builder.build(t);n.push(s)})),n}updateServerOffsets(e,t){return mc(this,void 0,void 0,(function*(){let n=new Ql(t.id,t.scene,e,t.teamId);return new Promise(((e,t)=>{let i=new Yc({name:pc.IM_MARK_AS_READ,params:n,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,success:t=>{e(t)},fail:e=>{t(e)}});Kc.Socket.e(i)}))}))}}nu.instance=new nu;class iu{constructor(){this.offsetMap=new Map,this.markingTime=0,this.userId=Kc.Socket.user().id}updateOffset(e,t){let n=this.offsetMap.get(e);return nc.isDef(n)?t>n&&(this.offsetMap.set(e,t),!0):(this.offsetMap.set(e,t),!0)}updateUserOffsets(e){e.forEach((e=>{let t=e.userId,n=e.offset;this.updateOffset(t,n)}))}updateMyOffset(e){return this.updateOffset(this.userId,e)}myOffset(){return this.getOffset(this.userId)}getOffset(e){return this.offsetMap.get(e)||0}}class ou{constructor(e,t,n,i,o){this.id=e,this.scene=t,this.lastTimestamp=n,this.limit=i,this.teamId=o}}class su{constructor(e){this.history=e}pre(){this.oldLastMessage=this.history.getMaxMessage(),this.oldUnreadAmount=this.history.unreadAmount(),this.oldLastMessage&&(this.oldLastMessageRecalled=this.oldLastMessage.recalled,this.oldLastMessageRead=this.oldLastMessage.read,this.oldLastMessageStatus=this.oldLastMessage.status)}post(){let e,t,n,i=this.history.unreadAmount(),o=this.history.getMaxMessage();o&&(n=o.status,e=o.read,t=o.recalled);let s=this.history.target;this.oldLastMessage!==o||this.oldLastMessageRead!==e||this.oldLastMessageRecalled!==t||this.oldLastMessageStatus!==n?o?ql.i.fire(Pl.MAX_MESSAGE_CHANGED,o):ql.i.fire(Pl.MAX_MESSAGE_DELETED,s):this.oldUnreadAmount!==i&&ql.i.fire(Pl.UNREAD_AMOUNT_CHANGED,s)}}class ru{constructor(e,t,n,i){this.scene=e,this.conversationId=t,this.recaller=n,this.times=i}}class au{static init(){this.eventCenter=new Vc}static on(e,t){this.eventCenter.on(e,t)}static fire(e,t){this.eventCenter.fire(e,t)}static off(e,t){this.eventCenter.off(e,t)}}!function(e){e.PRIVATE_MESSAGE_RECEIVED="PRIVATE_MESSAGE_RECEIVED",e.GROUP_MESSAGE_RECEIVED="GROUP_MESSAGE_RECEIVED",e.SYSTEM_MESSAGE_RECEIVED="SYSTEM_MESSAGE_RECEIVED",e.CONVERSATIONS_UPDATED="CONVERSATIONS_UPDATED",e.HISTORY_EXPIRED="HISTORY_EXPIRED",e.USER_PRESENCE="USER_PRESENCE",e.GROUP_PRESENCE="GROUP_PRESENCE",e.MESSAGE_DELETED="MESSAGE_DELETED",e.MESSAGE_READ="MESSAGE_READ",e.MESSAGE_RECALLED="MESSAGE_RECALLED",e.CS_MESSAGE_RECEIVED="CS_MESSAGE_RECEIVED",e.PENDING_CONVERSATIONS_UPDATED="PENDING_CONVERSATIONS_UPDATED"}(Dl||(Dl={}));class cu{constructor(e){this.expiredTime=0,this.remoteHistory=nu.instance,this.target=e,this.userOffsets=new iu,this.messageCache=new Vl(e)}initMaxMessageAndOffsets(e,t){this.existsMessage(e)||(this.messageCache.saveMessage(e),t.forEach((e=>{this.markLocalMessagesRead(this.messageCache.all(),e.userId,e.offset,!1)})))}existsMessage(e){return this.messageCache.existsMessage(e.messageId)}loadHistory(e,t){return mc(this,void 0,void 0,(function*(){return this.expiredTime>0&&!this.messageCache.isEmpty()&&(yield this.updateByServerChange()),nc.isUndef(t)?t=10:t>30&&(t=30),yield this.loadServerMessages(e,t)}))}loadServerMessages(e,t){return mc(this,void 0,void 0,(function*(){let n=this.messageCache.loadLocalMessages(t,e);if(!1===this.messageCache.allLoaded&&n.length!==t){let i=t-n.length,o=n[0]?n[0].timestamp:e,s=new ou(this.target.id.toString(),this.target.scene,o,i,this.target.teamId),r=yield this.remoteHistory.loadServerMessages(this.target,s),a=r.messages;n=a.concat(n),this.messageCache.cacheServerMessages(s,a),r.userOffsets.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),this.userOffsets.offsetMap.forEach(((e,t)=>{this.markLocalMessagesRead(a,t,e,!1)}))}return n}))}deleteMessages(e){return mc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>mc(this,void 0,void 0,(function*(){let t=e.messages;yield Xl.deleteServerMessages(t),this.messageCache.deleteMessages(t),fc.onSuccess(e)}))))}))}syncDeletedMessage(e,t){this.aopUnreadAmountMaxMessage((()=>{this.doSyncDeletedMessage(e,t)}))}doSyncDeletedMessage(e,t){if(e===Kc.Socket.user().id){let e=this.messageCache.findMessagesByTimes(t);this.messageCache.deleteMessages(e),e.length>0&&au.fire(Dl.MESSAGE_DELETED,e)}}recallMessages(e){return mc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>mc(this,void 0,void 0,(function*(){this.doRecall(e)}))))}))}doRecall(e){let t=this.messageCache.recallMessage(e);t.length>0&&au.fire(Dl.MESSAGE_RECALLED,t)}expire(){this.messageCache.isEmpty()||(this.expiredTime=this.messageCache.maxSuccessMessageTime())}updateByServerChange(){return mc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>mc(this,void 0,void 0,(function*(){let e=yield this.remoteHistory.sync(this.target.scene,this.target.id,this.expiredTime,this.messageCache.minTime(),this.target.teamId);e.userOffsets.forEach((e=>{this.markLocalMessagesRead(this.messageCache.all(),e.userId,e.offset,!0)}));let t=e.deletedMessageTimes;t.length>0&&this.doSyncDeletedMessage(Kc.Socket.user().id,t);let n=e.recalledMessages;n.length>0&&n.forEach((e=>{let t=new ru(this.target.scene,this.target.id,e.recaller,e.times);this.doRecall(t)})),this.expiredTime=0}))))}))}markRead(){return mc(this,void 0,void 0,(function*(){yield this.aopUnreadAmountMaxMessage((()=>mc(this,void 0,void 0,(function*(){let e=this.messageCache.maxSuccessMessageTime();e>this.userOffsets.myOffset()&&(this.userOffsets.markingTime=e,yield this.remoteHistory.updateServerOffsets(e,this.target),e===this.userOffsets.markingTime&&this.markLocalMessagesRead(this.messageCache.all(),Kc.Socket.user().id,e,!0))}))))}))}syncMarkedMessage(e){this.aopUnreadAmountMaxMessage((()=>{this.markLocalMessagesRead(this.messageCache.all(),e.markerId,e.time,!0)}))}onMessageSending(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.saveMessage(e)}))}onMessageSendSuccess(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.correctPosition(e),this.markLocalMessagesRead(this.messageCache.all(),Kc.Socket.user().id,e.timestamp,!0)}))}onMessageSendFailed(e){this.getMaxMessage()===e&&ql.i.fire(Pl.MAX_MESSAGE_CHANGED,e)}onMessageReceived(e){this.aopUnreadAmountMaxMessage((()=>{this.messageCache.saveMessage(e),this.markLocalMessagesRead(this.messageCache.all(),e.senderId,e.timestamp,!0)}))}aopUnreadAmountMaxMessage(e,t){return mc(this,void 0,void 0,(function*(){try{let t=new su(this);t.pre(),yield e(),t.post()}catch(n){fc.onFailed(t,n)}}))}markLocalMessagesRead(e,t,n,i){if(this.userOffsets.updateOffset(t,n),this.isOtherUserId(t)){let t=this.markMySentRead(e,n);i&&t.length>0&&au.fire(Dl.MESSAGE_READ,t)}else t===Kc.Socket.user().id&&this.markOthersSentRead(e,n)}markOthersSentRead(e,t){if(this.target.scene===Ya.PRIVATE)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.isOtherSent()&&i.timestamp<=t){if(i.read)break;i.read=!0}}}markMySentRead(e,t){let n=new Array;if(this.target.scene===Ya.PRIVATE)for(let i=e.length-1;i>=0;i--){let o=e[i];if(!o.isOtherSent()&&o.timestamp<=t&&o.status===Za.SUCCESS){if(o.read)break;o.read=!0,n.push(o)}}return n}isOtherUserId(e){if(this.target.scene===Ya.CS){let t=this.target.customerId();return Kc.Socket.user().id===t?e!==Kc.Socket.user().id:e===t}return e!==Kc.Socket.user().id}unreadAmount(e){let t=0,n=this.userOffsets.myOffset(),i=this.messageCache.all();for(const o of i)o.isOtherSent()&&!1===o.recalled&&o.timestamp>n&&(t+=1);return t}getMaxMessage(e){return this.messageCache.getMaxMessage()}maxTime(e){let t=this.getMaxMessage();return nc.isDef(t)?t.timestamp:0}}class lu{constructor(e,t){this.teamId=e,this.customerId=t}}class uu{}class pu{constructor(e,t,n){this.teamId=e,this.teamData=JSON.stringify(t),this.agentData=JSON.stringify(n)}}class du{constructor(e){this.teamId=e}}class hu{constructor(e){this.teamId=e}}var fu={exports:{}},mu=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,gu=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],vu=function(e){var t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));for(var o=mu.exec(e||""),s={},r=14;r--;)s[gu[r]]=o[r]||"";return-1!=n&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s},yu={exports:{}},bu={exports:{}},xu=1e3,Su=6e4,ku=60*Su,Cu=24*ku,wu=function(e,t){t=t||{};var n,i=typeof e;if("string"===i&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"days":case"day":case"d":return n*Cu;case"hours":case"hour":case"hrs":case"hr":case"h":return n*ku;case"minutes":case"minute":case"mins":case"min":case"m":return n*Su;case"seconds":case"second":case"secs":case"sec":case"s":return n*xu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===i&&!1===isNaN(e))return t.long?Eu(n=e,Cu,"day")||Eu(n,ku,"hour")||Eu(n,Su,"minute")||Eu(n,xu,"second")||n+" ms":function(e){return e>=Cu?Math.round(e/Cu)+"d":e>=ku?Math.round(e/ku)+"h":e>=Su?Math.round(e/Su)+"m":e>=xu?Math.round(e/xu)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Eu(e,t,n){if(!(e=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},t.enable(n())}(yu,yu.exports);var Tu=vu,Iu=yu.exports("socket.io-client:url"),_u=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(Iu("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),Iu("parse %s",e),n=Tu(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port,n.href=n.protocol+"://"+i+(t&&t.port===n.port?"":":"+n.port),n},Ou={},Au={}.toString,Ru=Array.isArray||function(e){return"[object Array]"==Au.call(e)};!function(e){yu.exports("socket.io-parser");var t=yc.exports,n=Ru;function i(){}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=i,e.Decoder=s;var o=e.ERROR+'"encode error"';function s(){this.reconstructor=null}function r(t){return{type:e.ERROR,data:"parser error: "+t}}i.prototype.encode=function(t,n){n([function(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var i=function(e){try{return JSON.stringify(e)}catch(t){return!1}}(t.data);if(!1===i)return o;n+=i}return n}(t)])},t(s.prototype),s.prototype.add=function(t){var i;if("string"!=typeof t)throw new Error("Unknown type: "+t);i=function(t){var i=0,o={type:Number(t.charAt(0))};if(null==e.types[o.type])return r("unknown packet type "+o.type);if(e.BINARY_EVENT===o.type||e.BINARY_ACK===o.type){for(var s="";"-"!==t.charAt(++i)&&(s+=t.charAt(i),i!=t.length););if(s!=Number(s)||"-"!==t.charAt(i))throw new Error("Illegal attachments");o.attachments=Number(s)}if("/"===t.charAt(i+1))for(o.nsp="";++i&&","!==(c=t.charAt(i))&&(o.nsp+=c,i!==t.length););else o.nsp="/";var a=t.charAt(i+1);if(""!==a&&Number(a)==a){for(o.id="";++i;){var c;if(null==(c=t.charAt(i))||Number(c)!=c){--i;break}if(o.id+=t.charAt(i),i===t.length)break}o.id=Number(o.id)}if(t.charAt(++i)){var l=function(e){try{return JSON.parse(e)}catch(t){return!1}}(t.substr(i));if(!1===l||o.type!==e.ERROR&&!n(l))return r("invalid payload");o.data=l}return o}(t),this.emit("decoded",i)},s.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}(Ou);var Pu={exports:{}},Mu={},Nu={},Du=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var i in e)n.call(e,i)&&t.push(i);return t},Bu=Ru,Lu=Object.prototype.toString,ju="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Lu.call(Blob),Uu="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Lu.call(File),Fu=function e(t){if(!t||"object"!=typeof t)return!1;if(Bu(t)){for(var n=0,i=t.length;n=55296&&t<=56319&&o=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function Xu(e,t){return Vu(e>>t&63|128)}function Ju(e,t){if(!(4294967168&e))return Vu(e);var n="";return 4294965248&e?4294901760&e?!(4292870144&e)&&(n=Vu(e>>18&7|240),n+=Xu(e,12),n+=Xu(e,6)):(Wu(e,t)||(e=65533),n=Vu(e>>12&15|224),n+=Xu(e,6)):n=Vu(e>>6&31|192),n+Vu(63&e|128)}function Qu(){if($u>=Hu)throw Error("Invalid byte index");var e=255&zu[$u];if($u++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function Yu(e){var t,n;if($u>Hu)throw Error("Invalid byte index");if($u==Hu)return!1;if(t=255&zu[$u],$u++,!(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|Qu())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|Qu()<<6|Qu())>=2048)return Wu(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|Qu()<<12|Qu()<<6|Qu())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var Zu={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,i=Ku(e),o=i.length,s=-1,r="";++s65535&&(o+=Vu((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=Vu(t);return o}(o)}},ep=void 0!==ep?ep:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,tp=function(){try{return 2===new Blob(["hi"]).size}catch(Wa){return!1}}(),np=tp&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(Wa){return!1}}(),ip=ep&&ep.prototype.append&&ep.prototype.getBlob;function op(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e}))}function sp(e,t){t=t||{};var n=new ep;return op(e).forEach((function(e){n.append(e)})),t.type?n.getBlob(t.type):n.getBlob()}function rp(e,t){return new Blob(op(e),t||{})}"undefined"!=typeof Blob&&(sp.prototype=Blob.prototype,rp.prototype=Blob.prototype);var ap=tp?np?Blob:rp:ip?sp:void 0;!function(e){var t=Du,n=Fu,i=Gu,o=Zu;e.protocol=3;var s=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},r=t(s),a={type:"error",data:"parser error"},c=ap;e.encodePacket=function(e,t,n,i){"function"==typeof t&&(i=t,t=!1),"function"==typeof n&&(i=n,n=null),void 0===e.data||e.data.buffer||e.data;var r=s[e.type];return void 0!==e.data&&(r+=n?o.encode(String(e.data),{strict:!1}):String(e.data)),i(""+r)},e.decodePacket=function(e,t,n){if(void 0===e)return a;if("string"==typeof e){if(n&&!1===(e=function(e){try{e=o.decode(e,{strict:!1})}catch(t){return!1}return e}(e)))return a;var i=e.charAt(0);return Number(i)==i&&r[i]?e.length>1?{type:r[i],data:e.substring(1)}:{type:r[i]}:a}i=new Uint8Array(e)[0];var s=sliceBuffer(e,1);return c&&"blob"===t&&(s=new c([s])),{type:r[i],data:s}},e.encodePayload=function(t,o,s){"function"==typeof o&&(s=o,o=null);var r=n(t);if(!t.length)return s("0:");!function(t){for(var n=new Array(t.length),a=i(t.length,(function(e,t){return s(t.join(""))})),c=function(t,i,s){!function(t,n){e.encodePacket(t,!!r&&o,!0,(function(e){n(null,function(e){return e.length+":"+e}(e))}))}(i,(function(e,i){n[t]=i,s(e,n)}))},l=0;l0);return t}function bp(){var e=yp(+new Date);return e!==pp?(gp=0,pp=e):e+"."+yp(gp++)}for(;vp<64;vp++)mp[fp[vp]]=vp;bp.encode=yp,bp.decode=function(e){var t=0;for(vp=0;vp';i=document.createElement(e)}catch(t){(i=document.createElement("iframe")).name=n.iframeId,i.src="javascript:0"}i.id=n.iframeId,n.form.appendChild(i),n.iframe=i}this.form.action=this.uri(),c(),e=e.replace(Bp,"\\\n"),this.area.value=e.replace(Dp,"\\n");try{this.form.submit()}catch(l){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&a()}:this.iframe.onload=a};var Up,Fp,Gp=lp,qp=Nu,zp=dp,Hp=hp,$p=xp,Vp=yu.exports("engine.io-client:websocket");(void 0===Nn&&void 0===Mn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&("undefined"!=typeof WebSocket?Up=WebSocket:"undefined"!=typeof self&&(Up=self.WebSocket||self.MozWebSocket));var Kp=Up||Fp;(void 0===Nn&&void 0===Mn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&"undefined"==typeof GameGlobal||(Kp=function(e){var t=this;if(t.onopen=function(){},t.onclose=function(){},t.onmessage=function(e){},t.onerror=function(e){},"object"==typeof tt&&tt.getSystemInfo){let n=tt.connectSocket({url:e});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen((function(){t.onopen()})),n.onError((function(e){t.onerror(e)})),n.onMessage((function(e){t.onmessage(e)})),n.onClose((function(){t.onclose()}))}else if("undefined"!=typeof my)my.connectSocket({url:e}),t.send=function(e){my.sendSocketMessage({data:e})},t.close=function(e){my.closeSocket()},my.onSocketOpen((function(e){t.onopen()})),my.onSocketError((function(e){t.onerror(e)})),my.onSocketMessage((function(e){t.onmessage(e)})),my.onSocketClose((e=>{t.onclose(e)}));else if("undefined"!=typeof swan)swan.connectSocket({url:e}),t.send=function(e){swan.sendSocketMessage({data:e})},t.close=function(e){swan.closeSocket()},swan.onSocketOpen((function(e){t.onopen()})),swan.onSocketError((function(e){t.onerror(e)})),swan.onSocketMessage((function(e){t.onmessage(e)})),swan.onSocketClose((e=>{t.onclose(e)}));else if(void 0!==Nn){var n=Nn.connectSocket({url:e,complete:()=>{}});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen((function(e){t.onopen()})),n.onError((function(e){t.onerror(e)})),n.onMessage((function(e){t.onmessage(e)})),n.onClose((function(e){t.onclose()}))}else{var i=Mn.connectSocket({url:e});t.send=function(e){i.send({data:e})},t.close=function(e){i.close({code:1e3})},i.onOpen((function(){t.onopen()})),i.onError((function(e){t.onerror(e)})),i.onMessage((function(e){t.onmessage(e)})),i.onClose((function(e){t.onclose(e)}))}});var Wp=Xp;function Xp(e){e&&e.forceBase64&&(this.supportsBinary=!1),(void 0===Nn&&void 0===Mn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&(this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=Up&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(Kp=Fp)),Gp.call(this,e)}Hp(Xp,Gp),Xp.prototype.name="websocket",Xp.prototype.supportsBinary=!1,Xp.prototype.doOpen=function(){if(this.check()){var e,t,n=this.uri();if((void 0===Nn&&void 0===Mn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket)&&(e=this.protocols),(t=void 0===Nn&&void 0===Mn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket?{agent:this.agent,perMessageDeflate:this.perMessageDeflate}:{agent:this.agent}).pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,"object"==typeof navigator&&"ReactNative"===navigator.product&&(t={}),this.extraHeaders&&(t.headers=this.extraHeaders),this.localAddress&&(t.localAddress=this.localAddress),"undefined"!=typeof cc&&"Windows"===cc.sys.os)cc.resources.load("cacert",((e,t)=>{const i=t.nativeUrl;this.ws=new Kp(n,[],i),this.ws.binaryType="arraybuffer",this.addEventListeners()}));else{try{void 0===Nn&&void 0===Mn&&"undefined"==typeof my&&"undefined"==typeof swan||"undefined"!=typeof WebSocket?this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new Kp(n,e):new Kp(n):new Kp(n,e,t):this.ws=new Kp(n)}catch(i){return this.emit("error",i)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}}},Xp.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},Xp.prototype.write=function(e){var t=this;this.writable=!1;for(var n=e.length,i=0,o=n;i0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}cd.priorWebsocketSuccess=!1,td(cd.prototype),cd.protocol=od.protocol,cd.Socket=cd,cd.Transport=lp,cd.transports=Mu,cd.parser=Nu,cd.prototype.createTransport=function(e){nd('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=od.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new ed[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},cd.prototype.open=function(){var e;if(this.rememberUpgrade&&cd.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(n){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},cd.prototype.setTransport=function(e){nd("setting transport %s",e.name);var t=this;this.transport&&(nd("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},cd.prototype.probe=function(e){nd('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,i=this;function o(){if(i.onlyBinaryUpgrades){var o=!this.supportsBinary&&i.transport.supportsBinary;n=n||o}n||(nd('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(o){if(!n)if("pong"===o.type&&"probe"===o.data){if(nd('probe transport "%s" pong',e),i.upgrading=!0,i.emit("upgrading",t),!t)return;cd.priorWebsocketSuccess="websocket"===t.name,nd('pausing current transport "%s"',i.transport.name),i.transport.pause((function(){n||"closed"!==i.readyState&&(nd("changing transport and sending upgrade packet"),u(),i.setTransport(t),t.send([{type:"upgrade"}]),i.emit("upgrade",t),t=null,i.upgrading=!1,i.flush())}))}else{nd('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,i.emit("upgradeError",s)}})))}function s(){n||(n=!0,u(),t.close(),t=null)}function r(n){var o=new Error("probe error: "+n);o.transport=t.name,s(),nd('probe transport "%s" failed because of error: %s',e,n),i.emit("upgradeError",o)}function a(){r("transport closed")}function c(){r("socket closed")}function l(e){t&&e.name!==t.name&&(nd('"%s" works - aborting "%s"',e.name,t.name),s())}function u(){t.removeListener("open",o),t.removeListener("error",r),t.removeListener("close",a),i.removeListener("close",c),i.removeListener("upgrading",l)}cd.priorWebsocketSuccess=!1,t.once("open",o),t.once("error",r),t.once("close",a),this.once("close",c),this.once("upgrading",l),t.open()},cd.prototype.onOpen=function(){if(nd("socket open"),this.readyState="open",cd.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){nd("starting upgrade probes");for(var e=0,t=this.upgrades.length;e0&&e.jitter<=1?e.jitter:0,this.attempts=0}md.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},md.prototype.reset=function(){this.attempts=0},md.prototype.setMin=function(e){this.ms=e},md.prototype.setMax=function(e){this.max=e},md.prototype.setJitter=function(e){this.jitter=e};class gd{static init(e,t,n){this.host=e,(void 0!==t&&!1===t||!0===n)&&(this.https=!1)}static isMP(){return[ic.MP_WX,ic.MP_ALI,ic.MP_BYTE,ic.MP_WGAME,ic.MP_BAIDU].includes(oc.currentPlatform())}static uri(){let e="http";return this.https&&(e+="s"),e+"://"+this.index()+this.host}static index(){return 0==this.i?this.i=Math.floor(Math.random()*this.max)+1:this.i=this.i%this.max+1,this.i}}gd.i=0,gd.max=5,gd.https=!0;var vd=vc(Object.freeze({__proto__:null,URIResolver:gd})),yd=vc(hc),bd=Pu.exports,xd=ld.exports,Sd=yc.exports,kd=Ou,Cd=pd,wd=hd,Ed=(yu.exports("socket.io-client:manager"),Zp),Td=fd;const{URIResolver:Id}=vd;var _d=yd.runStatus,Od=Object.prototype.hasOwnProperty,Ad=Rd;function Rd(e,t){if(!(this instanceof Rd))return new Rd(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new Td({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||kd;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}Rd.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)Od.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},Rd.prototype.updateSocketIds=function(){for(var e in this.nsps)Od.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},Rd.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},Sd(Rd.prototype),Rd.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},Rd.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},Rd.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},Rd.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},Rd.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},Rd.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},Rd.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},Rd.prototype.open=Rd.prototype.connect=function(e,t){if(this.readyState,~this.readyState.indexOf("open"))return this;this.uri,this.engine=bd(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=Cd(n,"open",(function(){i.onopen(),e&&e()})),s=Cd(n,"error",(async function(t){if(i.uri=Id.uri(),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else i.maybeReconnectOnOpen()}));if(!1!==this._timeout){var r=this._timeout,a=setTimeout((function(){o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",r)}),r);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(o),this.subs.push(s),this},Rd.prototype.onopen=function(){this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(Cd(e,"data",wd(this,"ondata"))),this.subs.push(Cd(e,"ping",wd(this,"onping"))),this.subs.push(Cd(e,"pong",wd(this,"onpong"))),this.subs.push(Cd(e,"error",wd(this,"onerror"))),this.subs.push(Cd(e,"close",wd(this,"onclose"))),this.subs.push(Cd(this.decoder,"decoded",wd(this,"ondecoded")))},Rd.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},Rd.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},Rd.prototype.ondata=function(e){this.decoder.add(e)},Rd.prototype.ondecoded=function(e){this.emit("packet",e)},Rd.prototype.onerror=function(e){this.emitAll("error",e)},Rd.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new xd(this,e,t),this.nsps[e]=n;var i=this;n.on("connecting",o),n.on("connect",(function(){n.id=i.generateId(e)})),this.autoConnect&&o()}function o(){~Ed(i.connecting,n)||i.connecting.push(n)}return n},Rd.prototype.destroy=function(e){var t=Ed(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},Rd.prototype.packet=function(e){var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(n){for(var i=0;i0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},Rd.prototype.cleanup=function(){for(var e=this.subs.length,t=0;t=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();this.reconnecting=!0;var n=setTimeout((function(){if(_d.isBackend())return e.reconnecting=!1,e.reconnect(),void e.emitAll("reconnect_error","Uniapp running backend, skipped reconnect...");e.skipReconnect||(e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):e.onreconnect()})))}),t);this.subs.push({destroy:function(){clearTimeout(n)}})}},Rd.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var n=_u,i=Ou,o=Ad;yu.exports("socket.io-client"),e.exports=t=r;var s=t.managers={};function r(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var i,r=n(e),a=r.source,c=r.id,l=r.path,u=s[c]&&l in s[c].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||u?i=o(a,t):(s[c]||(s[c]=o(a,t)),i=s[c]),r.query&&!t.query&&(t.query=r.query),i.socket(r.path,t)}t.protocol=i.protocol,t.connect=r,t.Manager=Ad,t.Socket=ld.exports}(fu,fu.exports);const Pd=fu.exports;class Md{constructor(){this.io=Pd,this.status=Ka.DISCONNECTED,this.permissions=[Jc.NONE],this.connectedObservers=[],this.disconnectedObservers=[]}connect(){this.status=Ka.CONNECTING}socketio(){return this.io}on(e,t){this.io.on(e,t)}disconnect(){this.io.disconnect()}getStatus(){return this.status}addConnectedObserver(e){nc.isFunction(e)&&this.connectedObservers.push(e)}addDisconnectedObserver(e){nc.isFunction(e)&&this.disconnectedObservers.push(e)}notify(e,t){for(let n=0;n{this.status=Ka.CONNECTED,this.notify(this.connectedObservers)})),this.io.on("reconnecting",(e=>{this.status=Ka.CONNECTING,this.notify(this.reconnectingObservers,e)})),this.io.on("disconnect",(()=>{this.status=Ka.DISCONNECTED,this.notify(this.disconnectedObservers)})),this.io.on("connect_error",(function(e){}))}addReconnectingObserver(e){this.reconnectingObservers.push(e)}}class Dd{static get(e){const t=encodeURIComponent(e)+"=",n=document.cookie.split("; ");for(const i of n)if(i.startsWith(t))return decodeURIComponent(i.substring(t.length));return null}static set(e,t,n,i,o="/",s=!1){let r=encodeURIComponent(e)+"="+encodeURIComponent(t);n instanceof Date&&(r+="; expires="+n.toGMTString()),o&&(r+="; path="+o),i&&(r+="; domain="+i),s&&(r+="; secure"),document.cookie=r}static remove(e,t,n="/",i=!1){Dd.set(e,"",new Date(0),t,n,i)}}class Bd{asyncGet(e){let t=this.get(e);return Promise.resolve(t)}asyncPut(e,t){return this.put(e,t),Promise.resolve()}get(e){let t=this.doGet(e);return t=JSON.parse(t),t}put(e,t){this.doPut(e,JSON.stringify(t))}}class Ld extends Bd{constructor(){super(),this.domain=null,this.domain="undefined"!=typeof location&&/^(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/.test(location.host)?location.host.split(".").slice(-2).join("."):null}doGet(e){return Dd.get(e)||null}doPut(e,t){const n=new Date(2030,12,31,0,0,0,0),i=this.domain;Dd.set(e,t,n,i)}remove(e){const t=this.domain;Dd.remove(e,t)}support(){return"undefined"!=typeof navigator&&!0===navigator.cookieEnabled}}class jd extends Bd{doGet(e){return localStorage.getItem(e)||null}doPut(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}support(){return!("undefined"!=typeof GameGlobal||"undefined"==typeof localStorage||!localStorage.setItem)}}class Ud extends Bd{doGet(e){return Nn.getStorageSync(e)||null}doPut(e,t){Nn.setStorageSync(e,t)}remove(e){Nn.removeStorageSync(e)}support(){return!("object"!=typeof Nn||!Nn.getStorageSync)}}class Fd extends Bd{doGet(e){return cc.sys.localStorage.getItem(e)||null}doPut(e,t){cc.sys.localStorage.setItem(e,t)}remove(e){cc.sys.localStorage.removeItem(e)}support(){return"undefined"!=typeof cc&&void 0!==cc.sys.localStorage}}class Gd extends Bd{doGet(e){return Mn.getStorageSync(e)||null}doPut(e,t){Mn.setStorageSync(e,t)}remove(e){Mn.removeStorageSync(e)}support(){return!("object"!=typeof Mn||!Mn.getStorageSync||"undefined"!=typeof tt)}}class qd extends Bd{asyncGet(e){return mc(this,void 0,void 0,(function*(){const t=yield Ja.asyncStorage.getItem(e);return JSON.parse(t)}))}asyncPut(e,t){return Ja.asyncStorage.setItem(e,JSON.stringify(t))}doPut(e,t){throw new Error("Method not implemented.")}remove(e){Ja.asyncStorage.removeItem(e)}support(){return Xa.currentFramework()===Va.REACT_NATIVE}doGet(e){throw new Error("Method not implemented.")}}class zd extends Bd{doGet(e){const t=my.getStorageSync({key:e}).data||null;return"string"==typeof JSON.parse(t)?JSON.parse(t):t}doPut(e,t){my.setStorageSync({key:e,data:JSON.stringify(t)})}remove(e){my.removeStorageSync({key:e})}support(){return!("undefined"==typeof my||!my.getStorageSync)}}class Hd extends Bd{doGet(e){return tt.getStorageSync(e)||null}doPut(e,t){tt.setStorageSync(e,t)}remove(e){tt.removeStorageSync(e)}support(){return!("object"!=typeof tt||!tt.getStorageSync)}}class $d extends Bd{doGet(e){return swan.getStorageSync(e)||null}doPut(e,t){swan.setStorageSync(e,t)}remove(e){swan.removeStorageSync(e)}support(){return!("undefined"==typeof swan||!swan.getStorageSync)}}class Vd{constructor(){this.supportedStorage=null;const e=Vd.storages;e.push(new Ud),e.push(new Fd),e.push(new jd),e.push(new Gd),e.push(new qd),e.push(new zd),e.push(new $d),e.push(new Hd),e.push(new Ld),this.dispatch(),this.supportedStorage}static localStorage(){return this.instance.supportedStorage}dispatch(){for(let e of Vd.storages)if(e.support()){this.supportedStorage=e;break}}}Vd.storages=new Array,Vd.instance=new Vd;class Kd{static get(){return mc(this,void 0,void 0,(function*(){let e,t=Vd.localStorage();return null!==t&&(e=yield t.asyncGet(Kd.SM_KEY)),e}))}static put(e){return mc(this,void 0,void 0,(function*(){var t=Vd.localStorage();let n=e.sm;null!==t&&n&&t.asyncPut(Kd.SM_KEY,n)}))}}Kd.SM_KEY="GE-SM";class Wd{static e(e,t){let n="";for(let s=0;s=32&&o<=126?String.fromCharCode(function(e){let n=e+t;return n>126?n-126+32:n}(i)):String.fromCharCode(i));var i,o;return n}}class Xd{static initRNUniqueId(){if(Xa.currentFramework()===Va.REACT_NATIVE){let e=Ja.platform,t=e.constants,n={os:e.OS};return"android"===n.os?n.f=t.Fingerprint:n.v=e.Version,JSON.stringify(n)}return null}static initPlusDeviceId(){return new Promise(((e,t)=>{"undefined"!=typeof plus?plus.device.getInfo({success:t=>{e(t.uuid)},fail:e=>{t(e)}}):e(null)}))}static getVideoCard(){var e;if(oc.currentPlatform()===ic.BROWSER&&"undefined"!=typeof document){const t=document.createElement("canvas"),n=null!==(e=t.getContext("webgl"))&&void 0!==e?e:t.getContext("experimental-webgl");if(n&&"getExtension"in n){let e=0,t=0;if(navigator.userAgent.indexOf("Firefox")>-1)t=n.VENDOR,e=n.RENDERER;else{let i=n.getExtension("WEBGL_debug_renderer_info");if(!i)return null;t=i.UNMASKED_VENDOR_WEBGL,e=i.UNMASKED_RENDERER_WEBGL}const i={vendor:(n.getParameter(t)||"").toString(),renderer:(n.getParameter(e)||"").toString()};return JSON.stringify(i)}}return null}static z(){return mc(this,void 0,void 0,(function*(){const e={p:oc.currentPlatform(),f:Xa.currentFramework(),vc:this.getVideoCard(),rfp:this.initRNUniqueId()};return Wd.e(JSON.stringify(e),5)}))}}class Jd{constructor(e){this.rocketsBuffer=new Set,this.socket=e,this.socket.addConnectedObserver(this.onSocketConnected.bind(this))}emit(e){this.socket.status!==Ka.DISCONNECTED?(e.start(),this.doEmit(e)):e.fail({resultCode:"409",content:"Please connect first"})}doEmit(e){if(!e.complete)if(this.socket.status!==Ka.CONNECT_FAILED)if(this.isConnected())if(this.hasPermission(e)){let t=setTimeout((()=>{this.doEmit(e)}),e.singleTimeout);e.unique&&(e.params.retried=e.retried),this.socket.socketio().emit(e.name,e.params,(n=>{clearTimeout(t),200===n.resultCode||200==n.code?e.success(n):e.fail(n)})),e.retried++}else e.fail({resultCode:401,content:"No permission"});else this.isConnecting()&&this.rocketsBuffer.add(e);else e.fail({resultCode:408,content:"Failed to connect GoEasy."})}hasPermission(e){return!!this.socket.permissions.find((t=>t===e.permission))}isConnected(){return[Ka.CONNECTED,Ka.RECONNECTED,Ka.EXPIRED_RECONNECTED,Ka.DISCONNECTING].includes(this.socket.status)}isConnecting(){return[Ka.CONNECTING,Ka.RECONNECTING].includes(this.socket.status)}onSocketConnected(){this.emitBuffer()}emitBuffer(){Array.from(this.rocketsBuffer).forEach((e=>{this.rocketsBuffer.delete(e),this.doEmit(e)}))}}class Qd extends zc{static init(){Qd.i=new Qd}static fire(e,t){this.i.fire(e,t)}static on(e,t){this.i.on(e,t)}static off(e,t){this.i.off(e,t)}}class Yd extends Md{constructor(e,t){super(),this.ioSocket=null,this.sid=null,this.anonymous=!1,this.userId=null,this.artifactVersion=Qa,this.vname=null,this.uri=null,this.ioOpts=null,this.reconnectingTimes=0,this.messageObservers=new Map,this.connectFailedObservers=[],this.connectingObservers=[],this.expiredReconnectedObservers=[],this.options=e,this.ioSocket=new Nd({onDisconnected:this.onIoDisconnected.bind(this),onReconnecting:this.onIoReconnecting.bind(this)}),this.ioSocketEmitter=new Jd(this.ioSocket),this.ioSocket.addConnectedObserver(this.onIoReconnected.bind(this)),this.initOptions(t),this.connect()}initUserId(){let e=this.connectOptions.id;nc.isEmpty(e)?this.anonymous=!0:this.userId=e.toString()}socketio(){return this.ioSocket.socketio()}extendOptions(){let e=this.connectOptions;if(nc.isNull(e.data)||nc.isDef(e.data)&&!nc.isObject(e.data))throw{code:400,content:"TypeError: data requires an object."};if((nc.isDef(e.data)?String(e.data).length:0)>300&&nc.isObject(e)&&nc.isFunction(e.onFailed))throw{code:400,content:"user.data-length limit 300 byte."};if(nc.isObject(e.wxmpId)){if(nc.isEmpty(e.wxmpId.appid))throw{code:400,content:"wxmpId.appid is required."};if(nc.isEmpty(e.wxmpId.openid))throw{code:400,content:"wxmpId.openid is required. requires string."}}else if(nc.isPrimitive(e.wxmpId))throw{code:400,content:"TypeError: wxmpId requires an object."}}initUriAndOpts(){let e=this.options;gd.init(e.host,e.forceTLS,e.supportOldBrowser),this.uri=gd.uri();let t=["websocket"];!0===e.supportOldBrowser&&t.push("polling"),this.ioOpts={transports:t,timeout:dc.connect,reconnectionDelayMax:dc.reconnectionDelayMax}}onIoReconnected(){this.status===Ka.RECONNECTING&&this.authorize()}sendAck(e,t){this.ioSocket.io.emit(e,t)}initOptions(e){this.connectOptions=e,this.addConnectedObserver(e.onSuccess),this.addConnectFailedObserver(e.onFailed),this.addConnectingObserver(e.onProgress),this.initUserId()}connect(){this.initUriAndOpts(),this.extendOptions(),super.connect(),this.onConnecting(),this.ioSocket.connect({uri:this.uri,opts:this.ioOpts}),this.authorize()}disconnect(){return new Promise(((e,t)=>{this.status=Ka.DISCONNECTING;let n=()=>{this.ioSocket.disconnect(),this.status=Ka.DISCONNECTED,Qd.fire(al.DISCONNECTED),e()};const i=Fc.modules.get("GN");if(i&&(i.params.regId||this.connectOptions.wxmpId)){let e=e=>{t(e)},i=new Yc({name:pc.manualDisconnect,params:{},permission:Jc.READ,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:e,success:n});Kc.Socket.e(i)}else n()}))}authorize(){return mc(this,void 0,void 0,(function*(){let e=this.connectOptions,t={appkey:this.options.appkey,userId:this.userId,userData:JSON.stringify(e.data),otp:e.otp,artifactVersion:this.artifactVersion,sid:this.sid,mP:yield Fc.getParams(),a:this.anonymous,z:yield Xd.z(),sm:yield Kd.get(),c:{n:this.vname,v:this.artifactVersion}};JSON.stringify(t);let n=new Yc({name:pc.authorize,params:t,permission:Jc.NONE,singleTimeout:dc.commonInfiniteSingle,totalTimeout:dc.commonInfiniteTotal,success:e=>{this.onAuthorizeSuccess(e)},fail:e=>{this.onAuthorizeFailed(e)}});this.ioSocketEmitter.emit(n)}))}onConnecting(){Qd.fire(al.CONNECTING,this.reconnectingTimes),this.notify(this.connectingObservers,this.reconnectingTimes)}onIoReconnecting(){this.reconnectingTimes++,this.status==Ka.CONNECTED||this.status==Ka.EXPIRED_RECONNECTED||this.status==Ka.RECONNECTING?this.status=Ka.RECONNECTING:this.status=Ka.CONNECTING,this.onConnecting()}onIoDisconnected(){this.status!==Ka.DISCONNECTING&&(this.status=Ka.RECONNECTING,Qd.fire(al.LOST),this.notify(this.disconnectedObservers))}onAuthorizeSuccess(e){Kd.put(e),Fc.setDatas(e.mD),this.status===Ka.RECONNECTING?this.sid!==e.sid?(this.status=Ka.EXPIRED_RECONNECTED,this.sid=e.sid,Qd.fire(al.EXPIRED_RECONNECTED),this.notify(this.expiredReconnectedObservers)):(this.status=Ka.RECONNECTED,Qd.fire(al.RECONNECTED)):(this.status=Ka.CONNECTED,this.sid=e.sid),e.enablePublish&&(this.permissions.find((e=>e==Jc.WRITE))||this.permissions.push(Jc.WRITE)),e.enableSubscribe&&(this.permissions.find((e=>e==Jc.READ))||this.permissions.push(Jc.READ)),this.reconnectingTimes=0,Qd.fire(al.CONNECTED),this.notify(this.connectedObservers)}onAuthorizeFailed(e){this.ioSocket.disconnect(),this.status=Ka.CONNECT_FAILED;let t={code:e.resultCode||408,content:e.content||"Host unreachable or timeout"};this.notify(this.connectFailedObservers,t)}addConnectingObserver(e){nc.isFunction(e)&&this.connectingObservers.push(e)}addConnectFailedObserver(e){nc.isFunction(e)&&this.connectFailedObservers.push(e)}addExpiredReconnectedObserver(e){nc.isFunction(e)&&this.expiredReconnectedObservers.push(e)}onMessage(e,t){this.ioSocket.io._callbacks.hasOwnProperty("$"+e)||this.ioSocket.io.on(e,t)}user(){let e=this.connectOptions;return e?{id:e.id,data:e.data}:null}}class Zd{constructor(e){this.guidList=[],this.socket=e}offMessage(e,t){Qd.off(al.NEW_MESSAGE+"_"+e,t)}onMessage(e,t){Qd.on(al.NEW_MESSAGE+"_"+e,t),this.socket.onMessage(e,(t=>{this.fire(e,t)}))}fire(e,t){let n=this.filter(t);n&&Qd.fire(al.NEW_MESSAGE+"_"+e,n)}filter(e){if("string"==typeof e&&(e=JSON.parse(e)),e.i){if(this.guidList.findIndex((t=>t===e.i))>-1)return;this.guidList.unshift(e.i),this.guidList.length>300&&this.guidList.pop()}return e}}class eh{static init(e){this.i=new eh(e)}constructor(e){this.goeasyOptions=e}static connect(e,t){if(this.status()!==Ka.DISCONNECTED&&nc.isObject(e)&&nc.isFunction(e.onFailed))return void e.onFailed({code:408,content:"It is already connected, don't try again until disconnect() is called. "});this.confirmUserIdAndData(e),Qd.init();let n=this.i;Fc.preConnect(e),n.socket=new Yd(n.goeasyOptions,e),n.socket.vname=t,n.emitter=new Jd(n.socket),n.messageListener=new Zd(n.socket),Fc.postConnect()}static confirmUserIdAndData(e){if(Fc.modules.get("GIM"))nl.validateId(e.id,"id"),nl.validateObject(e.data,"data");else if("string"==typeof e.id&&e.id.length>60)throw{code:400,content:"id over max length 60"}}static e(e){this.i.emitter.emit(e)}static sendAck(e,t){this.i.socket.sendAck(e,t)}static status(){return this.i&&this.i.socket?this.i.socket.getStatus():Ka.DISCONNECTED}static on(e,t){Qd.on(e,t)}static off(e,t){Qd.off(e,t)}static offMessage(e,t){this.i.messageListener.offMessage(e,t)}static onMessage(e,t){this.i.messageListener.onMessage(e,t)}static disconnect(e){this.status()===Ka.CONNECTED||this.status()===Ka.RECONNECTED?this.i.socket.disconnect().then((()=>{fc.onSuccess(e)})).catch((t=>{fc.onFailed(e,t)})):fc.onFailed(e,{code:408,content:"Host unreachable or timeout"})}static user(){return this.i.socket.user()}}eh.EVENT=al;class th{static getInstance(){return th.instance||(th.instance=new th),th.instance}constructor(){this.synchronized=!0,this.onlineChanged=e=>{e.online?this.teamIds.add(e.teamId):this.teamIds.delete(e.teamId)},this.onDisconnected=()=>{this.queryMyTeamPromise=null,this.teamIds=null},this.onConnected=()=>{this.synchronized&&(this.queryMyTeamPromise=this.queryTeams())},eh.on(eh.EVENT.LOST,this.onDisconnected),eh.on(eh.EVENT.RECONNECTED,this.onConnected),eh.onMessage(rl.CS_ONLINE_CHANGED,this.onlineChanged)}queryTeams(){return this.queryMyTeamPromise||(this.queryMyTeamPromise=new Promise(((e,t)=>{let n=new Yc({name:pc.CS_MY_TEAMS,params:{},permission:Jc.READ,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,fail:e=>{t(e)},success:t=>{this.teamIds=new Set(t.content),this.synchronized=!0,e(this.teamIds)}});Kc.Socket.e(n)}))),this.queryMyTeamPromise}myTeams(){if(this.synchronized&&this.queryMyTeamPromise)return this.teamIds;throw"please query team first."}isOnline(e,t){return mc(this,void 0,void 0,(function*(){yield this.queryTeams(),fc.onSuccess(t,this.teamIds.has(e))}))}online(e,t){if(!nc.isObject(t.agentData)||!nc.isObject(t.teamData))throw{code:400,content:"agentData and teamData require an object"};let n=new pu(e,t.teamData,t.agentData),i=new Yc({name:pc.CS_ONLINE,params:n,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:e=>{fc.onFailed(t,e)},success:n=>{this.teamIds.add(e),fc.onSuccess(t),ql.i.fire(Pl.CS_ONLINE_SUCCESS)}});Kc.Socket.e(i)}offline(e,t){let n=new du(e),i=new Yc({name:pc.CS_OFFLINE,params:n,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:e=>{fc.onFailed(t,e)},success:n=>{this.teamIds.delete(e),fc.onSuccess(t),ql.i.fire(Pl.CS_OFFLINE_SUCCESS)}});Kc.Socket.e(i)}agents(e,t){let n=new hu(e),i=new Yc({name:pc.CS_AGENTS,params:n,permission:Jc.READ,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,fail:e=>{fc.onFailed(t,e)},success:e=>{e.content.forEach((e=>{e.data=JSON.parse(e.data)})),fc.onSuccess(t,e)}});Kc.Socket.e(i)}}class nh{constructor(e){this.onMessageReceived=e=>{let t=nh.session;if(e.scene()===Ya.CS&&t.liveOptions){let n=e,i=t.liveOptions.customerId;t.teamId===n.teamId&&n.customerId()===i&&(t.tryUpdateStatus(n),t.liveOptions.onNewMessage(n))}},this.teamId=e,ql.i.on(Pl.CS_AGENT_MESSAGE_RECEIVED,this.onMessageReceived),ql.i.on(Pl.CS_ACCEPTED,this.onMessageReceived),ql.i.on(Pl.CS_ENDED,this.onMessageReceived),ql.i.on(Pl.CS_TRANSFER,this.onMessageReceived),eh.on(al.DISCONNECTED,nh.destroy)}static live(e,t){return mc(this,void 0,void 0,(function*(){let n=t.customerId;nl.validateId(n,"customerId");let i=new lu(e,n);yield th.getInstance().queryTeams();let o=new Yc({name:pc.CS_LIVE_SESSION,params:i,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:e=>{fc.onFailed(t,e)},success:n=>{nh.destroy(),this.session=new nh(e),this.session.liveOptions=t;let i=n.content.customerStatus;"ACCEPTED"===i.status&&(i.agent.data=JSON.parse(i.agent.data)),this.session.status=i,this.session.liveOptions.onStatusUpdated(this.session.status),fc.onSuccess(t)}});Kc.Socket.e(o)}))}customerId(){return this.liveOptions.customerId}static isMyCustomer(e){let t=nh.session;if(t&&t.teamId===e.teamId&&t.customerId()===e.customerId()){let n=th.getInstance().myTeams(),i=t.status.agent;return n.has(e.teamId)&&(!i||i.id===Kc.Socket.user().id)}return!0}static isMyMessage(e){let t=Kl.byIMMessage(e);return e.type===Nl.TRANSFER&&e.payload.transferTo.id===Kc.Socket.user().id||this.isMyCustomer(t)}static quit(e){let t=nh.session;if(t){let n=t.liveOptions.customerId;nl.validateId(n,"customerId");let i=new lu(t.teamId,n),o=new Yc({name:pc.CS_QUIT_LIVE,params:i,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:t=>{fc.onFailed(e,t)},success:t=>{nh.destroy(),fc.onSuccess(e)}});Kc.Socket.e(o)}}tryUpdateStatus(e){if("FREE"!==this.status.status&&this.status.sessionId>e.sessionId)return;let t;switch(e.type){case Nl.ACCEPT:t=new uu,t.status="ACCEPTED",t.start=e.payload.sessionStart,t.sessionId=e.sessionId,t.agent=new tc(e.senderId,e.senderData);break;case Nl.END:t=new uu,t.status="FREE";break;case Nl.TRANSFER:t=new uu,t.status="ACCEPTED",t.start=e.payload.sessionStart,t.sessionId=e.sessionId,t.agent=e.payload.transferTo;break;default:"FREE"===this.status.status&&(t=new uu,t.status="PENDING",t.start=e.timestamp,t.sessionId=e.sessionId)}t&&(this.status=t,this.liveOptions.onStatusUpdated(t))}}nh.destroy=()=>{let e=nh.session;e&&(ql.i.off(Pl.CS_AGENT_MESSAGE_RECEIVED,e.onMessageReceived),ql.i.off(Pl.CS_ACCEPTED,e.onMessageReceived),ql.i.off(Pl.CS_ENDED,e.onMessageReceived),ql.i.off(Pl.CS_TRANSFER,e.onMessageReceived),eh.off(al.DISCONNECTED,nh.destroy),nh.session=null)};class ih extends cu{constructor(e){super(e),this.unread=0,this.markingAmount=0}loadHistory(e,t){return mc(this,void 0,void 0,(function*(){return nc.isUndef(t)?t=10:t>30&&(t=30),yield this.loadServerMessages(e,t)}))}loadServerMessages(e,t){return mc(this,void 0,void 0,(function*(){let n=new ou(this.target.id.toString(),this.target.scene,e,t,this.target.teamId),i=yield this.remoteHistory.loadServerMessages(this.target,n);return i.userOffsets.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),i.messages}))}deleteMessages(e){return mc(this,void 0,void 0,(function*(){fc.onFailed(e,"Delete CS message is not supported yet")}))}initMaxMessageAndOffsets(e,t){t.forEach((e=>{this.userOffsets.updateOffset(e.userId,e.offset)})),(nc.isUndef(this.acceptedMaxMessage)||this.acceptedMaxMessage.timestamp{this.userOffsets.updateOffset(e.userId,e.offset)})),this.savePendingMessage(e)}savePendingMessage(e){this.pendingMaxMessage?this.pendingMaxMessage.timestampthis.userOffsets.markingTime&&e>t&&(this.userOffsets.markingTime=e,this.markingAmount=this.unread,!0)}postMark(e){e===this.userOffsets.markingTime&&(this.unread-=this.markingAmount,this.markingAmount=0,this.userOffsets.updateOffset(Kc.Socket.user().id,e),ql.i.fire(Pl.UNREAD_AMOUNT_CHANGED,this.target))}syncMarkedMessage(e){}getMaxMessage(e){return e?this.acceptedMaxMessage:this.pendingMaxMessage}unreadAmount(e){return e?this.unread:0}existsMessage(e){return this.acceptedMaxMessage&&this.acceptedMaxMessage.messageId===e.messageId||this.pendingMaxMessage&&this.pendingMaxMessage.messageId===e.messageId}maxAcceptedMessageTime(){return this.acceptedMaxMessage?this.acceptedMaxMessage.timestamp:0}maxTime(e){let t=this.getMaxMessage(e);return t?t.timestamp:0}}class oh extends cu{constructor(e){super(e)}deleteMessages(e){return mc(this,void 0,void 0,(function*(){fc.onFailed(e,"Delete CS message is not supported yet")}))}}class sh{static validateMessageArray(e){if(!nc.isArray(e)||nc.isEmpty(e))throw{code:400,content:"messages requires non empty array"};if(e.length>20)throw{code:400,content:"The maximum number of messages is 20"};let t=Kl.byIMMessage(e[0]);for(let n=0;n0){let e=Kl.byIMMessage(i);if(e.scene!==t.scene||e.id!==t.id)throw{code:400,content:"each message must be from the same friend or group"}}}}}class rh{static init(){return rh.instance=new rh,rh.instance}constructor(){this.map=new Map,this.onMessageSending=e=>{let t=Kl.byIMMessage(e);this.findOrCreateHistory(t).onMessageSending(e)},this.onMessageSendSuccess=e=>{let t=Kl.byIMMessage(e);this.findHistory(t).onMessageSendSuccess(e)},this.onMessageSendFailed=e=>{let t=Kl.byIMMessage(e);this.findHistory(t).onMessageSendFailed(e)},this.onMessageReceived=e=>{let t=Kl.byIMMessage(e),n=this.findOrCreateHistory(t);n.expiredTime>0&&(this.map.delete(t.toString()),n=this.findOrCreateHistory(t)),n.onMessageReceived(e)},this.onRemoteMarkRead=e=>{let t=Kl.byMessageReadRemoteEvent(e),n=this.findHistory(t);n&&n.syncMarkedMessage(e)},this.onRemoteMessageDeleted=e=>{let t=Kl.byIMMessageDeletedEvent(e),n=this.findHistory(t);n&&n.syncDeletedMessage(e.deleterId,e.times)},this.onMessageRecalled=e=>{let t=Kl.byConversationId(e.scene,e.conversationId),n=this.findHistory(t);n&&n.recallMessages(e)},this.onDisconnected=()=>{this.map.forEach(((e,t)=>{e.expire()}))},this.onReconnected=()=>{au.fire(Dl.HISTORY_EXPIRED)},this.destroy=()=>{},this.initialListeners()}initialListeners(){ql.i.on(Pl.MESSAGE_SENDING,this.onMessageSending),ql.i.on(Pl.MESSAGE_SEND_SUCCESS,this.onMessageSendSuccess),ql.i.on(Pl.MESSAGE_SEND_FAILED,this.onMessageSendFailed),ql.i.on(Pl.MESSAGE_RECEIVED,this.onMessageReceived),ql.i.on(Pl.CS_AGENT_MESSAGE_RECEIVED,this.onMessageReceived),ql.i.on(Pl.CS_ACCEPTED,this.onMessageReceived),ql.i.on(Pl.CS_ENDED,this.onMessageReceived),ql.i.on(Pl.CS_TRANSFER,this.onMessageReceived),ql.i.on(Pl.MESSAGE_RECALLED,this.onMessageRecalled),eh.onMessage(rl.IM_MSG_READ,this.onRemoteMarkRead),eh.onMessage(rl.IM_MSG_DELETED,this.onRemoteMessageDeleted),eh.on(eh.EVENT.LOST,this.onDisconnected),eh.on(eh.EVENT.RECONNECTED,this.onReconnected)}loadHistory(e,t){return mc(this,void 0,void 0,(function*(){let n=this.queryToTarget(e,t),i=this.findOrCreateHistory(n);i.expiredTime>0&&(this.map.delete(n.toString()),i=this.findOrCreateHistory(n));let o=yield i.loadHistory(e.lastTimestamp,e.limit);fc.onSuccess(e,{code:200,content:o})}))}queryToTarget(e,t){if(nc.isDef(e.userId))return new Kl(Ya.PRIVATE,e.userId);if(nc.isDef(e.groupId))return new Kl(Ya.GROUP,e.groupId);if(nc.isDef(e.type)){if(!Object.values(Ya).includes(e.type))throw new Error("incorrect type, must be: "+Object.values(Ya));if(nc.isUndef(e.id))throw new Error("If type is not empty, id is required.");return Ya.CS==e.type&&nc.isUndef(t)&&(t=e.id),new Kl(e.type,e.id,t)}throw new Error("incorrect query options.")}privateMarkAsRead(e){return mc(this,void 0,void 0,(function*(){if(nc.isUndef(e.userId))throw new Error("userId could not be empty.");let t=Kl.byScene(Ya.PRIVATE,e.userId);yield this.markAsRead(t,e)}))}groupMarkAsRead(e){return mc(this,void 0,void 0,(function*(){if(nc.isUndef(e.groupId))throw new Error("groupId could not be empty.");let t=Kl.byScene(Ya.GROUP,e.groupId);yield this.markAsRead(t,e)}))}markMessageAsRead(e,t){return mc(this,void 0,void 0,(function*(){if(nc.isUndef(e.id))throw new Error("id could not be empty.");if(!Object.values(Ya).includes(e.type))throw new Error("incorrect type, must be: "+Object.values(Ya));Ya.CS==e.type&&nc.isUndef(t)&&(t=e.id);let n=Kl.byScene(e.type,e.id,t);yield this.markAsRead(n,e)}))}markAsRead(e,t){return mc(this,void 0,void 0,(function*(){let n=this.findHistory(e);n&&(yield n.markRead()),fc.onSuccess(t)}))}deleteMessage(e){return mc(this,void 0,void 0,(function*(){this.validateMessageArray(e.messages),Xl.validate(e);let t=e.messages[0],n=Kl.byIMMessage(t),i=this.findHistory(n);if(!i)throw{code:400,content:"No message that could be deleted"};yield i.deleteMessages(e)}))}findOrCreateHistory(e){let t=this.findHistory(e);return t||(t=e.scene===Ya.CS?Kc.Socket.user().id===e.customerId()?new oh(e):new ih(e):new cu(e),this.map.set(e.toString(),t),t)}static get(e){return rh.instance.findOrCreateHistory(e)}findHistory(e){return this.map.get(e.toString())}validateMessageArray(e){sh.validateMessageArray(e)}}class ah{constructor(e){this.top=!1,this.data=null,this.dataLoaded=!1,this.target=e}toDto(){let e=this.target.scene,t=this.target.id,n=new ec;return e===Ya.PRIVATE?n.userId=t:e===Ya.GROUP?n.groupId=t:e===Ya.CS&&(n.id=this.target.teamId),n.type=e,n.lastMessage=this.getMaxMessage(),n.unread=this.getUnreadAmount(),n.top=this.top,n.data=this.data,n}getMaxMessage(){return rh.get(this.target).getMaxMessage()}getUnreadAmount(){return rh.get(this.target).unreadAmount()}maxMessageTime(){return rh.get(this.target).maxTime()}}class ch extends ah{constructor(e){super(e),this.accepted=!1}toDto(){let e=new ec,t=this.target.scene,n=this.target.id,i=this.target.teamId;return e.id=n,e.teamId=i,e.type=t,e.lastMessage=this.getMaxMessage(),e.unread=this.getUnreadAmount(),e.top=this.top,e.data=this.data,e.ended=this.isEnded(),e}isEnded(){let e=this.getMaxMessage(),t=e.type,n=e.payload;return t===Nl.END||t===Nl.TRANSFER&&n.transferTo.id!==Kc.Socket.user().id}getMaxMessage(){return rh.get(this.target).getMaxMessage(this.accepted)}getUnreadAmount(){return rh.get(this.target).unreadAmount(this.accepted)}maxMessageTime(){return rh.get(this.target).maxTime(this.accepted)}}class lh{constructor(e,t,n,i){this.type=e,this.top=t,this.targetId=n,this.teamId=i}}class uh{constructor(e,t,n){this.type=e,this.targetId=t,this.teamId=n}}class ph{constructor(e,t,n){this.type=e,this.targetId=t,this.teamId=n}}class dh{top(e,t){let n=new lh(e.scene,t,e.id,e.teamId);return new Promise(((e,t)=>{let i=new Yc({name:pc.topConversation,params:n,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,success:n=>{200===n.code?e(n):t(n)},fail:e=>{t(e)}});Kc.Socket.e(i)}))}remove(e){let t=new uh(e.scene,e.id,e.teamId);return new Promise(((e,n)=>{let i=new Yc({name:pc.removeConversation,params:t,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,success:t=>{200==t.code?e(t):n(t)},fail:e=>{n(e)}});Kc.Socket.e(i)}))}query(e){return new Promise(((t,n)=>{let i=new Yc({name:e,params:{},permission:Jc.READ,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,fail:e=>{n(e)},success:e=>mc(this,void 0,void 0,(function*(){t(e)}))});Kc.Socket.e(i)}))}loadData(e){let t=new ph(e.scene,e.id,e.teamId);return new Promise(((e,n)=>{let i=new Yc({name:pc.imData,params:t,permission:Jc.READ,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,success:t=>{let n=JSON.parse(t.content);e(n)},fail:e=>{n(e)}});Kc.Socket.e(i)}))}}dh.instance=new dh;class hh{constructor(){this.list=new Array,this.builder=new tu,this.remoteConversations=dh.instance,this.synchronized=!1,ql.i.on(Pl.MAX_MESSAGE_CHANGED,this.onMaxMessageChanged.bind(this)),ql.i.on(Pl.UNREAD_AMOUNT_CHANGED,this.onUnreadMessageChanged.bind(this)),ql.i.on(Pl.MAX_MESSAGE_DELETED,this.onMaxMessageDeleted.bind(this))}onUnreadMessageChanged(e){this.findConversation(e)&&this.fireUpdated()}fireUpdated(){this.debounce(this.triggerUpdate.bind(this))}triggerUpdate(){let e=this.loadLocalConversations(),t=this.getUpdatedEventName();au.fire(t,{unreadTotal:e.content.unreadTotal,conversations:e.content.conversations})}getUpdatedEventName(){return Dl.CONVERSATIONS_UPDATED}latestConversations(e){return mc(this,void 0,void 0,(function*(){this.synchronized||(yield this.loadServerConversations());let t=this.loadLocalConversations();fc.onSuccess(e,t)}))}loadServerConversations(){return mc(this,void 0,void 0,(function*(){let e=this.rocketName(),t=yield this.remoteConversations.query(e);this.convertAbbrConversation(t.content),this.synchronized=!0}))}rocketName(){return pc.imLastConversations}convertAbbrConversation(e){let t=e;for(const n of t){let e=n.t,t=n.top,i=n.d?JSON.parse(n.d):{},o=n.userOffsets;n.lmsg.t=e;let s=n.lmsg,r=this.builder.build(s),a=Kl.byIMMessage(r),c=this.findConversation(a);nc.isUndef(c)?(c=this.buildByAbbr(n,r),this.insertOne(c)):(c.top=t,c.data=i),a.scene===Ya.GROUP&&(r.x=1),rh.get(a).initMaxMessageAndOffsets(r,o),this.correctPosition(c)}}onMaxMessageDeleted(e){this.removeConversation(e)}onMaxMessageChanged(e){return mc(this,void 0,void 0,(function*(){if(e.scene()===Ya.CS){let t=e;if(Kc.Socket.user().id!=t.customerId()&&(!1===t.accepted||t.type===Nl.ACCEPT&&t.senderId!=Kc.Socket.user().id))return}yield this.saveOrUpdateConversation(e)}))}saveOrUpdateConversation(e){return mc(this,void 0,void 0,(function*(){let t=e.status,n=Kl.byIMMessage(e),i=this.findConversation(n);nc.isUndef(i)&&t!==Za.FAIL&&(i=this.buildByMessage(e),this.insertOne(i),t===Za.SUCCESS&&(i.data=yield this.remoteConversations.loadData(n),i.dataLoaded=!0)),t===Za.SENDING&&(i.data=e.getToData(),i.dataLoaded=!0),i&&i.dataLoaded&&(this.correctPosition(i),this.fireUpdated())}))}debounce(e){clearTimeout(this.timer),this.timer=setTimeout((()=>{e()}),500)}loadLocalConversations(){let e=0,t=new Array;for(const n of this.list)if(n.dataLoaded&&n.getMaxMessage()){e+=n.getUnreadAmount();let i=n.toDto();t.push(i)}return{code:200,content:{unreadTotal:e,conversations:t}}}findConversationIndex(e){return this.list.findIndex((t=>e.toString()===t.target.toString()))}findConversation(e){let t=this.findConversationIndex(e);return this.list[t]}removeLocalConversation(e){let t=this.findConversationIndex(e.target);this.list.splice(t,1)}insertOne(e){hh.sortedInserter.insert(this.list,e),this.list.length>hh.CONVERSATIONS_MAX_LENGTH&&0===this.list[this.list.length-1].getUnreadAmount()&&this.list.pop()}correctPosition(e){this.removeLocalConversation(e),this.insertOne(e)}removeConversation(e){let t=this.findConversation(e);t&&(this.removeLocalConversation(t),this.fireUpdated())}top(e,t,n){return mc(this,void 0,void 0,(function*(){if(!nc.isBoolean(t))throw new Error("top must be boolean.");let i=this.findConversation(e);if(!i)throw new Error("conversation does not exist.");i.top!=t&&(yield this.remoteConversations.top(e,t),i.top=t,this.correctPosition(i)),this.fireUpdated(),fc.onSuccess(n)}))}remove(e,t){return mc(this,void 0,void 0,(function*(){let n=this.findConversation(e);if(!n)throw new Error("conversation does not exist.");if(n instanceof ch&&!n.isEnded())throw new Error("CS conversation can only be deleted after it ends");yield this.remoteConversations.remove(e),this.removeLocalConversation(n),this.fireUpdated(),fc.onSuccess(t)}))}buildByAbbr(e,t){let n,i=Kl.byIMMessage(t);if(e.t===Ya.CS){let e=t;Kc.Socket.user().id===e.customerId()?n=new ah(i):(n=new ch(i),n.accepted=e.accepted)}else n=new ah(i);return n.dataLoaded=!0,n.top=e.top,n.data=e.d?JSON.parse(e.d):{},n}buildByMessage(e){let t,n=Kl.byIMMessage(e);if(e.scene()===Ya.CS){let i=e;Kc.Socket.user().id===i.customerId()?t=new ah(n):(t=new ch(n),t.accepted=i.accepted)}else t=new ah(n);return t}}hh.CONVERSATIONS_MAX_LENGTH=200,hh.sortedInserter=new class extends $l{compare(e,t){let n;if(e.top==t.top){let i=e.maxMessageTime();n=t.maxMessageTime()-i}else n=e.top?-1:1;return 0===n?0:n>0?1:-1}};class fh extends Uc{static init(){return this.module=new fh,this.module.name=this.GIM_MODULE_NAME,this.initGN(),this.module}static initGN(){el.addAssembler(new class{assemble(e){let t={messageId:e.id,timestamp:e.tm,type:e.t,senderId:e.sid,toType:e.tt};return e.tt===Ya.GROUP&&(t.groupId=e.gid),t}support(e){return!!e.sid}})}postConnect(){yf.init()}static check(){if(!this.module)throw{code:400,content:"IM not initialized. Please include 'IM' in the 'modules' during GoEasy initialization."}}}fh.GIM_MODULE_NAME="GIM";class mh extends hh{constructor(){super(),this.expired=!1,ql.i.on(Pl.CS_ONLINE_SUCCESS,this.onCSOnlineSuccess.bind(this)),ql.i.on(Pl.CS_OFFLINE_SUCCESS,this.onCSOfflineSuccess.bind(this)),eh.on(eh.EVENT.LOST,this.onDisconnected.bind(this)),eh.on(eh.EVENT.RECONNECTED,this.onConnected.bind(this))}onMaxMessageChanged(e){return mc(this,void 0,void 0,(function*(){if(e.scene()===Ya.CS){let t=e;if(t.customerId()!=Kc.Socket.user().id&&(!1===t.accepted||t.type===Nl.ACCEPT))if(Nl.ACCEPT===e.type){let t=Kl.byIMMessage(e);this.removeConversation(t)}else yield this.saveOrUpdateConversation(e)}}))}latestConversations(e){const t=Object.create(null,{latestConversations:{get:()=>super.latestConversations}});return mc(this,void 0,void 0,(function*(){let n=this.synchronized;yield t.latestConversations.call(this,e),this.list.length>0&&!n&&this.fireUpdated()}))}onUnreadMessageChanged(e){}onCSOnlineSuccess(){return mc(this,void 0,void 0,(function*(){yield this.loadServerConversations(),this.fireUpdated()}))}onCSOfflineSuccess(){this.list=[],this.fireUpdated()}getUpdatedEventName(){return Dl.PENDING_CONVERSATIONS_UPDATED}rocketName(){return pc.CS_PENDING_CONVERSATION}convertAbbrConversation(e){return mc(this,void 0,void 0,(function*(){let t=e;for(const e of t){e.lastMessage.t=Ya.CS;let t=e.customerData,n=e.lastMessage,i=e.userOffsets,o=t?JSON.parse(t):{},s=this.builder.build(n),r=Kl.byIMMessage(s),a=this.findConversation(r);nc.isUndef(a)&&(a=new ch(r),a.accepted=s.accepted,a.dataLoaded=!0,this.insertOne(a)),a.top=!1,a.data=o,rh.get(r).initPendingMaxMessageAndOffsets(s,i),this.correctPosition(a)}}))}onDisconnected(){this.expired=!0}onConnected(){return mc(this,void 0,void 0,(function*(){this.expired&&fh.module&&fh.module.active&&(this.expired=!1,this.list=[],yield this.loadServerConversations(),this.fireUpdated())}))}}class gh{constructor(){this.conversations=new hh,this.pendingConversations=new mh}latestConversations(e){this.conversations.latestConversations(e)}latestPendingConversations(e){this.pendingConversations.latestConversations(e)}topPrivateConversation(e){let t=Kl.byScene(Ya.PRIVATE,e.userId);this.conversations.top(t,e.top,e)}topGroupConversation(e){let t=Kl.byScene(Ya.GROUP,e.groupId);this.conversations.top(t,e.top,e)}topConversation(e){let t=e.conversation;this.validateConversationDTO(t);let n=Kl.byConversationDTO(t);this.conversations.top(n,e.top,e)}removePrivateConversation(e){let t=Kl.byScene(Ya.PRIVATE,e.userId);this.conversations.remove(t,e)}removeGroupConversation(e){let t=Kl.byScene(Ya.GROUP,e.groupId);this.conversations.remove(t,e)}removeConversation(e){let t=e.conversation;this.validateConversationDTO(t);let n=Kl.byConversationDTO(t);this.conversations.remove(n,e)}validateConversationDTO(e){if(!(e instanceof ec))throw new Error("Incorrect conversation object.");{let t=e.lastMessage;if(t instanceof eu&&t.customerId()!==Kc.Socket.user().id&&!1===t.accepted)throw new Error("pending conversation cannot be topped or removed.")}}}class vh{constructor(){this.builder=new tu,Kc.Socket.onMessage(rl.imMessage,this.onMessageReceived.bind(this))}onMessageReceived(e){if(e.t!==Ya.CS){let t=this.builder.build(e);this.sendAck(t);let n=Kl.byIMMessage(t),i=n.scene;rh.get(n).existsMessage(t)||(this.createNotification(e),ql.i.fire(Pl.MESSAGE_RECEIVED,t),i===Ya.PRIVATE?au.fire(Dl.PRIVATE_MESSAGE_RECEIVED,t):i===Ya.GROUP&&au.fire(Dl.GROUP_MESSAGE_RECEIVED,t))}}sendAck(e){Kc.Socket.sendAck("imAck",{publishGuid:e.messageId})}createNotification(e){const t=Kc.N.supportAppNotification();if(!nc.isObject(e.nt)||e.s===Kc.Socket.user().id||!t)return;let n={id:e.i,tm:e.ts,t:e.mt,sid:e.s,tt:e.t};n.tt===Ya.GROUP&&(n.gid=e.r),Kc.N.createLocalNotification(e.nt.t,e.nt.c,n,e.nt.sound,e.nt.badge)}}class yh{constructor(){this.subscribedGroups=[],Kc.Socket.on(al.EXPIRED_RECONNECTED,this.expiredResubscribeGroups.bind(this))}expiredResubscribeGroups(){this.subscribedGroups.forEach((e=>mc(this,void 0,void 0,(function*(){yield this.doSubscribeGroup(e)}))))}subscribe(e){let t=e.groupIds;nl.validateIdArray(t,"groupIds");let n=new bh(t,e.accessToken);this.doSubscribeGroup(n).then((()=>{this.subscribedGroups.push(n),fc.onSuccess(e,{code:200,content:"ok"})})).catch((t=>{fc.onFailed(e,{code:t.resultCode||408,content:t.content||"Failed to subscribe group message"})}))}doSubscribeGroup(e){return new Promise(((t,n)=>{let i=e.groupIds.toString().split(","),o=new Yc({name:pc.subscribeGroups,params:{groupIds:i,at:e.accessToken},permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,success:()=>{t()},fail:e=>{n(e)}});Kc.Socket.e(o)}))}unsubscribe(e){nl.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t=new Yc({name:pc.unsubscribeGroup,params:{groupId:e.groupId},permission:Jc.READ,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,success:()=>{this.deleteSubscriptionByGroupId(e.groupId),fc.onSuccess(e,{code:200,content:"ok"})},fail:t=>{fc.onFailed(e,{code:t.resultCode||408,content:t.content||"Failed to unsubscribe group message"})}});Kc.Socket.e(t)}deleteSubscriptionByGroupId(e){this.subscribedGroups=this.subscribedGroups.filter((t=>{const n=t.groupIds.findIndex((t=>t==e));return n>-1&&t.groupIds.splice(n,1),t.groupIds.length>0}))}}class bh{constructor(e,t){this.groupIds=e,this.accessToken=t}}class xh{constructor(){this.newMessageReceived=e=>{let t=null;e.c&&(t=JSON.parse(e.c)),t&&t.events&&t.events.map((e=>{let n=e.userData?JSON.parse(e.userData):{},i={time:e.time,action:e.action,groupOnlineCount:t.userAmount,groupId:t.groupId,id:e.userId,data:n};au.fire(Dl.GROUP_PRESENCE,i)}))},eh.onMessage(rl.groupPresence,this.newMessageReceived)}presence(e){nl.validateIdArray(e.groupIds,"groupIds"),e.groupIds.toString().split(",");let t={groupIds:e.groupIds};this.emitRocket(pc.subscribeGroupPresence,t,(()=>{fc.onSuccess(e,{code:200,content:"ok"})}),(t=>{fc.onFailed(e,{code:t.code||408,content:t.content||"Failed to subscribe group message"})}),dc.commonRequestSingle,dc.commonRequestTotal)}unPresence(e){nl.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t={groupId:e.groupId};this.emitRocket(pc.unsubscribeGroupPresence,t,(()=>{fc.onSuccess(e,{code:200,content:"ok"})}),(t=>{fc.onFailed(e,{code:t.code||408,content:t.content||"Failed to unsubscribe presence"})}),dc.commonRequestSingle,dc.commonRequestTotal)}emitRocket(e,t,n,i,o,s){let r=new Yc({name:e,params:t,singleTimeout:o,totalTimeout:s,permission:Jc.WRITE,success:n,fail:i});Kc.Socket.e(r)}}class Sh{get(e){nl.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t=new Yc({name:pc.imGroupOnlineCount,params:{groupId:e.groupId},permission:Jc.READ,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,fail:function(t){fc.onFailed(e,t||{code:408,content:"Failed to query online group users"})},success:function(t){200==t.code?fc.onSuccess(e,t):fc.onFailed(e,t)}});Kc.Socket.e(t)}}class kh{doHereNow(e,t,n){let i=new Yc({name:e,params:t,permission:Jc.READ,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,fail:e=>{fc.onFailed(n,e)},success:e=>{let t=e.content;e.content=t.map((e=>{let t=e.userData?JSON.parse(e.userData):{};return{id:e.userId,data:t}})),fc.onSuccess(n,e)}});Kc.Socket.e(i)}}class Ch extends kh{hereNow(e){nl.validateId(e.groupId,"groupId"),e.groupId=e.groupId.toString();let t={groupId:e.groupId};this.doHereNow(pc.imGroupHereNow,t,e)}}class wh{constructor(){this.newMessageReceived=e=>{let t=[];e.c&&(t=JSON.parse(e.c).events||[]),t.map((e=>{let t=e.userData?JSON.parse(e.userData):{},n={time:e.time,action:e.action,id:e.userId,data:t};au.fire(Dl.USER_PRESENCE,n)}))},eh.onMessage(rl.userPresence,this.newMessageReceived)}presence(e){nl.validateIdArray(e.userIds,"userIds"),e.userIds.toString().split(",");let t={userIds:e.userIds};this.emitRocket(pc.subscribeUserPresence,t,(()=>{fc.onSuccess(e,{code:200,content:"ok"})}),(t=>{fc.onFailed(e,{code:t.code||408,content:t.content||"Failed to subscribe group message"})}),dc.commonRequestSingle,dc.commonRequestTotal)}unPresence(e){nl.validateId(e.userId,"userId"),e.userId=e.userId.toString();let t={userId:e.userId};this.emitRocket(pc.unsubscribeUserPresence,t,(()=>{fc.onSuccess(e,{code:200,content:"ok"})}),(t=>{fc.onFailed(e,{code:t.code||408,content:t.content||"Failed to unsubscribe presence"})}),dc.commonRequestSingle,dc.commonRequestTotal)}emitRocket(e,t,n,i,o,s){let r=new Yc({name:e,params:t,singleTimeout:o,totalTimeout:s,permission:Jc.WRITE,success:n,fail:i});Kc.Socket.e(r)}}class Eh extends kh{hereNow(e){let t=e.userIds;nl.validateIdArray(t,"userIds"),t.toString().split(","),this.doHereNow(pc.imHereNow,e,e)}}const Th=new class{fileExtension(e,t){if(nc.isString(e))try{let n=e.split(t);return n[n.length-1]}catch(n){throw Error(n)}}};class Ih{}class _h extends Ih{constructor(){super(...arguments),this.contentType="",this.name="",this.size=0,this.url=""}}class Oh extends _h{constructor(){super(...arguments),this.width=0,this.height=0}}class Ah{build(e){this.validate(e.createOptions);let t=this.create();return this.setPayload(e,t),t}}class Rh extends Ah{create(){return new _h}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.name=i.name,n.size=i.size,n.contentType=i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Ph extends Rh{create(){return new Oh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=n.path||n.tempFilePath,s=nc.isEmpty(n.name)||void 0===n.name?o:n.name;i.name="wx-image."+Th.fileExtension(s,"."),i.contentType="image/"+Th.fileExtension(s,"."),i.url=o,i.size=n.size,e.complete=new Promise(((e,t)=>{Mn.getImageInfo({src:i.url,success(t){i.width=t.width,i.height=t.height,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Mh extends _h{constructor(){super(...arguments),this.duration=0}}class Nh extends Rh{create(){return new Mh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=n.tempFilePath,s=nc.isEmpty(n.name)||null==n.name?o:n.name,r=n.duration,a=n.fileSize;i.url=o,i.size=a,i.duration=r/1e3,i.name="wx-audio."+Th.fileExtension(s,"."),i.contentType="audio/"+Th.fileExtension(s,"."),e.complete=Promise.resolve()}validate(e){super.validate(e)}}class Dh extends Ih{constructor(){super(...arguments),this.text=""}}class Bh extends Ah{create(){return new Dh}setPayload(e,t){let n=t,i=e.createOptions;n.text=i.text,e.complete=Promise.resolve()}validate(e){if(nc.isEmpty(e.text))throw{code:400,content:"text is empty"};if(!nc.isString(e.text))throw{code:400,content:"TypeError: text requires string."};if(""===e.text.trim())throw{code:400,content:"text is empty"};if(e.text.length>2500)throw{code:400,content:"Message text over max length 2500"}}}class Lh extends Ih{constructor(){super(...arguments),this.video=new Uh,this.thumbnail=new jh}}class jh{constructor(){this.name="",this.url="",this.width=0,this.height=0,this.contentType=""}initURL(e){oc.currentPlatform()===ic.BROWSER&&this.htmlUrl(e)}htmlUrl(e){let t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),this.url=t.toDataURL("image/png")}}class Uh{constructor(){this.name="",this.url="",this.width=0,this.height=0,this.contentType="",this.size=0,this.duration=0}}class Fh extends Ah{create(){return new Lh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:r,height:a,size:c,tempFilePath:l,thumbTempFilePath:u,width:p,name:d=""}=n,h=nc.isEmpty(d)?l:d;o.contentType="video/"+Th.fileExtension(h,"."),o.name="wx-video."+Th.fileExtension(h,"."),o.url=l,o.width=s.width=p,o.height=s.height=a,o.size=c,o.duration=r,s.url=u,s.contentType="image/jpg",s.name="wx-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Gh extends Ah{create(){return new _h}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.fullPath||i.path,n.name=i.name,n.size=i.size,n.contentType=i.type,i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class qh extends Gh{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size;let o=nc.isEmpty(i.name)||void 0===i.name?i.path:i.name;n.contentType="image/"+Th.fileExtension(o,"."),n.name="uni-image."+Th.fileExtension(o,"."),e.complete=new Promise(((e,t)=>{Nn.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class zh extends Gh{create(){return new Mh}setPayload(e,t){let n=e.createOptions,i=t,o=n.file,s=o.tempFilePath,r=nc.isEmpty(o.name)||null==o.name?s:o.name;i.url=s,i.name="uni-audio."+Th.fileExtension(r,"."),i.contentType="audio/"+Th.fileExtension(r,"."),e.complete=new Promise(((e,t)=>{Nn.getFileInfo({filePath:s,success:o=>{let r=o.size;if(i.size=r,0===r)e();else if(nc.isDef(n.file.duration))i.duration=n.file.duration/1e3,e();else{const n=Nn.createInnerAudioContext();n.src=s,n.onCanplay((function(o){o.errCode?(n.destroy(),t(o)):(i.duration=n.duration,n.destroy(),e())})),n.onError((i=>{n.destroy(),-99===i.errCode?e():t(i)}))}},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Hh extends Ah{create(){return new Lh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:r,height:a,size:c,tempFilePath:l,width:u,name:p=""}=n,d=nc.isEmpty(p)?l:p;o.size=c,o.width=u,o.height=a,o.url=l,o.duration=r,o.contentType="video/"+Th.fileExtension(d,"."),o.name="uni-video."+Th.fileExtension(d,"."),s.url=l,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",s.name="uni-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class $h extends Ah{create(){return new _h}setPayload(e,t){let n=t,i=e.createOptions.file,o=window.URL||window.webkitURL;n.url=o.createObjectURL(i),n.name=i.name,n.size=i.size,n.contentType=i.type,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!(e.file instanceof File))throw Error("wrong file type.");if(0==e.file.size)throw Error("File size is 0.");if(e.file.size>524288e3)throw Error("message-length limit 30mib")}}class Vh extends $h{create(){return new Oh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=window.URL||window.webkitURL,s=new Image;s.src=o.createObjectURL(n),e.complete=new Promise(((e,t)=>{s.onload=function(){i.width=s.width,i.height=s.height,o.revokeObjectURL(s.src),e()},s.onerror=function(e){o.revokeObjectURL(s.src),t(e)}}))}validate(e){super.validate(e);let t=["gif","jpg","png","jpeg"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported image.")}}class Kh extends $h{create(){return new Mh}setPayload(e,t){super.setPayload(e,t);let n=e.createOptions.file,i=t,o=window.URL||window.webkitURL,s=document.createElement("audio");s.src=o.createObjectURL(n),e.complete=new Promise(((e,t)=>{s.onloadedmetadata=()=>{i.duration=s.duration,o.revokeObjectURL(s.src),e()},s.onerror=e=>{o.revokeObjectURL(s.src),t(e)}}))}validate(e){super.validate(e);let t=["mp3","ogg","wav","wma","ape","acc","mpeg"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported audio.")}}class Wh extends Ah{create(){return new Lh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,r=window.URL||window.webkitURL,a=document.createElement("video");a.src=r.createObjectURL(n),o.size=n.size,o.name=n.name,o.contentType=n.type,o.url=a.src,s.name=n.name,s.contentType="image/jpg",e.complete=new Promise(((e,t)=>{a.onloadedmetadata=()=>{o.duration=a.duration,o.width=a.videoWidth,o.height=a.videoHeight,s.width=a.videoWidth,s.height=a.videoHeight,s.url=this.getThumbnailUrl(a),r.revokeObjectURL(a.src),e()},a.onerror=function(e){r.revokeObjectURL(a.src),t(e)}}))}getThumbnailUrl(e){let t=document.createElement("canvas");return t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),t.toDataURL("image/png")}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!(e.file instanceof File))throw Error("wrong file type.");if(0==e.file.size)throw Error("File size is 0.");if(e.file.size>31457280)throw Error("message-length limit 30mib");let t=["avi","mov","rmvb","rm","flv","mp4","3gp","quicktime"];if(!t.find((t=>t===e.file.type.split("/")[1].toLowerCase())))throw Error("Only "+t.join(",")+" is supported video.")}}class Xh extends Ah{create(){return new Lh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:r,height:a,size:c,tempFilePath:l,tempVideoThumbPath:u,width:p}=n;o.size=c,o.width=p,o.height=a,o.url=l,o.duration=r,o.contentType="video/mp4",o.name="ali-video.mp4",s.url=u,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",s.name="ali-thumbnail.jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Jh extends Ah{create(){return new _h}setPayload(e,t){e.complete=Promise.reject("Alipay not support file message.")}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class Qh extends Jh{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size,e.complete=new Promise(((e,t)=>{my.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,n.contentType="image/"+t.type,n.name="ali-image."+t.type,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class Yh extends Jh{create(){return new Mh}setPayload(e,t){let n=t,i=e.createOptions.file,o=i.tempFilePath;n.url=o,n.name="ali-audio."+Th.fileExtension(o,"."),n.contentType="audio/"+Th.fileExtension(o,"."),n.duration=i.duration,n.size=i.fileSize,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class Zh extends Ah{create(){return new Lh}setPayload(e,t){let n=e.createOptions.file,i=t,o=i.video,s=i.thumbnail,{duration:r,height:a,size:c,tempFilePath:l,thumbTempFilePath:u,width:p}=n;o.size=c,o.width=p,o.height=a,o.url=l,o.duration=r,o.contentType="video/"+Th.fileExtension(l,"."),o.name="baidu-video."+Th.fileExtension(l,"."),s.url=u,s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/"+Th.fileExtension(u,"."),s.name="baidu-thumbnail."+Th.fileExtension(l,"."),e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class ef extends Ah{create(){return new _h}setPayload(e,t){e.complete=Promise.reject("Baidu app not support file message.")}validate(e){}}class tf extends ef{create(){return new Mh}setPayload(e,t){let n=t,i=e.createOptions.file,o=i.tempFilePath;n.url=o,n.name="baidu-audio."+Th.fileExtension(o,"."),n.contentType="audio/"+Th.fileExtension(o,"."),n.duration=i.duration/1e3,n.size=i.fileSize,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class nf extends ef{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;n.url=i.path,n.size=i.size,e.complete=new Promise(((e,t)=>{swan.getImageInfo({src:i.path,success(t){n.width=t.width,n.height=t.height,n.contentType="image/"+t.type,n.name="baidu-image."+t.type,e()},fail(e){t(e)}})}))}validate(e){super.validate(e)}}class of extends Ah{create(){return new _h}setPayload(e,t){let n=t,i=e.createOptions.file;const{uri:o,type:s,size:r,name:a}=i;n.url=decodeURIComponent(o),n.name=a,n.size=r,n.contentType=s,e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class sf extends of{create(){return new Oh}setPayload(e,t){let n=t,i=e.createOptions.file;const{uri:o,fileSize:s,type:r,fileName:a,width:c,height:l}=i;n.url=o,n.size=s,n.contentType=r,n.name=a,n.width=c,n.height=l,e.complete=Promise.resolve()}validate(e){super.validate(e)}}class rf extends Ah{create(){return new Lh}setPayload(e,t){let n=e.createOptions.file;const i=t,{video:o,thumbnail:s}=i,{uri:r,type:a,fileSize:c,fileName:l,duration:u,height:p,width:d}=n;o.size=c,o.width=d,o.height=p,o.url=r,o.duration=u,o.contentType=a,o.name=l,s.url=r,s.name="rn-thumbnail.jpg",s.height=200,s.width=Number((o.width*s.height/o.height).toFixed(0)),s.contentType="image/jpg",e.complete=Promise.resolve()}validate(e){if(!nc.isObject(e))throw Error("it is an empty message.");if(!nc.isDef(e.file))throw Error("file is empty.")}}class af extends of{create(){return new Mh}setPayload(e,t){let n=e.createOptions,i=t,o=n.file;const{uri:s,name:r,duration:a,size:c}=o;i.url=s,i.duration=Number((a/1e3).toFixed(2)),i.size=c,i.name=r||"rn-audio."+Th.fileExtension(s,"."),i.contentType="audio/"+Th.fileExtension(s,"."),n.file={uri:s,type:i.contentType,name:i.name},e.complete=Promise.resolve()}validate(e){super.validate(e)}}class cf extends Ih{}class lf extends Ah{create(){return new cf}setPayload(e,t){let n=e.createOptions;t.payload=n.payload,e.complete=Promise.resolve()}validate(e){let t=e.type,n=e.payload;if(nc.isEmpty(t))throw Error("type is empty.");if(!nc.isString(t))throw Error("type require a string");if(nc.isEmpty(n))throw Error("payload is empty.");if(!nc.isPlainObject(n)&&!nc.isStringOrNumber(n))throw Error("payload require object | string | number.")}}class uf{constructor(e,t){this.type=e,this.createOptions=t}}class pf{constructor(){this.framework=Xa.currentFramework(),this.platform=oc.currentPlatform(),this.payloadBuilders={[Va.UNIAPP]:{image:new qh,file:new Gh,audio:new zh,video:new Hh,text:new Bh},[ic.MP_WX]:{image:new Ph,file:new Rh,audio:new Nh,video:new Fh,text:new Bh},[ic.BROWSER]:{image:new Vh,file:new $h,audio:new Kh,video:new Wh,text:new Bh},[ic.MP_ALI]:{image:new Qh,file:new Jh,audio:new Yh,video:new Xh,text:new Bh},[ic.MP_BAIDU]:{image:new nf,file:new ef,audio:new tf,video:new Zh,text:new Bh},[Va.REACT_NATIVE]:{image:new sf,file:new of,audio:new af,video:new rf,text:new Bh},[ic.MP_BYTE]:{image:new Ph,file:new Rh,audio:new Nh,video:new Fh,text:new Bh}}}buildMessage(e,t){const n=this.framework===Va.UNKNOWN?this.platform:this.framework;let i=this.payloadBuilders[n][e],o=new uf(e,t);if(i){let e=i.build(o);o.payload=e}else{let e=(new lf).build(o);o.payload=e.payload}let s=this.build(o);return o.complete.then((()=>{fc.onSuccess(t,s)})).catch((e=>{fc.onFailed(t,e)})),s}build(e){let t,n=e.type,i=e.payload,o=e.createOptions,s=o.to,r=s.type;return this.validate(o),r===Ya.GROUP?(t=new Zl,t.groupId=s.id.toString(),t.senderData=Kc.Socket.user().data):r===Ya.PRIVATE?(t=new Yl,t.read=!1,t.receiverId=s.id.toString()):r===Ya.CS&&(t=new eu,t.to=s.id.toString(),t.teamId=s.id.toString(),t.senderData=Kc.Socket.user().data),t.senderId=Kc.Socket.user().id,t.messageId=Xc.get(),t.payload=i,t.timestamp=Date.now(),t.type=n,t.recalled=!1,t.status=Za.NEW,t.buildOptions=e,t}validate(e){const t=e.to;if(!t)throw new Error("message require property to.");if(!nc.isObject(t))throw new Error("TypeError: to requires an object.");if(!nc.isObject(t.data))throw new Error("TypeError: to.data requires an object.");if(!t.type||t.type!==Ya.GROUP&&t.type!==Ya.PRIVATE&&t.type!==Ya.CS)throw new Error("message require property to.type");if(nl.validateId(t.id,"to.id"),Kc.Socket.user().id===t.id)throw new Error("to.id can not be the same as your id.");nc.isDef(e.notification)&&nl.validateNotification(e.notification),e.wxmpTemplateMsg&&nl.validateWXMPTemplateMsg(e.wxmpTemplateMsg)}}class df extends vh{onMessageReceived(e){if(e.t===Ya.CS){let t=this.builder.build(e);this.sendAck(t);let n=Kl.byIMMessage(t);rh.get(n).existsMessage(t)||(t.customerId()===Kc.Socket.user().id?(this.createNotification(e),ql.i.fire(Pl.MESSAGE_RECEIVED,t),au.fire(Dl.CS_MESSAGE_RECEIVED,t)):th.getInstance().queryTeams().then((()=>{nh.isMyMessage(t)&&this.createNotification(e),ql.i.fire(Pl.CS_AGENT_MESSAGE_RECEIVED,t)})))}}}class hf{constructor(e){this.times=new Array;let t=e[0],n=Kl.byIMMessage(t);this.scene=n.scene,this.targetId=n.id,e.forEach((e=>{this.times.push(e.timestamp)})),this.times.sort(((e,t)=>e{ql.i.fire(Pl.MESSAGE_RECALLED,e)},eh.onMessage(rl.IM_MSG_RECALLED,this.onRemoteRecalled)}recallMessage(e){return mc(this,void 0,void 0,(function*(){sh.validateMessageArray(e.messages),this.validate(e);let t=e.messages;yield this.recallServerMessages(t);let n=t[0],i=n.scene(),o=this.toConversationId(i,n.senderId,n.targetId()),s={id:Kc.Socket.user().id,data:Kc.Socket.user().data},r=t.map((e=>e.timestamp)),a=new ru(i,o,s,r);ql.i.fire(Pl.MESSAGE_RECALLED,a),fc.onSuccess(e)}))}toConversationId(e,t,n){if(Ya.PRIVATE===e)return o=n,(i=t).localeCompare(o)>0?`${i}:${o}`:`${o}:${i}`;var i,o;if(Ya.GROUP===e)return n;throw{code:400,content:`scene: ${e} not support`}}recallServerMessages(e){let t=new hf(e);return 0===t.times.length?Promise.resolve():new Promise(((e,n)=>{let i=new Yc({name:pc.IM_RECALL_MESSAGE,params:t,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:e=>{n(e)},success:t=>{200===t.code?e(t):n(t)}});Kc.Socket.e(i)}))}validate(e){let t=e.messages;for(let n=0;n{let i=this.dataCache.getData(e);i?n.set(e,i):t.push(e)})),0===t.length||(yield this.fetchData(...t)).forEach(((e,t)=>{this.dataCache.setData(t,e),n.set(t,e)})),Promise.resolve(n)}))}fetchData(...e){return new Promise(((t,n)=>{let i=new Yc({name:pc.MD_CMD,permission:Jc.READ,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,params:{name:"GET",data:{ids:e}},success:e=>{if(200===e.code){const n=new Map;e.content.forEach((e=>{n.set(e.id,e.data)})),t(n)}else n(e)},fail:e=>{n(e)}});Kc.Socket.e(i)}))}setData(e,t){this.dataCache.setData(e,t)}}class vf{constructor(){ql.i.on(Pl.MESSAGE_RECEIVED,this.onMessageReceived),ql.i.on(Pl.MESSAGE_SENDING,this.onMessageSending)}onMessageSending(e){let t=Kl.byIMMessage(e);t.scene===Ya.PRIVATE&&gf.i.setData(t.id,e.getToData())}onMessageReceived(e){if(Kl.byIMMessage(e).scene===Ya.GROUP){let t=e;gf.i.setData(t.senderId,t.senderData)}}}class yf{constructor(){this._iMReceiver=new vh,this.csMessageReceiver=new df,this.memberDataUpdator=new vf,this._userHereNow=new Eh,this.goEasyUploader=new Rl,this._groupHereNow=new Ch,this._groupOnlineCount=new Sh,this.groupMessageSubscriber=new yh,this.messageBuilder=new pf,this.messageSender=new Hl,this.recaller=new ff,this._groupPresenceSubscriber=new xh,this._userPresenceSubscriber=new wh,this.conversations=new gh,this.histories=rh.init()}static init(){ql.init(),au.init(),yf.instance=new yf}static i(){if(yf.instance)return yf.instance;throw Error("Please connect first.")}validateModules(){if(eh.status()===Ka.DISCONNECTED)throw Error("Please call connect() first.");fh.check()}catch(e,t){return mc(this,void 0,void 0,(function*(){try{this.validateModules(),nl.validateCallbackOptions(t),yield e()}catch(n){fc.onFailed(t,n)}}))}on(e,t){au.on(e,t)}off(e,t){au.off(e,t)}createTextMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Ml.TEXT,e)}createImageMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Ml.IMAGE,e)}createFileMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Ml.FILE,e)}createAudioMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Ml.AUDIO,e)}createVideoMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(Ml.VIDEO,e)}createCustomMessage(e){return this.validateModules(),this.messageBuilder.buildMessage(e.type,e)}sendMessage(e){this.catch((()=>{this.messageSender.send(e)}),e)}recallMessage(e){this.catch((()=>{this.recaller.recallMessage(e)}),e)}deleteMessage(e){this.catch((()=>{this.histories.deleteMessage(e)}),e)}markGroupMessageAsRead(e){this.catch((()=>mc(this,void 0,void 0,(function*(){yield this.histories.groupMarkAsRead(e)}))),e)}markPrivateMessageAsRead(e){this.catch((()=>mc(this,void 0,void 0,(function*(){yield this.histories.privateMarkAsRead(e)}))),e)}markMessageAsRead(e,t){this.catch((()=>mc(this,void 0,void 0,(function*(){yield this.histories.markMessageAsRead(e,t)}))),e)}latestConversations(e){this.validateModules(),this.conversations.latestConversations(e)}removePrivateConversation(e){this.catch((()=>this.conversations.removePrivateConversation(e)),e)}removeGroupConversation(e){this.catch((()=>this.conversations.removeGroupConversation(e)),e)}topPrivateConversation(e){this.catch((()=>this.conversations.topPrivateConversation(e)),e)}topGroupConversation(e){this.catch((()=>this.conversations.topGroupConversation(e)),e)}history(e,t){this.catch((()=>{this.histories.loadHistory(e,t)}),e)}subscribeUserPresence(e){this.catch((()=>this._userPresenceSubscriber.presence(e)),e)}unsubscribeUserPresence(e){this.catch((()=>this._userPresenceSubscriber.unPresence(e)),e)}hereNow(e){this.catch((()=>this._userHereNow.hereNow(e)),e)}subscribeGroup(e){this.catch((()=>this.groupMessageSubscriber.subscribe(e)),e)}unsubscribeGroup(e){this.catch((()=>this.groupMessageSubscriber.unsubscribe(e)),e)}subscribeGroupPresence(e){this.catch((()=>this._groupPresenceSubscriber.presence(e)),e)}unsubscribeGroupPresence(e){this.catch((()=>this._groupPresenceSubscriber.unPresence(e)),e)}groupHereNow(e){this.catch((()=>this._groupHereNow.hereNow(e)),e)}groupOnlineCount(e){this.catch((()=>this._groupOnlineCount.get(e)),e)}latestPendingConversations(e){this.validateModules(),this.conversations.latestPendingConversations(e)}topConversation(e){this.validateModules(),this.conversations.topConversation(e)}removeConversation(e){this.validateModules(),this.conversations.removeConversation(e)}}class bf{constructor(e,t){this.customerId=e,this.teamId=t}}class xf{constructor(e,t){this.teamId=e;let n=new tc(t.id.toString(),JSON.stringify(t.data));this.customer=n}}class Sf{constructor(e,t,n){this.customerId=e,this.teamId=t,this.agentId=n}}class kf{constructor(e,t){this.customerId=e,this.teamId=t}}class Cf{constructor(e){this.builder=new tu,this.teamId=e}accept(e,t){let n=t.customer;if(nc.isUndef(n))throw{code:400,content:"customer is required."};nl.validateId(n.id,"customer.id");let i=n.data;if(nc.isUndef(i)||!nc.isObject(i))throw{code:400,content:"customer data must be non-empty object."};let o=new xf(e,n),s=new Yc({name:pc.CS_ACCEPT,params:o,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:e=>{fc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);ql.i.fire(Pl.CS_ACCEPTED,n),fc.onSuccess(t)}});Kc.Socket.e(s)}end(e,t){nl.validateId(t.id,"id");let n=t.id.toString(),i=new kf(n,e),o=new Yc({name:pc.CS_END,params:i,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:e=>{fc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);ql.i.fire(Pl.CS_ENDED,n),fc.onSuccess(t)}});Kc.Socket.e(o)}queryCustomerStatus(e,t){return mc(this,void 0,void 0,(function*(){nl.validateId(t.id,"id");let n=yield this.doCustomerStatus(e,t.id);this.activeCustomerStatus=n,this.activeCustomerStatusOptions=t,fc.onSuccess(t,n)}))}doCustomerStatus(e,t){let n=t.toString(),i=new bf(n,e);return new Promise(((e,t)=>{let n=new Yc({name:pc.CS_CUSTOMER_STATUS,params:i,permission:Jc.READ,singleTimeout:dc.commonQuerySingle,totalTimeout:dc.commonQueryTotal,fail:e=>{t(e)},success:t=>{let n=t.content;n.agent&&(n.agent.data=JSON.parse(n.agent.data)),e(n)}});Kc.Socket.e(n)}))}transfer(e,t){nl.validateId(t.customerId,"customerId"),nl.validateId(t.agentId,"agentId");let n=t.customerId.toString(),i=t.agentId.toString(),o=new Sf(n,e,i),s=new Yc({name:pc.CS_TRANSFER,params:o,permission:Jc.WRITE,singleTimeout:dc.commonRequestSingle,totalTimeout:dc.commonRequestTotal,fail:e=>{fc.onFailed(t,e)},success:e=>{let n=this.builder.build(e.content.message);ql.i.fire(Pl.CS_TRANSFER,n),fc.onSuccess(t)}});Kc.Socket.e(s)}}class wf{createTextMessage(e,t){let n=yf.i().createTextMessage(t);this.extendProps(e,n)}createImageMessage(e,t){let n=yf.i().createImageMessage(t);this.extendProps(e,n)}createFileMessage(e,t){let n=yf.i().createFileMessage(t);this.extendProps(e,n)}createAudioMessage(e,t){let n=yf.i().createAudioMessage(t);this.extendProps(e,n)}createVideoMessage(e,t){let n=yf.i().createVideoMessage(t);this.extendProps(e,n)}createCustomMessage(e,t){let n=yf.i().createCustomMessage(t);this.extendProps(e,n)}extendProps(e,t){if(t.scene()===Ya.CS){let n=t;n.teamId=e,n.accepted=!0}}}class Ef{constructor(e){this.teamId=e,this.agentStatus=th.getInstance(),this.conversationHandler=new Cf(e),this.messageCreator=new wf}catch(e,t){return mc(this,void 0,void 0,(function*(){try{nl.validateCallbackOptions(t),yield e()}catch(n){fc.onFailed(t,n)}}))}isOnline(e){this.catch((()=>{this.agentStatus.isOnline(this.teamId,e)}),e)}online(e){this.catch((()=>{this.agentStatus.online(this.teamId,e)}),e)}offline(e){this.catch((()=>{this.agentStatus.offline(this.teamId,e)}),e)}customerStatus(e){this.catch((()=>{this.conversationHandler.queryCustomerStatus(this.teamId,e)}),e)}accept(e){this.catch((()=>{this.conversationHandler.accept(this.teamId,e)}),e)}end(e){this.catch((()=>{this.conversationHandler.end(this.teamId,e)}),e)}history(e){yf.i().history(e,this.teamId)}markMessageAsRead(e){yf.i().markMessageAsRead(e,this.teamId)}createTextMessage(e){this.messageCreator.createTextMessage(this.teamId,e)}createImageMessage(e){this.messageCreator.createImageMessage(this.teamId,e)}createFileMessage(e){this.messageCreator.createFileMessage(this.teamId,e)}createAudioMessage(e){this.messageCreator.createAudioMessage(this.teamId,e)}createVideoMessage(e){this.messageCreator.createVideoMessage(this.teamId,e)}createCustomMessage(e){this.messageCreator.createCustomMessage(this.teamId,e)}transfer(e){this.catch((()=>{this.conversationHandler.transfer(this.teamId,e)}),e)}agents(e){this.catch((()=>{this.agentStatus.agents(this.teamId,e)}),e)}liveSession(e){this.catch((()=>{nh.live(this.teamId,e)}),e)}quitLiveSession(e){this.catch((()=>{nh.quit(e)}),e)}listenCustomer(e){let t={customerId:e.id,onNewMessage:e.onNewMessage,onStatusUpdated:e.onStatusUpdated,onFailed:e.onFailed,onSuccess:e.onSuccess};this.catch((()=>{nh.live(this.teamId,t)}),e)}cancelListenCustomer(e){this.catch((()=>{nh.quit(e)}),e)}}class Tf{static team(e){nl.validateId(e,"teamId");let t=this.teams.get(e);return t||(t=new Ef(e.toString()),this.teams.set(e.toString(),t)),t}}Tf.teams=new Map;class If{constructor(e){this.id=e}isOnline(e){Tf.team(this.id).isOnline(e)}online(e){Tf.team(this.id).online(e)}offline(e){Tf.team(this.id).offline(e)}customerStatus(e){Tf.team(this.id).customerStatus(e)}accept(e){Tf.team(this.id).accept(e)}end(e){Tf.team(this.id).end(e)}history(e){Tf.team(this.id).history(e)}markMessageAsRead(e){Tf.team(this.id).markMessageAsRead(e)}createTextMessage(e){Tf.team(this.id).createTextMessage(e)}createImageMessage(e){Tf.team(this.id).createImageMessage(e)}createFileMessage(e){Tf.team(this.id).createFileMessage(e)}createAudioMessage(e){Tf.team(this.id).createAudioMessage(e)}createVideoMessage(e){Tf.team(this.id).createVideoMessage(e)}createCustomMessage(e){Tf.team(this.id).createCustomMessage(e)}transfer(e){Tf.team(this.id).transfer(e)}agents(e){Tf.team(this.id).agents(e)}liveSession(e){Tf.team(this.id).liveSession(e)}quitLiveSession(e){Tf.team(this.id).quitLiveSession(e)}listenCustomer(e){Tf.team(this.id).listenCustomer(e)}cancelListenCustomer(e){Tf.team(this.id).cancelListenCustomer(e)}}class _f{static getInstance(e){return this.init(e),_f}static init(e){if(this.getConnectionStatus()!==Ka.DISCONNECTED)throw new Error("Initialization failed. Please disconnect and try again.");this.validateOptions(e),Ja.init(e.reactNativeOptions),this.options=e,eh.init(e),e.allowNotification&&el.init(e.allowNotification),e.modules&&(e.modules.includes("PUBSUB")&&Fc.initModule(ml.init()),e.modules.includes("IM")&&Fc.initModule(fh.init())),gf.init(),Kc.init(eh,el,gf,Qa,sc,Fc)}static setBadge(e){el.setBadge(e)}static connect(e){eh.connect(e,"JS")}static disconnect(e){eh.disconnect(e)}static getConnectionStatus(){return eh.status()}static validateOptions(e){let t="";if(!nc.isObject(e))throw t="options is require an object.",Error(t);if(!nc.isPrimitive(e.appkey)||0==e.appkey.length)throw t="Invalid options:'appkey' is empty.",Error(t);if(!nc.isPrimitive(e.host)||0==e.host.length)throw t="Invalid options:'host' is empty.",Error(t);if(!nc.isArray(e.modules))throw t="Invalid options: 'modules' must be nonempty array",Error(t);if(!e.modules.includes("im")&&!e.modules.includes("pubsub"))throw t="Invalid options: 'modules' must include at least one of 'im' or 'pubsub'.",Error(t);e.modules=e.modules.map((e=>e.toUpperCase()))}static onClickNotification(e){el.onClickNotification(e)}static c(e){e.init(Kc.Socket,Kc.N,Kc.Member,Kc.v,Kc.Platform,Fc)}}function Of(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}_f.version=Qa,_f.IM_EVENT=Dl,_f.IM_SCENE=Ya,_f.im=class{static on(e,t){yf.i().on(e,t)}static off(e,t){yf.i().off(e,t)}static createTextMessage(e){return yf.i().createTextMessage(e)}static createImageMessage(e){return yf.i().createImageMessage(e)}static createFileMessage(e){return yf.i().createFileMessage(e)}static createAudioMessage(e){return yf.i().createAudioMessage(e)}static createVideoMessage(e){return yf.i().createVideoMessage(e)}static createCustomMessage(e){return yf.i().createCustomMessage(e)}static sendMessage(e){yf.i().sendMessage(e)}static recallMessage(e){yf.i().recallMessage(e)}static deleteMessage(e){yf.i().deleteMessage(e)}static markGroupMessageAsRead(e){yf.i().markGroupMessageAsRead(e)}static markPrivateMessageAsRead(e){yf.i().markPrivateMessageAsRead(e)}static latestConversations(e){yf.i().latestConversations(e)}static removePrivateConversation(e){yf.i().removePrivateConversation(e)}static removeGroupConversation(e){yf.i().removeGroupConversation(e)}static topPrivateConversation(e){yf.i().topPrivateConversation(e)}static topGroupConversation(e){yf.i().topGroupConversation(e)}static history(e){yf.i().history(e)}static subscribeUserPresence(e){yf.i().subscribeUserPresence(e)}static unsubscribeUserPresence(e){yf.i().unsubscribeUserPresence(e)}static hereNow(e){yf.i().hereNow(e)}static subscribeGroup(e){yf.i().subscribeGroup(e)}static unsubscribeGroup(e){yf.i().unsubscribeGroup(e)}static subscribeGroupPresence(e){yf.i().subscribeGroupPresence(e)}static unsubscribeGroupPresence(e){yf.i().unsubscribeGroupPresence(e)}static groupHereNow(e){yf.i().groupHereNow(e)}static groupOnlineCount(e){yf.i().groupOnlineCount(e)}static markMessageAsRead(e){yf.i().markMessageAsRead(e)}static csteam(e){return new If(e)}static pendingConversations(e){yf.i().latestPendingConversations(e)}static topConversation(e){yf.i().topConversation(e)}static removeConversation(e){yf.i().removeConversation(e)}},_f.pubsub=class{static publish(e){this.catch((()=>{fl.instance.publish(e)}),e)}static subscribe(e){this.catch((()=>{fl.instance.subscribe(e)}),e)}static unsubscribe(e){this.catch((()=>{fl.instance.unsubscribe(e)}),e)}static subscribePresence(e){this.catch((()=>{fl.instance.subscribePresence(e)}),e)}static unsubscribePresence(e){this.catch((()=>{fl.instance.unsubscribePresence(e)}),e)}static history(e){this.catch((()=>{fl.instance.history(e)}),e)}static hereNow(e){this.catch((()=>{fl.instance.hereNow(e)}),e)}static catch(e,t){try{if(ml.check(),[Ka.DISCONNECTED,Ka.DISCONNECTING,Ka.CONNECT_FAILED].includes(Kc.Socket.status()))throw new Error("Please call connect() first.");e()}catch(n){fc.onFailed(t,n)}}};var Af={exports:{}};window,Af.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},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="/Users/chrisftian/Documents/projects/cos-sdk/cos-wx-sdk-v5/dist",n(n.s=8)}([function(e,t,n){function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(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)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){c=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw r}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n=0;--s){var a=this.tryEntries[s],r=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),v}},t}function a(e,t,n,i,o,s,a){try{var r=e[s](a),c=r.value}catch(u){return void n(u)}r.done?t(c):Promise.resolve(c).then(i,o)}function r(e){return(r="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)}var c=n(10),u=n(13),l=n(14),d=l.btoa,p=Pn.getFileSystemManager(),h=n(2),g=n(15),f=g.XMLParser,m=g.XMLBuilder,_=new f({ignoreDeclaration:!0,ignoreAttributes:!0,parseTagValue:!1,trimValues:!1}),v=new m,y=function e(t){if(R(t))for(var n in t){var i=t[n];"string"==typeof i?"#text"===n&&delete t[n]:Array.isArray(i)?i.forEach((function(t){e(t)})):R(i)&&e(i)}};function I(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function M(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&n.push(t?I(i).toLowerCase():i);return n.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}var C=["cache-control","content-disposition","content-encoding","content-length","content-md5","content-type","expect","expires","host","if-match","if-modified-since","if-none-match","if-unmodified-since","origin","range","transfer-encoding","pic-operations"],S=function(){},E=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};function T(e){return b(e,(function(e){return"object"===r(e)&&null!==e?T(e):e}))}function k(e,t){return O(t,(function(n,i){e[i]=t[i]})),e}function D(e){return e instanceof Array}function R(e){return"[object Object]"===Object.prototype.toString.call(e)}function O(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}function b(e,t){var n=D(e)?[]:{};for(var i in e)e.hasOwnProperty(i)&&(n[i]=t(e[i],i));return n}var A,L,P=function(e,t){if(t=k({},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])}(),F.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-forbid-overwrite":"ForbidOverwrite","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,i){void 0!==t[e]&&(n[i]=t[e])})),t.Headers=E(n))}return t},N=function(e){return new Promise((function(t,n){p.readFile({filePath:e,success:function(e){t(e.data)},fail:function(e){n((null==e?void 0:e.errMsg)||"")}})}))},w=(A=s().mark((function e(t,n,i){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("postObject"!==t){e.next=4;break}i(),e.next=21;break;case 4:if("putObject"!==t){e.next=20;break}if(void 0!==n.Body||!n.FilePath){e.next=17;break}return e.prev=6,e.next=9,N(n.FilePath);case 9:n.Body=e.sent,e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(6),n.Body=void 0,i({error:"readFile error, ".concat(e.t0)}),e.abrupt("return");case 17:void 0!==n.Body?(n.ContentLength=n.Body.byteLength,i(null,n.ContentLength)):i({error:"missing param Body"}),e.next=21;break;case 20:n.FilePath?p.stat({path:n.FilePath,success:function(e){var t=e.stats;n.FileStat=t,n.FileStat.FilePath=n.FilePath;var o=t.isDirectory()?0:t.size;n.ContentLength=o=o||0,i(null,o)},fail:function(e){i(e)}}):i({error:"missing param FilePath"});case 21:case"end":return e.stop()}}),e,null,[[6,12]])})),L=function(){var e=this,t=arguments;return new Promise((function(n,i){var o=A.apply(e,t);function s(e){a(o,n,i,s,r,"next",e)}function r(e){a(o,n,i,s,r,"throw",e)}s(void 0)}))},function(e,t,n){return L.apply(this,arguments)}),U=function(e){return Date.now()+(e||0)},G=function(e,t){if(!e||!t)return-1;e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.lengths)return 1;if(o=0);return function(){return i}}(),F={noop:S,formatParams:P,apiWrapper:function(e,t){return function(n,i){var o,s=this;if("function"==typeof n&&(i=n,n={}),n=P(e,n),s.options.EnableReporter)if("sliceUploadFile"===n.calledBySdk||"sliceCopyFile"===n.calledBySdk)o=n.tracker&&n.tracker.generateSubTracker({apiName:e});else if(["uploadFile","uploadFiles"].includes(e))o=null;else{var a=0;n.Body&&(a="string"==typeof n.Body?n.Body.length:n.Body.size||n.Body.byteLength||0);var r=s.options.UseAccelerate||"string"==typeof s.options.Domain&&s.options.Domain.includes("accelerate.");o=new h({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:n.Bucket,region:n.Region,apiName:e,realApi:e,accelerate:r,fileKey:n.Key,fileSize:a,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})}n.tracker=o;var c=function(e){return e&&e.headers&&(e.headers["x-ci-request-id"]&&(e.RequestId=e.headers["x-ci-request-id"]),e.headers["x-cos-request-id"]&&(e.RequestId=e.headers["x-cos-request-id"]),e.headers["x-cos-version-id"]&&(e.VersionId=e.headers["x-cos-version-id"]),e.headers["x-cos-delete-marker"]&&(e.DeleteMarker=e.headers["x-cos-delete-marker"])),e},u=function(e,t){o&&o.report(e,t),i&&i(c(e),c(t))},l=function(){if("getService"!==e&&"abortUploadTask"!==e){var t=function(e,t){var n=t.Bucket,i=t.Region,o=t.Key;if(e.indexOf("Bucket")>-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(!n)return"Bucket";if(!i)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e||"uploadFile"===e){if(!n)return"Bucket";if(!i)return"Region";if(!o)return"Key"}return!1}(e,n);if(t)return"missing param "+t;if(n.Region){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.";!s.options.CompatibilityMode&&-1===n.Region.indexOf("-")&&"yfb"!==n.Region&&"default"!==n.Region&&n.Region}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!s.options.AppId)return'Bucket should format as "test-1250000000".';n.Bucket=n.Bucket+"-"+s.options.AppId}n.AppId&&delete n.AppId}n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}}(),d=["getAuth","getObjectUrl"].includes(e);if(!d&&!i)return new Promise((function(e,o){if(i=function(t,n){t?o(t):e(n)},l)return u({error:l});t.call(s,n,u)}));if(l)return u({error:l});var p=t.call(s,n,u);return d?p:void 0}},xml2json:function(e){var t=_.parse(e);return y(t),t},json2xml:function(e){return v.build(e)},md5:c,clearKey:E,fileSlice:function(e,t,n,i){e?p.readFile({filePath:e,position:t,length:n-t,success:function(e){i(e.data)},fail:function(){i(null)}}):i(null)},getBodyMd5:function(e,t,n){n=n||S,e&&t&&t instanceof ArrayBuffer?F.getFileMd5(t,(function(e,t){n(t)})):n()},getFileMd5:function(e,t){var n=c(e);return t&&t(n),n},binaryBase64:function(e){var t,n,i,o="";for(t=0,n=e.length/2;t-1||i.indexOf("x-ci-")>-1||C.indexOf(i)>-1)&&(t[n]=e[n])}return t}(T(e.Headers||e.headers||{})),c=e.Key||"";e.UseRawKey?t=e.Pathname||e.pathname||"/"+c:0!==(t=e.Pathname||e.pathname||c).indexOf("/")&&(t="/"+t);var l=!1!==e.ForceSignHost;if(!r.Host&&!r.host&&e.Bucket&&e.Region&&l&&(r.Host=e.Bucket+".cos."+e.Region+".myqcloud.com"),n&&i){var d=Math.round(U(e.SystemClockOffset)/1e3)-1,p=d,h=e.Expires||e.expires;p+=void 0===h?900:1*h||0;var g=n,f=o||d+";"+p,m=o||d+";"+p,_=M(r,!0).join(";").toLowerCase(),v=M(a,!0).join(";").toLowerCase(),y=u.HmacSHA1(m,i).toString(),I=[s,t,F.obj2str(a,!0),F.obj2str(r,!0),""].join("\n"),S=["sha1",f,u.SHA1(I).toString(),""].join("\n");return["q-sign-algorithm=sha1","q-ak="+g,"q-sign-time="+f,"q-key-time="+m,"q-header-list="+_,"q-url-param-list="+v,"q-signature="+u.HmacSHA1(S,y).toString()].join("&")}},compareVersion:G,canFileSlice:x,isCIHost:function(e){return/^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(e)},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&&(k(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=T(n)),e},getSourceParams:function(e){var t=this.options.CopySourceParser;if(t)return t(e);var n=e.match(/^([^.]+-\d+)\.cos(v6|-cdc|-internal)?\.([^.]+)\.((myqcloud\.com)|(tencentcos\.cn))\/(.+)$/);return n?{Bucket:n[1],Region:n[3],Key:n[7]}:null},encodeBase64:function(e,t){var n=l.encode(e);return t&&(n=n.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")),n},simplifyPath:function(e){var t,n=[],o=i(e.split("/"));try{for(o.s();!(t=o.n()).done;){var s=t.value;".."===s?n.length&&n.pop():s.length&&"."!==s&&n.push(s)}}catch(a){o.e(a)}finally{o.f()}return"/"+n.join("/")},arrayBufferToString:function(e){return new TextDecoder("utf-8").decode(e)},parseResBody:function(e){var t;if(e&&"string"==typeof e){var n=e.trim(),i=0===n.indexOf("<"),o=0===n.indexOf("{");if(i)t=F.xml2json(e)||{};else if(o)try{var s=e.replace(/\n/g," "),a=JSON.parse(s);t="[object Object]"===Object.prototype.toString.call(a)?a:e}catch(r){t=e}else t=e}else t=e||{};return t}};e.exports=F},function(e,t,n){const i=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o="["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",s=new RegExp("^"+o+"$");t.isExist=function(e){return void 0!==e},t.isEmptyObject=function(e){return 0===Object.keys(e).length},t.merge=function(e,t,n){if(t){const i=Object.keys(t),o=i.length;for(let s=0;s=0;--s){var r=this.tryEntries[s],a=r.completion;if("root"===r.tryLoc)return o("end");if(r.tryLoc<=this.prev){var c=i.call(r,"catchLoc"),l=i.call(r,"finallyLoc");if(c&&l){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;R(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:M(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),y}},t}function r(e,t,n,i,o,s,r){try{var a=e[s](r),c=a.value}catch(l){return void n(l)}a.done?t(c):Promise.resolve(c).then(i,o)}function a(e){return(a="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)}var c=n(10),l=n(13),u=n(14),p=u.btoa,d=Mn.getFileSystemManager(),h=n(2),f=n(15),m=f.XMLParser,g=f.XMLBuilder,v=new m({ignoreDeclaration:!0,ignoreAttributes:!0,parseTagValue:!1,trimValues:!1}),y=new g,b=function e(t){if(_(t))for(var n in t){var i=t[n];"string"==typeof i?"#text"===n&&delete t[n]:Array.isArray(i)?i.forEach((function(t){e(t)})):_(i)&&e(i)}};function x(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function S(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&n.push(t?x(i).toLowerCase():i);return n.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}var k=["cache-control","content-disposition","content-encoding","content-length","content-md5","content-type","expect","expires","host","if-match","if-modified-since","if-none-match","if-unmodified-since","origin","range","transfer-encoding","pic-operations"],C=function(){},w=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};function E(e){return A(e,(function(e){return"object"===a(e)&&null!==e?E(e):e}))}function T(e,t){return O(t,(function(n,i){e[i]=t[i]})),e}function I(e){return e instanceof Array}function _(e){return"[object Object]"===Object.prototype.toString.call(e)}function O(e,t){for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)}function A(e,t){var n=I(e)?[]:{};for(var i in e)e.hasOwnProperty(i)&&(n[i]=t(e[i],i));return n}var R,P,M=function(e,t){if(t=T({},t),"getAuth"!==e&&"getV4Auth"!==e&&"getObjectUrl"!==e){var n=t.Headers||{};t&&"object"===a(t)&&(function(){for(var e in t)t.hasOwnProperty(e)&&e.indexOf("x-cos-")>-1&&(n[e]=t[e])}(),U.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-forbid-overwrite":"ForbidOverwrite","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,i){void 0!==t[e]&&(n[i]=t[e])})),t.Headers=w(n))}return t},N=function(e){return new Promise((function(t,n){d.readFile({filePath:e,success:function(e){t(e.data)},fail:function(e){n((null==e?void 0:e.errMsg)||"")}})}))},D=(R=s().mark((function e(t,n,i){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("postObject"!==t){e.next=4;break}i(),e.next=21;break;case 4:if("putObject"!==t){e.next=20;break}if(void 0!==n.Body||!n.FilePath){e.next=17;break}return e.prev=6,e.next=9,N(n.FilePath);case 9:n.Body=e.sent,e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(6),n.Body=void 0,i({error:"readFile error, ".concat(e.t0)}),e.abrupt("return");case 17:void 0!==n.Body?(n.ContentLength=n.Body.byteLength,i(null,n.ContentLength)):i({error:"missing param Body"}),e.next=21;break;case 20:n.FilePath?d.stat({path:n.FilePath,success:function(e){var t=e.stats;n.FileStat=t,n.FileStat.FilePath=n.FilePath;var o=t.isDirectory()?0:t.size;n.ContentLength=o=o||0,i(null,o)},fail:function(e){i(e)}}):i({error:"missing param FilePath"});case 21:case"end":return e.stop()}}),e,null,[[6,12]])})),P=function(){var e=this,t=arguments;return new Promise((function(n,i){var o=R.apply(e,t);function s(e){r(o,n,i,s,a,"next",e)}function a(e){r(o,n,i,s,a,"throw",e)}s(void 0)}))},function(e,t,n){return P.apply(this,arguments)}),B=function(e){return Date.now()+(e||0)},L=function(e,t){if(!e||!t)return-1;e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.lengths)return 1;if(o=0);return function(){return i}}(),U={noop:C,formatParams:M,apiWrapper:function(e,t){return function(n,i){var o,s=this;if("function"==typeof n&&(i=n,n={}),n=M(e,n),s.options.EnableReporter)if("sliceUploadFile"===n.calledBySdk||"sliceCopyFile"===n.calledBySdk)o=n.tracker&&n.tracker.generateSubTracker({apiName:e});else if(["uploadFile","uploadFiles"].includes(e))o=null;else{var r=0;n.Body&&(r="string"==typeof n.Body?n.Body.length:n.Body.size||n.Body.byteLength||0);var a=s.options.UseAccelerate||"string"==typeof s.options.Domain&&s.options.Domain.includes("accelerate.");o=new h({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:n.Bucket,region:n.Region,apiName:e,realApi:e,accelerate:a,fileKey:n.Key,fileSize:r,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})}n.tracker=o;var c=function(e){return e&&e.headers&&(e.headers["x-ci-request-id"]&&(e.RequestId=e.headers["x-ci-request-id"]),e.headers["x-cos-request-id"]&&(e.RequestId=e.headers["x-cos-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},l=function(e,t){o&&o.report(e,t),i&&i(c(e),c(t))},u=function(){if("getService"!==e&&"abortUploadTask"!==e){var t=function(e,t){var n=t.Bucket,i=t.Region,o=t.Key;if(e.indexOf("Bucket")>-1||"deleteMultipleObject"===e||"multipartList"===e||"listObjectVersions"===e){if(!n)return"Bucket";if(!i)return"Region"}else if(e.indexOf("Object")>-1||e.indexOf("multipart")>-1||"sliceUploadFile"===e||"abortUploadTask"===e||"uploadFile"===e){if(!n)return"Bucket";if(!i)return"Region";if(!o)return"Key"}return!1}(e,n);if(t)return"missing param "+t;if(n.Region){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.";!s.options.CompatibilityMode&&-1===n.Region.indexOf("-")&&"yfb"!==n.Region&&"default"!==n.Region&&n.Region}if(n.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(n.Bucket))if(n.AppId)n.Bucket=n.Bucket+"-"+n.AppId;else{if(!s.options.AppId)return'Bucket should format as "test-1250000000".';n.Bucket=n.Bucket+"-"+s.options.AppId}n.AppId&&delete n.AppId}n.Key&&"/"===n.Key.substr(0,1)&&(n.Key=n.Key.substr(1))}}(),p=["getAuth","getObjectUrl"].includes(e);if(!p&&!i)return new Promise((function(e,o){if(i=function(t,n){t?o(t):e(n)},u)return l({error:u});t.call(s,n,l)}));if(u)return l({error:u});var d=t.call(s,n,l);return p?d:void 0}},xml2json:function(e){var t=v.parse(e);return b(t),t},json2xml:function(e){return y.build(e)},md5:c,clearKey:w,fileSlice:function(e,t,n,i){e?d.readFile({filePath:e,position:t,length:n-t,success:function(e){i(e.data)},fail:function(){i(null)}}):i(null)},getBodyMd5:function(e,t,n){n=n||C,e&&t&&t instanceof ArrayBuffer?U.getFileMd5(t,(function(e,t){n(t)})):n()},getFileMd5:function(e,t){var n=c(e);return t&&t(n),n},binaryBase64:function(e){var t,n,i,o="";for(t=0,n=e.length/2;t-1||i.indexOf("x-ci-")>-1||k.indexOf(i)>-1)&&(t[n]=e[n])}return t}(E(e.Headers||e.headers||{})),c=e.Key||"";e.UseRawKey?t=e.Pathname||e.pathname||"/"+c:0!==(t=e.Pathname||e.pathname||c).indexOf("/")&&(t="/"+t);var u=!1!==e.ForceSignHost;if(!a.Host&&!a.host&&e.Bucket&&e.Region&&u&&(a.Host=e.Bucket+".cos."+e.Region+".myqcloud.com"),n&&i){var p=Math.round(B(e.SystemClockOffset)/1e3)-1,d=p,h=e.Expires||e.expires;d+=void 0===h?900:1*h||0;var f=n,m=o||p+";"+d,g=o||p+";"+d,v=S(a,!0).join(";").toLowerCase(),y=S(r,!0).join(";").toLowerCase(),b=l.HmacSHA1(g,i).toString(),x=[s,t,U.obj2str(r,!0),U.obj2str(a,!0),""].join("\n"),C=["sha1",m,l.SHA1(x).toString(),""].join("\n");return["q-sign-algorithm=sha1","q-ak="+f,"q-sign-time="+m,"q-key-time="+g,"q-header-list="+v,"q-url-param-list="+y,"q-signature="+l.HmacSHA1(C,b).toString()].join("&")}},compareVersion:L,canFileSlice:j,isCIHost:function(e){return/^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(e)},error:function(e,t){var n=e;return e.message=e.message||null,"string"==typeof t?(e.error=t,e.message=t):"object"===a(t)&&null!==t&&(T(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=E(n)),e},getSourceParams:function(e){var t=this.options.CopySourceParser;if(t)return t(e);var n=e.match(/^([^.]+-\d+)\.cos(v6|-cdc|-internal)?\.([^.]+)\.((myqcloud\.com)|(tencentcos\.cn))\/(.+)$/);return n?{Bucket:n[1],Region:n[3],Key:n[7]}:null},encodeBase64:function(e,t){var n=u.encode(e);return t&&(n=n.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")),n},simplifyPath:function(e){var t,n=[],o=i(e.split("/"));try{for(o.s();!(t=o.n()).done;){var s=t.value;".."===s?n.length&&n.pop():s.length&&"."!==s&&n.push(s)}}catch(r){o.e(r)}finally{o.f()}return"/"+n.join("/")},arrayBufferToString:function(e){return new TextDecoder("utf-8").decode(e)},parseResBody:function(e){var t;if(e&&"string"==typeof e){var n=e.trim(),i=0===n.indexOf("<"),o=0===n.indexOf("{");if(i)t=U.xml2json(e)||{};else if(o)try{var s=e.replace(/\n/g," "),r=JSON.parse(s);t="[object Object]"===Object.prototype.toString.call(r)?r:e}catch(a){t=e}else t=e}else t=e||{};return t}};e.exports=U},function(e,t,n){const i=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o="["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",s=new RegExp("^"+o+"$");t.isExist=function(e){return void 0!==e},t.isEmptyObject=function(e){return 0===Object.keys(e).length},t.merge=function(e,t,n){if(t){const i=Object.keys(t),o=i.length;for(let s=0;s=0;--o){var a=this.tryEntries[o],r=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=s.call(a,"catchLoc"),u=s.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),v}},t}function s(e,t,n,i,o,s,a){try{var r=e[s](a),c=r.value}catch(u){return void n(u)}r.done?t(c):Promise.resolve(c).then(i,o)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){s(a,i,o,r,c,"next",e)}function c(e){s(a,i,o,r,c,"throw",e)}r(void 0)}))}}function r(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){for(var n=0;n5&&"xml"===i)return g("InvalidXml","XML declaration allowed only at the start of the document.",m(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function r(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t"===e[t+2]){t+=2;break}return t}t.validate=function(e,t){t=Object.assign({},o,t);const n=[];let c=!1,u=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)v+=e[o];if(v=v.trim(),"/"===v[v.length-1]&&(v=v.substring(0,v.length-1),o--),d=v,!i.isName(d)){let t;return t=0===v.trim().length?"Invalid space after '<'.":"Tag '"+v+"' is an invalid name.",g("InvalidTag",t,m(e,o))}const y=l(e,o);if(!1===y)return g("InvalidAttr","Attributes for '"+v+"' have open quote.",m(e,o));let I=y.value;if(o=y.index,"/"===I[I.length-1]){const n=o-I.length;I=I.substring(0,I.length-1);const i=p(I,t);if(!0!==i)return g(i.err.code,i.err.msg,m(e,n+i.err.line));c=!0}else if(_){if(!y.tagClosed)return g("InvalidTag","Closing tag '"+v+"' doesn't have proper closing.",m(e,o));if(I.trim().length>0)return g("InvalidTag","Closing tag '"+v+"' can't have attributes or invalid starting.",m(e,f));if(0===n.length)return g("InvalidTag","Closing tag '"+v+"' has not been opened.",m(e,f));{const t=n.pop();if(v!==t.tagName){let n=m(e,t.tagStartPos);return g("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+v+"'.",m(e,f))}0==n.length&&(u=!0)}}else{const i=p(I,t);if(!0!==i)return g(i.err.code,i.err.msg,m(e,o-I.length+i.err.line));if(!0===u)return g("InvalidXml","Multiple possible root nodes found.",m(e,o));-1!==t.unpairedTags.indexOf(v)||n.push({tagName:v,tagStartPos:f}),c=!0}for(o++;o0)||g("InvalidXml","Invalid '"+JSON.stringify(n.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):g("InvalidXml","Start tag expected.",1)};const c='"',u="'";function l(e,t){let n="",i="",o=!1;for(;t"===e[t]&&""===i){o=!0;break}n+=e[t]}return""===i&&{value:n,index:t,tagClosed:o}}const d=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function p(e,t){const n=i.getAllMatches(e,d),o={};for(let i=0;i{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1}},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){n(e).push(t)},e.off=function(e,t){for(var i=n(e),o=i.length-1;o>=0;o--)t===i[o]&&i.splice(o,1)},e.emit=function(e,t){for(var i=n(e).map((function(e){return e})),o=0;o=0;n--){var o=i[n][2];(!o||o+2592e3=0;s--){var a=i[s];(a[0]===e&&a[1]===t||e!==a[0]&&0===a[0].indexOf(o))&&i.splice(s,1)}i.unshift([e,t,Math.round(Date.now()/1e3)]),i.length>n&&i.splice(n),u()}},removeUploadId:function(e){c(),delete l.using[e];for(var t=i.length-1;t>=0;t--)i[t][1]===e&&i.splice(t,1);u()}};e.exports=l},function(e,t,n){var i=n(9);e.exports=i},function(e,t,n){var i=n(0),o=n(6),s=n(25),a=n(26),r=n(32),c=n(3),u={SecretId:"",SecretKey:"",SecurityToken:"",StartTime:0,ExpiredTime:0,ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1048576,SliceSize:1048576,CopyChunkParallelLimit:20,CopyChunkSize:10485760,CopySliceSize:10485760,MaxPartNumber:1e4,ProgressInterval:1e3,UploadQueueSize:1e4,Domain:"",ServiceDomain:"",Protocol:"",CompatibilityMode:!1,ForcePathStyle:!1,Timeout:0,CorrectClockSkew:!0,SystemClockOffset:0,UploadCheckContentMd5:!1,UploadAddMetaMd5:!1,UploadIdCacheLimit:50,UseAccelerate:!1,ForceSignHost:!0,HttpDNSServiceId:"",SimpleUploadMethod:"postObject",AutoSwitchHost:!1,CopySourceParser:null,ObjectKeySimplifyCheck:!0,DeepTracker:!1,TrackerDelay:5e3,CustomId:"",BeaconReporter:null,ClsReporter:null},l=function(e){if(this.options=i.extend(i.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.EnableReporter=this.options.BeaconReporter||this.options.ClsReporter,this.options.AppId,this.options.SecretId&&this.options.SecretId.indexOf(" "),this.options.SecretKey&&this.options.SecretKey.indexOf(" "),this.options.ForcePathStyle)throw new Error("ForcePathStyle is not supported");o.init(this),s.init(this)};a.init(l,s),r.init(l,s),l.util={md5:i.md5,xml2json:i.xml2json,json2xml:i.json2xml,encodeBase64:i.encodeBase64},l.getAuthorization=i.getAuth,l.version=c.version,e.exports=l},function(e,t,n){(function(e){var t;function i(e){return(i="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)}!function(){var o="input is invalid type",s="object"===("undefined"==typeof window?"undefined":i(window)),a=s?window:{};a.JS_MD5_NO_WINDOW&&(s=!1),!s&&"object"===("undefined"==typeof self?"undefined":i(self))&&(a=self);var r,c=!a.JS_MD5_NO_COMMON_JS&&"object"===i(e)&&e.exports,u=n(12),l=!a.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[128,32768,8388608,-2147483648],h=[0,8,16,24],g=["hex","array","digest","buffer","arrayBuffer","base64"],f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),m=[];if(l){var _=new ArrayBuffer(68);r=new Uint8Array(_),m=new Uint32Array(_)}!a.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!l||!a.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===i(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});var v=function(e){return function(t){return new y(!0).update(t)[e]()}};function y(e){if(e)m[0]=m[16]=m[1]=m[2]=m[3]=m[4]=m[5]=m[6]=m[7]=m[8]=m[9]=m[10]=m[11]=m[12]=m[13]=m[14]=m[15]=0,this.blocks=m,this.buffer8=r;else if(l){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}y.prototype.update=function(e){if(!this.finalized){var t,n=i(e);if("string"!==n){if("object"!==n)throw o;if(null===e)throw o;if(!l||e.constructor!==ArrayBuffer&&"ArrayBuffer"!==e.constructor.name){if(!(Array.isArray(e)||l&&ArrayBuffer.isView(e)))throw o}else e=new Uint8Array(e);t=!0}for(var s,a,r=0,c=e.length,u=this.blocks,d=this.buffer8;r>2]|=e[r]<>6,d[a++]=128|63&s):s<55296||s>=57344?(d[a++]=224|s>>12,d[a++]=128|s>>6&63,d[a++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++r)),d[a++]=240|s>>18,d[a++]=128|s>>12&63,d[a++]=128|s>>6&63,d[a++]=128|63&s);else for(a=this.start;r>2]|=s<>2]|=(192|s>>6)<>2]|=(128|63&s)<=57344?(u[a>>2]|=(224|s>>12)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<>2]|=(240|s>>18)<>2]|=(128|s>>12&63)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<=64?(this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},y.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=p[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()}},y.prototype.hash=function(){var e,t,n,i,o,s,a=this.blocks;this.first?t=((t=((e=((e=a[0]-680876937)<<7|e>>>25)-271733879|0)^(n=((n=(-271733879^(i=((i=(-1732584194^2004318071&e)+a[1]-117830708)<<12|i>>>20)+e|0)&(-271733879^e))+a[2]-1126478375)<<17|n>>>15)+i|0)&(i^e))+a[3]-1316259209)<<22|t>>>10)+n|0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((i=this.h3)^t&(n^i))+a[0]-680876936)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[1]-389564586)<<12|i>>>20)+e|0)&(e^t))+a[2]+606105819)<<17|n>>>15)+i|0)&(i^e))+a[3]-1044525330)<<22|t>>>10)+n|0),t=((t+=((e=((e+=(i^t&(n^i))+a[4]-176418897)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[5]+1200080426)<<12|i>>>20)+e|0)&(e^t))+a[6]-1473231341)<<17|n>>>15)+i|0)&(i^e))+a[7]-45705983)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(i^t&(n^i))+a[8]+1770035416)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[9]-1958414417)<<12|i>>>20)+e|0)&(e^t))+a[10]-42063)<<17|n>>>15)+i|0)&(i^e))+a[11]-1990404162)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(i^t&(n^i))+a[12]+1804603682)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+a[13]-40341101)<<12|i>>>20)+e|0)&(e^t))+a[14]-1502002290)<<17|n>>>15)+i|0)&(i^e))+a[15]+1236535329)<<22|t>>>10)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[1]-165796510)<<5|e>>>27)+t|0)^t))+a[6]-1069501632)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[11]+643717713)<<14|n>>>18)+i|0)^i))+a[0]-373897302)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[5]-701558691)<<5|e>>>27)+t|0)^t))+a[10]+38016083)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[15]-660478335)<<14|n>>>18)+i|0)^i))+a[4]-405537848)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[9]+568446438)<<5|e>>>27)+t|0)^t))+a[14]-1019803690)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[3]-187363961)<<14|n>>>18)+i|0)^i))+a[8]+1163531501)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+a[13]-1444681467)<<5|e>>>27)+t|0)^t))+a[2]-51403784)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+a[7]+1735328473)<<14|n>>>18)+i|0)^i))+a[12]-1926607734)<<20|t>>>12)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[5]-378558)<<4|e>>>28)+t|0))+a[8]-2022574463)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[11]+1839030562)<<16|n>>>16)+i|0))+a[14]-35309556)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[1]-1530992060)<<4|e>>>28)+t|0))+a[4]+1272893353)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[7]-155497632)<<16|n>>>16)+i|0))+a[10]-1094730640)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[13]+681279174)<<4|e>>>28)+t|0))+a[0]-358537222)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[3]-722521979)<<16|n>>>16)+i|0))+a[6]+76029189)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+a[9]-640364487)<<4|e>>>28)+t|0))+a[12]-421815835)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+a[15]+530742520)<<16|n>>>16)+i|0))+a[2]-995338651)<<23|t>>>9)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[0]-198630844)<<6|e>>>26)+t|0)|~n))+a[7]+1126891415)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[14]-1416354905)<<15|n>>>17)+i|0)|~e))+a[5]-57434055)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[12]+1700485571)<<6|e>>>26)+t|0)|~n))+a[3]-1894986606)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[10]-1051523)<<15|n>>>17)+i|0)|~e))+a[1]-2054922799)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[8]+1873313359)<<6|e>>>26)+t|0)|~n))+a[15]-30611744)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[6]-1560198380)<<15|n>>>17)+i|0)|~e))+a[13]+1309151649)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+a[4]-145523070)<<6|e>>>26)+t|0)|~n))+a[11]-1120210379)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+a[2]+718787259)<<15|n>>>17)+i|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=i+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+i|0)},y.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3;return d[e>>4&15]+d[15&e]+d[e>>12&15]+d[e>>8&15]+d[e>>20&15]+d[e>>16&15]+d[e>>28&15]+d[e>>24&15]+d[t>>4&15]+d[15&t]+d[t>>12&15]+d[t>>8&15]+d[t>>20&15]+d[t>>16&15]+d[t>>28&15]+d[t>>24&15]+d[n>>4&15]+d[15&n]+d[n>>12&15]+d[n>>8&15]+d[n>>20&15]+d[n>>16&15]+d[n>>28&15]+d[n>>24&15]+d[i>>4&15]+d[15&i]+d[i>>12&15]+d[i>>8&15]+d[i>>20&15]+d[i>>16&15]+d[i>>28&15]+d[i>>24&15]},y.prototype.toString=y.prototype.hex,y.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&i,i>>8&255,i>>16&255,i>>24&255]},y.prototype.array=y.prototype.digest,y.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},y.prototype.buffer=y.prototype.arrayBuffer,y.prototype.base64=function(){for(var e,t,n,i="",o=this.array(),s=0;s<15;)e=o[s++],t=o[s++],n=o[s++],i+=f[e>>>2]+f[63&(e<<4|t>>>4)]+f[63&(t<<2|n>>>6)]+f[63&n];return e=o[s],i+(f[e>>>2]+f[e<<4&63]+"==")};var I=function(){var e=v("hex");e.getCtx=e.create=function(){return new y},e.update=function(t){return e.create().update(t)};for(var t=0;t>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(i+o)%4*8;else if(65535>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],i=0;i>>2]>>>24-i%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=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(n,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],i=0;i>>2]>>>24-i%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(n,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},l=n.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,r=o/(4*a);if(t=(r=t?e.ceil(r):e.max((0|r)-this._minBufferSize,0))*a,o=e.min(4*t,o),t){for(var c=0;cu;u++){if(16>u)s[u]=0|e[t+u];else{var l=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=l<<1|l>>>31}l=(i<<5|i>>>27)+c+s[u],l=20>u?l+(1518500249+(o&a|~o&r)):40>u?l+(1859775393+(o^a^r)):60>u?l+((o&a|o&r|a&r)-1894007588):l+((o^a^r)-899497514),c=r,r=a,a=o<<30|o>>>2,o=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+r|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(i+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}}),n.SHA1=o._createHelper(a),n.HmacSHA1=o._createHmacHelper(a),l=(u=d).enc.Utf8,u.algo.HMAC=u.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=l.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,r=s.words,c=0;c>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,r=0;r<4&&s+.75*r>>6*(3-r)&63));var c=i.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,i=n.charAt(64);if(i){var o=e.indexOf(i);-1!=o&&(t=o)}for(var s=[],a=0,r=0;r>>6-r%4*2;s[a>>>2]|=(u|l)<<24-a%4*8,a++}return c.create(s,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.exports=d},function(e,t){var n,i,o,s,a,r,c,u,l,d,p,h,g,f,m,_,v,y,I,M=(i=(n=n||{}).Base64,s=function(e){for(var t={},n=0,i=e.length;n>>6)+a(128|63&t):a(224|t>>>12&15)+a(128|t>>>6&63)+a(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return a(240|t>>>18&7)+a(128|t>>>12&63)+a(128|t>>>6&63)+a(128|63&t)},c=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,u=function(e){return e.replace(c,r)},l=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[o.charAt(n>>>18),o.charAt(n>>>12&63),t>=2?"=":o.charAt(n>>>6&63),t>=1?"=":o.charAt(63&n)].join("")},d=n.btoa?function(e){return n.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,l)},p=function(e){return d(u(e))},h=function(e,t){return t?p(String(e)).replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,""):p(String(e))},g=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),f=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 a(55296+(t>>>10))+a(56320+(1023&t));case 3:return a((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return a((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},m=function(e){return e.replace(g,f)},_=function(e){var t=e.length,n=t%4,i=(t>0?s[e.charAt(0)]<<18:0)|(t>1?s[e.charAt(1)]<<12:0)|(t>2?s[e.charAt(2)]<<6:0)|(t>3?s[e.charAt(3)]:0),o=[a(i>>>16),a(i>>>8&255),a(255&i)];return o.length-=[0,0,2,1][n],o.join("")},v=n.atob?function(e){return n.atob(e)}:function(e){return e.replace(/[\s\S]{1,4}/g,_)},y=function(e){return m(v(e))},{VERSION:"2.1.9",atob:v,btoa:d,fromBase64:I=function(e){return y(String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,""))},toBase64:h,utob:u,encode:h,encodeURI:function(e){return h(e,!0)},btou:m,decode:I,noConflict:function(){var e=n.Base64;return n.Base64=i,e}});e.exports=M},function(e,t,n){const i=n(4),o=n(16),s=n(23);e.exports={XMLParser:o,XMLValidator:i,XMLBuilder:s}},function(e,t,n){const{buildOptions:i}=n(17),o=n(18),{prettify:s}=n(22),a=n(4);e.exports=class{constructor(e){this.externalEntities={},this.options=i(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=a.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new o(this.options);n.addExternalEntities(this.externalEntities);const i=n.parseXml(e);return this.options.preserveOrder||void 0===i?i:s(i,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}}},function(e,t){const n={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};t.buildOptions=function(e){return Object.assign({},n,e)},t.defaultOptions=n},function(e,t,n){const i=n(1),o=n(19),s=n(20),a=n(21),r=n(5);function c(e){const t=Object.keys(e);for(let n=0;n0)){a||(e=this.replaceEntitiesValue(e));const i=this.options.tagValueProcessor(t,e,n,o,s);return null==i?e:typeof i!=typeof e||i!==e?i:this.options.trimValues||e.trim()===e?M(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function l(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const d=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function p(e,t,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const n=i.getAllMatches(e,d),o=n.length,s={};for(let e=0;e",r,"Closing Tag is not closed.");let o=e.substring(r+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),n&&(i=this.saveTextToParentTag(i,n,a));const s=a.substring(a.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: ${o}>`);let c=0;s&&-1!==this.options.unpairedTags.indexOf(s)?(c=a.lastIndexOf(".",a.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=a.lastIndexOf("."),a=a.substring(0,c),n=this.tagsNodeStack.pop(),i="",r=t}else if("?"===e[r+1]){let t=y(e,r,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,n,a),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new o(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,a,t.tagName)),this.addChild(n,e,a)}r=t.closeIndex+1}else if("!--"===e.substr(r+1,3)){const t=v(e,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(r+4,t-2);i=this.saveTextToParentTag(i,n,a),n.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=t}else if("!D"===e.substr(r+1,2)){const t=s(e,r);this.docTypeEntities=t.entities,r=t.i}else if("!["===e.substr(r+1,2)){const t=v(e,"]]>",r,"CDATA is not closed.")-2,o=e.substring(r+9,t);i=this.saveTextToParentTag(i,n,a);let s=this.parseTextData(o,n.tagname,a,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):n.add(this.options.textNodeName,s),r=t+2}else{let s=y(e,r,this.options.removeNSPrefix),c=s.tagName;const u=s.rawTagName;let l=s.tagExp,d=s.attrExpPresent,p=s.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&i&&"!xml"!==n.tagname&&(i=this.saveTextToParentTag(i,n,a,!1));const h=n;if(h&&-1!==this.options.unpairedTags.indexOf(h.tagname)&&(n=this.tagsNodeStack.pop(),a=a.substring(0,a.lastIndexOf("."))),c!==t.tagname&&(a+=a?"."+c:c),this.isItStopNode(this.options.stopNodes,a,c)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),a=a.substr(0,a.length-1),l=c):l=l.substr(0,l.length-1),r=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))r=s.closeIndex;else{const n=this.readStopNodeData(e,u,p+1);if(!n)throw new Error(`Unexpected end of ${u}`);r=n.i,t=n.tagContent}const i=new o(c);c!==l&&d&&(i[":@"]=this.buildAttributesMap(l,a,c)),t&&(t=this.parseTextData(t,c,a,!0,d,!0,!0)),a=a.substr(0,a.lastIndexOf(".")),i.add(this.options.textNodeName,t),this.addChild(n,i,a)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),a=a.substr(0,a.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const e=new o(c);c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,a,c)),this.addChild(n,e,a),a=a.substr(0,a.lastIndexOf("."))}else{const e=new o(c);this.tagsNodeStack.push(n),c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,a,c)),this.addChild(n,e,a),n=e}i="",r=p}}else i+=e[r];return t.child};function g(e,t,n){const i=this.options.updateTag(t.tagname,n,t[":@"]);!1===i||("string"==typeof i?(t.tagname=i,e.addChild(t)):e.addChild(t))}const f=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function m(e,t,n,i){return e&&(void 0===i&&(i=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,i))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function _(e,t,n){const i="*."+n;for(const o in e){const n=e[o];if(i===n||t===n)return!0}return!1}function v(e,t,n,i){const o=e.indexOf(t,n);if(-1===o)throw new Error(i);return o+t.length-1}function y(e,t,n,i=">"){const o=function(e,t,n=">"){let i,o="";for(let s=t;s",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(o--,0===o))return{tagContent:e.substring(i,n),i:s};n=s}else if("?"===e[n+1])n=v(e,"?>",n+1,"StopNode is not closed.");else if("!--"===e.substr(n+1,3))n=v(e,"--\x3e",n+3,"StopNode is not closed.");else if("!["===e.substr(n+1,2))n=v(e,"]]>",n,"StopNode is not closed.")-2;else{const i=y(e,n,">");i&&((i&&i.tagName)===t&&"/"!==i.tagExp[i.tagExp.length-1]&&o++,n=i.closeIndex)}}function M(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&a(e,n)}return i.isExist(e)?e:""}e.exports=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=c,this.parseXml=h,this.parseTextData=u,this.resolveNameSpace=l,this.buildAttributesMap=p,this.isItStopNode=_,this.replaceEntitiesValue=f,this.readStopNodeData=I,this.saveTextToParentTag=m,this.addChild=g,this.ignoreAttributesFn=r(this.options.ignoreAttributes)}}},function(e,t,n){e.exports=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}},function(e,t,n){const i=n(1);function o(e,t){let n="";for(;t"===e[t]){if(p?"-"===e[t-1]&&"-"===e[t-2]&&(p=!1,i--):i--,0===i)break}else"["===e[t]?d=!0:h+=e[t];else{if(d&&a(e,t))t+=7,[entityName,val,t]=o(e,t+1),-1===val.indexOf("&")&&(n[l(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(d&&r(e,t))t+=8;else if(d&&c(e,t))t+=8;else if(d&&u(e,t))t+=9;else{if(!s)throw new Error("Invalid DOCTYPE");p=!0}i++,h=""}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}}},function(e,t){const n=/^[-+]?0x[a-fA-F0-9]+$/,i=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const o={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};e.exports=function(e,t={}){if(t=Object.assign({},o,t),!e||"string"!=typeof e)return e;let s=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(s))return e;if(t.hex&&n.test(s))return Number.parseInt(s,16);{const n=i.exec(s);if(n){const i=n[1],o=n[2];let r=(a=n[3])&&-1!==a.indexOf(".")?("."===(a=a.replace(/0+$/,""))?a="0":"."===a[0]?a="0"+a:"."===a[a.length-1]&&(a=a.substr(0,a.length-1)),a):a;const c=n[4]||n[6];if(!t.leadingZeros&&o.length>0&&i&&"."!==s[2])return e;if(!t.leadingZeros&&o.length>0&&!i&&"."!==s[1])return e;{const n=Number(s),a=""+n;return-1!==a.search(/[eE]/)||c?t.eNotation?n:e:-1!==s.indexOf(".")?"0"===a&&""===r||a===r||i&&a==="-"+r?n:e:o?r===a||i+r===a?n:e:s===a||s===i+a?n:e}}return e}var a}},function(e,t,n){function i(e,t,n){let r;const c={};for(let u=0;u0&&(c[t.textNodeName]=r):void 0!==r&&(c[t.textNodeName]=r),c}function o(e){const t=Object.keys(e);for(let n=0;n","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function a(e){this.options=Object.assign({},s,e),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=o(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=u),this.processTextOrObjNode=r,this.options.format?(this.indentate=c,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function r(e,t,n,i){const o=this.j2x(e,n+1,i.concat(t));return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}function c(e){return this.options.indentBy.repeat(e)}function u(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}a.prototype.build=function(e){return this.options.preserveOrder?i(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},a.prototype.j2x=function(e,t,n){let i="",o="";const s=n.join(".");for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(void 0===e[a])this.isAttribute(a)&&(o+="");else if(null===e[a])this.isAttribute(a)?o+="":"?"===a[0]?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t);else if("object"!=typeof e[a]){const n=this.isAttribute(a);if(n&&!this.ignoreAttributesFn(n,s))i+=this.buildAttrPairStr(n,""+e[a]);else if(!n)if(a===this.options.textNodeName){let t=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(t)}else o+=this.buildTextValNode(e[a],a,"",t)}else if(Array.isArray(e[a])){const i=e[a].length;let s="",r="";for(let c=0;c"+e+o}},a.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`>${e}`,t},a.prototype.buildTextValNode=function(e,t,n,i){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(i)+``+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(i)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(i)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),""===o?this.indentate(i)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(i)+"<"+t+n+">"+o+""+t+this.tagEndChar}},a.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t`,l=!1;continue}if(h===t.commentPropName){u+=c+`\x3c!--${p[h][0][t.textNodeName]}--\x3e`,l=!0;continue}if("?"===h[0]){const e=o(p[":@"],t),n="?xml"===h?"":c;let i=p[h][0][t.textNodeName];i=0!==i.length?" "+i:"",u+=n+`<${h}${i}${e}?>`,l=!0;continue}let f=c;""!==f&&(f+=t.indentBy);const m=c+`<${h}${o(p[":@"],t)}`,_=n(p[h],t,g,f);-1!==t.unpairedTags.indexOf(h)?t.suppressUnpairedNode?u+=m+">":u+=m+"/>":_&&0!==_.length||!t.suppressEmptyNode?_&&_.endsWith(">")?u+=m+`>${_}${c}${h}>`:(u+=m+">",_&&""!==c&&(_.includes("/>")||_.includes(""))?u+=c+t.indentBy+_+c:u+=_,u+=`${h}>`):u+=m+"/>",l=!0}return u}function i(e){const t=Object.keys(e);for(let n=0;n0&&t.processEntities)for(let n=0;n0&&(i="\n"),n(e,t,"",i)}},function(e,t,n){var i=n(7),o=n(0),s={};e.exports.transferToTaskMethod=function(e,t){s[t]=e[t],e[t]=function(e,n){e.SkipTask?s[t].call(this,e,n):this._addTask(t,e,n)}},e.exports.init=function(e){var t,n,a=[],r={},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),t},d=(n=function(){t=0,e.emit("task-list-update",{list:o.map(a,l)}),e.emit("list-update",{list:o.map(a,l)})},function(){t||(t=setTimeout(n))}),p=function(){if(!(a.length<=e.options.UploadQueueSize)){for(var t=0;te.options.UploadQueueSize;){var n="waiting"===a[t].state||"checking"===a[t].state||"uploading"===a[t].state;a[t]&&n?t++:(r[a[t].id]&&delete r[a[t].id],a.splice(t,1),u--)}d()}},h=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 i=o.formatParams(n.api,n.params);s[n.api].call(e,i,(function(i,o){e._isRunningTask(n.id)&&("checking"!==n.state&&"uploading"!==n.state||(n.state=i?"error":"success",i&&(n.error=i),c--,d(),t(),n.callback&&n.callback(i,o),"success"===n.state&&(n.params&&(delete n.params.UploadData,delete n.params.Body,delete n.params),delete n.callback)),p())})),d(),setTimeout(t)}}},g=function(t,n){var o=r[t];if(o){var s=o&&"waiting"===o.state,a=o&&("checking"===o.state||"uploading"===o.state);if("canceled"===n&&"canceled"!==o.state||"paused"===n&&s||"paused"===n&&a){if("paused"===n&&o.params.Body&&"function"==typeof o.params.Body.pipe)return;o.state=n,e.emit("inner-kill-task",{TaskId:t,toState:n});try{var u=o&&o.params&&o.params.UploadData.UploadId}catch(l){}"canceled"===n&&u&&i.removeUsing(u),d(),a&&(c--,h()),"canceled"===n&&(o.params&&(delete o.params.UploadData,delete o.params.Body,delete o.params),delete o.callback)}p()}};e._addTasks=function(t){o.each(t,(function(t){e._addTask(t.api,t.params,t.callback,!0)})),d()},e._addTask=function(t,n,i,s){var c="postObject"===e.options.SimpleUploadMethod?"postObject":"putObject";"sliceUploadFile"!==t||o.canFileSlice()||(t=c),n=o.formatParams(t,n);var u=o.uuid();n.TaskId=u,n.onTaskReady&&n.onTaskReady(u);var l={params:n,callback:i,api:t,index:a.length,id:u,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},g=n.onHashProgress;n.onHashProgress=function(t){e._isRunningTask(l.id)&&(l.hashPercent=t.percent,g&&g(t),d())};var f=n.onProgress;return n.onProgress=function(t){e._isRunningTask(l.id)&&("checking"===l.state&&(l.state="uploading"),l.loaded=t.loaded,l.size=t.total,l.speed=t.speed,l.percent=t.percent,f&&f(t),d())},o.getFileSize(t,n,(function(e,t){e?i(e):(r[u]=l,a.push(l),l.size=t,!s&&d(),h(),p())})),u},e._isRunningTask=function(e){var t=r[e];return!(!t||"checking"!==t.state&&"uploading"!==t.state)},e.getTaskList=function(){return o.map(a,l)},e.cancelTask=function(e){g(e,"canceled")},e.pauseTask=function(e){g(e,"paused")},e.restartTask=function(e){var t=r[e];!t||"paused"!==t.state&&"error"!==t.state||(t.state="waiting",d(),u=Math.min(u,t.index),h())},e.isUploadRunning=function(){return c||u-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(s="{Bucket}."+s)),s=(s=s.replace(/\{\{AppId\}\}/gi,i).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,a).replace(/\{\{.*?\}\}/gi,"")).replace(/\{AppId\}/gi,i).replace(/\{BucketName\}/gi,n).replace(/\{Bucket\}/gi,t).replace(/\{Region\}/gi,a).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(s)||(s="https://"+s),"/"===s.slice(-1)&&(s=s.slice(0,-1));var c=s;return e.ForcePathStyle&&(c+="/"+t),c+="/",r&&(c+=o.camSafeUrlEncode(r).replace(/%2F/g,"/")),e.isLocation&&(c=c.replace(/^https?:\/\//,"")),c}var u=function(e){if(!e.Bucket||!e.Region)return"";var t=void 0===e.UseAccelerate?this.options.UseAccelerate:e.UseAccelerate;return(e.Url||c({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:e.Bucket,region:t?"accelerate":e.Region})).replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1")};function l(e,t){var n=o.clone(e.Headers),i="";o.each(n,(function(e,t){(""===e||["content-type","cache-control"].indexOf(t.toLowerCase())>-1)&&delete n[t],"host"===t.toLowerCase()&&(i=e)}));var s=!1!==e.ForceSignHost;!i&&e.SignHost&&s&&(n.Host=e.SignHost);var a=!1,r=function(e,n){a||(a=!0,n&&n.XCosSecurityToken&&!n.SecurityToken&&((n=o.clone(n)).SecurityToken=n.XCosSecurityToken,delete n.XCosSecurityToken),t&&t(e,n))},c=this,u=e.Bucket||"",l=e.Region||"",d="name/cos:PostObject"!==e.Action&&e.Key?e.Key:"";c.options.ForcePathStyle&&u&&(d=u+"/"+d);var p="/"+d,h={},g=e.Scope;if(!g){var f=e.Action||"",m=e.ResourceKey||e.Key||"";g=e.Scope||[{action:f,bucket:u,region:l,prefix:m}]}var _=o.md5(JSON.stringify(g));c._StsCache=c._StsCache||[],function(){var e,t;for(e=c._StsCache.length-1;e>=0;e--){t=c._StsCache[e];var n=Math.round(o.getSkewTime(c.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n=t.ExpiredTime)c._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===_){h=t;break}}}();var v=function(){var t="";h.StartTime&&e.Expires?t=h.StartTime+";"+(h.StartTime+1*e.Expires):h.StartTime&&h.ExpiredTime&&(t=h.StartTime+";"+h.ExpiredTime);var i={Authorization:o.getAuth({SecretId:h.TmpSecretId,SecretKey:h.TmpSecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,SystemClockOffset:c.options.SystemClockOffset,KeyTime:t,ForceSignHost:s}),SecurityToken:h.SecurityToken||h.XCosSecurityToken||"",Token:h.Token||"",ClientIP:h.ClientIP||"",ClientUA:h.ClientUA||"",SignFrom:"client"};r(null,i)},y=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(i){}if(!t)return o.error(new Error("getAuthorization callback params format error"))}else{if(!e.TmpSecretId)return o.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!e.TmpSecretKey)return o.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!e.SecurityToken&&!e.XCosSecurityToken)return o.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!e.ExpiredTime)return o.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(e.ExpiredTime&&10!==e.ExpiredTime.toString().length)return o.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(e.StartTime&&10!==e.StartTime.toString().length)return o.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(h.ExpiredTime&&h.ExpiredTime-o.getSkewTime(c.options.SystemClockOffset)/1e3>60)v();else if(c.options.getAuthorization)c.options.getAuthorization.call(c,{Bucket:u,Region:l,Method:e.Method,Key:d,Pathname:p,Query:e.Query,Headers:n,Scope:g,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:s},(function(e){"string"==typeof e&&(e={Authorization:e});var t=y(e);if(t)return r(t);e.Authorization?r(null,e):((h=e||{}).Scope=g,h.ScopeKey=_,c._StsCache.push(h),v())}));else{if(!c.options.getSTS)return function(){var t="";if(c.options.StartTime&&e.Expires){if(10!==c.options.StartTime.toString().length)return r(o.error(new Error('params "StartTime" should be 10 digits')));t=c.options.StartTime+";"+(c.options.StartTime+1*e.Expires)}else if(c.options.StartTime&&c.options.ExpiredTime){if(10!==c.options.StartTime.toString().length)return r(o.error(new Error('params "StartTime" should be 10 digits')));if(10!==c.options.ExpiredTime.toString().length)return r(o.error(new Error('params "ExpiredTime" should be 10 digits')));t=c.options.StartTime+";"+1*c.options.ExpiredTime}var i={Authorization:o.getAuth({SecretId:e.SecretId||c.options.SecretId,SecretKey:e.SecretKey||c.options.SecretKey,Method:e.Method,Pathname:p,Query:e.Query,Headers:n,Expires:e.Expires,KeyTime:t,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:s}),SecurityToken:c.options.SecurityToken||c.options.XCosSecurityToken,SignFrom:"client"};return r(null,i),i}();c.options.getSTS.call(c,{Bucket:u,Region:l},(function(e){(h=e||{}).Scope=g,h.ScopeKey=_,h.TmpSecretId||(h.TmpSecretId=h.SecretId),h.TmpSecretKey||(h.TmpSecretKey=h.SecretKey);var t=y(h);if(t)return r(t);c._StsCache.push(h),v()}))}return""}function d(e){var t=this,n=!1,i=!1,s=!1,a=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var r=e.error.Code,c=e.error.Message;("RequestTimeTooSkewed"===r||"AccessDenied"===r&&"Request has expired"===c)&&(s=!0)}catch(p){}if(e){if(s&&a){var u=Date.parse(a);this.options.CorrectClockSkew&&Math.abs(o.getSkewTime(this.options.SystemClockOffset)-u)>=3e4&&(this.options.SystemClockOffset=u-Date.now(),n=!0)}else{if(5===Math.floor(e.statusCode/100))return{canRetry:!0,networkError:!1};if("timeout"===e.message)return{canRetry:!0,networkError:t.options.AutoSwitchHost}}if(e.statusCode){var l=Math.floor(e.statusCode/100),d=(null==e?void 0:e.headers)&&(null==e?void 0:e.headers["x-cos-request-id"]);[3,4,5].includes(l)&&!d&&(n=t.options.AutoSwitchHost,i=!0)}else n=!0,i=t.options.AutoSwitchHost}return{canRetry:n,networkError:i}}function p(e){var t=e.requestUrl,n=e.clientCalcSign,i=e.networkError;return!!this.options.AutoSwitchHost&&!!t&&!!n&&!!i&&/^https?:\/\/[^\/]*\.cos\.[^\/]*\.myqcloud\.com(\/.*)?$/.test(t)&&!/^https?:\/\/[^\/]*\.cos\.accelerate\.myqcloud\.com(\/.*)?$/.test(t)}function h(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=o.clearKey(e.qs),e.headers&&(e.headers=o.clearKey(e.headers)),e.qs&&(e.qs=o.clearKey(e.qs));var i=o.clone(e.qs);e.action&&(i[e.action]="");var s=e.url||e.Url,a=e.SignHost||u.call(this,{Bucket:e.Bucket,Region:e.Region,Url:s}),r=e.tracker;!function o(s){var c=n.options.SystemClockOffset;e.SwitchHost&&(a=a.replace(/myqcloud.com/,"tencentcos.cn")),r&&r.setParams({signStartTime:(new Date).getTime(),httpRetryTimes:s-1}),l.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:i,Headers:e.headers,SignHost:a,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope,ForceSignHost:n.options.ForceSignHost},(function(i,a){i?t(i):(r&&r.setParams({signEndTime:(new Date).getTime(),httpStartTime:(new Date).getTime()}),e.AuthData=a,g.call(n,e,(function(i,u){var l=!1,h=!1;if(i){var g=d.call(n,i);l=g.canRetry||c!==n.options.SystemClockOffset,h=g.networkError}if(r&&r.setParams({httpEndTime:(new Date).getTime()}),i&&s<4&&l){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"]);var f=p.call(n,{requestUrl:(null==i?void 0:i.url)||"",clientCalcSign:"client"===(null==a?void 0:a.SignFrom),networkError:h});e.SwitchHost=f,e.headers["x-cos-sdk-retry"]="true",o(s+1)}else t(i,u)})))}))}(1)}function g(e,t){var n=this,s=e.TaskId;if(!s||n._isRunningTask(s)){var a=e.Bucket,r=e.Region,u=e.Key,l=e.method||"GET",d=e.url||e.Url,p=e.body,h=e.json,g=e.rawBody,f=e.dataType,m=n.options.HttpDNSServiceId;n.options.UseAccelerate&&(r="accelerate"),d=d||c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:a,region:r,object:u}),e.SwitchHost&&(d=d.replace(/myqcloud.com/,"tencentcos.cn"));var _=u?d:"";e.action&&(d=d+"?"+e.action),e.qsStr&&(d=d.indexOf("?")>-1?d+"&"+e.qsStr:d+"?"+e.qsStr);var v={method:l,url:d,headers:e.headers,qs:e.qs,filePath:e.filePath,body:p,json:h,httpDNSServiceId:m,dataType:f},y="x-cos-security-token";o.isCIHost(d)&&(y="x-ci-security-token"),v.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(v.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(v.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(v.headers.clientUA=e.AuthData.ClientUA),e.AuthData.SecurityToken&&(v.headers[y]=e.AuthData.SecurityToken),v.headers&&(v.headers=o.clearKey(v.headers)),v=o.clearKey(v),e.onProgress&&"function"==typeof e.onProgress&&(v.onProgress=function(t){if(!s||n._isRunningTask(s)){var i=t?t.loaded:0;e.onProgress({loaded:i,total:t.total})}}),this.options.Timeout&&(v.timeout=this.options.Timeout),n.options.ForcePathStyle&&(v.pathStyle=n.options.ForcePathStyle),n.emit("before-send",v);var I,M=v.url.includes("accelerate."),C=v.qs?Object.keys(v.qs).map((function(e){return"".concat(e,"=").concat(v.qs[e])})).join("&"):"",S=C?v.url+"?"+C:v.url;e.tracker&&(e.tracker.setParams({url:S,httpMethod:v.method,accelerate:M,httpSize:(null===(I=v.body)||void 0===I?void 0:I.size)||0}),e.tracker.parent&&!e.tracker.parent.params.url&&e.tracker.parent.setParams({url:_,accelerate:M}));var E=i(v,(function(e,i,a){if("abort"!==e){var r,c=function(e,a){if(s&&n.off("inner-kill-task",T),!r){r=!0;var c={};i&&i.statusCode&&(c.statusCode=i.statusCode),i&&i.headers&&(c.headers=i.headers),e?(v.url&&(c.url=v.url),v.method&&(c.method=v.method),e=o.extend(e||{},c),t(e,null)):(a=o.extend(a||{},c),t(null,a)),E=null}};if(e)c({error:e});else{var u=i.statusCode,l=2===Math.floor(u/100);if(g){if(l)return c(null,{body:a});if(a instanceof ArrayBuffer){var d=o.arrayBufferToString(a),p=o.parseResBody(d);return c({error:p.Error||p})}}var h=o.parseResBody(a);l?h.Error?c({error:h.Error}):c(null,h):c({error:h.Error||h})}}})),T=function e(t){t.TaskId===s&&(E&&E.abort&&E.abort(),n.off("inner-kill-task",e))};s&&n.on("inner-kill-task",T)}}var f={getService:function(e,t){"function"==typeof e&&(t=e,e={});var n="https:",i=this.options.ServiceDomain,s=e.Region;i?(i=i.replace(/\{\{Region\}\}/gi,s||"").replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(i)||(i=n+"//"+i),"/"===i.slice(-1)&&(i=i.slice(0,-1))):i=s?n+"//cos."+s+".myqcloud.com":n+"//service.cos.myqcloud.com",i.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1"),h.call(this,{Action:"name/cos:GetService",url:i,method:"GET",headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Buckets&&n.ListAllMyBucketsResult.Buckets.Bucket||[];i=o.isArray(i)?i:[i];var s=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Owner||{};t(null,{Buckets:i,Owner:s,statusCode:n.statusCode,headers:n.headers})}))},putBucket:function(e,t){var n=this,i="";if(e.BucketAZConfig){var s={BucketAZConfig:e.BucketAZConfig};i=o.json2xml({CreateBucketConfiguration:s})}h.call(this,{Action:"name/cos:PutBucket",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,body:i,tracker:e.tracker},(function(i,o){if(i)return t(i);var s=c({protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,isLocation:!0});t(null,{Location:s,statusCode:o.statusCode,headers:o.headers})}))},headBucket:function(e,t){h.call(this,{Action:"name/cos:HeadBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"HEAD",tracker:e.tracker},(function(e,n){t(e,n)}))},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,h.call(this,{Action:"name/cos:GetBucket",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListBucketResult||{},s=i.Contents||[],a=i.CommonPrefixes||[];s=o.isArray(s)?s:[s],a=o.isArray(a)?a:[a];var r=o.clone(i);o.extend(r,{Contents:s,CommonPrefixes:a,statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},deleteBucket:function(e,t){h.call(this,{Action:"name/cos:DeleteBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"DELETE",tracker:e.tracker},(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,i="";if(e.AccessControlPolicy){var s=o.clone(e.AccessControlPolicy||{}),a=s.Grants||s.Grant;a=o.isArray(a)?a:[a],delete s.Grant,delete s.Grants,s.AccessControlList={Grant:a},i=o.json2xml({AccessControlPolicy:s}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=r(n[t]))})),h.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:n,action:"acl",body:i,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketAcl:function(e,t){h.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"acl",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.AccessControlPolicy||{},s=i.Owner||{},r=i.AccessControlList.Grant||[];r=o.isArray(r)?r:[r];var c=a(i);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:s,Grants:r,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putBucketCors:function(e,t){var n=(e.CORSConfiguration||{}).CORSRules||e.CORSRules||[];n=o.clone(o.isArray(n)?n:[n]),o.each(n,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",i=e[n]||e[t]||[];delete e[n],e[t]=o.isArray(i)?i:[i]}))}));var i={CORSRule:n};e.ResponseVary&&(i.ResponseVary=e.ResponseVary);var s=o.json2xml({CORSConfiguration:i}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"cors",headers:a,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketCors:function(e,t){h.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchCORSConfiguration"===e.error.Code){var i={CORSRules:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.CORSConfiguration||{},a=s.CORSRules||s.CORSRule||[];a=o.clone(o.isArray(a)?a:[a]);var r=s.ResponseVary;o.each(a,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",i=e[n]||e[t]||[];delete e[t],e[n]=o.isArray(i)?i:[i]}))})),t(null,{CORSRules:a,ResponseVary:r,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketCors:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors",tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"location",tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,n)}))},getBucketPolicy:function(e,t){h.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",rawBody:!0,tracker:e.tracker},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t({ErrorStatus:"Access Denied"}):e.statusCode&&405===e.statusCode?t({ErrorStatus:"Method Not Allowed"}):e.statusCode&&404===e.statusCode?t({ErrorStatus:"Policy Not Found"}):t(e);var i={};try{i=JSON.parse(n.body)}catch(o){}t(null,{Policy:i,statusCode:n.statusCode,headers:n.headers})}))},putBucketPolicy:function(e,t){var n=e.Policy,i=n;try{"string"==typeof n?n=JSON.parse(i):i=JSON.stringify(n)}catch(a){t({error:"Policy format error"})}var s=e.Headers;s["Content-Type"]="application/json",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:e.Bucket,Region:e.Region,action:"policy",body:i,headers:s,json:!0,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",tracker:e.tracker},(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||{},i=n.TagSet||n.Tags||e.Tags||[];i=o.clone(o.isArray(i)?i:[i]);var s=o.json2xml({Tagging:{TagSet:{Tag:i}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"tagging",headers:a,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var i={Tags:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else{var s=[];try{s=n.Tagging.TagSet.Tag||[]}catch(a){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Tags:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketTagging:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLifecycle:function(e,t){var n=(e.LifecycleConfiguration||{}).Rules||e.Rules||[];n=o.clone(n);var i=o.json2xml({LifecycleConfiguration:{Rule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"lifecycle",headers:s,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchLifecycleConfiguration"===e.error.Code){var i={Rules:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=[];try{s=n.LifecycleConfiguration.Rule||[]}catch(a){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Rules:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketLifecycle:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle",tracker:e.tracker},(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||{},i=o.json2xml({VersioningConfiguration:n}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"versioning",headers:s,tracker:e.tracker},(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({error:"missing param VersioningConfiguration"})},getBucketVersioning:function(e,t){h.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"versioning",tracker:e.tracker},(function(e,n){e||!n.VersioningConfiguration&&(n.VersioningConfiguration={}),t(e,n)}))},putBucketReplication:function(e,t){var n=o.clone(e.ReplicationConfiguration),i=o.json2xml({ReplicationConfiguration:n});i=(i=i.replace(/<(\/?)Rules>/gi,"<$1Rule>")).replace(/<(\/?)Tags>/gi,"<$1Tag>");var s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"replication",headers:s,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication",tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var i={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else e||!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=n.ReplicationConfiguration.Rule,delete n.ReplicationConfiguration.Rule),t(e,n)}))},deleteBucketReplication:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketWebsite:function(e,t){if(e.WebsiteConfiguration){var n=o.clone(e.WebsiteConfiguration||{}),i=n.RoutingRules||n.RoutingRule||[];i=o.isArray(i)?i:[i],delete n.RoutingRule,delete n.RoutingRules,i.length&&(n.RoutingRules={RoutingRule:i});var s=o.json2xml({WebsiteConfiguration:n}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"website",headers:a,tracker:e.tracker},(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({error:"missing param WebsiteConfiguration"})},getBucketWebsite:function(e,t){h.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"website",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchWebsiteConfiguration"===e.error.Code){var i={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.WebsiteConfiguration||{};if(s.RoutingRules){var a=o.clone(s.RoutingRules.RoutingRule||[]);a=o.makeArray(a),s.RoutingRules=a}t(null,{WebsiteConfiguration:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketWebsite:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"website",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketReferer:function(e,t){if(e.RefererConfiguration){var n=o.clone(e.RefererConfiguration||{}),i=n.DomainList||{},s=i.Domains||i.Domain||[];(s=o.isArray(s)?s:[s]).length&&(n.DomainList={Domain:s});var a=o.json2xml({RefererConfiguration:n}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(a)),h.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"referer",headers:r,tracker:e.tracker},(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({error:"missing param RefererConfiguration"})},getBucketReferer:function(e,t){h.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"referer",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchRefererConfiguration"===e.error.Code){var i={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.RefererConfiguration||{};if(s.DomainList){var a=o.makeArray(s.DomainList.Domain||[]);s.DomainList={Domains:a}}t(null,{RefererConfiguration:s,statusCode:n.statusCode,headers:n.headers})}}))},putBucketDomain:function(e,t){var n=(e.DomainConfiguration||{}).DomainRule||e.DomainRule||[];n=o.clone(n);var i=o.json2xml({DomainConfiguration:{DomainRule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"domain",headers:s,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=[];try{i=n.DomainConfiguration.DomainRule||[]}catch(s){}i=o.clone(o.isArray(i)?i:[i]),t(null,{DomainRule:i,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketDomain:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketOrigin:function(e,t){var n=(e.OriginConfiguration||{}).OriginRule||e.OriginRule||[];n=o.clone(n);var i=o.json2xml({OriginConfiguration:{OriginRule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"origin",headers:s,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=[];try{i=n.OriginConfiguration.OriginRule||[]}catch(s){}i=o.clone(o.isArray(i)?i:[i]),t(null,{OriginRule:i,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketOrigin:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLogging:function(e,t){var n=o.json2xml({BucketLoggingStatus:e.BucketLoggingStatus||""}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(n)),h.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:n,action:"logging",headers:i,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"logging",tracker:e.tracker},(function(e,n){if(e)return t(e);delete n.BucketLoggingStatus._xmlns,t(null,{BucketLoggingStatus:n.BucketLoggingStatus,statusCode:n.statusCode,headers:n.headers})}))},putBucketInventory:function(e,t){var n=o.clone(e.InventoryConfiguration);if(n.OptionalFields){var i=n.OptionalFields||[];n.OptionalFields={Field:i}}if(n.Destination&&n.Destination.COSBucketDestination&&n.Destination.COSBucketDestination.Encryption){var s=n.Destination.COSBucketDestination.Encryption;Object.keys(s).indexOf("SSECOS")>-1&&(s["SSE-COS"]=s.SSECOS,delete s.SSECOS)}var a=o.json2xml({InventoryConfiguration:n}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(a)),h.call(this,{Action:"name/cos:PutBucketInventory",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:a,action:"inventory",qs:{id:e.Id},headers:r,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketInventory:function(e,t){h.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id},tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.InventoryConfiguration;if(i&&i.OptionalFields&&i.OptionalFields.Field){var s=i.OptionalFields.Field;o.isArray(s)||(s=[s]),i.OptionalFields=s}if(i.Destination&&i.Destination.COSBucketDestination&&i.Destination.COSBucketDestination.Encryption){var a=i.Destination.COSBucketDestination.Encryption;Object.keys(a).indexOf("SSE-COS")>-1&&(a.SSECOS=a["SSE-COS"],delete a["SSE-COS"])}t(null,{InventoryConfiguration:i,statusCode:n.statusCode,headers:n.headers})}))},listBucketInventory:function(e,t){h.call(this,{Action:"name/cos:ListBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{"continuation-token":e.ContinuationToken},tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListInventoryConfigurationResult,s=i.InventoryConfiguration||[];s=o.isArray(s)?s:[s],delete i.InventoryConfiguration,o.each(s,(function(e){if(e&&e.OptionalFields&&e.OptionalFields.Field){var t=e.OptionalFields.Field;o.isArray(t)||(t=[t]),e.OptionalFields=t}if(e.Destination&&e.Destination.COSBucketDestination&&e.Destination.COSBucketDestination.Encryption){var n=e.Destination.COSBucketDestination.Encryption;Object.keys(n).indexOf("SSE-COS")>-1&&(n.SSECOS=n["SSE-COS"],delete n["SSE-COS"])}})),i.InventoryConfigurations=s,o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))},deleteBucketInventory:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id},tracker:e.tracker},(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||{}},i=o.json2xml(n),s={"Content-Type":"application/xml"};s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Interface:"putBucketAccelerate",Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"accelerate",headers:s,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param AccelerateConfiguration"})},getBucketAccelerate:function(e,t){h.call(this,{Interface:"getBucketAccelerate",Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:e.Bucket,Region:e.Region,action:"accelerate",tracker:e.tracker},(function(e,n){e||!n.AccelerateConfiguration&&(n.AccelerateConfiguration={}),t(e,n)}))},getObject:function(e,t){if(this.options.ObjectKeySimplifyCheck&&"/"===o.simplifyPath(e.Key))t(o.error(new Error("The Getobject Key is illegal")));else{var n=e.Query||{},i=e.QueryString||"",s=e.tracker;s&&s.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,h.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,qs:n,qsStr:i,rawBody:!0,dataType:e.DataType,tracker:s},(function(n,i){if(n){var s=n.statusCode;return e.Headers["If-Modified-Since"]&&s&&304===s?t(null,{NotModified:!0}):t(n)}t(null,{Body:i.body,ETag:o.attr(i.headers,"etag",""),statusCode:i.statusCode,headers:i.headers})}))}},headObject:function(e,t){h.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,tracker:e.tracker},(function(n,i){if(n){var s=n.statusCode;return e.Headers["If-Modified-Since"]&&s&&304===s?t(null,{NotModified:!0,statusCode:s}):t(n)}i.ETag=o.attr(i.headers,"etag",""),t(null,i)}))},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,h.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListVersionsResult||{},s=i.DeleteMarker||[];s=o.isArray(s)?s:[s];var a=i.Version||[];a=o.isArray(a)?a:[a];var r=o.clone(i);delete r.DeleteMarker,delete r.Version,o.extend(r,{DeleteMarkers:s,Versions:a,statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},putObject:function(e,t){var n=this,i=e.ContentLength,a=o.throttleOnProgress.call(n,i,e.onProgress),r=e.Headers;r["Cache-Control"]||r["cache-control"]||(r["Cache-Control"]=""),r["Content-Type"]||r["content-type"]||(r["Content-Type"]=s.getType(e.Key)||"application/octet-stream");var u=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5,l=e.tracker;u&&l&&l.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(u,e.Body,(function(s){s&&(l&&l.setParams({md5EndTime:(new Date).getTime()}),n.options.UploadCheckContentMd5&&(r["Content-MD5"]=o.binaryBase64(s)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(r["x-cos-meta-md5"]=s)),void 0!==e.ContentLength&&(r["Content-Length"]=e.ContentLength),a(null,!0),h.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:a,tracker:l},(function(s,r){if(s)return a(null,!0),t(s);a({loaded:i,total:i},!0);var u=c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:n.options.UseAccelerate?"accelerate":e.Region,object:e.Key});u=u.substr(u.indexOf("://")+3),r.Location=u,r.ETag=o.attr(r.headers,"etag",""),t(null,r)}))}))},postObject:function(e,t){var n=this,i={},s=e.FilePath;if(s){for(var a in i["Cache-Control"]=e.CacheControl,i["Content-Disposition"]=e.ContentDisposition,i["Content-Encoding"]=e.ContentEncoding,i["Content-MD5"]=e.ContentMD5,i["Content-Length"]=e.ContentLength,i["Content-Type"]=e.ContentType,i.Expect=e.Expect,i.Expires=e.Expires,i["x-cos-acl"]=e.ACL,i["x-cos-grant-read"]=e.GrantRead,i["x-cos-grant-write"]=e.GrantWrite,i["x-cos-grant-full-control"]=e.GrantFullControl,i["x-cos-storage-class"]=e.StorageClass,i["x-cos-mime-limit"]=e.MimeLimit,i["x-cos-traffic-limit"]=e.TrafficLimit,i["x-cos-forbid-overwrite"]=e.ForbidOverwrite,i["x-cos-server-side-encryption-customer-algorithm"]=e.SSECustomerAlgorithm,i["x-cos-server-side-encryption-customer-key"]=e.SSECustomerKey,i["x-cos-server-side-encryption-customer-key-MD5"]=e.SSECustomerKeyMD5,i["x-cos-server-side-encryption"]=e.ServerSideEncryption,i["x-cos-server-side-encryption-cos-kms-key-id"]=e.SSEKMSKeyId,i["x-cos-server-side-encryption-context"]=e.SSEContext,delete i["Content-Length"],delete i["content-length"],e)a.indexOf("x-cos-meta-")>-1&&(i[a]=e[a]);var r=o.throttleOnProgress.call(n,i["Content-Length"],e.onProgress);h.call(this,{Action:"name/cos:PostObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:i,qs:e.Query,filePath:s,TaskId:e.TaskId,onProgress:r,tracker:e.tracker},(function(i,o){if(r(null,!0),i)return t(i);if(o&&o.headers){var a=o.headers,u=a.etag||a.Etag||a.ETag||"",l=s.substr(s.lastIndexOf("/")+1),d=c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key.replace(/\$\{filename\}/g,l),isLocation:!0});return t(null,{Location:d,statusCode:o.statusCode,headers:a,ETag:u})}t(null,o)}))}else t({error:"missing param FilePath"})},deleteObject:function(e,t){h.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId,tracker:e.tracker},(function(e,n){if(e){var i=e.statusCode;return i&&204===i?t(null,{statusCode:i}):i&&404===i?t(null,{BucketNotFound:!0,statusCode:i}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectAcl:function(e,t){var n={};e.VersionId&&(n.versionId=e.VersionId),h.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:n,action:"acl",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.AccessControlPolicy||{},s=i.Owner||{},r=i.AccessControlList&&i.AccessControlList.Grant||[];r=o.isArray(r)?r:[r];var c=a(i);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:s,Grants:r,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putObjectAcl:function(e,t){var n=e.Headers,i="";if(e.AccessControlPolicy){var s=o.clone(e.AccessControlPolicy||{}),a=s.Grants||s.Grant;a=o.isArray(a)?a:[a],delete s.Grant,delete s.Grants,s.AccessControlList={Grant:a},i=o.json2xml({AccessControlPolicy:s}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=r(n[t]))})),h.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:n,body:i,tracker:e.tracker},(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,h.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n,tracker:e.tracker},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var i=n.headers||{};t(null,{AccessControlAllowOrigin:i["access-control-allow-origin"],AccessControlAllowMethods:i["access-control-allow-methods"],AccessControlAllowHeaders:i["access-control-allow-headers"],AccessControlExposeHeaders:i["access-control-expose-headers"],AccessControlMaxAge:i["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})}))},putObjectCopy:function(e,t){var n=e.Headers;!n["Cache-Control"]&&n["cache-control"]&&(n["Cache-Control"]="");var i=e.CopySource||"",s=o.getSourceParams.call(this,i);if(s){var a=s.Bucket,r=s.Region,c=decodeURIComponent(s.Key);h.call(this,{Scope:[{action:"name/cos:GetObject",bucket:a,region:r,prefix:c},{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,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=o.clone(n.CopyObjectResult||{});o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))}else t({error:"CopySource format error"})},deleteMultipleObject:function(e,t){var n=e.Objects||[],i=e.Quiet;n=o.isArray(n)?n:[n];var s=o.json2xml({Delete:{Object:n,Quiet:i||!1}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s));var r=o.map(n,(function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}}));h.call(this,{Scope:r,method:"POST",Bucket:e.Bucket,Region:e.Region,body:s,action:"delete",headers:a,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.DeleteResult||{},s=i.Deleted||[],a=i.Error||[];s=o.isArray(s)?s:[s],a=o.isArray(a)?a:[a];var r=o.clone(i);o.extend(r,{Error:a,Deleted:s,statusCode:n.statusCode,headers:n.headers}),t(null,r)}))},restoreObject:function(e,t){var n=e.Headers;if(e.RestoreRequest){var i=e.RestoreRequest||{},s=o.json2xml({RestoreRequest:i});n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:s,action:"restore",headers:n,tracker:e.tracker},(function(e,n){t(e,n)}))}else t({error:"missing param RestoreRequest"})},putObjectTagging:function(e,t){var n=e.Tagging||{},i=n.TagSet||n.Tags||e.Tags||[];i=o.clone(o.isArray(i)?i:[i]);var s=o.json2xml({Tagging:{TagSet:{Tag:i}}}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Interface:"putObjectTagging",Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:e.Bucket,Key:e.Key,Region:e.Region,body:s,action:"tagging",headers:a,VersionId:e.VersionId,tracker:e.tracker},(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){h.call(this,{Interface:"getObjectTagging",Action:"name/cos:GetObjectTagging",method:"GET",Key:e.Key,Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",VersionId:e.VersionId,tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var i={Tags:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else{var s=[];try{s=n.Tagging.TagSet.Tag||[]}catch(a){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Tags:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteObjectTagging:function(e,t){h.call(this,{Interface:"deleteObjectTagging",Action:"name/cos:DeleteObjectTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"tagging",VersionId:e.VersionId,tracker:e.tracker},(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})}))},appendObject:function(e,t){h.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,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,n)}))},uploadPartCopy:function(e,t){var n=e.CopySource||"",i=o.getSourceParams.call(this,n);if(i){var s=i.Bucket,a=i.Region,r=decodeURIComponent(i.Key);h.call(this,{Scope:[{action:"name/cos:GetObject",bucket:s,region:a,prefix:r},{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,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=o.clone(n.CopyPartResult||{});o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))}else t({error:"CopySource format error"})},multipartInit:function(e,t){var n=e.Headers,i=e.tracker;n["Cache-Control"]||n["cache-control"]||(n["Cache-Control"]=""),n["Content-Type"]||n["content-type"]||(n["Content-Type"]=s.getType(e.Key)||"application/octet-stream"),h.call(this,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers,qs:e.Query,tracker:i},(function(e,n){return e?(i&&i.parent&&i.parent.setParams({errorNode:"multipartInit"}),t(e)):(n=o.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,o.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)}))},multipartUpload:function(e,t){var n=this;o.getFileSize("multipartUpload",e,(function(){var i=e.tracker,s=n.options.UploadCheckContentMd5;s&&i&&i.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(s,e.Body,(function(a){a&&(e.Headers["Content-MD5"]=o.binaryBase64(a),s&&i&&i.setParams({md5EndTime:(new Date).getTime()})),i&&i.setParams({partNumber:e.PartNumber}),h.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:i},(function(e,n){if(e)return i&&i.parent&&i.parent.setParams({errorNode:"multipartUpload"}),t(e);t(null,{ETag:o.attr(n.headers,"etag",{}),statusCode:n.statusCode,headers:n.headers})}))}))}))},multipartComplete:function(e,t){for(var n=this,i=e.UploadId,s=e.Parts,a=e.tracker,r=0,u=s.length;r-1?(o=n.Authorization,r=o.match(/q-url-param-list.*?(?=&)/g)[0],c="q-url-param-list="+encodeURIComponent(r.replace(/q-url-param-list=/,"")).toLowerCase(),u=new RegExp(r,"g"),o.replace(u,c)):"sign="+encodeURIComponent(n.Authorization)),n.SecurityToken&&(i+="&x-cos-security-token="+n.SecurityToken),n.ClientIP&&(i+="&clientIP="+n.ClientIP),n.ClientUA&&(i+="&clientUA="+n.ClientUA),n.Token&&(i+="&token="+n.Token),a&&(i+="&"+a),setTimeout((function(){t(null,{Url:i})}))}var o,r,c,u}));return p?(r+="?"+p.Authorization+(p.SecurityToken?"&x-cos-security-token="+p.SecurityToken:""),a&&(r+="&"+a)):a&&(r+="?"+a),r},getAuth:function(e){return o.getAuth({SecretId:e.SecretId||this.options.SecretId||"",SecretKey:e.SecretKey||this.options.SecretKey||"",Bucket:e.Bucket,Region:e.Region,Method:e.Method,Key:e.Key,Query:e.Query,Headers:e.Headers,Expires:e.Expires,SystemClockOffset:this.options.SystemClockOffset})}};e.exports.init=function(e,t){t.transferToTaskMethod(f,"postObject"),t.transferToTaskMethod(f,"putObject"),o.each(f,(function(t,n){e.prototype[n]=o.apiWrapper(n,t)}))}},function(e,t){function n(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}var i=function(e,t){var i,o,s,a=[],r=function(e,t){var i=[];for(var o in e)e.hasOwnProperty(o)&&i.push(t?n(o).toLowerCase():o);return i.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}(e);for(i=0;i-1||g.indexOf(f)>-1)&&(h[f]=e.headers[f]);s["x-cos-acl"]&&(h.acl=s["x-cos-acl"]),!h["Content-Type"]&&(h["Content-Type"]=""),(n=Pn.uploadFile({url:a,method:r,name:"file",header:s,filePath:o,formData:h,timeout:e.timeout,success:function(e){l(null,e)},fail:function(e){l(e.errMsg,e)}})).onProgressUpdate((function(e){c&&c({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend,progress:e.progress/100})}))}else{var m=e.qs&&i(e.qs)||"";m&&(a+=(a.indexOf("?")>-1?"&":"?")+m),s["Content-Length"]&&delete s["Content-Length"];var _={url:a,method:r,header:s,dataType:"text",data:e.body,responseType:e.dataType||"text",timeout:e.timeout,redirect:"manual",success:function(e){l(null,e)},fail:function(e){l(e.errMsg,e)}};u&&Object.assign(_,{enableHttpDNS:!0,httpDNSServiceId:u}),n=Pn.request(_)}return n}},function(e,t,n){let i=n(29);e.exports=new i(n(30),n(31))},function(e,t,n){function i(){this._types=Object.create(null),this._extensions=Object.create(null);for(let e=0;e=0;--o){var r=this.tryEntries[o],a=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var c=s.call(r,"catchLoc"),l=s.call(r,"finallyLoc");if(c&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;R(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:M(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),y}},t}function s(e,t,n,i,o,s,r){try{var a=e[s](r),c=a.value}catch(l){return void n(l)}a.done?t(c):Promise.resolve(c).then(i,o)}function r(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var r=e.apply(t,n);function a(e){s(r,i,o,a,c,"next",e)}function c(e){s(r,i,o,a,c,"throw",e)}a(void 0)}))}}function a(e,t,n){return(t=l(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){for(var n=0;n5&&"xml"===i)return f("InvalidXml","XML declaration allowed only at the start of the document.",g(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function a(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t"===e[t+2]){t+=2;break}return t}t.validate=function(e,t){t=Object.assign({},o,t);const n=[];let c=!1,l=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)y+=e[o];if(y=y.trim(),"/"===y[y.length-1]&&(y=y.substring(0,y.length-1),o--),p=y,!i.isName(p)){let t;return t=0===y.trim().length?"Invalid space after '<'.":"Tag '"+y+"' is an invalid name.",f("InvalidTag",t,g(e,o))}const b=u(e,o);if(!1===b)return f("InvalidAttr","Attributes for '"+y+"' have open quote.",g(e,o));let x=b.value;if(o=b.index,"/"===x[x.length-1]){const n=o-x.length;x=x.substring(0,x.length-1);const i=d(x,t);if(!0!==i)return f(i.err.code,i.err.msg,g(e,n+i.err.line));c=!0}else if(v){if(!b.tagClosed)return f("InvalidTag","Closing tag '"+y+"' doesn't have proper closing.",g(e,o));if(x.trim().length>0)return f("InvalidTag","Closing tag '"+y+"' can't have attributes or invalid starting.",g(e,m));if(0===n.length)return f("InvalidTag","Closing tag '"+y+"' has not been opened.",g(e,m));{const t=n.pop();if(y!==t.tagName){let n=g(e,t.tagStartPos);return f("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+y+"'.",g(e,m))}0==n.length&&(l=!0)}}else{const i=d(x,t);if(!0!==i)return f(i.err.code,i.err.msg,g(e,o-x.length+i.err.line));if(!0===l)return f("InvalidXml","Multiple possible root nodes found.",g(e,o));-1!==t.unpairedTags.indexOf(y)||n.push({tagName:y,tagStartPos:m}),c=!0}for(o++;o0)||f("InvalidXml","Invalid '"+JSON.stringify(n.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):f("InvalidXml","Start tag expected.",1)};const c='"',l="'";function u(e,t){let n="",i="",o=!1;for(;t"===e[t]&&""===i){o=!0;break}n+=e[t]}return""===i&&{value:n,index:t,tagClosed:o}}const p=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function d(e,t){const n=i.getAllMatches(e,p),o={};for(let i=0;i{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1}},function(e,t){var n=function(e){var t={},n=function(e){return!t[e]&&(t[e]=[]),t[e]};e.on=function(e,t){n(e).push(t)},e.off=function(e,t){for(var i=n(e),o=i.length-1;o>=0;o--)t===i[o]&&i.splice(o,1)},e.emit=function(e,t){for(var i=n(e).map((function(e){return e})),o=0;o=0;n--){var o=i[n][2];(!o||o+2592e3=0;s--){var r=i[s];(r[0]===e&&r[1]===t||e!==r[0]&&0===r[0].indexOf(o))&&i.splice(s,1)}i.unshift([e,t,Math.round(Date.now()/1e3)]),i.length>n&&i.splice(n),l()}},removeUploadId:function(e){c(),delete u.using[e];for(var t=i.length-1;t>=0;t--)i[t][1]===e&&i.splice(t,1);l()}};e.exports=u},function(e,t,n){var i=n(9);e.exports=i},function(e,t,n){var i=n(0),o=n(6),s=n(25),r=n(26),a=n(32),c=n(3),l={SecretId:"",SecretKey:"",SecurityToken:"",StartTime:0,ExpiredTime:0,ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1048576,SliceSize:1048576,CopyChunkParallelLimit:20,CopyChunkSize:10485760,CopySliceSize:10485760,MaxPartNumber:1e4,ProgressInterval:1e3,UploadQueueSize:1e4,Domain:"",ServiceDomain:"",Protocol:"",CompatibilityMode:!1,ForcePathStyle:!1,Timeout:0,CorrectClockSkew:!0,SystemClockOffset:0,UploadCheckContentMd5:!1,UploadAddMetaMd5:!1,UploadIdCacheLimit:50,UseAccelerate:!1,ForceSignHost:!0,HttpDNSServiceId:"",SimpleUploadMethod:"postObject",AutoSwitchHost:!1,CopySourceParser:null,ObjectKeySimplifyCheck:!0,DeepTracker:!1,TrackerDelay:5e3,CustomId:"",BeaconReporter:null,ClsReporter:null},u=function(e){if(this.options=i.extend(i.clone(l),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.EnableReporter=this.options.BeaconReporter||this.options.ClsReporter,this.options.AppId,this.options.SecretId&&this.options.SecretId.indexOf(" "),this.options.SecretKey&&this.options.SecretKey.indexOf(" "),this.options.ForcePathStyle)throw new Error("ForcePathStyle is not supported");o.init(this),s.init(this)};r.init(u,s),a.init(u,s),u.util={md5:i.md5,xml2json:i.xml2json,json2xml:i.json2xml,encodeBase64:i.encodeBase64},u.getAuthorization=i.getAuth,u.version=c.version,e.exports=u},function(e,t,n){(function(e){var t;function i(e){return(i="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)}!function(){var o="input is invalid type",s="object"===("undefined"==typeof window?"undefined":i(window)),r=s?window:{};r.JS_MD5_NO_WINDOW&&(s=!1),!s&&"object"===("undefined"==typeof self?"undefined":i(self))&&(r=self);var a,c=!r.JS_MD5_NO_COMMON_JS&&"object"===i(e)&&e.exports,l=n(12),u=!r.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,p="0123456789abcdef".split(""),d=[128,32768,8388608,-2147483648],h=[0,8,16,24],f=["hex","array","digest","buffer","arrayBuffer","base64"],m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),g=[];if(u){var v=new ArrayBuffer(68);a=new Uint8Array(v),g=new Uint32Array(v)}!r.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!u||!r.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===i(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});var y=function(e){return function(t){return new b(!0).update(t)[e]()}};function b(e){if(e)g[0]=g[16]=g[1]=g[2]=g[3]=g[4]=g[5]=g[6]=g[7]=g[8]=g[9]=g[10]=g[11]=g[12]=g[13]=g[14]=g[15]=0,this.blocks=g,this.buffer8=a;else if(u){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}b.prototype.update=function(e){if(!this.finalized){var t,n=i(e);if("string"!==n){if("object"!==n)throw o;if(null===e)throw o;if(!u||e.constructor!==ArrayBuffer&&"ArrayBuffer"!==e.constructor.name){if(!(Array.isArray(e)||u&&ArrayBuffer.isView(e)))throw o}else e=new Uint8Array(e);t=!0}for(var s,r,a=0,c=e.length,l=this.blocks,p=this.buffer8;a>2]|=e[a]<>6,p[r++]=128|63&s):s<55296||s>=57344?(p[r++]=224|s>>12,p[r++]=128|s>>6&63,p[r++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++a)),p[r++]=240|s>>18,p[r++]=128|s>>12&63,p[r++]=128|s>>6&63,p[r++]=128|63&s);else for(r=this.start;a>2]|=s<>2]|=(192|s>>6)<>2]|=(128|63&s)<=57344?(l[r>>2]|=(224|s>>12)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<>2]|=(240|s>>18)<>2]|=(128|s>>12&63)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<=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}},b.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=d[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()}},b.prototype.hash=function(){var e,t,n,i,o,s,r=this.blocks;this.first?t=((t=((e=((e=r[0]-680876937)<<7|e>>>25)-271733879|0)^(n=((n=(-271733879^(i=((i=(-1732584194^2004318071&e)+r[1]-117830708)<<12|i>>>20)+e|0)&(-271733879^e))+r[2]-1126478375)<<17|n>>>15)+i|0)&(i^e))+r[3]-1316259209)<<22|t>>>10)+n|0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((i=this.h3)^t&(n^i))+r[0]-680876936)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+r[1]-389564586)<<12|i>>>20)+e|0)&(e^t))+r[2]+606105819)<<17|n>>>15)+i|0)&(i^e))+r[3]-1044525330)<<22|t>>>10)+n|0),t=((t+=((e=((e+=(i^t&(n^i))+r[4]-176418897)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+r[5]+1200080426)<<12|i>>>20)+e|0)&(e^t))+r[6]-1473231341)<<17|n>>>15)+i|0)&(i^e))+r[7]-45705983)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(i^t&(n^i))+r[8]+1770035416)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+r[9]-1958414417)<<12|i>>>20)+e|0)&(e^t))+r[10]-42063)<<17|n>>>15)+i|0)&(i^e))+r[11]-1990404162)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(i^t&(n^i))+r[12]+1804603682)<<7|e>>>25)+t|0)^(n=((n+=(t^(i=((i+=(n^e&(t^n))+r[13]-40341101)<<12|i>>>20)+e|0)&(e^t))+r[14]-1502002290)<<17|n>>>15)+i|0)&(i^e))+r[15]+1236535329)<<22|t>>>10)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+r[1]-165796510)<<5|e>>>27)+t|0)^t))+r[6]-1069501632)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+r[11]+643717713)<<14|n>>>18)+i|0)^i))+r[0]-373897302)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+r[5]-701558691)<<5|e>>>27)+t|0)^t))+r[10]+38016083)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+r[15]-660478335)<<14|n>>>18)+i|0)^i))+r[4]-405537848)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+r[9]+568446438)<<5|e>>>27)+t|0)^t))+r[14]-1019803690)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+r[3]-187363961)<<14|n>>>18)+i|0)^i))+r[8]+1163531501)<<20|t>>>12)+n|0,t=((t+=((i=((i+=(t^n&((e=((e+=(n^i&(t^n))+r[13]-1444681467)<<5|e>>>27)+t|0)^t))+r[2]-51403784)<<9|i>>>23)+e|0)^e&((n=((n+=(e^t&(i^e))+r[7]+1735328473)<<14|n>>>18)+i|0)^i))+r[12]-1926607734)<<20|t>>>12)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+r[5]-378558)<<4|e>>>28)+t|0))+r[8]-2022574463)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+r[11]+1839030562)<<16|n>>>16)+i|0))+r[14]-35309556)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+r[1]-1530992060)<<4|e>>>28)+t|0))+r[4]+1272893353)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+r[7]-155497632)<<16|n>>>16)+i|0))+r[10]-1094730640)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+r[13]+681279174)<<4|e>>>28)+t|0))+r[0]-358537222)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+r[3]-722521979)<<16|n>>>16)+i|0))+r[6]+76029189)<<23|t>>>9)+n|0,t=((t+=((s=(i=((i+=((o=t^n)^(e=((e+=(o^i)+r[9]-640364487)<<4|e>>>28)+t|0))+r[12]-421815835)<<11|i>>>21)+e|0)^e)^(n=((n+=(s^t)+r[15]+530742520)<<16|n>>>16)+i|0))+r[2]-995338651)<<23|t>>>9)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+r[0]-198630844)<<6|e>>>26)+t|0)|~n))+r[7]+1126891415)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+r[14]-1416354905)<<15|n>>>17)+i|0)|~e))+r[5]-57434055)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+r[12]+1700485571)<<6|e>>>26)+t|0)|~n))+r[3]-1894986606)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+r[10]-1051523)<<15|n>>>17)+i|0)|~e))+r[1]-2054922799)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+r[8]+1873313359)<<6|e>>>26)+t|0)|~n))+r[15]-30611744)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+r[6]-1560198380)<<15|n>>>17)+i|0)|~e))+r[13]+1309151649)<<21|t>>>11)+n|0,t=((t+=((i=((i+=(t^((e=((e+=(n^(t|~i))+r[4]-145523070)<<6|e>>>26)+t|0)|~n))+r[11]-1120210379)<<10|i>>>22)+e|0)^((n=((n+=(e^(i|~t))+r[2]+718787259)<<15|n>>>17)+i|0)|~e))+r[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=i+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+i|0)},b.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3;return p[e>>4&15]+p[15&e]+p[e>>12&15]+p[e>>8&15]+p[e>>20&15]+p[e>>16&15]+p[e>>28&15]+p[e>>24&15]+p[t>>4&15]+p[15&t]+p[t>>12&15]+p[t>>8&15]+p[t>>20&15]+p[t>>16&15]+p[t>>28&15]+p[t>>24&15]+p[n>>4&15]+p[15&n]+p[n>>12&15]+p[n>>8&15]+p[n>>20&15]+p[n>>16&15]+p[n>>28&15]+p[n>>24&15]+p[i>>4&15]+p[15&i]+p[i>>12&15]+p[i>>8&15]+p[i>>20&15]+p[i>>16&15]+p[i>>28&15]+p[i>>24&15]},b.prototype.toString=b.prototype.hex,b.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&i,i>>8&255,i>>16&255,i>>24&255]},b.prototype.array=b.prototype.digest,b.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},b.prototype.buffer=b.prototype.arrayBuffer,b.prototype.base64=function(){for(var e,t,n,i="",o=this.array(),s=0;s<15;)e=o[s++],t=o[s++],n=o[s++],i+=m[e>>>2]+m[63&(e<<4|t>>>4)]+m[63&(t<<2|n>>>6)]+m[63&n];return e=o[s],i+(m[e>>>2]+m[e<<4&63]+"==")};var x=function(){var e=y("hex");e.getCtx=e.create=function(){return new b},e.update=function(t){return e.create().update(t)};for(var t=0;t>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(i+o)%4*8;else if(65535>>2]=n[o>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],i=0;i>>2]>>>24-i%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=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(n,t/2)}},c=r.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],i=0;i>>2]>>>24-i%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(n,t)}},l=r.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},u=n.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.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,i=n.words,o=n.sigBytes,r=this.blockSize,a=o/(4*r);if(t=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*r,o=e.min(4*t,o),t){for(var c=0;cl;l++){if(16>l)s[l]=0|e[t+l];else{var u=s[l-3]^s[l-8]^s[l-14]^s[l-16];s[l]=u<<1|u>>>31}u=(i<<5|i>>>27)+c+s[l],u=20>l?u+(1518500249+(o&r|~o&a)):40>l?u+(1859775393+(o^r^a)):60>l?u+((o&r|o&a|r&a)-1894007588):u+((o^r^a)-899497514),c=a,a=r,r=o<<30|o>>>2,o=i,i=u}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+r|0,n[3]=n[3]+a|0,n[4]=n[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(i+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}}),n.SHA1=o._createHelper(r),n.HmacSHA1=o._createHmacHelper(r),u=(l=p).enc.Utf8,l.algo.HMAC=l.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=u.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),r=o.words,a=s.words,c=0;c>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a>>6*(3-a)&63));var c=i.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,n=this._map,i=n.charAt(64);if(i){var o=e.indexOf(i);-1!=o&&(t=o)}for(var s=[],r=0,a=0;a>>6-a%4*2;s[r>>>2]|=(l|u)<<24-r%4*8,r++}return c.create(s,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.exports=p},function(e,t){var n,i,o,s,r,a,c,l,u,p,d,h,f,m,g,v,y,b,x,S=(i=(n=n||{}).Base64,s=function(e){for(var t={},n=0,i=e.length;n>>6)+r(128|63&t):r(224|t>>>12&15)+r(128|t>>>6&63)+r(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return r(240|t>>>18&7)+r(128|t>>>12&63)+r(128|t>>>6&63)+r(128|63&t)},c=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,l=function(e){return e.replace(c,a)},u=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[o.charAt(n>>>18),o.charAt(n>>>12&63),t>=2?"=":o.charAt(n>>>6&63),t>=1?"=":o.charAt(63&n)].join("")},p=n.btoa?function(e){return n.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,u)},d=function(e){return p(l(e))},h=function(e,t){return t?d(String(e)).replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,""):d(String(e))},f=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g"),m=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 r(55296+(t>>>10))+r(56320+(1023&t));case 3:return r((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return r((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},g=function(e){return e.replace(f,m)},v=function(e){var t=e.length,n=t%4,i=(t>0?s[e.charAt(0)]<<18:0)|(t>1?s[e.charAt(1)]<<12:0)|(t>2?s[e.charAt(2)]<<6:0)|(t>3?s[e.charAt(3)]:0),o=[r(i>>>16),r(i>>>8&255),r(255&i)];return o.length-=[0,0,2,1][n],o.join("")},y=n.atob?function(e){return n.atob(e)}:function(e){return e.replace(/[\s\S]{1,4}/g,v)},b=function(e){return g(y(e))},{VERSION:"2.1.9",atob:y,btoa:p,fromBase64:x=function(e){return b(String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,""))},toBase64:h,utob:l,encode:h,encodeURI:function(e){return h(e,!0)},btou:g,decode:x,noConflict:function(){var e=n.Base64;return n.Base64=i,e}});e.exports=S},function(e,t,n){const i=n(4),o=n(16),s=n(23);e.exports={XMLParser:o,XMLValidator:i,XMLBuilder:s}},function(e,t,n){const{buildOptions:i}=n(17),o=n(18),{prettify:s}=n(22),r=n(4);e.exports=class{constructor(e){this.externalEntities={},this.options=i(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=r.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new o(this.options);n.addExternalEntities(this.externalEntities);const i=n.parseXml(e);return this.options.preserveOrder||void 0===i?i:s(i,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}}},function(e,t){const n={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};t.buildOptions=function(e){return Object.assign({},n,e)},t.defaultOptions=n},function(e,t,n){const i=n(1),o=n(19),s=n(20),r=n(21),a=n(5);function c(e){const t=Object.keys(e);for(let n=0;n0)){r||(e=this.replaceEntitiesValue(e));const i=this.options.tagValueProcessor(t,e,n,o,s);return null==i?e:typeof i!=typeof e||i!==e?i:this.options.trimValues||e.trim()===e?S(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function u(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const p=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function d(e,t,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const n=i.getAllMatches(e,p),o=n.length,s={};for(let e=0;e",a,"Closing Tag is not closed.");let o=e.substring(a+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),n&&(i=this.saveTextToParentTag(i,n,r));const s=r.substring(r.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: ${o}>`);let c=0;s&&-1!==this.options.unpairedTags.indexOf(s)?(c=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=r.lastIndexOf("."),r=r.substring(0,c),n=this.tagsNodeStack.pop(),i="",a=t}else if("?"===e[a+1]){let t=b(e,a,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,n,r),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new o(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,r,t.tagName)),this.addChild(n,e,r)}a=t.closeIndex+1}else if("!--"===e.substr(a+1,3)){const t=y(e,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(a+4,t-2);i=this.saveTextToParentTag(i,n,r),n.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}a=t}else if("!D"===e.substr(a+1,2)){const t=s(e,a);this.docTypeEntities=t.entities,a=t.i}else if("!["===e.substr(a+1,2)){const t=y(e,"]]>",a,"CDATA is not closed.")-2,o=e.substring(a+9,t);i=this.saveTextToParentTag(i,n,r);let s=this.parseTextData(o,n.tagname,r,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):n.add(this.options.textNodeName,s),a=t+2}else{let s=b(e,a,this.options.removeNSPrefix),c=s.tagName;const l=s.rawTagName;let u=s.tagExp,p=s.attrExpPresent,d=s.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&i&&"!xml"!==n.tagname&&(i=this.saveTextToParentTag(i,n,r,!1));const h=n;if(h&&-1!==this.options.unpairedTags.indexOf(h.tagname)&&(n=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),c!==t.tagname&&(r+=r?"."+c:c),this.isItStopNode(this.options.stopNodes,r,c)){let t="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),r=r.substr(0,r.length-1),u=c):u=u.substr(0,u.length-1),a=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))a=s.closeIndex;else{const n=this.readStopNodeData(e,l,d+1);if(!n)throw new Error(`Unexpected end of ${l}`);a=n.i,t=n.tagContent}const i=new o(c);c!==u&&p&&(i[":@"]=this.buildAttributesMap(u,r,c)),t&&(t=this.parseTextData(t,c,r,!0,p,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),i.add(this.options.textNodeName,t),this.addChild(n,i,r)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),r=r.substr(0,r.length-1),u=c):u=u.substr(0,u.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const e=new o(c);c!==u&&p&&(e[":@"]=this.buildAttributesMap(u,r,c)),this.addChild(n,e,r),r=r.substr(0,r.lastIndexOf("."))}else{const e=new o(c);this.tagsNodeStack.push(n),c!==u&&p&&(e[":@"]=this.buildAttributesMap(u,r,c)),this.addChild(n,e,r),n=e}i="",a=d}}else i+=e[a];return t.child};function f(e,t,n){const i=this.options.updateTag(t.tagname,n,t[":@"]);!1===i||("string"==typeof i?(t.tagname=i,e.addChild(t)):e.addChild(t))}const m=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function g(e,t,n,i){return e&&(void 0===i&&(i=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,i))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function v(e,t,n){const i="*."+n;for(const o in e){const n=e[o];if(i===n||t===n)return!0}return!1}function y(e,t,n,i){const o=e.indexOf(t,n);if(-1===o)throw new Error(i);return o+t.length-1}function b(e,t,n,i=">"){const o=function(e,t,n=">"){let i,o="";for(let s=t;s",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(o--,0===o))return{tagContent:e.substring(i,n),i:s};n=s}else if("?"===e[n+1])n=y(e,"?>",n+1,"StopNode is not closed.");else if("!--"===e.substr(n+1,3))n=y(e,"--\x3e",n+3,"StopNode is not closed.");else if("!["===e.substr(n+1,2))n=y(e,"]]>",n,"StopNode is not closed.")-2;else{const i=b(e,n,">");i&&((i&&i.tagName)===t&&"/"!==i.tagExp[i.tagExp.length-1]&&o++,n=i.closeIndex)}}function S(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&r(e,n)}return i.isExist(e)?e:""}e.exports=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=c,this.parseXml=h,this.parseTextData=l,this.resolveNameSpace=u,this.buildAttributesMap=d,this.isItStopNode=v,this.replaceEntitiesValue=m,this.readStopNodeData=x,this.saveTextToParentTag=g,this.addChild=f,this.ignoreAttributesFn=a(this.options.ignoreAttributes)}}},function(e,t,n){e.exports=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}},function(e,t,n){const i=n(1);function o(e,t){let n="";for(;t"===e[t]){if(d?"-"===e[t-1]&&"-"===e[t-2]&&(d=!1,i--):i--,0===i)break}else"["===e[t]?p=!0:h+=e[t];else{if(p&&r(e,t))t+=7,[entityName,val,t]=o(e,t+1),-1===val.indexOf("&")&&(n[u(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(p&&a(e,t))t+=8;else if(p&&c(e,t))t+=8;else if(p&&l(e,t))t+=9;else{if(!s)throw new Error("Invalid DOCTYPE");d=!0}i++,h=""}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}}},function(e,t){const n=/^[-+]?0x[a-fA-F0-9]+$/,i=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const o={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};e.exports=function(e,t={}){if(t=Object.assign({},o,t),!e||"string"!=typeof e)return e;let s=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(s))return e;if(t.hex&&n.test(s))return Number.parseInt(s,16);{const n=i.exec(s);if(n){const i=n[1],o=n[2];let a=(r=n[3])&&-1!==r.indexOf(".")?("."===(r=r.replace(/0+$/,""))?r="0":"."===r[0]?r="0"+r:"."===r[r.length-1]&&(r=r.substr(0,r.length-1)),r):r;const c=n[4]||n[6];if(!t.leadingZeros&&o.length>0&&i&&"."!==s[2])return e;if(!t.leadingZeros&&o.length>0&&!i&&"."!==s[1])return e;{const n=Number(s),r=""+n;return-1!==r.search(/[eE]/)||c?t.eNotation?n:e:-1!==s.indexOf(".")?"0"===r&&""===a||r===a||i&&r==="-"+a?n:e:o?a===r||i+a===r?n:e:s===r||s===i+r?n:e}}return e}var r}},function(e,t,n){function i(e,t,n){let a;const c={};for(let l=0;l0&&(c[t.textNodeName]=a):void 0!==a&&(c[t.textNodeName]=a),c}function o(e){const t=Object.keys(e);for(let n=0;n","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function r(e){this.options=Object.assign({},s,e),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=o(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=l),this.processTextOrObjNode=a,this.options.format?(this.indentate=c,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function a(e,t,n,i){const o=this.j2x(e,n+1,i.concat(t));return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}function c(e){return this.options.indentBy.repeat(e)}function l(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}r.prototype.build=function(e){return this.options.preserveOrder?i(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},r.prototype.j2x=function(e,t,n){let i="",o="";const s=n.join(".");for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))if(void 0===e[r])this.isAttribute(r)&&(o+="");else if(null===e[r])this.isAttribute(r)?o+="":"?"===r[0]?o+=this.indentate(t)+"<"+r+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+r+"/"+this.tagEndChar;else if(e[r]instanceof Date)o+=this.buildTextValNode(e[r],r,"",t);else if("object"!=typeof e[r]){const n=this.isAttribute(r);if(n&&!this.ignoreAttributesFn(n,s))i+=this.buildAttrPairStr(n,""+e[r]);else if(!n)if(r===this.options.textNodeName){let t=this.options.tagValueProcessor(r,""+e[r]);o+=this.replaceEntitiesValue(t)}else o+=this.buildTextValNode(e[r],r,"",t)}else if(Array.isArray(e[r])){const i=e[r].length;let s="",a="";for(let c=0;c"+e+o}},r.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`>${e}`,t},r.prototype.buildTextValNode=function(e,t,n,i){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(i)+``+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(i)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(i)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),""===o?this.indentate(i)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(i)+"<"+t+n+">"+o+""+t+this.tagEndChar}},r.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t`,u=!1;continue}if(h===t.commentPropName){l+=c+`\x3c!--${d[h][0][t.textNodeName]}--\x3e`,u=!0;continue}if("?"===h[0]){const e=o(d[":@"],t),n="?xml"===h?"":c;let i=d[h][0][t.textNodeName];i=0!==i.length?" "+i:"",l+=n+`<${h}${i}${e}?>`,u=!0;continue}let m=c;""!==m&&(m+=t.indentBy);const g=c+`<${h}${o(d[":@"],t)}`,v=n(d[h],t,f,m);-1!==t.unpairedTags.indexOf(h)?t.suppressUnpairedNode?l+=g+">":l+=g+"/>":v&&0!==v.length||!t.suppressEmptyNode?v&&v.endsWith(">")?l+=g+`>${v}${c}${h}>`:(l+=g+">",v&&""!==c&&(v.includes("/>")||v.includes(""))?l+=c+t.indentBy+v+c:l+=v,l+=`${h}>`):l+=g+"/>",u=!0}return l}function i(e){const t=Object.keys(e);for(let n=0;n0&&t.processEntities)for(let n=0;n0&&(i="\n"),n(e,t,"",i)}},function(e,t,n){var i=n(7),o=n(0),s={};e.exports.transferToTaskMethod=function(e,t){s[t]=e[t],e[t]=function(e,n){e.SkipTask?s[t].call(this,e,n):this._addTask(t,e,n)}},e.exports.init=function(e){var t,n,r=[],a={},c=0,l=0,u=function(e){var t={id:e.id,Bucket:e.Bucket,Region:e.Region,Key:e.Key,FilePath:e.FilePath,state:e.state,loaded:e.loaded,size:e.size,speed:e.speed,percent:e.percent,hashPercent:e.hashPercent,error:e.error};return e.FilePath&&(t.FilePath=e.FilePath),t},p=(n=function(){t=0,e.emit("task-list-update",{list:o.map(r,u)}),e.emit("list-update",{list:o.map(r,u)})},function(){t||(t=setTimeout(n))}),d=function(){if(!(r.length<=e.options.UploadQueueSize)){for(var t=0;te.options.UploadQueueSize;){var n="waiting"===r[t].state||"checking"===r[t].state||"uploading"===r[t].state;r[t]&&n?t++:(a[r[t].id]&&delete a[r[t].id],r.splice(t,1),l--)}p()}},h=function t(){if(!(c>=e.options.FileParallelLimit)){for(;r[l]&&"waiting"!==r[l].state;)l++;if(!(l>=r.length)){var n=r[l];l++,c++,n.state="checking",n.params.onTaskStart&&n.params.onTaskStart(u(n)),!n.params.UploadData&&(n.params.UploadData={});var i=o.formatParams(n.api,n.params);s[n.api].call(e,i,(function(i,o){e._isRunningTask(n.id)&&("checking"!==n.state&&"uploading"!==n.state||(n.state=i?"error":"success",i&&(n.error=i),c--,p(),t(),n.callback&&n.callback(i,o),"success"===n.state&&(n.params&&(delete n.params.UploadData,delete n.params.Body,delete n.params),delete n.callback)),d())})),p(),setTimeout(t)}}},f=function(t,n){var o=a[t];if(o){var s=o&&"waiting"===o.state,r=o&&("checking"===o.state||"uploading"===o.state);if("canceled"===n&&"canceled"!==o.state||"paused"===n&&s||"paused"===n&&r){if("paused"===n&&o.params.Body&&"function"==typeof o.params.Body.pipe)return;o.state=n,e.emit("inner-kill-task",{TaskId:t,toState:n});try{var l=o&&o.params&&o.params.UploadData.UploadId}catch(u){}"canceled"===n&&l&&i.removeUsing(l),p(),r&&(c--,h()),"canceled"===n&&(o.params&&(delete o.params.UploadData,delete o.params.Body,delete o.params),delete o.callback)}d()}};e._addTasks=function(t){o.each(t,(function(t){e._addTask(t.api,t.params,t.callback,!0)})),p()},e._addTask=function(t,n,i,s){var c="postObject"===e.options.SimpleUploadMethod?"postObject":"putObject";"sliceUploadFile"!==t||o.canFileSlice()||(t=c),n=o.formatParams(t,n);var l=o.uuid();n.TaskId=l,n.onTaskReady&&n.onTaskReady(l);var u={params:n,callback:i,api:t,index:r.length,id:l,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},f=n.onHashProgress;n.onHashProgress=function(t){e._isRunningTask(u.id)&&(u.hashPercent=t.percent,f&&f(t),p())};var m=n.onProgress;return n.onProgress=function(t){e._isRunningTask(u.id)&&("checking"===u.state&&(u.state="uploading"),u.loaded=t.loaded,u.size=t.total,u.speed=t.speed,u.percent=t.percent,m&&m(t),p())},o.getFileSize(t,n,(function(e,t){e?i(e):(a[l]=u,r.push(u),u.size=t,!s&&p(),h(),d())})),l},e._isRunningTask=function(e){var t=a[e];return!(!t||"checking"!==t.state&&"uploading"!==t.state)},e.getTaskList=function(){return o.map(r,u)},e.cancelTask=function(e){f(e,"canceled")},e.pauseTask=function(e){f(e,"paused")},e.restartTask=function(e){var t=a[e];!t||"paused"!==t.state&&"error"!==t.state||(t.state="waiting",p(),l=Math.min(l,t.index),h())},e.isUploadRunning=function(){return c||l-1?"{Region}.myqcloud.com":"cos.{Region}.myqcloud.com",e.ForcePathStyle||(s="{Bucket}."+s)),s=(s=s.replace(/\{\{AppId\}\}/gi,i).replace(/\{\{Bucket\}\}/gi,n).replace(/\{\{Region\}\}/gi,r).replace(/\{\{.*?\}\}/gi,"")).replace(/\{AppId\}/gi,i).replace(/\{BucketName\}/gi,n).replace(/\{Bucket\}/gi,t).replace(/\{Region\}/gi,r).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(s)||(s="https://"+s),"/"===s.slice(-1)&&(s=s.slice(0,-1));var c=s;return e.ForcePathStyle&&(c+="/"+t),c+="/",a&&(c+=o.camSafeUrlEncode(a).replace(/%2F/g,"/")),e.isLocation&&(c=c.replace(/^https?:\/\//,"")),c}var l=function(e){if(!e.Bucket||!e.Region)return"";var t=void 0===e.UseAccelerate?this.options.UseAccelerate:e.UseAccelerate;return(e.Url||c({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:e.Bucket,region:t?"accelerate":e.Region})).replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1")};function u(e,t){var n=o.clone(e.Headers),i="";o.each(n,(function(e,t){(""===e||["content-type","cache-control"].indexOf(t.toLowerCase())>-1)&&delete n[t],"host"===t.toLowerCase()&&(i=e)}));var s=!1!==e.ForceSignHost;!i&&e.SignHost&&s&&(n.Host=e.SignHost);var r=!1,a=function(e,n){r||(r=!0,n&&n.XCosSecurityToken&&!n.SecurityToken&&((n=o.clone(n)).SecurityToken=n.XCosSecurityToken,delete n.XCosSecurityToken),t&&t(e,n))},c=this,l=e.Bucket||"",u=e.Region||"",p="name/cos:PostObject"!==e.Action&&e.Key?e.Key:"";c.options.ForcePathStyle&&l&&(p=l+"/"+p);var d="/"+p,h={},f=e.Scope;if(!f){var m=e.Action||"",g=e.ResourceKey||e.Key||"";f=e.Scope||[{action:m,bucket:l,region:u,prefix:g}]}var v=o.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(o.getSkewTime(c.options.SystemClockOffset)/1e3)+30;if(t.StartTime&&n=t.ExpiredTime)c._StsCache.splice(e,1);else if(!t.ScopeLimit||t.ScopeLimit&&t.ScopeKey===v){h=t;break}}}();var y=function(){var t="";h.StartTime&&e.Expires?t=h.StartTime+";"+(h.StartTime+1*e.Expires):h.StartTime&&h.ExpiredTime&&(t=h.StartTime+";"+h.ExpiredTime);var i={Authorization:o.getAuth({SecretId:h.TmpSecretId,SecretKey:h.TmpSecretKey,Method:e.Method,Pathname:d,Query:e.Query,Headers:n,Expires:e.Expires,SystemClockOffset:c.options.SystemClockOffset,KeyTime:t,ForceSignHost:s}),SecurityToken:h.SecurityToken||h.XCosSecurityToken||"",Token:h.Token||"",ClientIP:h.ClientIP||"",ClientUA:h.ClientUA||"",SignFrom:"client"};a(null,i)},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(i){}if(!t)return o.error(new Error("getAuthorization callback params format error"))}else{if(!e.TmpSecretId)return o.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!e.TmpSecretKey)return o.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!e.SecurityToken&&!e.XCosSecurityToken)return o.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!e.ExpiredTime)return o.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(e.ExpiredTime&&10!==e.ExpiredTime.toString().length)return o.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(e.StartTime&&10!==e.StartTime.toString().length)return o.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(h.ExpiredTime&&h.ExpiredTime-o.getSkewTime(c.options.SystemClockOffset)/1e3>60)y();else if(c.options.getAuthorization)c.options.getAuthorization.call(c,{Bucket:l,Region:u,Method:e.Method,Key:p,Pathname:d,Query:e.Query,Headers:n,Scope:f,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:s},(function(e){"string"==typeof e&&(e={Authorization:e});var t=b(e);if(t)return a(t);e.Authorization?a(null,e):((h=e||{}).Scope=f,h.ScopeKey=v,c._StsCache.push(h),y())}));else{if(!c.options.getSTS)return function(){var t="";if(c.options.StartTime&&e.Expires){if(10!==c.options.StartTime.toString().length)return a(o.error(new Error('params "StartTime" should be 10 digits')));t=c.options.StartTime+";"+(c.options.StartTime+1*e.Expires)}else if(c.options.StartTime&&c.options.ExpiredTime){if(10!==c.options.StartTime.toString().length)return a(o.error(new Error('params "StartTime" should be 10 digits')));if(10!==c.options.ExpiredTime.toString().length)return a(o.error(new Error('params "ExpiredTime" should be 10 digits')));t=c.options.StartTime+";"+1*c.options.ExpiredTime}var i={Authorization:o.getAuth({SecretId:e.SecretId||c.options.SecretId,SecretKey:e.SecretKey||c.options.SecretKey,Method:e.Method,Pathname:d,Query:e.Query,Headers:n,Expires:e.Expires,KeyTime:t,SystemClockOffset:c.options.SystemClockOffset,ForceSignHost:s}),SecurityToken:c.options.SecurityToken||c.options.XCosSecurityToken,SignFrom:"client"};return a(null,i),i}();c.options.getSTS.call(c,{Bucket:l,Region:u},(function(e){(h=e||{}).Scope=f,h.ScopeKey=v,h.TmpSecretId||(h.TmpSecretId=h.SecretId),h.TmpSecretKey||(h.TmpSecretKey=h.SecretKey);var t=b(h);if(t)return a(t);c._StsCache.push(h),y()}))}return""}function p(e){var t=this,n=!1,i=!1,s=!1,r=e.headers&&(e.headers.date||e.headers.Date)||e.error&&e.error.ServerTime;try{var a=e.error.Code,c=e.error.Message;("RequestTimeTooSkewed"===a||"AccessDenied"===a&&"Request has expired"===c)&&(s=!0)}catch(d){}if(e){if(s&&r){var l=Date.parse(r);this.options.CorrectClockSkew&&Math.abs(o.getSkewTime(this.options.SystemClockOffset)-l)>=3e4&&(this.options.SystemClockOffset=l-Date.now(),n=!0)}else{if(5===Math.floor(e.statusCode/100))return{canRetry:!0,networkError:!1};if("timeout"===e.message)return{canRetry:!0,networkError:t.options.AutoSwitchHost}}if(e.statusCode){var u=Math.floor(e.statusCode/100),p=(null==e?void 0:e.headers)&&(null==e?void 0:e.headers["x-cos-request-id"]);[3,4,5].includes(u)&&!p&&(n=t.options.AutoSwitchHost,i=!0)}else n=!0,i=t.options.AutoSwitchHost}return{canRetry:n,networkError:i}}function d(e){var t=e.requestUrl,n=e.clientCalcSign,i=e.networkError;return!!this.options.AutoSwitchHost&&!!t&&!!n&&!!i&&/^https?:\/\/[^\/]*\.cos\.[^\/]*\.myqcloud\.com(\/.*)?$/.test(t)&&!/^https?:\/\/[^\/]*\.cos\.accelerate\.myqcloud\.com(\/.*)?$/.test(t)}function h(e,t){var n=this;!e.headers&&(e.headers={}),!e.qs&&(e.qs={}),e.VersionId&&(e.qs.versionId=e.VersionId),e.qs=o.clearKey(e.qs),e.headers&&(e.headers=o.clearKey(e.headers)),e.qs&&(e.qs=o.clearKey(e.qs));var i=o.clone(e.qs);e.action&&(i[e.action]="");var s=e.url||e.Url,r=e.SignHost||l.call(this,{Bucket:e.Bucket,Region:e.Region,Url:s}),a=e.tracker;!function o(s){var c=n.options.SystemClockOffset;e.SwitchHost&&(r=r.replace(/myqcloud.com/,"tencentcos.cn")),a&&a.setParams({signStartTime:(new Date).getTime(),httpRetryTimes:s-1}),u.call(n,{Bucket:e.Bucket||"",Region:e.Region||"",Method:e.method,Key:e.Key,Query:i,Headers:e.headers,SignHost:r,Action:e.Action,ResourceKey:e.ResourceKey,Scope:e.Scope,ForceSignHost:n.options.ForceSignHost},(function(i,r){i?t(i):(a&&a.setParams({signEndTime:(new Date).getTime(),httpStartTime:(new Date).getTime()}),e.AuthData=r,f.call(n,e,(function(i,l){var u=!1,h=!1;if(i){var f=p.call(n,i);u=f.canRetry||c!==n.options.SystemClockOffset,h=f.networkError}if(a&&a.setParams({httpEndTime:(new Date).getTime()}),i&&s<4&&u){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"]);var m=d.call(n,{requestUrl:(null==i?void 0:i.url)||"",clientCalcSign:"client"===(null==r?void 0:r.SignFrom),networkError:h});e.SwitchHost=m,e.headers["x-cos-sdk-retry"]="true",o(s+1)}else t(i,l)})))}))}(1)}function f(e,t){var n=this,s=e.TaskId;if(!s||n._isRunningTask(s)){var r=e.Bucket,a=e.Region,l=e.Key,u=e.method||"GET",p=e.url||e.Url,d=e.body,h=e.json,f=e.rawBody,m=e.dataType,g=n.options.HttpDNSServiceId;n.options.UseAccelerate&&(a="accelerate"),p=p||c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:r,region:a,object:l}),e.SwitchHost&&(p=p.replace(/myqcloud.com/,"tencentcos.cn"));var v=l?p:"";e.action&&(p=p+"?"+e.action),e.qsStr&&(p=p.indexOf("?")>-1?p+"&"+e.qsStr:p+"?"+e.qsStr);var y={method:u,url:p,headers:e.headers,qs:e.qs,filePath:e.filePath,body:d,json:h,httpDNSServiceId:g,dataType:m},b="x-cos-security-token";o.isCIHost(p)&&(b="x-ci-security-token"),y.headers.Authorization=e.AuthData.Authorization,e.AuthData.Token&&(y.headers.token=e.AuthData.Token),e.AuthData.ClientIP&&(y.headers.clientIP=e.AuthData.ClientIP),e.AuthData.ClientUA&&(y.headers.clientUA=e.AuthData.ClientUA),e.AuthData.SecurityToken&&(y.headers[b]=e.AuthData.SecurityToken),y.headers&&(y.headers=o.clearKey(y.headers)),y=o.clearKey(y),e.onProgress&&"function"==typeof e.onProgress&&(y.onProgress=function(t){if(!s||n._isRunningTask(s)){var i=t?t.loaded:0;e.onProgress({loaded:i,total:t.total})}}),this.options.Timeout&&(y.timeout=this.options.Timeout),n.options.ForcePathStyle&&(y.pathStyle=n.options.ForcePathStyle),n.emit("before-send",y);var x,S=y.url.includes("accelerate."),k=y.qs?Object.keys(y.qs).map((function(e){return"".concat(e,"=").concat(y.qs[e])})).join("&"):"",C=k?y.url+"?"+k:y.url;e.tracker&&(e.tracker.setParams({url:C,httpMethod:y.method,accelerate:S,httpSize:(null===(x=y.body)||void 0===x?void 0:x.size)||0}),e.tracker.parent&&!e.tracker.parent.params.url&&e.tracker.parent.setParams({url:v,accelerate:S}));var w=i(y,(function(e,i,r){if("abort"!==e){var a,c=function(e,r){if(s&&n.off("inner-kill-task",E),!a){a=!0;var c={};i&&i.statusCode&&(c.statusCode=i.statusCode),i&&i.headers&&(c.headers=i.headers),e?(y.url&&(c.url=y.url),y.method&&(c.method=y.method),e=o.extend(e||{},c),t(e,null)):(r=o.extend(r||{},c),t(null,r)),w=null}};if(e)c({error:e});else{var l=i.statusCode,u=2===Math.floor(l/100);if(f){if(u)return c(null,{body:r});if(r instanceof ArrayBuffer){var p=o.arrayBufferToString(r),d=o.parseResBody(p);return c({error:d.Error||d})}}var h=o.parseResBody(r);u?h.Error?c({error:h.Error}):c(null,h):c({error:h.Error||h})}}})),E=function e(t){t.TaskId===s&&(w&&w.abort&&w.abort(),n.off("inner-kill-task",e))};s&&n.on("inner-kill-task",E)}}var m={getService:function(e,t){"function"==typeof e&&(t=e,e={});var n="https:",i=this.options.ServiceDomain,s=e.Region;i?(i=i.replace(/\{\{Region\}\}/gi,s||"").replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(i)||(i=n+"//"+i),"/"===i.slice(-1)&&(i=i.slice(0,-1))):i=s?n+"//cos."+s+".myqcloud.com":n+"//service.cos.myqcloud.com",i.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1"),h.call(this,{Action:"name/cos:GetService",url:i,method:"GET",headers:e.Headers,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Buckets&&n.ListAllMyBucketsResult.Buckets.Bucket||[];i=o.isArray(i)?i:[i];var s=n&&n.ListAllMyBucketsResult&&n.ListAllMyBucketsResult.Owner||{};t(null,{Buckets:i,Owner:s,statusCode:n.statusCode,headers:n.headers})}))},putBucket:function(e,t){var n=this,i="";if(e.BucketAZConfig){var s={BucketAZConfig:e.BucketAZConfig};i=o.json2xml({CreateBucketConfiguration:s})}h.call(this,{Action:"name/cos:PutBucket",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,body:i,tracker:e.tracker},(function(i,o){if(i)return t(i);var s=c({protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,isLocation:!0});t(null,{Location:s,statusCode:o.statusCode,headers:o.headers})}))},headBucket:function(e,t){h.call(this,{Action:"name/cos:HeadBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"HEAD",tracker:e.tracker},(function(e,n){t(e,n)}))},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,h.call(this,{Action:"name/cos:GetBucket",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListBucketResult||{},s=i.Contents||[],r=i.CommonPrefixes||[];s=o.isArray(s)?s:[s],r=o.isArray(r)?r:[r];var a=o.clone(i);o.extend(a,{Contents:s,CommonPrefixes:r,statusCode:n.statusCode,headers:n.headers}),t(null,a)}))},deleteBucket:function(e,t){h.call(this,{Action:"name/cos:DeleteBucket",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,method:"DELETE",tracker:e.tracker},(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,i="";if(e.AccessControlPolicy){var s=o.clone(e.AccessControlPolicy||{}),r=s.Grants||s.Grant;r=o.isArray(r)?r:[r],delete s.Grant,delete s.Grants,s.AccessControlList={Grant:r},i=o.json2xml({AccessControlPolicy:s}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=a(n[t]))})),h.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,headers:n,action:"acl",body:i,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketAcl:function(e,t){h.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"acl",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.AccessControlPolicy||{},s=i.Owner||{},a=i.AccessControlList.Grant||[];a=o.isArray(a)?a:[a];var c=r(i);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:s,Grants:a,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putBucketCors:function(e,t){var n=(e.CORSConfiguration||{}).CORSRules||e.CORSRules||[];n=o.clone(o.isArray(n)?n:[n]),o.each(n,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",i=e[n]||e[t]||[];delete e[n],e[t]=o.isArray(i)?i:[i]}))}));var i={CORSRule:n};e.ResponseVary&&(i.ResponseVary=e.ResponseVary);var s=o.json2xml({CORSConfiguration:i}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"cors",headers:r,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketCors:function(e,t){h.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchCORSConfiguration"===e.error.Code){var i={CORSRules:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.CORSConfiguration||{},r=s.CORSRules||s.CORSRule||[];r=o.clone(o.isArray(r)?r:[r]);var a=s.ResponseVary;o.each(r,(function(e){o.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],(function(t){var n=t+"s",i=e[n]||e[t]||[];delete e[t],e[n]=o.isArray(i)?i:[i]}))})),t(null,{CORSRules:r,ResponseVary:a,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketCors:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"cors",tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"location",tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,n)}))},getBucketPolicy:function(e,t){h.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",rawBody:!0,tracker:e.tracker},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t({ErrorStatus:"Access Denied"}):e.statusCode&&405===e.statusCode?t({ErrorStatus:"Method Not Allowed"}):e.statusCode&&404===e.statusCode?t({ErrorStatus:"Policy Not Found"}):t(e);var i={};try{i=JSON.parse(n.body)}catch(o){}t(null,{Policy:i,statusCode:n.statusCode,headers:n.headers})}))},putBucketPolicy:function(e,t){var n=e.Policy,i=n;try{"string"==typeof n?n=JSON.parse(i):i=JSON.stringify(n)}catch(r){t({error:"Policy format error"})}var s=e.Headers;s["Content-Type"]="application/json",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:e.Bucket,Region:e.Region,action:"policy",body:i,headers:s,json:!0,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"policy",tracker:e.tracker},(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||{},i=n.TagSet||n.Tags||e.Tags||[];i=o.clone(o.isArray(i)?i:[i]);var s=o.json2xml({Tagging:{TagSet:{Tag:i}}}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"tagging",headers:r,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var i={Tags:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else{var s=[];try{s=n.Tagging.TagSet.Tag||[]}catch(r){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Tags:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketTagging:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLifecycle:function(e,t){var n=(e.LifecycleConfiguration||{}).Rules||e.Rules||[];n=o.clone(n);var i=o.json2xml({LifecycleConfiguration:{Rule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"lifecycle",headers:s,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&e.error&&"NoSuchLifecycleConfiguration"===e.error.Code){var i={Rules:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=[];try{s=n.LifecycleConfiguration.Rule||[]}catch(r){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Rules:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketLifecycle:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"lifecycle",tracker:e.tracker},(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||{},i=o.json2xml({VersioningConfiguration:n}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"versioning",headers:s,tracker:e.tracker},(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({error:"missing param VersioningConfiguration"})},getBucketVersioning:function(e,t){h.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"versioning",tracker:e.tracker},(function(e,n){e||!n.VersioningConfiguration&&(n.VersioningConfiguration={}),t(e,n)}))},putBucketReplication:function(e,t){var n=o.clone(e.ReplicationConfiguration),i=o.json2xml({ReplicationConfiguration:n});i=(i=i.replace(/<(\/?)Rules>/gi,"<$1Rule>")).replace(/<(\/?)Tags>/gi,"<$1Tag>");var s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"replication",headers:s,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication",tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"ReplicationConfigurationnotFoundError"!==e.error.Code)t(e);else{var i={ReplicationConfiguration:{Rules:[]},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else e||!n.ReplicationConfiguration&&(n.ReplicationConfiguration={}),n.ReplicationConfiguration.Rule&&(n.ReplicationConfiguration.Rules=n.ReplicationConfiguration.Rule,delete n.ReplicationConfiguration.Rule),t(e,n)}))},deleteBucketReplication:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"replication",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketWebsite:function(e,t){if(e.WebsiteConfiguration){var n=o.clone(e.WebsiteConfiguration||{}),i=n.RoutingRules||n.RoutingRule||[];i=o.isArray(i)?i:[i],delete n.RoutingRule,delete n.RoutingRules,i.length&&(n.RoutingRules={RoutingRule:i});var s=o.json2xml({WebsiteConfiguration:n}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:s,action:"website",headers:r,tracker:e.tracker},(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({error:"missing param WebsiteConfiguration"})},getBucketWebsite:function(e,t){h.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"website",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchWebsiteConfiguration"===e.error.Code){var i={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.WebsiteConfiguration||{};if(s.RoutingRules){var r=o.clone(s.RoutingRules.RoutingRule||[]);r=o.makeArray(r),s.RoutingRules=r}t(null,{WebsiteConfiguration:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteBucketWebsite:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"website",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketReferer:function(e,t){if(e.RefererConfiguration){var n=o.clone(e.RefererConfiguration||{}),i=n.DomainList||{},s=i.Domains||i.Domain||[];(s=o.isArray(s)?s:[s]).length&&(n.DomainList={Domain:s});var r=o.json2xml({RefererConfiguration:n}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(r)),h.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"referer",headers:a,tracker:e.tracker},(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({error:"missing param RefererConfiguration"})},getBucketReferer:function(e,t){h.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"referer",tracker:e.tracker},(function(e,n){if(e)if(404===e.statusCode&&"NoSuchRefererConfiguration"===e.error.Code){var i={WebsiteConfiguration:{},statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else t(e);else{var s=n.RefererConfiguration||{};if(s.DomainList){var r=o.makeArray(s.DomainList.Domain||[]);s.DomainList={Domains:r}}t(null,{RefererConfiguration:s,statusCode:n.statusCode,headers:n.headers})}}))},putBucketDomain:function(e,t){var n=(e.DomainConfiguration||{}).DomainRule||e.DomainRule||[];n=o.clone(n);var i=o.json2xml({DomainConfiguration:{DomainRule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"domain",headers:s,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=[];try{i=n.DomainConfiguration.DomainRule||[]}catch(s){}i=o.clone(o.isArray(i)?i:[i]),t(null,{DomainRule:i,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketDomain:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"domain",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketOrigin:function(e,t){var n=(e.OriginConfiguration||{}).OriginRule||e.OriginRule||[];n=o.clone(n);var i=o.json2xml({OriginConfiguration:{OriginRule:n}}),s=e.Headers;s["Content-Type"]="application/xml",s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"origin",headers:s,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=[];try{i=n.OriginConfiguration.OriginRule||[]}catch(s){}i=o.clone(o.isArray(i)?i:[i]),t(null,{OriginRule:i,statusCode:n.statusCode,headers:n.headers})}))},deleteBucketOrigin:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"origin",tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},putBucketLogging:function(e,t){var n=o.json2xml({BucketLoggingStatus:e.BucketLoggingStatus||""}),i=e.Headers;i["Content-Type"]="application/xml",i["Content-MD5"]=o.binaryBase64(o.md5(n)),h.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:n,action:"logging",headers:i,tracker:e.tracker},(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){h.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"logging",tracker:e.tracker},(function(e,n){if(e)return t(e);delete n.BucketLoggingStatus._xmlns,t(null,{BucketLoggingStatus:n.BucketLoggingStatus,statusCode:n.statusCode,headers:n.headers})}))},putBucketInventory:function(e,t){var n=o.clone(e.InventoryConfiguration);if(n.OptionalFields){var i=n.OptionalFields||[];n.OptionalFields={Field:i}}if(n.Destination&&n.Destination.COSBucketDestination&&n.Destination.COSBucketDestination.Encryption){var s=n.Destination.COSBucketDestination.Encryption;Object.keys(s).indexOf("SSECOS")>-1&&(s["SSE-COS"]=s.SSECOS,delete s.SSECOS)}var r=o.json2xml({InventoryConfiguration:n}),a=e.Headers;a["Content-Type"]="application/xml",a["Content-MD5"]=o.binaryBase64(o.md5(r)),h.call(this,{Action:"name/cos:PutBucketInventory",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:r,action:"inventory",qs:{id:e.Id},headers:a,tracker:e.tracker},(function(e,n){return e&&204===e.statusCode?t(null,{statusCode:e.statusCode}):e?t(e):void t(null,{statusCode:n.statusCode,headers:n.headers})}))},getBucketInventory:function(e,t){h.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id},tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.InventoryConfiguration;if(i&&i.OptionalFields&&i.OptionalFields.Field){var s=i.OptionalFields.Field;o.isArray(s)||(s=[s]),i.OptionalFields=s}if(i.Destination&&i.Destination.COSBucketDestination&&i.Destination.COSBucketDestination.Encryption){var r=i.Destination.COSBucketDestination.Encryption;Object.keys(r).indexOf("SSE-COS")>-1&&(r.SSECOS=r["SSE-COS"],delete r["SSE-COS"])}t(null,{InventoryConfiguration:i,statusCode:n.statusCode,headers:n.headers})}))},listBucketInventory:function(e,t){h.call(this,{Action:"name/cos:ListBucketInventory",method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{"continuation-token":e.ContinuationToken},tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListInventoryConfigurationResult,s=i.InventoryConfiguration||[];s=o.isArray(s)?s:[s],delete i.InventoryConfiguration,o.each(s,(function(e){if(e&&e.OptionalFields&&e.OptionalFields.Field){var t=e.OptionalFields.Field;o.isArray(t)||(t=[t]),e.OptionalFields=t}if(e.Destination&&e.Destination.COSBucketDestination&&e.Destination.COSBucketDestination.Encryption){var n=e.Destination.COSBucketDestination.Encryption;Object.keys(n).indexOf("SSE-COS")>-1&&(n.SSECOS=n["SSE-COS"],delete n["SSE-COS"])}})),i.InventoryConfigurations=s,o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))},deleteBucketInventory:function(e,t){h.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"inventory",qs:{id:e.Id},tracker:e.tracker},(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||{}},i=o.json2xml(n),s={"Content-Type":"application/xml"};s["Content-MD5"]=o.binaryBase64(o.md5(i)),h.call(this,{Interface:"putBucketAccelerate",Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:e.Bucket,Region:e.Region,body:i,action:"accelerate",headers:s,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,{statusCode:n.statusCode,headers:n.headers})}))}else t({error:"missing param AccelerateConfiguration"})},getBucketAccelerate:function(e,t){h.call(this,{Interface:"getBucketAccelerate",Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:e.Bucket,Region:e.Region,action:"accelerate",tracker:e.tracker},(function(e,n){e||!n.AccelerateConfiguration&&(n.AccelerateConfiguration={}),t(e,n)}))},getObject:function(e,t){if(this.options.ObjectKeySimplifyCheck&&"/"===o.simplifyPath(e.Key))t(o.error(new Error("The Getobject Key is illegal")));else{var n=e.Query||{},i=e.QueryString||"",s=e.tracker;s&&s.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,h.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,qs:n,qsStr:i,rawBody:!0,dataType:e.DataType,tracker:s},(function(n,i){if(n){var s=n.statusCode;return e.Headers["If-Modified-Since"]&&s&&304===s?t(null,{NotModified:!0}):t(n)}t(null,{Body:i.body,ETag:o.attr(i.headers,"etag",""),statusCode:i.statusCode,headers:i.headers})}))}},headObject:function(e,t){h.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,headers:e.Headers,tracker:e.tracker},(function(n,i){if(n){var s=n.statusCode;return e.Headers["If-Modified-Since"]&&s&&304===s?t(null,{NotModified:!0,statusCode:s}):t(n)}i.ETag=o.attr(i.headers,"etag",""),t(null,i)}))},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,h.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:n.prefix,method:"GET",Bucket:e.Bucket,Region:e.Region,headers:e.Headers,qs:n,action:"versions",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.ListVersionsResult||{},s=i.DeleteMarker||[];s=o.isArray(s)?s:[s];var r=i.Version||[];r=o.isArray(r)?r:[r];var a=o.clone(i);delete a.DeleteMarker,delete a.Version,o.extend(a,{DeleteMarkers:s,Versions:r,statusCode:n.statusCode,headers:n.headers}),t(null,a)}))},putObject:function(e,t){var n=this,i=e.ContentLength,r=o.throttleOnProgress.call(n,i,e.onProgress),a=e.Headers;a["Cache-Control"]||a["cache-control"]||(a["Cache-Control"]=""),a["Content-Type"]||a["content-type"]||(a["Content-Type"]=s.getType(e.Key)||"application/octet-stream");var l=e.UploadAddMetaMd5||n.options.UploadAddMetaMd5||n.options.UploadCheckContentMd5,u=e.tracker;l&&u&&u.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(l,e.Body,(function(s){s&&(u&&u.setParams({md5EndTime:(new Date).getTime()}),n.options.UploadCheckContentMd5&&(a["Content-MD5"]=o.binaryBase64(s)),(e.UploadAddMetaMd5||n.options.UploadAddMetaMd5)&&(a["x-cos-meta-md5"]=s)),void 0!==e.ContentLength&&(a["Content-Length"]=e.ContentLength),r(null,!0),h.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:r,tracker:u},(function(s,a){if(s)return r(null,!0),t(s);r({loaded:i,total:i},!0);var l=c({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});l=l.substr(l.indexOf("://")+3),a.Location=l,a.ETag=o.attr(a.headers,"etag",""),t(null,a)}))}))},postObject:function(e,t){var n=this,i={},s=e.FilePath;if(s){for(var r in i["Cache-Control"]=e.CacheControl,i["Content-Disposition"]=e.ContentDisposition,i["Content-Encoding"]=e.ContentEncoding,i["Content-MD5"]=e.ContentMD5,i["Content-Length"]=e.ContentLength,i["Content-Type"]=e.ContentType,i.Expect=e.Expect,i.Expires=e.Expires,i["x-cos-acl"]=e.ACL,i["x-cos-grant-read"]=e.GrantRead,i["x-cos-grant-write"]=e.GrantWrite,i["x-cos-grant-full-control"]=e.GrantFullControl,i["x-cos-storage-class"]=e.StorageClass,i["x-cos-mime-limit"]=e.MimeLimit,i["x-cos-traffic-limit"]=e.TrafficLimit,i["x-cos-forbid-overwrite"]=e.ForbidOverwrite,i["x-cos-server-side-encryption-customer-algorithm"]=e.SSECustomerAlgorithm,i["x-cos-server-side-encryption-customer-key"]=e.SSECustomerKey,i["x-cos-server-side-encryption-customer-key-MD5"]=e.SSECustomerKeyMD5,i["x-cos-server-side-encryption"]=e.ServerSideEncryption,i["x-cos-server-side-encryption-cos-kms-key-id"]=e.SSEKMSKeyId,i["x-cos-server-side-encryption-context"]=e.SSEContext,delete i["Content-Length"],delete i["content-length"],e)r.indexOf("x-cos-meta-")>-1&&(i[r]=e[r]);var a=o.throttleOnProgress.call(n,i["Content-Length"],e.onProgress);h.call(this,{Action:"name/cos:PostObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:i,qs:e.Query,filePath:s,TaskId:e.TaskId,onProgress:a,tracker:e.tracker},(function(i,o){if(a(null,!0),i)return t(i);if(o&&o.headers){var r=o.headers,l=r.etag||r.Etag||r.ETag||"",u=s.substr(s.lastIndexOf("/")+1),p=c({ForcePathStyle:n.options.ForcePathStyle,protocol:n.options.Protocol,domain:n.options.Domain,bucket:e.Bucket,region:e.Region,object:e.Key.replace(/\$\{filename\}/g,u),isLocation:!0});return t(null,{Location:p,statusCode:o.statusCode,headers:r,ETag:l})}t(null,o)}))}else t({error:"missing param FilePath"})},deleteObject:function(e,t){h.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,VersionId:e.VersionId,tracker:e.tracker},(function(e,n){if(e){var i=e.statusCode;return i&&204===i?t(null,{statusCode:i}):i&&404===i?t(null,{BucketNotFound:!0,statusCode:i}):t(e)}t(null,{statusCode:n.statusCode,headers:n.headers})}))},getObjectAcl:function(e,t){var n={};e.VersionId&&(n.versionId=e.VersionId),h.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,qs:n,action:"acl",tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.AccessControlPolicy||{},s=i.Owner||{},a=i.AccessControlList&&i.AccessControlList.Grant||[];a=o.isArray(a)?a:[a];var c=r(i);n.headers&&n.headers["x-cos-acl"]&&(c.ACL=n.headers["x-cos-acl"]),c=o.extend(c,{Owner:s,Grants:a,statusCode:n.statusCode,headers:n.headers}),t(null,c)}))},putObjectAcl:function(e,t){var n=e.Headers,i="";if(e.AccessControlPolicy){var s=o.clone(e.AccessControlPolicy||{}),r=s.Grants||s.Grant;r=o.isArray(r)?r:[r],delete s.Grant,delete s.Grants,s.AccessControlList={Grant:r},i=o.json2xml({AccessControlPolicy:s}),n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(i))}o.each(n,(function(e,t){0===t.indexOf("x-cos-grant-")&&(n[t]=a(n[t]))})),h.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"acl",headers:n,body:i,tracker:e.tracker},(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,h.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:n,tracker:e.tracker},(function(e,n){if(e)return e.statusCode&&403===e.statusCode?t(null,{OptionsForbidden:!0,statusCode:e.statusCode}):t(e);var i=n.headers||{};t(null,{AccessControlAllowOrigin:i["access-control-allow-origin"],AccessControlAllowMethods:i["access-control-allow-methods"],AccessControlAllowHeaders:i["access-control-allow-headers"],AccessControlExposeHeaders:i["access-control-expose-headers"],AccessControlMaxAge:i["access-control-max-age"],statusCode:n.statusCode,headers:n.headers})}))},putObjectCopy:function(e,t){var n=e.Headers;!n["Cache-Control"]&&n["cache-control"]&&(n["Cache-Control"]="");var i=e.CopySource||"",s=o.getSourceParams.call(this,i);if(s){var r=s.Bucket,a=s.Region,c=decodeURIComponent(s.Key);h.call(this,{Scope:[{action:"name/cos:GetObject",bucket:r,region:a,prefix:c},{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,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=o.clone(n.CopyObjectResult||{});o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))}else t({error:"CopySource format error"})},deleteMultipleObject:function(e,t){var n=e.Objects||[],i=e.Quiet;n=o.isArray(n)?n:[n];var s=o.json2xml({Delete:{Object:n,Quiet:i||!1}}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(s));var a=o.map(n,(function(t){return{action:"name/cos:DeleteObject",bucket:e.Bucket,region:e.Region,prefix:t.Key}}));h.call(this,{Scope:a,method:"POST",Bucket:e.Bucket,Region:e.Region,body:s,action:"delete",headers:r,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=n.DeleteResult||{},s=i.Deleted||[],r=i.Error||[];s=o.isArray(s)?s:[s],r=o.isArray(r)?r:[r];var a=o.clone(i);o.extend(a,{Error:r,Deleted:s,statusCode:n.statusCode,headers:n.headers}),t(null,a)}))},restoreObject:function(e,t){var n=e.Headers;if(e.RestoreRequest){var i=e.RestoreRequest||{},s=o.json2xml({RestoreRequest:i});n["Content-Type"]="application/xml",n["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,VersionId:e.VersionId,body:s,action:"restore",headers:n,tracker:e.tracker},(function(e,n){t(e,n)}))}else t({error:"missing param RestoreRequest"})},putObjectTagging:function(e,t){var n=e.Tagging||{},i=n.TagSet||n.Tags||e.Tags||[];i=o.clone(o.isArray(i)?i:[i]);var s=o.json2xml({Tagging:{TagSet:{Tag:i}}}),r=e.Headers;r["Content-Type"]="application/xml",r["Content-MD5"]=o.binaryBase64(o.md5(s)),h.call(this,{Interface:"putObjectTagging",Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:e.Bucket,Key:e.Key,Region:e.Region,body:s,action:"tagging",headers:r,VersionId:e.VersionId,tracker:e.tracker},(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){h.call(this,{Interface:"getObjectTagging",Action:"name/cos:GetObjectTagging",method:"GET",Key:e.Key,Bucket:e.Bucket,Region:e.Region,headers:e.Headers,action:"tagging",VersionId:e.VersionId,tracker:e.tracker},(function(e,n){if(e)if(404!==e.statusCode||!e.error||"Not Found"!==e.error&&"NoSuchTagSet"!==e.error.Code)t(e);else{var i={Tags:[],statusCode:e.statusCode};e.headers&&(i.headers=e.headers),t(null,i)}else{var s=[];try{s=n.Tagging.TagSet.Tag||[]}catch(r){}s=o.clone(o.isArray(s)?s:[s]),t(null,{Tags:s,statusCode:n.statusCode,headers:n.headers})}}))},deleteObjectTagging:function(e,t){h.call(this,{Interface:"deleteObjectTagging",Action:"name/cos:DeleteObjectTagging",method:"DELETE",Bucket:e.Bucket,Region:e.Region,Key:e.Key,headers:e.Headers,action:"tagging",VersionId:e.VersionId,tracker:e.tracker},(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})}))},appendObject:function(e,t){h.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,tracker:e.tracker},(function(e,n){if(e)return t(e);t(null,n)}))},uploadPartCopy:function(e,t){var n=e.CopySource||"",i=o.getSourceParams.call(this,n);if(i){var s=i.Bucket,r=i.Region,a=decodeURIComponent(i.Key);h.call(this,{Scope:[{action:"name/cos:GetObject",bucket:s,region:r,prefix:a},{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,tracker:e.tracker},(function(e,n){if(e)return t(e);var i=o.clone(n.CopyPartResult||{});o.extend(i,{statusCode:n.statusCode,headers:n.headers}),t(null,i)}))}else t({error:"CopySource format error"})},multipartInit:function(e,t){var n=e.Headers,i=e.tracker;n["Cache-Control"]||n["cache-control"]||(n["Cache-Control"]=""),n["Content-Type"]||n["content-type"]||(n["Content-Type"]=s.getType(e.Key)||"application/octet-stream"),h.call(this,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:e.Bucket,Region:e.Region,Key:e.Key,action:"uploads",headers:e.Headers,qs:e.Query,tracker:i},(function(e,n){return e?(i&&i.parent&&i.parent.setParams({errorNode:"multipartInit"}),t(e)):(n=o.clone(n||{}))&&n.InitiateMultipartUploadResult?t(null,o.extend(n.InitiateMultipartUploadResult,{statusCode:n.statusCode,headers:n.headers})):void t(null,n)}))},multipartUpload:function(e,t){var n=this;o.getFileSize("multipartUpload",e,(function(){var i=e.tracker,s=n.options.UploadCheckContentMd5;s&&i&&i.setParams({md5StartTime:(new Date).getTime()}),o.getBodyMd5(s,e.Body,(function(r){r&&(e.Headers["Content-MD5"]=o.binaryBase64(r),s&&i&&i.setParams({md5EndTime:(new Date).getTime()})),i&&i.setParams({partNumber:e.PartNumber}),h.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:i},(function(e,n){if(e)return i&&i.parent&&i.parent.setParams({errorNode:"multipartUpload"}),t(e);t(null,{ETag:o.attr(n.headers,"etag",{}),statusCode:n.statusCode,headers:n.headers})}))}))}))},multipartComplete:function(e,t){for(var n=this,i=e.UploadId,s=e.Parts,r=e.tracker,a=0,l=s.length;a-1?(o=n.Authorization,a=o.match(/q-url-param-list.*?(?=&)/g)[0],c="q-url-param-list="+encodeURIComponent(a.replace(/q-url-param-list=/,"")).toLowerCase(),l=new RegExp(a,"g"),o.replace(l,c)):"sign="+encodeURIComponent(n.Authorization)),n.SecurityToken&&(i+="&x-cos-security-token="+n.SecurityToken),n.ClientIP&&(i+="&clientIP="+n.ClientIP),n.ClientUA&&(i+="&clientUA="+n.ClientUA),n.Token&&(i+="&token="+n.Token),r&&(i+="&"+r),setTimeout((function(){t(null,{Url:i})}))}var o,a,c,l}));return d?(a+="?"+d.Authorization+(d.SecurityToken?"&x-cos-security-token="+d.SecurityToken:""),r&&(a+="&"+r)):r&&(a+="?"+r),a},getAuth:function(e){return o.getAuth({SecretId:e.SecretId||this.options.SecretId||"",SecretKey:e.SecretKey||this.options.SecretKey||"",Bucket:e.Bucket,Region:e.Region,Method:e.Method,Key:e.Key,Query:e.Query,Headers:e.Headers,Expires:e.Expires,SystemClockOffset:this.options.SystemClockOffset})}};e.exports.init=function(e,t){t.transferToTaskMethod(m,"postObject"),t.transferToTaskMethod(m,"putObject"),o.each(m,(function(t,n){e.prototype[n]=o.apiWrapper(n,t)}))}},function(e,t){function n(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}var i=function(e,t){var i,o,s,r=[],a=function(e,t){var i=[];for(var o in e)e.hasOwnProperty(o)&&i.push(t?n(o).toLowerCase():o);return i.sort((function(e,t){return(e=e.toLowerCase())===(t=t.toLowerCase())?0:e>t?1:-1}))}(e);for(i=0;i-1||f.indexOf(m)>-1)&&(h[m]=e.headers[m]);s["x-cos-acl"]&&(h.acl=s["x-cos-acl"]),!h["Content-Type"]&&(h["Content-Type"]=""),(n=Mn.uploadFile({url:r,method:a,name:"file",header:s,filePath:o,formData:h,timeout:e.timeout,success:function(e){u(null,e)},fail:function(e){u(e.errMsg,e)}})).onProgressUpdate((function(e){c&&c({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend,progress:e.progress/100})}))}else{var g=e.qs&&i(e.qs)||"";g&&(r+=(r.indexOf("?")>-1?"&":"?")+g),s["Content-Length"]&&delete s["Content-Length"];var v={url:r,method:a,header:s,dataType:"text",data:e.body,responseType:e.dataType||"text",timeout:e.timeout,redirect:"manual",success:function(e){u(null,e)},fail:function(e){u(e.errMsg,e)}};l&&Object.assign(v,{enableHttpDNS:!0,httpDNSServiceId:l}),n=Mn.request(v)}return n}},function(e,t,n){let i=n(29);e.exports=new i(n(30),n(31))},function(e,t,n){function i(){this._types=Object.create(null),this._extensions=Object.create(null);for(let e=0;e=0;--o){var a=this.tryEntries[o],r=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=s.call(a,"catchLoc"),u=s.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;A(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:P(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),v}},t}function o(e){return(o="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)}function s(e,t,n,i,o,s,a){try{var r=e[s](a),c=r.value}catch(u){return void n(u)}r.done?t(c):Promise.resolve(c).then(i,o)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){s(a,i,o,r,c,"next",e)}function c(e){s(a,i,o,r,c,"throw",e)}r(void 0)}))}}var r=n(7),c=n(33),u=n(6).EventProxy,l=n(0),d=n(2);function p(e,t){var n=e.TaskId,i=e.Bucket,o=e.Region,s=e.Key,a=e.StorageClass,d=this,p={},f=e.FileSize,m=e.SliceSize,_=Math.ceil(f/m),v=0,y=l.throttleOnProgress.call(d,f,e.onHashProgress),I=function(t,n){var i=t.length;return 0===i?n(null,!0):i>_||i>1&&Math.max(t[0].Size,t[1].Size)!==m?n(null,!1):void function o(s){if(s=c.length)M.emit("has_and_check_upload_id",t);else{var p=c[u];if(!l.isInArray(t,p))return r.removeUploadId(p),void a(u+1);r.using[p]?a(u+1):g.call(d,{Bucket:i,Region:o,Key:s,UploadId:p,tracker:e.tracker},(function(e,t){d._isRunningTask(n)&&(e?(r.removeUploadId(p),a(u+1)):M.emit("upload_id_available",{UploadId:p,PartList:t.PartList}))}))}}(0):M.emit("has_and_check_upload_id",t)})),M.on("get_remote_upload_id_list",(function(){h.call(d,{Bucket:i,Region:o,Key:s,tracker:e.tracker},(function(t,o){if(d._isRunningTask(n)){if(t)return M.emit("error",t);var c=l.filter(o.UploadList,(function(e){return e.Key===s&&(!a||e.StorageClass.toUpperCase()===a.toUpperCase())})).reverse().map((function(e){return e.UploadId||e.UploadID}));if(c.length)M.emit("seek_local_avail_upload_id",c);else{var u,p=r.getFileId(e.FileStat,e.ChunkSize,i,s);p&&(u=r.getUploadIdList(p))&&l.each(u,(function(e){r.removeUploadId(e)})),M.emit("no_available_upload_id")}}}))})),M.emit("get_remote_upload_id_list")}function h(e,t){var n=this,i=[],o={Bucket:e.Bucket,Region:e.Region,Prefix:e.Key,calledBySdk:e.calledBySdk||"sliceUploadFile",tracker:e.tracker};!function e(){n.multipartList(o,(function(n,s){if(n)return t(n);i.push.apply(i,s.Upload||[]),"true"===s.IsTruncated?(o.KeyMarker=s.NextKeyMarker,o.UploadIdMarker=s.NextUploadIdMarker,e()):t(null,{UploadList:i})}))}()}function g(e,t){var n=this,i=[],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,s){if(n)return t(n);i.push.apply(i,s.Part||[]),"true"===s.IsTruncated?(o.PartNumberMarker=s.NextPartNumberMarker,e()):t(null,{PartList:i})}))}()}function f(e,t){var n=this,i=e.TaskId,o=e.Bucket,s=e.Region,a=e.Key,r=e.UploadData,u=e.FileSize,d=e.SliceSize,p=Math.min(e.AsyncLimit||n.options.ChunkParallelLimit||1,256),h=e.FilePath,g=Math.ceil(u/d),f=0,_=e.ServerSideEncryption,v=l.filter(r.PartList,(function(e){return e.Uploaded&&(f+=e.PartNumber>=g&&u%d||d),!e.Uploaded})),y=e.onProgress;c.eachLimit(v,p,(function(t,c){if(n._isRunningTask(i)){var l=t.PartNumber,p=Math.min(u,t.PartNumber*d)-(t.PartNumber-1)*d,g=0;m.call(n,{TaskId:i,Bucket:o,Region:s,Key:a,SliceSize:d,FileSize:u,PartNumber:l,ServerSideEncryption:_,FilePath:h,UploadData:r,onProgress:function(e){f+=e.loaded-g,g=e.loaded,y({loaded:f,total:u})},tracker:e.tracker},(function(e,o){n._isRunningTask(i)&&(e?f-=g:(f+=p-g,t.ETag=o.ETag),y({loaded:f,total:u}),c(e||null,o))}))}}),(function(e){if(n._isRunningTask(i))return e?t(e):void t(null,{UploadId:r.UploadId,SliceList:r.PartList})}))}function m(e,t){var n=this,i=e.TaskId,o=e.Bucket,s=e.Region,a=e.Key,r=e.FileSize,u=e.FilePath,d=1*e.PartNumber,p=e.SliceSize,h=e.ServerSideEncryption,g=e.UploadData,f=n.options.ChunkRetryTimes+1,m=e.Headers||{},_=p*(d-1),v=p,y=_+p;y>r&&(v=(y=r)-_);var I=["x-cos-traffic-limit","x-cos-mime-limit"],M={};l.each(m,(function(e,t){I.indexOf(t)>-1&&(M[t]=e)})),l.fileSlice(u,_,y,(function(r){var u=l.getFileMd5(r),p=u?l.binaryBase64(u):null,m=g.PartList[d-1];c.retry(f,(function(t){n._isRunningTask(i)&&n.multipartUpload({TaskId:i,Bucket:o,Region:s,Key:a,ContentLength:v,PartNumber:d,UploadId:g.UploadId,ServerSideEncryption:h,Body:r,Headers:M,onProgress:e.onProgress,ContentMD5:p,calledBySdk:"sliceUploadFile",tracker:e.tracker},(function(e,o){if(n._isRunningTask(i))return e?t(e):(m.Uploaded=!0,t(null,o))}))}),(function(e,o){if(n._isRunningTask(i))return t(e,o)}))}))}function _(e,t){var n=e.Bucket,i=e.Region,o=e.Key,s=e.UploadId,a=e.SliceList,r=this,u=this.options.ChunkRetryTimes+1,l=a.map((function(e){return{PartNumber:e.PartNumber,ETag:e.ETag}}));c.retry(u,(function(t){r.multipartComplete({Bucket:n,Region:i,Key:o,UploadId:s,Parts:l,calledBySdk:"sliceUploadFile",Headers:e.Headers||{},tracker:e.tracker},t)}),(function(e,n){t(e,n)}))}function v(e,t){var n=e.Bucket,i=e.Region,o=e.Key,s=e.AbortArray,a=e.AsyncLimit||1,r=this,u=0,l=new Array(s.length);c.eachLimit(s,a,(function(t,s){var a=u;if(o&&o!==t.Key)return l[a]={error:{KeyNotMatch:!0}},void s(null);var c=t.UploadId||t.UploadID;r.multipartAbort({Bucket:n,Region:i,Key:t.Key,Headers:e.Headers,UploadId:c},(function(e){var o={Bucket:n,Region:i,Key:t.Key,UploadId:c};l[a]={error:e,task:o},s(null)})),u++}),(function(e){if(e)return t(e);for(var n=[],i=[],o=0,s=l.length;oa?"sliceUploadFile":"putObject",t.tracker=new d({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:t.Bucket,region:t.Region,apiName:"uploadFile",realApi:h,fileKey:t.Key,fileSize:c,accelerate:p,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})),l.each(t,(function(e,t){"object"!==o(e)&&"function"!=typeof e&&(u[t]=e)})),g=t.onTaskReady,t.onTaskReady=function(e){u.TaskId=e,g&&g(e)},f=t.onFileFinish,m=function(e,i){t.tracker&&t.tracker.report(e,i),f&&f(e,i,u),n&&n(e,i)},_="postObject"===s.options.SimpleUploadMethod?"postObject":"putObject",v=c>a?"sliceUploadFile":_,r.push({api:v,params:t,callback:m}),s._addTasks(r);case 24:case"end":return e.stop()}}),e,this,[[3,9]])})))).apply(this,arguments)}function I(){return I=a(i().mark((function e(t,n){var s,r,c,u,p,h,g,f,m,_,v;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=this,r=void 0===t.SliceSize?s.options.SliceSize:t.SliceSize,c=0,u=0,p=l.throttleOnProgress.call(s,u,t.onProgress),h=t.files.length,g=t.onFileFinish,f=Array(h),m=function(e,t,i){p(null,!0),g&&g(e,t,i),f[i.Index]={options:i,error:e,data:t},--h<=0&&n&&n(null,{files:f})},_=[],v=function(){return t.files.map((function(e,t){return new Promise((n=a(i().mark((function n(a){var h,g,f,v,y,I,M,C,S,E,T;return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return h=0,n.prev=1,n.next=4,l.getFileSizeByPath(e.FilePath);case 4:h=n.sent,n.next=9;break;case 7:n.prev=7,n.t0=n.catch(1);case 9:g={Index:t,TaskId:""},c+=h,s.options.EnableReporter&&(f=s.options.UseAccelerate||"string"==typeof s.options.Domain&&s.options.Domain.includes("accelerate."),v=h>r?"sliceUploadFile":"putObject",e.tracker=new d({Beacon:s.options.BeaconReporter,clsReporter:s.options.ClsReporter,bucket:e.Bucket,region:e.Region,apiName:"uploadFiles",realApi:v,fileKey:e.Key,fileSize:h,accelerate:f,deepTracker:s.options.DeepTracker,customId:s.options.CustomId,delay:s.options.TrackerDelay})),l.each(e,(function(e,t){"object"!==o(e)&&"function"!=typeof e&&(g[t]=e)})),y=e.onTaskReady,e.onTaskReady=function(e){g.TaskId=e,y&&y(e)},I=0,M=e.onProgress,e.onProgress=function(e){u=u-I+e.loaded,I=e.loaded,M&&M(e),p({loaded:u,total:c})},C=e.onFileFinish,S=function(t,n){e.tracker&&e.tracker.report(t,n),C&&C(t,n),m&&m(t,n,g)},E="postObject"===s.options.SimpleUploadMethod?"postObject":"putObject",T=h>r?"sliceUploadFile":E,_.push({api:T,params:e,callback:S}),a(!0);case 24:case"end":return n.stop()}}),n,null,[[1,7]])}))),function(e){return n.apply(this,arguments)}));var n}))},e.next=13,Promise.all(v());case 13:s._addTasks(_);case 14:case"end":return e.stop()}}),e,this)}))),I.apply(this,arguments)}function M(e,t){var n=e.TaskId,i=e.Bucket,o=e.Region,s=e.Key,a=e.CopySource,r=e.UploadId,u=1*e.PartNumber,l=e.CopySourceRange,d=this.options.ChunkRetryTimes+1,p=this;c.retry(d,(function(t){p.uploadPartCopy({TaskId:n,Bucket:i,Region:o,Key:s,CopySource:a,UploadId:r,PartNumber:u,CopySourceRange:l,onProgress:e.onProgress,tracker:e.tracker,calledBySdk:e.calledBySdk},(function(e,n){t(e||null,n)}))}),(function(e,n){return t(e,n)}))}var C={sliceUploadFile:function(e,t){var n=this;if(!l.canFileSlice())return e.SkipTask=!0,void("postObject"===n.options.SimpleUploadMethod?n.postObject(e,t):n.putObject(e,t));var i,o,s=new u,a=e.TaskId,c=e.Bucket,d=e.Region,h=e.Key,g=e.FilePath,m=e.ChunkSize||e.SliceSize||n.options.ChunkSize,v=e.AsyncLimit,y=e.StorageClass,I=e.ServerSideEncryption,M=e.onHashProgress,C=e.tracker;C&&C.setParams({chunkSize:m}),s.on("error",(function(i){if(n._isRunningTask(a)){var o={UploadId:e.UploadData.UploadId||"",err:i,error:i};return t(o)}})),s.on("upload_complete",(function(n){var i=l.extend({UploadId:e.UploadData.UploadId||""},n);t(null,i)})),s.on("upload_slice_complete",(function(t){var u={};l.each(e.Headers,(function(e,t){var n=t.toLowerCase();0!==n.indexOf("x-cos-meta-")&&"pic-operations"!==n||(u[t]=e)})),_.call(n,{Bucket:c,Region:d,Key:h,UploadId:t.UploadId,SliceList:t.SliceList,Headers:u,tracker:C},(function(e,c){if(n._isRunningTask(a)){if(r.removeUsing(t.UploadId),e)return o(null,!0),s.emit("error",e);r.removeUploadId(t.UploadId),o({loaded:i,total:i},!0),s.emit("upload_complete",c)}}))})),s.on("get_upload_data_finish",(function(t){var u=r.getFileId(e.FileStat,e.ChunkSize,c,h);u&&r.saveUploadId(u,t.UploadId,n.options.UploadIdCacheLimit),r.setUsing(t.UploadId),o(null,!0),f.call(n,{TaskId:a,Bucket:c,Region:d,Key:h,FilePath:g,FileSize:i,SliceSize:m,AsyncLimit:v,ServerSideEncryption:I,UploadData:t,onProgress:o,tracker:C},(function(e,t){if(n._isRunningTask(a))return e?(o(null,!0),s.emit("error",e)):void s.emit("upload_slice_complete",t)}))})),s.on("get_file_size_finish",(function(){if(o=l.throttleOnProgress.call(n,i,e.onProgress),e.UploadData.UploadId)s.emit("get_upload_data_finish",e.UploadData);else{var t=l.extend({TaskId:a,Bucket:c,Region:d,Key:h,Headers:e.Headers,StorageClass:y,FilePath:g,FileSize:i,SliceSize:m,onHashProgress:M,tracker:C},e);t.FileSize=i,p.call(n,t,(function(t,i){if(n._isRunningTask(a)){if(t)return s.emit("error",t);e.UploadData.UploadId=i.UploadId,e.UploadData.PartList=i.PartList,s.emit("get_upload_data_finish",e.UploadData)}}))}})),i=e.ContentLength,delete e.ContentLength,!e.Headers&&(e.Headers={}),l.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],o=1048576,s=0;s=E&&v%I||I),!e.Uploaded}));c.eachLimit(h,C,(function(t,n){var r=t.PartNumber,l=t.CopySourceRange,p=t.end-t.start,h=0;c.retry(S,(function(t){M.call(i,{Bucket:o,Region:s,Key:a,CopySource:d,UploadId:u.UploadId,PartNumber:r,CopySourceRange:l,tracker:e.tracker,calledBySdk:"sliceCopyFile",onProgress:function(e){T+=e.loaded-h,h=e.loaded,y({loaded:T,total:v})}},t)}),(function(e,i){if(e)return n(e);y({loaded:T,total:v}),T+=p-h,t.ETag=i.ETag,n(e||null,i)}))}),(function(e){if(e)return r.removeUsing(u.UploadId),y(null,!0),t(e);n.emit("copy_slice_complete",u)}))})),n.on("get_chunk_size_finish",(function(){var c=function(){i.multipartInit({Bucket:o,Region:s,Key:a,Headers:R,tracker:e.tracker,calledBySdk:"sliceCopyFile"},(function(i,o){if(i)return t(i);e.UploadId=o.UploadId,n.emit("get_copy_data_finish",{UploadId:e.UploadId,PartList:e.PartList})}))},u=r.getCopyFileId(d,k,I,o,a),p=r.getUploadIdList(u);if(!u||!p)return c();!function t(u){if(u>=p.length)return c();var d=p[u];if(r.using[d])return t(u+1);g.call(i,{Bucket:o,Region:s,Key:a,UploadId:d,tracker:e.tracker,calledBySdk:"sliceCopyFile"},(function(i,o){if(i)r.removeUploadId(d),t(u+1);else{if(r.using[d])return t(u+1);var s={},a=0;l.each(o.PartList,(function(e){var t=parseInt(e.Size),n=a+t-1;s[e.PartNumber+"|"+a+"|"+n]=e.ETag,a+=t})),l.each(e.PartList,(function(e){var t=s[e.PartNumber+"|"+e.start+"|"+e.end];t&&(e.ETag=t,e.Uploaded=!0)})),n.emit("get_copy_data_finish",{UploadId:d,PartList:e.PartList})}}))}(0)})),n.on("get_file_size_finish",(function(){var o;if(function(){for(var t=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],n=1048576,o=0;o11&&(D[t]=e)})),n.emit("get_file_size_finish")}else t({error:'get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.'})}))}else t({error:"CopySource format error"})}};e.exports.init=function(e,t){t.transferToTaskMethod(C,"sliceUploadFile"),l.each(C,(function(t,n){e.prototype[n]=l.apiWrapper(n,t)}))}},function(e,t){var n={eachLimit:function(e,t,n,i){if(i=i||function(){},!e.length||t<=0)return i();var o=0,s=0,a=0;!function r(){if(o>=e.length)return i();for(;a=e.length?i():r())}))}()},retry:function(e,t,n){e<1?n():function i(o){t((function(t,s){t&&oe.length)&&(t=e.length);for(var n=0,i=Array(t);n=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!e})()}function d(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function p(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)),i}function g(e){for(var t=1;ti&&(Jt({api:t,paramName:n,desc:Gn("MaximumArrayLengthLog",n,i)}),1)):(Jt({api:t,paramName:n,desc:on()}),!1)}function Mn(e,t,n,i){var o=i.allowUndefined,s=i.min;return i=i.max,lt(e)?!!o||(Jt({api:t,paramName:n,desc:en()}),!1):Ke(e)?Ke(s)&&e=Math.pow(2,64)&&(Jt({api:t,paramName:n,desc:Gn("NumberLessThanLog",n,"Math.pow(2,64)")}),1)):(Jt({api:t,paramName:n,desc:Zt()}),!1)}},enableMark:g({},Ln)},createConversationGroup:{conversationIDList:g({},Z),groupName:g(g({},Y),{},{validator:function(e,t,n){return!(!e||32=this.TOPIC_MSG_LIMIT&&this._convM.clearMemMsg(o,!0)}}catch(r){n.e(r)}finally{n.f()}}}},{key:"pushIn",value:function(e){var t=1>(-2*s&6))))o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);try{return decodeURIComponent(escape(n))}catch(r){return""}}Gi.mixin=function(e){(e=e.prototype||e)._isReady=!1,e.ready=function(e){if(e)return this._isReady?void(1=this.MAX_LENGTH&&(t=this.map.entries().next().value[0],this.map.delete(t)),this.map.set(e,1)}},{key:"has",value:function(e){return this.map.has(e)}},{key:"delete",value:function(e){this.has(e)&&this.map.delete(e)}},{key:"reset",value:function(){this.map.clear()}}]),Ki=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],zi=s((function e(t){i(this,e),this.groupID="",this.name="",this.avatar="",this.type="",this.introduction="",this.notification="",this.ownerID="",this.createTime="",this.infoSequence="",this.lastInfoTime="",this.selfInfo={messageRemindType:"",joinTime:"",nameCard:"",role:"",userID:"",memberCustomField:void 0,readedSequence:0,excludedUnreadSequenceList:void 0},this.lastMessage={lastTime:"",lastSequence:"",fromAccount:"",messageForShow:""},this.nextMessageSeq="",this.memberNum="",this.memberCount="",this.maxMemberNum="",this.maxMemberCount="",this.joinOption="",this.inviteOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._lastRevokedTime=0,this._initGroup(t)}),[{key:"memberNum",get:function(){return this.memberCount},set:function(e){}},{key:"maxMemberNum",get:function(){return this.maxMemberCount},set:function(e){}},{key:"_initGroup",value:function(e){for(var t in e)Ki.indexOf(t)<0||("selfInfo"!==t?("memberNum"===t&&(this.memberCount=e[t]),"maxMemberNum"===t&&(this.maxMemberCount=e[t]),"isSupportTopic"!==t?this[t]=e[t]:this.isSupportTopic=1===e[t]):this.updateSelfInfo(e[t]))}},{key:"updateGroup",value:function(e){var t=this;(e.appid=void 0,e.grossTopicNextMsgSeq=void 0,e.selfInfo&&(e.selfInfo.grossTopicReadSeq=void 0),e=JSON.parse(JSON.stringify(e))).lastMsgTime&&(this.lastMessage.lastTime=e.lastMsgTime),lt(e.muteAllMembers)||("On"===e.muteAllMembers?e.muteAllMembers=!0:e.muteAllMembers=!1),e.groupCustomField&&_t(this.groupCustomField,e.groupCustomField),lt(e.memberNum)||(this.memberCount=e.memberNum),lt(e.maxMemberNum)||(this.maxMemberCount=e.maxMemberNum),lt(e.isSupportTopic)||(this.isSupportTopic=Ke(e.isSupportTopic)?1===e.isSupportTopic:e.isSupportTopic),Ze(this,e,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),Ye(e.members)&&0e?(c.messageList=o.slice(r-e,r),c.nextReqMessageID=a?o[r-e].ID:o[r-e].sequence+""):(c.messageList=o.slice(0,r),c.isCompleted=!0):ei||n&&s.sequence>n)){if("in"===s.flow&&s.isRead)break;s.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t,n=!(1o&&e.sequence<=i:e.sequence>o&&e.sequenceo&&e.length<60?a._recursiveGetMsgList(e,t,n,i,o,s):a._emitMsgReceived(t,e)}))}},{key:"_emitMsgReceived",value:function(e,t){var n,i,o=this;0=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):e._checkCountMap.set(n,++i)}))}},{key:"onNewGroupTips",value:function(e){be.l("".concat(this._n,".onNewGroupTips options:").concat(JSON.stringify(e.dataList)));var t=(e=this._assembly(e)).eventDataList,n=e.result;0<(e=e.AVChatRoomMessageList).length&&this._grpM.onAVChatRoomMessage(e),0=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):e._checkCountMap.set(n,++i)}))}},{key:"updateLastMsg",value:function(e){var t="".concat(this._n,".updateLastMsg");if(0!==this._grpM.getGroupMap().size){for(var n,i,o,s,a=!1,r=e.length,c=0;c=this.CACHE_EXPIRE_TIME||a=this.EXPIRE_TIME?this._getRemoteGroupCounters({groupID:i,avChatRoomKey:s}).then((function(e){return a.setMoreMessage("from remote. count:".concat(e.length)).end(),be.l("".concat(n," from remote. groupID:").concat(i)),Cn({counters:e=t._getLocalCounters(i,o)})})).catch((function(e){return a.setError(e).end(),En(e)})):(a.setMoreMessage("from cache").end(),be.l("".concat(n," from cache. groupID:").concat(i)),Sn({counters:e=this._getLocalCounters(i,o)}))}},{key:"_getRemoteGroupCounters",value:function(e){var t=this;return this._grpM.req({P:jn.GET_GRP_COUNTER,data:g({},e)}).then((function(n){var i=void 0===(i=(n=n.data).counterList)?[]:i;return n=n.groupCounterSeq,t._updateLocalGroupCounters({groupID:e.groupID,counterList:i,groupCounterSeq:n}),be.l("".concat(t._n,"._getRemoteGroupCounters ok. groupID:").concat(e.groupID)),i})).catch((function(e){return En(e)}))}},{key:"_convertObjectToList",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_updateGroupCounters",value:function(e){var t="".concat(this._n,"._updateGroupCounters"),n=e.groupID,i=e.avChatRoomKey,o=e.mode;return be.l("".concat(t,". groupID:").concat(n," avChatRoomKey:").concat(i," mode:").concat(o)),this._grpM.req({P:jn.UPDATE_GRP_COUNTER,data:g({},e)}).then((function(e){be.l("".concat(t," ok.")),e=e.data.counterList;var n={};return(void 0===e?[]:e).forEach((function(e){var t=e.key;e=e.value,n[t]=e})),n})).catch((function(e){return En(e)}))}},{key:"_hasLocalGroupCounters",value:function(e){return this._groupCountersMap.has(e)}},{key:"_getLocalGroupCounters",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:"_updateLocalGroupCounters",value:function(e){var t,n,i,o=e.groupID,s=void 0===(s=e.counterList)?[]:s;e=e.groupCounterSeq,this._hasLocalGroupCounters(o)&&(i=this._getLocalGroupCounters(o),t=i.counters,n=i.avChatRoomKey,i=i.groupCounterSeq,0