import{j as e,a8 as x,ds as f,Y as m,dm as p,dr as S,ai as g,dd as y,h as A,i as h,aq as b,b_ as k,b$ as L,a3 as v,fi as I}from"./app-BgLa5dit.js";import{A as M}from"./DFA8aJel.chunk.js";import{C}from"./EsGKTtoq.chunk.js";const B={propsLoaded(s){return Object.values(s).every(i=>!!i)}};function q(s){return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:`${x.toTitleCase(s.memberType)}`}),e.jsx(f,{responsive:!0,children:e.jsx("tbody",{children:s.objects&&s.objects.map(i=>e.jsx("tr",{children:e.jsx("td",{children:e.jsx(m,{appLink:p.getMemberAppLink(s.memberType,i.id),children:i.name})})},i.id))})}),e.jsx(S,{initialValues:{backboneClassificationIds:[]},presentationType:s.presentationType,subjectTree:s.subjectTree,saveSubjects:s.onClickAddToSubject,memberType:s.memberType,saveBtnText:"Add to backbone subject",subjectRequired:!0})]})}const N=s=>i=>i.appLink.action===s;function O(s){const i=s.presentationType===g.Subject?"Topics":"Curriculums";return e.jsxs(e.Fragment,{children:[e.jsx(M,{variant:"danger",children:`Warning: You are editing the backbone subjects for ${i}.`}),e.jsx("div",{className:"py-2",children:e.jsx(y,{tabs:s.getTabs(s.subjectId,s.presentationId),isItemActive:N(s.activeAction)})})]})}const H=(s,i,t)=>({application:t===g.Subject?h.SUBJECTS:h.CURRICULUMS,action:A.Subjects.EDIT_CLASSIFICATION,args:[s,i]}),F=s=>e.jsxs("div",{className:"border rounded p-2 mb-3",children:[e.jsx("h6",{className:"border-bottom pb-1",children:s.presentation.name}),s.classifications&&s.classifications.length?e.jsx("ul",{className:"list-unstyled mb-0",children:s.classifications.map(i=>e.jsx("li",{className:"py-1",children:e.jsx(m,{appLink:H(s.presentation.id,i.id,s.presentation.type),children:i.name})},i.id))}):e.jsx("p",{children:e.jsx("em",{children:"There are no topics mapped to this backbone subject in this presentation."})})]}),Y=s=>e.jsx(e.Fragment,{children:!!s.presentations&&!!s.classificationDictionary&&s.presentations.map(i=>e.jsx(F,{presentation:i,classifications:s.classificationDictionary[i.id]},i.id))});function P(s){const{member:{id:i,name:t,classifications:n=[]},getMemberAppLink:a,onToggleClassification:l,actions:c}=s,o=b.isFunction(a)&&a(i);return n.length&&!b.isFunction(l)&&k.throw(new L("onToggleClassification must be passed to SubjectMemberItem")),e.jsxs("tr",{children:[e.jsx("td",{children:o?e.jsx(m,{appLink:a(i),children:t}):t}),!!n.length&&n.map(r=>e.jsx("td",{children:e.jsx(C,{selected:r.selected,onToggle:d=>l(r.id,d,i)})},r.id)),c&&e.jsx("td",{children:e.jsx("span",{className:"d-flex justify-content-end",children:e.jsx(v,{actions:c})})})]})}const E=(s,i)=>i?s.name:`Classification: ${s.name}`;function u(s){return e.jsx(e.Fragment,{children:s.classifications.map(i=>e.jsxs("th",{children:[e.jsx("span",{className:"d-inline-block",children:e.jsx(C,{selected:s.getIsClassificationSelected(i),onToggle:t=>s.onToggleClassification(i.id,t)})}),e.jsx(m,{appLink:s.getClassificationAppLink(i.id),children:E(i,s.showClassificationSubHeader)})]},i.id))})}function $(s){const{memberType:i,hasActions:t,classifications:n,...a}=s,l=`${x.toTitleCase(p.singularizeMemberType(i))} Name`,c=!!n&&!!n.length,o=c&&n.length>1,r=c?2:1,d={classifications:n,showClassificationSubHeader:o,...a};return e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{rowSpan:r,children:l}),c&&(o?e.jsx("th",{colSpan:n.length,className:"text-center",children:"Topics"}):e.jsx(u,{...d})),t&&e.jsx("th",{rowSpan:r})]}),c&&o&&e.jsx("tr",{children:e.jsx(u,{...d})})]})}function w(s,i){return t=>{const n=t[s],a=I.length(n);return!!a&&a===i.length}}function _(s){const{members:i,memberType:t,getActions:n,classifications:a,getClassificationAppLink:l,onToggleClassification:c,...o}=s;if(!i.length)return e.jsx("div",{className:"py-5",children:`No ${t} in this backbone subject.`});const r=b.isFunction(n),d={memberType:t,classifications:a,getClassificationAppLink:l,getIsClassificationSelected:w(t,i),onToggleClassification:c,hasActions:r};return e.jsxs(f,{responsive:!0,bordered:!0,children:[e.jsx($,{...d}),e.jsx("tbody",{children:i.map((j,T)=>e.jsx(P,{member:j,actions:r&&n(j.id),onToggleClassification:c,...o},T))})]})}export{q as A,O as E,B as P,_ as S,Y as a};
//# sourceMappingURL=Biz49l3k.chunk.js.map
