var y=Object.defineProperty;var T=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var E=(s,e,t)=>e in s?y(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,C=(s,e)=>{for(var t in e||(e={}))I.call(e,t)&&E(s,t,e[t]);if(T)for(var t of T(e))w.call(e,t)&&E(s,t,e[t]);return s};import{j as n,_ as l,z as r}from"./main.2.8.10.js";import{u as L,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as A}from"./SnackMsg.7BjcJK1j.js";import{S as P}from"./Steps.B84Ui3GU.js";import{I as z,g as D}from"./Integrations.BFhED4ck.js";import{c as S,T as M}from"./theEventsCalendarCommonFunctions.dSRBTcV7.js";import{T as B}from"./TheEventsCalendarIntegLayout.BS8ZOuNv.js";import F from"./TheEventsCalendarAuthorization.CdsZZM05.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./TutorialLink.D6K_DiHL.js";function se({formFields:s,setFlow:e,flow:t,allIntegURL:p}){const f=L(),[j,g]=i.useState(!1),[u,v]=i.useState({auth:!1,events:!1}),[o,h]=i.useState(1),[k,d]=i.useState({show:!1}),[a,m]=i.useState({name:"The Events Calendar",type:"The Events Calendar",field_map:[],staticFields:[],selectedTask:"",events:[],selectedEvent:"",actions:{}}),_=()=>{g(!0),D(t,e,p,a,f,"","",g).then(c=>{var x;c.success?(r.success((x=c.data)==null?void 0:x.msg),f(p)):r.error(c.data||c)})},N=b=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!a.selectedTask){r.error(l("Please select a task!","bit-integrations"));return}if(a.selectedTask===M.NEW_ATTENDEE&&!a.selectedEvent){r.error(l("Please select a event!","bit-integrations"));return}if(!S(a)){r.error(l("Please map mandatory fields!","bit-integrations"));return}a.field_map.length>0&&h(b)};return n.jsxs("div",{children:[n.jsx(A,{snack:k,setSnackbar:d}),n.jsx("div",{className:"txt-center mt-2",children:n.jsx(P,{step:3,active:o})}),n.jsx(F,{theEventsCalendarConf:a,setTheEventsCalendarConf:m,step:o,setStep:h,loading:u,setLoading:v,setSnackbar:d}),n.jsxs("div",{className:"btcd-stp-page",style:C({},o===2&&{width:900,height:"auto",overflow:"visible"}),children:[n.jsx(B,{formFields:s,theEventsCalendarConf:a,setTheEventsCalendarConf:m,loading:u,setLoading:v,setSnackbar:d}),n.jsxs("button",{onClick:()=>N(3),disabled:!S(a),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),"  ",n.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),n.jsx(z,{step:o,saveConfig:()=>_(),isLoading:j,dataConf:a,setDataConf:m,formFields:s})]})}export{se as default};
