import{aI as f,ao as e,bk as I,at as k,el as q,a_ as T,ce as w,av as _,aq as C,bb as y,bl as S}from"./app-k0jcl5PQ.js";import{I as g}from"./CG1PE8VW.chunk.js";import{E as D}from"./uoUaCILN.chunk.js";import{I as A}from"./B31bqZwo.chunk.js";const $="_timeTag_irvqk_1",F="_hide_irvqk_6",R="_type_irvqk_14",E="_question_irvqk_19",M="_deleteContainer_irvqk_27",Q="_correctness_irvqk_35",z="_selected_irvqk_47",B="_row_irvqk_50",i={timeTag:$,hide:F,type:R,question:E,deleteContainer:M,delete:"_delete_irvqk_27",correctness:Q,selected:z,row:B},j="shared.interactiveQuestions";function H(t){const{interaction:n,getCorrectness:o}=t;switch(o(n)){case g.Correct:return e.jsx("span",{className:"text-success",children:e.jsx(T,{size:_.Medium,svg:S})});case g.Incorrect:return e.jsx("span",{className:"text-danger",children:e.jsx(T,{size:_.Medium,svg:y})});case g.AwaitingMarking:return e.jsx("span",{className:"text-secondary italic",children:e.jsx("i",{children:e.jsx(C,{namespace:j,phrase:"pending"})})});case g.UnAnswered:return e.jsx("button",{className:"btn btn-outline-dark",children:e.jsx(C,{namespace:j,phrase:"answer"})});case g.Answered:return e.jsx("span",{className:"text-secondary italic",children:e.jsx("i",{children:e.jsx(C,{namespace:j,phrase:"answered"})})});case g.NotApplicable:return e.jsx(e.Fragment,{})}}function W(t){const{interaction:n,visibleAt:o,selectedInteractionId:c,goToTimepoint:a,scrollTo:x,isFirstInteraction:d}=t,s=n.id.toString()===(c==null?void 0:c.toString()),r=f.useRef(null);f.useEffect(()=>{if(!s||!r.current)return;const l=r.current,m=l.getBoundingClientRect(),h=m.top-l.offsetParent.getBoundingClientRect().top;x(h,m.height)},[s]);function v(){a&&a(n.id)}function p(l){l.stopPropagation(),t.onClickDelete(n.id)}const u=a?"cursor-pointer":"cursor-default";return e.jsx("div",{ref:r,children:e.jsxs(k,{className:`py-2 ${u} ${i.row} ${s?i.selected:""}`,onClick:s?()=>{}:v,children:[e.jsx("div",{className:`me-3 d-inline-flex rounded-pill justify-content-center align-items-center text-info fw-semibold bg-light-blue ${i.timeTag} ${d?"":i.hide}`,children:d?q.ToDisplayDuration(o):""}),e.jsx(A,{interaction:n,showTypeName:!0,typeNameClassName:i.type,questionClassName:i.question}),t.onClickDelete&&e.jsx(k,{onClick:p,className:`${i.deleteContainer}`,children:e.jsx("span",{className:`text-end ${i.delete}`,children:e.jsx(T,{size:_.Medium,svg:w})})}),t.getCorrectness&&e.jsx("span",{className:`text-end ${i.correctness}`,children:e.jsx(H,{interaction:n,getCorrectness:t.getCorrectness})})]})})}function P(t){const{timepoint:n,scrollTo:o,onClickDelete:c,selectedInteractionId:a,getCorrectness:x}=t;function d(s){t.goToTimepoint(n.id,s,n.visibleAt)}return n.interactions?e.jsx(e.Fragment,{children:n.interactions.map((s,r)=>!t.experimentalInteractiveQuestions&&D[s.typeId]?e.jsx(f.Fragment,{},r):e.jsx(W,{interaction:s,visibleAt:n.visibleAt,goToTimepoint:t.goToTimepoint&&d,onClickDelete:c,scrollTo:o,selectedInteractionId:a,isFirstInteraction:r===0,getCorrectness:x},r))}):e.jsx(e.Fragment,{})}function K(t){const{interactive:n,goToTimepoint:o,selectedInteractionId:c,maxHeight:a,onClickDelete:x,getCorrectness:d}=t,s=f.useRef(null);function r(p,u){if(!s.current)return;const l=s.current.getClientHeight(),m=s.current.getScrollTop(),h=p+m,b=h<m,N=h+u>m+l;!b&&!N||s.current.scrollTop(h-l/2+u/2)}const v=o?"border rounded":"";return e.jsx(I.Scrollbars,{autoHeight:!0,autoHeightMax:a,className:v,hideTracksWhenNotNeeded:!0,ref:s,children:e.jsx("div",{className:"px-3 py-2",children:n.timepoints.map((p,u)=>e.jsx(P,{timepoint:p,goToTimepoint:o,selectedInteractionId:c,scrollTo:r,onClickDelete:x,getCorrectness:d,experimentalInteractiveQuestions:t.experimentalInteractiveQuestions},u))})})}export{K as I};
//# sourceMappingURL=DtZoWt5r.chunk.js.map
