var k=Object.defineProperty;var b=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var g=(o,s,e)=>s in o?k(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e,x=(o,s)=>{for(var e in s||(s={}))B.call(s,e)&&g(o,e,s[e]);if(b)for(var e of b(s))I.call(s,e)&&g(o,e,s[e]);return o};import{k as C,f as w,j as t,_ as l}from"./main.2.8.10.js";import{u as N,e as y,b as p}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as L}from"./SnackMsg.7BjcJK1j.js";import{S as M}from"./Steps.B84Ui3GU.js";import{I as P,s as R}from"./Integrations.BFhED4ck.js";import A from"./BitFormAuthorization.Mw86i975.js";import{h as E,c as T,b as q}from"./BitFormCommonFunc.Dqw7_w5K.js";import{B as D}from"./BitFormIntegLayout.DkMel2ty.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./BackIcn.BFDZx8No.js";import"./TutorialLink.D6K_DiHL.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function ot({formFields:o,setFlow:s,flow:e,allIntegURL:h}){const j=N(),{formID:f}=y(),v=C(w),{siteURL:F}=v,[r,n]=p.useState(!1),[m,u]=p.useState(1),[S,a]=p.useState({show:!1}),[i,c]=p.useState({name:"Bit Form",type:"Bit Form",domainName:F,api_key:"",id:"",field_map:[{formField:"",BitFormMapField:""}],address_field:[],actions:{}}),_=()=>{var d;if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),(d=i.actions)!=null&&d.address&&!T(i)){a({show:!0,msg:l("Please map address required fields to continue.","bit-integrations")});return}if(!q(i)){a({show:!0,msg:l("Please map fields to continue.","bit-integrations")});return}i.listId!==""&&u(3)};return t.jsxs("div",{children:[t.jsx(L,{snack:S,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(M,{step:3,active:m})}),t.jsx(A,{formID:f,bitFormConf:i,setBitFormConf:c,step:m,setstep:u,isLoading:r,setIsLoading:n,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:x({},m===2&&{width:900,height:"auto",overflow:"visible"}),children:[t.jsx(D,{formFields:o,handleInput:d=>E(d,i,c,f,n),bitFormConf:i,setBitFormConf:c,isLoading:r,setIsLoading:n,setSnackbar:a}),!i.id&&t.jsxs(t.Fragment,{children:[t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{})]}),t.jsxs("button",{onClick:()=>_(),disabled:i.field_map.length<2||r,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),"  ",t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx(P,{step:m,saveConfig:()=>R({flow:e,setFlow:s,allIntegURL:h,navigate:j,conf:i,setIsLoading:n,setSnackbar:a}),isLoading:r,dataConf:i,setDataConf:c,formFields:o})]})}export{ot as default};
