var T=Object.defineProperty;var j=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var S=(a,e,s)=>e in a?T(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s,v=(a,e)=>{for(var s in e||(e={}))N.call(e,s)&&S(a,s,e[s]);if(j)for(var s of j(e))y.call(e,s)&&S(a,s,e[s]);return a};import{j as t,_ as m,s as k,d as C}from"./main.2.8.1.js";import{d as u,u as w}from"./react-router-dom.9mCuUg3q.js";import{z as I,y as M}from"./Note.BeM7sN-p.js";import{S as z}from"./SnackMsg.S8DrwLlT.js";import{S as A}from"./Steps.1hz7v9Vj.js";import{I as _,s as B}from"./Integrations.D2bgBas2.js";import{B as E}from"./BackIcn._kGL_vVw.js";import{t as D}from"./tutorialLinks.kMkIDzcD.js";import{T as L}from"./TutorialLink.BAFX--T3.js";import{T as F,h as H}from"./TutorLmsIntegLayout.BbI2u6Gc.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";function P({tutorlmsConf:a,setTutorlmsConf:e,step:s,setStep:g,setSnackbar:f}){const[i,c]=u.useState(!1),[o,h]=u.useState(!1),[b,l]=u.useState(!1),{tutorlms:n}=D,d=()=>{h("auth"),C({},"tutor_authorize").then(r=>{r!=null&&r.success&&(c(!0),f({show:!0,msg:m("Connected with Tutor LMS Successfully","bit-integrations")})),h(!1),l(!0)})},x=r=>{const p=M(a);p[r.target.name]=r.target.value,e(p)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:s===1&&900,height:s===1&&"auto"},children:[t.jsx(L,{title:"Tutor LMS",youTubeLink:n==null?void 0:n.youTubeLink}),t.jsx(L,{title:"Tutor LMS",docLink:n==null?void 0:n.docLink}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:m("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:x,name:"name",value:a.name,type:"text",placeholder:m("Integration Name...","bit-integrations")}),o==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(I,{size:25,clr:"#022217",className:"mr-2"}),"Checking if Tutor LMS is active!!!"]}),b&&!i&&!o&&t.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),k(m("%s plugin must be activated to integrate with Bit Integrations","bit-integrations"),"Tutor LMS")]}),!i&&t.jsx("button",{onClick:d,className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",children:m("Connect","bit-integrations")}),i&&t.jsxs("button",{onClick:()=>g(2),className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",disabled:!i,children:[m("Next","bit-integrations"),t.jsx(E,{className:"ml-1 rev-icn"})]})]})}function tt({formFields:a,setFlow:e,flow:s,allIntegURL:g}){const f=w(),[i,c]=u.useState(!1),[o,h]=u.useState(1),[b,l]=u.useState({show:!1}),[n,d]=u.useState({name:"Tutor LMS",type:"Tutor Lms",field_map:[{formField:"",tutorField:""}],actions:{},actionData:{}}),x=()=>{c(!0),B({flow:s,setFlow:e,allIntegURL:g,conf:n,navigate:f,setIsLoading:c,setSnackbar:l})},r=p=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),h(p)};return t.jsxs("div",{children:[t.jsx(z,{snack:b,setSnackbar:l}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(A,{step:3,active:o})}),t.jsx(P,{tutorlmsConf:n,setTutorlmsConf:d,step:o,setStep:h,isLoading:i,setIsLoading:c,setSnackbar:l}),t.jsxs("div",{className:"btcd-stp-page",style:v({},o===2&&{width:900,height:"auto",minHeight:o===2&&"260px",overflow:"visible"}),children:[t.jsx(F,{formFields:a,handleInput:p=>H(p,n,d,c,l),tutorlmsConf:n,setTutorlmsConf:d,isLoading:i,setIsLoading:c,setSnackbar:l}),t.jsxs("button",{onClick:()=>r(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[m("Next","bit-integrations"),"  ",t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx(_,{step:o,saveConfig:()=>x(),isLoading:i,dataConf:n,setDataConf:d,formFields:a})]})}export{tt as default};
