import{j as e,_ as v,D as f,v as x,U as m}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e10.js";import{a as i}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e4.js";import{u as p}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e19.js";import{o as g,w}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e22.js";import{S as N}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e126.js";import{b as _}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e59.js";import{R}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e127.js";import{a as b}from"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e75.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e18.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e8.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e5.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e7.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e6.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e2.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e3.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e9.js";import"./v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e105.js";const y=i.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_0_1_4b8cc392-a410-45f6-b662-85abdad9c03e125.js")),[]));function E({rel:s}){return e.jsx(i.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(y,{rel:s})})}const k=s=>s.filter(a=>a.status==="Sent"),D=s=>s.filter(a=>a.status==="Erro"),S=({rel:s,setShowRel:a})=>{const{language:t}=p(),l=e.jsx("div",{className:"flex justify-center overflow-auto",style:{height:"calc(100vh - 130px)"},children:e.jsx("div",{className:"overflow-x-auto pt-3 max-w-[1000px] w-full",children:e.jsxs("table",{className:"table text-center",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t.id}),e.jsx("th",{children:t.nome}),e.jsx("th",{children:t.numero}),e.jsx("th",{children:t.status})]})}),e.jsx("tbody",{children:s.send.slice().reverse().map((o,d)=>e.jsxs("tr",{children:[e.jsx("td",{children:o.id}),e.jsx("td",{children:e.jsx("span",{className:"text-min w-[95px] block m-auto",children:o.nome})}),e.jsx("td",{children:e.jsx("span",{className:"text-min w-[95px] block m-auto",children:o.phone})}),e.jsx("td",{children:e.jsx(N,{type:o.status})})]},d))})]})})});return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"p-4",style:{height:"calc(100vh - 75px)"},children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs(x,{children:[t.envio_realizado," ",m.MillisToFormattedDate(s.id)]}),e.jsx("span",{className:"pulse cursor-pointer lg:tooltip lg:tooltip-right","data-tip":t.voltar,onClick:()=>a({active:!1,rel:[]}),children:e.jsx(b,{className:"w-6 h-6 text-[var(--primaria)]",strokeWidth:1})})]}),l]})})};function K(){const{open:s}=g(),{relatorio:a}=w(),{language:t}=p(),l=i.useRef([]),[c,o]=i.useState({active:!1,rel:[]}),d=r=>{o({active:!0,rel:r})},j=(r,n)=>{const h={current:n};s(e.jsx(E,{rel:r}),{placement:"bottom"},h.current,10)},u=e.jsxs(e.Fragment,{children:[e.jsx(f,{children:t.desc_relatorio}),e.jsxs("div",{className:"p-4",style:{height:"calc(100vh - 75px)"},children:[e.jsxs(x,{children:[t.ultimos_envios_1," ",a.length," ",t.ultimos_envios_2]}),e.jsx("div",{className:"overflow-x-auto mt-4",style:{maxHeight:"calc(100vh - 135px)"},children:e.jsxs("table",{className:"table text-center",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t.data}),e.jsx("th",{children:t.cts_disparados}),e.jsx("th",{children:t.enviados}),e.jsx("th",{children:t.erro_enviar}),e.jsx("th",{children:t.acao})]})}),e.jsx("tbody",{children:a.map((r,n)=>e.jsxs("tr",{className:"hover:bg-base-300 cursor-pointer",children:[e.jsx("td",{className:"rounded-l-lg",children:m.MillisToFormattedDate(parseInt(r.id))}),e.jsx("td",{children:r.send.length}),e.jsx("td",{children:k(r.send).length}),e.jsx("td",{children:D(r.send).length}),e.jsx("td",{className:"rounded-r-lg",children:e.jsxs("div",{className:"flex gap-3 items-center justify-center",children:[e.jsx("span",{className:"pulse cursor-pointer",onClick:()=>d(r),children:e.jsx(_,{className:"h-5 w-5 text-[var(--icon)]"})}),e.jsx("span",{ref:h=>l.current[n]=h,className:"pulse cursor-pointer",onClick:()=>j(r,l.current[n]),children:e.jsx(R,{className:"h-5 w-5 text-[var(--icon)]"})})]})})]},n))})]})})]})]});return c.active?e.jsx(S,{rel:c.rel,setShowRel:o}):u}export{K as default};
