1import{r as K,j as e,k as p,T as l,P as q,n as j,aE as Q,cK as Y,B as k,e as W,gK as J,a9 as V,dC as i,dF as I,dr as t,ds as w,dD as P,dG as E,dH as b,jG as G,dE as X,an as ee,a as te,y as se,w as N,x as T,c as ie,t as R,lW as re,S as ae,ad as ne}from"./index-aREvobyF.js";import{P as oe}from"./PageMetaHeader-6lUw-EYb.js";import{S as $}from"./SimpleTable-DF7EMZw0.js";import{C as le}from"./CreativeActivitySurveyResponseModal-Bkm_85AM.js";import{u as M,a as ce,r as de}from"./xlsx-Dxpd-3wM.js";import{s as pe}from"./file-CYbLPrGl.js";import"./link-box-DcUyRFYn.js";import"./table-BqH1TAsn.js";try{let s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="06ce07fd-40d7-4561-8329-800b1cbde6ac",s._sentryDebugIdIdentifier="sentry-dbid-06ce07fd-40d7-4561-8329-800b1cbde6ac")}catch{}const ye=({onFileUpload:s,onTemplateDownload:r})=>{const y=K.useRef(null),o=c=>{var a;const n=(a=c.target.files)==null?void 0:a[0];n&&s(n),c.target.value=""};return e.jsxs(p,{gap:5,children:[e.jsxs(p,{gap:3,children:[e.jsx(l,{textStyle:"t4-semibold-compact",children:"1. ìì
íì¼ ì
ë¡ë"}),e.jsx(l,{textStyle:"b3-medium",color:"fg",children:"ìëìì í
í릿ì ë¤ì´ë°ì, ì¤ë¬¸ ë´ì©ì ììì ë§ì¶° ì
ë ¥í´ ì£¼ì¸ì."})]}),e.jsxs(p,{gap:3,children:[e.jsx(l,{textStyle:"b2-semibold",color:"fg",children:"íì¼ ì
ë¡ë"}),e.jsxs(q,{gap:3,children:[e.jsxs(j,{colorPalette:"blue",variant:"solid",onClick:()=>{var c;return(c=y.current)==null?void 0:c.click()},children:[e.jsx(Q,{}),"íì¼ ì
ë¡ë"]}),e.jsxs(j,{colorPalette:"blue",variant:"surface",onClick:r,children:[e.jsx(Y,{}),"ì¤ë¬¸ ìëµ í
í릿 ë¤ì´ë¡ë"]}),e.jsx("input",{ref:y,type:"file",accept:".xlsx,.xls,.csv",style:{display:"none"},onChange:o})]}),e.jsxs(k,{bg:"bg.subtle",border:"1px solid",borderColor:"border",borderRadius:"lg",p:4,children:[e.jsxs(l,{textStyle:"b3-semibold-compact",color:"fg",mb:1,children:["â» ë°ëì ìì"," ",e.jsx(l,{as:"span",color:"blue.fg",children:"[ì¤ë¬¸ ìëµ í
í릿]"}),"ì ë¤ì´ë°ì, ììì ë§ì¶° ìì± í ì
ë¡ëí´ ì£¼ì¸ì. ë¤ë¥¸ ììì ì¬ì©í ì ìì´ì."]}),e.jsxs(p,{as:"ul",pl:5,gap:0,listStyleType:"disc",children:[e.jsxs(l,{as:"li",textStyle:"b3-regular",color:"fg",children:["íë²Â·ì´ë¦ ìì"," ",e.jsx(l,{as:"span",textStyle:"b3-semibold-compact",color:"blue.fg",children:"C1ì´ë¶í° ì¤ë¬¸ 문íì í 칸ì íëì©"})," ","ë£ê³ ,"," ",e.jsx(l,{as:"span",textStyle:"b3-semibold-compact",color:"blue.fg",children:"íì ëµë³ì í´ë¹ íì íì ì
ë ¥"}),"í´ ì£¼ì¸ì."]}),e.jsx(l,{as:"li",textStyle:"b3-regular",color:"fg",children:"ì¤ë¬¸ì íì ìëµì í목 ë³ë¡ 1,000ì ì´ë´ë¡ ìì±í´ 주ì¸ì."}),e.jsx(l,{as:"li",textStyle:"b3-regular",color:"fg",children:"íì¼ ì©ëì 20MBê¹ì§ ê°ë¥í´ì."})]})]})]})]})},me=(s,r)=>r.map((y,o)=>({key:`preview-${s.memberKey}-${o}`,question:y,answer:s.answers[o]??"",created_at:new Date().toISOString()})),ue=s=>
1({key:s.memberKey,identity:s.studentIdentity,name:s.studentName,year:new Date().getFullYear(),grade:0,class_num:0,number:0}),z=({label:s,value:r})=>e.jsxs(q,{gap:2,align:"center",children:[e.jsx(V,{colorPalette:"gray",variant:"subtle",size:"sm",children:s}),e.jsx(l,{textStyle:"b2-medium",children:r})]}),be=({parsedData:s})=>{const[r,y]=K.useState(null);if(!s)return e.jsxs(p,{gap:4,children:[e.jsx(l,{textStyle:"t4-semibold-compact",children:"2. ì
ë¡ë íì¼ íì¸"}),e.jsx(k,{border:"1px solid",borderColor:"border",borderRadius:"lg",overflow:"hidden",children:e.jsxs(p,{align:"center",py:20,gap:4,children:[e.jsx(k,{bg:"bg.muted",borderRadius:"full",p:3,display:"flex",alignItems:"center",justifyContent:"center",children:e.jsx(W,{as:J,boxSize:5,color:"fg.muted"})}),e.jsxs(p,{gap:2,textAlign:"center",children:[e.jsx(l,{textStyle:"b1-semibold",color:"fg",children:"íì¼ì ì
ë¡ëí´ ì£¼ì¸ì."}),e.jsx(l,{textStyle:"b2-regular",color:"fg.muted",children:"ì
ë¡ë í ë±ë¡í ë´ì©ì íì¸í ì ìì´ì."})]})]})})]});const o=s.questions.map((a,m)=>({key:`q-${m}`,cells:[{key:"no",children:m+1},{key:"question",children:a}]})),c=s.questions.length,n=s.rows.map(a=>{const m=a.answers.filter(x=>x.trim()!=="").length;return{key:a.memberKey,cells:[{key:"íë²",children:a.studentIdentity,w:"table.xs"},{key:"ì´ë¦",children:a.studentName,w:"table.xs"},{key:"ìëµì",children:`${m}/${c}`,w:"table.xs"},...s.questions.map((x,v)=>{var A;return{key:`문í${v+1}`,children:(A=a.answers[v])!=null&&A.trim()?e.jsx(l,{truncate:!0,textStyle:"b3-regular",children:a.answers[v]}):e.jsx(l,{color:"fg.subtle",children:"-"}),display:{base:"none",md:"table-cell"}}}),{key:"ìì¸í보기",children:e.jsx(j,{variant:"ghost",colorPalette:"blue",size:"xs",onClick:()=>y({student:ue(a),surveyResponses:me(a,s.questions)}),children:"ìì¸í 보기"}),w:"100px"}]}});return e.jsxs(e.Fragment,{children:[e.jsxs(p,{gap:6,children:[e.jsx(l,{textStyle:"t4-semibold-compact",children:"2. ì
ë¡ë íì¼ íì¸"}),s.unmatchedIdentities.length>0&&e.jsx(k,{bg:"red.subtle",border:"1px solid",borderColor:"red.muted",borderRadius:"lg",p:3,children:e.jsxs(l,{textStyle:"b3-medium",color:"red.fg",children:["ë±ë¡ëì§ ìì íë²: ",e.jsx("strong",{children:s.unmatchedIdentities.join(", ")})]})}),e.jsxs(p,{gap:3,children:[e.jsx(z,{label:"문í ì",value:`${s.questions.length}ê°`}),e.jsx(k,{overflow:"hidden",children:e.jsx($,{size:"sm",rows:o,header:{columns:[{key:"no",children:"No.",w:"table.xs"},{key:"question",children:"ì¤ë¬¸ 문í"}]}})})]}),e.jsxs(p,{gap:3,children:[e.jsx(z,{label:"ìëµ íì ì",value:`${s.rows.length}ëª
`}),e.jsx(k,{overflow:"hidden",children:e.jsx($,{size:"sm",rows:n,header:{columns:[{key:"íë²",children:"íë²",w:"table.xs"},{key:"ì´ë¦",children:"ì´ë¦",w:"table.xs"},{key:"ìëµì",children:"ìëµ ì",w:"table.xs"},...s.questions.map((a,m)=>({key:`문í${m+1}`,children:`문í ${m+1}`,display:{base:"none",md:"table-cell"}})),{key:"ìì¸í보기",children:"ìì¸í 보기",w:"table.sm"}]}})})]})]}),r&&e.jsx(le,{student:r.student,surveyResponses:r.surveyResponses,open:!0,onClose:()=>y(null)})]})},xe=0,F=2,ve=(s,r,y)=>{const o=de(s,{type:"array"}),c=o.Sheets[o.SheetNames[0]],n=M.sheet_to_json(c,{header:1,defval:""});if(n.length<1)return{filename:r,questions:[],rows:[],unmatchedIdentities:[]};const[a,...m]=n,x=a.slice(F).map(d=>String(d??"")),v=x.map((d,g)=>d.trim()?g:-1).filter(d=>d!==-1),A=v.map(d=>x[d]),U=new Map(y.map(d=>[d.student.identity,d])),S=[],C=[];for(const d of m){const g=String(d[xe]??"").trim();if(!g)continue;const u=U.get(g);if(!u){C.push(g);continue}const _=d.slice(F);S.push({memberKey:u.key,studentIdentity:g,studentName:u.student.name,answers:v.map(h=>String(_[h]??""))})}return{filename:r,questions:A,rows:S,unmatchedIdentities:C}},ge=(s,r=[])=>{const y=["íë²","ì´ë¦",...r],o=s.map(a=>[a.student.identity,a.student.name,...r.map(()=>"")]),c=M.aoa_to_sheet([y,...o]),n=M.book_new();return M.book_append_sheet(n,c,"Sheet1"),ce(n,{type:"array",bookType:"xlsx"})},he="",fe=100,Ae=6;i({activity_type:P(["autonomous","career","club"]),year:w().int().describe("íë
ë"),name:t().max(fe).default(he).describe("íëëª
(ëì리 íì)"),grade:I([w().int().min(1).max(Ae),E()]).optional().describe("íë
(ìì¨/ì§ë¡ íì)"),class_num:I([w().int().min(1),E()]).optional().describe("ë° (ìì¨/ì§ë¡ íì)")});i({activity_key:t()});i({activity_key:t()});const _e=100;i({name:t().min(1).max(_e).describe("ëì리ëª
")});i({activity_key:t()});i({activity_key:t()});i({activity_key:t()});const ke=new RegExp("[A-Za-z0-9-_]{22}"),Ce=[],we=new RegExp("[A-Za-z0-9-_]{22}"),je=[];i({add_student_keys:b(t().regex(ke)).default(Ce).describe("ì¶ê°í íì key"),remove_member_keys:b(t().regex(we)).default(je).describe("ì ê±°í ë©¤ë² key")});i({activity_key:t(),member_key:t()});const Se="",Be=1e3,Re="",Me="[]",Ie="[]";i({keywords:t().max(Be).default(Se).describe("í¤ìë/ë©ëª¨"),student_level:P(["H","M","L",""]).default(Re).describe("íë ìì¤"),delete_file_keys:t().default(Me).describe("ìì í íì¼ key ëª©ë¡ (JSON array str)"),delete_survey_response_keys:t().default(Ie).describe("ìì í ì¤ë¬¸ ìëµ key ëª©ë¡ (JSON array str)"),pdf_file:I([G(Blob),E()]).optional()});i({activity_key:t(),member_key:t()});i({activity_key:t()});const Ee=new RegExp("[A-Za-z0-9-_]{22}");i({items:I([b(i({member_key:t().regex(Ee),start_page:w().int().min(1),end_page:w().int().min(1)})),t(),E()]).optional().describe("í목 목ë¡"),file:G(Blob)});i({activity_key:t()});const D=1e3,Ue=new RegExp("[A-Za-z0-9-_]{22}");i({filename:t().describe("ì본 íì¼ëª
"),questions:b(t().max(D)).describe("ê³µíµ ì§ë¬¸ 목ë¡"),member_answers:b(i({member_key:t().regex(Ue),answers:b(t()).describe("ì§ë¬¸ ììì ëìíë ëµë³ 목ë¡")})).describe("멤ë²ë³ ëµë³ 목ë¡")});i({activity_key:t()});const Te=new RegExp("[A-Za-z0-9-_]{22}"),Ke="",qe="",Pe=[];i({items:b(i({member_key:t().regex(Te),keywords:t().default(Ke).describe("í¤ìë/ë©ëª¨"),student_level:P(["H","M","L",""]).default(qe).describe("íë ìì¤")})).default(Pe).describe("ì¼ê´ ìì í목 목ë¡")});i({activity_key:t()});const De=new RegExp("[A-Za-z0-9-_]{22}"),Le=[];i({items:b(i({member_key:t().regex(De),content:t().describe("ìµì¢
ê¸°ë¡ ë´ì©")})).default(Le).describe("ì¼ê´ ì ì¥ í목 목ë¡")});i({activity_key:t()});i({label:t().describe("ìì í ì¼ê´ ì
ë¡ë ë¼ë²¨"),target:t().describe("ìì ëì: 'files' ëë 'survey_responses'")}
1);i({activity_key:t()});i({activity_key:t(),member_key:t()});const Ne="",$e=100;i({custom_content:t().max($e).default(Ne).describe("êµì¬ ì§ì ìì± ì½í ì¸ ")});i({activity_key:t(),member_key:t()});i({activity_key:t(),member_key:t(),element_key:t()});i({is_selected:X().describe("ì í ì¬ë¶")});i({activity_key:t()});const ze=new RegExp("[A-Za-z0-9-_]{22}");i({member_keys:b(t().regex(ze)).describe("ëì ë©¤ë² key 목ë¡")});i({activity_key:t()});const Fe=new RegExp("[A-Za-z0-9-_]{22}"),Ge="ë³´íµ",Oe="";i({member_keys:b(t().regex(Fe)).describe("ëì ë©¤ë² key 목ë¡"),length_preset:t().default(Ge).describe("ì§§ê² / ë³´íµ / 길ê²"),user_message:t().default(Oe).describe("êµì¬ ë©ëª¨")});i({activity_key:t()});i({activity_key:t()});const Ze=D,He=D,st=()=>{const{activityKey:s}=ee(),r=te(),y=se(),[o,c]=K.useState(null),{data:n}=N(T.creativeActivities.detail(s)),{data:a,isPending:m}=N(T.creativeActivities.detail(s)._ctx.members),x=a??[],{mutate:v,isPending:A}=ie({mutationFn:()=>{if(!o)throw new Error("no data");return re.appsCreativeActivitiesApiSurveyBatchExcelUpload({activityKey:s,requestBody:{filename:o.filename,questions:o.questions,member_answers:o.rows.map(u=>({member_key:u.memberKey,answers:u.answers}))}})},onSuccess:()=>{R.create({title:"ìë£ê° ë±ë¡ëììµëë¤.",type:"success"}),y.invalidateQueries({queryKey:T.creativeActivities.detail(s)._ctx.members.queryKey}),r(-1)}}),U=u=>{const _=new FileReader;_.readAsArrayBuffer(u),_.onload=h=>{var L;const O=(L=h.target)==null?void 0:L.result,Z=x.map(f=>({key:f.key,student:{identity:f.student.identity,name:f.student.name}})),B=ve(O,u.name,Z);if(B.questions.some(f=>f.length>Ze)){c(null),R.create({title:"ê° ì§ë¬¸ì 1,000ì ì´ë´ë¡ ì ë ¥í´ ì£¼ì¸ì.",type:"error"});return}if(B.rows.some(f=>f.answers.some(H=>H.length>He))){c(null),R.create({title:"ê° ìëµì 1,000ì ì´ë´ë¡ ì ë ¥í´ ì£¼ì¸ì.",type:"error"});return}if(B.rows.length===0){c(null),R.create({title:"ë±ë¡í ì ë³´ê° ììµëë¤",type:"error"});return}c(B)}},S=()=>{const u=x.map(h=>({key:h.key,student:{identity:h.student.identity,name:h.student.name}})),_=ge(u);pe(new Blob([_]),"ì¤ë¬¸_ìëµ_í í릿.xlsx")},C=n!=null&&n.grade?`${n.grade}íë `:"",d=n!=null&&n.class_num?`${n.class_num}ë°`:"",g=C||d?` : ${C} ${d}`:"";return m?e.jsx(p,{align:"center",py:20,children:e.jsx(ae,{role:"status"})}):e.jsxs(p,{rowGap:0,children:[e.jsx(oe,{title:`ì¤ë¬¸ ìëµ ì¼ê´ ë±ë¡${g}`,description:"íìë¤ì´ ì ì¶í ì¤ë¬¸ ìëµì ìì ë¡ ì¼ê´ ë±ë¡í ì ìì´ì. ë±ë¡í ìëµì AIê° ë¶ìí ë íì íë ìë£ë¡ íì©ë¼ì.",backLink:"-1"}),e.jsxs(p,{bg:"white",borderRadius:"xl",p:6,gap:6,shadow:"sm",children:[e.jsx(ye,{onFileUpload:U,onTemplateDownload:S}),e.jsx(p,{height:"1px",bg:"border"}),e.jsx(be,{parsedData:o})]}),e.jsxs(q,{justify:"flex-end",columnGap:3,pt:6,pb:10,children:[e.jsx(j,{variant:"outline",colorPalette:"blue",borderRadius:"full",onClick:()=>r(-1),children:"ì´ì ì¼ë¡"}),e.jsxs(j,{colorPalette:"blue",borderRadius:"full",disabled:!o,loading:A,onClick:()=>v(),children:[e.jsx(ne,{}),"ë±ë¡ ìë£"]})]})]})};export{st as default}; 2//# sourceMappingURL=CreativeActivitySurveyBatchUploadPage-B-pmz5sV.js.map
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.