import{j as e,_ as r,ac as E,T as C,aK as M,as as I,aL as P,at as v,D as w,I as L}from"./v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f10.js";import{a as t}from"./v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f4.js";import{u as p}from"./v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f61.js";import{u as F,b as k}from"./v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f19.js";import{az as R,b as S,z,p as O,q as U,aA as D,av as V}from"./v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f23.js";import{W as f}from"./v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f18.js";import{b as B}from"./v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f58.js";const W=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f136.js")),[]));function q(){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(W,{})})}const N=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f137.js")),[]));function H(){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(N,{})})}const K=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f138.js")),[]));function G({setUserLabels:s,userLabels:u}){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(K,{setUserLabels:s,userLabels:u})})}const J=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f139.js")),[]));function Q(){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(J,{})})}const X=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f140.js")),[]));function Y({userId:s}){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(X,{userId:s})})}const Z=t.lazy(() => __vitePreload(()=>import(chrome.runtime.getURL("content/assets/js/v_7_4_2_18_ea7d0884-20ea-4e04-b6f3-cef449ac182f141.js")),[]));function $({userId:s}){return e.jsx(t.Suspense,{fallback:e.jsx(e.Fragment,{}),children:e.jsx(Z,{userId:s})})}function ce(){const{language:s}=F(p(a=>({language:a.language}))),{pinChat:u,isPin:g}=R(p(a=>({pinChat:a.pinChat,isPin:a.isPin}))),{getUserAbasTam:h}=S(p(a=>({userTabs:a.userTabs,getUserAbasTam:a.getUserAbasTam}))),x=k(a=>a.isBusiness),m=z(a=>{var n,o;return(o=(n=a.activeChat)==null?void 0:n.id)==null?void 0:o.user}),_=z(a=>{var n,o;return(o=(n=a.activeChat)==null?void 0:n.id)==null?void 0:o._serialized}),A=O(a=>a.open),i=U(a=>a.open),y=async()=>{await V("clear_message")!==!0&&(await f.Msg("showClearMsg")?L({type:"Success",message:s.asMensagensApagasForamRecuperadas,position:"top-right"}):L({type:"Error",message:s.nenhumaMensagemApagadaFoiRecuperada,position:"top-right"}))},[c,b]=t.useState(null);return t.useEffect(()=>{x&&(async()=>{try{const n=await f.Labels("getAllLabels"),o=await f.Utils("getContato",_);if(o==="undefined")return;const T=o.labels.map(d=>n.find(l=>l.hexColor&&l.id===d)).filter(Boolean).map(({id:d,name:l,hexColor:j})=>({id:d,name:l,color:j,hexColor:j}));b(T)}catch(n){console.error(s.erroAoBuscarLabels,n)}})()},[_]),[{id:"init_fluxo",name:s.iniciarUmFluxoParaEsteContato,icon:e.jsx(E,{size:20}),function:a=>i(e.jsx($,{userId:m}),{placement:"bottom"},a.target,15)},{id:"fixar_chat",name:g()?s.desafixarChat:s.fixarChat,icon:e.jsx(C,{className:g()?"!text-[var(--wds-teal-500)]":"",size:20}),function:()=>u()},{id:"show_clean_messages",name:s.exibirMensagensApagadasRecente,icon:e.jsx(D,{size:20,strokeWidth:"1.8"}),function:()=>y()},{id:"traducao_com_IA",name:s.traducaoComIA,icon:e.jsx(M,{size:20}),function:()=>A(e.jsx(q,{}))},{id:"user_tabs",name:s.userTabs,icon:e.jsx(I,{size:20}),tam:h(m),function:a=>i(e.jsx(H,{}),{placement:"bottom"},a.target,15)},{id:"labels",name:s.tags,icon:c&&c.length>0?e.jsx("div",{className:"flex",children:c.map((a,n)=>e.jsx("span",{style:n!==0?{marginLeft:"-1rem"}:null,children:e.jsx(P,{size:24,style:{color:a.color}})},n))}):e.jsx(v,{size:20}),function:a=>i(e.jsx(G,{setUserLabels:b,userLabels:c}),{placement:"bottom"},a.target.parentNode.parentNode,15),disabled:!x},{id:"transferir_atendimento",name:s.transferirAtendimento,icon:e.jsx(w,{size:20}),function:a=>i(e.jsx(Q,{}),{placement:"bottom"},a.target,15)},{id:"close_atendimento",name:s.fimAtendimento_encerrar,icon:e.jsx(B,{size:20}),function:a=>i(e.jsx(Y,{userId:m}),{placement:"bottom"},a.target,15)}]}export{ce as R};
