import{aI as c,bc as C,ao as i,at as v,a_ as T,av as y,dW as E,d8 as P,o as l,W as m,E as u,ch as g,r as f,L as h}from"./app-k0jcl5PQ.js";import{S as w}from"./DlQIAsvN.chunk.js";const N="classrooms.classroomStar",t=h.encloseNamespace(N),n=e=>P.isFavouritedByCurrentUser(e);function F(e){const[s,r]=c.useState(n(e.classroom)),o=C();c.useEffect(()=>{n(e.classroom)!==s&&r(!s)},[n(e.classroom)]);function d(){r(!s),e.onToggle(!s,()=>S(!s),()=>x(s))}function S(a){if(a){l.logUserAction({id:e.classroom.id},{location:e.locationContext,actionType:f.Favourite,descriptor:g.On,entity:u.Classroom,workflowPhase:m.Complete}),o.success(t("pinSuccess",{classroomName:e.classroom.name,escapeText:!0}));return}l.logUserAction({id:e.classroom.id},{location:e.locationContext,actionType:f.Favourite,descriptor:g.Off,entity:u.Classroom,workflowPhase:m.Complete}),o.success(t("unpinSuccess",{classroomName:e.classroom.name,escapeText:!0}))}function x(a){if(r(a),a){o.error(t("unpinError",{classroomName:e.classroom.name,escapeText:!0}));return}o.error(t("pinError",{classroomName:e.classroom.name,escapeText:!0}))}return i.jsx(v,{onClick:d,className:s?"text-yellow":"",children:i.jsx(T,{svg:s?E:w,size:y.Medium})})}export{F as C};
//# sourceMappingURL=B04URh0L.chunk.js.map
