import{j as e}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a53.js";import{a as t}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a52.js";import{u}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a556.js";import{P as T,u as E}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a54.js";import{al as M,a as v,q as w,r as P,w as k,C as S}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a525.js";import{u as F,z as b}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a55.js";import{_ as r,a8 as R,T as O,aF as U,aq as D,aG as N,ar as V,v as q,I as j}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a58.js";import{L as B}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a57.js";import{k as W}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a571.js";import{h as G}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a544.js";const H=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a5155.js")),[]));function J(){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(H,{})})}const K=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a5156.js")),[]));function Q(){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(K,{})})}const X=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a5157.js")),[]));function Y({setUserLabels:s,userLabels:i}){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(X,{setUserLabels:s,userLabels:i})})}const Z=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a5158.js")).then(s=>s.i),[]));function $(){return e.jsx(t.Suspense,{fallback:e.jsx("div",{className:"flex h-40 w-[22rem] max-w-[calc(100vw-2rem)] items-center justify-center",role:"status",children:e.jsx(B,{className:"h-5 w-5 animate-spin text-[var(--primaria)]",strokeWidth:2,"aria-hidden":!0})}),children:e.jsx(Z,{})})}const ee=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a5159.js")),[])),ae=({userId:s,chatID:i})=>e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(ee,{userId:s,chatID:i??T(s)})}),se=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a5160.js")),[]));function te({userId:s}){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(se,{userId:s})})}function fe(){const{language:s}=E(u(a=>({language:a.language}))),{pinChat:i,isPin:p}=M(u(a=>({pin:a.pin,pinChat:a.pinChat,isPin:a.isPin}))),{getUserAbasTam:L}=v(u(a=>({userTabs:a.userTabs,getUserAbasTam:a.getUserAbasTam}))),m=F(a=>a.isBusiness),z=w(a=>a.open),o=P(a=>a.open),{userId:d,userSerialized:x,IdlabelsUser:f}=k(u(a=>({userId:a.activeChat?.id?.user??"",userSerialized:a.activeChat?.id?._serialized,IdlabelsUser:a.activeChat?.labels}))),y=async()=>{await S("clear_message")!==!0&&(await b.Msg("showClearMsg")?j({type:"Success",message:s.asMensagensApagasForamRecuperadas,position:"top-right"}):j({type:"Error",message:s.nenhumaMensagemApagadaFoiRecuperada,position:"top-right"}))},[l,g]=t.useState(null);return t.useEffect(()=>{m&&(async()=>{try{const n=await b.Labels("getAllLabels"),A=(f??[]).reduce((_,C)=>{const I=C,c=n.find(h=>h.hexColor&&String(h.id)===String(I));return c&&_.push({id:c.id,name:c.name,color:c.hexColor,hexColor:c.hexColor}),_},[]);g(A)}catch(n){console.error(s.erroAoBuscarLabels,n)}})()},[x,m,f]),[{id:"init_fluxo",name:s.iniciarUmFluxoParaEsteContato,icon:e.jsx(R,{size:20}),function:a=>o(e.jsx(te,{userId:d}),{placement:"bottom"},a.target,15)},{id:"fixar_chat",name:p()?s.desafixarChat:s.fixarChat,icon:e.jsx(O,{className:p()?"text-green-800":"",size:20}),function:()=>i()},{id:"show_clean_messages",name:s.exibirMensagensApagadasRecente,icon:e.jsx(G,{size:20,strokeWidth:"1.8"}),function:()=>y()},{id:"traducao_com_IA",name:s.traducaoComIA,icon:e.jsx(U,{size:20}),function:()=>z(e.jsx(J,{}))},{id:"user_tabs",name:s.userTabs,icon:e.jsx(D,{size:20}),tam:L(d),function:a=>o(e.jsx(Q,{}),{placement:"bottom"},a.target,15)},{id:"labels",name:s.tags,icon:l&&l.length>0?e.jsx("div",{className:"flex",children:l.map((a,n)=>e.jsx("span",{style:n!==0?{marginLeft:"-1rem"}:{},children:e.jsx(N,{size:24,style:{color:a.color}})},n))}):e.jsx(V,{size:20}),function:a=>o(e.jsx(Y,{setUserLabels:g,userLabels:l}),{placement:"bottom"},a.target.parentNode.parentNode,15),disabled:!m},{id:"transferir_atendimento",name:s.transferirAtendimento,icon:e.jsx(q,{size:20}),function:a=>o(e.jsx($,{}),{placement:"bottom"},a.target,15)},{id:"close_atendimento",name:s.fimAtendimento_encerrar,icon:e.jsx(W,{size:20}),function:a=>o(e.jsx(ae,{userId:d,chatID:x}),{placement:"bottom"},a.target,15)}]}export{fe as R};
