import{u as I,k as j,r as i,j as e}from"./main-406.js";import{d as b,j as v,I as D,G as S}from"./bi.394.85.js";import{B as k}from"./bi.46.744.js";import{S as _}from"./bi.68.941.js";import N from"./bi.207.300.js";import{c as q}from"./bi.688.859.js";import{D as w}from"./bi.720.860.js";import"./bi.150.760.js";function M({formFields:c,setFlow:p,flow:d,allIntegURL:u}){const f=I(),{formID:l}=j(),[n,o]=i.useState(!1),[s,m]=i.useState(1),[g,a]=i.useState({show:!1}),[t,r]=i.useState({name:"DirectIq",type:"DirectIq",client_id:"",client_secret:"",field_map:[{formField:"",directIqField:""}],actions:{}}),x=h=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),h===3){if(!q(t)){a({show:!0,msg:"Please map all required fields to continue."});return}if(!(t!=null&&t.listId)){a({show:!0,msg:"Please select list to continue."});return}t.name!==""&&t.field_map.length>0&&m(3)}};return e.jsxs("div",{children:[e.jsx(b,{snack:g,setSnackbar:a}),e.jsx("div",{className:"txt-center mt-2",children:e.jsx(_,{step:3,active:s})}),e.jsx(N,{formID:l,directIqConf:t,setDirectIqConf:r,step:s,setstep:m,isLoading:n,setIsLoading:o,setSnackbar:a}),e.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"auto"},children:[e.jsx(w,{formID:l,formFields:c,directIqConf:t,setDirectIqConf:r,isLoading:n,setIsLoading:o,setSnackbar:a}),e.jsxs("button",{onClick:()=>x(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:[v("Next","bit-integrations")," "," ",e.jsx(k,{className:"ml-1 rev-icn"})]})]}),e.jsx(D,{step:s,saveConfig:()=>S(d,p,u,t,f,"","",o),isLoading:n,dataConf:t,setDataConf:r,formFields:c})]})}export{M as default};
