import{u as j,k as I,r as i,j as e}from"./main-333.js";import{d as v,_ as l,I as S,F as k}from"./bi.636.93.js";import{B as _}from"./bi.429.767.js";import{S as Z}from"./bi.563.969.js";import y from"./bi.848.349.js";import{c as M}from"./bi.976.955.js";import{Z as N}from"./bi.683.956.js";import"./bi.318.783.js";function D({formFields:c,setFlow:p,flow:g,allIntegURL:u}){const f=j(),{formID:m}=I(),[o,n]=i.useState(!1),[s,d]=i.useState(1),[x,a]=i.useState({show:!1}),[t,r]=i.useState({name:"ZagoMail",type:"ZagoMail",api_public_key:"",field_map:[{formField:"",zagoMailField:""}],selectedList:"",actions:{},selectedTags:[]}),h=b=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),b===3){if(!M(t)){a({show:!0,msg:l("Please map all required fields to continue.","bit-integrations")});return}if(!(t!=null&&t.listId)){a({show:!0,msg:l("Please select list to continue.","bit-integrations")});return}t.name!==""&&t.field_map.length>0&&d(3)}};return e.jsxs("div",{children:[e.jsx(v,{snack:x,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(Z,{step:3,active:s})}),e.jsx(y,{formID:m,zagoMailConf:t,setZagoMailConf:r,step:s,setstep:d,isLoading:o,setIsLoading:n,setSnackbar:a}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(N,{formID:m,formFields:c,zagoMailConf:t,setZagoMailConf:r,isLoading:o,setIsLoading:n,setSnackbar:a}),e.jsxs("button",{onClick:()=>h(3),disabled:!(t!=null&&t.listId)||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),"  ",e.jsx(_,{className:"ml-1 rev-icn"})]})]}),e.jsx(S,{step:s,saveConfig:()=>k(g,p,u,t,f,"","",n),isLoading:o,dataConf:t,setDataConf:r,formFields:c})]})}export{D as default};
