import{j as e,V as x,$ as i,a2 as g,I as n,ak as f}from"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab710.js";import{a as o}from"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab74.js";import{ar as h}from"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab723.js";import{u as j}from"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab719.js";import{P as v}from"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab7169.js";import"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab718.js";import"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab76.js";import"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab78.js";import"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab7.js";import"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab75.js";import"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab77.js";import"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab79.js";import"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab72.js";import"./v_7_4_2_13_59773d94-6a68-4ed1-8b86-dcf9791b0ab73.js";function B(){const{language:t}=j(),[r,p]=o.useState(),[c,u]=o.useState(""),[a,l]=o.useState({active:!1,type:"Error",menssage:""}),d=async()=>{let s=r;if(s=s.replaceAll(" ","").replaceAll("-","").replaceAll("(","").replaceAll(")",""),r.length<8){l({active:!0,type:"Error",menssage:"Numero invalido"}),n({type:"Error",message:t.error_link,position:"top-right"});return}if(c.length===0){l({active:!0,type:"Error",menssage:t.error_inserAMessage}),n({type:"Error",message:t.error_inserAMessage,position:"top-right"});return}if(await h("create_link")===!0)return;let m=`https://wa.me/+${s}?text=${encodeURIComponent(c)}`;f(m),l({active:!0,type:"Success",menssage:m}),n({type:"Success",message:t.link_copied,position:"top-right"})};return e.jsxs("div",{className:"flex flex-col gap-4 w-[480px] h-full",children:[e.jsx(x,{children:t.modal_generateLinks_title}),e.jsx(i,{children:t.modal_generateLinks_subTitle}),e.jsxs("div",{className:"w-full flex flex-col gap-5 items-center justify-center pt-4",children:[e.jsxs("div",{className:"flex flex-col w-full gap-3",children:[e.jsx(i,{weight:"bold",children:t.modal_numberWhatsapp}),e.jsx(v,{value:r,setValue:p,inputClass:"input input-bordered input-sm join-item w-full notFocus boxInput removeArrow",containerClass:"modalChat",required:!0})]}),e.jsxs("div",{className:"flex flex-col w-full gap-3",children:[e.jsx(i,{weight:"bold",children:t.modal_generateLinks_Message}),e.jsx("div",{className:"join w-full",children:e.jsx("input",{className:"input input-bordered input-sm join-item min-w-[320px] w-full notFocus boxInput",placeholder:t.modal_generateLinks_writeMessage,onChange:s=>{u(s.target.value)}})})]}),e.jsxs("div",{className:"w-full flex  flex-col justify-center items-center gap-5",children:[a.active?e.jsxs("div",{className:(a.type==="Error"?"alert-error":"alert-success")+" alert  h-10 flex justify-center items-center",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg ",className:"stroke-current shrink-0 h-6 w-6 text-[var(--letra)]",fill:"none",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})}),e.jsx("span",{className:"text-[var(--letra)]",children:a.menssage})]}):void 0,e.jsx("div",{className:"pt-2",children:e.jsx(g,{name:t.modal_generateLinks_confimationButton,funcao:d})})]})]})]})}export{B as default};
