1import{j as e,V as we,T as ct,D as Ut,a as tt,I as es,F as vt,P as ts,p as ss}from"./vendor-pdf-CAs81Xpx.js";import{R as Ct,a as b,d as rs,i as as}from"./vendor-react-WakpR0wD.js";import{b as st}from"./vendor-charts-Dhh0UBmn.js";import{aA as He,X as Yt,i as Ee,C as $t,s as Tt,p as ht,o as ls,c5 as ns,E as os,ap as is}from"./index-BQksJ-U7.js";import{m as cs,c as Ze,T as ds,g as At,d as It,b as rt,q as _t,e as Lt}from"./vendor-firestore-C84qCbTf.js";import{a6 as xs,$ as Pt,a1 as ms}from"./vendor-firebase-core-DfI3m37w.js";import{M as us}from"./MainLayout-Svkkv2is.js";import{B as hs}from"./BackButton-voeEGv1I.js";import{S as at}from"./vendor-swal-BgUaMQbp.js";import{F as bs}from"./FileSaver.min-CB2AuxH4.js";import{a as fs}from"./pdfArchiveUtils-TL2GCZ7K.js";import{T as ps}from"./ThaiDatePicker-CalwPZw0.js";import{F as gs}from"./file-down-ClSTePcc.js";import{C as ft}from"./circle-check-6jn1nmmv.js";import{A as ys}from"./AcademicYearSemesterFilter-BFMoMFpz.js";import{c as js}from"./remediationUtils-v4xztunY.js";import{R as vs}from"./refresh-cw-g24bzswf.js";import{L as ks}from"./layers-BqW9rdU4.js";import{G as Ss}from"./graduation-cap-CekbwC8_.js";import{T as Ns}from"./triangle-alert-ChTRPd_F.js";import{C as Et}from"./circle-alert-PQlQFZ8S.js";import"./vendor-firebase-auth-DWo6Js8N.js";import"./Navbar-BYlHuWeG.js";import"./ProfileAvatar-C57cy0cU.js";import"./users-FNKwIhe4.js";import"./profile-DDlO39M8.js";import"./index-CTJayJtD.js";import"./SkeletonLoader-ODolvGj-.js";import"./AIAssistantWidget-DjAJzlhp.js";import"./arrow-left-Bz7UVE-D.js";import"./calendar-range-BtbhMTlm.js";import"./learnerActivityUtils-DGtKX1gk.js";const kt={0:.362,1:.362,2:.362,3:.362,4:.362,5:.362,6:.362,7:.362,8:.362,9:.362," ":.216,"!":.147,'"':.208,"#":.403,$:.361,"%":.585,"&":.423,"'":.12,"(":.19,")":.19,"*":.285,"+":.411,",":.162,"-":.216,".":.162,"/":.27,":":.162,";":.162,"<":.411,"=":.411,">":.411,"?":.283,"@":.536,A:.4,B:.378,C:.406,D:.431,E:.351,F:.351,G:.425,H:.441,I:.147,J:.264,K:.376,L:.353,M:.548,N:.441,O:.486,P:.378,Q:.487,R:.379,S:.352,T:.379,U:.466,V:.39,W:.588,X:.418,Y:.366,Z:.424,"[":.196,"\\":.262,"]":.196,"^":.412,_:.352,"`":.204,a:.344,b:.401,c:.331,d:.401,e:.374,f:.206,g:.311,h:.39,i:.143,j:.155,k:.316,l:.2,m:.601,n:.39,o:.398,p:.401,q:.401,r:.217,s:.282,t:.238,u:.39,v:.341,w:.507,x:.318,y:.337,z:.321,"{":.208,"|":.153,"}":.208,"~":.416," ":.216,à¸:.386,à¸:.378,à¸:.382,à¸:.393,à¸
:.393,à¸:.408,à¸:.294,à¸:.367,à¸:.377,à¸:.38,à¸:.384,à¸:.519,à¸:.519,à¸:.425,à¸:.425,à¸:.343,à¸:.461,à¸:.532,à¸:.543,à¸:.391,à¸:.391,à¸:.378,à¸:.43,à¸:.335,à¸:.42,à¸:.428,à¸:.428,à¸:.381,à¸:.381,à¸:.447,à¸:.447,ภ:.425,ม:.4,ย:.375,ร:.322,ฤ:.378,ล:.381,ฦ:.425,ว:.335,ศ:.393,ษ:.438,ส:.381,ห:.427,ฬ:.454,à¸:.387,ฮ:.372,ฯ:.391,ะ:.357,"ั":0,า:.316,ำ:.316,"ิ":0,"ี":0,"ึ":0,"ื":0,"ุ":0,"ู":0,"ฺ":0,"฿":.411,à¹:.203,à¹:.377,à¹:.237,à¹:.242,à¹:.244,à¹
:.205,à¹:.399,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":.45,"à¹":.449,"à¹":.449,"à¹":.449,"à¹":.449,"à¹":.449,"à¹":.449,"à¹":.449,"à¹":.449,"à¹":.449,"à¹":.449,"à¹":.522,"à¹":.697},Kt={0:.378,1:.378,2:.378,3:.378,4:.378,5:.378,6:.378,7:.378,8:.378,9:.378," ":.226,"!":.168,'"':.291,"#":.462,$:.367,"%":.688,"&":.486,"'":.169,"(":.244,")":.244,"*":.343,"+":.417,",":.172,"-":.226,".":.172,"/":.276,":":.172,";":.172,"<":.417,"=":.417,">":.417,"?":.289,"@":.572,A:.451,B:.396,C:.432,D:.459,E:.358,F:.358,G:.454,H:.472,I:.163,J:.282,K:.411,L:.359,M:.574,N:.472,O:.518,P:.39,Q:.518,R:.395,S:.365,T:.421,U:.482,V:.422,W:.612,X:.426,Y:.396,Z:.451,"[":.234,"\\":.268,"]":.234,"^":.418,_:.376,"`":.21,a:.367,b:.435,c:.347,d:.435,e:.391,f:.254,g:.332,h:.423,i:.163,j:.171,k:.34,l:.213,m:.636,n:.423,o:.412,p:.431,q:.431,r:.246,s:.296,t:.258,u:.418,v:.358,w:.48,x:.349,y:.361,z:.358,"{":.255,"|":.177,"}":.255,"~":.422," ":.226,à¸:.391,à¸:.415,à¸:.431,à¸:.403,à¸
:.403,à¸:.453,à¸:.318,à¸:.39,à¸:.405,à¸:.415,à¸:.431,à¸:.565,à¸:.565,à¸:.425,à¸:.425,à¸:.372,à¸:.492,à¸:.551,à¸:.576,à¸:.405,à¸:.405,à¸:.391,à¸:.438,à¸:.358,à¸:.433,à¸:.445,à¸:.445,à¸:.414,à¸:.414,à¸:.482,à¸:.482,ภ:.425,ม:.417,ย:.386,ร:.329,ฤ:.391,ล:.399,ฦ:.425,ว:.379,ศ:.403,ษ:.461,ส:.399,ห:.438,ฬ:.468,à¸:.394,ฮ:.385,ฯ:.38,ะ:.34,"ั":0,า:.336,ำ:.336,"ิ":0,"ี":0,"ึ":0,"ื":0,"ุ":0,"ู":0,"ฺ":0,"฿":.389,à¹:.208,à¹:.395,à¹:.252,à¹:.269,à¹:.252,à¹
:.209,à¹:.437,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":0,"à¹":.45,"à¹":.456,"à¹":.456,"à¹":.456,"à¹":.456,"à¹":.456,"à¹":.456,"à¹":.456,"à¹":.456,"à¹":.456,"à¹":.456,"à¹":.525,"à¹":.697},ws=.5,Bt=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter("th",{granularity:"grapheme"}):null,Dt=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter("th",{granularity:"word"}):null,Cs=s=>Bt?Array.from(Bt.segment(s)).map(t=>t.segment):Array.from(s),Ft=s=>Dt?Array.from(Dt.segment(s)).map(t=>t.segment):s.split(/(\s+)/),pt=s=>s===" "||s===" ",$s=s=>kt[s]??ws,Vt=s=>Array.from(s).reduce((t,i)=>t+$s(i),0),gt=(s,t,i=15,x=0,C=[])=>{const f=$=>Vt($)*i,S=[];if(C.length){const $=C.map(_=>_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),G=s.split(new RegExp(`(${$.join("|")})`));for(const _ of G)_&&(C.includes(_)?S.push(_):S.push(...Ft(_)))}else S.push(...Ft(s));const d=[];let g=[],N=0;const B=$=>t-($===0?x:0)-.5,k=()=>{for(;g.length&&pt(g[g.length-1]);)g.pop();d.push(g),g=[],N=0};for(const $ of S){const G=Cs($),_=G.reduce((L,A)=>L+f(A),0),F=G.every(pt);if(!(g.length===0&&F)){if(!F&&N+_>B(d.length)&&g.length>0&&k(),!F&&_>B(d.length)){for(const L of G){const A=f(L);N+A>B(d.length)&&g.length>0&&k(),g.push(L),N+=A}continue}g.push(...G),N+=_}}return g.length&&k(),d},Mt=({text:s,width:t,fontSize:i=15,lineHeight:x=1.3,firstLineIndent:C=0,noBreak:f,style:S})=>{const d=k=>Vt(k)*i,g=gt(s,t,i,C,f),N=i*x,B={fontSize:i,lineHeight:x};return e.jsx(we,{style:S,children:g.map((k,$)=>{const G=$===g.length-1,_=$===0?C:0;return G?e.jsx(we,{style:{paddingLeft:_,height:N},wrap:!1,children:e.jsx(ct,{style:B,children:k.join("")})},$):e.jsx(we,{style:{flexDirection:"row",justifyContent:"space-between",paddingLeft:_,height:N},wrap:!1,children:k.map((F,L)=>pt(F)?e.jsx(we,{style:{width:d(F),flexShrink:0}},L):e.jsx(ct,{style:{...B,flexShrink:0},children:F},L))},$)})})};vt.register({family:"TH Sarabun PSK",src:"/fonts/THSarabunNew.ttf",fontWeight:"normal"});vt.register({family:"TH Sarabun PSK",src:"/fonts/THSarabunNew-Bold.ttf",fontWeight:"bold"});vt.registerHyphenationCallback(s=>[s]);const Oe="TH Sarabun PSK",P=s=>{if(s==null)return"";const t=["à¹","à¹","à¹","à¹","à¹","à¹","à¹","à¹","à¹","à¹"];return String(s).replace(/[0-9]/g,i=>t[parseInt(i,10)])},it=["4","3.5","3","2.5","2","1.5","1","0","ร","มส","à¸","มà¸"],Ts={4:"à¹","3.5":"à¹.à¹",3:"à¹","2.5":"à¹.à¹",2:"à¹","1.5":"à¹.à¹",1:"à¹",0:"à¹",ร:"ร",มส:"มส",à¸:"à¸",มà¸:"มà¸"},Ge=["3","2","1","0"],As={3:"à¹",2:"à¹",1:"à¹",0:"à¹"},Is=()=>it.reduce((s,t)=>({...s,[t]:0}),{}),_s=()=>Ge.reduce((s,t)=>({...s,[t]:0}),{}),ze=(s,t)=>t?(s/t*100).toFixed(1):"0.0",Xt=842/1755,qt=kt["."],dt=(s,t)=>Array.from(s).reduce((i,x)=>i+(kt[x]??.5),0)*t,yt=(s,t)=>Array.from(s).reduce((i,x)=>i+(Kt[x]??.5),0)*t,jt=Kt["."],Se=(s,t=16)=>".".repeat(Math.max(0,Math.floor(s/(qt*t)))),ye=(s,t,i=16)=>
1Se(t-s,i),Le="  ",Be=(s,t,i)=>({position:"absolute",top:s,left:t,...i}),c=({cy:s,x:t,size:i=16,bold:x,w:C,align:f,children:S})=>e.jsx(ct,{style:{...Be(s-i/2,t),fontFamily:Oe,fontSize:i,fontWeight:x?"bold":"normal",lineHeight:1,...C?{width:C,textAlign:f||"left"}:{}},children:S}),Ne=({cy:s,x:t,width:i,data:x,size:C=16,align:f="center",bold:S,inset:d=0})=>{const g=S?yt:dt,N=i-d,B=x?Math.min(C,C*(N-2)/Math.max(g(x,C),1)):C;return e.jsxs(e.Fragment,{children:[e.jsx(c,{cy:s,x:t,size:C,bold:S,children:".".repeat(Math.max(0,Math.floor(i/((S?jt:qt)*C))))}),x?e.jsx(c,{cy:s-1.6,x:t+d,size:B,w:N,align:f,bold:S,children:x}):null]})},zt=({cy:s,leftX:t,rightX:i,leftDots:x,rightDots:C,spaceBeforeRightDots:f,sem:S,year:d})=>{const g="à¸à¸£à¸°à¸à¸³à¸ าà¸à¹à¸£à¸µà¸¢à¸à¸à¸µà¹",N=f?"à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²Â ":"à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²";return S||d?e.jsx(c,{cy:s,x:449.3-150,w:300,align:"center",bold:!0,children:`${g} ${S||"............"}   à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸² ${d||"................"}`}):e.jsxs(e.Fragment,{children:[e.jsx(c,{cy:s,x:t,bold:!0,children:g}),e.jsx(Ne,{cy:s,x:t+yt(g,16),width:x*jt*16,data:S||void 0,bold:!0}),e.jsx(c,{cy:s,x:i,bold:!0,children:N}),e.jsx(Ne,{cy:s,x:i+yt(N,16),width:C*jt*16,data:d||void 0,bold:!0})]})},qe=.5,Ls="#000000",he="#C2D69B",de="#FFFF99",Pe="#F7F34A",T=({x0:s,x1:t,y0:i,y1:x,fill:C,text:f,bold:S,align:d="center",size:g=16,noBorder:N,labelH:B})=>{const k=t-s,$=f?Math.min(g,g*(k-(d==="left"?6:2))/Math.max(dt(f,g),1)):g;return e.jsx(we,{style:{position:"absolute",left:s-qe/2,top:i-qe/2,width:k+qe,height:x-i+qe,backgroundColor:C,borderWidth:N?0:qe,borderColor:Ls,borderStyle:"solid",justifyContent:B?"flex-start":"center",alignItems:d==="center"?"center":"flex-start",paddingLeft:d==="left"?3:0,paddingTop:B?Math.max(0,(B-$)/2-.5):0},children:f?e.jsx(ct,{style:{fontFamily:Oe,fontSize:$,fontWeight:S?"bold":"normal",lineHeight:1,position:"relative",top:-.5},wrap:!1,children:f}):null})},be=s=>s*Xt,Ps=.48,We=s=>s*Xt+Ps,Es=[147,199,546,665,747,833,933,988,1047,1099.5,1168,1221,1280,1332,1384,1441,1500,1559,1618].map(We),Bs=[338,389,736,854,937,1022,1123,1224,1327,1431,1535].map(We),Rt=585,Re=(s,t=56)=>s?`( ${s} )`:`( ${".".repeat(t)} )`,lt=dt("ลà¸à¸à¸·à¹à¸",16),bt=s=>s.courseTitle||"-",nt=s=>s.classLevel||"",Gt=({schoolName:s,docNo:t="",dateStr:i="",academicYear:x,semester:C,learningArea:f="",teacherName:S,courses:d=[],targetPercentage:g="",summarySheetCount:N="1",characteristicsSheetCount:B="1",reviewerName:k="",deputyDirectorName:$="",directorName:G=""})=>{const _=C==="annual"||C==="0",F=!C||_?"":P(C),L=x?P(x):"",A=s!=null&&s.startsWith("à¹à¸£à¸à¹à¸£à¸µà¸¢à¸")?s:`à¹à¸£à¸à¹à¸£à¸µà¸¢à¸${s||""}`,le=d.length,ne=d,X=it.reduce((a,o)=>(a[o]=ne.reduce((n,w)=>{var z;return n+(((z=w.gradeBuckets)==null?void 0:z[o])||0)},0),a),{}),D=ne.reduce((a,o)=>a+(o.studentCount||0),0),je=X[4]+X["3.5"]+X[3],xe=X[0]+X.ร+X.มส,Ce=Ge.reduce((a,o)=>(a[o]=d.reduce((n,w)=>{var z;return n+(((z=w.charBuckets)==null?void 0:z[o])||0)},0),a),{}),K=d.reduce((a,o)=>a+(o.studentCount||0),0),fe=g?P(g):D?P(ze(je,D)):"",J=71.5,se=467.6,$e=18,I=18,U=["à¸à¸²à¸£à¸à¸±à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸à¸²à¸£à¸ªà¸à¸","à¹à¸¥à¸°à¹à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸£à¸²à¸¢à¸à¸¸à¸à¸à¸¥"],Z=15,oe=_?`à¸à¸£à¸°à¸à¸³à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²${L?` ${L}`:Se(60)}`:`à¸à¸£à¸°à¸à¸³à¸ าà¸à¹à¸£à¸µà¸¢à¸à¸à¸µà¹${F?` ${F} `:Se(21)}à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²${L?` ${L}`:Se(34)}`,me=`à¸à¸²à¸¡à¸à¸µà¹${A}${Le}à¸à¸³à¸«à¸à¸à¸¡à¸²à¸à¸£à¸à¸²à¸à¸à¸²à¸£à¸à¸à¸´à¸à¸±à¸à¸´à¸à¸²à¸à¸à¹à¸²à¸à¸à¸²à¸£à¸§à¸±à¸à¸à¸¥ à¹à¸¥à¸°à¸à¸£à¸°à¹à¸¡à¸´à¸à¸à¸¥ à¸à¸²à¸£à¸à¸±à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸à¸²à¸£à¸ªà¸à¸ à¹à¸à¸¢à¹à¸«à¹à¸¡à¸µà¸à¸²à¸£à¸à¸³à¸ªà¹à¸à¹à¸à¸à¸ªà¸£à¸¸à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸ à¹à¸à¸à¸ªà¸£à¸¸à¸à¸à¸¥à¸à¸¸à¸à¸¥à¸±à¸à¸©à¸à¸°à¸à¸±à¸à¸à¸¶à¸à¸à¸£à¸°à¸ªà¸à¸à¹ à¹à¸¥à¸°à¹à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸£à¸²à¸¢à¸à¸¸à¸à¸à¸¥${Le}à¹à¸¡à¸·à¹à¸à¸à¸³à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸à¸²à¸£à¸ªà¸à¸à¹à¸ªà¸£à¹à¸à¸ªà¸´à¹à¸à¹à¸¥à¹à¸§${Le}à¸à¹à¸²à¸à¹à¸à¹à¸²`+(S?` ${S} `:".".repeat(53))+"สัà¸à¸à¸±à¸à¸à¸¥à¸¸à¹à¸¡à¸ªà¸²à¸£à¸°à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸£à¸¹à¹"+(f?` ${f} `:".".repeat(54))+`à¸à¸¶à¸à¸à¸à¸£à¸²à¸¢à¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸ ${_?`à¸à¸£à¸°à¸à¸³à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²${L?` ${L}`:Se(60)}`:`à¸à¸£à¸°à¸à¸³à¸ าà¸à¹à¸£à¸µà¸¢à¸à¸à¸µà¹ ${F?`${F} `:`${".".repeat(9)} `}à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²${L?` ${L}`:".".repeat(19)}`}${Le}รายละà¹à¸à¸µà¸¢à¸à¸à¸±à¸à¸à¸µà¹`,ee=`รายวิà¸à¸²à¸à¸µà¹à¸à¸³à¹à¸à¸´à¸à¸à¸²à¸£à¸à¸±à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸à¸²à¸£à¸ªà¸à¸à¸à¸±à¹à¸à¸«à¸¡à¸ à¸à¸³à¸à¸§à¸${le?` ${P(le)} `:".".repeat(19)}วิà¸à¸² (ระà¸à¸¸à¸à¸¸à¸à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸µà¹à¸ªà¸à¸ รวม IS, หà¸à¹à¸²à¸à¸µà¹à¸à¸¥à¹à¸¡à¸·à¸à¸, à¸à¸¥à¸¸à¹à¸¡à¸ªà¸à¹à¸ ยà¸à¹à¸§à¹à¸à¸à¸¸à¸¡à¸à¸¸à¸¡)`,Qe=gt(me,se,Z,72,U).length,De=gt(ee,se,16,72).length,ve=Math.max(5,d.length),pe=(Qe-5)*I,Ye=(De-2)*I,xt=(ve-5)*$e,Fe=273.9,Ke=372.7+pe,mt=418.3+pe+Ye,Te=pe+Ye+xt,ie=789.2+Te>812,te=(a,o)=>{const n=w=>w+a;return e.jsxs(e.Fragment,{children:[e.jsxs(e.Fragment,{children:[e.jsx(c,{cy:n(516.7),x:107.4,children:"รวมà¹à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸à¸£à¸°à¸à¸³à¸£à¸²à¸¢à¸§à¸´à¸à¸² (à¸à¸.à¹) à¸à¸±à¹à¸à¸ªà¸´à¹à¸"}
1),e.jsx(c,{cy:n(516.7),x:349.7,children:"à¸à¸³à¸à¸§à¸"}),e.jsx(Ne,{cy:n(516.7),x:377.5,width:59,data:le?P(le):void 0}),e.jsx(c,{cy:n(516.7),x:436.5,children:"à¹à¸¥à¹à¸¡"})]}),e.jsx(c,{cy:n(543.5),x:143.4,children:"à¸à¸¶à¸à¹à¸£à¸µà¸¢à¸à¸¡à¸²à¹à¸à¸·à¹à¸à¹à¸à¸£à¸à¸à¸£à¸²à¸à¹à¸¥à¸°à¸à¸´à¸à¸²à¸£à¸à¸²"}),e.jsxs(c,{cy:n(571.8),x:290.7,children:["ลà¸à¸à¸·à¹à¸",ye(290.7+lt,495.5)]}),e.jsx(c,{cy:n(590),x:318.5,w:168,align:"center",children:Re(S,60)}),e.jsx(c,{cy:n(607.8),x:J,children:"à¸à¸²à¸à¸§à¸±à¸à¸à¸¥à¹à¸¥à¸°à¸à¸£à¸°à¹à¸¡à¸´à¸à¸à¸¥à¸à¸£à¸§à¸à¹à¸¥à¹à¸§"}),e.jsx(we,{style:Be(n(626.5)-5.55,72.4,{width:11.1,height:11.1,borderWidth:1.6,borderColor:"#000",borderStyle:"solid"})}),e.jsx(c,{cy:n(626.5),x:89.2,children:"à¸à¸¹à¸à¸à¹à¸à¸à¸à¸£à¸à¸à¹à¸§à¸"}),e.jsx(we,{style:Be(n(626.5)-5.55,180.4,{width:11.1,height:11.1,borderWidth:1.6,borderColor:"#000",borderStyle:"solid"})}),e.jsxs(c,{cy:n(626.5),x:196.2,children:["à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸/à¹à¸¡à¹à¸à¸£à¸à¸à¹à¸§à¸ ระà¸à¸¸",ye(196.2+dt("à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸/à¹à¸¡à¹à¸à¸£à¸à¸à¹à¸§à¸ ระà¸à¸¸",16),534.4)]}),e.jsxs(c,{cy:n(644.2),x:287.3,children:["ลà¸à¸à¸·à¹à¸",ye(287.3+lt,462.9)]}),e.jsx(c,{cy:n(644.2),x:462.9,children:"à¸à¸¹à¹à¸à¸£à¸§à¸"}),k?e.jsx(c,{cy:n(662.4),x:287.3,w:202,align:"center",size:15,children:Re(k)}):null,e.jsx(c,{cy:n(680.8),x:J,bold:!0,children:"à¸à¸§à¸²à¸¡à¹à¸«à¹à¸à¸£à¸à¸à¸à¸¹à¹à¸à¸³à¸à¸§à¸¢à¸à¸²à¸£à¸à¸¥à¸¸à¹à¸¡à¸à¸£à¸´à¸«à¸²à¸£à¸§à¸´à¸à¸²à¸à¸²à¸£"}),e.jsx(c,{cy:n(680.8),x:323.3,bold:!0,children:"à¸à¸§à¸²à¸¡à¹à¸«à¹à¸à¸à¸¹à¹à¸à¸³à¸à¸§à¸¢à¸à¸²à¸£à¹à¸£à¸à¹à¸£à¸µà¸¢à¸"}),e.jsx(c,{cy:n(698.9),x:73.4,children:ye(72,271)}),e.jsx(c,{cy:n(698.9),x:324.6,children:ye(323.8,522.8)}),e.jsx(c,{cy:n(717.2),x:73.4,children:ye(72,272)}),e.jsx(c,{cy:n(717.2),x:324.6,children:ye(323.8,523.8)}),e.jsxs(c,{cy:n(734.9),x:J,children:["ลà¸à¸à¸·à¹à¸",ye(J+lt,237.4)]}),e.jsxs(c,{cy:n(734.9),x:323.3,children:["ลà¸à¸à¸·à¹à¸",ye(323.3+lt,489.3)]}),e.jsx(c,{cy:n(753.1),x:65.4,w:200,align:"center",children:Re($,40)}),e.jsx(c,{cy:n(753.1),x:314.9,w:200,align:"center",children:Re(G,40)}),e.jsx(c,{cy:n(770.9),x:62.4,w:200,align:"center",children:"รà¸à¸à¸à¸¹à¹à¸à¸³à¸à¸§à¸¢à¸à¸²à¸£à¸à¸¥à¸¸à¹à¸¡à¸à¸£à¸´à¸«à¸²à¸£à¸§à¸´à¸à¸²à¸à¸²à¸£"}),e.jsxs(c,{cy:n(770.9),x:323.3,children:["à¸à¸¹à¹à¸à¸³à¸à¸§à¸¢à¸à¸²à¸£",A.replace(/ /g,Le)]}),e.jsx(c,{cy:n(789.2),x:61,w:200,align:"center",children:"............/......................./..............."}),e.jsx(c,{cy:n(789.2),x:311.5,w:200,align:"center",children:"............/......................./..............."})]})},ge=[{cy:208.7,no:"à¹.",label:"à¹à¸à¸à¸ªà¸£à¸¸à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸",count:N,unit:"à¹à¸à¹à¸"},{cy:226.4,no:"à¹.",label:"à¹à¸à¸à¸ªà¸£à¸¸à¸à¸à¸¥à¸à¸¸à¸à¸¥à¸±à¸à¸©à¸à¸°à¸à¸±à¸à¸à¸¶à¸à¸à¸£à¸°à¸ªà¸à¸à¹",count:B,unit:"à¹à¸à¹à¸"},{cy:244.7,no:"à¹.",label:"à¹à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸£à¸²à¸¢à¸à¸¸à¸à¸à¸¥ (à¸à¸.à¹)",count:le?String(le):"",unit:"à¹à¸¥à¹à¸¡"}],Ae=ne,Ie=Math.max(13,Ae.length),H=We(274),M=be(38.5),Ve=We(351),_e=Math.min(be(38.77),(Rt-130-Ve-2*be(38.5))/Ie),ue=Ve+Ie*_e,V=ue+be(38.5),r=V+be(38.5),l=Es,m=Math.min(14,_e*.78),u=Bs,p=Math.max(13,d.length),y=We(236),h=be(39),E=We(314),W=Math.min(be(38.69),(Rt-100-E-2*be(39))/p),O=E+p*W,Y=O+be(39),re=Y+be(39),ae=Math.min(14,W*.78),j=a=>e.jsxs(e.Fragment,{children:[e.jsxs(c,{cy:a,x:322.9,children:["ลà¸à¸à¸·à¹à¸",Se(205),"à¸à¸£à¸¹à¸à¸¹à¹à¸ªà¸à¸"]}),e.jsx(c,{cy:a+18,x:344.6,w:205.1,align:"center",children:Re(S,44)}),e.jsxs(c,{cy:a+36,x:322.9,children:["ลà¸à¸à¸·à¹à¸",Se(205),"à¸à¸²à¸à¸§à¸±à¸à¹à¸¥à¸°à¸à¸£à¸°à¹à¸¡à¸´à¸à¸à¸¥"]}),e.jsx(c,{cy:a+54,x:344.6,w:205.1,align:"center",children:Re(k,44)})]}),v=`à¸à¸£à¸°à¸à¸³à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸² ${L||"................"}`;return e.jsxs(Ut,{title:`à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡_รายà¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸_${S}_à¸à¸µ${x}`,children:[e.jsxs(tt,{size:"A4",style:{fontFamily:Oe,fontSize:16,color:"#000"},children:[e.jsx(es,{src:"/assets/images/garuda_official.jpg",style:{...Be(61.8,71),width:44.6,height:46.3,objectFit:"fill"}}),e.jsx(c,{cy:86.2,x:J,size:28,bold:!0,w:se,align:"center",children:"à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡"}),e.jsx(c,{cy:130.5,x:71.5,size:18,bold:!0,children:"สà¹à¸§à¸à¸£à¸²à¸à¸à¸²à¸£"}),e.jsxs(c,{cy:131,x:143.4,children:["à¸à¸¥à¸¸à¹à¸¡à¸à¸£à¸´à¸«à¸²à¸£à¸§à¸´à¸à¸²à¸à¸²à¸£",Le,A]}),e.jsx(c,{cy:151.1,x:71,size:18,bold:!0,children:"à¸à¸µà¹"}),e.jsx(c,{cy:151.6,x:87.8,children:t||Se(190)}),e.jsx(c,{cy:151.1,x:287.3,size:18,bold:!0,children:"วัà¸à¸à¸µà¹"}),e.jsx(Ne,{cy:151.6,x:308.4,width:162.6,data:i||void 0,align:"left",inset:6}),e.jsx(c,{cy:171.3,x:72,size:18,bold:!0,children:"à¹à¸£à¸·à¹à¸à¸"}),e.jsxs(c,{cy:171.8,x:104.1,children:["รายà¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸ ",oe]}),e.jsx(c,{cy:190.5,x:71.5,size:16,bold:!0,children:"à¹à¸£à¸µà¸¢à¸"}),e.jsxs(c,{cy:190.5,x:103.6,children:["à¸à¸¹à¹à¸à¸³à¸à¸§à¸¢à¸à¸²à¸£",A.replace(/ /g,Le)]}),e.jsx(c,{cy:209.1,x:71.5,size:16,bold:!0,children:"สิà¹à¸à¸à¸µà¹à¸ªà¹à¸à¸¡à¸²à¸à¹à¸§à¸¢"}),ge.map(a=>e.jsxs(Ct.Fragment,{children:[e.jsx(c,{cy:a.cy,x:142.5,children:a.no}),e.jsx(c,{cy:a.cy,x:156.4,children:a.label}
1),e.jsx(c,{cy:a.cy,x:431.2,children:"à¸à¸³à¸à¸§à¸"}),e.jsx(Ne,{cy:a.cy,x:459.1,width:34,data:a.count?P(a.count):void 0}),e.jsx(c,{cy:a.cy,x:493.1,children:a.unit})]},a.no)),e.jsx(Mt,{text:me,width:se,fontSize:Z,noBreak:U,lineHeight:I/Z,firstLineIndent:72,style:Be(Fe-I/2,J,{width:se})}),e.jsx(Mt,{text:ee,width:se,fontSize:16,lineHeight:I/16,firstLineIndent:72,style:Be(Ke-I/2,J,{width:se})}),Array.from({length:ve}).map((a,o)=>{const n=mt+o*$e,w=d[o];return e.jsxs(Ct.Fragment,{children:[e.jsxs(c,{cy:n,x:107.4,children:[P(o+1),"."]}),e.jsx(c,{cy:n,x:123.8,children:"วิà¸à¸²"}),e.jsx(Ne,{cy:n,x:139.1,width:158.8,data:w?`${bt(w)}${nt(w)?` ${nt(w)}${w.room?`/${w.room}`:""}`:""}`:void 0}),e.jsx(c,{cy:n,x:297.9,children:"รหัสวิà¸à¸²"}),e.jsx(Ne,{cy:n,x:330.5,width:58.5,data:(w==null?void 0:w.courseCode)||void 0}),e.jsx(c,{cy:n,x:389,children:"à¸à¸³à¸à¸§à¸ à¸à¸.à¹"}),e.jsx(Ne,{cy:n,x:445.1,width:62.4,data:w?"à¹":void 0}),e.jsx(c,{cy:n,x:507.5,children:"à¹à¸¥à¹à¸¡"})]},o)}),ie?null:te(Te)]}),ie?e.jsx(tt,{size:"A4",style:{fontFamily:Oe,fontSize:16,color:"#000"},children:te(80-516.7)}):null,e.jsxs(tt,{size:"A4",orientation:"landscape",style:{fontFamily:Oe,fontSize:16,color:"#000"},children:[e.jsx(c,{cy:66.6,x:449.3-149.5,w:300,align:"center",size:18,bold:!0,children:"à¹à¸à¸à¸ªà¸£à¸¸à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸"}),_?e.jsx(c,{cy:86,x:449.3-151,w:300,align:"center",bold:!0,children:v}):e.jsx(zt,{cy:86,leftX:341.1,rightX:464.4,leftDots:13,rightDots:16,sem:F,year:L}),e.jsx(c,{cy:104.3,x:250.4,bold:!0,children:"à¸à¹à¸²à¹à¸à¹à¸²à¸«à¸¡à¸²à¸¢à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸£à¸°à¸à¸±à¸à¸à¸µ (à¹à¸à¸£à¸ à¹-à¹) à¸à¸à¸à¸à¸¥à¸¸à¹à¸¡à¸ªà¸²à¸£à¸°à¸¯ à¸à¸·à¸ รà¹à¸à¸¢à¸¥à¸°"}),e.jsx(we,{style:Be(112.3,559,{width:89.6,borderBottomWidth:.75,borderBottomColor:"#000",borderBottomStyle:"solid",height:0})}),fe?e.jsx(c,{cy:104.3,x:559,w:89.6,align:"center",bold:!0,children:fe}):null,[0,1,2,3,4].map(a=>e.jsx(T,{x0:l[a],x1:l[a+1],y0:H,y1:H+2*M,fill:he,bold:!0,labelH:M,text:["à¸à¸µà¹","รายวิà¸à¸²","รหัส","à¸à¸±à¹à¸","หà¹à¸à¸"][a]},`h${a}`)),e.jsx(T,{x0:l[5],x1:l[6],y0:H,y1:H+M,fill:he,bold:!0,text:"à¸à¸³à¸à¸§à¸"}),e.jsx(T,{x0:l[5],x1:l[6],y0:H+M,y1:H+2*M,fill:he,bold:!0,text:"(à¸à¸)"}),e.jsx(T,{x0:l[6],x1:l[18],y0:H,y1:H+M,fill:he,bold:!0,text:"à¸à¸³à¸à¸§à¸à¸à¸±à¸à¹à¸£à¸µà¸¢à¸à¸à¸µà¹à¸¡à¸µà¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸ (à¸à¸)"}),it.map((a,o)=>e.jsx(T,{x0:l[6+o],x1:l[7+o],y0:H+M,y1:H+2*M,fill:he,bold:!0,text:Ts[a]},a)),Array.from({length:Ie}).map((a,o)=>{const n=Ae[o],w=Ve+o*_e,z=w+_e;return[n?P(o+1):void 0,n?bt(n):void 0,(n==null?void 0:n.courseCode)||void 0,n?nt(n):void 0,n?n.room:void 0,n?P(n.studentCount??0):void 0,...it.map(q=>{var R;return n?P(((R=n.gradeBuckets)==null?void 0:R[q])||0):void 0})].map((q,R)=>e.jsx(T,{x0:l[R],x1:l[R+1],y0:w,y1:z,text:q,align:R===1?"left":"center",size:m},`${o}-${R}`))}),e.jsx(T,{x0:l[0],x1:l[4],y0:ue,y1:V,fill:de,bold:!0,text:"รวม"}),e.jsx(T,{x0:l[4],x1:l[5],y0:ue,y1:V,fill:de}),e.jsx(T,{x0:l[5],x1:l[6],y0:ue,y1:V,fill:de,bold:!0,size:m+1,text:D?P(D):void 0}),e.jsx(T,{x0:l[6],x1:l[9],y0:ue,y1:V,fill:de,bold:!0,size:m+1,text:D?P(je):void 0}),e.jsx(T,{x0:l[13],x1:l[16],y0:ue,y1:V,fill:de,bold:!0,size:m+1,text:D?P(xe):void 0}),e.jsx(T,{x0:l[16],x1:l[17],y0:ue,y1:V,fill:de,bold:!0,size:m+1,text:D?P(X.à¸):void 0}),e.jsx(T,{x0:l[17],x1:l[18],y0:ue,y1:V,fill:de,bold:!0,size:m+1,text:D?P(X.มà¸):void 0}),e.jsx(T,{x0:l[0],x1:l[6],y0:V,y1:r,fill:Pe,bold:!0,text:"à¸à¸´à¸à¹à¸à¹à¸à¸£à¹à¸à¸¢à¸¥à¸°"}),e.jsx(T,{x0:l[6],x1:l[9],y0:V,y1:r,fill:Pe,bold:!0,size:m+1,text:D?P(ze(je,D)):void 0}),e.jsx(T,{x0:l[13],x1:l[16],y0:V,y1:r,fill:Pe,bold:!0,size:m+1,text:D?P(ze(xe,D)):void 0}),e.jsx(T,{x0:l[16],x1:l[17],y0:V,y1:r,fill:Pe,bold:!0,size:m+1,text:D?P(ze(X.à¸,D)):void 0}),e.jsx(T,{x0:l[17],x1:l[18],y0:V,y1:r,fill:Pe,bold:!0,size:m+1,text:D?P(ze(X.มà¸,D)):void 0}),j(r+27.7)]}),e.jsxs(tt,{size:"A4",orientation:"landscape",style:{fontFamily:Oe,fontSize:16,color:"#000"},children:[e.jsx(c,{cy:66.5,x:449.5-149.5,w:300,align:"center",size:18,bold:!0,children:"à¹à¸à¸à¸ªà¸£à¸¸à¸à¸à¸¸à¸à¸¥à¸±à¸à¸©à¸à¸°à¸à¸±à¸à¸à¸¶à¸à¸à¸£à¸°à¸ªà¸à¸à¹"}),_?e.jsx(c,{cy:86,x:448.6-148.5,w:300,align:"center",bold:!0,children:v}):e.jsx(zt,{cy:86,leftX:332,rightX:455.3,leftDots:13,rightDots:21,spaceBeforeRightDots:!0,sem:F,year:L}),[0,1,2,3,4].map(a=>e.jsx(T,{x0:u[a],x1:u[a+1],y0:y,y1:y+2*h,fill:he,bold:!0,labelH:
1h,text:["à¸à¸µà¹","รายวิà¸à¸²","รหัส","à¸à¸±à¹à¸","หà¹à¸à¸"][a]},`h${a}`)),e.jsx(T,{x0:u[5],x1:u[6],y0:y,y1:y+h,fill:he,bold:!0,text:"à¸à¸³à¸à¸§à¸"}),e.jsx(T,{x0:u[5],x1:u[6],y0:y+h,y1:y+2*h,fill:he,bold:!0,text:"(à¸à¸)"}),e.jsx(T,{x0:u[6],x1:u[10],y0:y,y1:y+h,fill:he,bold:!0,text:"à¸à¸³à¸à¸§à¸à¸à¸±à¸à¹à¸£à¸µà¸¢à¸à¸à¸µà¹à¸¡à¸µà¸à¸¥à¸à¸²à¸£à¸à¸£à¸°à¹à¸¡à¸´à¸ (à¸à¸)"}),Ge.map((a,o)=>e.jsx(T,{x0:u[6+o],x1:u[7+o],y0:y+h,y1:y+2*h,fill:he,bold:!0,text:As[a]},a)),Array.from({length:p}).map((a,o)=>{const n=d[o],w=E+o*W,z=w+W;return[n?P(o+1):void 0,n?bt(n):void 0,(n==null?void 0:n.courseCode)||void 0,n?nt(n):void 0,n?n.room:void 0,n?P(n.studentCount??0):void 0,...Ge.map(q=>{var R;return n?P(((R=n.charBuckets)==null?void 0:R[q])||0):void 0})].map((q,R)=>e.jsx(T,{x0:u[R],x1:u[R+1],y0:w,y1:z,text:q,align:R===1?"left":"center",size:ae},`${o}-${R}`))}),e.jsx(T,{x0:u[0],x1:u[4],y0:O,y1:Y,fill:de,bold:!0,text:"รวม"}),e.jsx(T,{x0:u[4],x1:u[5],y0:O,y1:Y,fill:de}),e.jsx(T,{x0:u[5],x1:u[6],y0:O,y1:Y,fill:de,bold:!0,size:ae+1,text:K?P(K):void 0}),Ge.map((a,o)=>e.jsx(T,{x0:u[6+o],x1:u[7+o],y0:O,y1:Y,fill:de,bold:!0,size:ae+1,text:K?P(Ce[a]):void 0},`s${a}`)),e.jsx(T,{x0:u[0],x1:u[6],y0:Y,y1:re,fill:Pe,bold:!0,text:"à¸à¸´à¸à¹à¸à¹à¸à¸£à¹à¸à¸¢à¸¥à¸°"}),Ge.map((a,o)=>e.jsx(T,{x0:u[6+o],x1:u[7+o],y0:Y,y1:re,fill:o===3?"#FFFF00":Pe,bold:!0,size:ae+1,text:K?P(ze(Ce[a],K)):void 0},`p${a}`)),j(re+26.9)]})]})},Ds=["มà¸à¸£à¸²à¸à¸¡","à¸à¸¸à¸¡à¸ าà¸à¸±à¸à¸à¹","มีà¸à¸²à¸à¸¡","à¹à¸¡à¸©à¸²à¸¢à¸","à¸à¸¤à¸©à¸ าà¸à¸¡","มิà¸à¸¸à¸à¸²à¸¢à¸","à¸à¸£à¸à¸à¸²à¸à¸¡","สิà¸à¸«à¸²à¸à¸¡","à¸à¸±à¸à¸¢à¸²à¸¢à¸","à¸à¸¸à¸¥à¸²à¸à¸¡","à¸à¸¤à¸¨à¸à¸´à¸à¸²à¸¢à¸","à¸à¸±à¸à¸§à¸²à¸à¸¡"],Fs=s=>{const[t,i,x]=s.split("-").map(Number);return!t||!i||!x?"":`${x} ${Ds[i-1]} ${t+543}`},Ms=({isOpen:s,onClose:t,pdfProps:i,schoolId:x,createdBy:C})=>{const[f,S]=b.useState(!1),[d,g]=b.useState(""),[N,B]=b.useState(""),[k,$]=b.useState(""),[G,_]=b.useState(""),[F,L]=b.useState(!1),[A,le]=b.useState(""),[ne,X]=b.useState(""),[D,je]=b.useState(""),[xe,Ce]=b.useState(!1);b.useEffect(()=>{if(s){g(""),le(""),L(!1),_(""),je("");const I=new Date,U=["มà¸à¸£à¸²à¸à¸¡","à¸à¸¸à¸¡à¸ าà¸à¸±à¸à¸à¹","มีà¸à¸²à¸à¸¡","à¹à¸¡à¸©à¸²à¸¢à¸","à¸à¸¤à¸©à¸ าà¸à¸¡","มิà¸à¸¸à¸à¸²à¸¢à¸","à¸à¸£à¸à¸à¸²à¸à¸¡","สิà¸à¸«à¸²à¸à¸¡","à¸à¸±à¸à¸¢à¸²à¸¢à¸","à¸à¸¸à¸¥à¸²à¸à¸¡","à¸à¸¤à¸¨à¸à¸´à¸à¸²à¸¢à¸","à¸à¸±à¸à¸§à¸²à¸à¸¡"],Z=I.getDate(),oe=U[I.getMonth()],me=I.getFullYear()+543,ee=`${Z} ${oe} ${me}`;B(ee),X(ee)}},[s]),b.useEffect(()=>{if(!s)return;Ce(!0);const I=setTimeout(()=>{le(d),X(N),je(G),Ce(!1)},500);return()=>clearTimeout(I)},[d,N,G,s]);const K=i.semester==="1"?"à¹à¸à¸à¸¡1":i.semester==="2"?"à¹à¸à¸à¸¡2":"à¸à¸¥à¸à¸à¸à¸µ",J=`à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡_รายà¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸${i.teacherName?`_${i.teacherName.replace(/\s+/g,"_")}`:""}_à¸à¸µ${i.academicYear}_${K}.pdf`,se=b.useMemo(()=>({...i,docNo:A.trim(),dateStr:ne.trim(),targetPercentage:D.trim()}),[i,A,ne,D]),$e=async()=>{S(!0);try{const I={...i,docNo:d.trim(),dateStr:N.trim(),targetPercentage:G.trim()},U=await ss(e.jsx(Gt,{...I})).toBlob();if(bs.saveAs(U,J),x)try{let Z,oe;try{const ee=await fs(x,"porbor5-submission-memos",U,J);Z=ee.url,oe=ee.storagePath}catch(ee){console.warn("Could not archive memo PDF:",ee)}const me=`รายà¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸ ภาà¸à¹à¸£à¸µà¸¢à¸à¸à¸µà¹ ${i.semester} à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸² ${i.academicYear}`;await cs(Ze(Ee,"school-settings",x,"memos"),{memoNo:d.trim()||"ยัà¸à¹à¸¡à¹à¸£à¸°à¸à¸¸à¹à¸¥à¸à¸à¸µà¹",subject:me,to:i.directorName||"à¸à¸¹à¹à¸à¸³à¸à¸§à¸¢à¸à¸²à¸£à¹à¸£à¸à¹à¸£à¸µà¸¢à¸",sender:i.teacherName,notes:`รายà¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸ à¸à¸³à¸à¸§à¸ ${i.courses.length} รายวิà¸à¸²/หà¹à¸à¸`,academicYear:i.academicYear,semester:i.semester,createdBy:C||i.teacherName||"ระà¸à¸",createdAt:ds.now(),...Z?{pdfUrl:Z,storagePath:oe}:{}}),L(!0)}catch(Z){console.error("Error saving memo to registry:",Z)}}catch(I){console.error("Error generating PorBor5 submission memo PDF:",I)}finally{S(!1)}};return s?rs.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/60 px-4 pb-4 pt-[76px] backdrop-blur-sm",onClick:t,children:e.jsxs("div",{className:"flex h-full max-h-[calc(100vh-92px)] w-full max-w-5xl flex-col rounded-2xl bg-white shadow-2xl dark:bg-[#1e1f21]",onClick:I=>I.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 px-5 py-4 dark:border-gray-700",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"truncate text-base font-bold text-gray-900 dark:text-white",children:"à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¹à¸à¸à¸ªà¸²à¸£ â à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸£à¸²à¸¢à¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸"}),e.jsxs("p",{className:"truncate text-xs text-gray-500 dark:text-gray-400",children:[i.teacherName," ⢠à¸à¸£à¸°à¸à¸³à¸ าà¸à¹à¸£à¸µà¸¢à¸à¸à¸µà¹ ",i.semester," à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸² ",i.academicYear," (",i.courses.length," รายวิà¸à¸²)"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:$e,disabled:f,className:"inline-flex h-9 items-center justify-center gap-2 rounded-lg bg-indigo-600 px-4 text-sm font-bold text-white shadow-sm transition hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50",children:[f?e.jsx(He,{size:16,className:"animate-spin"}):e.jsx(gs,{size:16}),f?"à¸à¸³à¸¥à¸±à¸à¸à¸±à¸à¸à¸¶à¸...":"à¸à¸²à¸§à¸à¹à¹à¸«à¸¥à¸"]}),e.jsx("button",{type:"button",onClick:t,className:"inline-flex h-9 w-9 items-center justify-center rounded-lg text-gray-500 transition hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700",title:"à¸à¸´à¸",children:e.jsx(Yt,{size:18})})]})]}),e.jsxs("div",{className:"px-5 py-3 bg-gray-50/50 dark:bg-gray-800/40 border-b border-gray-200 dark:border-gray-700 flex flex-wrap items-end gap-3 text-xs",children:[e.jsxs("div",{className:"flex-1 min-w-[140px] max-w-[200px]",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-gray-600 dark:text-gray-300 mb-1",children:"à¹à¸¥à¸à¸à¸µà¹à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡"}),e.jsx("input",{type:"text",value:d,onChange:I=>g(I.target.value),placeholder:"à¹à¸à¹à¸ ศภ04.../...",className:"w-full px-2.5 py-1.5 bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-700 rounded-lg text-xs focus:ring-2 focus:ring-rose-500 focus:outline-none dark:text-white"})]}),e.jsxs("div",{className:"flex-1 min-w-[140px] max-w-[200px]",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-gray-600 dark:text-gray-300 mb-1",children:"วัà¸à¸à¸µà¹à¹à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ps,{value:k||null,placeholder:"à¹à¸¥à¸·à¸à¸à¸§à¸±à¸à¸à¸µà¹à¸à¸²à¸à¸à¸à¸´à¸à¸´à¸",onChange:I=>{$(I),B(Fs(I))},className:"text-xs [&>div:first-child]:min-h-[32px] [&>div:first-child]:py-1.5 [&>div:first-child]:px-2.5"}),k?e.jsx("button",{type:"button",onClick:()=>{$(""),B("")},title:"ลà¹à¸²à¸à¸§à¸±à¸à¸à¸µà¹ (à¸à¸¥à¹à¸à¸¢à¹à¸à¹à¸à¹à¸ªà¹à¸à¸à¸¸à¸à¹à¸à¹à¸à¸¥à¸²à¹à¸«à¹à¹à¸à¸µà¸¢à¸à¹à¸à¸)",className:"shrink-0 rounded-lg border border-gray-300 px-2 py-1.5 text-[11px] font-semibold text-gray-600 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:"ลà¹à¸²à¸"}):null]})]}),e.jsxs("div",{className:"flex-1 min-w-[160px] max-w-[220px]",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-gray-600 dark:text-gray-300 mb-1",children:"à¸à¹à¸²à¹à¸à¹à¸²à¸«à¸¡à¸²à¸¢à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¸£à¸°à¸à¸±à¸à¸à¸µ (รà¹à¸à¸¢à¸¥à¸°)"}),e.jsx("input",{type:"text",value:G,onChange:I=>_(I.target.value),placeholder:"à¹à¸à¹à¸ 70",className:"w-full px-2.5 py-1.5 bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-700 rounded-lg text-xs focus:ring-2 focus:ring-rose-500 focus:outline-none dark:text-white"})]}),xe&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-amber-600 dar
1k:text-amber-400 py-2",children:[e.jsx(He,{size:13,className:"animate-spin"}),e.jsx("span",{children:"à¸à¸³à¸¥à¸±à¸à¸à¸±à¸à¹à¸à¸à¸à¸±à¸§à¸à¸¢à¹à¸²à¸..."})]})]}),F&&e.jsxs("div",{className:"px-5 py-2 bg-emerald-50 dark:bg-emerald-950/30 border-b border-emerald-100 dark:border-emerald-800 text-emerald-700 dark:text-emerald-300 text-xs flex items-center gap-2",children:[e.jsx(ft,{size:14}),e.jsx("span",{children:"à¸à¸²à¸§à¸à¹à¹à¸«à¸¥à¸à¸ªà¸³à¹à¸£à¹à¸ à¸à¸£à¹à¸à¸¡à¸à¸±à¸à¸à¸¶à¸à¸¥à¸à¸ªà¸¹à¹à¸à¸°à¹à¸à¸µà¸¢à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¸à¸à¹à¸£à¸à¹à¸£à¸µà¸¢à¸à¹à¸£à¸µà¸¢à¸à¸£à¹à¸à¸¢à¹à¸¥à¹à¸§"})]}),e.jsx("div",{className:"flex-1 overflow-hidden rounded-b-2xl bg-gray-100 dark:bg-[#1e1f21]",children:e.jsx(ts,{width:"100%",height:"100%",className:"h-full w-full border-none",showToolbar:!0,children:e.jsx(Gt,{...se})})})]})}),document.body):null},zs=["4","3.5","3","2.5","2","1.5","1","0","ร","มส","à¸","มà¸"],Ht=new Set(zs),Ot=s=>{if(s==null)return null;const t=String(s).trim();if(!t)return null;if(Ht.has(t))return t;const i=Number(t);if(Number.isFinite(i)){const x=String(Math.round(i*2)/2);return Ht.has(x)?x:null}return null},Rs=(s,t)=>{if(!s)return null;const i=Ot(s.status);if(i&&!/^[0-9.]+$/.test(i))return i;const x=Ot(s.grade);if(x==="ร"||x==="มส"||x==="à¸"||x==="มà¸")return x;const C=Array.isArray(t==null?void 0:t.formativeAssessments)?t.formativeAssessments:[],f=s.formativeDetails||{},S=Object.values(f).map(k=>Number(k)||0);let d;C.length>0?d=C.reduce((k,$)=>k+(Number(f[$.id||$.name||""])||0),0):s.preMidterm!==void 0||s.postMidterm!==void 0?d=(Number(s.preMidterm)||0)+(Number(s.postMidterm)||0):d=Number(s.formative)||S.reduce((k,$)=>k+$,0);const g=d+(Number(s.midterm)||0)+(Number(s.final)||0);if(!(g>0||S.some(k=>k>0)||["formative","preMidterm","postMidterm","midterm","final"].some(k=>s[k]!==void 0&&s[k]!==null&&s[k]!=="")))return x;const B=js(g);return x&&s.originalGrade&&x!==B?x:B},Gs=(s,t)=>{const i=s||"",x=(t||"").toUpperCase();return i.includes("หà¸à¹à¸²à¸à¸µà¹à¸à¸¥à¹à¸¡à¸·à¸à¸")||/\bIS\b/i.test(i)||i.includes("à¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²à¸à¹à¸à¸à¸§à¹à¸²à¸à¹à¸§à¸¢à¸à¸à¹à¸à¸")||i.includes("à¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²à¸à¹à¸à¸à¸§à¹à¸²à¸à¸´à¸ªà¸£à¸°")||x.startsWith("IS")},Wt=s=>{if(!s)return!1;const t=String(s).toLowerCase().trim();return t.startsWith("p")||t.startsWith("à¸.")||t.startsWith("à¸")||["1","2","3","4","5","6"].includes(t)},ot=s=>{if(!s)return"1";const t=String(s).trim().toLowerCase();return["1","2"].includes(t)?t:["0","annual","all","à¸à¸±à¹à¸à¸à¸µ","à¸à¸¥à¸à¸à¸à¸µ","à¸à¸¥à¸à¸à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²"].includes(t)?"annual":t},Hs=s=>{const t=Array.isArray(s==null?void 0:s.teacherIds)&&s.teacherIds.length>0?s.teacherIds:s!=null&&s.teacherId?[s.teacherId]:[];return Array.from(new Set(t.filter(i=>i&&i!=="pending"&&!String(i).startsWith("GHOST"))))},vr=()=>{const s=as(),t=st(r=>r.auth.user),i=st(r=>r.userMap.teachers),x=st(r=>r.schoolSettings.currentAcademicYear),C=st(r=>r.calendar.academicYear),[f,S]=b.useState(""),[d,g]=b.useState(C||x||String(new Date().getFullYear()+543)),[N,B]=b.useState("1"),[k,$]=b.useState(!0),[G,_]=b.useState(!1),[F,L]=b.useState([]),[A,le]=b.useState(null),[ne,X]=b.useState(""),[D,je]=b.useState("my"),[xe,Ce]=b.useState("all"),[K,fe]=b.useState(new Set),[J,se]=b.useState(!1),[$e,I]=b.useState(null),[U,Z]=b.useState(!1),[oe,me]=b.useState(null),[ee,Qe]=b.useState(null),De=b.useRef(new Map),ve=b.useRef(new Map),pe=b.useRef(new Set),Ye=b.useMemo(()=>t!=null&&t.role?Array.isArray(t.role)?t.role:[t.role]:[],[t]),xt=b.useMemo(()=>Ye.some(r=>["admin","director","academic","academic_head","registrar","super_admin"].includes(r)),[Ye]),Fe=(t==null?void 0:t.docId)||(t==null?void 0:t.uid)||"";b.useEffect(()=>{const r=t==null?void 0:t.schoolId;r&&(S(r),At(It(Ee,"school-settings",r)).then(l=>{l.exists()&&le(l.data())}))},[t]),b.useEffect(()=>{De.current.clear()},[f,d]);const Ke=b.useCallback(async(r=!1)=>{var l;if(!f||!d){$(!1),L([]);return}r?_(!0):$(!0);try{const[m,u,p]=await Promise.all([rt(Ze(Ee,"school-settings",f,"courses")),rt(_t(Ze(Ee,"school-settings",f,"course_assignments"),Lt("academicYear","==",String(d)))),rt(_t(Ze(Ee,"school-settings",f,"enrollments"),Lt("academicYear","==",String(d))))]),y=new Map;m.docs.forEach(j=>y.set(j.id,{id:j.id,...j.data()}));const h=new Map;u.docs.forEach(j=>{const v=j.data(),a=v.courseId,o=String(v.semester||"1");a&&(h.has(a)||h.set(a,[]),h.get(a).push({semester:o,list:v.teacherAssignments||[]}))});const E=new Map;
1y.forEach((j,v)=>{const a=String(j.code||"").trim();a&&!E.has(a)&&E.set(a,v)});const W=j=>{const v=String(j??"").trim().replace(/^à¸à¸¥à¸¸à¹à¸¡\s*/,"").replace(/^à¸\./,"").trim(),a=Number(v);return v!==""&&Number.isFinite(a)&&a>0?a:null},Q=j=>{const v=new Set;return[j.groupNumber,j.group,j.groupName].forEach(a=>{const o=W(a);o&&v.add(o)}),v.size===0&&[j.room,j.roomNumber].forEach(a=>{const o=W(a);o&&v.add(o)}),v.size===0&&v.add(1),Array.from(v)},O=new Map,Y=(j,v)=>{O.has(j)||O.set(j,new Set),O.get(j).add(v)};p.docs.forEach(j=>{const v=j.data(),a=v.courseId||(v.courseCode?E.get(String(v.courseCode).trim()):void 0),o=v.studentId,n=v.semester;!a||!o||Q(v).forEach(w=>{Y(`${a}_${w}`,o),Y(`${a}_${w}_${n}`,o)})});const re=[],ae=ot(N);for(const[j,v]of Array.from(h.entries())){const a=y.get(j);if(!a)continue;const o=String(a.title||a.name||"").toLowerCase(),n=String(a.code||"").toLowerCase(),w=String(a.type||"").toLowerCase();if(!(o.includes("à¸à¸¸à¸¡à¸à¸¸à¸¡")||o.includes("à¹à¸®à¸¡à¸£à¸¹à¸¡")||o.includes("à¹à¸à¸°à¹à¸à¸§")||o.includes("ลูà¸à¹à¸ªà¸·à¸")||n.startsWith("à¸")||w.includes("à¸à¸´à¸à¸à¸£à¸£à¸¡")))for(const{semester:z,list:Xe}of v){const q=ot(z),R=Wt(a.classId);let Me=!1;if(ae==="annual"||R?Me=!0:Me=!q||q==="annual"||q===ae,!!Me)for(const ce of Xe){const Je=Number(ce.groupNumber)||1,Nt=Hs(ce),Ue=Nt[0]||ce.teacherId||"";if(!Ue)continue;const Zt=((l=i[Ue])==null?void 0:l.name)||ce.teacherName||Ue,et=ce.room?String(ce.room).trim():"1";let ke="";Array.isArray(ce.classLevels)&&ce.classLevels.length>0?ke=ce.classLevels[0]:ce.classLevel?ke=ce.classLevel:typeof a.classId=="string"?ke=a.classId:Array.isArray(a.classId)&&a.classId.length>0&&(ke=a.classId[0]);const wt=Array.from(O.get(`${j}_${Je}_${z}`)||O.get(`${j}_${Je}`)||[]),ut=wt.length,Qt=`${$t[ke]||ke}${et?`/${et}`:""}`,Jt=`${j}_${ke}_${et}_${Je}_${z}`;re.push({id:Jt,courseId:j,courseCode:a.code||"",courseTitle:a.title||a.name||"à¹à¸¡à¹à¸£à¸°à¸à¸¸à¸à¸·à¹à¸à¸§à¸´à¸à¸²",subjectGroup:a.subjectGroup||a.learningArea||"",classLevel:ke,room:et,classLabel:Qt,groupNumber:Je,teacherId:Ue,teacherIds:Nt,teacherName:Zt,studentCount:ut,passCount:ut,failCount:0,incompleteCount:0,hasPdf:!1,pdfUrl:null,pdfStoragePath:null,overallPercentage:ut>0?50:0,sectionSemester:z,enrolledStudentIds:wt,includeInGradeTable:!Gs(a.title||a.name||"",a.code||"")})}}}ve.current=new Map,pe.current=new Set,L(re),$(!1),_(!1)}catch(m){console.error("Error fetching PorBor5 courses:",m),$(!1),_(!1)}},[f,d,N,i]);b.useEffect(()=>{Ke()},[Ke]);const mt=async r=>{if(r.pdfUrl){me({url:r.pdfUrl,title:`à¸à¸.5 â ${r.courseTitle} (${r.classLabel})`});return}if(r.pdfStoragePath){Qe(r.id);try{const l=await ms(Pt(Tt,r.pdfStoragePath));r.pdfUrl=l,me({url:l,title:`à¸à¸.5 â ${r.courseTitle} (${r.classLabel})`})}catch(l){console.error("Error fetching booklet PDF URL:",l),at.fire({icon:"error",title:"à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¹à¸à¸´à¸à¹à¸à¸¥à¹à¹à¸à¹",text:"à¹à¸à¸´à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸à¹à¸à¸à¸²à¸£à¹à¸«à¸¥à¸à¹à¸à¸¥à¹ PDF à¸à¸²à¸à¸£à¸°à¸à¸à¸à¸±à¸à¹à¸à¹à¸",confirmButtonColor:"#e11d48"})}finally{Qe(null)}}},Te=b.useCallback((r,l,m)=>{if(m==="all")return!0;const u=[r,...l||[]].filter(Boolean);if(m==="my"){const h=[Fe,t==null?void 0:t.uid,t==null?void 0:t.docId,t==null?void 0:t.teacherId].filter(Boolean);for(const[W,Q]of Object.entries(i||{}))(Q.uid===(t==null?void 0:t.uid)||W===(t==null?void 0:t.uid)||Q.id===Fe)&&h.push(W,Q.id,Q.uid||"",Q.teacherId||"");const E=new Set(h.filter(Boolean));return u.some(W=>E.has(W))}const p=new Set([m]),y=i[m];return y&&(y.id&&p.add(y.id),y.uid&&p.add(y.uid),y.teacherId&&p.add(y.teacherId)),u.some(h=>p.has(h))},[Fe,t,i]),ie=b.useMemo(()=>F.filter(r=>Te(r.teacherId,r.teacherIds,D)),[F,Te,D]);b.useEffect(()=>{if(!f||!d||ie.length===0)return;const r=Array.from(new Set(ie.map(p=>p.courseId))).filter(p=>!pe.current.has(p));if(r.length===0)return;r.forEach(p=>pe.current.add(p));const l=ot(N),m=l==="annual"?["semester_annual"]:l==="2"?["semester_2","semester_annual"]:["semester_1","semester_annual"];let u=!1;return(async()=>{for(let y=0;y<r.length;y+=6){if(u)return;const h=r.slice(y,y+6);await Promise.allSettled(h.flatMap(E=>m.map(async W=>{try{const Q=await xs(Pt(Tt,`school-settings/${f}/grading/courses/${E}/year_${d}/${W}`)),O=ve.current.get(E)||new Set;
1Q.items.forEach(Y=>O.add(Y.fullPath)),ve.current.set(E,O)}catch{}})))}u||L(y=>y.map(h=>{if(!pe.current.has(h.courseId)||h.hasPdf)return h;const E=Wt(h.classLevel),W=[h.room?`_${h.room}`:"",h.groupNumber?`_${h.groupNumber}`:"",""],Q=E?["semester_annual","semester_1","semester_2"]:[`semester_${ot(h.sectionSemester)||"1"}`,"semester_annual","semester_1","semester_2"],O=[h.classLevel,h.classLevel.toLowerCase(),h.classLevel.toUpperCase()].filter(Boolean),Y=[];for(const v of Array.from(new Set(Q)))for(const a of Array.from(new Set(O)))for(const o of Array.from(new Set(W)))Y.push(`school-settings/${f}/grading/courses/${h.courseId}/year_${d}/${v}/à¸à¸5_${h.courseId}_${a}${o}.pdf`);const re=ve.current.get(h.courseId),ae=re?Y.find(v=>re.has(v)):void 0,j=!!ae;return{...h,hasPdf:j,pdfStoragePath:ae||null,overallPercentage:j?100:h.studentCount>0?50:0}}))})(),()=>{u=!0,r.forEach(p=>{ve.current.has(p)||pe.current.delete(p)})}},[ie,f,d,N]);const te=ie.length,ge=ie.filter(r=>r.hasPdf).length,Ae=te-ge,Ie=te>0?Math.round(ge/te*100):0,H=te>0&&ge===te,M=b.useMemo(()=>ie.filter(r=>{if(xe==="saved"&&!r.hasPdf||xe==="pending"&&r.hasPdf)return!1;if(ne.trim()){const l=ne.toLowerCase().trim(),m=r.courseCode.toLowerCase().includes(l),u=r.courseTitle.toLowerCase().includes(l),p=r.classLabel.toLowerCase().includes(l),y=r.teacherName.toLowerCase().includes(l);if(!m&&!u&&!p&&!y)return!1}return!0}),[ie,xe,ne]),Ve=b.useMemo(()=>{const r=new Map;return F.forEach(l=>{l.teacherId&&l.teacherName&&r.set(l.teacherId,l.teacherName)}),Array.from(r.entries()).filter(([l])=>!Te(l,void 0,"my")).map(([l,m])=>{var y;const u=(y=i[l])==null?void 0:y.name,p=!u&&m===l;return{id:l,unresolved:p,name:p?`à¹à¸¡à¹à¸à¸à¸à¸·à¹à¸à¸à¸£à¸¹ (${l.slice(0,6)}â¦)`:u||m}}).sort((l,m)=>Number(l.unresolved)-Number(m.unresolved)||l.name.localeCompare(m.name,"th"))},[F,Te,i]),_e=()=>{K.size===M.length&&M.length>0?fe(new Set):fe(new Set(M.map(r=>r.id)))},St=r=>{fe(l=>{const m=new Set(l);return m.has(r)?m.delete(r):m.add(r),m})},ue=r=>{const l=Object.values((r==null?void 0:r.characteristicsScores)||{});if(l.length===0)return null;const m=Math.round(l.reduce((u,p)=>u+p,0)/l.length);return m<0||m>3?null:String(m)},V=async r=>{const l=r||(K.size>0?M.filter(p=>K.has(p.id)):ie);if(l.length===0){at.fire({icon:"info",title:"à¹à¸¡à¹à¸à¸à¸£à¸²à¸¢à¸§à¸´à¸à¸²",text:"à¸à¸£à¸¸à¸à¸²à¹à¸¥à¸·à¸à¸à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸µà¹à¸à¹à¸à¸à¸à¸²à¸£à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¸¢à¹à¸²à¸à¸à¹à¸à¸¢ 1 วิà¸à¸²",confirmButtonText:"à¸à¸à¸¥à¸",confirmButtonColor:"#e11d48"});return}const m=l.filter(p=>!p.hasPdf),u=async()=>{var p,y;Z(!0);try{const h=l[0],E=(p=Object.entries(i||{}).find(([o,n])=>o===(t==null?void 0:t.uid)||n.uid===(t==null?void 0:t.uid)||n.id===Fe))==null?void 0:p[1],W=(E==null?void 0:E.name)||(t==null?void 0:t.fullName)||(t==null?void 0:t.displayName)||h.teacherName,Q=(E==null?void 0:E.subjectGroup)||(E==null?void 0:E.learningArea)||h.subjectGroup,O=Array.from(new Set(l.map(o=>o.courseId))),Y=O.filter(o=>!De.current.has(o));Y.length>0&&await Promise.allSettled(Y.map(async o=>{try{const n=await rt(Ze(Ee,"school-settings",f,"courses",o,"grades")),w={};n.docs.forEach(z=>{w[z.id]=z.data()}),De.current.set(o,w)}catch(n){console.warn(`Could not load grades for course ${o}:`,n)}}));const re={};await Promise.allSettled(O.map(async o=>{try{const n=await At(It(Ee,"school-settings",f,"courses",o));n.exists()&&(re[o]=n.data())}catch(n){console.warn(`Could not load course ${o}:`,n)}}));const ae=l.map(o=>{const n=De.current.get(o.courseId)||{},w=Is(),z=_s();return o.enrolledStudentIds.forEach(Xe=>{const q=n[Xe];if(!q)return;const R=Rs(q,re[o.courseId]);R&&w[R]++;const Me=ue(q);Me&&z[Me]++}),{courseCode:o.courseCode,courseTitle:o.courseTitle,classLevel:$t[o.classLevel]||o.classLevel,room:o.room,studentCount:o.studentCount,gradeBuckets:w,charBuckets:z,includeInGradeTable:o.includeInGradeTable}}),j=is(A,"academic"),v=((y=Object.values(i||{}).find(o=>o.isHeadOfAssessment))==null?void 0:y.name)||(A==null?void 0:A.assessmentHeadName)||"",a={schoolName:(A==null?void 0:A.schoolName)||"à¹à¸£à¸à¹à¸£à¸µà¸¢à¸",schoolAffiliation:(A==null?void 0:A.affiliation)||"",academicYear:String(d),semester:String(N),learningArea:Q,teacherName:W,teacherPosition:"à¸à¸£à¸¹à¸à¸¹à¹à¸ªà¸à¸",courses:ae,directorName:A!=null&&A.directorName?`${A.directorPrefix||""}${A.directorName}`.trim():"",reviewerName:v,deputyDirectorName:(j==null?void 0:j.name)||""};I(a),se(!0)}catch(h){console.error("Error generating memo:",h),at.fire({icon:"error",title:"à¹à¸à¸´à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸à¹à¸à¸à¸²à¸£à¸à¸£à¸°à¸¡à¸§à¸¥à¸à¸¥",text:"à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸à¸¶à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸¥à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸à¹à¸à¹ à¸à¸£à¸¸à¸à¸²à¸¥à¸à¸à¹à¸«à¸¡à¹à¸à¸µà¸à¸à¸£à¸±à¹à¸",confirmButtonColor:"#e11d48"})}finally{Z(!1)}};m.length>0?at.fire({icon:"warning",title:"à¸à¸£à¸§à¸à¸à¸à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸µà¹à¸¢à¸±à¸à¹à¸¡à¹à¹à¸à¹à¸à¸à¸à¹à¸¥à¹à¸¡ à¸à¸.5 (PDF)",html:` 2 <div class="text-left text-xs space-y-2 mt-2"> 3 <p>มีà¸à¸³à¸à¸§à¸ <b>${m.length} รายวิà¸à¸²</b> à¸à¸µà¹à¸¢à¸±à¸à¹à¸¡à¹à¸¡à¸µà¹à¸à¸¥à¹à¹à¸¥à¹à¸¡ à¸à¸.5 (PDF) à¹à¸à¸à¸¥à¸±à¸à¹à¸à¸à¸ªà¸²à¸£:</p> 4 <ul class="list-disc pl-5 text-gray-600 dark:text-gray-300 max-h-36 overflow-y-auto space-y-1"> 5 ${m.slice(0,10).map(p=>`<li><b>${p.courseCode}</b> ${p.courseTitle} (${p.classLabel})</li>`).join("")} 6 ${m.length>10?`<li>...à¹à¸¥à¸°à¸à¸µà¸ ${m.length-10} รายวิà¸à¸²</li>`:""} 7 </ul> 8 <p class="text-gray-500 pt-2 border-t border-gray-200 dark:border-gray-700"> 9 * à¸à¸²à¸¡à¸£à¸°à¹à¸à¸µà¸¢à¸à¸à¸²à¸à¸§à¸±à¸à¸à¸¥à¸à¸§à¸£à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸¡ à¸à¸.5 à¹à¸«à¹à¸à¸£à¸à¸
9à¹à¸à¸ à¹à¸à¹à¸«à¸²à¸à¸à¹à¸²à¸à¸à¹à¸à¸à¸à¸²à¸£à¸à¸´à¸¡à¸à¹à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¸³à¸ªà¹à¸à¸à¸±à¸à¸à¸µ สามารà¸à¸à¸à¸¢à¸·à¸à¸¢à¸±à¸à¹à¸à¸·à¹à¸à¸à¸³à¹à¸à¸´à¸à¸à¸²à¸£à¹à¸à¹ 10 </p> 11 </div> 12 `,showCancelButton:!0,confirmButtonText:"ยืà¸à¸¢à¸±à¸à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¹à¸à¹à¸",cancelButtonText:"ยà¸à¹à¸¥à¸´à¸ (à¹à¸à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸¡ à¸à¸.5 à¸à¹à¸à¸)",confirmButtonColor:"#e11d48",cancelButtonColor:"#6b7280"}).then(p=>{p.isConfirmed&&u()}):u()};return e.jsx(us,{children:e.jsxs("div",{className:"max-w-[1400px] mx-auto px-4 sm:px-6 lg:px-8 py-6 space-y-5 text-slate-800 dark:text-slate-200",children:[e.jsxs("header",{className:"border border-slate-300 dark:border-slate-700 bg-white dark:bg-[#202125]",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-6 gap-y-1 bg-[#1e3a5f] px-5 py-2 text-[11px] tracking-wide text-white",children:[e.jsx("span",{children:"à¸à¸¥à¸¸à¹à¸¡à¸à¸£à¸´à¸«à¸²à¸£à¸§à¸´à¸à¸²à¸à¸²à¸£ · à¸à¸²à¸à¸§à¸±à¸à¸à¸¥à¹à¸¥à¸°à¸à¸£à¸°à¹à¸¡à¸´à¸à¸à¸¥"}),e.jsxs("span",{children:["à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸² ",d," · ",N==="annual"?"à¸à¸¥à¸à¸à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²":`ภาà¸à¹à¸£à¸µà¸¢à¸à¸à¸µà¹ ${N}`]})]}),e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(hs,{to:"/academic/hub/evaluation"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-slate-900 dark:text-white sm:text-2xl",children:"à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸£à¸²à¸¢à¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸"}),e.jsxs("div",{className:"mt-1.5 space-y-0.5 text-xs leading-relaxed text-slate-600 dark:text-slate-400",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-bold text-slate-800 dark:text-slate-100",children:"à¹à¸à¸à¸ªà¸²à¸£à¸à¸µà¹à¸à¸±à¸à¸à¸³: "}),["à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¸³à¸ªà¹à¸à¹à¸¥à¹à¸¡ à¸à¸.5","à¹à¸à¸à¸ªà¸£à¸¸à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸","à¹à¸à¸à¸ªà¸£à¸¸à¸à¸à¸¸à¸à¸¥à¸±à¸à¸©à¸à¸°à¸à¸±à¸à¸à¸¶à¸à¸à¸£à¸°à¸ªà¸à¸à¹"].map((r,l)=>e.jsxs("span",{className:"mr-3 inline-block whitespace-nowrap",children:[["à¹","à¹","à¹"][l],") ",r]},r))]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-bold text-slate-800 dark:text-slate-100",children:"à¹à¸à¸·à¹à¸à¸à¹à¸: "}),"à¸à¹à¸à¸à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸¡ à¸à¸.5 (PDF) à¸à¸à¸à¸à¸¸à¸à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¸¡à¸à¸à¸«à¸¡à¸²à¸¢à¹à¸«à¹à¸à¸£à¸à¸à¹à¸§à¸à¸à¹à¸à¸à¸ªà¹à¸à¸à¸à¸à¹à¸à¸à¸ªà¸²à¸£"]})]})]})]}),e.jsxs("div",{className:"grid w-full shrink-0 grid-cols-1 gap-2 sm:grid-cols-3 lg:w-auto",children:[e.jsxs("button",{onClick:()=>Ke(!0),disabled:k||G,title:"à¸à¸£à¸§à¸à¸ªà¸à¸à¸ªà¸à¸²à¸à¸°à¹à¸à¸¥à¹ PDF ลà¹à¸²à¸ªà¸¸à¸à¹à¸à¸£à¸°à¸à¸",className:"inline-flex h-10 items-center justify-center gap-2 whitespace-nowrap border border-slate-300 bg-white px-4 text-xs font-semibold text-slate-700 transition hover:bg-slate-50 disabled:opacity-50 dark:border-slate-600 dark:bg-transparent dark:text-slate-200 dark:hover:bg-slate-800",children:[e.jsx(vs,{size:15,className:G?"animate-spin":""}),G?"à¸à¸³à¸¥à¸±à¸à¸à¸£à¸§à¸à¸ªà¸à¸...":"à¸à¸£à¸§à¸à¸ªà¸à¸à¸ªà¸à¸²à¸à¸°à¸¥à¹à¸²à¸ªà¸¸à¸"]}),e.jsxs("button",{onClick:()=>s("/academic/course-assignment"),className:"inline-flex h-10 items-center justify-center gap-2 whitespace-nowrap border border-slate-300 bg-white px-4 text-xs font-semibold text-slate-700 transition hover:bg-slate-50 dark:border-slate-600 dark:bg-transparent dark:text-slate-200 dark:hover:bg-slate-800",children:[e.jsx(ks,{size:15}),"à¸à¸²à¸£à¸²à¸à¸¡à¸à¸à¸«à¸¡à¸²à¸¢à¸à¸²à¸£à¸ªà¸à¸"]}),e.jsxs("button",{onClick:()=>s("/academic/grade-book"),className:"inline-flex h-10 items-center justify-center gap-2 whitespace-nowrap border border-slate-300 bg-white px-4 text-xs font-semibold text-slate-700 transition hover:bg-slate-50 dark:border-slate-600 dar
12k:bg-transparent dark:text-slate-200 dark:hover:bg-slate-800",children:[e.jsx(Ss,{size:15}),"à¸à¸°à¹à¸à¸µà¸¢à¸à¸§à¸±à¸à¸à¸¥ (à¸à¸.5)"]})]})]})]}),e.jsxs("section",{className:"border border-slate-300 bg-white dark:border-slate-700 dark:bg-[#202125]",children:[e.jsx("div",{className:"border-b border-slate-300 bg-slate-100 px-5 py-2.5 text-sm font-bold text-slate-800 dark:border-slate-700 dark:bg-slate-800/60 dark:text-slate-100",children:"สà¹à¸§à¸à¸à¸µà¹ ๠สรุà¸à¸ªà¸à¸²à¸à¸°à¸à¸²à¸£à¸à¸±à¸à¸à¸³à¹à¸¥à¹à¸¡ à¸à¸.5"}),e.jsx("dl",{className:"grid grid-cols-2 divide-x divide-y divide-slate-200 dark:divide-slate-700 sm:grid-cols-4 sm:divide-y-0",children:[{label:"รายวิà¸à¸²à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¸¡à¸à¸à¸«à¸¡à¸²à¸¢",value:te,tone:"text-slate-900 dark:text-white"},{label:"à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸¡ PDF à¹à¸¥à¹à¸§",value:ge,tone:"text-emerald-700 dark:text-emerald-400"},{label:"ยัà¸à¹à¸¡à¹à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸¡ PDF",value:Ae,tone:Ae>0?"text-red-700 dark:text-red-400":"text-slate-400"},{label:"รà¹à¸à¸¢à¸¥à¸°à¸à¸§à¸²à¸¡à¸à¸£à¸à¸à¹à¸§à¸",value:`${Ie}%`,tone:H?"text-emerald-700 dark:text-emerald-400":"text-amber-700 dark:text-amber-400"}].map(r=>e.jsxs("div",{className:"px-5 py-3",children:[e.jsx("dt",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:r.label}),e.jsx("dd",{className:`mt-0.5 text-2xl font-bold tabular-nums ${r.tone}`,children:r.value})]},r.label))}),!k&&te>0&&e.jsxs("div",{className:`flex flex-col gap-3 border-t border-slate-300 border-l-4 px-5 py-4 dark:border-slate-700 md:flex-row md:items-center md:justify-between ${H?"border-l-emerald-600 bg-emerald-50/50 dark:bg-emerald-950/10":"border-l-amber-500 bg-amber-50/50 dark:bg-amber-950/10"}`,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:`mt-0.5 ${H?"text-emerald-700 dark:text-emerald-400":"text-amber-700 dark:text-amber-400"}`,children:H?e.jsx(ft,{size:20}):e.jsx(Ns,{size:20})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold text-slate-900 dark:text-white",children:H?"à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸¡ à¸à¸.5 (PDF) à¸à¸£à¸à¸à¸¸à¸à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¸¡à¸à¸à¸«à¸¡à¸²à¸¢ à¸à¸£à¹à¸à¸¡à¸ªà¹à¸à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡":`ยัà¸à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸ªà¹à¸à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¹à¸à¹ â à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸§ ${ge} à¸à¸²à¸ ${te} รายวิà¸à¸²`}),e.jsx("p",{className:"mt-0.5 text-xs text-slate-600 dark:text-slate-400",children:H?"à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸£à¸à¸à¹à¸§à¸ สามารà¸à¸à¸±à¸à¸à¸³à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¸³à¸ªà¹à¸à¹à¸¥à¹à¸¡ à¸à¸.5 à¹à¸à¹":`à¸à¸à¹à¸«à¸¥à¸·à¸ ${Ae} รายวิà¸à¸²à¸à¸µà¹à¸à¹à¸à¸à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸¡ à¸à¸.5 (PDF) à¸à¹à¸à¸à¸ªà¹à¸à¸à¸à¸`}),e.jsx("div",{className:"mt-2 h-2 w-full max-w-sm bg-slate-200 dark:bg-slate-700",role:"progressbar","aria-valuenow":Ie,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:`h-full transition-all duration-500 ${H?"bg-emerald-600":"bg-amber-500"}`,style:{width:`${Ie}%`}})})]})]}),e.jsxs("button",{onClick:()=>V(),disabled:U,title:"à¸à¸´à¸¡à¸à¹à¹à¸¥à¸°à¸ªà¹à¸à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸£à¸²à¸¢à¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸",className:"inline-flex shrink-0 items-center justify-center gap-2 border border-red-700 bg-red-700 px-5 py-2.5 text-sm font-bold text-white transition hover:bg-red-800 disabled:opacity-50",children:[U?e.jsx(He,{size:16,className:"animate-spin"}):e.jsx(ht,{size:16}),U?"à¸à¸³à¸¥à¸±à¸à¸à¸£à¸°à¸¡à¸§à¸¥à¸à¸¥à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸à¸£à¸...":H?"สà¹à¸à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡":`สà¹à¸à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡ (${ge}/${te})`]})]})]}),e.jsxs("section",{className:"border border-slate-300 bg-white dark:border-slate-700 dark:bg-[#202125]",children:[e.jsx("div",{className:"border-b border-slate-300 bg-slate-100 px-5 py-2.5 text-sm font-bold text-slate-800 dark:border-slate-700 dark:bg-slate-800/60 dark:text-slate-100",children:"สà¹à¸§à¸à¸à¸µà¹ ๠à¸à¸³à¸«à¸à¸à¸à¸à¸à¹à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥"}),e.jsxs("div",{className:"grid gap-4 px-5 py-4 md:grid-cols-2 xl:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-[11px] font-semibold text-slate-600 dar
12k:text-slate-400",children:"à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸² / ภาà¸à¹à¸£à¸µà¸¢à¸"}),e.jsx(ys,{schoolId:f,academicYear:d,onAcademicYearChange:g,semester:N,onSemesterChange:B})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"porbor5-teacher",className:"mb-1 block text-[11px] font-semibold text-slate-600 dark:text-slate-400",children:"à¸à¸£à¸¹à¸à¸¹à¹à¸ªà¸à¸"}),e.jsxs("select",{id:"porbor5-teacher",value:D,onChange:r=>{je(r.target.value),fe(new Set)},className:"w-full border border-slate-300 bg-white px-3 py-2 text-xs text-slate-800 focus:border-[#1e3a5f] focus:outline-none focus:ring-1 focus:ring-[#1e3a5f] dark:border-slate-600 dark:bg-slate-800 dark:text-slate-100",children:[e.jsxs("option",{value:"my",children:["วิà¸à¸²à¸à¸µà¹à¸à¸±à¸à¸ªà¸à¸ (",(t==null?void 0:t.fullName)||"à¸à¸£à¸¹à¸à¸¹à¹à¹à¸à¹à¸à¸±à¸à¸à¸¸à¸à¸±à¸",")"]}),xt&&e.jsx("option",{value:"all",children:"à¸à¸£à¸¹à¸à¸¸à¸à¸à¸à¹à¸à¹à¸£à¸à¹à¸£à¸µà¸¢à¸ (à¸à¸±à¹à¸à¸«à¸¡à¸)"}),Ve.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id))]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"mb-1 block text-[11px] font-semibold text-slate-600 dark:text-slate-400",children:"สà¸à¸²à¸à¸°à¹à¸¥à¹à¸¡ à¸à¸.5"}),e.jsx("div",{className:"inline-flex w-full border border-slate-300 dark:border-slate-600",role:"group","aria-label":"à¸à¸£à¸à¸à¸à¸²à¸¡à¸ªà¸à¸²à¸à¸°à¹à¸¥à¹à¸¡ à¸à¸.5",children:[{key:"all",label:`à¸à¸±à¹à¸à¸«à¸¡à¸ (${te})`},{key:"saved",label:`à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸§ (${ge})`},{key:"pending",label:`à¸à¹à¸²à¸ (${Ae})`}].map((r,l)=>e.jsx("button",{type:"button",onClick:()=>Ce(r.key),"aria-pressed":xe===r.key,className:`flex-1 px-2 py-2 text-xs font-semibold transition ${l>0?"border-l border-slate-300 dark:border-slate-600":""} ${xe===r.key?"bg-[#1e3a5f] text-white":"bg-white text-slate-700 hover:bg-slate-50 dark:bg-transparent dark:text-slate-300 dark:hover:bg-slate-800"}`,children:r.label},r.key))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"porbor5-search",className:"mb-1 block text-[11px] font-semibold text-slate-600 dark:text-slate-400",children:"à¸à¹à¸à¸«à¸²"}),e.jsxs("div",{className:"relative",children:[e.jsx(ls,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-slate-400",size:14}),e.jsx("input",{id:"porbor5-search",type:"text",placeholder:"รหัสวิà¸à¸² / à¸à¸·à¹à¸à¸§à¸´à¸à¸² / à¸à¸±à¹à¸-หà¹à¸à¸ / à¸à¸·à¹à¸à¸à¸£à¸¹",value:ne,onChange:r=>X(r.target.value),className:"w-full border border-slate-300 bg-white py-2 pl-9 pr-3 text-xs text-slate-800 placeholder-slate-400 focus:border-[#1e3a5f] focus:outline-none focus:ring-1 focus:ring-[#1e3a5f] dark:border-slate-600 dark:bg-slate-800 dark:text-slate-100"})]})]})]})]}),e.jsxs("section",{className:"border border-slate-300 bg-white dark:border-slate-700 dark:bg-[#202125]",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-slate-300 bg-slate-100 px-5 py-2.5 dark:border-slate-700 dark:bg-slate-800/60",children:[e.jsxs("h2",{className:"text-sm font-bold text-slate-800 dark:text-slate-100",children:["สà¹à¸§à¸à¸à¸µà¹ ๠รายà¸à¸²à¸£à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¸¡à¸à¸à¸«à¸¡à¸²à¸¢ (",M.length," รายà¸à¸²à¸£)"]}),M.length>0&&e.jsx("button",{onClick:_e,className:"text-xs font-semibold text-[#1e3a5f] underline-offset-2 hover:underline dark:text-sky-300",children:K.size===M.length?"ยà¸à¹à¸¥à¸´à¸à¸à¸²à¸£à¹à¸¥à¸·à¸à¸à¸à¸±à¹à¸à¸«à¸¡à¸":"à¹à¸¥à¸·à¸à¸à¸à¸±à¹à¸à¸«à¸¡à¸"})]}),k?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(He,{size:28,className:"mb-2 animate-spin text-[#1e3a5f] dark:text-sky-300"}),e.jsx("p",{className:"text-xs",children:"à¸à¸³à¸¥à¸±à¸à¸à¸£à¸§à¸à¸ªà¸à¸à¸ªà¸à¸²à¸à¸°à¹à¸à¸¥à¹ à¸à¸.5 à¸à¸²à¸à¸à¸²à¸à¸à¹à¸à¸¡à¸¹à¸¥..."})]}):M.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center px-4 py-14 text-center",children:[e.jsx(Et,{size:32,className:"mb-2 text-slate-300 dark:text-slate-600"}),e.jsx("p",{className:"text-sm font-bold text-slate-700 dark:text-slate-200",children:"à¹à¸¡à¹à¸à¸à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸à¸¡à¸à¸à¸«à¸¡à¸²à¸¢à¸ªà¸à¸"}),e.jsx("p",{className:"mt-1 max-w-md text-xs text-slate-500",children:"หาà¸à¸¢à¸±à¸à¹à¸¡à¹à¸¡à¸µà¸à¸²à¸£à¸¡à¸à¸à¸«à¸¡à¸²à¸¢à¸à¸²à¸à¸ªà¸à¸ à¸à¸£à¸¸à¸à¸²à¸à¸£à¸§à¸à¸ªà¸à¸à¸à¸µà¹à¸«à¸à¹à¸²à¸£à¸°à¸à¸à¸¡à¸à¸à¸«à¸¡à¸²à¸¢à¸à¸²à¸à¸ªà¸à¸ หรืà¸à¹à¸à¸¥à¸µà¹à¸¢à¸à¸à¸µà¸à¸²à¸£à¸¨à¸¶à¸à¸©à¸²/ภาà¸à¹à¸£à¸µà¸¢à¸"})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[960px] border-collapse text-left text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#1e3a5f] text-white",children:[e.jsx("th",{className:"w-12 border border-[#2c4a72] px-3 py-2.5 text-center font-semibold",children:e.jsx("input",{type:"checkbox","aria-label":"à¹à¸¥à¸·à¸à¸à¸à¸±à¹à¸à¸«à¸¡à¸",checked:K.size===M.length&&M.length>0,onChange:_e,className:"h-4 w-4 accent-amber-500"})}),e.jsx("th",{className:"w-12 border border-[#2c4a72] px-3 py-2.5 text-center font-semibold",children:"à¸à¸µà¹"}),e.jsx("th",{className:"w-28 border border-[#2c4a72] px-3 py-2.5 font-semibold",children:"รหัสวิà¸à¸²"}),e.jsx("th",{className:"border border-[#2c4a72] px-3 py-2.5 font-semibold",children:"à¸à¸·à¹à¸à¸£à¸²à¸¢à¸§à¸´à¸à¸²"}),e.jsx("th",{className:"w-24 border border-[#2c4a72] px-3 py-2.5 text-center font-semibold",children:"à¸à¸±à¹à¸/หà¹à¸à¸"}),e.jsx("th",{className:"w-40 border border-[#2c4a72] px-3 py-2.5 font-semibold",children:"à¸à¸£à¸¹à¸à¸¹à¹à¸ªà¸à¸"}),e.jsx("th",{className:"w-24 border border-[#2c4a72] px-3 py-2.5 text-center font-semibold",children:"à¸
12ำà¸à¸§à¸ (à¸à¸)"}),e.jsx("th",{className:"w-36 border border-[#2c4a72] px-3 py-2.5 text-center font-semibold",children:"สà¸à¸²à¸à¸°à¹à¸¥à¹à¸¡ à¸à¸.5"}),e.jsx("th",{className:"w-56 border border-[#2c4a72] px-3 py-2.5 text-center font-semibold",children:"à¸à¸²à¸£à¸à¸³à¹à¸à¸´à¸à¸à¸²à¸£"})]})}),e.jsx("tbody",{className:"text-slate-700 dark:text-slate-300",children:M.map((r,l)=>{const m=K.has(r.id);return e.jsxs("tr",{className:`transition-colors hover:bg-sky-50/60 dark:hover:bg-slate-800/50 ${m?"bg-sky-50 dark:bg-sky-950/20":l%2===1?"bg-slate-50/70 dark:bg-slate-800/20":""}`,children:[e.jsx("td",{className:"border border-slate-200 px-3 py-2.5 text-center dark:border-slate-700",children:e.jsx("input",{type:"checkbox","aria-label":`à¹à¸¥à¸·à¸à¸ ${r.courseCode}`,checked:m,onChange:()=>St(r.id),className:"h-4 w-4 accent-[#1e3a5f]"})}),e.jsx("td",{className:"border border-slate-200 px-3 py-2.5 text-center tabular-nums text-slate-500 dark:border-slate-700",children:l+1}),e.jsx("td",{className:"border border-slate-200 px-3 py-2.5 font-mono font-semibold text-slate-900 dark:border-slate-700 dark:text-white",children:r.courseCode}),e.jsxs("td",{className:"border border-slate-200 px-3 py-2.5 dark:border-slate-700",children:[e.jsx("div",{className:"font-semibold text-slate-900 dark:text-white",children:r.courseTitle}),r.subjectGroup&&e.jsx("div",{className:"text-[10px] text-slate-500",children:r.subjectGroup})]}),e.jsx("td",{className:"border border-slate-200 px-3 py-2.5 text-center font-semibold dark:border-slate-700",children:r.classLabel}),e.jsx("td",{className:"max-w-[160px] truncate border border-slate-200 px-3 py-2.5 dark:border-slate-700",title:r.teacherName,children:r.teacherName}),e.jsx("td",{className:"border border-slate-200 px-3 py-2.5 text-center tabular-nums dark:border-slate-700",children:r.studentCount}),e.jsx("td",{className:"border border-slate-200 px-3 py-2.5 text-center dark:border-slate-700",children:r.hasPdf?e.jsxs("span",{className:"inline-flex items-center gap-1 border border-emerald-600 px-2 py-0.5 text-[11px] font-semibold text-emerald-800 dark:border-emerald-500 dark:text-emerald-300",children:[e.jsx(ft,{size:12})," à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸§"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 border border-red-600 px-2 py-0.5 text-[11px] font-semibold text-red-800 dark:border-red-500 dark:text-red-300",children:[e.jsx(Et,{size:12})," ยัà¸à¹à¸¡à¹à¸à¸±à¸à¸à¸¶à¸"]})}),e.jsx("td",{className:"border border-slate-200 px-3 py-2.5 dark:border-slate-700",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-1.5",children:[r.hasPdf?e.jsxs("button",{onClick:()=>mt(r),disabled:ee===r.id,title:"à¸à¸¹à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¹à¸¥à¹à¸¡ à¸à¸.5 (PDF)",className:"inline-flex items-center gap-1 border border-slate-300 bg-white px-2.5 py-1.5 font-semibold text-slate-700 transition hover:bg-slate-50 disabled:opacity-50 dark:border-slate-600 dark:bg-transparent dark:text-slate-200 dark:hover:bg-slate-800",children:[ee===r.id?e.jsx(He,{size:13,className:"animate-spin"}):e.jsx(ns,{size:13}),"à¸à¸¹à¹à¸¥à¹à¸¡ PDF"]}):e.jsxs("button",{onClick:()=>s(`/academic/grade-book?courseId=${r.courseId}&classId=${r.classLevel}&room=${r.room}&semester=${r.sectionSemester||N}`),title:"à¹à¸à¸´à¸à¸«à¸à¹à¸² à¸à¸.5 à¹à¸à¸·à¹à¸à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¸°à¸ªà¹à¸à¸à¸à¸à¹à¸¥à¹à¸¡ PDF",className:"inline-flex items-center gap-1 border border-amber-600 bg-amber-50 px-2.5 py-1.5 font-semibold text-amber-900 transition hover:bg-amber-100 dark:border-amber-500 dark:bg-amber-950/20 dark:text-amber-200",children:[e.jsx(os,{size:13}),"à¹à¸à¸à¸±à¸à¸à¸¶à¸à¹à¸¥à¹à¸¡ à¸à¸.5"]}),e.jsxs("button",{onClick:()=>V([r]),title:"à¸à¸´à¸¡à¸à¹à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¹à¸à¸à¸²à¸°à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸µà¹",className:"inline-flex items-center gap-1 border border-[#1e3a5f] bg-white px-2.5 py-1.5 font-semibold text-[#1e3a5f] transition hover:bg-[#1e3a5f] hover:text-white dark:border-sky-400 dark:bg-transparent dark:text-sky-300 dark:hover:bg-sky-400 dark:hover:text-slate-900",children:[e.jsx(ht,{size:13}),"à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡"]})]})})]},r.id)})})]})}),e.jsx("div",{className:"border-t border-slate-200 px-5 py-2.5 text-[11px] text-slate-500 dark:border-slate-700 dark:text-slate-400",children:'หมายà¹à¸«à¸à¸¸: à¹à¸¥à¸·à¸à¸à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¹à¸à¸à¸²à¸£à¸²à¸à¹à¸à¸·à¹à¸à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸«à¸¥à¸²à¸¢à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸£à¹à¸à¸¡à¸
12ัภหรืà¸à¸à¸ "à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡" à¸à¸µà¹à¹à¸à¸§à¹à¸à¸·à¹à¸à¸à¸à¸à¹à¸à¸à¸²à¸°à¸£à¸²à¸¢à¸§à¸´à¸à¸²à¸à¸±à¹à¸'})]}),K.size>0&&e.jsxs("div",{className:"fixed bottom-6 left-1/2 z-40 flex -translate-x-1/2 flex-wrap items-center gap-4 border border-slate-600 bg-[#14273f] px-5 py-3 text-white shadow-2xl animate-slide-up",children:[e.jsxs("span",{className:"text-xs font-semibold",children:["à¹à¸¥à¸·à¸à¸à¹à¸¥à¹à¸§ ",e.jsx("span",{className:"tabular-nums text-amber-300",children:K.size})," รายวิà¸à¸²"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>fe(new Set),className:"border border-slate-500 px-3 py-1.5 text-xs font-semibold transition hover:bg-slate-700",children:"ยà¸à¹à¸¥à¸´à¸à¸à¸²à¸£à¹à¸¥à¸·à¸à¸"}),e.jsxs("button",{onClick:()=>V(),disabled:U,title:"à¸à¸´à¸¡à¸à¹à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡à¸£à¸²à¸¢à¸à¸²à¸à¸à¸¥à¸ªà¸±à¸¡à¸¤à¸à¸à¸´à¹à¸à¸²à¸à¸à¸²à¸£à¹à¸£à¸µà¸¢à¸",className:"inline-flex items-center gap-1.5 border border-amber-400 bg-amber-400 px-4 py-1.5 text-xs font-bold text-slate-900 transition hover:bg-amber-300 disabled:opacity-50",children:[U?e.jsx(He,{size:14,className:"animate-spin"}):e.jsx(ht,{size:14}),"à¸à¸à¸à¸à¸±à¸à¸à¸¶à¸à¸à¹à¸à¸à¸§à¸²à¸¡ (",K.size," วิà¸à¸²)"]})]})]}),J&&$e&&e.jsx(Ms,{isOpen:J,onClose:()=>se(!1),pdfProps:$e,schoolId:f,createdBy:(t==null?void 0:t.fullName)||(t==null?void 0:t.displayName)||(t==null?void 0:t.email)||"à¸à¸£à¸¹à¸à¸¹à¹à¸ªà¸à¸"}),oe&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-4 pb-4 pt-[76px] bg-black/60 backdrop-blur-sm animate-fade-in",children:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-2xl shadow-2xl flex flex-col w-full max-w-5xl h-full max-h-[calc(100vh-92px)] border border-gray-200 dark:border-gray-800 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-200 dark:border-gray-800",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-800 dark:text-white truncate",children:oe.title}),e.jsx("button",{onClick:()=>me(null),className:"p-1 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-white transition",children:e.jsx(Yt,{size:18})})]}),e.jsx("div",{className:"flex-1 bg-gray-100 dark:bg-gray-950 p-2",children:e.jsx("iframe",{src:oe.url,className:"w-full h-full border-0 rounded-lg shadow-inner",title:oe.title})})]})})]})})};export{vr as PorBor5SubmissionMemoPage,vr 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.