import{aI as I,az as g,aj as P,aX as O,c4 as j,bc as A,ao as e,aF as y,L as R,aq as L,bU as i,aZ as w,m as F,o as T,v as U,f as b,e as B}from"./app-k0jcl5PQ.js";import{C as S}from"./_XP6hjk3.chunk.js";const p="classrooms.removeTeachersFromClassroom",a=R.encloseNamespace(p);function q(s){var d;const[f,m]=I.useState(!1),c=g(P.currentUser()),r=g(c.data&&S.getClassroom(s.classroomId,c.data.id)),{hasPermissions:C}=O(),x=j(),u=A(),l=s.teacherIds.some(t=>{var n;return t.toString()===((n=c.data.id)==null?void 0:n.toString())}),o=l&&s.teacherIds.length===1;function v(){m(!0);const t=C(w.ManageAllClassrooms),n=l&&!t?[`classroom:${s.classroomId}`,"published:classrooms","pinned:classrooms"]:[];F(x,S.removeInvitees(s.teacherIds,s.classroomId,n,()=>{m(!1),T.logUserAction({id:s.classroomId,teacherCount:s.teacherIds.length},s.analyticsOptions),u.success(a(o?"successSelfOnly":"success",h)),l&&!t&&U.trigger({application:B.CLASSROOMS,action:b.Classrooms.HOME},{replace:!0}),s.closePopup()},()=>{u.error(a("error")),s.closePopup()}))}const h={smartCount:s.teacherIds.length,classroomName:(d=r.data)==null?void 0:d.name,escapeText:!0};return e.jsx(y,{title:a(o?"titleSelfOnly":"title"),closePopup:s.closePopup,showLoadingSpinner:!r.data,children:r.data&&e.jsxs(e.Fragment,{children:[e.jsx("p",{children:e.jsx(L,{namespace:p,phrase:o?"confirmSelfOnly":"confirm",options:h})}),e.jsxs(i,{children:[e.jsx(i.Cancel,{onClick:s.closePopup}),e.jsx(i.Submit,{onClick:v,variant:"danger",text:a(o?"removeSelfOnly":"remove"),showSpinner:f})]})]})})}export{q as RemoveTeachersFromClassroomView};
//# sourceMappingURL=Dm_4kJRx.chunk.js.map
