var L=Object.defineProperty;var p=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var f=(a,s,t)=>s in a?L(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t,b=(a,s)=>{for(var t in s||(s={}))C.call(s,t)&&f(a,t,s[t]);if(p)for(var t of p(s))M.call(s,t)&&f(a,t,s[t]);return a};import{u as A,k as w,r as l,j as o}from"./main-333.js";import{d as N,_,I as z,s as D}from"./bi.636.93.js";import{S as E}from"./bi.563.969.js";import{M as T,h as F}from"./bi.777.898.js";import P from"./bi.298.319.js";import"./bi.429.767.js";import"./bi.318.783.js";function O({formFields:a,setFlow:s,flow:t,allIntegURL:d,isInfo:h,edit:x}){const v=A(),{formID:g}=w(),[n,u]=l.useState(!1),[r,m]=l.useState(1),[y,i]=l.useState({show:!1}),S=[{key:"1",label:"Course complete for the user"},{key:"2",label:"Lesson complete for the user"},{key:"3",label:"Quiz complete for the user"},{key:"4",label:"Reset user course"},{key:"5",label:"Reset user lesson"}],[e,c]=l.useState({name:"MasterStudyLms",type:"MasterStudyLms",mainAction:"",field_map:[{formField:"",msLmsFormField:""}],allActions:S,actions:{}}),j=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),e.mainAction!==""&&m(3)};function I(){switch(e.mainAction){case"1":return e.courseId===void 0;case"4":return e.courseId===void 0;case"2":return e.lessonId===void 0;case"5":return e.lessonId===void 0;case"3":return e.quizId===void 0;default:return!1}}return o.jsxs("div",{children:[o.jsx(N,{snack:y,setSnackbar:i}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(E,{step:3,active:r})}),o.jsx(P,{formID:g,msLmsConf:e,setMsLmsConf:c,step:r,setStep:m,isLoading:n,setIsLoading:u,setSnackbar:i}),o.jsxs("div",{className:"btcd-stp-page",style:b({},r===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(T,{formFields:a,handleInput:k=>F(k,e,c),msLmsConf:e,setMsLmsConf:c,isLoading:n,setIsLoading:u,setSnackbar:i,allIntegURL:d,isInfo:h,edit:x}),o.jsxs("button",{onClick:()=>j(),disabled:!e.mainAction||n||I(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[_("Next","bit-integrations")," ",o.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),o.jsx(z,{step:r,saveConfig:()=>D({flow:t,setFlow:s,allIntegURL:d,navigate:v,conf:e,setIsLoading:u,setSnackbar:i}),isLoading:n,dataConf:e,setDataConf:c,formFields:a})]})}export{O as default};
