var k=Object.defineProperty;var g=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var b=(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)&&b(o,e,s[e]);if(g)for(var e of g(s))I.call(s,e)&&b(o,e,s[e]);return o};import{k as C,g as w,j as t,_ as l}from"./main.2.8.1.js";import{u as N,h as y,d as p}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as L}from"./SnackMsg.S8DrwLlT.js";import{S as M}from"./Steps.1hz7v9Vj.js";import{I as P,s as R}from"./Integrations.D2bgBas2.js";import A from"./BitFormAuthorization.DVh6aPHK.js";import{h as E,c as T,b as q}from"./BitFormCommonFunc.L0AES6Z4.js";import{B as D}from"./BitFormIntegLayout.i2goT_T6.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./BackIcn._kGL_vVw.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.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,d]=p.useState({name:"Bit Form",type:"Bit Form",domainName:F,api_key:"",id:"",field_map:[{formField:"",BitFormMapField:""}],address_field:[],actions:{}}),_=()=>{var c;if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),(c=i.actions)!=null&&c.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:d,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:c=>E(c,i,d,f,n),bitFormConf:i,setBitFormConf:d,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:d,formFields:o})]})}export{ot as default};
