import{j as e,_ as A,bi as _,bj as k,a2 as T,au as L,bh as O,X as z,an as M,af as R,bg as q,a4 as B}from"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f10.js";import{c as j,a_ as D,p as I,a$ as S,s as P}from"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f23.js";import{u as b,b as G}from"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f19.js";import"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f18.js";import{a as u}from"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f4.js";import{a as V}from"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f106.js";import"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f8.js";import"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f.js";import"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f5.js";import"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f7.js";import"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f6.js";import"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f9.js";import"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f2.js";import"./v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f3.js";const W=u.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_15_728248e3-b235-44ed-9cd5-d3199fba8c4f166.js")),[]));function f(){return e.jsx(u.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(W,{})})}const X=({follow:i})=>{const{disableFollowUp:o}=j(),{language:d}=b(),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(_,{color:"red",size:24})}):null};function ce(){var h,g;const{FollowUp:i,deleteFollowUp:o,switchActive:d,duplicateFollowUp:n}=j(),{setEditFollowUp:v,setResetDefaultFollowUp:y}=D(),{isBusiness:N}=G(),{open:x}=I(),{language:a}=b(),{setAcao:F}=S(),m=P(s=>s.label),w=s=>{F(s.acao),v(s),x(e.jsx(f,{}))},C=s=>{const t=s.days?`${s.days} ${a.day}${s.days>1?"s":""}`:"",r=s.hours?`${s.hours} ${a.hour}${s.hours>1?"s":""}`:"",c=s.minutes?`${s.minutes} ${a.minute}${s.minutes>1?"s":""}`:"",l=[t,r,c].filter(Boolean);if(l.length===0)return a.now;if(l.length===1)return l[0];const p=l.pop();return`${l.join(", ")} ${a.and} ${p}`},U=s=>{switch(s.type){case"dispararAoEntrar":return a.onEnter;case"dispararAoSair":return a.onLeave;case"timing":return`${a.onTime}: ${C(s.timing)}`;default:return s.type}},$=s=>{const{propriedades:t}=s,r=t,c=s.type,l=[];switch(c){case"cancelAfterChat":l.push(a.cancelAfterMessage);break;case"responderGrupos":l.push(a.replyGroups);break;case"assinatura":l.push(`${a.signature}: ${r.desativarAss?a.disabled:r.persAss.nameAss}`);break;default:return null}return l},E=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(X,{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:U(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,r)=>{const l="tag"in t?t.tag:t.name,p="hexColor"in t?{backgroundColor:t.hexColor,color:k(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:l})},r)}),[...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,r)=>e.jsx("span",{className:"badge badge-md badge-neutral font-semibold py-1 px-2 rounded",children:$(t)},r))})]}),e.jsxs("div",{className:"flex justify-start gap-2 items-center h-9 pt-2",children:[e.jsx("span",{children:a.active}),e.jsx(T,{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:()=>w(s),"data-tip":a.edit,children:e.jsx(L,{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(V,{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(O,{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(z,{children:a.followUp}),i.length===0?e.jsxs("div",{children:[e.jsx(M,{title:a.nothingFollowUpCreatedTitle,description:N?a.nothingFollowUpCreatedDescBusiness:a.nothingFollowUpCreatedDesc,icon:e.jsx(R,{className:"w-7 h-7 text-[var(--primaria)]"})}),e.jsx("div",{className:"flex justify-center",children:((g=(h=m.videos_tutoriais)==null?void 0:h.follow_up)==null?void 0:g.length)>0&&e.jsx(q,{funcao:()=>window.open(m.videos_tutoriais.follow_up,"_blank")})})]}):e.jsx("div",{className:"flex-1 overflow-y-auto",children:E}),e.jsx("div",{className:"m-auto",children:e.jsx(B,{name:a.create,funcao:()=>{y(),x(e.jsx(f,{}),!1)}})})]})}export{ce as default};
