import{a5 as e,H as t,I as s,Q as n,ai as i,J as r,v as o,x as a,G as c,p as l,aj as u,ak as h,al as d,U as f,ac as p,z as g,ad as m,am as y,O as _,q as v,an as k,Z as w,R as T,E as b,ao as S,ap as I,aq as A,_ as x,b as P,o as C,c as U,w as L,i as O,t as E,d as R,F as D,f as N,e as F,n as M,g as q,h as j,k as B,j as $,ar as K,as as J,at as V,aa as W,a9 as H,l as z,s as G,m as Q,ag as Y,r as X,N as Z,S as ee,y as te}from"./index-22d2df30.js";import{_ as se}from"./uni-load-more.e389ae51.js";import{r as ne}from"./uni-app.es.06715d18.js";const ie={pages:[{path:"pages/index/index",style:{navigationBarTitleText:"首页"}},{path:"pages/message/chat",style:{navigationBarTitleText:"聊天"}},{path:"pages/contacts/index",style:{navigationBarTitleText:"联系人"}},{path:"pages/message/detail",style:{navigationBarTitleText:"聊天信息"}},{path:"pages/contacts/detail",style:{navigationBarTitleText:"用户信息"}},{path:"pages/contacts/friend",style:{navigationBarTitleText:"新朋友"}},{path:"pages/contacts/search",style:{navigationBarTitleText:"搜索朋友"}},{path:"pages/login/index",style:{navigationBarTitleText:"登录"}},{path:"pages/login/register",style:{navigationBarTitleText:"注册"}},{path:"pages/message/call",style:{navigationBarTitleText:"通话"}},{path:"pages/index/userSelection",style:{navigationBarTitleText:"用户选择"}},{path:"pages/message/group/groupUser",style:{navigationBarTitleText:"群聊成员管理"}},{path:"pages/index/qrcode",style:{navigationBarTitleText:"群二维码"}},{path:"pages/message/group/info",style:{navigationBarTitleText:"群信息"}},{path:"pages/contacts/group",style:{navigationBarTitleText:"群聊列表"}},{path:"pages/index/search",style:{navigationBarTitleText:"搜索"}},{path:"pages/index/scan",style:{navigationBarTitleText:"扫描"}},{path:"pages/mine/webview",style:{navigationBarTitleText:"webview"}},{path:"pages/mine/profile",style:{navigationBarTitleText:"个人信息"}},{path:"pages/mine/secure",style:{navigationBarTitleText:"安全"}},{path:"pages/mine/about",style:{navigationBarTitleText:"关于"}},{path:"pages/mine/setting",style:{navigationBarTitleText:"设置"}}],globalStyle:{navigationStyle:"custom",navigationBarTextStyle:"black",navigationBarTitleText:"uni-app",navigationBarBackgroundColor:"#F8F8F8",backgroundColor:"#F8F8F8","app-plus":{background:"#efeff4"}},tabBar:{custom:!0,color:"#333",selectedColor:"#1AAD19",borderStyle:"black",backgroundColor:"#FFFFFF",list:[{pagePath:"pages/index/index",iconPath:"static/image/tabbar/demo.png",selectedIconPath:"static/image/tabbar/demo.png",text:"首页"},{pagePath:"pages/contacts/index",iconPath:"static/image/tabbar/demo.png",selectedIconPath:"static/image/tabbar/demo.png",text:"通讯录"}]}};function re(e,t,s){return e(s={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&s.path)}},s.exports),s.exports}var oe=re((function(e,t){var s;e.exports=(s=s||function(e,t){var s=Object.create||function(){function e(){}return function(t){var s;return e.prototype=t,s=new e,e.prototype=null,s}}(),n={},i=n.lib={},r=i.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,s=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var r=0;r>>2]>>>24-r%4*8&255;t[n+r>>>2]|=o<<24-(n+r)%4*8}else for(r=0;r>>2]=s[r>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,s=this.sigBytes;t[s>>>2]&=4294967295<<32-s%4*8,t.length=e.ceil(s/4)},clone:function(){var e=r.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var s,n=[],i=function(t){var s=987654321,n=4294967295;return function(){var i=((s=36969*(65535&s)+(s>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},r=0;r>>2]>>>24-i%4*8&255;n.push((r>>>4).toString(16)),n.push((15&r).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,s=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(s,t/2)}},l=a.Latin1={stringify:function(e){for(var t=e.words,s=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(r))}return n.join("")},parse:function(e){for(var t=e.length,s=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(s,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},h=i.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new o.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 s=this._data,n=s.words,i=s.sigBytes,r=this.blockSize,a=i/(4*r),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*r,l=e.min(4*c,i);if(c){for(var u=0;u>>24)|4278255360&(i<<24|i>>>8)}var r=this._hash.words,o=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],_=e[t+7],v=e[t+8],k=e[t+9],w=e[t+10],T=e[t+11],b=e[t+12],S=e[t+13],I=e[t+14],A=e[t+15],x=r[0],P=r[1],C=r[2],U=r[3];x=l(x,P,C,U,o,7,a[0]),U=l(U,x,P,C,c,12,a[1]),C=l(C,U,x,P,f,17,a[2]),P=l(P,C,U,x,p,22,a[3]),x=l(x,P,C,U,g,7,a[4]),U=l(U,x,P,C,m,12,a[5]),C=l(C,U,x,P,y,17,a[6]),P=l(P,C,U,x,_,22,a[7]),x=l(x,P,C,U,v,7,a[8]),U=l(U,x,P,C,k,12,a[9]),C=l(C,U,x,P,w,17,a[10]),P=l(P,C,U,x,T,22,a[11]),x=l(x,P,C,U,b,7,a[12]),U=l(U,x,P,C,S,12,a[13]),C=l(C,U,x,P,I,17,a[14]),x=u(x,P=l(P,C,U,x,A,22,a[15]),C,U,c,5,a[16]),U=u(U,x,P,C,y,9,a[17]),C=u(C,U,x,P,T,14,a[18]),P=u(P,C,U,x,o,20,a[19]),x=u(x,P,C,U,m,5,a[20]),U=u(U,x,P,C,w,9,a[21]),C=u(C,U,x,P,A,14,a[22]),P=u(P,C,U,x,g,20,a[23]),x=u(x,P,C,U,k,5,a[24]),U=u(U,x,P,C,I,9,a[25]),C=u(C,U,x,P,p,14,a[26]),P=u(P,C,U,x,v,20,a[27]),x=u(x,P,C,U,S,5,a[28]),U=u(U,x,P,C,f,9,a[29]),C=u(C,U,x,P,_,14,a[30]),x=h(x,P=u(P,C,U,x,b,20,a[31]),C,U,m,4,a[32]),U=h(U,x,P,C,v,11,a[33]),C=h(C,U,x,P,T,16,a[34]),P=h(P,C,U,x,I,23,a[35]),x=h(x,P,C,U,c,4,a[36]),U=h(U,x,P,C,g,11,a[37]),C=h(C,U,x,P,_,16,a[38]),P=h(P,C,U,x,w,23,a[39]),x=h(x,P,C,U,S,4,a[40]),U=h(U,x,P,C,o,11,a[41]),C=h(C,U,x,P,p,16,a[42]),P=h(P,C,U,x,y,23,a[43]),x=h(x,P,C,U,k,4,a[44]),U=h(U,x,P,C,b,11,a[45]),C=h(C,U,x,P,A,16,a[46]),x=d(x,P=h(P,C,U,x,f,23,a[47]),C,U,o,6,a[48]),U=d(U,x,P,C,_,10,a[49]),C=d(C,U,x,P,I,15,a[50]),P=d(P,C,U,x,m,21,a[51]),x=d(x,P,C,U,b,6,a[52]),U=d(U,x,P,C,p,10,a[53]),C=d(C,U,x,P,w,15,a[54]),P=d(P,C,U,x,c,21,a[55]),x=d(x,P,C,U,v,6,a[56]),U=d(U,x,P,C,A,10,a[57]),C=d(C,U,x,P,y,15,a[58]),P=d(P,C,U,x,S,21,a[59]),x=d(x,P,C,U,g,6,a[60]),U=d(U,x,P,C,T,10,a[61]),C=d(C,U,x,P,f,15,a[62]),P=d(P,C,U,x,k,21,a[63]),r[0]=r[0]+x|0,r[1]=r[1]+P|0,r[2]=r[2]+C|0,r[3]=r[3]+U|0},_doFinalize:function(){var t=this._data,s=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;s[i>>>5]|=128<<24-i%32;var r=e.floor(n/4294967296),o=n;s[15+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),s[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(s.length+1),this._process();for(var a=this._hash,c=a.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,s,n,i,r,o){var a=e+(t&s|~t&n)+i+o;return(a<>>32-r)+t}function u(e,t,s,n,i,r,o){var a=e+(t&n|s&~n)+i+o;return(a<>>32-r)+t}function h(e,t,s,n,i,r,o){var a=e+(t^s^n)+i+o;return(a<>>32-r)+t}function d(e,t,s,n,i,r,o){var a=e+(s^(t|~n))+i+o;return(a<>>32-r)+t}t.MD5=r._createHelper(c),t.HmacMD5=r._createHmacHelper(c)}(Math),s.MD5)})),re((function(e,t){var s,n,i;e.exports=(n=(s=ae).lib.Base,i=s.enc.Utf8,void(s.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var s=e.blockSize,n=4*s;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var r=this._oKey=t.clone(),o=this._iKey=t.clone(),a=r.words,c=o.words,l=0;l>>2]>>>24-r%4*8&255)<<16|(t[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|t[r+2>>>2]>>>24-(r+2)%4*8&255,a=0;a<4&&r+.75*a>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,s=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var r=0;r>>6-o%4*2;n[r>>>2]|=(a|c)<<24-r%4*8,r++}return i.create(n,r)}(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},s.enc.Base64)}));const he="FUNCTION",de="pending",fe="rejected";function pe(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function ge(e){return"object"===pe(e)}function me(e){return"function"==typeof e}function ye(e){return function(){try{return e.apply(e,arguments)}catch(t){console.error(t)}}}const _e="REJECTED",ve="NOT_PENDING";class ke{constructor({createPromise:e,retryRule:t=_e}={}){this.createPromise=e,this.status=null,this.promise=null,this.retryRule=t}get needRetry(){if(!this.status)return!0;switch(this.retryRule){case _e:return this.status===fe;case ve:return this.status!==de}}exec(){return this.needRetry?(this.status=de,this.promise=this.createPromise().then((e=>(this.status="fullfilled",Promise.resolve(e))),(e=>(this.status=fe,Promise.reject(e)))),this.promise):this.promise}}function we(e){return e&&"string"==typeof e?JSON.parse(e):e}const Te=we([]);we("");const be=we("[]")||[];let Se="";try{Se="__UNI__D1E78EC"}catch(pt){}let Ie={};function Ae(e,t={}){var s,n;return s=Ie,n=e,Object.prototype.hasOwnProperty.call(s,n)||(Ie[e]=t),Ie[e]}const xe=["invoke","success","fail","complete"],Pe=Ae("_globalUniCloudInterceptor");function Ce(e,t){Pe[e]||(Pe[e]={}),ge(t)&&Object.keys(t).forEach((s=>{xe.indexOf(s)>-1&&function(e,t,s){let n=Pe[e][t];n||(n=Pe[e][t]=[]),-1===n.indexOf(s)&&me(s)&&n.push(s)}(e,s,t[s])}))}function Ue(e,t){Pe[e]||(Pe[e]={}),ge(t)?Object.keys(t).forEach((s=>{xe.indexOf(s)>-1&&function(e,t,s){const n=Pe[e][t];if(!n)return;const i=n.indexOf(s);i>-1&&n.splice(i,1)}(e,s,t[s])})):delete Pe[e]}function Le(e,t){return e&&0!==e.length?e.reduce(((e,s)=>e.then((()=>s(t)))),Promise.resolve()):Promise.resolve()}function Oe(e,t){return Pe[e]&&Pe[e][t]||[]}function Ee(e){Ce("callObject",e)}const Re=Ae("_globalUniCloudListener"),De="response",Ne="needLogin",Fe="refreshToken",Me="clientdb",qe="cloudfunction",je="cloudobject";function Be(e){return Re[e]||(Re[e]=[]),Re[e]}function $e(e,t){const s=Be(e);s.includes(t)||s.push(t)}function Ke(e,t){const s=Be(e),n=s.indexOf(t);-1!==n&&s.splice(n,1)}function Je(e,t){const s=Be(e);for(let n=0;n{We&&e(),function t(){if("function"==typeof n){const t=n();t&&t[0]&&(We=!0,e())}We||setTimeout((()=>{t()}),30)}()})),Ve)}function ze(e){const t={};for(const s in e){const n=e[s];me(n)&&(t[s]=ye(n))}return t}class Ge extends Error{constructor(e){super(e.message),this.errMsg=e.message||e.errMsg||"unknown system error",this.code=this.errCode=e.code||e.errCode||"SYSTEM_ERROR",this.errSubject=this.subject=e.subject||e.errSubject,this.cause=e.cause,this.requestId=e.requestId}toJson(e=0){if(!(e>=10))return e++,{errCode:this.errCode,errMsg:this.errMsg,errSubject:this.errSubject,cause:this.cause&&this.cause.toJson?this.cause.toJson(e):this.cause}}}var Qe={request:e=>d(e),uploadFile:e=>f(e),setStorageSync:(e,t)=>p(e,t),getStorageSync:e=>g(e),removeStorageSync:e=>m(e),clearStorageSync:()=>y()};function Ye(e){return e&&Ye(e.__v_raw)||e}function Xe(){return{token:Qe.getStorageSync("uni_id_token")||Qe.getStorageSync("uniIdToken"),tokenExpired:Qe.getStorageSync("uni_id_token_expired")}}function Ze({token:e,tokenExpired:t}={}){e&&Qe.setStorageSync("uni_id_token",e),t&&Qe.setStorageSync("uni_id_token_expired",t)}let et,tt;function st(){return et||(et=_()),et}function nt(){let e,t;try{if(A){if(A.toString().indexOf("not yet implemented")>-1)return;const{scene:s,channel:n}=A();e=n,t=s}}catch(s){}return{channel:e,scene:t}}function it(){const e=I&&I()||"en";if(tt)return{...tt,locale:e,LOCALE:e};const t=st(),{deviceId:s,osName:n,uniPlatform:i,appId:r}=t,o=["pixelRatio","brand","model","system","language","version","platform","host","SDKVersion","swanNativeVersion","app","AppPlatform","fontSizeSetting"];for(let a=0;a{t(Object.assign(e,{complete(e){e||(e={});const t=e.data&&e.data.header&&e.data.header["x-serverless-request-id"]||e.header&&e.header["request-id"];if(!e.statusCode||e.statusCode>=400)return n(new Ge({code:"SYS_ERR",message:e.errMsg||"request:fail",requestId:t}));const i=e.data;if(i.error)return n(new Ge({code:i.error.code,message:i.error.message,requestId:t}));i.result=i.data,i.requestId=t,delete i.data,s(i)}}))}))},at=function(e){return ue.stringify(le.parse(e))},ct={"uniCloud.init.paramRequired":"{param} required","uniCloud.uploadFile.fileError":"filePath should be instance of File"};const{t:lt}=e({"zh-Hans":{"uniCloud.init.paramRequired":"缺少参数:{param}","uniCloud.uploadFile.fileError":"filePath应为File对象"},"zh-Hant":{"uniCloud.init.paramRequired":"缺少参数:{param}","uniCloud.uploadFile.fileError":"filePath应为File对象"},en:ct,fr:{"uniCloud.init.paramRequired":"{param} required","uniCloud.uploadFile.fileError":"filePath should be instance of File"},es:{"uniCloud.init.paramRequired":"{param} required","uniCloud.uploadFile.fileError":"filePath should be instance of File"},ja:ct},"zh-Hans");var ut=class{constructor(e){["spaceId","clientSecret"].forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(lt("uniCloud.init.paramRequired",{param:t}))})),this.config=Object.assign({},{endpoint:0===e.spaceId.indexOf("mp-")?"https://api.next.bspapp.com":"https://api.bspapp.com"},e),this.config.provider="aliyun",this.config.requestUrl=this.config.endpoint+"/client",this.config.envType=this.config.envType||"public",this.config.accessTokenKey="access_token_"+this.config.spaceId,this.adapter=Qe,this._getAccessTokenPromiseHub=new ke({createPromise:()=>this.requestAuth(this.setupRequest({method:"serverless.auth.user.anonymousAuthorize",params:"{}"},"auth")).then((e=>{if(!e.result||!e.result.accessToken)throw new Ge({code:"AUTH_FAILED",message:"获取accessToken失败"});this.setAccessToken(e.result.accessToken)})),retryRule:ve})}get hasAccessToken(){return!!this.accessToken}setAccessToken(e){this.accessToken=e}requestWrapped(e){return ot(e,this.adapter.request)}requestAuth(e){return this.requestWrapped(e)}request(e,t){return Promise.resolve().then((()=>this.hasAccessToken?t?this.requestWrapped(e):this.requestWrapped(e).catch((t=>new Promise(((e,s)=>{!t||"GATEWAY_INVALID_TOKEN"!==t.code&&"InvalidParameter.InvalidToken"!==t.code?s(t):e()})).then((()=>this.getAccessToken())).then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)})))):this.getAccessToken().then((()=>{const t=this.rebuildRequest(e);return this.request(t,!0)}))))}rebuildRequest(e){const t=Object.assign({},e);return t.data.token=this.accessToken,t.header["x-basement-token"]=this.accessToken,t.header["x-serverless-sign"]=rt(t.data,this.config.clientSecret),t}setupRequest(e,t){const s=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),n={"Content-Type":"application/json"};return"auth"!==t&&(s.token=this.accessToken,n["x-basement-token"]=this.accessToken),n["x-serverless-sign"]=rt(s,this.config.clientSecret),{url:this.config.requestUrl,method:"POST",data:s,dataType:"json",header:n}}getAccessToken(){return this._getAccessTokenPromiseHub.exec()}async authorize(){await this.getAccessToken()}callFunction(e){const t={method:"serverless.function.runtime.invoke",params:JSON.stringify({functionTarget:e.name,functionArgs:e.data||{}})};return this.request(this.setupRequest(t))}getOSSUploadOptionsFromPath(e){const t={method:"serverless.file.resource.generateProximalSign",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}uploadFileToOSS({url:e,formData:t,name:s,filePath:n,fileType:i,onUploadProgress:r}){return new Promise(((o,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:s,filePath:n,fileType:i,header:{"X-OSS-server-side-encrpytion":"AES256"},success(e){e&&e.statusCode<400?o(e):a(new Ge({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Ge({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof r&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{r({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}reportOSSUpload(e){const t={method:"serverless.file.resource.report",params:JSON.stringify(e)};return this.request(this.setupRequest(t))}async uploadFile({filePath:e,cloudPath:t,fileType:s="image",cloudPathAsRealPath:n=!1,onUploadProgress:i,config:r}){if("string"!==pe(t))throw new Ge({code:"INVALID_PARAM",message:"cloudPath必须为字符串类型"});if(!(t=t.trim()))throw new Ge({code:"INVALID_PARAM",message:"cloudPath不可为空"});if(/:\/\//.test(t))throw new Ge({code:"INVALID_PARAM",message:"cloudPath不合法"});const o=r&&r.envType||this.config.envType;if(n&&("/"!==t[0]&&(t="/"+t),t.indexOf("\\")>-1))throw new Ge({code:"INVALID_PARAM",message:"使用cloudPath作为路径时,cloudPath不可包含“\\”"});const a=(await this.getOSSUploadOptionsFromPath({env:o,filename:n?t.split("/").pop():t,fileId:n?t:void 0})).result,c="https://"+a.cdnDomain+"/"+a.ossPath,{securityToken:l,accessKeyId:u,signature:h,host:d,ossPath:f,id:p,policy:g,ossCallbackUrl:m}=a,y={"Cache-Control":"max-age=2592000","Content-Disposition":"attachment",OSSAccessKeyId:u,Signature:h,host:d,id:p,key:f,policy:g,success_action_status:200};if(l&&(y["x-oss-security-token"]=l),m){const e=JSON.stringify({callbackUrl:m,callbackBody:JSON.stringify({fileId:p,spaceId:this.config.spaceId}),callbackBodyType:"application/json"});y.callback=at(e)}const _={url:"https://"+a.host,formData:y,fileName:"file",name:"file",filePath:e,fileType:s};if(await this.uploadFileToOSS(Object.assign({},_,{onUploadProgress:i})),m)return{success:!0,filePath:e,fileID:c};if((await this.reportOSSUpload({id:p})).success)return{success:!0,filePath:e,fileID:c};throw new Ge({code:"UPLOAD_FAILED",message:"文件上传失败"})}getTempFileURL({fileList:e}={}){return new Promise(((t,s)=>{Array.isArray(e)&&0!==e.length||s(new Ge({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"})),t({fileList:e.map((e=>({fileID:e,tempFileURL:e})))})}))}async getFileInfo({fileList:e}={}){if(!Array.isArray(e)||0===e.length)throw new Ge({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.info",params:JSON.stringify({id:e.map((e=>e.split("?")[0])).join(",")})};return{fileList:(await this.request(this.setupRequest(t))).result}}},ht={init(e){const t=new ut(e),s={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return s},t.customAuth=t.auth,t}};const dt="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:";var ft,pt;(pt=ft||(ft={})).local="local",pt.none="none",pt.session="session";var gt=function(){};const mt=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new Ge({message:'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'})};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}const t=new Promise(((t,s)=>{e=(e,n)=>e?s(e):t(n)}));return e.promise=t,e};function yt(e){return void 0===e}function _t(e){return"[object Null]"===Object.prototype.toString.call(e)}var vt;!function(e){e.WEB="web",e.WX_MP="wx_mp"}(vt||(vt={}));const kt={adapter:null,runtime:void 0},wt=["anonymousUuidKey"];class Tt extends gt{constructor(){super(),kt.adapter.root.tcbObject||(kt.adapter.root.tcbObject={})}setItem(e,t){kt.adapter.root.tcbObject[e]=t}getItem(e){return kt.adapter.root.tcbObject[e]}removeItem(e){delete kt.adapter.root.tcbObject[e]}clear(){delete kt.adapter.root.tcbObject}}function bt(e,t){switch(e){case"local":return t.localStorage||new Tt;case"none":return new Tt;default:return t.sessionStorage||new Tt}}class St{constructor(e){if(!this._storage){this._persistence=kt.adapter.primaryStorage||e.persistence,this._storage=bt(this._persistence,kt.adapter);const t=`access_token_${e.env}`,s=`access_token_expire_${e.env}`,n=`refresh_token_${e.env}`,i=`anonymous_uuid_${e.env}`,r=`login_type_${e.env}`,o=`user_info_${e.env}`;this.keys={accessTokenKey:t,accessTokenExpireKey:s,refreshTokenKey:n,anonymousUuidKey:i,loginTypeKey:r,userInfoKey:o}}}updatePersistence(e){if(e===this._persistence)return;const t="local"===this._persistence;this._persistence=e;const s=bt(e,kt.adapter);for(const n in this.keys){const e=this.keys[n];if(t&&wt.includes(n))continue;const i=this._storage.getItem(e);yt(i)||_t(i)||(s.setItem(e,i),this._storage.removeItem(e))}this._storage=s}setStore(e,t,s){if(!this._storage)return;const n={version:s||"localCachev1",content:t},i=JSON.stringify(n);try{this._storage.setItem(e,i)}catch(r){throw r}}getStore(e,t){try{if(!this._storage)return}catch(n){return""}t=t||"localCachev1";const s=this._storage.getItem(e);return s&&s.indexOf(t)>=0?JSON.parse(s).content:""}removeStore(e){this._storage.removeItem(e)}}const It={},At={};function xt(e){return It[e]}class Pt{constructor(e,t){this.data=t||null,this.name=e}}class Ct extends Pt{constructor(e,t){super("error",{error:e,data:t}),this.error=e}}const Ut=new class{constructor(){this._listeners={}}on(e,t){return s=e,n=t,(i=this._listeners)[s]=i[s]||[],i[s].push(n),this;var s,n,i}off(e,t){return function(e,t,s){if(s&&s[e]){const n=s[e].indexOf(t);-1!==n&&s[e].splice(n,1)}}(e,t,this._listeners),this}fire(e,t){if(e instanceof Ct)return console.error(e.error),this;const s="string"==typeof e?new Pt(e,t||{}):e,n=s.name;if(this._listens(n)){s.target=this;const e=this._listeners[n]?[...this._listeners[n]]:[];for(const t of e)t.call(this,s)}return this}_listens(e){return this._listeners[e]&&this._listeners[e].length>0}};function Lt(e,t){Ut.on(e,t)}function Ot(e,t={}){Ut.fire(e,t)}function Et(e,t){Ut.off(e,t)}const Rt="loginStateChanged",Dt="loginStateExpire",Nt="loginTypeChanged",Ft="anonymousConverted",Mt="refreshAccessToken";var qt;!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.NULL="NULL"}(qt||(qt={}));const jt=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"],Bt={"X-SDK-Version":"1.3.5"};function $t(e,t,s){const n=e[t];e[t]=function(t){const i={},r={};s.forEach((s=>{const{data:n,headers:o}=s.call(e,t);Object.assign(i,n),Object.assign(r,o)}));const o=t.data;return o&&(()=>{var e;if(e=o,"[object FormData]"!==Object.prototype.toString.call(e))t.data={...o,...i};else for(const t in i)o.append(t,i[t])})(),t.headers={...t.headers||{},...r},n.call(e,t)}}function Kt(){const e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{...Bt,"x-seqid":e}}}class Jt{constructor(e={}){var t;this.config=e,this._reqClass=new kt.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:`请求在${this.config.timeout/1e3}s内未完成,已中断`,restrictedMethods:["post"]}),this._cache=xt(this.config.env),this._localCache=(t=this.config.env,At[t]),$t(this._reqClass,"post",[Kt]),$t(this._reqClass,"upload",[Kt]),$t(this._reqClass,"download",[Kt])}async post(e){return await this._reqClass.post(e)}async upload(e){return await this._reqClass.upload(e)}async download(e){return await this._reqClass.download(e)}async refreshAccessToken(){let e,t;this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken());try{e=await this._refreshAccessTokenPromise}catch(s){t=s}if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return e}async _refreshAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s,loginTypeKey:n,anonymousUuidKey:i}=this._cache.keys;this._cache.removeStore(e),this._cache.removeStore(t);let r=this._cache.getStore(s);if(!r)throw new Ge({message:"未登录CloudBase"});const o={refresh_token:r},a=await this.request("auth.fetchAccessTokenWithRefreshToken",o);if(a.data.code){const{code:e}=a.data;if("SIGN_PARAM_INVALID"===e||"REFRESH_TOKEN_EXPIRED"===e||"INVALID_REFRESH_TOKEN"===e){if(this._cache.getStore(n)===qt.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===e){const e=this._cache.getStore(i),t=this._cache.getStore(s),n=await this.send("auth.signInAnonymously",{anonymous_uuid:e,refresh_token:t});return this.setRefreshToken(n.refresh_token),this._refreshAccessToken()}Ot(Dt),this._cache.removeStore(s)}throw new Ge({code:a.data.code,message:`刷新access token失败:${a.data.code}`})}if(a.data.access_token)return Ot(Mt),this._cache.setStore(e,a.data.access_token),this._cache.setStore(t,a.data.access_token_expire+Date.now()),{accessToken:a.data.access_token,accessTokenExpire:a.data.access_token_expire};a.data.refresh_token&&(this._cache.removeStore(s),this._cache.setStore(s,a.data.refresh_token),this._refreshAccessToken())}async getAccessToken(){const{accessTokenKey:e,accessTokenExpireKey:t,refreshTokenKey:s}=this._cache.keys;if(!this._cache.getStore(s))throw new Ge({message:"refresh token不存在,登录状态异常"});let n=this._cache.getStore(e),i=this._cache.getStore(t),r=!0;return this._shouldRefreshAccessTokenHook&&!(await this._shouldRefreshAccessTokenHook(n,i))&&(r=!1),(!n||!i||i{e.wxOpenId&&e.wxPublicId&&(t=!0)})),{users:s,hasPrimaryUid:t}}setPrimaryUid(e){return this._request.send("auth.setPrimaryUid",{uid:e})}unlink(e){return this._request.send("auth.unlink",{platform:e})}async update(e){const{nickName:t,gender:s,avatarUrl:n,province:i,country:r,city:o}=e,{data:a}=await this._request.send("auth.updateUserInfo",{nickName:t,gender:s,avatarUrl:n,province:i,country:r,city:o});this.setLocalUserInfo(a)}async refresh(){const{data:e}=await this._request.send("auth.getUserInfo",{});return this.setLocalUserInfo(e),e}setUserInfo(){const{userInfoKey:e}=this._cache.keys,t=this._cache.getStore(e);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((e=>{this[e]=t[e]})),this.location={country:t.country,province:t.province,city:t.city}}setLocalUserInfo(e){const{userInfoKey:t}=this._cache.keys;this._cache.setStore(t,e),this.setUserInfo()}}class Gt{constructor(e){if(!e)throw new Ge({code:"PARAM_ERROR",message:"envId is not defined"});this._cache=xt(e);const{refreshTokenKey:t,accessTokenKey:s,accessTokenExpireKey:n}=this._cache.keys,i=this._cache.getStore(t),r=this._cache.getStore(s),o=this._cache.getStore(n);this.credential={refreshToken:i,accessToken:r,accessTokenExpire:o},this.user=new zt(e)}get isAnonymousAuth(){return this.loginType===qt.ANONYMOUS}get isCustomAuth(){return this.loginType===qt.CUSTOM}get isWeixinAuth(){return this.loginType===qt.WECHAT||this.loginType===qt.WECHAT_OPEN||this.loginType===qt.WECHAT_PUBLIC}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}}class Qt extends Ht{async signIn(){this._cache.updatePersistence("local");const{anonymousUuidKey:e,refreshTokenKey:t}=this._cache.keys,s=this._cache.getStore(e)||void 0,n=this._cache.getStore(t)||void 0,i=await this._request.send("auth.signInAnonymously",{anonymous_uuid:s,refresh_token:n});if(i.uuid&&i.refresh_token){this._setAnonymousUUID(i.uuid),this.setRefreshToken(i.refresh_token),await this._request.refreshAccessToken(),Ot(Rt),Ot(Nt,{env:this.config.env,loginType:qt.ANONYMOUS,persistence:"local"});const e=new Gt(this.config.env);return await e.user.refresh(),e}throw new Ge({message:"匿名登录失败"})}async linkAndRetrieveDataWithTicket(e){const{anonymousUuidKey:t,refreshTokenKey:s}=this._cache.keys,n=this._cache.getStore(t),i=this._cache.getStore(s),r=await this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:n,refresh_token:i,ticket:e});if(r.refresh_token)return this._clearAnonymousUUID(),this.setRefreshToken(r.refresh_token),await this._request.refreshAccessToken(),Ot(Ft,{env:this.config.env}),Ot(Nt,{loginType:qt.CUSTOM,persistence:"local"}),{credential:{refreshToken:r.refresh_token}};throw new Ge({message:"匿名转化失败"})}_setAnonymousUUID(e){const{anonymousUuidKey:t,loginTypeKey:s}=this._cache.keys;this._cache.removeStore(t),this._cache.setStore(t,e),this._cache.setStore(s,qt.ANONYMOUS)}_clearAnonymousUUID(){this._cache.removeStore(this._cache.keys.anonymousUuidKey)}}class Yt extends Ht{async signIn(e){if("string"!=typeof e)throw new Ge({code:"PARAM_ERROR",message:"ticket must be a string"});const{refreshTokenKey:t}=this._cache.keys,s=await this._request.send("auth.signInWithTicket",{ticket:e,refresh_token:this._cache.getStore(t)||""});if(s.refresh_token)return this.setRefreshToken(s.refresh_token),await this._request.refreshAccessToken(),Ot(Rt),Ot(Nt,{env:this.config.env,loginType:qt.CUSTOM,persistence:this.config.persistence}),await this.refreshUserInfo(),new Gt(this.config.env);throw new Ge({message:"自定义登录失败"})}}class Xt extends Ht{async signIn(e,t){if("string"!=typeof e)throw new Ge({code:"PARAM_ERROR",message:"email must be a string"});const{refreshTokenKey:s}=this._cache.keys,n=await this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:i,access_token:r,access_token_expire:o}=n;if(i)return this.setRefreshToken(i),r&&o?this.setAccessToken(r,o):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Ot(Rt),Ot(Nt,{env:this.config.env,loginType:qt.EMAIL,persistence:this.config.persistence}),new Gt(this.config.env);throw n.code?new Ge({code:n.code,message:`邮箱登录失败: ${n.message}`}):new Ge({message:"邮箱登录失败"})}async activate(e){return this._request.send("auth.activateEndUserMail",{token:e})}async resetPasswordWithToken(e,t){return this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})}}class Zt extends Ht{async signIn(e,t){if("string"!=typeof e)throw new Ge({code:"PARAM_ERROR",message:"username must be a string"});"string"!=typeof t&&(t="",console.warn("password is empty"));const{refreshTokenKey:s}=this._cache.keys,n=await this._request.send("auth.signIn",{loginType:qt.USERNAME,username:e,password:t,refresh_token:this._cache.getStore(s)||""}),{refresh_token:i,access_token_expire:r,access_token:o}=n;if(i)return this.setRefreshToken(i),o&&r?this.setAccessToken(o,r):await this._request.refreshAccessToken(),await this.refreshUserInfo(),Ot(Rt),Ot(Nt,{env:this.config.env,loginType:qt.USERNAME,persistence:this.config.persistence}),new Gt(this.config.env);throw n.code?new Ge({code:n.code,message:`用户名密码登录失败: ${n.message}`}):new Ge({message:"用户名密码登录失败"})}}class es{constructor(e){this.config=e,this._cache=xt(e.env),this._request=Wt(e.env),this._onAnonymousConverted=this._onAnonymousConverted.bind(this),this._onLoginTypeChanged=this._onLoginTypeChanged.bind(this),Lt(Nt,this._onLoginTypeChanged)}get currentUser(){const e=this.hasLoginState();return e&&e.user||null}get loginType(){return this._cache.getStore(this._cache.keys.loginTypeKey)}anonymousAuthProvider(){return new Qt(this.config)}customAuthProvider(){return new Yt(this.config)}emailAuthProvider(){return new Xt(this.config)}usernameAuthProvider(){return new Zt(this.config)}async signInAnonymously(){return new Qt(this.config).signIn()}async signInWithEmailAndPassword(e,t){return new Xt(this.config).signIn(e,t)}signInWithUsernameAndPassword(e,t){return new Zt(this.config).signIn(e,t)}async linkAndRetrieveDataWithTicket(e){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new Qt(this.config)),Lt(Ft,this._onAnonymousConverted),await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e)}async signOut(){if(this.loginType===qt.ANONYMOUS)throw new Ge({message:"匿名用户不支持登出操作"});const{refreshTokenKey:e,accessTokenKey:t,accessTokenExpireKey:s}=this._cache.keys,n=this._cache.getStore(e);if(!n)return;const i=await this._request.send("auth.logout",{refresh_token:n});return this._cache.removeStore(e),this._cache.removeStore(t),this._cache.removeStore(s),Ot(Rt),Ot(Nt,{env:this.config.env,loginType:qt.NULL,persistence:this.config.persistence}),i}async signUpWithEmailAndPassword(e,t){return this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})}async sendPasswordResetEmail(e){return this._request.send("auth.sendPasswordResetEmail",{email:e})}onLoginStateChanged(e){Lt(Rt,(()=>{const t=this.hasLoginState();e.call(this,t)}));const t=this.hasLoginState();e.call(this,t)}onLoginStateExpired(e){Lt(Dt,e.bind(this))}onAccessTokenRefreshed(e){Lt(Mt,e.bind(this))}onAnonymousConverted(e){Lt(Ft,e.bind(this))}onLoginTypeChanged(e){Lt(Nt,(()=>{const t=this.hasLoginState();e.call(this,t)}))}async getAccessToken(){return{accessToken:(await this._request.getAccessToken()).accessToken,env:this.config.env}}hasLoginState(){const{refreshTokenKey:e}=this._cache.keys;return this._cache.getStore(e)?new Gt(this.config.env):null}async isUsernameRegistered(e){if("string"!=typeof e)throw new Ge({code:"PARAM_ERROR",message:"username must be a string"});const{data:t}=await this._request.send("auth.isUsernameRegistered",{username:e});return t&&t.isRegistered}getLoginState(){return Promise.resolve(this.hasLoginState())}async signInWithTicket(e){return new Yt(this.config).signIn(e)}shouldRefreshAccessToken(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)}getUserInfo(){return this._request.send("auth.getUserInfo",{}).then((e=>e.code?e:{...e.data,requestId:e.seqId}))}getAuthHeader(){const{refreshTokenKey:e,accessTokenKey:t}=this._cache.keys,s=this._cache.getStore(e);return{"x-cloudbase-credentials":this._cache.getStore(t)+"/@@/"+s}}_onAnonymousConverted(e){const{env:t}=e.data;t===this.config.env&&this._cache.updatePersistence(this.config.persistence)}_onLoginTypeChanged(e){const{loginType:t,persistence:s,env:n}=e.data;n===this.config.env&&(this._cache.updatePersistence(s),this._cache.setStore(this._cache.keys.loginTypeKey,t))}}const ts=function(e,t){t=t||mt();const s=Wt(this.config.env),{cloudPath:n,filePath:i,onUploadProgress:r,fileType:o="image"}=e;return s.send("storage.getUploadMetadata",{path:n}).then((e=>{const{data:{url:a,authorization:c,token:l,fileId:u,cosFileId:h},requestId:d}=e,f={key:n,signature:c,"x-cos-meta-fileid":h,success_action_status:"201","x-cos-security-token":l};s.upload({url:a,data:f,file:i,name:n,fileType:o,onUploadProgress:r}).then((e=>{201===e.statusCode?t(null,{fileID:u,requestId:d}):t(new Ge({code:"STORAGE_REQUEST_FAIL",message:`STORAGE_REQUEST_FAIL: ${e.data}`}))})).catch((e=>{t(e)}))})).catch((e=>{t(e)})),t.promise},ss=function(e,t){t=t||mt();const s=Wt(this.config.env),{cloudPath:n}=e;return s.send("storage.getUploadMetadata",{path:n}).then((e=>{t(null,e)})).catch((e=>{t(e)})),t.promise},ns=function({fileList:e},t){if(t=t||mt(),!e||!Array.isArray(e))return{code:"INVALID_PARAM",message:"fileList必须是非空的数组"};for(let n of e)if(!n||"string"!=typeof n)return{code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"};const s={fileid_list:e};return Wt(this.config.env).send("storage.batchDeleteFile",s).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.delete_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},is=function({fileList:e},t){t=t||mt(),e&&Array.isArray(e)||t(null,{code:"INVALID_PARAM",message:"fileList必须是非空的数组"});let s=[];for(let i of e)"object"==typeof i?(i.hasOwnProperty("fileID")&&i.hasOwnProperty("maxAge")||t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是包含fileID和maxAge的对象"}),s.push({fileid:i.fileID,max_age:i.maxAge})):"string"==typeof i?s.push({fileid:i}):t(null,{code:"INVALID_PARAM",message:"fileList的元素必须是字符串"});const n={file_list:s};return Wt(this.config.env).send("storage.batchGetDownloadUrl",n).then((e=>{e.code?t(null,e):t(null,{fileList:e.data.download_list,requestId:e.requestId})})).catch((e=>{t(e)})),t.promise},rs=async function({fileID:e},t){const s=(await is.call(this,{fileList:[{fileID:e,maxAge:600}]})).fileList[0];if("SUCCESS"!==s.code)return t?t(s):new Promise((e=>{e(s)}));const n=Wt(this.config.env);let i=s.download_url;if(i=encodeURI(i),!t)return n.download({url:i});t(await n.download({url:i}))},os=function({name:e,data:t,query:s,parse:n,search:i},r){const o=r||mt();let a;try{a=t?JSON.stringify(t):""}catch(l){return Promise.reject(l)}if(!e)return Promise.reject(new Ge({code:"PARAM_ERROR",message:"函数名不能为空"}));const c={inQuery:s,parse:n,search:i,function_name:e,request_data:a};return Wt(this.config.env).send("functions.invokeFunction",c).then((e=>{if(e.code)o(null,e);else{let s=e.data.response_data;if(n)o(null,{result:s,requestId:e.requestId});else try{s=JSON.parse(e.data.response_data),o(null,{result:s,requestId:e.requestId})}catch(t){o(new Ge({message:"response data must be json"}))}}return o.promise})).catch((e=>{o(e)})),o.promise},as={timeout:15e3,persistence:"session"},cs={};class ls{constructor(e){this.config=e||this.config,this.authObj=void 0}init(e){switch(kt.adapter||(this.requestClient=new kt.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:`请求在${(e.timeout||5e3)/1e3}s内未完成,已中断`})),this.config={...as,...e},!0){case this.config.timeout>6e5:console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"),this.config.timeout=6e5;break;case this.config.timeout<100:console.warn("timeout小于可配置下限[100ms],已重置为下限数值"),this.config.timeout=100}return new ls(this.config)}auth({persistence:e}={}){if(this.authObj)return this.authObj;const t=e||kt.adapter.primaryStorage||as.persistence;var s;return t!==this.config.persistence&&(this.config.persistence=t),function(e){const{env:t}=e;It[t]=new St(e),At[t]=new St({...e,persistence:"local"})}(this.config),s=this.config,Vt[s.env]=new Jt(s),this.authObj=new es(this.config),this.authObj}on(e,t){return Lt.apply(this,[e,t])}off(e,t){return Et.apply(this,[e,t])}callFunction(e,t){return os.apply(this,[e,t])}deleteFile(e,t){return ns.apply(this,[e,t])}getTempFileURL(e,t){return is.apply(this,[e,t])}downloadFile(e,t){return rs.apply(this,[e,t])}uploadFile(e,t){return ts.apply(this,[e,t])}getUploadMetadata(e,t){return ss.apply(this,[e,t])}registerExtension(e){cs[e.name]=e}async invokeExtension(e,t){const s=cs[e];if(!s)throw new Ge({message:`扩展${e} 必须先注册`});return await s.invoke(t,this)}useAdapters(e){const{adapter:t,runtime:s}=function(e){const t=(s=e,"[object Array]"===Object.prototype.toString.call(s)?e:[e]);var s;for(const n of t){const{isMatch:e,genAdapter:t,runtime:s}=n;if(e())return{adapter:t(),runtime:s}}}(e)||{};t&&(kt.adapter=t),s&&(kt.runtime=s)}}var us=new ls;function hs(e,t,s){void 0===s&&(s={});var n=/\?/.test(t),i="";for(var r in s)""===i?!n&&(t+="?"):i+="&",i+=r+"="+encodeURIComponent(s[r]);return/^http(s)?:\/\//.test(t+=i)?t:""+e+t}class ds{post(e){const{url:t,data:s,headers:n}=e;return new Promise(((e,i)=>{Qe.request({url:hs("https:",t),data:s,method:"POST",header:n,success(t){e(t)},fail(e){i(e)}})}))}upload(e){return new Promise(((t,s)=>{const{url:n,file:i,data:r,headers:o,fileType:a}=e,c=Qe.uploadFile({url:hs("https:",n),name:"file",formData:Object.assign({},r),filePath:i,fileType:a,header:o,success(e){const s={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&r.success_action_status&&(s.statusCode=parseInt(r.success_action_status,10)),t(s)},fail(e){s(new Error(e.errMsg||"uploadFile:fail"))}});"function"==typeof e.onUploadProgress&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((t=>{e.onUploadProgress({loaded:t.totalBytesSent,total:t.totalBytesExpectedToSend})}))}))}}const fs={setItem(e,t){Qe.setStorageSync(e,t)},getItem:e=>Qe.getStorageSync(e),removeItem(e){Qe.removeStorageSync(e)},clear(){Qe.clearStorageSync()}};var ps={genAdapter:function(){return{root:{},reqClass:ds,localStorage:fs,primaryStorage:"local"}},isMatch:function(){return!0},runtime:"uni_app"};us.useAdapters(ps);const gs=us,ms=gs.init;gs.init=function(e){e.env=e.spaceId;const t=ms.call(this,e);t.config.provider="tencent",t.config.spaceId=e.spaceId;const s=t.auth;return t.auth=function(e){const t=s.call(this,e);return["linkAndRetrieveDataWithTicket","signInAnonymously","signOut","getAccessToken","getLoginState","signInWithTicket","getUserInfo"].forEach((e=>{var s;t[e]=(s=t[e],function(e){e=e||{};const{success:t,fail:n,complete:i}=ze(e);if(!(t||n||i))return s.call(this,e);s.call(this,e).then((e=>{t&&t(e),i&&i(e)}),(e=>{n&&n(e),i&&i(e)}))}).bind(t)})),t},t.customAuth=t.auth,t};var ys=gs,_s=class extends ut{getAccessToken(){return new Promise(((e,t)=>{const s="Anonymous_Access_token";this.setAccessToken(s),e(s)}))}setupRequest(e,t){const s=Object.assign({},e,{spaceId:this.config.spaceId,timestamp:Date.now()}),n={"Content-Type":"application/json"};"auth"!==t&&(s.token=this.accessToken,n["x-basement-token"]=this.accessToken),n["x-serverless-sign"]=rt(s,this.config.clientSecret);const i=it();n["x-client-info"]=encodeURIComponent(JSON.stringify(i));const{token:r}=Xe();return n["x-client-token"]=r,{url:this.config.requestUrl,method:"POST",data:s,dataType:"json",header:JSON.parse(JSON.stringify(n))}}uploadFileToOSS({url:e,formData:t,name:s,filePath:n,fileType:i,onUploadProgress:r}){return new Promise(((o,a)=>{const c=this.adapter.uploadFile({url:e,formData:t,name:s,filePath:n,fileType:i,success(e){e&&e.statusCode<400?o(e):a(new Ge({code:"UPLOAD_FAILED",message:"文件上传失败"}))},fail(e){a(new Ge({code:e.code||"UPLOAD_FAILED",message:e.message||e.errMsg||"文件上传失败"}))}});"function"==typeof r&&c&&"function"==typeof c.onProgressUpdate&&c.onProgressUpdate((e=>{r({loaded:e.totalBytesSent,total:e.totalBytesExpectedToSend})}))}))}uploadFile({filePath:e,cloudPath:t,fileType:s="image",onUploadProgress:n}){if(!t)throw new Ge({code:"CLOUDPATH_REQUIRED",message:"cloudPath不可为空"});let i;return this.getOSSUploadOptionsFromPath({cloudPath:t}).then((t=>{const{url:r,formData:o,name:a}=t.result;i=t.result.fileUrl;const c={url:r,formData:o,name:a,filePath:e,fileType:s};return this.uploadFileToOSS(Object.assign({},c,{onUploadProgress:n}))})).then((()=>this.reportOSSUpload({cloudPath:t}))).then((t=>new Promise(((s,n)=>{t.success?s({success:!0,filePath:e,fileID:i}):n(new Ge({code:"UPLOAD_FAILED",message:"文件上传失败"}))}))))}deleteFile({fileList:e}){const t={method:"serverless.file.resource.delete",params:JSON.stringify({fileList:e})};return this.request(this.setupRequest(t)).then((e=>{if(e.success)return e.result;throw new Ge({code:"DELETE_FILE_FAILED",message:"删除文件失败"})}))}getTempFileURL({fileList:e}={}){if(!Array.isArray(e)||0===e.length)throw new Ge({code:"INVALID_PARAM",message:"fileList的元素必须是非空的字符串"});const t={method:"serverless.file.resource.getTempFileURL",params:JSON.stringify({fileList:e})};return this.request(this.setupRequest(t)).then((e=>{if(e.success)return{fileList:e.result.fileList.map((e=>({fileID:e.fileID,tempFileURL:e.tempFileURL})))};throw new Ge({code:"GET_TEMP_FILE_URL_FAILED",message:"获取临时文件链接失败"})}))}},vs={init(e){const t=new _s(e),s={signInAnonymously:function(){return t.authorize()},getLoginState:function(){return Promise.resolve(!1)}};return t.auth=function(){return s},t.customAuth=t.auth,t}};function ks({data:e}){let t;t=it();const s=JSON.parse(JSON.stringify(e||{}));if(Object.assign(s,{clientInfo:t}),!s.uniIdToken){const{token:e}=Xe();e&&(s.uniIdToken=e)}return s}const ws=[{rule:/fc_function_not_found|FUNCTION_NOT_FOUND/,content:",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",mode:"append"}];var Ts=/[\\^$.*+?()[\]{}|]/g,bs=RegExp(Ts.source);function Ss(e,t,s){return e.replace(new RegExp((n=t)&&bs.test(n)?n.replace(Ts,"\\$&"):n,"g"),s);var n}const Is=2e4,As={code:20101,message:"Invalid client"};function xs(e){const{errSubject:t,subject:s,errCode:n,errMsg:i,code:r,message:o,cause:a}=e||{};return new Ge({subject:t||s||"uni-secure-network",code:n||r||Is,message:i||o,cause:a})}let Ps;function Cs({secretType:e}={}){return"request"===e||"response"===e||"both"===e}function Us({functionName:e,result:t,logPvd:s}){}function Ls(e){const t=e.callFunction,s=function(s){const n=s.name;s.data=ks.call(e,{data:s.data});const i={aliyun:"aliyun",tencent:"tcb",tcb:"tcb"}[this.config.provider],r=Cs(s)||false;return t.call(this,s).then((e=>(e.errCode=0,!r&&Us.call(this,{functionName:n,result:e,logPvd:i}),Promise.resolve(e))),(e=>(!r&&Us.call(this,{functionName:n,result:e,logPvd:i}),e&&e.message&&(e.message=function({message:e="",extraInfo:t={},formatter:s=[]}={}){for(let n=0;ns.provider===e&&s.spaceId===t));return n&&n.config}({provider:e,spaceId:t});if(!a||!a.accessControl||!a.accessControl.enable)return!1;const c=a.accessControl.function||{},l=Object.keys(c);if(0===l.length)return!0;const u=function(e,t){let s,n,i;for(let r=0;re.trim())).indexOf(t)>-1&&(n=o):i=o:s=o}return s||n||i}(l,s);if(!u)return!1;if((c[u]||[]).find(((e={})=>e.appId===n&&(e.platform||"").toLowerCase()===o.toLowerCase())))return!0;throw console.error(`此应用[appId: ${n}, platform: ${o}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`),xs(As)}({provider:n,spaceId:i,functionName:r})?new Ps({secretType:t.secretType,uniCloudIns:e}).wrapVerifyClientCallFunction(s.bind(e))(t):o(t),Object.defineProperty(a,"result",{get:()=>(console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"),{})}),a}}Ps=class{constructor(){throw xs({message:"Platform web is not supported by secure network"})}};const Os=Symbol("CLIENT_DB_INTERNAL");function Es(e,t){return e.then="DoNotReturnProxyWithAFunctionNamedThen",e._internalType=Os,e.inspect=null,e.__v_raw=void 0,new Proxy(e,{get(e,s,n){if("_uniClient"===s)return null;if("symbol"==typeof s)return e[s];if(s in e||"string"!=typeof s){const t=e[s];return"function"==typeof t?t.bind(e):t}return t.get(e,s,n)}})}function Rs(e){return{on:(t,s)=>{e[t]=e[t]||[],e[t].indexOf(s)>-1||e[t].push(s)},off:(t,s)=>{e[t]=e[t]||[];const n=e[t].indexOf(s);-1!==n&&e[t].splice(n,1)}}}const Ds=["db.Geo","db.command","command.aggregate"];function Ns(e,t){return Ds.indexOf(`${e}.${t}`)>-1}function Fs(e){switch(pe(e=Ye(e))){case"array":return e.map((e=>Fs(e)));case"object":return e._internalType===Os||Object.keys(e).forEach((t=>{e[t]=Fs(e[t])})),e;case"regexp":return{$regexp:{source:e.source,flags:e.flags}};case"date":return{$date:e.toISOString()};default:return e}}function Ms(e){return e&&e.content&&e.content.$method}class qs{constructor(e,t,s){this.content=e,this.prevStage=t||null,this.udb=null,this._database=s}toJSON(){let e=this;const t=[e.content];for(;e.prevStage;)e=e.prevStage,t.push(e.content);return{$db:t.reverse().map((e=>({$method:e.$method,$param:Fs(e.$param)})))}}toString(){return JSON.stringify(this.toJSON())}getAction(){const e=this.toJSON().$db.find((e=>"action"===e.$method));return e&&e.$param&&e.$param[0]}getCommand(){return{$db:this.toJSON().$db.filter((e=>"action"!==e.$method))}}get isAggregate(){let e=this;for(;e;){const t=Ms(e),s=Ms(e.prevStage);if("aggregate"===t&&"collection"===s||"pipeline"===t)return!0;e=e.prevStage}return!1}get isCommand(){let e=this;for(;e;){if("command"===Ms(e))return!0;e=e.prevStage}return!1}get isAggregateCommand(){let e=this;for(;e;){const t=Ms(e),s=Ms(e.prevStage);if("aggregate"===t&&"command"===s)return!0;e=e.prevStage}return!1}getNextStageFn(e){const t=this;return function(){return js({$method:e,$param:Fs(Array.from(arguments))},t,t._database)}}get count(){return this.isAggregate?this.getNextStageFn("count"):function(){return this._send("count",Array.from(arguments))}}get remove(){return this.isCommand?this.getNextStageFn("remove"):function(){return this._send("remove",Array.from(arguments))}}get(){return this._send("get",Array.from(arguments))}get add(){return this.isCommand?this.getNextStageFn("add"):function(){return this._send("add",Array.from(arguments))}}update(){return this._send("update",Array.from(arguments))}end(){return this._send("end",Array.from(arguments))}get set(){return this.isCommand?this.getNextStageFn("set"):function(){throw new Error("JQL禁止使用set方法")}}_send(e,t){const s=this.getAction(),n=this.getCommand();return n.$db.push({$method:e,$param:Fs(t)}),this._database._callCloudFunction({action:s,command:n})}}function js(e,t,s){return Es(new qs(e,t,s),{get(e,t){let n="db";return e&&e.content&&(n=e.content.$method),Ns(n,t)?js({$method:t},e,s):function(){return js({$method:t,$param:Fs(Array.from(arguments))},e,s)}}})}function Bs({path:e,method:t}){return class{constructor(){this.param=Array.from(arguments)}toJSON(){return{$newDb:[...e.map((e=>({$method:e}))),{$method:t,$param:this.param}]}}toString(){return JSON.stringify(this.toJSON())}}}function $s(e,t={}){return Es(new e(t),{get:(e,t)=>Ns("db",t)?js({$method:t},null,e):function(){return js({$method:t,$param:Fs(Array.from(arguments))},null,e)}})}class Ks extends class{constructor({uniClient:e={},isJQL:t=!1}={}){this._uniClient=e,this._authCallBacks={},this._dbCallBacks={},e._isDefault&&(this._dbCallBacks=Ae("_globalUniCloudDatabaseCallback")),t||(this.auth=Rs(this._authCallBacks)),this._isJQL=t,Object.assign(this,Rs(this._dbCallBacks)),this.env=Es({},{get:(e,t)=>({$env:t})}),this.Geo=Es({},{get:(e,t)=>Bs({path:["Geo"],method:t})}),this.serverDate=Bs({path:[],method:"serverDate"}),this.RegExp=Bs({path:[],method:"RegExp"})}getCloudEnv(e){if("string"!=typeof e||!e.trim())throw new Error("getCloudEnv参数错误");return{$env:e.replace("$cloudEnv_","")}}_callback(e,t){const s=this._dbCallBacks;s[e]&&s[e].forEach((e=>{e(...t)}))}_callbackAuth(e,t){const s=this._authCallBacks;s[e]&&s[e].forEach((e=>{e(...t)}))}multiSend(){const e=Array.from(arguments),t=e.map((e=>{const t=e.getAction(),s=e.getCommand();if("getTemp"!==s.$db[s.$db.length-1].$method)throw new Error("multiSend只支持子命令内使用getTemp");return{action:t,command:s}}));return this._callCloudFunction({multiCommand:t,queryList:e})}}{_parseResult(e){return this._isJQL?e.result:e}_callCloudFunction({action:e,command:t,multiCommand:s,queryList:n}){function i(e,t){if(s&&n)for(let s=0;sLe(Oe(o,"complete"),e))).then((()=>(i(null,e),Je(De,{type:Me,content:e}),Promise.reject(e))))}const c=Le(Oe(o,"invoke")),l=this._uniClient;return c.then((()=>l.callFunction({name:"DCloud-clientDB",type:"CLIENT_DB",data:{action:e,command:t,multiCommand:s}}))).then((e=>{const{code:t,message:s,token:n,tokenExpired:c,systemInfo:l=[]}=e.result;if(l)for(let i=0;i(console.warn(s),n)})}}return h=e,Le(Oe(o,"success"),h).then((()=>Le(Oe(o,"complete"),h))).then((()=>{i(h,null);const e=r._parseResult(h);return Je(De,{type:Me,content:e}),Promise.resolve(e)}));var h}),(e=>(/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message)&&console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB"),a(new Ge({code:e.code||"SYSTEM_ERROR",message:e.message,requestId:e.requestId})))))}}const Js="token无效,跳转登录页面",Vs="token过期,跳转登录页面",Ws={TOKEN_INVALID_TOKEN_EXPIRED:Vs,TOKEN_INVALID_INVALID_CLIENTID:Js,TOKEN_INVALID:Js,TOKEN_INVALID_WRONG_TOKEN:Js,TOKEN_INVALID_ANONYMOUS_USER:Js},Hs={"uni-id-token-expired":Vs,"uni-id-check-token-failed":Js,"uni-id-token-not-exist":Js,"uni-id-check-device-feature-failed":Js};function zs(e,t){let s="";return s=e?`${e}/${t}`:t,s.replace(/^\//,"")}function Gs(e=[],t=""){const s=[],n=[];return e.forEach((e=>{!0===e.needLogin?s.push(zs(t,e.path)):!1===e.needLogin&&n.push(zs(t,e.path))})),{needLoginPage:s,notNeedLoginPage:n}}function Qs(e){return e.split("?")[0].replace(/^\//,"")}function Ys(){return function(e){let t=e&&e.$page&&e.$page.fullPath||"";return t?("/"!==t.charAt(0)&&(t="/"+t),t):t}(function(){const e=n();return e[e.length-1]}())}function Xs(){return Qs(Ys())}function Zs(e="",t={}){if(!e)return!1;if(!(t&&t.list&&t.list.length))return!1;const s=t.list,n=Qs(e);return s.some((e=>e.pagePath===n))}const en=!!ie.uniIdRouter,{loginPage:tn,routerNeedLogin:sn,resToLogin:nn,needLoginPage:rn,notNeedLoginPage:on,loginPageInTabBar:an}=function({pages:e=[],subPackages:t=[],uniIdRouter:s={},tabBar:n={}}=ie){const{loginPage:i,needLogin:r=[],resToLogin:o=!0}=s,{needLoginPage:a,notNeedLoginPage:c}=Gs(e),{needLoginPage:l,notNeedLoginPage:u}=function(e=[]){const t=[],s=[];return e.forEach((e=>{const{root:n,pages:i=[]}=e,{needLoginPage:r,notNeedLoginPage:o}=Gs(i,n);t.push(...r),s.push(...o)})),{needLoginPage:t,notNeedLoginPage:s}}(t);return{loginPage:i,routerNeedLogin:r,resToLogin:o,needLoginPage:[...a,...l],notNeedLoginPage:[...c,...u],loginPageInTabBar:Zs(i,n)}}();if(rn.indexOf(tn)>-1)throw new Error(`Login page [${tn}] should not be "needLogin", please check your pages.json`);function cn(e){const t=Xs();if("/"===e.charAt(0))return e;const[s,n]=e.split("?"),i=s.replace(/^\//,"").split("/"),r=t.split("/");r.pop();for(let o=0;o-1?n+`&uniIdRedirectUrl=${encodeURIComponent(i)}`:n+`?uniIdRedirectUrl=${encodeURIComponent(i)}`:n);var n,i;an?"navigateTo"!==e&&"redirectTo"!==e||(e="switchTab"):"switchTab"===e&&(e="navigateTo");const r={navigateTo:v,redirectTo:k,switchTab:w,reLaunch:T};setTimeout((()=>{r[e]({url:s})}))}function hn({url:e}={}){const t={abortLoginPageJump:!1,autoToLoginPage:!1},s=function(){const{token:e,tokenExpired:t}=Xe();let s;if(e){if(t-1)&&(rn.indexOf(t)>-1||sn.some((t=>{return s=e,new RegExp(t).test(s);var s})))}(e)&&s){if(s.uniIdRedirectUrl=e,Be(Ne).length>0)return setTimeout((()=>{Je(Ne,s)}),0),t.abortLoginPageJump=!0,t;t.autoToLoginPage=!0}return t}function dn(){!function(){const e=Ys(),{abortLoginPageJump:t,autoToLoginPage:s}=hn({url:e});t||s&&un({api:"redirectTo",redirect:e})}();const e=["navigateTo","redirectTo","reLaunch","switchTab"];for(let t=0;t{const{type:t,content:s}=e;let n=!1;switch(t){case"cloudobject":n=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in Hs}(s);break;case"clientdb":n=function(e){if("object"!=typeof e)return!1;const{errCode:t}=e||{};return t in Ws}(s)}n&&function(e={}){const t=Be(Ne);He().then((()=>{const s=Ys();if(s&&ln({redirect:s}))return t.length>0?Je(Ne,Object.assign({uniIdRedirectUrl:s},e)):void(tn&&un({api:"navigateTo",redirect:s}))}))}(s)}))}function pn(e){var t;(t=e).onResponse=function(e){$e(De,e)},t.offResponse=function(e){Ke(De,e)},function(e){e.onNeedLogin=function(e){$e(Ne,e)},e.offNeedLogin=function(e){Ke(Ne,e)},en&&(Ae("_globalUniCloudStatus").needLoginInit||(Ae("_globalUniCloudStatus").needLoginInit=!0,He().then((()=>{dn.call(e)})),nn&&fn.call(e)))}(e),function(e){e.onRefreshToken=function(e){$e(Fe,e)},e.offRefreshToken=function(e){Ke(Fe,e)}}(e)}let gn;const mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",yn=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;function _n(){const e=Xe().token||"",t=e.split(".");if(!e||3!==t.length)return{uid:null,role:[],permission:[],tokenExpired:0};let s;try{s=JSON.parse((n=t[1],decodeURIComponent(gn(n).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))))}catch(i){throw new Error("获取当前用户信息出错,详细错误信息为:"+i.message)}var n;return s.tokenExpired=1e3*s.exp,delete s.exp,delete s.iat,s}gn="function"!=typeof atob?function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!yn.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 s,n,i="",r=0;r>16&255):64===n?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return i}:atob;var vn=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(re((function(e,n){Object.defineProperty(n,"__esModule",{value:!0});const i="chooseAndUploadFile:ok",o="chooseAndUploadFile:fail";function a(e,t){return e.tempFiles.forEach(((e,s)=>{e.name||(e.name=e.path.substring(e.path.lastIndexOf("/")+1)),t&&(e.fileType=t),e.cloudPath=Date.now()+"_"+s+e.name.substring(e.name.lastIndexOf("."))})),e.tempFilePaths||(e.tempFilePaths=e.tempFiles.map((e=>e.path))),e}function c(e,t,{onChooseFile:s,onUploadProgress:n}){return t.then((e=>{if(s){const t=s(e);if(void 0!==t)return Promise.resolve(t).then((t=>void 0===t?e:t))}return e})).then((t=>!1===t?{errMsg:i,tempFilePaths:[],tempFiles:[]}:function(e,t,s=5,n){(t=Object.assign({},t)).errMsg=i;const r=t.tempFiles,o=r.length;let a=0;return new Promise((i=>{for(;a=o)return void(!r.find((e=>!e.url&&!e.errMsg))&&i(t));const l=r[s];e.uploadFile({filePath:l.path,cloudPath:l.cloudPath,fileType:l.fileType,onUploadProgress(e){e.index=s,e.tempFile=l,e.tempFilePath=l.path,n&&n(e)}}).then((e=>{l.url=e.fileID,s{l.errMsg=e.errMsg||e.message,s{t({count:s,sizeType:n,sourceType:i,extension:r,success(t){e(a(t,"image"))},fail(e){c({errMsg:e.errMsg.replace("chooseImage:fail",o)})}})}))}(n),n):"video"===n.type?c(e,function(e){const{camera:t,compressed:n,maxDuration:i,sourceType:r=["album","camera"],extension:c}=e;return new Promise(((e,l)=>{s({camera:t,compressed:n,maxDuration:i,sourceType:r,extension:c,success(t){const{tempFilePath:s,duration:n,size:i,height:r,width:o}=t;e(a({errMsg:"chooseVideo:ok",tempFilePaths:[s],tempFiles:[{name:t.tempFile&&t.tempFile.name||"",path:s,size:i,type:t.tempFile&&t.tempFile.type||"",width:o,height:r,duration:n,fileType:"video",cloudPath:""}]},"video"))},fail(e){l({errMsg:e.errMsg.replace("chooseVideo:fail",o)})}})}))}(n),n):c(e,function(e){const{count:t,extension:s}=e;return new Promise(((e,n)=>{let i=r;if("undefined"!=typeof wx&&"function"==typeof wx.chooseMessageFile&&(i=wx.chooseMessageFile),"function"!=typeof i)return n({errMsg:o+" 请指定 type 类型,该平台仅支持选择 image 或 video。"});i({type:"all",count:t,extension:s,success(t){e(a(t))},fail(e){n({errMsg:e.errMsg.replace("chooseFile:fail",o)})}})}))}(n),n)}}})));function kn(e){return{props:{localdata:{type:Array,default:()=>[]},options:{type:[Object,Array],default:()=>({})},spaceInfo:{type:Object,default:()=>({})},collection:{type:[String,Array],default:""},action:{type:String,default:""},field:{type:String,default:""},orderby:{type:String,default:""},where:{type:[String,Object],default:""},pageData:{type:String,default:"add"},pageCurrent:{type:Number,default:1},pageSize:{type:Number,default:20},getcount:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String],default:!1},gettreepath:{type:[Boolean,String],default:!1},startwith:{type:String,default:""},limitlevel:{type:Number,default:10},groupby:{type:String,default:""},groupField:{type:String,default:""},distinct:{type:[Boolean,String],default:!1},foreignKey:{type:String,default:""},loadtime:{type:String,default:"auto"},manual:{type:Boolean,default:!1}},data:()=>({mixinDatacomLoading:!1,mixinDatacomHasMore:!1,mixinDatacomResData:[],mixinDatacomErrorMessage:"",mixinDatacomPage:{}}),created(){this.mixinDatacomPage={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((()=>{var e=[];return["pageCurrent","pageSize","localdata","collection","action","field","orderby","where","getont","getcount","gettree","groupby","groupField","distinct"].forEach((t=>{e.push(this[t])})),e}),((e,t)=>{if("manual"===this.loadtime)return;let s=!1;const n=[];for(let i=2;i{this.mixinDatacomLoading=!1;const{data:n,count:i}=s.result;this.getcount&&(this.mixinDatacomPage.count=i),this.mixinDatacomHasMore=n.length{this.mixinDatacomLoading=!1,this.mixinDatacomErrorMessage=e,s&&s(e)})))},mixinDatacomGet(t={}){let s=e.database(this.spaceInfo);const n=t.action||this.action;n&&(s=s.action(n));const i=t.collection||this.collection;s=Array.isArray(i)?s.collection(...i):s.collection(i);const r=t.where||this.where;r&&Object.keys(r).length&&(s=s.where(r));const o=t.field||this.field;o&&(s=s.field(o));const a=t.foreignKey||this.foreignKey;a&&(s=s.foreignKey(a));const c=t.groupby||this.groupby;c&&(s=s.groupBy(c));const l=t.groupField||this.groupField;l&&(s=s.groupField(l)),!0===(void 0!==t.distinct?t.distinct:this.distinct)&&(s=s.distinct());const u=t.orderby||this.orderby;u&&(s=s.orderBy(u));const h=void 0!==t.pageCurrent?t.pageCurrent:this.mixinDatacomPage.current,d=void 0!==t.pageSize?t.pageSize:this.mixinDatacomPage.size,f=void 0!==t.getcount?t.getcount:this.getcount,p=void 0!==t.gettree?t.gettree:this.gettree,g=void 0!==t.gettreepath?t.gettreepath:this.gettreepath,m={getCount:f},y={limitLevel:void 0!==t.limitlevel?t.limitlevel:this.limitlevel,startWith:void 0!==t.startwith?t.startwith:this.startwith};return p&&(m.getTree=y),g&&(m.getTreePath=y),s=s.skip(d*(h-1)).limit(d).get(m),s}}}}function wn(e){return Ae("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}",e.config.spaceId))}async function Tn({openid:e,callLoginByWeixin:t=!1}={}){throw wn(this),new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `web`")}async function bn(e){const t=wn(this);return t.initPromise||(t.initPromise=Tn.call(this,e)),t.initPromise}function Sn(e){const t={getSystemInfo:b,getPushClientId:S};return function(s){return new Promise(((n,i)=>{t[e]({...s,success(e){n(e)},fail(e){i(e)}})}))}}class In extends class{constructor(){this._callback={}}addListener(e,t){this._callback[e]||(this._callback[e]=[]),this._callback[e].push(t)}on(e,t){return this.addListener(e,t)}removeListener(e,t){if(!t)throw new Error('The "listener" argument must be of type function. Received undefined');const s=this._callback[e];if(!s)return;const n=function(e,t){for(let s=e.length-1;s>=0;s--)if(e[s]===t)return s;return-1}(s,t);s.splice(n,1)}off(e,t){return this.removeListener(e,t)}removeAllListener(e){delete this._callback[e]}emit(e,...t){const s=this._callback[e];if(s)for(let n=0;n{if(!e)throw new Error("Invalid appId, please check the manifest.json file");if(!t)throw new Error("Invalid push client id");this._appId=e,this._pushClientId=t,this._seqId=Date.now()+"-"+Math.floor(9e5*Math.random()+1e5),this.emit("open"),this._initMessageListener()}),(e=>{throw this.emit("error",e),this.close(),e}))}async open(){return this.init()}_isUniCloudSSE(e){if("receive"!==e.type)return!1;const t=e&&e.data&&e.data.payload;return!(!t||"UNI_CLOUD_SSE"!==t.channel||t.seqId!==this._seqId)}_receivePushMessage(e){if(!this._isUniCloudSSE(e))return;const t=e&&e.data&&e.data.payload,{action:s,messageId:n,message:i}=t;this._payloadQueue.push({action:s,messageId:n,message:i}),this._consumMessage()}_consumMessage(){for(;;){const e=this._payloadQueue.find((e=>e.messageId===this._currentMessageId+1));if(!e)break;this._currentMessageId++,this._parseMessagePayload(e)}}_parseMessagePayload(e){const{action:t,messageId:s,message:n}=e;"end"===t?this._end({messageId:s,message:n}):"message"===t&&this._appendMessage({messageId:s,message:n})}_appendMessage({messageId:e,message:t}={}){this.emit("message",t)}_end({messageId:e,message:t}={}){this.emit("end",t),this.close()}_initMessageListener(){u(this._uniPushMessageCallback)}_destroy(){h(this._uniPushMessageCallback)}toJSON(){return{appId:this._appId,pushClientId:this._pushClientId,seqId:this._seqId}}close(){this._destroy(),this.emit("close")}}const An={tcb:ys,tencent:ys,aliyun:ht,private:vs};let xn=new class{init(e){let t={};const s=An[e.provider];if(!s)throw new Error("未提供正确的provider参数");var n;return t=s.init(e),function(e){e._initPromiseHub||(e._initPromiseHub=new ke({createPromise:function(){let t=Promise.resolve();t=new Promise((e=>{setTimeout((()=>{e()}),1)}));const s=e.auth();return t.then((()=>s.getLoginState())).then((e=>e?Promise.resolve():s.signInAnonymously()))}}))}(t),Ls(t),function(e){const t=e.uploadFile;e.uploadFile=function(e){return t.call(this,e)}}(t),(n=t).database=function(e){if(e&&Object.keys(e).length>0)return n.init(e).database();if(this._database)return this._database;const t=$s(Ks,{uniClient:n});return this._database=t,t},n.databaseForJQL=function(e){if(e&&Object.keys(e).length>0)return n.init(e).databaseForJQL();if(this._databaseForJQL)return this._databaseForJQL;const t=$s(Ks,{uniClient:n,isJQL:!0});return this._databaseForJQL=t,t},function(e){e.getCurrentUserInfo=_n,e.chooseAndUploadFile=vn.initChooseAndUploadFile(e),Object.assign(e,{get mixinDatacom(){return kn(e)}}),e.SSEChannel=In,e.initSecureNetworkByWeixin=function(e){return function({openid:t,callLoginByWeixin:s=!1}={}){return bn.call(e,{openid:t,callLoginByWeixin:s})}}(e),e.importObject=function(t){return function(s,n={}){n=function(e,t={}){return e.customUI=t.customUI||e.customUI,e.parseSystemError=t.parseSystemError||e.parseSystemError,Object.assign(e.loadingOptions,t.loadingOptions),Object.assign(e.errorOptions,t.errorOptions),"object"==typeof t.secretMethods&&(e.secretMethods=t.secretMethods),e}({customUI:!1,loadingOptions:{title:"加载中...",mask:!0},errorOptions:{type:"modal",retry:!1}},n);const{customUI:i,loadingOptions:r,errorOptions:u,parseSystemError:h}=n,d=!i;return new Proxy({},{get:(i,f)=>function({fn:e,interceptorName:t,getCallbackArgs:s}={}){return async function(...n){const i=s?s({params:n}):{};let r,o;try{return await Le(Oe(t,"invoke"),{...i}),r=await e(...n),await Le(Oe(t,"success"),{...i,result:r}),r}catch(a){throw o=a,await Le(Oe(t,"fail"),{...i,error:o}),o}finally{await Le(Oe(t,"complete"),o?{...i,error:o}:{...i,result:r})}}}({fn:async function i(...p){let g;d&&o({title:r.title,mask:r.mask});const m={name:s,type:"OBJECT",data:{method:f,params:p}};"object"==typeof n.secretMethods&&function(e,t){const s=t.data.method,n=e.secretMethods||{},i=n[s]||n["*"];i&&(t.secretType=i)}(n,m);let y=!1;try{g=await t.callFunction(m)}catch(e){y=!0,g={result:new Ge(e)}}const{errSubject:_,errCode:v,errMsg:k,newToken:w}=g.result||{};if(d&&a(),w&&w.token&&w.tokenExpired&&(Ze(w),Je(Fe,{...w})),v){let e=k;if(y&&h&&(e=(await h({objectName:s,methodName:f,params:p,errSubject:_,errCode:v,errMsg:k})).errMsg||k),d)if("toast"===u.type)c({title:e,icon:"none"});else{if("modal"!==u.type)throw new Error(`Invalid errorOptions.type: ${u.type}`);{const{confirm:t}=await async function({title:e,content:t,showCancel:s,cancelText:n,confirmText:i}={}){return new Promise(((r,o)=>{l({title:e,content:t,showCancel:s,cancelText:n,confirmText:i,success(e){r(e)},fail(){r({confirm:!1,cancel:!0})}})}))}({title:"提示",content:e,showCancel:u.retry,cancelText:"取消",confirmText:u.retry?"重试":"确定"});if(u.retry&&t)return i(...p)}}const t=new Ge({subject:_,code:v,message:k,requestId:g.requestId});throw t.detail=g.result,Je(De,{type:je,content:t}),t}return Je(De,{type:je,content:g.result}),g.result},interceptorName:"callObject",getCallbackArgs:function({params:e}={}){return{objectName:s,methodName:f,params:e}}})})}}(e)}(t),["callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","chooseAndUploadFile"].forEach((e=>{if(!t[e])return;const s=t[e];var n,i;t[e]=function(){return s.apply(t,Array.from(arguments))},t[e]=(n=t[e],i=e,function(e){let t=!1;if("callFunction"===i){const s=e&&e.type||he;t=s!==he}const s="callFunction"===i&&!t,r=this._initPromiseHub.exec();e=e||{};const{success:o,fail:a,complete:c}=ze(e),l=r.then((()=>t?Promise.resolve():Le(Oe(i,"invoke"),e))).then((()=>n.call(this,e))).then((e=>t?Promise.resolve(e):Le(Oe(i,"success"),e).then((()=>Le(Oe(i,"complete"),e))).then((()=>(s&&Je(De,{type:qe,content:e}),Promise.resolve(e))))),(e=>t?Promise.reject(e):Le(Oe(i,"fail"),e).then((()=>Le(Oe(i,"complete"),e))).then((()=>(Je(De,{type:qe,content:e}),Promise.reject(e))))));if(!(o||a||c))return l;l.then((e=>{o&&o(e),c&&c(e),s&&Je(De,{type:qe,content:e})}),(e=>{a&&a(e),c&&c(e),s&&Je(De,{type:qe,content:e})}))}).bind(t)})),t.init=this.init,t}};(()=>{const e=be;let t={};if(e&&1===e.length)t=e[0],xn=xn.init(t),xn._isDefault=!0;else{const t=["auth","callFunction","uploadFile","deleteFile","getTempFileURL","downloadFile","database","getCurrentUSerInfo","importObject"];let s;s=e&&e.length>0?"应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间":"应用未关联服务空间,请在uniCloud目录右键关联服务空间",t.forEach((e=>{xn[e]=function(){return console.error(s),Promise.reject(new Ge({code:"SYS_ERR",message:s}))}}))}Object.assign(xn,{get mixinDatacom(){return kn(xn)}}),pn(xn),xn.addInterceptor=Ce,xn.removeInterceptor=Ue,xn.interceptObject=Ee})();const Pn={name:"uniDataChecklist",mixins:[xn.mixinDatacom||{}],emits:["input","update:modelValue","change"],props:{mode:{type:String,default:"default"},multiple:{type:Boolean,default:!1},value:{type:[Array,String,Number],default:()=>""},modelValue:{type:[Array,String,Number],default:()=>""},localdata:{type:Array,default:()=>[]},min:{type:[Number,String],default:""},max:{type:[Number,String],default:""},wrap:{type:Boolean,default:!1},icon:{type:String,default:"left"},selectedColor:{type:String,default:""},selectedTextColor:{type:String,default:""},emptyText:{type:String,default:"暂无数据"},disabled:{type:Boolean,default:!1},map:{type:Object,default:()=>({text:"text",value:"value"})}},watch:{localdata:{handler(e){this.range=e,this.dataList=this.getDataList(this.getSelectedValue(e))},deep:!0},mixinDatacomResData(e){this.range=e,this.dataList=this.getDataList(this.getSelectedValue(e))},value(e){this.dataList=this.getDataList(e)},modelValue(e){this.dataList=this.getDataList(e)}},data:()=>({dataList:[],range:[],contentText:{contentdown:"查看更多",contentrefresh:"加载中",contentnomore:"没有更多"},isLocal:!0,styles:{selectedColor:"#2979ff",selectedTextColor:"#666"},isTop:0}),computed:{dataValue(){return""===this.value?this.modelValue:(this.modelValue,this.value)}},created(){this.localdata&&0!==this.localdata.length?(this.isLocal=!0,this.range=this.localdata,this.dataList=this.getDataList(this.getSelectedValue(this.range))):this.collection&&(this.isLocal=!1,this.loadData())},methods:{loadData(){this.mixinDatacomGet().then((e=>{this.mixinDatacomResData=e.result.data,0===this.mixinDatacomResData.length?(this.isLocal=!1,this.mixinDatacomErrorMessage=this.emptyText):this.isLocal=!0})).catch((e=>{this.mixinDatacomErrorMessage=e.message}))},getForm(e="uniForms"){let t=this.$parent,s=t.$options.name;for(;s!==e;){if(t=t.$parent,!t)return!1;s=t.$options.name}return t},chagne(e){const t=e.detail.value;let s={value:[],data:[]};if(this.multiple)this.range.forEach((e=>{t.includes(e[this.map.value]+"")&&(s.value.push(e[this.map.value]),s.data.push(e))}));else{const e=this.range.find((e=>e[this.map.value]+""===t));e&&(s={value:e[this.map.value],data:e})}this.$emit("input",s.value),this.$emit("update:modelValue",s.value),this.$emit("change",{detail:s}),this.multiple?this.dataList=this.getDataList(s.value,!0):this.dataList=this.getDataList(s.value)},getDataList(e){let t=JSON.parse(JSON.stringify(this.range)),s=[];return this.multiple&&(Array.isArray(e)||(e=[])),t.forEach(((t,n)=>{if(t.disabled=t.disable||t.disabled||!1,this.multiple)if(e.length>0){let s=e.find((e=>e===t[this.map.value]));t.selected=void 0!==s}else t.selected=!1;else t.selected=e===t[this.map.value];s.push(t)})),this.setRange(s)},setRange(e){let t=e.filter((e=>e.selected)),s=Number(this.min)||0,n=Number(this.max)||"";return e.forEach(((i,r)=>{if(this.multiple){if(t.length<=s){void 0!==t.find((e=>e[this.map.value]===i[this.map.value]))&&(i.disabled=!0)}if(t.length>=n&&""!==n){void 0===t.find((e=>e[this.map.value]===i[this.map.value]))&&(i.disabled=!0)}}this.setStyles(i,r),e[r]=i})),e},setStyles(e,t){e.styleBackgroud=this.setStyleBackgroud(e),e.styleIcon=this.setStyleIcon(e),e.styleIconText=this.setStyleIconText(e),e.styleRightIcon=this.setStyleRightIcon(e)},getSelectedValue(e){if(!this.multiple)return this.dataValue;let t=[];return e.forEach((e=>{e.selected&&t.push(e[this.map.value])})),this.dataValue.length>0?this.dataValue:t},setStyleBackgroud(e){let t={},s=this.selectedColor?this.selectedColor:"#2979ff";"list"!==this.mode&&(t["border-color"]=e.selected?s:"#DCDFE6"),"tag"===this.mode&&(t["background-color"]=e.selected?s:"#f5f5f5");let n="";for(let i in t)n+=`${i}:${t[i]};`;return n},setStyleIcon(e){let t={},s="",n=this.selectedColor?this.selectedColor:"#2979ff";t["background-color"]=e.selected?n:"#fff",t["border-color"]=e.selected?n:"#DCDFE6",!e.selected&&e.disabled&&(t["background-color"]="#F2F6FC",t["border-color"]=e.selected?n:"#DCDFE6");for(let i in t)s+=`${i}:${t[i]};`;return s},setStyleIconText(e){let t={},s="",n=this.selectedColor?this.selectedColor:"#2979ff";"tag"===this.mode?t.color=e.selected?this.selectedTextColor?this.selectedTextColor:"#fff":"#666":t.color=e.selected?this.selectedTextColor?this.selectedTextColor:n:"#666",!e.selected&&e.disabled&&(t.color="#999");for(let i in t)s+=`${i}:${t[i]};`;return s},setStyleRightIcon(e){let t={},s="";"list"===this.mode&&(t["border-color"]=e.selected?this.styles.selectedColor:"#DCDFE6");for(let n in t)s+=`${n}:${t[n]};`;return s}}};const Cn=x(Pn,[["render",function(e,t,s,n,i,r){const o=ne(P("uni-load-more"),se),a=B,c=$,l=K,u=J,h=V,d=W,f=H;return C(),U(c,{class:"uni-data-checklist",style:M({"margin-top":i.isTop+"px"})},{default:L((()=>[i.isLocal?(C(),R(D,{key:1},[s.multiple?(C(),U(h,{key:0,class:N(["checklist-group",{"is-list":"list"===s.mode||s.wrap}]),onChange:r.chagne},{default:L((()=>[(C(!0),R(D,null,F(i.dataList,((e,t)=>(C(),U(u,{class:N(["checklist-box",["is--"+s.mode,e.selected?"is-checked":"",s.disabled||e.disabled?"is-disable":"",0!==t&&"list"===s.mode?"is-list-border":""]]),style:M(e.styleBackgroud),key:t},{default:L((()=>[q(l,{class:"hidden",hidden:"",disabled:s.disabled||!!e.disabled,value:e[s.map.value]+"",checked:e.selected},null,8,["disabled","value","checked"]),"tag"!==s.mode&&"list"!==s.mode||"list"===s.mode&&"left"===s.icon?(C(),U(c,{key:0,class:"checkbox__inner",style:M(e.styleIcon)},{default:L((()=>[q(c,{class:"checkbox__inner-icon"})])),_:2},1032,["style"])):j("",!0),q(c,{class:N(["checklist-content",{"list-content":"list"===s.mode&&"left"===s.icon}])},{default:L((()=>[q(a,{class:"checklist-text",style:M(e.styleIconText)},{default:L((()=>[O(E(e[s.map.text]),1)])),_:2},1032,["style"]),"list"===s.mode&&"right"===s.icon?(C(),U(c,{key:0,class:"checkobx__list",style:M(e.styleBackgroud)},null,8,["style"])):j("",!0)])),_:2},1032,["class"])])),_:2},1032,["class","style"])))),128))])),_:1},8,["class","onChange"])):(C(),U(f,{key:1,class:N(["checklist-group",{"is-list":"list"===s.mode,"is-wrap":s.wrap}]),onChange:r.chagne},{default:L((()=>[(C(!0),R(D,null,F(i.dataList,((e,t)=>(C(),U(u,{class:N(["checklist-box",["is--"+s.mode,e.selected?"is-checked":"",s.disabled||e.disabled?"is-disable":"",0!==t&&"list"===s.mode?"is-list-border":""]]),style:M(e.styleBackgroud),key:t},{default:L((()=>[q(d,{class:"hidden",hidden:"",disabled:s.disabled||e.disabled,value:e[s.map.value]+"",checked:e.selected},null,8,["disabled","value","checked"]),"tag"!==s.mode&&"list"!==s.mode||"list"===s.mode&&"left"===s.icon?(C(),U(c,{key:0,class:"radio__inner",style:M(e.styleBackgroud)},{default:L((()=>[q(c,{class:"radio__inner-icon",style:M(e.styleIcon)},null,8,["style"])])),_:2},1032,["style"])):j("",!0),q(c,{class:N(["checklist-content",{"list-content":"list"===s.mode&&"left"===s.icon}])},{default:L((()=>[q(a,{class:"checklist-text",style:M(e.styleIconText)},{default:L((()=>[O(E(e[s.map.text]),1)])),_:2},1032,["style"]),"list"===s.mode&&"right"===s.icon?(C(),U(c,{key:0,style:M(e.styleRightIcon),class:"checkobx__list"},null,8,["style"])):j("",!0)])),_:2},1032,["class"])])),_:2},1032,["class","style"])))),128))])),_:1},8,["class","onChange"]))],64)):(C(),U(c,{key:0,class:"uni-data-loading"},{default:L((()=>[e.mixinDatacomErrorMessage?(C(),U(a,{key:1},{default:L((()=>[O(E(e.mixinDatacomErrorMessage),1)])),_:1})):(C(),U(o,{key:0,status:"loading",iconType:"snow",iconSize:18,"content-text":i.contentText},null,8,["content-text"]))])),_:1}))])),_:1},8,["style"])}],["__scopeId","data-v-cb752505"]]),Un=z(G);Q(Un);const Ln={data:()=>({title:"发起群聊",contact_id:"",lists:[],keywords:"",searchList:[],selectUser:[],userList:[],changeUser:[],user_ids:[],type:1,relayState:!1,scrollLeft:300,contacList:[],searcheUser:[],curMsg:{}}),watch:{relayState(e){1==e&&(c({icon:"success",title:"转发成功"}),setTimeout((()=>{Y()}),2e3))},keywords(e){this.search(),""!=e&&(this.searcheUser=this.changeUser)},searcheUser(e){const t=this.changeUser.concat(e);this.changeUser=[...new Set(t)]}},components:{},onLoad(e){var t=n(),s=t[t.length-2];this.type=e.type?e.type:1,this.contact_id=e.contact_id?e.contact_id:"",2==e.type?(this.title="添加成员",this.user_ids=s.user_ids,this.getAllUser()):3==e.type?(this.title="转发聊天",this.curMsg=s.curMsg,this.getAllUser()):(this.title="发起群聊",this.getAllUser())},methods:{relay(){let e=this.changeUser.map((e=>e.id));if(e.length)if(e.length>5)c({title:"转发的人数不能超过5人!",icon:"none"});else{var t=n(),s=t[t.length-2];let i="";i=s.fromUser,s.contact.id;let r="";r="relayCrm"==this.type||"relayProject"==this.type?s.message:g("selectedItem"),e.forEach((e=>{let t={id:this.$util.getUuid(),is_group:0,fromUser:i,extends:r.extends?r.extends:"",type:r.type,toContactId:e,content:r.content,sendTime:(new Date).getTime()};this.$api.msgApi.sendMessage(t).then((e=>{200===e.code&&(this.relayState=!0)}))}))}else c({title:"请选择至少一名人员",icon:"none"})},delUser(){l({title:"提示",content:"确定删除?",cancelText:"取消",confirmText:"确认",showCancel:!0,success:e=>{if(e.confirm){var t=n();let e=t[t.length-2].group_id;this.$api.msgApi.removeUser({user_id:this.changeUser.user_id,id:e}).then((e=>{200===e.code&&Y()}))}else console.log("cancel")}})},addGroupUser(e){var t=n(),s=t[t.length-2];s.getsimpleMessage=!1;let i=s.group_id;this.$api.msgApi.addGroupUser({user_ids:e,id:i}).then((e=>{200==e.code&&Y()}))},addGroup(e){this.$api.msgApi.addGroup({user_ids:e}).then((e=>{200==e.code&&setTimeout((()=>{Y()}),2e3)}))},getAllUser(){const e=g("allContacts");let t=[];3==this.type?(t=e.filter((e=>e.id!=this.contact_id)),t.forEach((e=>{e.disable=!1;let t=e.displayName;e.is_group&&(t+="(群聊)"),e.text=t,e.value=e.id}))):(t=e.filter((e=>0==e.is_group)),this.contacList=JSON.parse(JSON.stringify(t)),t.forEach((e=>{e.disable=!1,e.text=e.displayName,e.value=e.id,this.user_ids.length&&2==this.type&&this.user_ids.includes(e.id)&&(e.disable=!0)})),1==this.type&&this.contact_id&&(this.changeUser.push(parseInt(this.contact_id)),this.selectUser=t.filter((e=>e.id==this.contact_id)))),this.userList=t,this.lists=t},chooseUser(e){this.selectUser=e.detail.data,setTimeout((()=>{this.scrollLeft+=300}),50)},chooseSearchUser(e){this.selectUser=this.$util.mergeArrays(e.detail.data,this.selectUser),setTimeout((()=>{this.scrollLeft+=300}),50)},removeUser(e){this.selectUser=this.selectUser.filter((t=>t.id!=e)),this.changeUser=this.changeUser.filter((t=>t!=e))},save(){if(o({title:"保存中...",mask:!0}),!this.changeUser.length)return c({title:"请选择人员",icon:"none"});if(1==this.type)this.$api.msgApi.addGroup({user_ids:this.changeUser}).then((e=>{a();const t=e.data;Un.appendContacts(t),v({url:"/pages/message/chat?id="+t.id})}));else if(2==this.type)this.$api.msgApi.addGroupUser({user_ids:this.changeUser,id:this.contact_id}).then((e=>{a(),Y()}));else if(3==this.type){if(this.changeUser.length>5)return c({title:"单次转发不能超过5人",icon:"none"});this.$api.msgApi.forwardMessage({user_ids:this.changeUser,msg_id:this.curMsg.msg_id}).then((e=>{a(),Y()}))}else this.$api.msgApi.removeUser({user_ids:this.changeUser,id:this.contact_id}).then((e=>{a(),Y()}))},search:function(e){let t=JSON.parse(JSON.stringify(this.lists));this.searchList=this.$util.searchObject(t,["displayName","name_py"],this.keywords)},confirm:function(e){let t=[];e&&(this.userList.filter((s=>{let n=s.realname?s.realname:s.userInfo.displayName;return n.includes(e.trim())&&t.push(s),n.includes(e.trim())})),this.lists=t)}}};const On=x(Ln,[["render",function(e,t,s,n,i,r){const o=$,a=X("cu-custom"),c=B,l=Z,u=ne(P("uni-data-checkbox"),Cn),h=X("Empty"),d=te,f=ee;return C(),U(o,null,{default:L((()=>[q(a,{bgColor:"bg-gradual-green",isBack:!0},{backText:L((()=>[])),content:L((()=>[O(E(i.title),1)])),right:L((()=>[q(o,{class:"mr-10 f-16",onClick:r.save},{default:L((()=>[O(E(3==i.type?"转发":"保存"),1)])),_:1},8,["onClick"])])),_:1}),q(o,{class:"cu-bar bg-white search fixed",style:M([{top:e.CustomBar+"px"}])},{default:L((()=>[q(o,{class:"search-form round"},{default:L((()=>[q(c,{class:"cuIcon-search"}),q(l,{type:"text",modelValue:i.keywords,"onUpdate:modelValue":t[0]||(t[0]=e=>i.keywords=e),placeholder:"输入搜索的关键词","confirm-type":"search"},null,8,["modelValue"])])),_:1})])),_:1},8,["style"]),i.keywords?j("",!0):(C(),U(o,{key:0,class:"gui-padding",style:{"margin-top":"120rpx","padding-bottom":"100rpx"}},{default:L((()=>[q(u,{multiple:"",class:"user-list-select",onChange:r.chooseUser,modelValue:i.changeUser,"onUpdate:modelValue":t[1]||(t[1]=e=>i.changeUser=e),localdata:i.lists},null,8,["onChange","modelValue","localdata"]),i.lists.length?j("",!0):(C(),U(h,{key:0,noDatatext:"无联系人",textcolor:"#999"}))])),_:1})),i.keywords?(C(),U(o,{key:1,class:"gui-padding",style:{"margin-top":"120rpx","padding-bottom":"100rpx"}},{default:L((()=>[q(u,{multiple:"",class:"user-list-select",onChange:r.chooseSearchUser,modelValue:i.searcheUser,"onUpdate:modelValue":t[2]||(t[2]=e=>i.searcheUser=e),localdata:i.searchList},null,8,["onChange","modelValue","localdata"]),i.searchList.length?j("",!0):(C(),U(h,{key:0,noDatatext:"未搜索到数据",textcolor:"#999"}))])),_:1})):j("",!0),q(o,{class:"cu-bar bg-white tabbar border shop footer-opt"},{default:L((()=>[q(f,{class:"scroll-view_H","scroll-x":"true","scroll-anchoring":!0,"scroll-left":i.scrollLeft},{default:L((()=>[q(o,{class:"user-list-avatar"},{default:L((()=>[(C(!0),R(D,null,F(i.selectUser,(e=>(C(),U(d,{class:"user-avatar",src:e.avatar,onClick:t=>r.removeUser(e.id)},null,8,["src","onClick"])))),256))])),_:1}),q(o,{class:"select-num pd-10"},{default:L((()=>[O("已选"+E(i.selectUser.length)+"人",1)])),_:1})])),_:1},8,["scroll-left"])])),_:1})])),_:1})}],["__scopeId","data-v-b59b1c44"]]);export{On as default};