import{d as W,M as Y,L as U,h as _,g as v,o as u,c as x,a as t,q as h,t as l,u as e,e as n,J as Z,j as B,f as w,p as k,n as D,_ as ee}from"./address-utils-hEfxg3NW.js";import{b as ae,u as te,d as se,e as oe,l as C,F as m,f as N,C as le,x as F,X as z,_ as A}from"./main-sYJehYoh.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"},ge={class:"chat-info-dialog__users"},be={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:L}){const d=E,V=L,{$tr:o}=Y(ae),{contactList:g}=U(te()),{user:$}=U(se()),{updateMembers:j}=oe(),q=["support@3nweb.com"],c=_(!0),f=_(!1),b=_(""),p=_(""),S=_([]),i=_([]),I=v(()=>g.value.filter(a=>q.includes(a.mail)).map(a=>a.id)),X=v(()=>C.size(d.chat.members)>2),G=v(()=>d.chat.admins.includes($.value)),M=v(()=>g.value.filter(a=>d.chat.members.includes(a.mail))),J=v(()=>M.value.filter(a=>a.displayName.toLowerCase().includes(b.value.toLowerCase()))),O=v(()=>C.isEqual(S.value.slice().sort(),i.value.slice().sort())),y=()=>V("close"),R=()=>{c.value=!1,f.value=!0,p.value=b.value,i.value=C.cloneDeep(M.value.map(a=>a.id)),S.value=C.cloneDeep(i.value)},T=()=>{c.value||(f.value?(f.value=!1,c.value=!0,p.value=""):c.value=!0)},H=a=>{const s=i.value.indexOf(a);s===-1?i.value.push(a):i.value.splice(s,1)},K=()=>{const a=g.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(),x("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:D(["chat-info-dialog__content",{"chat-info-dialog__content--without-avatar":!c.value}])},[f.value?(u(),x("div",me,[t("div",ge,[t("div",be,[t("div",xe,[n(e(F),{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(g),"search-text":p.value,"without-anchor":!0,"selected-contacts":i.value,"non-selectable-contacts":I.value,onSelect:H},null,8,["contact-list","search-text","selected-contacts","non-selectable-contacts"])])])])):(u(),x(Z,{key:0},[c.value?(u(),x("div",ie,[n(le,{name:e(N)(d.chat),size:"64",shape:X.value?"decagon":"circle"},null,8,["name","shape"]),t("div",de,[t("span",re,l(e(N)(d.chat)),1),t("span",ue,l(d.chat.members.length)+" "+l(e(o)("chat.info.dialog.users")),1)])])):B("",!0),t("div",he,[t("div",_e,[t("div",ve,[t("div",fe,[n(e(F),{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:R},{default:k(()=>[h(l(e(o)("chat.info.dialog.update.members.btn.text")),1)]),_:1})):B("",!0)]),n(e(z),{value:b.value,"onUpdate:value":s[0]||(s[0]=r=>b.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":J.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:D({"chat-info-dialog__btn--hidden":c.value}),onClick:T},{default:k(()=>[h(l(e(o)("chat.info.dialog.btn.back.text")),1)]),_:1},8,["class"]),f.value?(u(),w(e(m),{key:1,disabled:O.value,onClick:K},{default:k(()=>[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:k(()=>[h(l(e(o)("chat.info.dialog.btn.close.text")),1)]),_:1}))])]))}}),Me=ee(ye,[["__scopeId","data-v-879c1dd0"]]);export{Me as default};
