import{j as t,_ as y}from"./main.2.9.0.js";import{u as B,e as S,b as e}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{B as I}from"./BackIcn._8Wofmn2.js";import{S as v}from"./SnackMsg.DYSD96P4.js";import{I as C,g as N}from"./Integrations.DL8wqGct.js";import _ from"./BooklyAuthorization.CYg3KeGG.js";import{B as L,g as w}from"./BooklyIntegLayout.BNFQDG-Q.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.B6YI8w_n.js";function U({formFields:r,setFlow:f,flow:u,allIntegURL:x}){const b=B(),{formID:m}=S(),[l,p]=e.useState(!1),[h,j]=e.useState({}),[o,c]=e.useState(1),[k,a]=e.useState({show:!1}),[s,i]=e.useState({name:"Bookly",type:"Bookly",field_map:[{formField:"",booklyField:""}],actions:{},mainAction:""}),g=n=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),n===3){const d=w(s);if(d){a({show:!0,msg:d});return}s.name!==""&&s.field_map.length>0&&c(n)}else c(n)};return t.jsxs("div",{children:[t.jsx(v,{snack:k,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(_,{formID:m,booklyConf:s,setBooklyConf:i,step:o,nextPage:g,isLoading:l,setIsLoading:p,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:o===2&&900,height:o===2&&"auto",minHeight:o===2&&"500px"},children:[t.jsx(L,{formID:m,formFields:r,booklyConf:s,setBooklyConf:i,setSnackbar:a,dataLoading:h,setDataLoading:j}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>g(3),disabled:s.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[y("Next","bit-integrations"),t.jsx(I,{className:"ml-1 rev-icn"})]})]}),t.jsx(C,{step:o,saveConfig:()=>N(u,f,x,s,b,"","",p),isLoading:l,dataConf:s,setDataConf:i,formFields:r})]})}export{U as default};
