import{j as t}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a53.js";import{a as b}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a52.js";import{q as g,ao as N,z as i,C as S}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a525.js";import{u as C}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a54.js";import{u as w}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a522.js";import{D as y,E as _,bj as M,b1 as I,H as p,I as u}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a58.js";import{z as d}from"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a55.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a56.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a59.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a510.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a57.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a5.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a520.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a541.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a555.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a556.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a543.js";import"./v_7_4_3_73_d3c9bac7-c74e-47f6-ac42-499f067843a557.js";function Q(){const{language:a}=C(),{close:c}=g(),{contatos:m,setContatos:l}=N(),{setAutoSaveChatName:h,chatName:e}=i(),x=w(s=>s.openWithGetEvents),[n,f]=b.useState(e.name),v=async()=>{if(await S("contatos")===!0)return;const s=m.filter(r=>r.id!==e.number),o={id:e.number,name:n};s.push(o),d.Contact("save",{contactId:o.id,name:o.name,options:{syncAdressBook:!0}}),chrome.runtime.sendMessage({action:"contatoSave",dados:o}),i.setState({chatName:{...e,name:n,number:e.number}}),l(s),c(),u({type:"Success",message:a.contatosNotifiSave,position:"top-right"})},j=async()=>{const s=m.filter(r=>r.id!==e.number),o={id:e.number,name:e.number};d.Contact("remove",o.id),chrome.runtime.sendMessage({action:"contatoSave",dados:o}),i.setState({chatName:{...e,name:e.number,number:e.number}}),l(s),c(),u({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(y,{children:a.contatos_title})}),t.jsx(_,{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:s=>f(s.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",{...x(a.contatos_info,{placement:"top"}),children:t.jsx(M,{className:"h-5 w-5"})})]}),t.jsx(I,{estado:e.autoSave,switchUpdate:()=>h(!e.autoSave),id:"autoSave"})]}),t.jsxs("div",{className:"flex justify-around",children:[t.jsx(p,{name:a.contatos_rm,funcao:j}),t.jsx(p,{name:a.contatos_save,funcao:v})]})]})}export{Q as default};
