import{j as e,bX as v,au as w,a1 as N,X as b,h as y,I as C}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b710.js";import{a as A}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b74.js";import{u as L}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b719.js";import{u as _}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b729.js";import{u as k}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7123.js";import{V as T}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7227.js";import{A as E,L as M}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b75.js";import{b as S}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7152.js";import{a as H}from"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7106.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b718.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b76.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b78.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b7.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b77.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b723.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b79.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b72.js";import"./v_7_4_2_16_364f475f-21c1-4d89-bf17-70efc8c405b73.js";function $(){var c,d;const{setViewContatos:n}=k(),{agrupamentos:t,setAgrupamentos:m}=_(),{language:a}=L(),[l,x]=A.useState(0),h=s=>{y({content:e.jsxs(e.Fragment,{children:[" ",a.deseja_deletar," "," ",e.jsx("strong",{style:{color:s.color},children:s.name}),"? "]}),confirmText:a.confirm,submit:()=>{C({type:"Success",message:a.agrupamento_deletado,position:"top-right"});const r=t.filter(i=>i.id!==s.id);m([...r])}})},u=s=>{n({isOpen:!1,type:"edit",content:s})},g=e.jsx("div",{className:"flex flex-col w-[235px] overflow-y-auto overflow-x-hidden ",style:{maxHeight:"calc(100vh - 240px)"},children:t.map((s,r)=>e.jsxs("div",{className:"flex gap-1 items-center border-b border-base-300 cursor-pointer hover:bg-base-300 p-1 px-2 rounded "+(l===r?"!bg-base-300":void 0),onClick:()=>x(r),children:[e.jsx("span",{children:e.jsx(v,{className:"w-5h-5",style:{color:s.color}})}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap w-[150px]",children:s.name}),e.jsxs("span",{className:"flex w-[25px] justify-between",children:[e.jsx("span",{className:"pulse cursor-pointer",onClick:()=>u(s),children:e.jsx(w,{className:"w-5 h-5 text-[var(--panel-header-icon)]"})}),e.jsx("span",{className:"pulse cursor-pointer",onClick:i=>{i.stopPropagation(),h(s)},children:e.jsx(H,{className:"w-5 h-5 text-[var(--panel-header-icon)]"})})]})]},r))}),f=({index:s,key:r,style:i})=>{var p;const o=(p=t[l])==null?void 0:p.chats[s];if(o)return e.jsx("li",{style:i,children:e.jsxs("div",{className:"flex gap-1 items-center px-2",children:[e.jsx(T,{id:o.id}),e.jsx("span",{className:"font-bold text-base overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:o.name}),e.jsx("span",{children:o.id.includes("@")?o.id.split("@")[0]:o.id})]})},o.id)},j=e.jsx("div",{className:"w-full pt-2",children:e.jsx("ul",{className:"gap-2 overflow-y-auto overflow-x-hidden justify-center",style:{maxHeight:"calc(100vh - 240px)",height:"calc(100vh - 240px)",width:"350px"},children:e.jsx(E,{children:({width:s,height:r})=>{var i;return e.jsx(M,{width:s,height:r,rowCount:t[l]?(i=t[l])==null?void 0:i.chats.length:0,rowHeight:25,rowRenderer:f})}})})});return e.jsxs("div",{style:{height:"calc(100vh - 110px)"},children:[e.jsx(N,{children:a.organiza_cts}),e.jsxs("div",{className:"flex gap-2 items-center p-2",children:[e.jsx(b,{children:a.agrupamentos_salvos}),e.jsx("span",{className:"pulse cursor-pointer lg:tooltip lg:tooltip-right","data-tip":a.voltar,onClick:()=>n({isOpen:!1,type:"create",content:[]}),children:e.jsx(S,{className:"w-6 h-6 text-[var(--primaria)]",strokeWidth:1})})]}),e.jsxs("div",{className:"flex pt-4 gap-12",children:[e.jsxs("div",{className:"flex flex-col gap-4 justify-start",children:[e.jsxs("div",{className:"indicator",children:[t.length!==0&&e.jsxs("span",{className:"indicator-item badge bg-[var(--primaria)] text-[var(--letra)] font-medium",children:["+",t.length]}),e.jsx("span",{className:"p-2 text-xl",children:a.agrupamentos_criados})]}),t.length!==0?g:e.jsx("div",{className:"p-4 border-dotted border rounded-lg text-center mt-2 border-[var(--terciaria)]",children:a.nenhum_agrupamento})]}),e.jsx("div",{className:"flex flex-col gap-4 justify-start",children:t.length!==0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"indicator",children:[((c=t[l])==null?void 0:c.chats.length)!==0&&e.jsxs("span",{className:"indicator-item badge bg-[var(--primaria)] text-[var(--letra)] font-medium",children:["+",(d=t[l])==null?void 0:d.chats.length]}),e.jsx("span",{className:"p-2 text-xl",children:a.cts_selecionados})]}),j]}):null})]})]})}export{$ as default};
