import{u as N}from"./vue-i18n-90d534a9.js";import{u as q,o as z}from"./vue-router-7f882520.js";import{k as j,v as F,l as H,I as y,q as v}from"./index-ae60edf9.js";import"./index-fc073ec7.js";import{S as J}from"./index-7aceb4e5.js";import{_ as Q}from"./index.vue_vue_type_script_setup_true_lang-1170722e.js";import{V as W}from"./virtual-list-b1ee24f1.js";import{_ as X}from"./index.vue_vue_type_script_setup_true_lang-e7eadba1.js";import{u as Y}from"./useGroupMemberList-2f20ff8e.js";import{u as Z}from"./useCurrentMemberRole-f0ed520c.js";import{M as r}from"./data-2e062955.js";import{_ as ee}from"./index.vue_vue_type_script_setup_true_lang-bf293ef7.js";import{A as re,e as h}from"./open-im-sdk-wasm-f19f04ec.js";import{u as te,R as C}from"./useInviteRtc-593f2956.js";import{d as oe,b as _,l as se,k as p,o as b,c as ae,$ as k,u as c,O as ie,P as ne}from"./@vue-cb50a1c4.js";import{s as ce}from"./function-call-079e4448.js";import"./@intlify-1c0af683.js";import"./dayjs-4460abc8.js";import"./@amap-aca98dec.js";import"./pinia-de4079f2.js";import"./axios-7d5a0a64.js";import"./form-data-497f8b5e.js";import"./uuid-a960c1f4.js";import"./date-fns-f56f60e6.js";import"./@babel-7fd5df1e.js";import"./mitt-f7ef348c.js";import"./@vueuse-19adab01.js";import"./livekit-client-ca552de3.js";import"./@livekit-3058dbe8.js";import"./loglevel-e40a507a.js";import"./rxjs-2154ddb2.js";import"./tslib-8dbab242.js";import"./@vuemap-5ebdc63e.js";import"./lodash-es-91418b19.js";import"./use-id-22cfdfcf.js";import"./index-597402db.js";import"./arrows_left-f963ef62.js";import"./index-e4a7d928.js";const ue={class:"page_container"},Qe=oe({__name:"index",setup(le){const{t:u}=N(),d=q(),L=j(),{inviteRtc:V}=te(),S=F(),I=H(),m=history.state,A=[r.VoiceInvite,r.VideoInvite,r.ChooseAt,r.Kickout],{fetchState:o,getMemberData:g,searchMember:D}=Y(m.groupID),{isOwner:R}=Z(m.groupID),i=_(m.action),s=_([]),n=se({keyword:"",searching:!1}),f=p(()=>A.includes(i.value)),T=p(()=>o.groupMemberList.filter(e=>s.value.includes(e.userID))),x=p(()=>{switch(i.value){case r.VoiceInvite:return u("rtc.voice");case r.VideoInvite:return u("rtc.video");case r.ChooseAt:return u("selectAtMember");case r.Kickout:return u("kickMember");case r.Transfer:return u("transferGroupDesc");default:return u("groupMember")}}),w=p(()=>n.searching?o.searchMemberList:history.state.action===r.Transfer?o.groupMemberList.filter(e=>e.roleLevel!==h.Owner):o.groupMemberList),M=p(()=>(e,a)=>m.action===r.VoiceInvite||m.action===r.VideoInvite?a===L.selfInfo.userID:e===h.Owner?!0:e===h.Admin?!R.value:!1),O=()=>{n.keyword&&(n.searching=!0,o.searchOffset=0,o.searchMemberList=[],D(n.keyword))},B=()=>{n.keyword||(n.searching=!1)},G=()=>{o.hasMore&&(n.searching?D(n.keyword):g())},K=()=>{if(f.value&&i.value===r.Kickout){i.value=r.Preview;return}d.back()},P=async e=>{if(i.value===r.Transfer){ce({message:u("messageTip.transferOwner",{name:e.nickname}),beforeClose:t=>new Promise(l=>{if(t!=="confirm"){l(!0);return}y.transferGroupOwner({groupID:e.groupID,newOwnerUserID:e.userID}).then(()=>d.back()).catch(E=>v({error:E})).finally(()=>l(!0))})});return}if(!f.value){I.storeCurrentGroupInfo.lookMemberInfo===re.Allowed&&S.getUserCardData(e.userID,e.groupID);return}if(M.value(e.roleLevel,e.userID))return;const a=s.value.findIndex(t=>e.userID===t);if(a>-1){const t=[...s.value];t.splice(a,1),s.value=t}else s.value.push(e.userID)},$=()=>{if(i.value===r.Kickout&&y.kickGroupMember({groupID:m.groupID,reason:"",userIDList:s.value}).then(()=>{i.value=r.Preview,o.groupMemberList=[],o.offset=0,o.loading=!1,o.hasMore=!0,g(),v({message:u("messageTip.kuckSuccess")})}).catch(e=>v({error:e})),i.value===r.VoiceInvite||i.value===r.VideoInvite){const e=r.VoiceInvite===i.value?C.VoiceCall:C.VideoCall;V(e,I.currentConversation.groupID,s.value),d.back()}},U=e=>{const a=s.value.findIndex(t=>e.userID===t);if(a>-1){const t=[...s.value];t.splice(a,1),s.value=t}};return z((e,a,t)=>{history.state.action=r.Preview,t()}),(e,a)=>{const t=J;return b(),ae("div",ue,[k(Q,{router:!1,title:c(x),onLeftClick:K},null,8,["title"]),k(t,{modelValue:n.keyword,"onUpdate:modelValue":a[0]||(a[0]=l=>n.keyword=l),placeholder:e.$t("placeholder.search"),onSearch:O,onBlur:B},null,8,["modelValue","placeholder"]),k(c(W),{class:"my_scrollbar flex-1 overflow-y-auto",onTobottom:G,"data-key":"userID","data-sources":c(w),"data-component":X,"estimate-size":88,"extra-props":l=>({total:c(o).groupMemberList.length,showCheck:c(f),checked:s.value.includes(l.userID),disabled:c(M)(l.roleLevel,l.userID),onClickItem:P,showRole:!0})},null,8,["data-sources","extra-props"]),c(f)?(b(),ie(ee,{key:0,"all-checked-list":c(T),total:c(w).length,onRemove:U,onConfirm:$},null,8,["all-checked-list","total"])):ne("",!0)])}}});export{Qe as default};
