import{r as u,j as e,d as l,p,H as g,I as f}from"./index-76f1ce5c.js";import{B as k,k as w,P as y,l as B,N as P,m as C,n as x}from"./iconBase-883829c2.js";const N=({id:c,className:o,color:r,children:i,onClick:d})=>{const[a,n]=u.useState("default"),[s,t]=u.useState(""),[S,h]=u.useState(!1),b=()=>{n("processing"),d().then(m=>{t(m),n("success")}).catch(m=>{t(m),n("fail")}).finally(()=>{h(!0),setTimeout(()=>{n("default"),h(!1)},3e3)})};return e("span",{children:l(k,{id:c,className:`btn-multiple-state  ${o}  ${w({"show-spinner":a==="processing","show-success":a==="success","show-fail":a==="fail"})}`,color:r,onClick:b,disabled:a!=="default",children:[e(y,{placement:"top",isOpen:S,target:c,children:e(B,{children:s})}),l("span",{className:"spinner d-inline-block",children:[e("span",{className:"bounce1"}),e("span",{className:"bounce2"}),e("span",{className:"bounce3"})]}),e("span",{className:"icon success",children:e("i",{className:"simple-icon-check"})}),e("span",{className:"icon fail",children:e("i",{className:"simple-icon-exclamation"})}),e("span",{className:"label",children:i})]})})};function v({title:c,onReset:o,onSave:r,activeTab:i,setActiveTab:d}){const a=()=>new Promise(s=>{setTimeout(()=>{s("Redefinido com sucesso!"),o()},1e3)}),n=()=>new Promise((s,t)=>{setTimeout(()=>{s("Salvo com sucesso!"),r()},1e3)});return l("div",{className:"header-admin",children:[i&&e(P,{tabs:!0,children:g.map((s,t)=>e(C,{children:e(x,{active:i==s.id,onClick:()=>d(s.id),children:s.name})},t))}),e("div",{className:"title",children:c}),e("div",{children:l("div",{children:[e(N,{id:"failButton",color:"secondary",onClick:a,children:e(f,{id:"button.reset"})})," ",e(N,{id:"successButton",color:"primary",onClick:n,children:e(f,{id:"button.save"})})]})})]})}v.propTypes={title:p.string,onReset:p.func,onSave:p.func};v.defaultProps={title:"",onReset:()=>{},onSave:()=>{}};export{v as H};
