import{az as u,aj as A,bc as U,c4 as f,ao as p,aF as x,L as P,m as C,o as t,r as g,q as T}from"./app-k0jcl5PQ.js";import{E as y}from"./CkuFLKlL.chunk.js";import{C as a}from"./_XP6hjk3.chunk.js";import"./C3DvQ1wU.chunk.js";import"./DV1GpLCe.chunk.js";import"./Di9d6zcy.chunk.js";import"./CKctgafI.chunk.js";import"./Bdp-qhf0.chunk.js";import"./BUELddOb.chunk.js";import"./DLmnDxSd.chunk.js";import"./CW7x8M-z.chunk.js";const G="classrooms.createClassroomGroup",r=P.encloseNamespace(G);function k(s){const c=u(A.currentUser()),n=u(c.data&&a.getClassroom(s.classroomId,c.data.id)),i=U(),m=f(),l=e=>{i.success(r("success",{groupName:e.name,classroomName:n.data.name,escapeText:!0})),s.closePopup()},h=e=>{C(m,a.addStudentsToGroup(s.studentIds,e.id,s.classroomId,()=>{t.logUserAction({id:e.id,name:e.name,studentCount:s.studentIds.length},t.mergeOptions(s.analyticsOptions,{actionType:g.Associate,descriptor:T.User})),l(e)}))},I=e=>{C(m,a.createClassroomGroup(e,s.classroomId,o=>{var d;if(t.logUserAction({id:o.id,name:o.name,classroomId:s.classroomId},t.mergeOptions(s.analyticsOptions,{actionType:g.Create})),(d=s.studentIds)!=null&&d.length){h(o);return}l(o)},()=>{i.error(r("error"))}))};return p.jsx(x,{title:r("title"),closePopup:s.closePopup,showLoadingSpinner:!n.data,children:p.jsx(y,{saveGroup:I,onClickCancel:s.closePopup})})}export{k as CreateClassroomGroupView};
//# sourceMappingURL=BK8vqoUL.chunk.js.map
