PageSourceSearch

https://giaoviendoimoi.com/assets/AssignmentHistoryPage-Dc2vrjVg.js

js giaoviendoimoi.com collected 2026-09-24 14:14:09 UTC 30,574 bytes, 1 lines download raw bytes

1import{r as C,j as e}from"./vendor-react-DJzUMfd1.js";import{W as xe,X as Xe,c as He,n as Le,b as Ze,D as Me,d as We,p as l,T as j,I as re,Y as Je,e as Be,N as P,Z as Ne,v as et,B as M,C as ge,r as Se,_ as Ke,$ as Fe,a0 as ue,a1 as d,a2 as Oe,a3 as tt,a4 as nt,L as rt,f as Ve,a as st,a5 as $e,q as ke}from"./index-C0esqoXR.js";import{H as ot}from"./HomeTabPageShell-CYm9Ejyp.js";import{i as De,h as at,j as Qe,k as it,l as lt,m as ct,n as dt}from"./assignmentService-tzBLKRhC.js";import{g as Ue}from"./gameTypes-f5wEe58l.js";import{Q as ht}from"./index-CPX-tAFT.js";import{F as xt}from"./FileSaver.min-d7RW4grg.js";import{T as Z}from"./Tooltip-DCBvMNYw.js";import{P as ut}from"./Person-BfcZbBI6.js";import{I as ze}from"./InputAdornment-DLc3DBCX.js";import{L as Ge}from"./Link-SqD1ZXeC.js";import{T as Ye}from"./TableContainer--SD-VYOD.js";import{E as Ie}from"./EmojiEvents-C3dbMUOl.js";import{T as pt}from"./Timer-4ebcaaX7.js";import{L as Ee}from"./Lock-fDVNKez0.js";import{F as mt}from"./FileDownload-yFOdmKFw.js";import{g as gt,R as jt,d as _e}from"./ResultDetailModal-DYWpG4sA.js";import{C as ft}from"./Container-BqzqHWDq.js";import{P as Re}from"./Visibility-CXJu5lj5.js";import{S as yt}from"./Stop-CCdargpS.js";import{D as wt}from"./Delete-CqbOIsIj.js";import"./vendor-3d-B-0V4uEN.js";import"./vendor-firebase-NOrVjYbK.js";import"./vendor-katex-DqEyuLHo.js";import"./joinCodeService-Duqlw8dB.js";import"./useShuffleQuestions-CMMUsmAD.js";import"./FormControlLabel-UfST9rc_.js";import"./Checkbox-hNFsBxwF.js";import"./Cancel-HgNyvqSD.js";import"./HelpOutline-BjEUExVZ.js";import"./shortAnswerBlanks-Z6lHtHwe.js";import"./MathText-CUiST3AE.js";import"./ToggleButtonGroup-CoAE_xr7.js";import"./useThemeProps-Cu1lPegC.js";const b=o=>o==null?"":String(o).replace(/<[^>]*>/g,"").trim(),bt=o=>{if(!o||o<0)return"-";if(o<60)return`${o}s`;const n=Math.floor(o/60),t=o%60;return t>0?`${n}m ${t}s`:`${n}m`},Ct=o=>o?(o.toDate?o.toDate():new Date(o)).toLocaleString("vi-VN",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}):"-";function St(o,n){const t=o.gameType,r=t==="tug_of_war",h=t==="turn_based_game",p=t==="versus_game",m=t==="star_bag_game";return n.map((x,k)=>{var c,T,z,y,I,f,S,W,V,q,se,oe,ce,B;const i=x.gameData||{},_=x.maxScore>0?Math.round(x.score/x.maxScore*100):0;let g=x.studentName||"",D=`${x.score}/${x.maxScore}`;if(r)g=`🔵 ${((c=i.team1)==null?void 0:c.name)||""}: ${((T=i.team1)==null?void 0:T.members)||"—"} | 🔴 ${((z=i.team2)==null?void 0:z.name)||""}: ${((y=i.team2)==null?void 0:y.members)||"—"}`,D=`${((I=i.team1)==null?void 0:I.score)??0} - ${((f=i.team2)==null?void 0:f.score)??0} (Thắng: ${i.winner==="team1"?(S=i.team1)==null?void 0:S.name:i.winner==="team2"?(W=i.team2)==null?void 0:W.name:"Hòa"})`;else if(m)g=`🔵 ${((V=i.team1)==null?void 0:V.name)||""} vs 🔴 ${((q=i.team2)==null?void 0:q.name)||""}`,D=`${((se=i.team1)==null?void 0:se.stars)??0} - ${((oe=i.team2)==null?void 0:oe.stars)??0} (Thắng: ${i.winner==="team1"?(ce=i.team1)==null?void 0:ce.name:i.winner==="team2"?(B=i.team2)==null?void 0:B.name:"Hòa"})`;else if(h)g=(i.players||[]).map(R=>R.name).join(", "),D=`🏆 ${i.winnerName||"—"}`;else if(p){const R=i.player1||{},J=i.player2||{};g=`${R.name||"P1"} vs ${J.name||"P2"}`,D=`${R.score??0} - ${J.score??0} (Thắng: ${i.winner==="player1"?R.name:i.winner==="player2"?J.name:"—"})`}return{STT:k+1,"Học sinh":g,"Kết quả":D,"% Hoàn thành":r||h||p||m?"-":`${_}%`,"Thời gian làm bài":bt(x.duration),"Thời điểm nộp":Ct(x.completedAt)}})}const Pe=o=>({headers:["Học sinh","Câu","Câu hỏi","Đáp án chọn","Đáp án đúng","Kết quả"],buildRows:n=>{var r;return(((r=n.gameData)==null?void 0:r.responses)||[]).map((h,p)=>({"Học sinh":n.studentName||"",Câu:p+1,"Câu hỏi":b(h.questionText||h.question),"Đáp án chọn":b(h.answerChosenText||h.chosenAnswer||h.selectedAnswer||"—"),"Đáp án đúng":b(h.correctAnswerText||(Array.isArray(h.correctAnswers)?h.correctAnswers.join(", "):h.correctAnswer)||""),"Kết quả":h.isCorrect?"Đúng":h.isCorrect===!1?"Sai":"Chưa làm"}))}}),Dt={interactive_video:Pe(),pose_quiz:Pe(),head_tilt_quiz:{headers:["Học sinh","Câu","Câu hỏi","Đáp án chọn","Đáp án đúng","Kết quả"],buildRows:o=>{var n;return(((n=o.gameData)==null?void 0:n.responses)||[]).map((t,r)=>({"Học sinh":o.studentName||"",Câu:r+1,"Câu hỏi":b(t.questionText),"Đáp án chọn":b(t.answerChosen==="A"?t.answerAText:t.answerBText),"Đáp án đúng":b(t.correctAnswer==="A"?t.answerAText:t.answerBText),"Kết quả":t.isCorrect?"Đúng":"Sai"}))}},interactive_image:{headers:["Học sinh","Điểm chạm","Câu hỏi","Đáp án đúng","Kết quả"],buildRows:o=>{var n;return(((n=o.gameData)==null?void 0:n.markerResults)||[]).map((t,r)=>({"Học sinh":o.studentName||"","Điểm chạm":r+1,"Câu hỏi":b(t.question),"Đáp án đúng":b(t.correctAnswer),"Kết quả":t.isCorrect===!0?"Đúng":t.isCorrect===!1?"Sai":"Chưa làm"}))}},paced_quiz:{headers:["Học sinh","Câu","Câu hỏi","Đáp án chọn","Đáp án đúng","Kết quả"],buildRows:(o,n)=>{var h,p;const t=((h=n.gameSnapshot)==null?void 0:h.questions)||[],r=((p=o.gameData)==null?void 0:p.answers)||{};return t.map((m,x)=>{var c,T,z,y;const k=r[x],i=k==null?void 0:k.answer,_=i?((T=(c=m.options)==null?void 0:c[i])==null?void 0:T.text)||i:"",g=m.correctAnswer,D=g?((y=(z=m.options)==null?void 0:z[g])==null?void 0:y.text)||g:"";return{"Học sinh":o.studentName||"",Câu:x+1,"Câu hỏi":b(m.text),"Đáp án chọn":b(_),"Đáp án đúng":b(D),"Kết quả":k===void 0?"Chưa làm":k.isCorrect?"Đúng":"Sai"}})}},crossword_puzzle:{headers:["Học sinh","Hàng","Câu hỏi","Đáp án","Số lần sai","Điểm"],buildRows:o=>{var n;return(((n=o.gameData)==null?void 0:n.responses)||[]).map((t,r)=>({"Học sinh":o.studentName||"",Hàng:(t.rowIndex!==void 0?t.rowIndex:r)+1,"Câu hỏi":b(t.questionText),"Đáp án":b(t.answerChosenText||t.correctAnswerText||""),"Số lần sai":t.wrongAttempts||0,Điểm:t.earnedScore!==void 0?`${t.earnedScore}/${t.maxScorePerRow}`:""}))}},flip_puzzle:{headers:["Học sinh","Ảnh giải mã","Lần thử","Đáp án nhập","Kết quả"],buildRows:o=>{var n;return(((n=o.gameData)==null?void 0:n.decodeAttempts)||[]).map((t,r)=>{var h;return{"Học sinh":o.studentName||"","Ảnh giải mã":((h=o.gameData)==null?void 0:h.imageName)||"—","Lần thử":r+1,"Đáp án nhập":t.guess,"Kết quả":t.isCorrect?"Đúng":"Sai"}})}},tug_of_war:{headers:["Đội","Câu","Câu hỏi","Đáp án chọn","Đáp án đúng","Kết quả"],buildRows:o=>{const n=o.gameData||{},t=[];for(const[r,h]of[["team1","🔵"],["team2","🔴"]]){const p=n[r];for(const[m,x]of((p==null?void 0:p.log)||[]).entries())t.push({Đội:`${h} ${(p==null?void 0:p.name)||r}`,Câu:m+1,"Câu hỏi":b(x.questionText),"Đáp án chọn":b(x.chosenAnswer||"Ảnh"),"Đáp án đúng":b(Array.isArray(x.correctAnswers)?x.correctAnswers.join(", "):x.correctAnswers),"Kết quả":x.isCorrect?"Đúng":"Sai"})}return t}},versus_game:{headers:["Người chơi","Câu","Câu hỏi","Đáp án chọn","Kết quả"],buildRows:(o,n)=>{var g,D,c;const t=o.gameData||{},r=t.player1||{},h=t.player2||{},p=t.winner,m=((g=n==null?void 0:n.gameSnapshot)==null?void 0:g.questions)||[],x=t.roundsP1??(p==="player1"?t.rounds??[]:[]),k=t.roundsP2??(p==="player2"?t.rounds??[]:[]),i=[],_=["A","B","C","D"];for(const[T,z]of[[r.name||"P1",x],[h.name||"P2",k]])for(const[y,I]
1of z.entries()){const f=m[((I==null?void 0:I.questionIndex)??0)%Math.max(m.length,1)]??null,S=(c=(D=f==null?void 0:f.answers)==null?void 0:D[I.chosenIndex])==null?void 0:c.text;i.push({"Người chơi":T,Câu:y+1,"Câu hỏi":b((f==null?void 0:f.questionText)||`Câu ${y+1}`),"Đáp án chọn":S?`${_[I.chosenIndex]}. ${b(S)}`:"—","Kết quả":I.isCorrect?"Đúng":"Sai"})}return i}},star_bag_game:{headers:["Đội","Số sao","Kết quả"],buildRows:o=>{const n=o.gameData||{},t=[];for(const[r,h]of[["team1","🔵"],["team2","🔴"]]){const p=n[r];p&&t.push({Đội:`${h} ${p.name||r}`,"Số sao":p.stars??0,"Kết quả":n.winner===r?"Thắng":n.winner==="draw"?"Hòa":"Thua"})}return t}},minesweeper:{headers:["Học sinh","Câu","Câu hỏi","Đáp án chọn","Đáp án đúng","Kết quả"],buildRows:o=>{var n;return(((n=o.gameData)==null?void 0:n.responses)||[]).map((t,r)=>({"Học sinh":o.studentName||"",Câu:r+1,"Câu hỏi":b(t.questionText),"Đáp án chọn":b(t.selectedAnswer),"Đáp án đúng":b(t.correctAnswer),"Kết quả":t.isCorrect?"Đúng":"Sai"}))}},knowledge_train:{headers:["Học sinh","Số toa","Số lần kiểm tra để hoàn thành"],buildRows:o=>{var n,t;return[{"Học sinh":o.studentName||"","Số toa":((n=o.gameData)==null?void 0:n.totalWagons)||0,"Số lần kiểm tra để hoàn thành":((t=o.gameData)==null?void 0:t.checkCount)||0}]}}},qe=(o,n)=>{const t=xe.encode_col(n-1);o["!autofilter"]={ref:`A1:${t}1`}};function vt(o,n,t=!0){if(!o||n.length===0)return;const r=xe.book_new(),h=St(o,n),p=xe.json_to_sheet(h);p["!cols"]=[{wch:5},{wch:35},{wch:25},{wch:12},{wch:16},{wch:18}],qe(p,6),xe.book_append_sheet(r,p,"Tổng quan");const m=t?Dt[o.gameType]:null;if(m){const _=n.flatMap(g=>m.buildRows(g,o));if(_.length>0){const g=xe.json_to_sheet(_,{header:m.headers});g["!cols"]=m.headers.map(D=>D.includes("Câu hỏi")?{wch:50}:D.includes("Đáp án")?{wch:30}:{wch:18}),qe(g,m.headers.length),xe.book_append_sheet(r,g,"Chi tiết từng câu")}}const x=Xe(r,{bookType:"xlsx",type:"array"}),k=new Blob([x],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),i=(o.title||"ket-qua").replace(/[\\/:*?"<>|]/g,"").trim();xt.saveAs(k,`${i}-ket-qua.xlsx`)}function Tt({open:o,onClose:n,assignment:t}){var pe;const{t:r}=He("assignment"),[h,p]=C.useState(!0),[m,x]=C.useState([]),[k,i]=C.useState(null),[_,g]=C.useState(""),D=Le(),c=t?Ue(t.gameType):null,T=t?De(t.expiresAt):!0,z=t!=null&&t.joinCode?`${window.location.origin}/join?code=${t.joinCode}`:"",{subscription:y,openProModal:I}=Ze(),f=((pe=y==null?void 0:y.proPlan)==null?void 0:pe.isPurchased)===!0||(y==null?void 0:y.proPlanExpiresAt)&&new Date(y.proPlanExpiresAt)>new Date||(y==null?void 0:y.subscriptionLevel)==="premium"||(y==null?void 0:y.subscriptionLevel)==="pro",S=(t==null?void 0:t.gameType)==="tug_of_war",W=(t==null?void 0:t.gameType)==="turn_based_game",V=(t==null?void 0:t.gameType)==="versus_game",q=!!(c!=null&&c.SubmissionDetailRenderer),se=!!(c!=null&&c.reportRoute),oe=a=>{if(!a||a<0)return"-";const A=r("duration.s_short",{defaultValue:"s"}),$=r("duration.m_short",{defaultValue:"m"});if(a<60)return`${a}${A}`;const v=Math.floor(a/60),N=a%60;return N>0?`${v}${$} ${N}${A}`:`${v}${$}`},ce=a=>{if(!a)return"-";const A=a.toDate?a.toDate():new Date(a),$=r("common:language.dateLocale",{defaultValue:"en-US"});return A.toLocaleString($,{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})};C.useEffect(()=>{g(""),o&&(t!=null&&t.id)&&B()},[o,t==null?void 0:t.id]);const B=async()=>{p(!0);try{const A=(await at(t.id)).sort(($,v)=>{var Q,U,G,ae;if(v.score!==$.score)return v.score-$.score;if($.duration!==v.duration)return $.duration-v.duration;const N=((U=(Q=$.completedAt)==null?void 0:Q.toMillis)==null?void 0:U.call(Q))??0,he=((ae=(G=v.completedAt)==null?void 0:G.toMillis)==null?void 0:ae.call(G))??0;return N-he});x(A)}catch(a){console.error("Error loading submissions:",a)}finally{p(!1)}},R=()=>{t!=null&&t.joinCode&&(navigator.clipboard.writeText(t.joinCode),g("code"),setTimeout(()=>g(""),2e3))},J=()=>{z&&(navigator.clipboard.writeText(z),g("link"),setTimeout(()=>g(""),2e3))},de=()=>{const a=document.getElementById("submission-detail-qr");if(!a)return;const A=document.createElement("a");A.href=a.toDataURL("image/png"),A.download=`qr-${t.joinCode}.png`,A.click()};return t?e.jsxs(Me,{open:o,onClose:n,maxWidth:"md",fullWidth:!0,PaperProps:{sx:{minHeight:"60vh"}},children:[e.jsxs(We,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(l,{sx:{width:40,height:40,borderRadius:2,bgcolor:`${(c==null?void 0:c.color)||"#667eea"}20`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.5rem"},children:(c==null?void 0:c.icon)||"🎮"}),e.jsxs(l,{children:[e.jsx(j,{variant:"h6",component:"div",children:t.title}),e.jsx(j,{variant:"caption",color:"text.secondary",children:r(`gameTypes.${t.gameType}.label`,{defaultValue:(c==null?void 0:c.label)||t.gameType})})]})]}),e.jsx(re,{onClick:n,children:e.jsx(Je,{})})]}),e.jsxs(Be,{dividers:!0,children:[e.jsxs(l,{sx:{display:"flex",gap:2,mb:3,p:2,bgcolor:"#f5f5f5",borderRadius:2,flexWrap:"wrap"},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(j,{variant:"body2",color:"text.secondary",children:r("details.joinCode")}),e.jsx(P,{label:t.joinCode,color:T?"default":"primary",sx:{fontFamily:"monospace",fontWeight:"bold"}}),!T&&e.jsx(Z,{title:r(_==="code"?"success.copySuccess":"success.copyCode"),children:e.jsx(re,{size:"small",onClick:R,children:e.jsx(Ne,{fontSize:"small"})})})]}),e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(j,{variant:"body2",color:"text.secondary",children:r("details.status")}),e.jsx(P,{label:T?r("details.expired"):Qe(t.expiresAt),color:T?"error":"success",size:"small"})]}),e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ut,{fontSize:"small",color:"action"}),e.jsx(j,{variant:"body2",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:r("details.submissionCount",{count:m.length})}})})]})]}),!T&&z&&e.jsxs(l,{sx:{display:"flex",gap:2,mb:3,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs(l,{sx:{flex:"1 1 280px",minWidth:0},children:[e.jsx(j,{variant:"body2",color:"text.secondary",sx:{mb:1},children:r("success.shareLink")}),e.jsx(et,{fullWidth:!0,size:"small",value:z,InputProps:{readOnly:!0,startAdornment:e.jsx(ze,{position:"start",children:e.jsx(Ge,{color:"action"})}),endAdornment:e.jsx(ze,{position:"end",children:e.jsx(M,{variant:"contained",size:"small",onClick:J,color:_==="link"?"success":"primary",sx:{borderRadius:2,minWidth:100},children:r(_==="link"?"success.copied":"success.copyLink")})})},sx:{bgcolor:"#f8f9fa"}})]}),e.jsxs(l,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:.5},children:[e.jsx(ht,{id:"submission-detail-qr",value:z,size:110}),e.jsx(M,{size:"small",variant:"text",onClick:de,children:r("success.qrDownload")})]})]}),h?e.jsx(l,{sx:{display:"flex",justifyContent:"center",py:4},children:e.jsx(ge,{})}):m.length===0?e.jsxs(l,{sx:{textAlign:"center",py:6},children:[e.jsx(j,{variant:"h6",color:"text.secondary",gutterBottom:!0,children:r("details.noSubmissions")}),e.jsx(j,{variant:"body2",color:"text.secondary",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:r("details.sharePrompt",{code:t.joinCode})}})})]}):e.jsx(Ye,{component:Se,variant:"outlined",children:e.jsxs(Ke,{size:"small",children:[e.jsx(Fe,{children:e.jsxs(ue,{sx:{bgcolor:"#f5f5f5"},children:[e.jsx(d,{width:50,children:e.jsx("strong",{children:r("details.table.stt")})}),e.jsx(d,{children:e.jsx("strong",{children:r(S?"details.table.members":W||V?"details.table.players":"details.table.name")})}),e.jsx(d,{align:"center",children:e.jsx("strong",{children:r(S||W||V?"details.table.result":"details.table.score")})}),e.jsx(d,{align:"center",children:e.jsx("strong",{children:r("details.table.duration")})}),e.jsx(d,{align:"right",children:e.jsx("strong",{children:r("details.table.submittedAt")})}),q&&e.jsx(d,{width:100,align:"center"})]})}),e.jsx(Oe,{children:m.map((a,A)=>{var he,Q,U,G,ae,je,fe,ye,we,be,K,ee,Ce,s,w,u,E,H,Y,ie,le,F,ve,Te;const $=a.maxScore>0?Math.round(a.score/a.maxScore*100):0,v=k===a.id,N=q&&(((he=c.hasExpandableDetails)==null?void 0:he.call(c,a))??!1);return e.jsxs(C.Fragment,{children:[e.jsxs(ue,{hover:!0,sx:{"& > *":{borderBottom:v?0:void 0}},children:[e.jsx(d,{children:A+1}),e.jsx(d,{children:S?e.jsxs(l,{children:[e.jsxs(j,{variant:"body2",sx:{color:"#2563eb"},children:["🔵 ",(U=(Q=a.gameData)==null?void 0:Q.team1)==null?void 0:U.name,": ",e.jsx("strong",{children:((ae=(G=a.gameData)==null?void 0:G.team1)==null?void 0:ae.members)||"—"})]}),e.jsxs(j,{variant:"body2",sx:{color:"#dc2626"},children:["🔴 ",(fe=(je=a.gameData)==null?void 0:je.team2)==null?void 0:fe.name,": ",e.jsx("strong",{children:((we=(ye=a.gameData)==null?void 0:ye.team2)==null?void 0:we.members)||"—"})]})]}):W?e.jsx(l,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:((K=(be=a.gameData)==null?void 0:be.players)==null?void 0:K.map((O,L)=>{var X,te,ne;return e.jsx(P,{label:`${L===((X=a.gameData)==null?void 0:X.winnerId
1x)?"🏆 ":""}${O.name}`,size:"small",sx:{fontWeight:L===((te=a.gameData)==null?void 0:te.winnerIdx)?"bold":"normal",bgcolor:L===((ne=a.gameData)==null?void 0:ne.winnerIdx)?"#e8f5e9":"#f5f5f5"}},L)}))||a.studentName}):V?(()=>{var te,ne,me;const O=(te=a.gameData)==null?void 0:te.player1,L=(ne=a.gameData)==null?void 0:ne.player2,X=(me=a.gameData)==null?void 0:me.winner;return!O||!L?e.jsx(j,{variant:"body2",children:a.studentName}):e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[e.jsx(j,{variant:"body2",fontWeight:X==="player1"?"bold":"normal",children:O.name}),e.jsxs(j,{variant:"body2",color:"text.secondary",children:[O.score??0," - ",L.score??0]}),e.jsx(j,{variant:"body2",fontWeight:X==="player2"?"bold":"normal",children:L.name}),X&&e.jsx(Ie,{fontSize:"small",sx:{color:"#ffc107"}})]})})():e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[A===0&&m.length>1&&e.jsx(Ie,{fontSize:"small",sx:{color:"#ffc107"}}),a.studentName]})}),e.jsx(d,{align:"center",children:S?e.jsxs(l,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:.5},children:[e.jsxs(j,{variant:"body2",fontWeight:"bold",children:[((Ce=(ee=a.gameData)==null?void 0:ee.team1)==null?void 0:Ce.score)??0," – ",((w=(s=a.gameData)==null?void 0:s.team2)==null?void 0:w.score)??0]}),e.jsx(P,{label:((u=a.gameData)==null?void 0:u.winner)==="team1"?`🏆 ${(H=(E=a.gameData)==null?void 0:E.team1)==null?void 0:H.name}`:((Y=a.gameData)==null?void 0:Y.winner)==="team2"?`🏆 ${(le=(ie=a.gameData)==null?void 0:ie.team2)==null?void 0:le.name}`:r("result.draw"),size:"small",sx:{fontWeight:"bold",...((F=a.gameData)==null?void 0:F.winner)==="team1"&&{bgcolor:"#2563eb",color:"white"},...((ve=a.gameData)==null?void 0:ve.winner)==="team2"&&{bgcolor:"#dc2626",color:"white"}}})]}):W?e.jsx(P,{label:`🏆 ${((Te=a.gameData)==null?void 0:Te.winnerName)||"—"}`,size:"small",sx:{fontWeight:"bold",bgcolor:"#11998e",color:"white"}}):V?(()=>{var X,te,ne,me,Ae;const O=(X=a.gameData)==null?void 0:X.winner,L=O==="player1"?(ne=(te=a.gameData)==null?void 0:te.player1)==null?void 0:ne.name:O==="player2"?(Ae=(me=a.gameData)==null?void 0:me.player2)==null?void 0:Ae.name:null;return L?e.jsx(P,{label:`🏆 ${L}`,size:"small",sx:{fontWeight:"bold",bgcolor:"#ffc107",color:"#333"}}):e.jsx(j,{variant:"body2",color:"text.secondary",children:"—"})})():e.jsx(P,{label:`${a.score}/${a.maxScore}`,size:"small",color:$>=70?"success":$>=50?"warning":"error",sx:{fontWeight:"bold"}})}),e.jsx(d,{align:"center",children:e.jsxs(l,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.5},children:[e.jsx(pt,{fontSize:"small",color:"action"}),oe(a.duration)]})}),e.jsx(d,{align:"right",children:ce(a.completedAt)}),q&&e.jsx(d,{align:"center",padding:"none",children:N&&e.jsx(Z,{title:r(v?"details.hideDetail":f?"details.viewDetail":"details.proFeature"),children:e.jsx(M,{size:"small",onClick:O=>{f?i(v?null:a.id):(O.stopPropagation(),I())},endIcon:f?v?e.jsx(tt,{fontSize:"small"}):e.jsx(nt,{fontSize:"small"}):e.jsx(Ee,{fontSize:"small"}),sx:{textTransform:"none",color:f?"text.secondary":"#f59e0b",fontWeight:f?"normal":"bold"},children:r(v?"details.hideDetail":f?"details.viewDetail":"details.viewDetailPro")})})})]}),q&&v&&N&&e.jsx(ue,{children:e.jsx(d,{colSpan:6,sx:{p:0,bgcolor:"#fafafa"},children:e.jsxs(l,{sx:{px:3,py:1.5},children:[e.jsx(j,{variant:"caption",fontWeight:"bold",color:"text.secondary",sx:{display:"block",mb:1},children:r("details.itemDetailTitle")}),e.jsx(rt,{dense:!0,disablePadding:!0,children:c.SubmissionDetailRenderer&&e.jsx(c.SubmissionDetailRenderer,{submission:a,assignment:t,t:r})})]})})})]},a.id)})})]})})]}),e.jsxs(Ve,{sx:{p:2,justifyContent:"space-between"},children:[e.jsxs(l,{sx:{display:"flex",gap:2},children:[m.length>0&&e.jsx(Z,{title:f||!q?"":r("details.downloadExcelFreeNote"),children:e.jsx(M,{variant:"outlined",startIcon:e.jsx(mt,{}),onClick:()=>vt(t,m,f),children:r("details.downloadExcel",{defaultValue:"Tải Excel"})})}),se&&e.jsxs(M,{variant:f?"contained":"outlined",onClick:()=>{f?(n(),D(c.reportRoute(t.id))):I()},sx:f?{background:`linear-gradient(135deg, ${c.color||"#667eea"} 0%, ${c.color||"#764ba2"} 100%)`,color:"#fff"}:{color:"#f59e0b",borderColor:"#f59e0b"},endIcon:!f&&e.jsx(Ee,{fontSize:"small"}),children:[t.gameType==="interactive_image"?r("details.reports.fullImage"):r("details.reports.fullQuiz"),!f&&r("details.reports.proSuffix")]})]}),e.jsx(M,{onClick:n,children:r("common.close")})]})]}):null}function ln(){const o=Le(),{t:n}=He("assignment"),{currentUser:t}=st(),[r,h]=C.useState(!0),[p,m]=C.useState(""),[x,k]=C.useState([]),[i,_]=C.useState({}),[g,D]=C.useState([]),[c,T]=C.useState(null),[z,y]=C.useState(!1),[I,f]=C.useState(null),[S,W]=C.useState(null),[V,q]=C.useState(!1),[se,oe]=C.useState(null),[ce,B]=C.useState(!1),[R,J]=C.useState(!1),[de,pe]=C.useState(null);C.useEffect(()=>{t&&a()},[t]);const a=async()=>{h(!0),m("");try{const[s,w]=await Promise.all([it(t.uid),gt(t.uid)]);k(s),D(w);const u={};await Promise.all(s.map(async E=>{u[E.id]=await lt(E.id)})),_(u)}catch(s){console.error("Error loading assignments:",s),m(n("history.loadError"))}finally{h(!1)}},A=s=>{T(s),y(!0)},$=s=>{W(s),q(!0)},v=async(s,w)=>{if(w.stopPropagation(),!!window.confirm(n("history.deleteArchiveConfirm",{title:N(s)})))try{oe(s.id),await _e(s.id),D(u=>u.filter(E=>
1E.id!==s.id))}catch(u){console.error("Error deleting session archive:",u),m(n("errors.endFailed"))}finally{oe(null)}},N=s=>{const w=s.createdAt,u=w!=null&&w.toDate?w.toDate():new Date,E=String(u.getHours()).padStart(2,"0"),H=String(u.getMinutes()).padStart(2,"0"),Y=String(u.getDate()).padStart(2,"0"),ie=String(u.getMonth()+1).padStart(2,"0"),le=u.getFullYear();return`Phiên ${E}h${H} ngày ${Y}/${ie}/${le}`},he=(s,w)=>{w.stopPropagation(),navigator.clipboard.writeText(s)},Q=(s,w)=>{w.stopPropagation();const u=`${window.location.origin}/join?code=${s}`;navigator.clipboard.writeText(u)},U=x.filter(s=>De(s.expiresAt)||s.status==="ended").length+g.length,G=async(s,w)=>{if(w.stopPropagation(),!!window.confirm(n("history.endConfirm",{title:s.title})))try{f(s.id),await ct(s.id,s.joinCode),await a()}catch(u){console.error("Error ending assignment:",u),m(n("errors.endFailed"))}finally{f(null)}},ae=n("history.stats",{count:x.length+g.length}),je=n("history.deleteExpiredBtn",{count:U}),fe=n("history.deleteExpiredTip"),ye=n("history.empty.title"),we=n("history.empty.description"),be=n("history.empty.button"),K={stt:n("history.table.stt"),reminderName:n("history.table.reminderName"),lesson:n("history.table.lesson"),codeLink:n("history.table.codeLink"),status:n("history.table.status"),submitted:n("history.table.submitted"),actions:n("history.table.actions")},ee={title:n(de!==null?"history.deleteModal.successTitle":"history.deleteModal.title"),successMsg:n("history.deleteModal.successMsg",{count:de}),confirmMsg:n("history.deleteModal.confirmMsg",{count:U}),warning:n("history.deleteModal.warning"),confirmBtn:n(R?"history.deleteModal.deleting":"history.deleteModal.confirmBtn")},Ce=async()=>{J(!0);try{const[s]=await Promise.all([dt(t.uid,x),...g.map(w=>_e(w.id))]);pe(s+g.length),await a()}catch(s){console.error("Error deleting expired assignments:",s),m(n("history.deleteError")),B(!1)}finally{J(!1)}};return e.jsxs(ot,{active:"assignments",children:[e.jsxs(ft,{maxWidth:"xl",sx:{py:0},disableGutters:!0,children:[e.jsxs(l,{sx:{mb:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:2},children:[e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx($e,{sx:{fontSize:40,color:"#667eea"}}),e.jsx(l,{children:e.jsx(j,{variant:"body2",color:"text.secondary",children:ae})})]}),U>0&&e.jsxs(l,{sx:{textAlign:"right"},children:[e.jsx(M,{variant:"outlined",color:"warning",onClick:()=>{B(!0),pe(null)},sx:{fontWeight:600},children:je}),e.jsx(j,{variant:"caption",color:"text.secondary",display:"block",sx:{mt:.5},children:fe})]})]}),p&&e.jsx(ke,{severity:"error",sx:{mb:3},children:p}),r?e.jsx(l,{sx:{display:"flex",justifyContent:"center",py:8},children:e.jsx(ge,{})}):x.length===0&&g.length===0?e.jsxs(Se,{sx:{p:6,textAlign:"center"},children:[e.jsx($e,{sx:{fontSize:80,color:"#ccc",mb:2}}),e.jsx(j,{variant:"h6",color:"text.secondary",gutterBottom:!0,children:ye}),e.jsx(j,{variant:"body2",color:"text.secondary",sx:{mb:3},children:we}),e.jsx(M,{variant:"contained",onClick:()=>o("/library"),sx:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"},children:be})]}):e.jsx(Ye,{component:Se,children:e.jsxs(Ke,{children:[e.jsx(Fe,{children:e.jsxs(ue,{sx:{bgcolor:"#f5f5f5"},children:[e.jsx(d,{width:40,children:e.jsx("strong",{children:K.stt})}),e.jsx(d,{children:e.jsx("strong",{children:K.reminderName})}),e.jsx(d,{children:e.jsx("strong",{children:K.lesson})}),e.jsx(d,{align:"center",width:160,children:e.jsx("strong",{children:K.codeLink})}),e.jsx(d,{align:"center",width:140,children:e.jsx("strong",{children:K.status})}),e.jsx(d,{align:"center",width:80,children:e.jsx("strong",{children:K.submitted})}),e.jsx(d,{align:"center",width:90,children:e.jsx("strong",{children:K.actions})})]})}),e.jsxs(Oe,{children:[x.map((s,w)=>{var le;const u=Ue(s.gameType),E=De(s.expiresAt),H=s.status==="ended",Y=!E&&!H,ie=i[s.id]||0;return e.jsxs(ue,{hover:!0,sx:{cursor:"pointer"},onClick:()=>A(s),children:[e.jsx(d,{children:w+1}),e.jsx(d,{children:e.jsx(j,{variant:"subtitle2",fontWeight:"bold",children:s.title})}),e.jsx(d,{children:e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(l,{sx:{width:28,height:28,borderRadius:1,flexShrink:0,bgcolor:`${(u==null?void 0:u.color)||"#667eea"}20`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1rem"},children:(u==null?void 0:u.icon)||"🎮"}),e.jsxs(l,{children:[e.jsx(j,{variant:"body2",children:((le=s.gameSnapshot)==null?void 0:le.title)||"—"}),e.jsx(j,{variant:"caption",color:"text.secondary",children:n(`gameTypes.${s.gameType}.label`,{defaultValue:(u==null?void 0:u.label)||s.gameType})})]})]})}),e.jsx(d,{align:"center",children:e.jsxs(l,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.5},children:[e.jsx(P,{label:s.joinCode,size:"small",color:Y?"primary":"default",sx:{fontFamily:"monospace",fontWeight:"bold"}}),Y&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{title:n("history.table.copyCode"),children:e.jsx(re,{size:"small",onClick:F=>he(s.joinCode,F),children:e.jsx(Ne,{fontSize:"small"})})}),e.jsx(Z,{title:n("history.table.copyLink"),children:e.jsx(re,{size:"small",onClick:F=>Q(s.joinCode,F),color:"primary",children:e.jsx(Ge,{fontSize:"small"})})})]})]})}),e.jsx(d,{align:"center",children:e.jsx(P,{label:H?n("history.table.statusEnded"):E?n("history.table.statusExpired"):Qe(s.expiresAt),size:"small",color:Y?"success":"error"})}),e.jsx(d,{align:"center",children:e.jsx(P,{label:ie,size:"small",variant:"outlined",color:ie>0?"primary":"default"})}),e.jsx(d,{align:"center",children:e.jsxs(l,{sx:{display:"flex",gap:.5,justifyContent:"center"},children:[e.jsx(Z,{title:n("history.table.viewDetail"),children:e.jsx(re,{size:"small",onClick:F=>{F.stopPropagation(),A(s)},children:e.jsx(Re,{})})}),Y&&e.jsx(Z,{title:n("history.table.endAssignment"),children:e.jsx(re,{size:"small",color:"error",disabled:I===s.id,onClick:F=>G(s,F),children:I===s.id?e.jsx(ge,{size:18,color:"inherit"}):e.jsx(yt,{})})})]})})]},s.id)}),g.map((s,w)=>{var u,E;return e.jsxs(ue,{hover:!0,sx:{cursor:"pointer"},onClick:()=>$(s),children:[e.jsx(d,{children:x.length+w+1}),e.jsx(d,{children:e.jsx(j,{variant:"subtitle2",fontWeight:"bold",children:N(s)})}),e.jsx(d,{children:e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(l,{sx:{width:28,height:28,borderRadius:1,flexShrink:0,bgcolor:"#667eea20",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1rem"},children:"⏱️"}),e.jsxs(l,{children:[e.jsx(j,{variant:"body2",children:s.quizTitle||"—"}),e.jsx(j,{variant:"caption",color:"text.secondary",children:s.mode==="free"?"Quiz Có Nhịp — Tự do":"Quiz Có Nhịp — Nhịp độ"})]})]})}),e.jsx(d,{align:"center",children:e.jsx(P,{label:"—",size:"small",variant:"outlined"})}),e.jsx(d,{align:"center",children:e.jsx(P,{label:"Đã kết thúc",size:"small",color:"default"})}
1),e.jsx(d,{align:"center",children:e.jsx(P,{label:((u=s.rankings)==null?void 0:u.length)||0,size:"small",variant:"outlined",color:(((E=s.rankings)==null?void 0:E.length)||0)>0?"primary":"default"})}),e.jsx(d,{align:"center",children:e.jsxs(l,{sx:{display:"flex",gap:.5,justifyContent:"center"},children:[e.jsx(Z,{title:n("history.table.viewDetail"),children:e.jsx(re,{size:"small",onClick:H=>{H.stopPropagation(),$(s)},children:e.jsx(Re,{})})}),e.jsx(Z,{title:n("history.table.deleteArchive"),children:e.jsx(re,{size:"small",color:"error",disabled:se===s.id,onClick:H=>v(s,H),children:se===s.id?e.jsx(ge,{size:18,color:"inherit"}):e.jsx(wt,{})})})]})})]},s.id)})]})]})})]}),e.jsxs(Me,{open:ce,onClose:()=>!R&&B(!1),maxWidth:"xs",fullWidth:!0,children:[e.jsx(We,{fontWeight:"bold",children:ee.title}),e.jsx(Be,{children:de!==null?e.jsx(j,{children:ee.successMsg}):e.jsxs(l,{children:[e.jsx(j,{sx:{mb:1.5},children:ee.confirmMsg}),e.jsx(ke,{severity:"warning",sx:{fontSize:"0.85rem"},children:ee.warning})]})}),e.jsx(Ve,{sx:{p:2},children:de!==null?e.jsx(M,{variant:"contained",onClick:()=>B(!1),children:n("common.close")}):e.jsxs(e.Fragment,{children:[e.jsx(M,{onClick:()=>B(!1),disabled:R,children:n("common.cancel")}),e.jsx(M,{variant:"contained",color:"error",onClick:Ce,disabled:R,startIcon:R?e.jsx(ge,{size:16,color:"inherit"}):null,children:ee.confirmBtn})]})})]}),e.jsx(Tt,{open:z,onClose:()=>{y(!1),T(null)},assignment:c}),e.jsx(jt,{open:V,onClose:()=>{q(!1),W(null)},history:S==null?void 0:S.history,loading:!1,rankings:(S==null?void 0:S.rankings)||[],quizData:S==null?void 0:S.quizData})]})}export{ln as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.