import{j as e,A as f,m as o}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a53.js";import{a as v}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a52.js";import{m as g,q as j,r as A,aP as y}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a525.js";import{u as b}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a54.js";import{M as N,C as m}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a5202.js";import{u as w}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a556.js";import{l as u}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a57.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a55.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a56.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a58.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a5.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a59.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a510.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a520.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a543.js";const x={initial:{opacity:0,y:5,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,x:16,scale:.98},transition:{duration:.16,ease:"easeOut"}};function p(s){return`${s.user_id}#${s.whatsappID}#${s.email.toLowerCase()}`}function P(){const{chatActive_atentendes:s,atendente:n,getAtendimentoByDeviceID:r}=g(w(t=>({chatActive_atentendes:t.chatActive_atentendes,atendente:t.atendente,getAtendimentoByDeviceID:t.getAtendimentoByDeviceID}))),a=b(t=>t.language),l=j(t=>t.open),c=A(t=>t.close),d=s.filter(t=>!n||!y(n,t)),i=d.length+(n?1:0),h=v.useCallback(t=>{l(e.jsx(N,{atendente:t})),c()},[c,l]);return e.jsxs("section",{className:"flex w-80 max-w-[calc(100vw-2rem)] flex-col overflow-hidden bg-[var(--background-default)]",children:[e.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-solid border-[var(--conversation-header-border)] px-3 py-3",children:[e.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-[var(--background-default-active)] text-[var(--primaria)]",children:e.jsx(u,{className:"h-[18px] w-[18px]",strokeWidth:1.8,"aria-hidden":!0})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-[13px] font-semibold leading-tight text-base-content/95",children:a.atendentesNesseChat}),e.jsx("span",{className:"mt-0.5 block truncate text-[10px] leading-tight text-base-content/55",children:a.atendentesVisualizandoAgora})]}),e.jsx("span",{className:"flex h-6 min-w-6 shrink-0 items-center justify-center rounded-full bg-[var(--primaria)]/10 px-1.5 text-[11px] font-semibold tabular-nums text-[var(--primaria)]","aria-label":`${i} ${a.atendentesVisualizandoAgora}`,children:i})]}),e.jsx("div",{className:"min-h-0 max-h-[60vh] flex-1 overscroll-contain overflow-y-auto p-2",children:e.jsx("div",{className:"flex flex-col gap-2",children:e.jsxs(f,{initial:!1,mode:"popLayout",children:[n&&e.jsx(o.div,{layout:"position",...x,children:e.jsx(m,{atendente:n,atendimentosAtivos:r(n.user_id),atual:!0,rotuloVoce:a.voce,rotuloAtendimentos:a.atendimentosEmAndamento,rotuloSelecionar:a.selecioneAtendente,rotuloUsuarioOuEmail:a.atendenteUsuarioOuEmail})},p(n)),d.map(t=>e.jsx(o.div,{layout:"position",...x,children:e.jsx(m,{atendente:t,atendimentosAtivos:r(t.user_id),rotuloVoce:a.voce,rotuloAtendimentos:a.atendimentosEmAndamento,rotuloSelecionar:a.selecioneAtendente,rotuloUsuarioOuEmail:a.atendenteUsuarioOuEmail,onSelect:()=>h(t)})},p(t))),i===0&&e.jsxs(o.div,{className:"flex min-h-40 flex-col items-center justify-center gap-3 px-6 py-8 text-center",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[e.jsx("span",{className:"flex items-center justify-center rounded-md bg-[var(--background-default-active)] p-3 text-[var(--primaria)]",children:e.jsx(u,{className:"h-5 w-5",strokeWidth:1.8,"aria-hidden":!0})}),e.jsx("p",{className:"text-xs font-medium leading-relaxed text-base-content/65",children:a.nenhumAtendenteConectado})]},"atendentes-vazio")]})})})]})}export{P as default};
