import{j as e,r as u}from"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab.js";import{a as g,aN as $,m as E,aO as A}from"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab23.js";import{u as f,h as k,d as _}from"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab20.js";import{_ as T,bn as O,bo as z,J as L,aA as M,bm as R,D as q,au as B,ai as D,bl as S,Q as I}from"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab11.js";import"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab19.js";import{a as P}from"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab110.js";import"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab8.js";import"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab7.js";import"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab4.js";import"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab3.js";import"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab2.js";import"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab10.js";import"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab6.js";import"./v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab9.js";const G=u.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_16_fa303664-d39f-4aec-85e8-7c81b2445eab167.js")),[]));function h(){return e.jsx(u.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(G,{})})}const V=({follow:i})=>{const{disableFollowUp:o}=g(),{language:d}=f(),n=i.funil.abas.length===0&&i.funil.etiquetas.length===0;return u.useEffect(()=>{n&&o(i.id)},[n,o,i.id]),n?e.jsx("span",{className:"lg:tooltip lg:tooltip-right","data-tip":d.funilFollowIsEmpty,children:e.jsx(O,{color:"red",size:24})}):null};function ne(){const{FollowUp:i,deleteFollowUp:o,switchActive:d,duplicateFollowUp:n}=g(),{setEditFollowUp:j,setResetDefaultFollowUp:v}=$(),{isBusiness:b}=k(),{open:x}=E(),{language:a}=f(),{setAcao:y}=A(),m=_(s=>s.getUrl("tutoriais","follow_up")),N=s=>{y(s.acao),j(s),x(e.jsx(h,{}))},F=s=>{const t=s.days?`${s.days} ${a.day}${s.days>1?"s":""}`:"",l=s.hours?`${s.hours} ${a.hour}${s.hours>1?"s":""}`:"",c=s.minutes?`${s.minutes} ${a.minute}${s.minutes>1?"s":""}`:"",r=[t,l,c].filter(Boolean);if(r.length===0)return a.now;if(r.length===1)return r[0];const p=r.pop();return`${r.join(", ")} ${a.and} ${p}`},w=s=>{switch(s.type){case"dispararAoEntrar":return a.onEnter;case"dispararAoSair":return a.onLeave;case"timing":return`${a.onTime}: ${F(s.timing)}`;default:return s.type}},C=s=>{const{propriedades:t}=s,l=t,c=s.type,r=[];switch(c){case"cancelAfterChat":r.push(a.cancelAfterMessage);break;case"responderGrupos":r.push(a.replyGroups);break;case"assinatura":r.push(`${a.signature}: ${l.desativarAss?a.disabled:l.persAss.nameAss}`);break;default:return null}return r},U=e.jsx("div",{className:"flex flex-col gap-2 overflow-auto max-h-full",children:[...i].reverse().map(s=>e.jsxs("div",{className:`rounded-2xl cursor-pointer border border-[var(--conversation-header-border)] 
             border-solid w-full p-4 hover:bg-[var(--background-default-active)] flex justify-between gap-1 overflow-hidden`,style:{opacity:s.active?1:.7},children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-bold truncate",children:s.nome}),e.jsx(V,{follow:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{children:`${a.actionType}:`}),e.jsx("p",{className:"font-bold",children:w(s.acionamento)})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("p",{children:`${a.funnels}:`}),e.jsx("div",{className:"flex gap-1",children:[...s.funil.abas,...s.funil.etiquetas].length===0?e.jsx("div",{className:"badge badge-md bg-gray-200 text-gray-600 font-semibold",children:a.funnelEmpty}):e.jsxs(e.Fragment,{children:[[...s.funil.abas,...s.funil.etiquetas].slice(0,6).map((t,l)=>{const r="tag"in t?t.tag:t.name,p="hexColor"in t?{backgroundColor:t.hexColor,color:z(t.hexColor,160)}:{backgroundColor:"var(--primaria)",color:"#FFF"};return e.jsx("div",{style:p,className:"badge badge-md font-semibold !truncate !max-w-[100px]",children:e.jsx("span",{className:"truncate",children:r})},l)}),[...s.funil.abas,...s.funil.etiquetas].length>6&&e.jsxs("div",{className:"badge badge-md bg-gray-200 text-gray-600 font-semibold",children:["+",[...s.funil.abas,...s.funil.etiquetas].length-6]})]})})]}),Object.values(s.regras).filter(t=>t.propriedades.active).length>0&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx("p",{children:`${a.activeRules}:`}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Object.values(s.regras).filter(t=>t.propriedades.active).map((t,l)=>e.jsx("span",{className:"badge badge-md badge-neutral font-semibold py-1 px-2 rounded",children:C(t)},l))})]}),e.jsxs("div",{className:"flex justify-start gap-2 items-center h-9 pt-2",children:[e.jsx("span",{children:a.active}),e.jsx(L,{estado:s.active,switchUpdate:()=>d(s.id),id:s.id,zoom:{zoom:"60%"}})]})]}),e.jsx("div",{className:"flex flex-col justify-between flex-shrink-0",children:e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx("span",{className:"pulse lg:tooltip lg:tooltip-bottom",onClick:()=>N(s),"data-tip":a.edit,children:e.jsx(M,{className:"w-5 h-5 text-[var(--panel-header-icon)]"})}),e.jsx("span",{className:"pulse lg:tooltip lg:tooltip-bottom",onClick:()=>o(s),"data-tip":a.delete,children:e.jsx(P,{className:"w-5 h-5 text-[var(--panel-header-icon)]"})}),e.jsx("span",{className:"pulse lg:tooltip lg:tooltip-left",onClick:()=>n(s.id),"data-tip":a.duplic,children:e.jsx(R,{className:"w-5 h-5 text-[var(--panel-header-icon)]"})})]})})]},s.id))});return e.jsxs("div",{className:"w-[800px] max-h-[99.5vh] flex flex-col gap-4",children:[e.jsx(q,{children:a.followUp}),i.length===0?e.jsxs("div",{children:[e.jsx(B,{title:a.nothingFollowUpCreatedTitle,description:b?a.nothingFollowUpCreatedDescBusiness:a.nothingFollowUpCreatedDesc,icon:e.jsx(D,{className:"w-7 h-7 text-[var(--primaria)]"})}),e.jsx("div",{className:"flex justify-center",children:m.active&&e.jsx(S,{funcao:()=>window.open(m.link,"_blank")})})]}):e.jsx("div",{className:"flex-1 overflow-y-auto",children:U}),e.jsx("div",{className:"m-auto",children:e.jsx(I,{name:a.create,funcao:()=>{v(),x(e.jsx(h,{}),!1)}})})]})}export{ne as default};
