import{d as W,i as Y,j as Z,k as U,u as ee,l as ae,m as te,r as _,b as v,n as x,o as u,e as k,p as t,f as h,t as l,q as e,s as n,F as m,v as se,w as B,C as oe,h as D,x as N,y as w,z as C,X as z,A,B as F,_ as le}from"./index-4rWIvqsO.js";const ce={class:"chat-info-dialog"},ne={class:"chat-info-dialog__title"},ie={key:0,class:"chat-info-dialog__info"},de={class:"chat-info-dialog__info-content"},re={class:"chat-info-dialog__name"},ue={class:"chat-info-dialog__text"},he={class:"chat-info-dialog__body"},_e={class:"chat-info-dialog__users"},ve={class:"chat-info-dialog__users-toolbar"},fe={class:"chat-info-dialog__users-title"},pe={class:"chat-info-dialog__users-list"},me={key:1,class:"chat-info-dialog__body"},be={class:"chat-info-dialog__users"},ge={class:"chat-info-dialog__users-toolbar"},xe={class:"chat-info-dialog__users-title"},ke={class:"chat-info-dialog__users-list"},Ce={class:"chat-info-dialog__actions"},ye=W({__name:"chat-info-dialog",props:{chat:{}},emits:["close"],setup(E,{emit:V}){const d=E,$=V,{$tr:o}=Y(Z),{contactList:b}=U(ee()),{user:L}=U(ae()),{updateMembers:j}=te(),q=["support@3nweb.com"],c=_(!0),f=_(!1),g=_(""),p=_(""),S=_([]),i=_([]),I=v(()=>b.value.filter(a=>q.includes(a.mail)).map(a=>a.id)),X=v(()=>x.size(d.chat.members)>2),G=v(()=>d.chat.admins.includes(L.value)),M=v(()=>b.value.filter(a=>d.chat.members.includes(a.mail))),O=v(()=>M.value.filter(a=>a.displayName.toLowerCase().includes(g.value.toLowerCase()))),R=v(()=>x.isEqual(S.value.slice().sort(),i.value.slice().sort())),y=()=>$("close"),T=()=>{c.value=!1,f.value=!0,p.value=g.value,i.value=x.cloneDeep(M.value.map(a=>a.id)),S.value=x.cloneDeep(i.value)},H=()=>{c.value||(f.value?(f.value=!1,c.value=!0,p.value=""):c.value=!0)},J=a=>{const s=i.value.indexOf(a);s===-1?i.value.push(a):i.value.splice(s,1)},K=()=>{const a=b.value.reduce((s,r)=>{const{id:P,mail:Q}=r;return i.value.includes(P)&&s.push(Q),s},[]);j(d.chat,a),y()};return(a,s)=>(u(),k("div",ce,[t("div",ne,[h(l(e(o)("chat.info.dialog.title"))+" ",1),n(e(m),{round:"",color:"transparent",icon:"close","icon-size":"16","icon-color":"#828282",onClick:y})]),t("div",{class:F(["chat-info-dialog__content",{"chat-info-dialog__content--without-avatar":!c.value}])},[f.value?(u(),k("div",me,[t("div",be,[t("div",ge,[t("div",xe,[n(e(N),{icon:"person",width:"20",height:"20",color:"var(--black-90)"}),h(" "+l(e(o)("chat.info.dialog.update.members.btn.text")),1)])]),n(e(z),{value:p.value,"onUpdate:value":s[2]||(s[2]=r=>p.value=r),icon:"round-search",clearable:"",placeholder:e(o)("chat.info.dialog.search.input.placeholder"),onFocus:s[3]||(s[3]=r=>c.value=!1)},null,8,["value","placeholder"]),t("div",ke,[n(A,{"contact-list":e(b),"search-text":p.value,"without-anchor":!0,"selected-contacts":i.value,"non-selectable-contacts":I.value,onSelect:J},null,8,["contact-list","search-text","selected-contacts","non-selectable-contacts"])])])])):(u(),k(se,{key:0},[c.value?(u(),k("div",ie,[n(oe,{name:e(B)(d.chat),size:"64",shape:X.value?"decagon":"circle"},null,8,["name","shape"]),t("div",de,[t("span",re,l(e(B)(d.chat)),1),t("span",ue,l(d.chat.members.length)+" "+l(e(o)("chat.info.dialog.users")),1)])])):D("",!0),t("div",he,[t("div",_e,[t("div",ve,[t("div",fe,[n(e(N),{icon:"account-circle",width:"20",height:"20",color:"var(--black-90)"}),h(" "+l(e(o)("chat.info.dialog.users")),1)]),G.value?(u(),w(e(m),{key:0,color:"transparent","text-color":"var(--blue-main, #0090ec)",onClick:T},{default:C(()=>[h(l(e(o)("chat.info.dialog.update.members.btn.text")),1)]),_:1})):D("",!0)]),n(e(z),{value:g.value,"onUpdate:value":s[0]||(s[0]=r=>g.value=r),icon:"search",clearable:"",placeholder:e(o)("chat.info.dialog.search.input.placeholder"),onFocus:s[1]||(s[1]=r=>c.value=!1)},null,8,["value","placeholder"]),t("div",pe,[n(A,{"contact-list":O.value,"without-anchor":!0,readonly:!0},null,8,["contact-list"])])])])],64))],2),t("div",Ce,[n(e(m),{color:"transparent","text-color":"var(--blue-main, #0090ec)",class:F({"chat-info-dialog__btn--hidden":c.value}),onClick:H},{default:C(()=>[h(l(e(o)("chat.info.dialog.btn.back.text")),1)]),_:1},8,["class"]),f.value?(u(),w(e(m),{key:1,disabled:R.value,onClick:K},{default:C(()=>[h(l(e(o)("chat.info.dialog.btn.update.text")),1)]),_:1},8,["disabled"])):(u(),w(e(m),{key:0,color:"transparent","text-color":"var(--blue-main, #0090ec)",onClick:y},{default:C(()=>[h(l(e(o)("chat.info.dialog.btn.close.text")),1)]),_:1}))])]))}}),Se=le(ye,[["__scopeId","data-v-06f554e9"]]);export{Se as default};
