import{j as t}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0286.js";import{a as j}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0282.js";import{k as g,aa as N,s as r,C as b}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b02821.js";import{u as S}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0285.js";import{a as C,b as w,b9 as y,S as _,c as u,I as d}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0288.js";import{W as p}from"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0283.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0284.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b02820.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b028.js";import"./v_7_4_3_48_026858c9-0735-4edd-ae06-f5f59030b0287.js";function U(){const{language:a}=S(),{close:i}=g(),{contatos:m,setContatos:l}=N(),{setAutoSaveChatName:x,chatName:e}=r(),[n,h]=j.useState(e.name),f=async()=>{if(await b("contatos")===!0)return;const o=m.filter(c=>c.id!==e.number),s={id:e.number,name:n};o.push(s),p.Contact("save",{contactId:s.id,name:s.name,options:{syncAdressBook:!0}}),chrome.runtime.sendMessage({action:"contatoSave",dados:s}),r.setState({chatName:{...e,name:n,number:e.number}}),l(o),i(),d({type:"Success",message:a.contatosNotifiSave,position:"top-right"})},v=async()=>{const o=m.filter(c=>c.id!==e.number),s={id:e.number,name:e.number};p.Contact("remove",s.id),chrome.runtime.sendMessage({action:"contatoSave",dados:s}),r.setState({chatName:{...e,name:e.number,number:e.number}}),l(o),i(),d({type:"Success",message:a.contatosNotifiRM,position:"top-right"})};return t.jsxs("div",{className:"w-[450px] grid gap-4",children:[t.jsx("div",{className:"flex gap-4",children:t.jsx(C,{children:a.contatos_title})}),t.jsx(w,{children:a.contatos_text}),t.jsxs("div",{className:"form-control w-full",children:[t.jsx("label",{className:"label",children:t.jsx("span",{className:"label-text",children:a.contatos_textInp})}),t.jsx("input",{type:"text",value:n,onChange:o=>h(o.target.value),placeholder:a.contatos_placeInp,className:"input input-bordered w-full input-sm"})]}),t.jsxs("div",{className:"flex justify-between cursor-pointer items-center h-9 px-1 py-2 rounded",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs("span",{children:[a.contatos_autoSave," "]}),t.jsx("span",{className:"lg:tooltip lg:tooltip-top","data-tip":a.contatos_info,children:t.jsx(y,{className:"h-5 w-5"})})]}),t.jsx(_,{estado:e.autoSave,switchUpdate:()=>x(!e.autoSave),id:"autoSave"})]}),t.jsxs("div",{className:"flex justify-around",children:[t.jsx(u,{name:a.contatos_rm,funcao:v}),t.jsx(u,{name:a.contatos_save,funcao:f})]})]})}export{U as default};
