import{b as e,H as a}from"./p-6bf07a28.js";const{state:t,onChange:s,reset:r}=e({user:{FirstName:"",LastName:"",ProfileText:"",ProfileImage:"",IsVerified:!1,Roles:[],FacilitatorClassList:[]},loaded:!1,updateLoading:!1,enrollmentList:[]}),n={state:t,onChange:s,reset:r};class i{constructor(){}static getInstance(){return i.instance||(i.instance=new i),i.instance}async enrollClass(e){let t=await a.http.post("api/v1/Student/EnrollClass",e);return t&&(n.state.enrollmentList=[...n.state.enrollmentList,t.Data]),t}async leaveClass(e){let t=await a.http.post("api/v1/Student/LeaveClass",e);return t&&(n.state.enrollmentList=n.state.enrollmentList.filter((e=>e.Id!=t.Data))),t}async fetchUserConfiguration(){let e=await a.http.get("api/v1/Student/UserConfiguration");return e&&(n.state.enrollmentList=e.Data.EnrollmentList,n.state.user.FirstName=e.Data.FirstName,n.state.user.LastName=e.Data.LastName,n.state.user.ProfileText=e.Data.ProfileText,n.state.user.ProfileImage=e.Data.ProfileImage,n.state.user.IsVerified=e.Data.IsVerified,n.state.user.Roles=e.Data.Roles,n.state.user.FacilitatorClassList=e.Data.FacilitatorClassList),e}async updateProfile(e){n.state.updateLoading=!0;let t=await a.http.post("api/Account/update-profile",e);return console.log("after fetch",t),t&&(n.state.updateLoading=!1,n.state.user=Object.assign(Object.assign({},n.state.user),{FirstName:t.Data.FirstName,LastName:t.Data.LastName,ProfileText:t.Data.ProfileText,ProfileImage:t.Data.ProfileImage})),t}async submitFeedback(e){return await a.http.post("api/v1/Feedback",e)}}export{i as S,n as u}