import{u as v,k as b,r as a,j as e}from"./main-333.js";import{_ as D,I as S,F as _,c as d}from"./bi.636.93.js";import{B as F}from"./bi.429.767.js";import{S as N}from"./bi.563.969.js";import k from"./bi.577.327.js";import{s as y,c as m}from"./bi.597.912.js";import{D as T}from"./bi.519.913.js";import"./bi.318.783.js";import"./bi.535.730.js";import"./bi.286.731.js";function M({formFields:o,setFlow:p,flow:u,allIntegURL:f}){const g=v(),{formID:n}=b(),[x,h]=a.useState(!1),[s,r]=a.useState(1),[c,l]=a.useState({auth:!1,customFields:!1,accounts:!1,tags:!1}),[t,i]=a.useState({name:"Drip",type:"Drip",api_token:"",accounts:[],field_map:[{formField:"",dripField:""}],actions:{},tags:[],selectedAccountId:"",dripFormFields:y,selectedTags:"",selectedStatus:"",selectedRemoveTags:""}),j=I=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),I===3){if(!m(t)){d.error("Please map all required fields to continue.");return}if(!(t!=null&&t.selectedAccountId)){d.error("Please select account to continue.");return}t.name!==""&&t.field_map.length>0&&r(3)}};return e.jsxs("div",{children:[e.jsx("div",{className:"txt-center mt-2",children:e.jsx(N,{step:3,active:s})}),e.jsx(k,{formID:n,dripConf:t,setDripConf:i,step:s,setstep:r,loading:c,setLoading:l}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(T,{formID:n,formFields:o,dripConf:t,setDripConf:i,loading:c,setLoading:l}),e.jsxs("button",{onClick:()=>j(3),disabled:!(t!=null&&t.selectedAccountId)||!m(t)||t.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[D("Next","bit-integrations"),"  ",e.jsx(F,{className:"ml-1 rev-icn"})]})]}),e.jsx(S,{step:s,saveConfig:()=>_(u,p,f,t,g,"","",h),isLoading:x,dataConf:t,setDataConf:i,formFields:o})]})}export{M as default};
