import{q as k,j as a,r as i,d as c,I as L}from"./index-76f1ce5c.js";import{T as A}from"./tabs-8bdf8fba.js";import{R as v,C as M,d as $,e as S,I as U,B as x}from"./iconBase-883829c2.js";import{D as w}from"./index-a0cf5c09.js";import{D as m}from"./logo-e4083531.js";import"./index-31a0332c.js";function F({intl:E}){const{messages:g}=E,b=({onSend:p,setOnSend:D,onReset:h,setOnReset:T,tab:o,active:f})=>{const[t,l]=i.useState([{name:"",image:m,images:null}]),[I,j]=i.useState([]);function y(){l([{name:"",image:m,images:null}]),console.log("reset",o)}function z(){console.log(t,o)}i.useEffect(()=>{h&&f&&(y(),T(!1))},[h]),i.useEffect(()=>{p&&f&&(z(),D(!1))},[p]);function P(s,e){function n(d){const r=document.getElementsByClassName(`photo-${e}-${o}`),R=o=="pt-br"||e>0?0:1,u=r[R].getElementsByClassName("dz-message");d.length>0?s.images?u[0].innerText=`A imagem "${s.images.name}" já foi carregada com sucesso!
  Clique aqui para substituí-la `:u[0].innerText=`
  Tipo de imagem aceita: JPEG ou PNG
  `:setTimeout(()=>{j(u)},100)}n(I)}i.useEffect(()=>{t.map((s,e)=>P(s,e))},[I,t,o]);const q=s=>{const e=[...t];e.splice(s,1),l(e)},B=s=>{s.preventDefault(),l([...t,{name:"",image:m,images:null}])},G=(s,e)=>{const{name:n,value:d}=s.target,r=[...t];r[e][n]=d,l(r)},C=(s,e)=>{const n=[...t];n[e].image=s,l(n)},N=(s,e)=>{const n=[...t];n[e].images=s,l(n)};return a("form",{onSubmit:B,children:a("div",{className:"contents",children:t.map((s,e)=>c("div",{className:"box",children:[c(v,{children:[a("div",{className:"col-auto miniature ml-3",children:c("div",{className:"has-float-label",children:[a("label",{children:"Imagem Parceria"}),a("img",{src:s.image,alt:"imagem de perfil"})]})}),a(M,{className:"col-dropzone",children:a($,{children:a(w,{scrollingContainer:".parent-scroll",id:`photo-${e}`,className:`photo-${e}-${o}`,name:"photo",addImage:n=>{N(n,e),C(n.dataURL,e)},removeImage:()=>{N(null,e),C(m,e)},images:s.images})})})]}),a(v,{children:a($,{className:"col-12",children:c(S,{children:[c("div",{className:"has-float-label",children:[a("label",{children:a(L,{id:"input.description"})}),a(U,{required:!0,placeholder:g["input.description"],type:"text",name:"content",id:`content-${e}`,onChange:n=>G(n,e),value:s.content})]}),t.length!==1&&a(x,{onClick:()=>q(e),color:"danger",children:"-"}),t.length-1===e&&t.length<8&&a(x,{type:"submit",color:"primary",children:"+"})]})})})]},e))})})};return a(A,{title:g["sidebar.partnerships"],Component:b})}const W=k(F);export{W as default};
