1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9842],{24336:function(e,t,n){n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]])},35596:function(e,t,n){n.d(t,{Z:function(){return k}});var r=n(57437),a=n(2265),i=n(52345),s=n(59717),l=n(81906),d=n(33728),o=n(57586),c=n(13100),u=n(32489),x=n(46977),m=n(93448),h=n(21652),p=n(8345),f=n(82941);let b=0,g=[],v=0,w=!1;function j(){v++,window.history.back()}let y="";function k(e){let{isOpen:t,onClose:n,title:k,children:N,footer:z,className:E}=e,C=(0,a.useId)(),D=(0,i.J)(),S=(0,s.o)(),M=(0,l.c)(0);(0,a.useEffect)(()=>{t&&M.set(0)},[t,M]);let I=(0,d.H)(M,[0,240],[1,0]),L=(0,a.useRef)(n),_=(0,a.useRef)(!1);(0,a.useEffect)(()=>{L.current=n},[n]),(0,a.useEffect)(()=>{if(!t)return;b||(y=document.body.style.overflow),b++,w||(w=!0,window.addEventListener("popstate",e=>{var t;if((v>0||g.length>0)&&(0,p.l)(e),v>0){v--;return}null===(t=g.at(-1))||void 0===t||t.onPop()},{capture:!0}));let e={id:C,onPop:()=>{_.current&&(_.current=!1,L.current())}};g.push(e),document.body.style.overflow="hidden";let n=(0,h.UM)(),r=window.history.state||{};return n&&!_.current&&(window.history.pushState({...r,isBottomSheet:!0,sheetId:C},""),_.current=!0),()=>{var t;_.current&&(null===(t=window.history.state)||void 0===t?void 0:t.sheetId)===C&&(_.current=!1,j()),g.splice(g.indexOf(e),1),--b<=0&&(b=0,document.body.style.overflow=y)}},[t,C]);let A=(0,a.useCallback)(()=>{_.current&&(_.current=!1,j()),n()},[n]),F=(0,x.a)(t,A),R=(0,a.useCallback)((e,t)=>{"pointercancel"!==e.type&&"touchcancel"!==e.type&&(t.velocity.y>500||t.offset.y>100)&&A()},[A]),T=(0,a.useRef)(null),Z=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!t)return;let e=T.current;if(!e)return;let n=[],r=function(t){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!e.contains(t)||Z.current!==t)return;let r=e.getBoundingClientRect(),a=t.getBoundingClientRect(),i=(0,f.Wk)({top:a.top-r.top,bottom:a.bottom-r.top},e.clientHeight,12,12);0!==i&&e.scrollTo({top:Math.max(0,e.scrollTop+i),behavior:n?"smooth":"auto"})},a=e=>{let t=e.target;t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName||t.isContentEditable)&&(Z.current=t,r(t,!1),n.push(setTimeout(()=>r(t,!0),120)),n.push(setTimeout(()=>r(t,!0),300)),n.push(setTimeout(()=>r(t,!0),500)))},i=()=>{Z.current=null},s=()=>{Z.current&&r(Z.current,!0)};e.addEventListener("focusin",a),e.addEventListener("focusout",i);let l=window.visualViewport;return null==l||l.addEventListener("resize",s),()=>{n.forEach(clearTimeout),e.removeEventListener("focusin",a),e.removeEventListener("focusout",i),null==l||l.removeEventListener("resize",s)}},[t]),(0,r.jsx)(o.M,{children:t&&(0,r.jsxs)("div",{className:"md:hidden fixed inset-x-0 z-[100] flex items-end",style:{top:"var(--vv-offset-top, 0px)",height:"var(--app-height)"},children:[(0,r.jsx)(c.E.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.22,ease:[.22,1,.36,1]},className:"absolute inset-0",children:(0,r.jsx)(c.E.div,{style:{opacity:I},onClick:A,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"})}),(0,r.jsxs)(c.E.div,{style:{y:M,maxHeight:"90%"},initial:D?{opacity:0}:{y:"100%"},animate:{y:0,opacity:1},exit:D?{opacity:0}:{y:"100%"},transition:D?{duration:.12}:{type:"spring",damping:30,stiffness:320,mass:.8},drag:"y",dragListener:!1,dragControls:S,dragConstraints:{top:0},dragSnapToOrigin:!0,dragMomentum:!1,dragElastic:{top:.12,bottom:.75},onDragEnd:R,ref:F,tabIndex:-1,"aria-label":k||"ìì¸ ì¤ì ",role:"dialog","aria-modal":"true",className:(0,m.cn)("relative w-full bg-white dark:bg-[#18181b] border-t border-transparent dark:border-white/[0.08] rounded-t-2xl","flex flex-col overflow-hidden mobile-sheet-pad shadow-2xl",E),children:[(0,r.jsxs)("div",{onPointerDown:e=>{e.target.closest("button")||S.start(e)},className:"shrink-0 cursor-grab active:cursor-grabbing touch-none select-none",children:[(0,r.jsx)("div",{className:"flex justify-center pt-3 pb-2",children:(0,r.jsx)("div",{className:"w-9 h-1 rounded-full bg-zinc-400/70 dark:bg-zinc-700"})}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pb-2 border-b border-zinc-200/40 dark:border-zinc-800/60",children:[(0,r.jsx)("h3",{className:"text-[var(--mobile-font-h2)] font-semibold text-zinc-900 dark:text-zinc-100",children:k}),(0,r.jsx)("button",{type:"button",onClick:A,"aria-label":"ë«ê¸°",className:"flex h-11 w-11 items-center justify-center rounded-lg text-zinc-600 dark:text-zinc-300",children:(0,r.jsx)(u.Z,{size:20})})]})]}),(0,r.jsx)("div",{ref:T,className:"flex-1 overflow-y-auto overflow-x-hidden px-4 pt-3 pb-2 mobile-scroll mobile-sheet-scroll",children:N}),z&&(0,r.jsx)("div",{className:"shrink-0 px-4 pt-2.5 pb-1 border-t border-zinc-100 dark:border-zinc-800/80 bg-white/95 dark:bg-[#18181b]/95 backdrop-blur-md",children:z})]})]})})}},93973:function(e,t,n){n.d(t,{Z:function(){return d}});var r=n(57437),a=n(73247),i=n(99388),s=n(99397),l=n(93448);function d(e){let{value:t,onChange:n,placeholder:d,searchLabel:o,actionLabel:c,onAction:u}=e;return(0,r.jsx)("div",{className:"fixed mobile-floating-bar left-0 right-0 px-6 flex justify-center z-40 pointer-events-none",children:(0,r.jsxs)("div",{className:"w-full max-w-[400px] flex gap-2 pointer-events-auto group",children:[(0,r.jsxs)("div",{className:(0,l.cn)("relative flex-1 flex items-center h-[48px] px-4","bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl border border-zinc-200/80 dark:border-white/10 rounded-full","shadow-[0_4px_12px_rgba(0,0,0,0.03)] dark:shadow-[0_4px_12px_rgba(0,0,0,0.3)]","transition duration-200 group-focus-within:border-zinc-300 dark:group-focus-within:border-zinc-600 group-focus-within:shadow-[0_4px_16px_rgba(0,0,0,0.06)]"),children:[(0,r.jsx)("div",{className:"shrink-0 text-zinc-400 dark:text-zinc-500",children:(0,r.jsx)(a.Z,{size:20,strokeWidth:1.5})}),(0,r.jsx)("input",{type:"text","aria-label":o,placeholder:d,value:t,onChange:e=>n(e.target.value),className:(0,l.cn)("w-full h-full bg-transparent border-none outline-none","pl-3 pr-1 text-[16px] font-normal","text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500")}),t&&(0,r.jsx)("button",{type:"button","aria-label":"ê²ìì´ ì§ì°ê¸°",onClick:()=>n(""),className:"shrink-0 p-1.5 -mr-1 text-zinc-400 dark:text-zinc-500 active:text-zinc-600 dark:active:text-zinc-300 active:scale-95 transition",children:(0,r.jsx)(i.Z,{size:18,strokeWidth:1.75})})]}),(0,r.jsx)("button",{type:"button","aria-label":c,onClick:u,className:(0,l.cn)("w-[48px] h-[48px] shrink-0 flex items-center justify-center rounded-full","bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl border border-zinc-200/80 dark:border-white/10","shadow-[0_4px_12px_rgba(0,0,0,0.03)] dark:shadow-[0_4px_12px_rgba(0,0,0,0.3)]","text-zinc-400 dark:text-zinc-300 active:scale-90 transition"),children:(0,r.jsx)(s.Z,{size:22,strokeWidth:1.5})})]})})}},99842:function(e,t,n){n.r(t),n.d(t,{AttendanceCalendarView:function(){return eU},default:function(){return eV}});var r=n(57437),a=n(90982),i=n(30419),s=n(78529),l=n(28691),d=n(2265),o=n(33145),c=n(92451),u=n(10407),x=n(30401),m=n(18930),h=n(99397),p=n(31047),f=n(82029),b=n(73247),g=n(99388),v=n(24336),w=n(93448),j=n(4908),y=n(83008),k=n(13376),N=n(27526),z=n(54696),E=n(67920),C=n(58819),D=n(98319),S=n(46173);let M=e=>{let{value:t,options:n,onChange:a,className:i}=e,s=null===t,l=e=>{t===e?a(null):a(e)};return(0,r.jsx)("div",{className:(0,w.cn)("flex gap-1.5 justify-center",i),children:n.map(e=>{let n=t===e,a=(0,S.on)(e);return(0,r.jsx)("button",{onClick:()=>l(e),className:(0,w.cn)("font-semibold transition-colors whitespace-nowrap border",s||n?"o
1pacity-100":"opacity-0 pointer-events-none absolute",n&&a?"w-full h-[28px] rounded-lg text-sm bg-transparent border-transparent text-[var(--ink)] dark:text-[var(--ink-dark)] hover:bg-black/[0.03] dark:hover:bg-white/10":"min-w-[52px] px-2.5 py-1 rounded-full text-xs bg-transparent text-zinc-500 dark:text-[#8E8E93] border-zinc-200 dark:border-white/10 hover:border-zinc-400 hover:text-zinc-900 dark:hover:border-white/25 dark:hover:text-white"),style:n&&a?{"--ink":a.fg,"--ink-dark":a.darkFg}:void 0,children:e},e)})})};var I=n(26710),L=n(91455),_=n(46977);let A=e=>{let{value:t,studentId:n,onChange:a,onSelect:i,className:s}=e,{students:l}=(0,j.AF)(),[o,c]=(0,d.useState)(!1),[u,x]=(0,d.useState)(t),m=(0,d.useRef)(null);(0,d.useEffect)(()=>{x(t)},[t]),(0,d.useEffect)(()=>{let e=e=>{m.current&&!m.current.contains(e.target)&&c(!1)};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[]);let h=l.filter(e=>"ë´ì íê¸"===e.homeClassId),p=u.trim()?h.filter(e=>e.name.includes(u.trim())):h,f=e=>{x(e.name),i(e.id,e.name),c(!1)};return(0,r.jsxs)("div",{ref:m,className:"relative w-full",children:[(0,r.jsx)("input",{type:"text",value:u,onChange:e=>{let t=e.target.value;x(t),a(t),c(!0)},onFocus:()=>c(!0),placeholder:"ì´ë¦",className:(0,w.cn)("bg-transparent text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 w-full text-center transition-colors",n?"text-white":"text-amber-400 placeholder:text-amber-400/70",s)}),o&&p.length>0&&(0,r.jsx)("div",{className:"absolute top-full left-0 mt-2 bg-white dark:bg-[#1C1C1E] border border-zinc-200 dark:border-white/10 rounded-xl shadow-2xl z-[100] w-full max-h-[200px] overflow-y-auto py-1",children:p.map(e=>(0,r.jsxs)("button",{onClick:()=>f(e),className:(0,w.cn)("w-full px-3 py-2 text-left text-sm transition-colors flex items-center justify-between gap-2",n===e.id?"bg-zinc-100 dark:bg-white/10 text-zinc-900 dark:text-white":"text-zinc-600 dark:text-[#8E8E93] hover:bg-zinc-100 dark:hover:bg-white/5 hover:text-zinc-900 dark:hover:text-white"),children:[(0,r.jsx)("span",{className:"font-medium",children:e.name}),(0,r.jsxs)("span",{className:"text-[10px] text-zinc-400 dark:text-[#5C5C5E]",children:[e.number,"ë²"]})]},e.id))})]})},F=e=>{let t=e.map(e=>S.OL.indexOf(e)).filter(e=>e>=0).sort((e,t)=>e-t);if(0===t.length)return"";let n=[];for(let e of t){let t=n[n.length-1];t&&e===t[t.length-1]+1?t.push(e):n.push([e])}let r=e=>e.match(/^(\d)êµì$/);return n.map(e=>{if(1===e.length)return S.OL[e[0]];let t=S.OL[e[0]],n=S.OL[e[e.length-1]],a=r(t),i=r(n);return a&&i?"".concat(a[1],"~").concat(i[1],"êµì"):"".concat(t,"~").concat(n)}).join(", ")},R=e=>{let{value:t,onChange:n,multi:a=!1,disabled:i=!1,className:s}=e,[l,o]=(0,d.useState)(!1),[c,u]=(0,d.useState)(""),x=(0,d.useRef)(null),m=t?t.split(",").filter(Boolean):[];(0,d.useEffect)(()=>{let e=e=>{x.current&&!x.current.contains(e.target)&&(o(!1),u(""))};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[]),(0,d.useEffect)(()=>{i&&(o(!1),u(""))},[i]);let h=c.trim()?S.OL.filter(e=>e.includes(c.trim())):S.OL,p=e=>{if(a){let t=m.includes(e)?m.filter(t=>t!==e):S.OL.filter(t=>t===e||m.includes(t));n(t.length>0?t.join(","):null)}else n(m.includes(e)?null:e),o(!1),u("")},f=l?c:F(m);return(0,r.jsxs)("div",{ref:x,className:"relative w-full",children:[(0,r.jsx)("input",{type:"text",value:f,onChange:e=>{u(e.target.value),o(!0)},onFocus:()=>!i&&o(!0),disabled:i,placeholder:"êµì",className:(0,w.cn)("bg-transparent text-sm font-medium focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 w-full text-center transition-colors",i?"text-[#5C5C5E] cursor-not-allowed":m.length>0?"text-white":"text-[#8E8E93] placeholder:text-[#5C5C5E]",s)}),l&&!i&&h.length>0&&(0,r.jsx)("div",{className:"absolute top-full left-0 mt-2 bg-white dark:bg-[#1C1C1E] border border-zinc-200 dark:border-white/10 rounded-xl shadow-2xl z-[100] w-full max-h-[200px] overflow-y-auto py-1",children:h.map(e=>{let t=m.includes(e);return(0,r.jsxs)("button",{onClick:()=>p(e),className:(0,w.cn)("w-full px-3 py-2 text-left text-sm transition-colors flex items-center justify-between gap-2",t?"bg-zinc-100 dark:bg-white/10 text-zinc-900 dark:text-white":"text-zinc-600 dark:text-[#8E8E93] hover:bg-zinc-100 dark:hover:bg-white/5 hover:text-zinc-900 dark:hover:text-white"),children:[(0,r.jsx)("span",{className:"font-medium",children:e}),a&&t&&(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:(0,r.jsx)("path",{d:"M20 6L9 17l-5-5"})})]},e)})})]})},T=e=>{let{isOpen:t,onClose:n,onSave:a,onDelete:i,initialDate:s,existingRecords:l=[],autoAddRow:o=!1}=e,[c,u]=(0,d.useState)([]),[x,m]=(0,d.useState)([]),[h,p]=(0,d.useState)(!1),f=(0,d.useRef)(!1),b=(0,d.useRef)(!1),[g,v]=(0,d.useState)(""),[j,y]=(0,d.useState)([]),k=(0,_.a)(t,()=>{f.current||n()});(0,d.useEffect)(()=>
1{if(!t){b.current=!1;return}if(!b.current){if(b.current=!0,v(""),y([]),m([]),l.length>0){let e=l.map(e=>{var t;return{id:e.id,recordId:e.id,studentName:e.studentName,studentId:e.studentId,reason:e.reason,type:e.type,period:null!==(t=e.period)&&void 0!==t?t:null,date:e.date,endDate:e.endDate,details:e.details}});o&&e.push({id:Date.now().toString(),studentName:"",studentId:null,reason:null,type:null,period:null,date:s,details:""}),u(e)}else u([{id:Date.now().toString(),studentName:"",studentId:null,reason:null,type:null,period:null,date:s,details:""}])}},[t,l,o,s]);let N=(e,t)=>{u(n=>n.map(n=>n.id===e?{...n,...t}:n))},z=e=>{if(c.length>1){let t=c.find(t=>t.id===e);(null==t?void 0:t.recordId)&&m(e=>[...e,t.recordId]),u(t=>t.filter(t=>t.id!==e))}},E=(0,d.useCallback)(async()=>{if(f.current)return;let e=c.filter(e=>!e.studentId||!e.reason||!e.type);if(y(e.map(e=>e.id)),e.length){var t,r;v("모ë íì íì, 구ë¶, ì íì ì íí´ ì£¼ì¸ì. íì ìë íì ìì í ì ìì´ì.");let n=null===(t=k.current)||void 0===t?void 0:t.querySelector('[data-entry-id="'.concat(e[0].id,'"]'));null==n||n.scrollIntoView({block:"nearest"}),null==n||null===(r=n.querySelector("input, button"))||void 0===r||r.focus();return}f.current=!0,p(!0),v("");try{for(let e of x)await i(e),m(t=>t.filter(t=>t!==e));for(let e of c)await a({id:e.recordId,studentId:e.studentId,studentName:e.studentName,reason:e.reason,type:e.type,period:e.period,date:e.date,endDate:e.endDate,details:e.details,submitted:!1}),u(t=>t.filter(t=>t.id!==e.id));n()}catch(e){v("ì¼ë¶ í목ì ì ì¥íì§ ëª»íì´ì. ìë£ë íì ë°ìíê³ , ë¨ì íì ê·¸ëë¡ ë³´ê´íìµëë¤. ë¤ì ì ì¥í´ 주ì¸ì.")}finally{f.current=!1,p(!1)}},[c,x,k,a,i,n]);return((0,d.useEffect)(()=>{if(!t)return;let e=e=>{if("Enter"===e.key){var t;if(e.isComposing||229===e.keyCode)return;let n=e.target;n instanceof HTMLElement&&(null===(t=k.current)||void 0===t?void 0:t.contains(n))&&"BUTTON"!==n.tagName&&"TEXTAREA"!==n.tagName&&"button"!==n.getAttribute("role")&&(e.preventDefault(),E())}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,E,k]),t)?(0,r.jsx)("div",{className:"modal-viewport z-50 flex items-start justify-center overflow-y-auto overscroll-contain bg-black/60 backdrop-blur-sm p-4",children:(0,r.jsxs)("div",{ref:k,role:"dialog","aria-modal":"true","aria-label":"ì¶ê²° ì
ë ¥",tabIndex:-1,"aria-busy":h,className:"my-auto !max-h-none w-full max-w-5xl bg-[#1C1C1E] border border-white/10 rounded-2xl shadow-2xl animate-in fade-in zoom-in-95 duration-200",children:[(0,r.jsxs)("div",{className:"px-6 pt-5 pb-3 flex items-center justify-between",children:[(0,r.jsx)("button",{onClick:()=>{u(e=>[...e,{id:Date.now().toString(),studentName:"",studentId:null,reason:null,type:null,period:null,date:s,details:""}])},disabled:h,className:"px-3 py-2 text-sm font-medium text-[#8E8E93] hover:text-white hover:bg-white/10 rounded-lg transition-colors attendance-add-student-btn",id:"attendance-add-student-btn",children:"+ íì ì¶ê°"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>{h||n()},disabled:h,className:"px-3 py-2 text-xs font-medium text-[#8E8E93] hover:text-white hover:bg-white/10 rounded-lg transition-colors",children:"ì·¨ì"}),(0,r.jsx)("button",{onClick:E,disabled:h,className:"btn-primary-solid px-4 py-2 rounded-xl text-xs font-bold transition whitespace-nowrap",children:h?"ì ì¥...":"ì ì¥"})]})]}),g&&(0,r.jsx)("p",{role:"alert",className:"px-6 pb-3 text-sm text-red-400",children:g}),(0,r.jsx)("fieldset",{disabled:h,className:"min-w-0 m-0 border-0 px-6 pb-7 space-y-3",children:c.map((e,t)=>(0,r.jsxs)("div",{"data-entry-id":e.id,className:(0,w.cn)("flex items-start gap-3 rounded-xl",j.includes(e.id)&&"ring-2 ring-red-400 p-2"),children:[(0,r.jsxs)("div",{className:"w-[180px] space-y-1.5",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"íì ì´ë¦"}),(0,r.jsx)("div",{className:"relative h-[38px] p-2 bg-white/5 rounded-xl border border-white/5 focus-within:border-white/20 focu
1s-within:ring-2 focus-within:ring-blue-500/50 [&_input:focus-visible]:ring-0 transition-colors flex items-center attendance-modal-input-wrapper",children:(0,r.jsx)(A,{value:e.studentName,studentId:e.studentId,onChange:t=>N(e.id,{studentName:t}),onSelect:(t,n)=>N(e.id,{studentId:t,studentName:n})})})]}),(0,r.jsxs)("div",{className:"space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"구ë¶"}),(0,r.jsx)("div",{className:"flex h-[38px] bg-white/5 p-1 rounded-xl border border-white/5 attendance-modal-pill-wrapper",children:["ì§ë³","ì¸ì ","미ì¸ì ","기í"].map(t=>{var n,a;let i=e.reason===t,s=!!e.reason;return(0,r.jsx)("button",{onClick:()=>N(e.id,{reason:i?null:t}),className:(0,w.cn)("rounded-lg text-xs font-semibold transition-all duration-500 ease-[cubic-bezier(0.32,0.72,0,1)] whitespace-nowrap overflow-hidden border",i?"flex-1 opacity-100 px-6 bg-transparent border-transparent text-[var(--ink)] dark:text-[var(--ink-dark)]":s?"w-0 max-w-0 p-0 opacity-0 margin-0 border-0":"text-[#8E8E93] border-transparent hover:text-white px-3 opacity-100 w-auto"),style:i?{"--ink":null===(n=(0,S.on)(t))||void 0===n?void 0:n.fg,"--ink-dark":null===(a=(0,S.on)(t))||void 0===a?void 0:a.darkFg}:{},children:t},t)})})]}),(0,r.jsxs)("div",{className:"space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"ì í"}),(0,r.jsx)("div",{className:"flex h-[38px] bg-white/5 p-1 rounded-xl border border-white/5 attendance-modal-pill-wrapper",children:["ê²°ì","ì§ê°","ì¡°í´","ê²°ê³¼"].map(t=>{var n,a;let i=e.type===t,s=!!e.type;return(0,r.jsx)("button",{onClick:()=>{var n;let r=i?null:t,a={type:r};"ê²°ì"===r?a.period=null:("ì§ê°"===r||"ì¡°í´"===r)&&(null===(n=e.period)||void 0===n?void 0:n.includes(","))&&(a.period=e.period.split(",")[0]),N(e.id,a)},className:(0,w.cn)("rounded-lg text-xs font-semibold transition-all duration-500 ease-[cubic-bezier(0.32,0.72,0,1)] whitespace-nowrap overflow-hidden border",i?"flex-1 opacity-100 px-6 bg-transparent border-transparent text-[var(--ink)] dark:text-[var(--ink-dark)]":s?"w-0 max-w-0 p-0 opacity-0 margin-0 border-0":"text-[#8E8E93] border-transparent hover:text-white px-3 opacity-100 w-auto"),style:i?{"--ink":null===(n=(0,S.on)(t))||void 0===n?void 0:n.fg,"--ink-dark":null===(a=(0,S.on)(t))||void 0===a?void 0:a.darkFg}:{},children:t},t)})})]}),(0,r.jsxs)("div",{className:"w-[100px] space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"êµì"}),(0,r.jsx)("div",{className:(0,w.cn)("relative h-[38px] p-2 bg-white/5 rounded-xl border border-white/5 transition-colors flex items-center attendance-modal-period-wrapper","ê²°ì"===e.type?"opacity-40":"focus-within:border-white/20 focus-within:ring-2 focus-within:ring-blue-500/50 [&_input:focus-visible]:ring-0"),children:(0,r.jsx)(R,{value:e.period,onChange:t=>N(e.id,{period:t}),multi:"ê²°ê³¼"===e.type,disabled:"ê²°ì"===e.type})})]}),(0,r.jsxs)("div",{className:"w-[160px] flex-1 space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"ë ì§"}),(0,r.jsx)("div",{className:"relative h-[38px] bg-white/5 rounded-xl border border-white/5 focus-within:ring-2 focus-within:ring-blue-500/50 [&_.calendar-picker-trigger:focus-visible]:ring-0 flex items-center px-2 attendance-modal-date-wrapper",children:(0,r.jsx)(I.h,{value:e.date,onChange:t=>N(e.id,{date:t}),endDate:e.endDate,onEndDateChange:t=>N(e.id,{endDate:t}),className:"px-0 py-0"})})]}),(0,r.jsxs)("div",{className:"w-[140px] flex-1 space-y-1.5",children:[0===t&&(0,r.jsx)("label",{className:"text-xs font-medium text-[#8E8E93] ml-1",children:"ì¬ì "}),(0,r.jsx)("input",{type:"text",value:e.details,onChange:t=>N(e.id,{details:t.target.value}),placeholder:"",className:"w-full h-[38px] px-3 bg-white/5 rounded-xl border border-white/5 text-sm text-white placeholder:text-[#5C5C5E] focus:outline-none focus:border-white/20 transition-colors attendance-modal-detail-input"})]}),(0,r.jsxs)("div",{className:"space-y-1.5 shrink-0",children:[0===t&&(0,r.jsx)("div",{className:"h-[24px]"}),c.length>1&&(0,r.jsx)("button",{onClick:()=>z(e.id),className:"h-[38px] w-[38px] flex items-center justify-center text-[#8E8E93] hover:text-red-400 hover:bg-red-500/10 rounded-lg transition-colors",title:"ìì ",children:(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]})]},e.id))})]})}):null};var Z=n(75368),O=n(32489),B=n(33245),U=n(92735);let P=(0,n(79205).Z)("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]);var V=n(51817),W=n(92934),Y=n(49322),q=n(17689);function K(){return"undefined"!=typeof document&&!!document.getElementById("__naemo_connector_installed__")}function H(){var e;if("undefined"==typeof document)return null;let t=document.getElementById("__naemo_connector_installed__");return null!==(e=null==t?void 0:t.content)&&void 0!==e?e:null}var X=n(34137);function G(e){let t=(null!=e?e:"").trim();return t?t.split(",").map(e=>
1e.trim()).filter(Boolean).join(", "):"1êµì"}function J(e){let[t,n,r]=e.split("-").map(Number),a=["ì¼","ì","í","ì","목","ê¸","í "][new Date(t,n-1,r).getDay()];return"".concat(n,"/").concat(r,"(").concat(a,")")}function $(e){let{isOpen:t,onClose:n,onSynced:a,defaultStart:i,defaultEnd:s}=e,[l,o]=(0,d.useState)("idle"),[c,u]=(0,d.useState)(null),[x,m]=(0,d.useState)([]),[h,p]=(0,d.useState)({total:0,processed:0,failed:0}),[f,b]=(0,d.useState)(null),[g,v]=(0,d.useState)(i),[w,j]=(0,d.useState)(s),[y,k]=(0,d.useState)("checking"),[N,z]=(0,d.useState)(!1),[E,C]=(0,d.useState)(!1),D=(0,d.useCallback)(async()=>{if(!K()){k("missing");return}k(await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1500;return new Promise(t=>{if(!K())return t(!1);let n=crypto.randomUUID(),r=setTimeout(()=>{window.removeEventListener("message",a),t(!1)},e),a=e=>{var i;let s=e.data;(null==s?void 0:s.target)==="naemo-saas"&&s.requestId===n&&(clearTimeout(r),window.removeEventListener("message",a),t(!!(null===(i=s.response)||void 0===i?void 0:i.type)&&"naemo:pong"===s.response.type))};window.addEventListener("message",a),window.postMessage({target:"naemo-connector",type:"naemo:ping",requestId:n},window.location.origin)})}()?"present":"inactive")},[]);(0,d.useEffect)(()=>{if(t){o("idle"),u(null),m([]),b(null),z(!1);try{let e=localStorage.getItem("naemo:neis-guide-seen");C(!e),e||localStorage.setItem("naemo:neis-guide-seen","1")}catch(e){C(!1)}D()}},[t,D]),(0,d.useEffect)(()=>{if(!t||"present"===y)return;let e=setInterval(D,1e3),n=()=>D();return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{clearInterval(e),window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[t,y,D]),(0,X.j)(n,t);let S=async()=>{o("loading-pending"),u(null);try{let n=await fetch("/api/attendance/neis-sync/pending?startDate=".concat(g,"&endDate=").concat(w)),r=await n.json();if(!n.ok||!r.success){var e,t;if("PLAN_REQUIRED"===r.error)throw Error(null!==(e=r.message)&&void 0!==e?e:"íë¡ íëììë§ ì¬ì©í ì ììµëë¤.");throw Error(null!==(t=r.error)&&void 0!==t?t:"ë°ì´í°ë¥¼ ë¶ë¬ì¬ ì ììµëë¤.")}m(r.data),o("ready")}catch(e){u(e.message),o("error")}},M=async()=>{let e=Date.now();o("syncing"),u(null),p({total:x.length,processed:0,failed:0});try{let t=await new Promise((e,t)=>{let n;if(!K()){t(Error("naemo Connector íì¥ì´ ì¤ì¹ëì´ ìì§ ììµëë¤."));return}let r=crypto.randomUUID(),a=()=>{clearTimeout(n),n=setTimeout(()=>{s(),t(Error("NEIS ìëì
ë ¥ì´ ì¼ì ìê° ëì ì§íëì§ ìì ì¤ë¨íìµëë¤. NEIS íë©´(ë¡ê·¸ì¸/ì¸ì
ë§ë£ ë±)ì íì¸í ë¤ ë¤ì ìëí´ì£¼ì¸ì."))},12e4)},i=n=>{var i,l,d,o;let c=n.data;if((null==c?void 0:c.target)==="naemo-saas"){if(a(),c.push){let n=c.push;"naemo:sync-progress"===n.type&&p&&p(n.payload),"naemo:sync-complete"===n.type&&(s(),e(n.payload)),"naemo:sync-error"===n.type&&(s(),t(Error(null!==(d=null===(l=n.payload)||void 0===l?void 0:l.message)&&void 0!==d?d:"ë기í ì¤í¨")));return}if(c.requestId===r){if(c.error){s(),t(Error(c.error));return}if(c.response&&!1===c.response.ok){s(),t(Error(null!==(o=c.response.error)&&void 0!==o?o:"ë기í ì¤í¨"));return}(null===(i=c.response)||void 0===i?void 0:i.ok)&&c.response.result&&(s(),e(c.response.result))}}};function s(){clearTimeout(n),window.removeEventListener("message",i)}window.addEventListener("message",i),a(),window.postMessage({target:"naemo-connector",type:"naemo:sync-request",requestId:r,payload:{records:x}},window.location.origin)});b(t),t.completedIds.length>0&&(await fetch("/api/attendance/neis-sync/mark-submitted",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:t.completedIds})}),null==a||a(t.completedIds));let n=(t.failures||[]).map(e=>{var t,n,r,a,i,s,l,d;let o=x.find(t=>t.id===e.id);return{recordId:e.id,studentName:null!==(t=null==o?void 0:o.studentName)&&void 0!==t?t:"ì ì ìì",studentNumber:null!==(n=null==o?void 0:o.studentNumber)&&void 0!==n?n:null,grade:null!==(r=null==o?void 0:o.grade)&&void 0!==r?r:null,classNum:null!==(a=null==o?void 0:o.classNum)&&void 0!==a?a:null,date:null!==(i=null==o?void 0:o.date)&&void 0!==i?i:"",type:null!==(s=null==o?void 0:o.type)&&void 0!==s?s:"",reason:null!==(l=null==o?void 0:o.reason)&&void 0!==l?l:"",period:null!==(d=null==o?void 0:o.period)&&void 0!==d?d:null,error:e.error}}),r=0===t.failed?"SUCCESS":0===t.processed?"FAILED":"PARTIAL";fetch("/api/attendance/neis-sync/log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:r,totalCount:t.total,successCount:t.processed,failCount:t.failed,durationMs:Date.now()-e,connectorVersion:H(),failures:n,errorMessage:t.failed>0?"".concat(t.failed,"ê±´ ì
ë ¥ ì¤í¨"):null})}).catch(e=>console.warn("[NeisSyncModal] ë¡ê·¸ ì ì¥ ì¤í¨:",e)),o("done")}catch(n){let t=Date.now()-e;u(n.message),o("error"),fetch("/api/attendance/neis-sync/log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"FAILED",totalCount:x.length,successCount:0,failCount:x.length,durationMs:t,connectorVersion:H(),errorMessage:(null==n?void 0:n.message)||"ë기í ì¤ ì¤ë¥ ë°ì",failures:[]})}).catch(e=>console.warn("[NeisSyncModal] ì¤í¨ ë¡ê·¸ ì ì¥ ì¤í¨:",e))}};return t?(0,r.jsx)("div",{className:"modal-viewport z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:(0,r.jsxs)("div",{className:"w-full max-w-2xl bg-[#1C1C1E] border border-white/10 rounded-2xl shadow-2xl",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 pt-5 pb-3",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-white",children:"NEIS ìëì
ë ¥ (ë² í)"}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)("button",{onClick:()=>C(e=>!e),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-sm font-bold text-toss-blue hover:bg-toss-blue/10 transition-colors",title:"ì¬ì© ë°©ë² ìë´",children:[(0,r.jsx)(Z.Z,{size:14}),E?"ìë´ì¬í ì 기":"ìë´ì¬í 보기"]}),(0,r.jsx)("button",{"aria-label":"ë«ê¸°",onClick:n,className:"p-1.5 text-[#8E8E93] hover:text-white hover:bg-white/10 rounded-lg transition-colors",children:(0,r.jsx)(O.Z,{size:18})})]})]}),(0,r.jsxs)("div",{className:"px-6 py-5 space-y-4",children:[E&&(0,r.jsx)("div",{className:"bg-white border border-zinc-300 rounded-xl overflow-hidden",children:(0,r.jsxs)("div",{className:"max-h-[320px] overflow-y-auto px-4 py-3.5 space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs font-semibold text-zinc-900 mb-2",children:"â ì¬ì© ë°©ë²"}),(0,r.jsxs)("ol",{className:"space-y-1.5 text-sm text-zinc-700 dark:text-zinc-300 leading-relaxed list-decimal list-inside marker:text-zinc-400",children:[(0,r.jsxs)("li",{children:["íì¥ íë¡ê·¸ë¨(",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"NEIS ì¶ê²° ìëì
ë ¥ by NAEMO"}),")ì ì¤íí©ëë¤."]}),(0,r.jsxs)("li",{children:["ë¤ë¥¸ íìì NEIS ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âíê¸ë´ì-ì¶ê²°ê´ë¦¬-ì¼ì¼ì¶ê²°ê´ë¦¬(ë´ìì©)â"})," íë©´ì ëì ëì¼ì¸ì."]}),(0,r.jsxs)("li",{children:["ìëì ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âëì ë¶ë¬ì¤ê¸°â"})," ë²í¼ì ë르ì¸ì."]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs font-semibold text-zinc-900 mb-2",children:"â ì¸ë¶ ì¬í"}),(0,r.jsxs)("div",{className:"space-y-3 text-sm text-zinc-700 dark:text-zinc-300 leading-relaxed",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"â "})," ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âì
ë ¥â"})," ì´ì ì²´í¬ëì§ ìì ì¶ê²°ë§ NEISì ë°ìëë©°, ì ìì ì¼ë¡ ë°ìëë©´ í´ë¹ 기ë¡ì ì²´í¬ë°ì¤ê° ìëì¼ë¡ ì²´í¬ë©ëë¤. (ì¤ë³µ ë°ì ë°©ì§)"]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"â¡"})," ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âêµìâ ì´"}),"ìì ì íí ê°ì¼ë¡ NEISì ì
ë ¥ë©ëë¤. êµì를 ì ííì§ ìì ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"ì§ê°\xb7ì¡°í´\xb7ê²°ê³¼"}),"ë NEISì 1êµì를 기ì¤ì¼ë¡ ì²´í¬ë©ëë¤. (ì§ê°ì 1êµì를 í¬í¨í ì´ì êµìë¤, ì¡°í´ë 1êµì를 í¬í¨í ì´í êµìë¤, ê²°ê³¼ë 1êµìë§)"]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"â¢"})," ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âì¬ì â ì´"}),"ì ì ì ë´ì©ì NEISì ",(0,r.jsx)("span",{className:"text-zinc-900 font-medium",children:"âì¬ì â"})," 칸ì ê·¸ëë¡ ì
ë ¥ë©ëë¤."]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(B.Z,{size:14,className:"text-zinc-700 dark:text-zinc-300 shrink-0 mt-0.5"}),(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"text-zinc-700 dark:text-zinc-300",children:"기í ê²°ì"}),"ì ë°ëì ì¬ì 를 ì
ë ¥í´ì¼ í©ëë¤. (ì¬ì ê° ë¹ì´ìì ê²½ì°, ìë ì
ë ¥ì´ ì¤ë¨ë©ëë¤.)"]})]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(B.Z,{size:14,className:"text-zinc-700 dark:text-zinc-300 shrink-0 mt-0.5"}),(0,r.jsx)("span",{children:"주ë§\xb7ê³µí´ì¼ì ì못 기ë¡ë ì¶ê²°ì´ ìì¼ë©´ ìë ì
ë ¥ì´ ì¤ë¨ë ì ììµëë¤."})]}),(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)(B.Z,{size:14,className:"text-zinc-700 dark:text-zinc-300 shrink-0 mt-0.5"}),(0,r.jsxs)("span",{children:["íì¬ ë² í ë²ì ì¼ë¡ ì´ì ì¤ì
ëë¤. ì¤ë¥ë ììì¹ ëª»í ëìì´ ë°ìíë©´ ë²ê·¸ ì ê³ í´ì£¼ì¸ì.",(0,r.jsx)("br",{}),"ì¬ë¬ë¶ì í¼ëë°±ì´ ë ëì ìë¹ì¤ë¥¼ ë§ëëë¤."]})]})]})]})]})}),"missing"===y&&!N&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("a",{href:"https://chromewebstore.google.com/detail/dipgaekcpaobajidhnbjhohkpckkhlao?utm_source=item-share-cb",target:"_blank",rel:"noopener noreferrer",style:{color:"#ffffff"},className:"inline-flex items-center gap-1.5 px-4 py-2 bg-zinc-900 text-sm font-semibold rounded-xl hover:bg-zinc-800 transition-colors",onClick:()=>z(!0),children:[(0,r.jsx)(U.Z,{size:14}),"íì¥ íë¡ê·¸ë¨ ì¤ì¹"]}),(0,r.jsx)("div",{className:"text-xs text-zinc-600 dark:text-zinc-400",children:"íì¥íë¡ê·¸ë¨ì ì¤ì¹íê³ ì¤íí ë¤ ë¤ì ìëí´ì£¼ì¸ì."})]}),"missing"===y&&N&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-white border border-zinc-300 rounded-xl",children:[(0,r.jsx)(U.Z,{size:18,className:"text-zinc-500 shrink-0 mt-0.5"}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("div",{className:"text-sm font-semibold text-zinc-900",children:"ì¤ì¹ê° ìë£ëìëì?"}),(0,r.jsx)("div",{className:"text-xs text-zinc-600 dark:text-zinc-400",children:"ì¤ì¹ í íì´ì§ë¥¼ ìë¡ê³ 침íë©´ ë°ë¡ ì¬ì©í ì ììµëë¤."}),(0,r.jsx)("button",{onClick:()=>window.location.reload(),style:{color:"#ffffff"},className:"inline-flex items-center gap-1.5 px-4 py-2 bg-zinc-900 text-sm font-semibold rounded-xl hover:bg-zinc-800 transition-colors",children:"íì´ì§ ìë¡ê³ 침"})]})]}),"inactive"===y&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-white border border-zinc-300 rounded-xl",children:[(0,r.jsx)(P,{size:18,className:"text-amber-600 shrink-0 mt-0.5"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"text-sm font-semibold text-zinc-900",children:"NEIS ì¶ê²° ìëì
ë ¥ íì¥ íë¡ê·¸ë¨ì ì¤íí´ì£¼ì¸ì"}),(0,r.jsxs)("div",{className:"text-xs text-zinc-600 dark:text-zinc-400",children:["íì¥íë¡ê·¸ë¨ì´ ì¤ì¹ëì´ ìì§ë§ ì¤í ì¤ì´ ìëëë¤. ë¸ë¼ì°ì ì°ì¸¡ ìë¨ì íì¥íë¡ê·¸ë¨ ìì´ì½ì í´ë¦í´ íì±íí´ì£¼ì¸ì. ì¤ííë©´ ì´ íë©´ì´ ",(0,r.jsx)("span",{className:"font-semibold",children:"ìëì¼ë¡ ê°±ì "}),"ë©ëë¤. ë³íê° ìì¼ë©´ íì´ì§ë¥¼ ìë¡ê³ 침í´ì£¼ì¸ì."]})]})]}),"present"===y&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-emerald-600",children:[(0,r.jsx)(P,{size:14}),"íì¥íë¡ê·¸ë¨ ê°ì§ë¨"]}),"idle"===l&&(0,r.jsx)("div",{className:"space-y-3",children:(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{onClick:()=>C(!1),children:[(0,r.jsx)("label",{className:"text-xs text-[#8E8E93] mb-1.5 block",children:"ììì¼"}),(0,r.jsx)("div",{className:"h-[38px] flex items-center bg-white/5 border border-white/5 rounded-xl px-1",children:(0,r.jsx)(I.h,{value:g,onChange:v})})]}),(0,r.jsxs)("div",{onClick:()=>C(!1),children:[(0,r.jsx)("label",{className:"text-xs text-[#8E8E93] mb-1.5 block",children:"ì¢
ë£ì¼"}),(0,r.jsx)("div",{className:"h-[38px] flex items-center bg-white/5 border border-white/5 rounded-xl px-1",children:(0,r.jsx)(I.h,{value:w,onChange:j})})]})]})}),"ready"===l&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"text-sm text-white",children:["ë기í ëì: ",(0,r.jsxs)("span",{className:"font-bold",children:[x.length,"ê±´"]}),(0,r.jsxs)("span",{className:"text-xs text-[#8E8E93] ml-2",children:[g," ~ ",w]})]}),0===x.length?(0,r.jsx)("div",{className:"text-xs text-[#8E8E93]",children:"ì´ ê¸°ê°ì NEISë¡ ë³´ë¼ ë¯¸ë기í ì¶ê²°ì´ ììµëë¤."}):(0,r.jsx)("div",{className:"rounded-xl border border-zinc-200 bg-white overflow-hidden",children:(0,r.jsx)("div",{className:"max-h-[300px] overflow-y-auto",children:(0,r.jsxs)("table",{className:"w-full text-xs",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-zinc-100 text-zinc-500 z-10",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"text-left font-medium px-3 py-2 w-20",children:"ë ì§"}),(0,r.jsx)("th",{className:"text-left font-medium px-3 py-2",children:"ì´ë¦"}),(0,r.jsx)("th",{className:"text-left font-medium px-3 py-2",children:"ì¶ê²°"}),(0,r.jsx)("th",{className:"text-center font-medium px-3 py-2 w-20",children:"êµì"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-zinc-100 text-zinc-800 dark:text-zinc-200",children:x.map(e=>(0,r.jsxs)("tr",{title:e.details||void 0,children:[(0,r.jsx)("td",{className:"px-3 py-2 text-zinc-500 whitespace-nowrap",children:e.endDate&&e.endDate!==e.date?(0,r.jsxs)(r.Fragment,{children:[J(e.date),"~",(0,r.jsx)("br",{}),J(e.endDate)]}):J(e.date)}),(0,r.jsx)("td",{className:"px-3 py-2 font-medium text-zinc-900",children:e.studentName}),(0,r.jsxs)("td",{className:"px-3 py-2",children:[e.reason," ",e.type,e.details&&(0,r.jsxs)("span",{className:"text-zinc-400",children:[" \xb7 ",e.details]})]}),(0,r.jsx)("td",{className:"px-3 py-2 text-center",children:(0,r.jsx)("span",{className:"inline-block px-2 py-0.5 rounded-md bg-zinc-200 text-zinc-700 dark:text-zinc-300 font-medium whitespace-nowrap",children:G(e.period)})})]},e.id))})]})})})]}),"syncing"===l&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(V.Z,{size:18,className:"text-blue-400 animate-spin"}),(0,r.jsx)("div",{className:"text-sm text-white",children:"NEISì ì
ë ¥ ì¤..."})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)("div",{className:"flex justify-between text-xs text-[#8E8E93]",children:[(0,r.jsxs)("span",{children:[h.processed," / ",h.total," ì²ë¦¬"]}),h.failed>0&&(0,r.jsxs)("span",{className:"text-red-400",children:[h.failed," ì¤í¨"]})]}),(0,r.jsx)("div",{className:"h-2 bg-white/5 rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-blue-500 transition-all",style:{width:"".concat(h.total?h.processed/h.total*100:0,"%")}})})]})]}),"done"===l&&f&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(W.Z,{size:18,className:"text-emerald-400"}),(0,r.jsx)("div",{className:"text-sm text-white font-semibold",children:"ìë£"})]}),(0,r.jsxs)("div",{className:"text-xs text-[#C7C7CC] space-y-1",children:[(0,r.jsxs)("div",{children:["ì±ê³µ: ",f.processed,"ê±´"]}),f.failed>0&&(0,r.jsxs)("div",{className:"text-red-400",children:["ì¤í¨: ",f.failed,"ê±´"]})]}),f
1.processed>0&&(0,r.jsx)("div",{className:"text-xs text-[#8E8E93] leading-relaxed",children:"ì ì ë°ìë 기ë¡ì ì¶ê²° ê´ë¦¬ íìì ì²´í¬ë°ì¤ê° ìëì¼ë¡ ì²´í¬ë©ëë¤."}),f.failures.length>0&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"text-xs text-white",children:["ì
ë ¥íì§ ëª»í 기ë¡: ",(0,r.jsxs)("span",{className:"font-bold text-red-400",children:[f.failures.length,"ê±´"]})]}),(0,r.jsx)("div",{className:"rounded-xl border border-red-200 bg-white overflow-hidden",children:(0,r.jsx)("div",{className:"max-h-44 overflow-y-auto divide-y divide-red-100",children:f.failures.map(e=>{let t=x.find(t=>t.id===e.id);return(0,r.jsxs)("div",{className:"px-3 py-2",children:[t?(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,r.jsx)("span",{className:"text-zinc-500 whitespace-nowrap",children:J(t.date)}),(0,r.jsx)("span",{className:"font-semibold text-zinc-900",children:t.studentName}),(0,r.jsxs)("span",{className:"text-zinc-700 dark:text-zinc-300",children:[t.reason," ",t.type]}),(0,r.jsx)("span",{className:"ml-auto px-1.5 py-0.5 rounded-md bg-zinc-100 text-zinc-600 dark:text-zinc-400 font-medium whitespace-nowrap",children:G(t.period)})]}):(0,r.jsx)("div",{className:"text-xs font-semibold text-zinc-900",children:"ì ì ìë 기ë¡"}),(0,r.jsx)("div",{className:"text-[11px] text-red-500 mt-1",children:function(e){let t=null!=e?e:"";return/êµì.*ì
.*ìì|ì
.*ìì|ì¬ë¡¯/.test(t)?"NEIS íë©´ìì í´ë¹ êµì 칸ì ì°¾ì§ ëª»íìµëë¤.":/기í/.test(t)?"기í ì¬ì ë NEISìì ì§ì ì
ë ¥í´ì¼ í©ëë¤.":/íì.*ì|í.*ì|ì°¾.*못|ëª
ë¨/.test(t)?"NEIS ëª
ë¨ìì í´ë¹ íìì ì°¾ì§ ëª»íìµëë¤.":/주ë§|ê³µí´ì¼|í ìì¼|ì¼ìì¼/.test(t)?"주ë§\xb7ê³µí´ì¼ìë ì¶ê²°ì ì
ë ¥í ì ììµëë¤.":/ìê° ì´ê³¼|timeout|ìëµ/.test(t)?"NEIS ìëµì´ ì§ì°ëì´ ì
ë ¥íì§ ëª»íìµëë¤.":t.replace(/\s*\(?\s*cellindex\s*=\s*\d+\s*\)?/gi,"").trim()||"NEIS ì
ë ¥ì ì¤í¨íìµëë¤. NEIS íë©´ì íì¸í´ì£¼ì¸ì."}(e.error)})]},e.id)})})})]})]}),"error"===l&&c&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-red-500/10 border border-red-500/30 rounded-xl",children:[(0,r.jsx)(Y.Z,{size:18,className:"text-red-400 shrink-0 mt-0.5"}),(0,r.jsx)("div",{className:"text-sm text-red-100",children:c})]}),(0,r.jsxs)("div",{className:"text-xs text-[#8E8E93] leading-relaxed px-1",children:["ìë ì
ë ¥ì´ ì¤ë¨ëë 주ì ìì¸: ",(0,r.jsx)("span",{className:"text-[#C7C7CC]",children:"기í ê²°ì"}),"(NEISìì ì§ì ì¬ì ì
ë ¥ íì), 주ë§\xb7ê³µí´ì¼ì ì못 기ë¡ë ì¶ê²°. ì í목ì íì¸ í ë¤ì ìëí´ì£¼ì¸ì."]})]})]}),(0,r.jsxs)("div",{className:"px-6 pb-5 pt-3 flex items-center justify-end gap-2",children:["idle"===l&&(0,r.jsxs)("button",{onClick:S,disabled:"missing"===y||"inactive"===y,style:{color:"#ffffff"},className:"neis-primary-btn flex items-center gap-2 px-4 py-2 bg-[#3b82f6] rounded-xl text-sm font-semibold disabled:opacity-40 disabled:cursor-not-allowed hover:bg-[#2f6fe0] transition-colors",children:[(0,r.jsx)(U.Z,{size:14}),"ëì ë¶ë¬ì¤ê¸°"]}),"ready"===l&&(0,r.jsx)("button",{onClick:()=>o("idle"),className:"px-4 py-2 bg-white/10 text-white rounded-xl text-sm hover:bg-white/15 transition-colors",children:"ë¤ë¡"}),"ready"===l&&x.length>0&&(0,r.jsxs)("button",{onClick:M,style:{color:"#ffffff"},className:"neis-primary-btn flex items-center gap-2 px-4 py-2 bg-[#3b82f6] rounded-xl text-sm font-semibold hover:bg-[#2f6fe0] transition-colors",children:[(0,r.jsx)(q.Z,{size:14}),"NEISì ìëì
ë ¥ ìì"]}),"ready"===l&&0===x.length&&(0,r.jsx)("button",{onClick:n,className:"px-4 py-2 bg-white/10 text-white rounded-xl text-sm hover:bg-white/15 transition-colors",children:"ë«ê¸°"}),("done"===l||"error"===l)&&(0,r.jsx)("button",{onClick:n,className:"px-4 py-2 bg-white/10 text-white rounded-xl text-sm hover:bg-white/15 transition-colors",children:"ë«ê¸°"})]})]})}):null}var Q=n(96214),ee=n(54292),et=n(25450),en=n(54887),er=n(45675),ea=n(40875),ei=n(35596),es=n(81906),el=n(22825),ed=n(33728),eo=n(13100),ec=n(92846);let eu={type:"spring",stiffness:520,damping:42,mass:.8};function ex(e){let{isOpen:t,onOpenChange:n,onAction:a,onPress:i,actionLabel:s="ìì ",actionButtonClass:l="bg-red-500 hover:bg-red-600 text-white",actionIcon:o,divided:c=!1,actionWidth:u=76,children:x,className:m}=e,h=(0,es.c)(0),p=(0,d.useRef)(null),f=(0,d.useRef)(!1),b=(0,d.useRef)(null),g=(0,d.useRef)(0),v=(0,d.useRef)(0),j=(0,d.useRef)(!1),y=(0,d.useCallback)(e=>{var t;null===(t=p.current)||void 0===t||t.stop(),p.current=(0,el.j)(h,e,eu)},[h]);(0,d.useEffect)(()=>{y(t?u:0),t||(j.current=!1)},[t,y,u]),(0,d.useEffect)(()=>()=>{var e;null===(e=p.current)||void 0===e||e.stop()},[]);let k=(0,ed.H)(h,e=>"-".concat(e,"px")),N=(0,ed.H)(h,[8,38],[0,1]),z=(0,ed.H)(h,[8,.9*u,u,1.3*u],[.8,.95,1,1.15]);return(0,r.jsxs)("div",{className:(0,w.cn)("relative overflow-hidden bg-[#FBFBF9] dark:bg-zinc-950",m),children:[(0,r.jsxs)(eo.E.button,{type:"button","aria-label":s,"aria-hidden":!t,tabIndex:t?0:-1,onClick:e=>{e.stopPropagation(),ec.MU.impact("medium"),a()},style:{width:u-8,opacity:N,scale:z},className:(0,w.cn)("absolute right-2 top-2 bottom-2 z-0","rounded-xl font-medium text-xs shadow-sm","flex flex-col items-center justify-center gap-1 cursor-pointer select-none","active:scale-95 transition-transform",l),children:[o,(0,r.jsx)("span",{className:"text-[11px] font-semibold",children:s})]}),(0,r.jsx)(eo.E.div,{style:{x:k},onPanStart:()=>{var e;b.current=null,null===(e=p.current)||void 0===e||e.stop(),j.current=h.get()>=u},onPan:(e,t)=>{if(null===b.current){let{x:e,y:n}=t.offset;if(12>Math.abs(e)&&12>Math.abs(n))return;b.current=Math.abs(e)>Math.abs(n)?"x":"y",g.current=h.get(),v.current=e,f.current=!0}if("x"!==b.current)return;let n=g.current-(t.offset.x-v.current);if(n<=0){h.set(0),j.current=!1;return}n>=u&&!j.current?(j.current=!0,ec.MU.selection()):n<u&&j.current&&(j.current=!1),n<=u?h.set(n):h.set(u+(n-u)*.12)},onPanEnd:(e,r)=>{let a="x"===b.current;if(b.current=null,setTimeout(()=>{f.current=!1},0),"pointercancel"===e.type){y(t?u:0);return}if(!a)return;let i=h.get(),s=!(r.velocity.x>450)&&(i>u/2||r.velocity.x<-450);y(s?u:0),s!==t&&(j.current||ec.MU.selection(),n(s))},onClick:()=>
1{if(!f.current){if(t){n(!1);return}i&&i()}},className:(0,w.cn)("relative z-10 w-full bg-white dark:bg-[#1C1C1E] transition-colors","touch-pan-y select-none",c&&"border-t border-zinc-100 dark:border-white/[0.06]"),children:x})]})}var em=n(52345);function eh(e){let{size:t=48,colorTheme:n="green",onComplete:a,className:i,triggerHaptic:s=!0}=e,l=(0,d.useRef)(a),o=(0,em.J)();(0,d.useEffect)(()=>{l.current=a},[a]),(0,d.useEffect)(()=>{let e=s?setTimeout(()=>{ec.MU.success()},o?0:200):null,t=setTimeout(()=>{var e;null===(e=l.current)||void 0===e||e.call(l)},o?0:650);return()=>{e&&clearTimeout(e),clearTimeout(t)}},[s,o]);let c="green"===n?"#10B981":"blue"===n?"#3182F6":"#FFFFFF";return(0,r.jsxs)("div",{className:(0,w.cn)("relative flex items-center justify-center select-none",i),style:{width:t,height:t},children:[(0,r.jsx)(eo.E.div,{initial:!o&&{scale:.3,opacity:0},animate:{scale:o?1:[.3,1.08,1],opacity:1},transition:o?{duration:0}:{duration:.32,ease:[.34,1.56,.64,1]},className:(0,w.cn)("absolute inset-0 rounded-full","green"===n?"bg-emerald-50 dark:bg-emerald-950/30":"blue"===n?"bg-blue-50 dark:bg-blue-950/30":"bg-white/10")}),(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"relative z-10",children:[(0,r.jsx)(eo.E.circle,{cx:"24",cy:"24",r:"20",stroke:c,strokeWidth:"3.2",strokeLinecap:"round",initial:!o&&{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:o?{duration:0}:{duration:.32,ease:"easeOut"}}),(0,r.jsx)(eo.E.path,{d:"M14.5 24.5L21 31L33.5 18",stroke:c,strokeWidth:"3.6",strokeLinecap:"round",strokeLinejoin:"round",initial:!o&&{pathLength:0},animate:{pathLength:1},transition:o?{pathLength:{duration:0}}:{pathLength:{delay:.12,duration:.26,ease:[.22,1,.36,1]}}})]})]})}function ep(e){let{isShaking:t,children:n,className:a}=e;return(0,r.jsx)("div",{className:(0,w.cn)(t&&"animate-subtle-shake",a),children:n})}let ef=new Set(["ì§ë³","ì¸ì ","미ì¸ì ","기í"]),eb=new Set(["ê²°ì","ì§ê°","ì¡°í´","ê²°ê³¼"]),eg=e=>e.normalize("NFC").toLocaleLowerCase().trim();function ev(e,t,n){let r=eg(t).split(/\s+/).filter(Boolean);if(0===r.length)return!0;let a=eg([n,e.studentName,e.reason,e.type,e.details,e.period].filter(Boolean).join(" "));return r.every(t=>ef.has(t)?e.reason===t:eb.has(t)?e.type===t:a.includes(t))}var ew=n(93973);let ej=[{value:"thisMonth",label:"ì´ë²ë¬"},{value:"lastMonth",label:"ì§ëë¬"},{value:"all",label:"ì ì²´"}],ey=["ì§ë³","ì¸ì ","미ì¸ì ","기í"],ek=["ê²°ì","ì§ê°","ì¡°í´","ê²°ê³¼"],eN=e=>{let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)},ez=e=>new Date(e+"T00:00:00");function eE(e){let{isOpen:t,onOpenChange:n,onDelete:a,onPress:i,label:s,divided:l=!1,children:d}=e;return(0,r.jsx)(ex,{isOpen:t,onOpenChange:n,onAction:a,onPress:i,actionLabel:"ìì ",actionButtonClass:"bg-red-500 hover:bg-red-600 text-white",actionIcon:(0,r.jsx)(m.Z,{size:16}),divided:l,actionWidth:76,children:(0,r.jsx)("div",{className:"flex items-center gap-2.5 px-3 py-2.5 bg-white dark:bg-zinc-900 active:bg-zinc-50 dark:active:bg-zinc-800 transition-colors cursor-pointer select-none",children:d})})}function eC(e){var t,n,a,i;let{students:s,records:l,onSaveRecord:c,onDeleteRecord:u}=e,[x,m]=(0,d.useState)("thisMonth"),[h,f]=(0,d.useState)(""),[g,v]=(0,d.useState)(!1),[j,y]=(0,d.useState)(null),{isShaking:k,triggerShake:N}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{hapticOnShake:t=!0}=e,[n,r]=(0,d.useState)(!1),a=(0,d.useRef)(null),i=(0,d.useCallback)(()=>{a.current&&clearTimeout(a.current),t&&ec.MU.error(),r(!0),a.current=setTimeout(()=>{r(!1)},380)},[t]);return(0,d.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),{isShaking:n,triggerShake:i,shakeClass:n?"animate-subtle-shake":""}}(),[z,E]=(0,d.useState)(!1),[C,D]=(0,d.useState)(null),[M,L]=(0,d.useState)(null),[_,A]=(0,d.useState)(null),[F,R]=(0,d.useState)(null),[T,Z]=(0,d.useState)(null),[O,B]=(0,d.useState)(eN(new Date)),[U,P]=(0,d.useState)(""),[V,W]=(0,d.useState)(""),[Y,q]=(0,d.useState)(!1),[K,H]=(0,d.useState)(!1),[X,G]=(0,d.useState)(""),[J,$]=(0,d.useState)(!1),Q=(0,d.useRef)(null),ee=(0,d.useRef)(null),es=(0,d.useRef)(null),el=(0,d.useRef)(null),[ed,eo]=(0,d.useState)(null),eu=(0,d.useRef)(0),ex=()=>Date.now()-eu.current<350;(0,d.useEffect)(()=>
1{if(!J)return;let e=e=>{var t;let n=e.target;null!==(t=el.current)&&void 0!==t&&t.contains(n)||!ee.current||ee.current.contains(n)||$(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[J]),(0,d.useEffect)(()=>{var e,t;if(!J){eo(null);return}let n=()=>{let e=es.current;if(!e)return;let t=e.getBoundingClientRect(),n=window.visualViewport,r=n?Math.max(0,n.offsetTop):0,a=r+(n?n.height:window.innerHeight)-t.bottom-6-10,i=t.top-r-6-10,s=a<150&&i>a,l=Math.max(96,Math.min(320,s?i:a));eo({left:t.left,width:t.width,top:s?t.top-6-l:t.bottom+6,maxHeight:l})};n();let r=requestAnimationFrame(n);return window.addEventListener("scroll",n,!0),window.addEventListener("resize",n),null===(e=window.visualViewport)||void 0===e||e.addEventListener("resize",n),null===(t=window.visualViewport)||void 0===t||t.addEventListener("scroll",n),()=>{var e,t;cancelAnimationFrame(r),window.removeEventListener("scroll",n,!0),window.removeEventListener("resize",n),null===(e=window.visualViewport)||void 0===e||e.removeEventListener("resize",n),null===(t=window.visualViewport)||void 0===t||t.removeEventListener("scroll",n)}},[J]);let em=null!==C,ef=(0,d.useMemo)(()=>{let e=[];return l.forEach(t=>{if(!t.endDate||t.date===t.endDate){e.push({...t,displayDate:t.date,uniqueKey:t.id});return}let n=ez(t.date),r=ez(t.endDate),a=new Date(n);for(;a<=r;){let n=a.getDay();if(0!==n&&6!==n){let n=eN(a);e.push({...t,displayDate:n,uniqueKey:"".concat(t.id,"-").concat(n)})}a.setDate(a.getDate()+1)}}),e},[l]),eb=(0,d.useMemo)(()=>{if("all"===x)return null;let e=new Date,t=new Date(e.getFullYear(),e.getMonth()-("lastMonth"===x?1:0),1);return{year:t.getFullYear(),month:t.getMonth()}},[x]),eg=(0,d.useMemo)(()=>ef.filter(e=>{if(!ev(e,h))return!1;if(!eb)return!0;let[t,n]=e.displayDate.split("-").map(Number);return t===eb.year&&n===eb.month+1}),[ef,eb,h]);(0,d.useMemo)(()=>{let e={ê²°ì:0,ì§ê°:0,ì¡°í´:0,ê²°ê³¼:0};return eg.forEach(t=>{t.type&&t.type in e&&e[t.type]++}),e},[eg]);let eC=(0,d.useMemo)(()=>{let e=[...eg].sort((e,t)=>t.displayDate.localeCompare(e.displayDate)),t=[],n="";return e.forEach(e=>{if(e.displayDate!==n){n=e.displayDate;let[r,a,i]=e.displayDate.split("-").map(Number),s=new Date(r,a-1,i),l="".concat(a,"ì ").concat(i,"ì¼ ").concat(["ì¼","ì","í","ì","목","ê¸","í "][s.getDay()],"ìì¼");t.push({date:e.displayDate,label:l,records:[]})}t[t.length-1].records.push(e)}),t},[eg]),eD=e=>{if(!e)return"";let t=s.find(t=>t.id===e);return t?t.number:""},eS=e=>{let[,t,n]=e.split("-").map(Number);return"".concat(t,"/").concat(n)},eM=e=>{if(!e)return"";let t=e.split(",").map(e=>S.OL.indexOf(e)).filter(e=>e>=0).sort((e,t)=>e-t);if(0===t.length)return"";let n=[];for(let e of t){let t=n[n.length-1];t&&e===t[t.length-1]+1?t.push(e):n.push([e])}let r=e=>e.match(/^(\d)êµì$/);return n.map(e=>{if(1===e.length)return S.OL[e[0]];let t=S.OL[e[0]],n=S.OL[e[e.length-1]],a=r(t),i=r(n);return a&&i?"".concat(a[1],"~").concat(i[1],"êµì"):"".concat(t,"~").concat(n)}).join(", ")},eI=(0,d.useMemo)(()=>{if(!X.trim())return s;let e=X.trim().toLowerCase();return s.filter(t=>t.name.toLowerCase().includes(e)||String(t.number).includes(e))},[s,X]),eL=s.find(e=>e.id===M),e_=e=>{if(ex())return;ec.MU.selection();let t=F===e?null:e;R(t),"ê²°ì"===t?Z(null):("ì§ê°"===t||"ì¡°í´"===t)&&(null==T?void 0:T.includes(","))&&Z(T.split(",")[0])},eA=e=>{if(ex())return;ec.MU.selection();let t=T?T.split(",").filter(Boolean):[];if("ê²°ê³¼"===F){let n=t.includes(e)?t.filter(t=>t!==e):S.OL.filter(n=>n===e||t.includes(n));Z(n.length>0?n.join(","):null)}else Z(t.includes(e)?null:e)},eF=e=>{var t;D(e.id),L(e.studentId),A(e.reason),R(e.type),Z(null!==(t=e.period)&&void 0!==t?t:null),B(e.date),P(e.endDate||""),W(e.details),q(e.submitted),G(""),$(!1),E(!1),v(!0)},eR=async()=>{if(!M||!F){N();return}let e=s.find(e=>e.id===M);if(!e)return;let t=U&&U>=O?U:void 0;H(!0);try{var n;let r={id:C||"record-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,5)),studentId:M,studentName:e.name,reason:_,type:F,period:"ê²°ì"===F?null:T,date:O,endDate:t,details:V,submitted:Y,createdAt:C&&(null===(n=l.find(e=>e.id===C))||void 0===n?void 0:n.createdAt)||new Date().toISOString()};await c(r),E(!0)}catch(e){N()}finally{H(!1)}};return(0,r.jsxs)("div",{className:"flex flex-1 min-h-0 flex-col h-full overflow-hidden bg-[#FBFBF9] dark:bg-zinc-950",children:[(0,r.jsx)("div",{className:"px-4 pt-3 pb-2.5 shrink-0",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("div",{className:"flex items-center gap-1.5",children:ej.map(e=>{let{value:t,label:n}=e;return(0,r.jsx)("button",{type:"button","aria-pressed":x===t,onClick:()=>{x!==t&&(ec.MU.selection(),y(null),m(t))},className:(0,et.Fk)(x===t),children:n},t)})}),(0,r.jsx)("span",{className:"text-[12px] text-zinc-400 dark:text-zinc-500 font-medium tabular-nums",children:eg.length>0&&"ì´ ".concat(eg.length,"ê±´")})]})}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto overscroll-contain px-4 mobile-scroll-with-floating",children:0===eC.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,r.jsx)(o.default,{src:"/icons/empty-search.svg",alt:"",width:56,height:56,className:"w-14 h-14 object-contain mb-3.5",unoptimized:!0}),(0,r.jsx)("h3",{className:"text-zinc-900 dark:text-zinc-100 font-bold mb-1",children:h.trim()?"ê²ì ê²°ê
1³¼ê° ììµëë¤":eb?"".concat(eb.month+1,"ì 기ë¡ì´ ììµëë¤"):"ì¶ê²° 기ë¡ì´ ììµëë¤"}),(0,r.jsx)("p",{className:"text-zinc-500 dark:text-zinc-400 text-[13px] break-keep",children:h.trim()?"ê²ìì´ë 기ê°ì ë°ê¿ ë³´ì¸ì.":"ìë + ë²í¼ì¼ë¡ ì¶ê²°ì ë±ë¡í ì ììµëë¤."})]}):eC.map(e=>(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("div",{className:"text-[13px] font-semibold text-zinc-500 mb-1.5 px-1",children:e.label}),(0,r.jsx)("div",{className:"bg-white dark:bg-zinc-900 rounded-2xl shadow-sm border border-zinc-200/50 dark:border-zinc-800/50 overflow-hidden",children:e.records.map((e,t)=>{var n;return(0,r.jsxs)(eE,{divided:t>0,isOpen:j===e.uniqueKey,onOpenChange:t=>{y(t?e.uniqueKey:null)},onDelete:()=>{y(null),u(e.id)},onPress:()=>eF(e),label:"".concat(e.studentName," ").concat(null!==(n=e.type)&&void 0!==n?n:""," 기ë¡"),children:[(0,r.jsx)("span",{className:"text-[13px] text-zinc-400 dark:text-zinc-500 font-medium w-5 text-right shrink-0",children:eD(e.studentId)}),(0,r.jsx)("span",{className:"text-[14px] font-medium text-zinc-800 dark:text-zinc-100 min-w-0 truncate mr-1",children:e.studentName}),e.reason&&(0,r.jsx)("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-md shrink-0 bg-zinc-100 dark:bg-white/10 text-zinc-600 dark:text-zinc-300",children:e.reason}),e.type&&(0,r.jsx)("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-md shrink-0 bg-zinc-100 dark:bg-white/10 text-zinc-600 dark:text-zinc-300 -ml-1",children:e.type}),e.period&&"ê²°ì"!==e.type&&(0,r.jsx)("span",{className:"text-[11px] font-medium text-zinc-400 dark:text-zinc-500 shrink-0 -ml-0.5 truncate",children:eM(e.period)}),(0,r.jsx)("span",{className:"text-[12px] text-zinc-400 dark:text-zinc-500 ml-auto shrink-0",children:e.endDate&&e.endDate!==e.date?"".concat(eS(e.date),"~").concat(eS(e.endDate)):eS(e.displayDate)}),(0,r.jsx)(er.Z,{size:12,className:"text-zinc-400 dark:text-zinc-500 shrink-0"})]},e.uniqueKey)})})]},e.date))}),!g&&(0,r.jsx)(ew.Z,{value:h,onChange:e=>{f(e),y(null)},placeholder:"ì¶ê²° ê²ì...",searchLabel:"ì¶ê²° ê²ì",actionLabel:"ì¶ê²° ê¸°ë¡ ì¶ê°",onAction:()=>{D(null),L(null),A(null),R(null),Z(null),B(eN(new Date)),P(""),W(""),q(!1),G(""),$(!1),E(!1),v(!0)}}),(0,r.jsx)(ei.Z,{isOpen:g,onClose:()=>v(!1),title:em?"ì¶ê²° ê¸°ë¡ ìì ":"ì¶ê²° ê¸°ë¡ ì¶ê°",footer:z?null:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[em&&(0,r.jsx)("button",{type:"button",onClick:()=>{C&&(ec.MU.impact("medium"),y(null),u(C),v(!1))},className:"px-4 py-3 rounded-2xl text-[15px] font-semibold text-red-500 dark:text-red-400 bg-red-50 dark:bg-red-950/30 active:bg-red-100 dark:active:bg-red-950/50 transition-colors",children:"ìì "}),(0,r.jsx)("button",{type:"button",onClick:eR,disabled:K,className:(0,w.cn)("flex-1 py-3 rounded-2xl text-[15px] font-semibold transition active:scale-[0.98] shadow-sm flex items-center justify-center",M&&F?"mobile-sheet-primary bg-zinc-900 text-white dark:bg-white dark:text-zinc-900":"bg-zinc-200 dark:bg-zinc-800 text-zinc-400 dark:text-zinc-500"),children:K?"ì ì¥ ì¤...":em?"ìì ":"ì ì¥í기"})]}),children:z?(0,r.jsxs)("div",{className:"py-14 flex flex-col items-center justify-center gap-3",children:[(0,r.jsx)(eh,{size:56,colorTheme:"green",onComplete:()=>{E(!1),v(!1)}}),(0,r.jsx)("p",{className:"text-[15px] font-semibold text-zinc-800 dark:text-zinc-100 mt-2",children:em?"ì¶ê²° 기ë¡ì´ ìì ëììµëë¤":"ì¶ê²° 기ë¡ì´ ì ì¥ëììµëë¤"})]}):(0,r.jsx)(ep,{isShaking:k,children:(0,r.jsxs)("div",{className:"space-y-3.5 px-0.5 pt-1 overflow-x-hidden",children:[(0,r.jsxs)("div",{ref:ee,children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-1.5 block",children:"íì"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("div",{ref:es,className:(0,w.cn)("flex items-center gap-2 px-3 py-2.5 rounded-xl border bg-white dark:bg-zinc-800 text-[16px] transition-colors",J?"border-zinc-400 dark:border-zinc-500 ring-2 ring-zinc-200 dark:ring-zinc-700":"border-zinc-200 dark:border-zinc-700"),onClick:()=>{$(!0),setTimeout(()=>{var e;return null===(e=Q.current)||void 0===e?void 0:e.focus()},50)},children:[(0,r.jsx)(b.Z,{size:15,className:"text-zinc-400 dark:text-zinc-500 shrink-0"}),M&&!J?(0,r.jsxs)("span",{className:"text-zinc-800 dark:text-zinc-100 font-medium truncate flex-1 min-w-0",children:[null==eL?void 0:eL.number," ",null==eL?void 0:eL.name]}):(0,r.jsx)("input",{ref:Q,type:"text",value:X,onChange:e=>{G(e.target.value),$(!0)},onFocus:()=>$(!0),placeholder:"ì´ë¦ ëë ë²í¸ë¡ ê²ì",className:"flex-1 bg-transparent text-zinc-800 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none min-w-0"}),(0,r.jsx)(ea.Z,{size:15,className:(0,w.cn)("text-zinc-400 dark:text-zinc-500 shrink-0 transition-transform",J&&"rotate-180")}
1)]}),J&&"undefined"!=typeof document&&(0,en.createPortal)((0,r.jsx)("div",{ref:el,className:"md:hidden fixed z-[200] rounded-xl border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 shadow-xl overflow-y-auto mobile-scroll",style:{left:null!==(t=null==ed?void 0:ed.left)&&void 0!==t?t:0,top:null!==(n=null==ed?void 0:ed.top)&&void 0!==n?n:0,width:null!==(a=null==ed?void 0:ed.width)&&void 0!==a?a:0,maxHeight:null!==(i=null==ed?void 0:ed.maxHeight)&&void 0!==i?i:0,visibility:ed?"visible":"hidden"},children:0===eI.length?(0,r.jsx)("div",{className:"px-3 py-3 text-[13px] text-zinc-400 dark:text-zinc-500 text-center",children:"ê²ì ê²°ê³¼ê° ììµëë¤"}):eI.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>{eu.current=Date.now(),L(e.id),G(""),$(!1)},className:(0,w.cn)("w-full flex items-center gap-2.5 px-3 py-2.5 text-left transition-colors",M===e.id?"bg-zinc-100 dark:bg-zinc-700/60":"active:bg-zinc-50 dark:active:bg-zinc-700/30"),children:[(0,r.jsx)("span",{className:"text-[12px] text-zinc-400 dark:text-zinc-500 font-medium w-5 text-right",children:e.number}),(0,r.jsx)("span",{className:"text-[14px] font-medium text-zinc-800 dark:text-zinc-100",children:e.name})]},e.id))}),document.body)]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-1.5 block",children:"구ë¶"}),(0,r.jsx)("div",{className:"flex gap-1.5",children:ey.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>{ex()||(ec.MU.selection(),A(_===e?null:e))},className:(0,w.cn)("flex-1 py-2.5 rounded-2xl text-[14px] font-semibold transition shadow-sm active:scale-[0.95]",_===e?"mobile-sheet-primary bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900":"bg-white text-zinc-500 border border-zinc-200/60 dark:bg-zinc-800 dark:text-zinc-400 dark:border-zinc-700 active:bg-zinc-50 dark:active:bg-zinc-700"),children:e},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-1.5 block",children:"ì í"}),(0,r.jsx)("div",{className:"flex gap-1.5",children:ek.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>e_(e),className:(0,w.cn)("flex-1 py-2.5 rounded-2xl text-[14px] font-semibold transition shadow-sm active:scale-[0.95]",F===e?"mobile-sheet-primary bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900":"bg-white text-zinc-500 border border-zinc-200/60 dark:bg-zinc-800 dark:text-zinc-400 dark:border-zinc-700 active:bg-zinc-50 dark:active:bg-zinc-700"),children:e},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,r.jsxs)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400",children:["êµì ",(0,r.jsx)("span",{className:"text-zinc-400 dark:text-zinc-500 font-normal",children:"(ì í)"})]}),"ê²°ê³¼"===F&&(0,r.jsx)("span",{className:"text-[11px] text-zinc-400 dark:text-zinc-500",children:"ì¬ë¬ êµì ì í ê°ë¥"})]}),"ê²°ì"===F?(0,r.jsx)("p",{className:"text-[12px] text-zinc-400 dark:text-zinc-500 px-1 py-1",children:"ê²°ìì êµì를 ì ííì§ ììµëë¤."}):(0,r.jsx)("div",{className:"grid grid-cols-3 gap-1.5",children:S.OL.map(e=>{let t=(T?T.split(","):[]).includes(e);return(0,r.jsx)("button",{type:"button",onClick:()=>eA(e),className:(0,w.cn)("py-2 rounded-2xl text-[13px] font-semibold transition shadow-sm active:scale-[0.95]",t?"mobile-sheet-primary bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900":"bg-white text-zinc-500 border border-zinc-200/60 dark:bg-zinc-800 dark:text-zinc-400 dark:border-zinc-700 active:bg-zinc-50 dark:active:bg-zinc-700"),children:e},e)})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-1.5 block",children:"ë ì§"}),(0,r.jsxs)("div",{className:"relative min-h-[46px] bg-white dark:bg-zinc-800 rounded-xl border border-zinc-200 dark:border-zinc-700 flex items-center px-3",children:[(0,r.jsx)(p.Z,{size:15,className:"text-zinc-400 dark:text-zinc-500 shrink-0 mr-1"}),(0,r.jsx)(I.h,{overlay:!0,value:O,onChange:e=>{B(e),U&&U<e&&P("")},endDate:U||void 0,onEndDateChange:e=>P(e||""),className:"text-[15px] font-medium text-left w-full py-2.5 text-zinc-800 dark:text-zinc-100"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-[13px] font-semibold text-zinc-500 dark:text-zinc-400 mb-1.5 block",children:"ì¬ì "}),(0,r.jsx)("input",{type:"text",value:V,onChange:e=>W(e.target.value),placeholder:"ë´ì© ì
ë ¥ (ì í)",className:"w-full px-3 py-2.5 rounded-xl border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 text-[16px] text-zinc-800 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-300 dark:focus:ring-zinc-600"})]})]})})})]})}var eD=n(64954);let eS=e=>{let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)},eM=e=>new Date(e+"T00:00:00"),eI=()=>(0,w.RJ)(),eL=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=new Date(new Date().toLocaleStr
1ing("en-US",{timeZone:"Asia/Seoul"})),n=t.getFullYear(),r=t.getMonth()+e,a=new Date(n,r,1),i=new Date(n,r+1,0);return{start:eS(a),end:eS(i),label:"".concat(a.getFullYear(),"ë
").concat(a.getMonth()+1,"ì")}},e_=()=>{let[e,t]=eI().split("-").map(Number),n=t<3?e-1:e;return{start:eS(new Date(n,2,1)),end:eS(new Date(n+1,2,0))}},eA=e=>{let t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{start:eS(t),end:eS(n)}},eF=["ê²°ì","ì§ê°","ì¡°í´","ê²°ê³¼"],eR=["ì§ë³","미ì¸ì ","기í","ì¸ì "],eT=(e,t)=>{let n=t?e.indexOf(t):-1;return -1===n?e.length:n},eZ=e=>{var t,n,r,a,i,s,l;return[null!==(t=e.studentId)&&void 0!==t?t:"",null!==(n=e.studentName)&&void 0!==n?n:"",e.date,null!==(r=e.endDate)&&void 0!==r?r:"",null!==(a=e.type)&&void 0!==a?a:"",null!==(i=e.reason)&&void 0!==i?i:"",String(null!==(s=e.period)&&void 0!==s?s:""),null!==(l=e.details)&&void 0!==l?l:"",e.submitted?"1":"0"].join("\x01")},eO=(e,t)=>{let n=eT(eF,e.type)-eT(eF,t.type);return 0!==n?n:eT(eR,e.reason)-eT(eR,t.reason)},eB=e=>{let t=eM(e.date),n=e.endDate?eM(e.endDate):t,r=[],a=new Date(t);for(;a<=n;){let t=a.getDay();0!==t&&6!==t&&r.push({...e,date:eS(a),endDate:void 0}),a.setDate(a.getDate()+1)}return r},eU=e=>{let{records:t,filter:n,onOpenModal:a,onMoveRecord:i,onDeleteRecord:s,onViewDateChange:l}=e,{status:o}=(0,N.kP)(),p=(0,z.Dv)(),f=(0,E.XC)(),{isLoaded:b}=(0,j.AF)(),g=(0,d.useRef)(!1);(0,d.useEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]);let[v,k]=(0,d.useState)(null),[C,D]=(0,d.useState)(null),[S,M]=(0,d.useState)(()=>new Date);(0,d.useEffect)(()=>{if("thisMonth"===n)M(new Date);else if("lastMonth"===n){let e=new Date;e.setMonth(e.getMonth()-1),M(e)}},[n]),(0,d.useEffect)(()=>{null==l||l(S)},[S,l]);let I=S.getFullYear(),L=S.getMonth(),_=new Date(I,L,1).getDay(),A=new Date(I,L+1,0).getDate(),F=new Date;F.getFullYear()===I&&F.getMonth();let[R,T]=(0,d.useState)({}),Z="".concat(I,"-").concat(L),O=R[Z]||["","","","","",""];(0,d.useEffect)(()=>{(async()=>{if(!b||(await new Promise(e=>setTimeout(e,1e3)),!g.current||p))return;let e=await (0,y.X)("getAttendanceMemos",{},f);if(e.success&&e.data){let t={};for(let n of e.data){let e=n.id.lastIndexOf("-"),r=n.id.substring(0,e),a=parseInt(n.id.substring(e+1),10);t[r]||(t[r]=["","","","","",""]),t[r][a]=n.content}T(t)}})()},[f,p,b]);let B=async(e,t)=>{T(n=>{let r=[...n[Z]||["","","","","",""]];return r[e]=t,{...n,[Z]:r}}),await (0,y.X)("upsertAttendanceMemo",{weekKey:"".concat(Z,"-").concat(e),content:t},f)},U=(0,d.useMemo)(()=>{let e={};return t.forEach(t=>{let n=eM(t.date),r=t.endDate?eM(t.endDate):n,a=new Date(n);for(;a<=r;){let n=a.getDay();if(0!==n&&6!==n){let n=eS(a);e[n]||(e[n]=[]),e[n].push(t)}a.setDate(a.getDate()+1)}}),e},[t]),P=[.5,1,1,1,1,1,.5],V=P.reduce((e,t)=>e+t,0),W=e=>{let t=0;for(let n=0;n<e;n++)t+=P[n];return t/V*100},Y=(e,t)=>{let n=0;for(let r=e;r<=t;r++)n+=P[r];return n/V*100},q=(e,t)=>{let n=eM(e),r=eM(t),a=0,i=new Date(n);for(;i<=r;){let e=i.getDay();0!==e&&6!==e&&a++,i.setDate(i.getDate()+1)}return a},K=e=>0===e||6===e,H=(e,t)=>{if(e>=t)return!1;let n=eM(e),r=eM(t);r.setDate(r.getDate()-1);let a=new Date(n);for(;a<=r;){let e=a.getDay();if(0!==e&&6!==e)return!0;a.setDate(a.getDate()+1)}return!1},X=(e,t)=>{if(e<=t)return!1;let n=eM(t);n.setDate(n.getDate()+1);let r=eM(e),a=new Date(n);for(;a<=r;){let e=a.getDay();if(0!==e&&6!==e)return!0;a.setDate(a.getDate()+1)}return!1},G=e=>{let n=[];return t.forEach(t=>{if(!t.endDate||t.date===t.endDate)return;let r=t.date,a=t.endDate,i=e[0],s=e[6];if(r<=s&&a>=i){let l=H(r,i)||X(a,s),d=null;for(let i=0;i<7;i++){let s=e[i],o=s>=r&&s<=a,c=!K(i);if(o&&c)null===d&&(d=i);else if(null!==d){let e=i-1;(d!==e||l)&&n.push({record:t,startCol:d,endCol:e}),d=null}}if(null!==d){let i=d;for(let t=d;t<7;t++){let n=e[t],s=n>=r&&n<=a,l=!K(t);s&&l&&(i=t)}(d!==i||l)&&n.push({record:t,startCol:d,endCol:i})}}}),n},J=(0,d.useMemo)(()=>{let e=[],t=[],n=new Date(I,L,0).getDate();for(let e=0;e<_;e++)t.push({day:n-_+e+1,isCurrentMonth:!1});for(let n=1;n<=A;n++)t.push({day:n,isCurrentMonth:!0}),7===t.length&&(e.push(t),t=[]);if(t.length>0){let n=1;for(;t.length<7;)t.push({day:n++,isCurrentMonth:!1});e.push(t)}return e},[I,L,_,A]),$=(0,d.useMemo)(()=>J.map((e,t)=>{let n=e.map((e,n)=>{let{day:r,isCurrentMonth:a}=e,i=I,s=L;return!a&&(0===t||1===t&&r>20?(s=L-1)<0&&(s=11,i=I-1):(s=L+1)>11&&(s=0,i=I+1)),"".concat(i,"-").concat(String(s+1).padStart(2,"0"),"-").concat(String(r).padStart(2,"0"))}),r=G(n);return{week:e,weekIdx:t,weekDates:n,spanningRecords:r}}),[J,t]);return(0,r.jsxs)("div",{className:"flex flex-col h-full bg-[#09090b]",children:[(0,r.jsxs)("div",{className:"shrink-0 flex flex-col md:grid md:grid-cols-[6fr_4px_1fr]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-l border-r border-b border-white/5 bg-[#1C1C1E] rounded-t-xl",children:[(0,r.jsx)("button",{"aria-label":"ì´ì ë¬",onClick:()=>M(new Date(I,L-1,1)),className:"p-2 hover:bg-white/10 rounded-lg text-[#8E8E93] hover:text-white transition-colors",children:(0,r.jsx)(c.Z,{size:20})}),(0,r.jsxs)("div",{className:"text-lg font-bold text-white tracking-tight",children:[I,"ë
",L+1,"ì"]}),(0,r.jsx)("button",{"aria-label":"ë¤ì ë¬",onClick:()=>M(new Date(I,L+1,1)),className:"p-2 hover:bg-white/10 rounded-lg text-[#8E8E93] hover:text-white transition-colors",children:(0,r.jsx)(u.Z,{size:20})})]}),(0,r.jsx)("div",{className:"hidden md:block bg-[#09090b]"}),(0,r.jsx)("div",{className:"hidden md:flex items-center justify-center py-3 border-t border-l border-r border-white/5 rounded-t-xl bg-[#1C1C1E]",children:(0,r.jsx)("span",{className:"text-sm font-medium text-[#E0E0E0]",children:"ì¶ê²° ë©ëª¨"})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto custom-scrollbar",children:(0,r.jsxs)("div",{className:"min-w-[800px] md:min-w-[600px] h-full flex flex-col",children:[(0,r.jsxs)("div",{className:"shrink-0 flex flex-col md:grid md:grid-cols-[6fr_4px_1fr]",children:[(0,r.jsx)("div",{className:"grid grid-cols-[minmax(0,0.5fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,0.5fr)]",children:["ì¼","ì","í","ì","목","ê¸","í "].map((e,t)=>(0,r.jsx)("div",{className:(0,w.cn)("text-center py-2 text-xs font-semibold uppercase tracking-wider border-r border-b border-white/5 bg-[#1C1C1E]",0===t&&"border-l border-white/5","text-[#8E8E93]"),children:e},e))}),(0,r.jsx)("div",{className:"hidden md:block bg-[#09090b]"}),(0,r.jsx)("div",{className:"hidden md:block bg-[#1C1C1E] border-r border-b border-l border-white/5"})]}),(0,r.jsx)("div",{className:"flex flex-col flex-1",children:$.map(e=>{let{week:t,weekIdx:n,weekDates:l,spanningRecords:d}=e,o=new Set(d.map(e=>e.record.id));return(0,r.jsxs)("div",{className:"flex flex-col md:grid md:grid-cols-[6fr_4px_1fr] flex-[1_0_auto] min-h-[100px] md:min-
1h-[140px]",children:[(0,r.jsxs)("div",{className:"relative grid grid-cols-[minmax(0,0.5fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,0.5fr)]",children:[d.map((e,t)=>{let{record:n,startCol:i,endCol:d}=e,o=Math.max(0,i),c=Math.min(6,d);if(o>c)return null;let u=H(n.date,l[0]),h=X(n.endDate||n.date,l[6]),p=u?0:8,f=C===n.id;return(0,r.jsxs)("div",{draggable:!0,onDragStart:e=>{e.dataTransfer.setData("text/plain",n.id),e.dataTransfer.effectAllowed="move",e.target.style.opacity="0.5"},onDragEnd:e=>{e.target.style.opacity="1",D(null)},className:(0,w.cn)("absolute z-10 text-xs px-2 py-1 border border-white/5 text-[#E0E0E0] truncate transition-colors cursor-grab active:cursor-grabbing shadow-sm flex items-center group/attendance attendance-block select-none",f?"event-block-hover":"event-block-base",u?"rounded-l-none border-l-0":"rounded-l",h?"rounded-r-none border-r-0":"rounded-r"),style:{left:"calc(".concat(W(o),"% + ").concat(p,"px)"),width:"calc(".concat(Y(o,c),"% - ").concat(p+(h?0:8),"px)"),top:"".concat(40+30*t,"px")},onMouseEnter:()=>D(n.id),onMouseLeave:()=>D(null),onClick:()=>a(n.date,!1),children:[n.submitted&&(0,r.jsx)(x.Z,{size:12,className:"text-green-400 mr-1.5 shrink-0",strokeWidth:3}),(0,r.jsx)("span",{className:"font-semibold text-white/90 mr-1.5",children:n.studentName}),(0,r.jsxs)("span",{className:"opacity-70",children:[n.reason," ",n.type]}),n.endDate&&(0,r.jsxs)("span",{className:"ml-1 opacity-50",children:[q(n.date,n.endDate),"ì¼"]}),(0,r.jsx)("div",{className:"ml-auto flex items-center gap-1",children:(0,r.jsx)("button",{"aria-label":"ìì ",onClick:e=>{e.stopPropagation(),s(n.id)},className:"opacity-0 group-hover/attendance:opacity-100 p-0.5 rounded-md text-red-500/70 hover:text-red-500 transition",children:(0,r.jsx)(m.Z,{size:12})})})]},n.id)}),[0,1,2,3,4,5,6].map(e=>{let{day:c,isCurrentMonth:u}=t[e],p=l[e],f=K(e),b=f?[]:(U[p]||[]).filter(e=>!o.has(e.id)),g=u&&F.getFullYear()===I&&F.getMonth()===L&&c===F.getDate(),j=d.reduce((e,t,n)=>p>=t.record.date&&p<=(t.record.endDate||t.record.date)?Math.max(e,n):e,-1),y=-1!==j?(j+1)*30+8:0;return(0,r.jsxs)("div",{className:(0,w.cn)("relative p-2 border-r border-b border-white/5 bg-[#1C1C1E] group transition-colors",0===e&&"border-l border-white/5",0===e&&n===J.length-1&&"rounded-bl-xl",6===e&&n===J.length-1&&"rounded-br-xl",v===p&&"bg-white/10 ring-2 ring-white/20 ring-inset"),onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",u&&v!==p&&k(p)},onDragLeave:()=>{k(null)},onDrop:e=>{e.preventDefault(),k(null);let t=e.dataTransfer.getData("text/plain");t&&u&&i(t,p)},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("span",{className:(0,w.cn)("text-sm font-medium w-6 h-6 flex items-center justify-center rounded-full",g&&"today-indicator",!u&&"opacity-30",g?"bg-[#df5252] text-white":0===e?"text-red-400":6===e?"text-blue-400":"text-[#E0E0E0]"),children:c}),u&&!f&&(0,r.jsx)("button",{"aria-label":"ì¶ê²° ê¸°ë¡ ì¶ê°",onClick:e=>{e.stopPropagation(),a(p,!0)},className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-white/10 rounded text-[#8E8E93] hover:text-white transition transform hover:scale-110 active:scale-95",children:(0,r.jsx)(h.Z,{size:14,strokeWidth:3})})]}),(0,r.jsx)("div",{className:"space-y-1",style:{marginTop:y>0?"".concat(y,"px"):void 0},children:b.map(e=>(0,r.jsxs)("div",{draggable:!0,onDragStart:t=>{t.dataTransfer.setData("text/plain",e.id),t.dataTransfer.effectAllowed="move",t.target.style.opacity="0.5"},onDragEnd:e=>{e.target.style.opacity="1"},onClick:()=>a(p,!1),className:(0,w.cn)("text-xs px-2 py-1 rounded bg-[#2C2C2E] border border-white/5 text-[#E0E0E0] truncate hover:bg-[#3A3A3C] transition-colors cursor-grab active:cursor-grabbing select-none shadow-sm flex items-center group/attendance attendance-block",!u&&"opacity-50"),children:[e.submitted&&(0,r.jsx)(x.Z,{size:12,className:"text-green-400 mr-1.5 shrink-0",strokeWidth:3}),(0,r.jsx)("span",{className:"font-semibold text-white/90 mr-1.5",children:e.studentName}),(0,r.jsxs)("span",{className:"opacity-70",children:[e.reason," ",e.type]}),(0,r.jsx)("div",{className:"ml-auto flex items-center gap-1",children:(0,r.jsx)("button",{"aria-label":"ìì ",onClick:t=>{t.stopPropagation(),s(e.id)},className:"opacity-0 group-hover/attendance:opacity-100 p-0.5 rounded-md text-red-500/70 hover:text-red-500 transition",children:(0,r.jsx)(m.Z,{size:12})})})]},e.id))})]},e)})]}),(0,r.jsx)("div",{className:"hidden md:block bg-[#09090b]"}),(0,r.jsx)("div",{className:(0,w.cn)("hidden md:block bg-[#1C1C1E] border-l border-r border-b border-white/5 p-2",n===J.length-1&&"rounded-b-xl"),children:(0,r.jsx)("textarea",{value:O[n]||"",onChange:e=>B(n,e.target.value),className:"w-full h-full bg-transparent text-sm text-[#E0E0E0] placeholder:text-[#5C5C5E] resize-none focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 leading-relaxed",placeholder:""})})]},n)})})]})})]})},eP=null;function eV(){var e;let t;let n=(0,C.d)(),c=(0,d.useMemo)(()=>Math.random().toString(36).slice(2,7),[]),u=(0,d.useRef)(!1);(0,d.useEffect)(()=>
1(u.current=!0,console.log("--- [AttendanceView:".concat(c,"] MOUNTED ---")),()=>{u.current=!1,console.log("--- [AttendanceView:".concat(c,"] UNMOUNTED ---")),eP===c&&(eP=null,console.log("[AttendanceView:".concat(c,"] Released global lock on unmount")))}),[c]);let x=(0,d.useRef)(!1),{students:S,isLoaded:_}=(0,j.AF)(),{showToast:F}=(0,D.pm)(),Z=(0,E.XC)(),{data:O,status:B}=(0,N.kP)(),U=(0,z.Dv)(),P="authenticated"===B&&!U&&(null==O?void 0:null===(e=O.user)||void 0===e?void 0:e.isSystemAdmin)===!0,[V,W]=(0,d.useState)([]),[Y,q]=(0,d.useState)("calendar"),[K,H]=(0,d.useState)("calendar"===Y?"all":"thisMonth"),[X,G]=(0,d.useState)(()=>new Date),[J,et]=(0,d.useState)("all"),[en,er]=(0,d.useState)(""),[ea,ei]=(0,d.useState)(!1),[es,el]=(0,d.useState)(!1),[ed,eo]=(0,d.useState)(!1),[ec,eu]=(0,d.useState)(""),[ex,em]=(0,d.useState)(!1),[eh,ep]=(0,d.useState)(!0),[ef,eb]=(0,d.useState)(!1),eg=(0,d.useRef)([]),ew=(0,d.useRef)(new Map);(0,d.useEffect)(()=>{eg.current=V},[V]),(0,d.useEffect)(()=>{"calendar"===Y&&H("all")},[Y]);let ej=(0,d.useRef)({});(0,d.useRef)(new Set);let ey=(0,d.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(u.current){if(x.current){console.log("[AttendanceView:".concat(c,"] denied: local loadingRef is true"));return}if(eP&&eP!==c&&!e){console.log("[AttendanceView:".concat(c,"] denied: Global lock held by ").concat(eP));return}if(!_){console.log("[AttendanceView:".concat(c,"] denied: StudentContext not loaded"));return}if("loading"===B){console.log("[AttendanceView:".concat(c,"] denied: status is loading"));return}console.log("[AttendanceView:".concat(c,"] Triggering loadRecords")),x.current=!0,eP=c,t&&ep(!0),eb(!1);try{if(U){let e=await (0,Q.getGuestData)();if(u.current){let t=e.attendanceRecords||[];0===t.length&&(t=(await (0,Q.generateMockData)()).attendanceRecords||[],await (0,Q.saveGuestData)("attendanceRecords",t)),W(t),ew.current=new Map(t.map(e=>[e.id,e]))}return}let e=e_(),t=eL(-1),n=t.start<e.start?t.start:e.start,r=[];for(let t=0;;t+=200){let a=await (0,l.W)(()=>(0,y.X)("getAttendanceRecords",{startDate:n,endDate:e.end,take:200,skip:t},Z));if(!u.current)return;if(!a.success||!a.data){eb(!0);return}if(r.push(...a.data),a.data.length<200)break}W(r),ew.current=new Map(r.map(e=>[e.id,e]))}catch(e){console.error("[AttendanceView:".concat(c,"] Load error:"),e),u.current&&eb(!0)}finally{u.current&&(ep(!1),x.current=!1),eP===c&&(eP=null)}}},[U,Z,B,c,_]);(0,d.useEffect)(()=>{("authenticated"===B||U)&&_&&ey()},[ey,B,_,U]);let ek=(0,d.useCallback)(async e=>{let t=e=>(eg.current=e,e);W(n=>n.find(t=>t.id===e.id)?t(n.map(t=>t.id===e.id?e:t)):t([...n,e]));let n=()=>{let n=ew.current.get(e.id);W(r=>{let a=r.find(t=>t.id===e.id);return a&&eZ(a)===eZ(e)?t(n?r.map(t=>t.id===e.id?n:t):r.filter(t=>t.id!==e.id)):r})};if(U){let t;let n=(await (0,Q.getGuestData)()).attendanceRecords||[];return t=n.findIndex(t=>t.id===e.id)>=0?n.map(t=>t.id===e.id?e:t):[...n,e],await (0,Q.saveGuestData)("attendanceRecords",t),ew.current.set(e.id,e),!0}if(!e.studentId)return console.log("Skipping save - no studentId:",e.id),!1;console.log("Saving record:",e.id,"studentId:",e.studentId);try{var r;let t=S.find(t=>t.id===e.studentId),a=t?{name:t.name,number:t.number,grade:t.grade||1,homeClassId:t.homeClassId}:void 0;a||console.warn("Student details not found for:",e.studentId);let i=await (0,y.X)("upsertAttendanceRecord",{id:e.id&&e.id.startsWith("record-")?void 0:e.id,studentId:e.studentId,date:e.date,endDate:e.endDate,type:e.type,reason:e.reason,period:null!==(r=e.period)&&void 0!==r?r:null,details:e.details,submitted:e.submitted,studentDetails:a},Z);if(console.log("Save result:",i.success?"SUCCESS":"FAILED",i.error||""),i.success&&i.data){i.audit&&(0,k.dp)(i.audit);let t=i.data.id||e.id,n={...e,id:t};return e.id!==t&&ew.current.delete(e.id),ew.current.set(t,n),e.id&&e.id.startsWith("record-")&&t!==e.id&&(W(t=>{let r=t.map(t=>t.id===e.id?n:t);return eg.current=r,r}),delete ej.current[e.id]),!0}return console.error("Save failed:",i.error),F(i.error||"ì¶ê²°ì ì ì¥íì§ ëª»íìµëë¤. ë¤ì ìëí´ ì£¼ì¸ì.","error"),n(),!1}catch(e){return console.error("Save error:",e),F("ì¶ê²°ì ì ì¥íì§ ëª»íìµëë¤. ë¤ì ìëí´ ì£¼ì¸ì.","error"),n(),!1}},[S,U,Z,F]),eN=(0,d.useRef)(void 0);eN.current=()=>{for(let e of Object.keys(ej.current)){clearTimeout(ej.current[e]),delete ej.current[e];let t=eg.current.find(t=>
1t.id===e);t&&t.studentId&&ek(t)}},(0,d.useEffect)(()=>{let e=()=>{var e;"hidden"===document.visibilityState&&(null===(e=eN.current)||void 0===e||e.call(eN))},t=()=>{var e;return null===(e=eN.current)||void 0===e?void 0:e.call(eN)};return document.addEventListener("visibilitychange",e),window.addEventListener("pagehide",t),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("pagehide",t)}},[]);let ez=()=>{if(U)return eW();let e={id:"record-".concat(Date.now()),studentId:null,studentName:"",reason:null,type:null,date:eI(),details:"",submitted:!1,createdAt:new Date().toISOString()};W(t=>{let n=[e,...t];return eg.current=n,n})},eE=async(e,t)=>{if(U)return eW();let n=eg.current.find(t=>t.id===e);if(!n){console.log("updateRecordFields: Record not found",e);return}let r={...n,...t};W(t=>{let n=t.map(t=>t.id===e?r:t);return eg.current=n,n}),r.studentId&&(ej.current[e]&&clearTimeout(ej.current[e]),ej.current[e]=setTimeout(async()=>{await ek(r)},500))},eF=(e,t,n)=>eE(e,{[t]:n}),eR=async(e,t,n)=>{if(U)return eW();if(!t)return;ej.current[e]&&(clearTimeout(ej.current[e]),delete ej.current[e]);let r=eg.current.find(t=>t.id===e);if(!r){console.log("updateStudentInfo: Record not found",e);return}let a={...r,studentId:t,studentName:n};W(t=>{let n=t.map(t=>t.id===e?a:t);return eg.current=n,n}),console.log("updateStudentInfo: Saving record immediately",a.id),await ek(a)},eT=(0,d.useRef)([]);(0,d.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&"KeyZ"===e.code&&!e.shiftKey){console.log("[Attendance:Undo] Shortcut detected. Stack size: ".concat(eT.current.length));let e=eT.current.pop();e?(console.log("Undoing deletion for attendance record:",e.id),ek({...e,id:"record-".concat(Date.now())}).then(t=>{t?F("ìì ë ì¶ê²° 기ë¡ì 복구íìµëë¤.","success"):eT.current.push(e)})):console.log("[Attendance:Undo] No record to restore in stack")}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ek,F]);let eV=async e=>{if(U){let t=await (0,Q.getGuestData)();await (0,Q.saveGuestData)("attendanceRecords",(t.attendanceRecords||[]).filter(t=>t.id!==e))}else if(e&&!e.startsWith("record-")){let t=await (0,y.X)("deleteAttendanceRecord",{id:e},Z);if(!t.success)throw Error(t.error||"ì¶ê²° ìì ì¤í¨")}let t=eg.current.find(t=>t.id===e);t&&eT.current.push(t),W(t=>{let n=t.filter(t=>t.id!==e);return eg.current=n,n})},eW=(0,d.useCallback)(()=>(F("ìì íë©´ììë ìì í ì ììµëë¤.","info"),!0),[F]),eY=["ì§ë³","미ì¸ì ","기í","ì¸ì "],eq=["ê²°ì","ì§ê°","ì¡°í´","ê²°ê³¼"],eK=(0,d.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];eu(e),em(t),el(!0)},[]),eH=(0,d.useCallback)(async(e,t)=>{if(U)return eW();let n=eg.current.find(t=>t.id===e);if(!n)return;let r=eM(n.date),a=Math.round((eM(t).getTime()-r.getTime())/864e5),i={...n,date:t};if(n.endDate){let e=new Date(eM(n.endDate));e.setDate(e.getDate()+a),i.endDate=eS(e)}W(t=>{let n=t.map(t=>t.id===e?i:t);return eg.current=n,n}),i.studentId&&(ej.current[e]&&clearTimeout(ej.current[e]),ej.current[e]=setTimeout(async()=>{await ek(i)},500))},[U,eW,ek]),eX=(0,d.useCallback)(async e=>{var t,n;if(!e.studentId)return;let r={id:e.id||"record-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,5)),studentId:e.studentId,studentName:e.studentName||"",reason:e.reason||null,type:e.type||null,period:null!==(t=e.period)&&void 0!==t?t:null,date:e.date||eI(),endDate:e.endDate,details:e.details||"",submitted:null!==(n=e.submitted)&&void 0!==n&&n,createdAt:e.createdAt||new Date().toISOString()};if(W(e=>{let t=e.find(e=>e.id===r.id)?e.map(e=>e.id===r.id?r:e):[...e,r];return eg.current=t,t}),!await ek(r))throw Error("ì¶ê²° ì ì¥ ì¤í¨")},[ek]),eG=(0,d.useCallback)(e=>{if(0===e.length)return;let t=new Set(e);for(let t of e)ej.current[t]&&(clearTimeout(ej.current[t]),delete ej.current[t]);W(e=>{let n=e.map(e=>t.has(e.id)?{...e,submitted:!0}:e);return eg.current=n,n})},[]),eJ=(0,d.useMemo)(()=>new Map(S.map(e=>[e.id,e])),[S]),e$=e=>e?eJ.get(e):void 0,{start:eQ,end:e0}="thisMonth"===K?eL(0):"lastMonth"===K?eL(-1):e_(),e1=(0,d.useMemo)(()=>V.filter(e=>e.date<=e0&&(e.endDate||e.date)>=eQ),[V,eQ,e0]),e5=(0,d.useMemo)(()=>e1.filter(e=>{var t;return ev(e,en,e.studentId?null===(t=eJ.get(e.studentId))||void 0===t?void 0:t.name:void 0)}
1),[e1,en,eJ]),e2=(0,d.useMemo)(()=>[...e5].filter(e=>"all"===J||e.type===J).sort((e,t)=>{var n,r;let a=t.date.localeCompare(e.date);if(0!==a)return a;let i=e$(e.studentId),s=e$(t.studentId),l=null!==(n=null==i?void 0:i.number)&&void 0!==n?n:999,d=null!==(r=null==s?void 0:s.number)&&void 0!==r?r:999;return l!==d?l-d:t.createdAt.localeCompare(e.createdAt)}),[e5,J,eJ]),e3=(0,d.useMemo)(()=>e5.flatMap(eB).filter(e=>e.date>=eQ&&e.date<=e0),[e5,eQ,e0]),e4=e=>({total:e.length,absent:e.filter(e=>"ê²°ì"===e.type).length,late:e.filter(e=>"ì§ê°"===e.type).length,earlyLeave:e.filter(e=>"ì¡°í´"===e.type).length,missing:e.filter(e=>"ê²°ê³¼"===e.type).length}),e8=(0,d.useMemo)(()=>e4(e3),[e3]),e9=(0,d.useMemo)(()=>{if("calendar"!==Y)return e8;let{start:e,end:t}=eA(X);return e4(e3.filter(n=>n.date>=e&&n.date<=t))},[Y,e3,X,e8]),e6=(0,d.useMemo)(()=>e2.flatMap(e=>{let t=eB(e);return t.filter(e=>e.date>=eQ&&e.date<=e0).map(n=>({...n,uniqueKey:1===t.length?e.id:"".concat(e.id,"-").concat(n.date)}))}).sort((e,t)=>{var n,r,a,i;if(ea){let a=(null!==(n=e.studentName)&&void 0!==n?n:"").localeCompare(null!==(r=t.studentName)&&void 0!==r?r:"","ko");if(0!==a)return a;let i=e.date.localeCompare(t.date);if(0!==i)return i;let s=eO(e,t);return 0!==s?s:t.createdAt.localeCompare(e.createdAt)}let s=t.date.localeCompare(e.date);if(0!==s)return s;let l=eO(e,t);if(0!==l)return l;let d=e$(e.studentId),o=e$(t.studentId),c=null!==(a=null==d?void 0:d.number)&&void 0!==a?a:999,u=null!==(i=null==o?void 0:o.number)&&void 0!==i?i:999;return c!==u?c-u:t.createdAt.localeCompare(e.createdAt)}),[e2,ea,eJ,eQ,e0]);return n?(0,r.jsxs)("div",{className:"h-full min-h-0 flex flex-col overflow-hidden relative bg-[#FBFBF9] dark:bg-zinc-950",children:[ef&&(0,r.jsx)("div",{className:0===V.length?"absolute inset-0 z-[100] bg-[#FBFBF9] dark:bg-zinc-950":"shrink-0",children:(0,r.jsx)(s.A,{message:"ì¶ê²° 기ë¡ì ë¶ë¬ì¤ì§ 못íì´ì. ë¤ì ìëí´ ì£¼ì¸ì.",onRetry:()=>void ey(!0)})}),_?(0,r.jsx)(eC,{students:U?S:S.filter(e=>"ë´ì íê¸"===e.homeClassId),records:V,onSaveRecord:ek,onDeleteRecord:eV}):(0,r.jsx)(ee.r,{label:"íì ëª
ë¨ì ë¶ë¬ì¤ê³ ìì´ì",variant:"students",className:"px-4"}),(eh||"loading"===B&&!(0,z.YY)())&&(0,r.jsx)(ee.r,{label:"ì¶ê²° ì 보를 ë¶ë¬ì¤ê³ ìì´ì",className:"absolute inset-0 z-50 px-4"})]}):(0,r.jsxs)("div",{className:"h-full flex flex-col p-3 pt-1 gap-3 overflow-y-auto bg-[#fafaf9] dark:bg-[#09090b] relative",children:[(eh||"loading"===B&&!(0,z.YY)())&&(0,r.jsx)(ee.MobileLoadingSwap,{label:"ì¶ê²° ì 보를 ë¶ë¬ì¤ê³ ìì´ì",className:"absolute inset-0 z-[100] bg-[#FBFBF9] dark:bg-zinc-950",fallback:"calendar"===Y?(0,r.jsx)(i.p7,{className:"absolute inset-0 z-[100]"}):(0,r.jsx)(a.ContentLoadingState,{variant:"table",label:"ì¶ê²° ì 보를 ë¶ë¬ì¤ê³ ìì´ì",className:"absolute inset-0 z-[100] overflow-auto bg-[#fafaf9] dark:bg-[#09090b]"})}),ef&&(0,r.jsx)("div",{className:0===V.length?"absolute inset-0 z-[100] bg-[#fafaf9] dark:bg-[#09090b]":"relative z-[100] bg-[#fafaf9] dark:bg-[#09090b]",children:(0,r.jsx)(s.A,{message:"ì¶ê²° 기ë¡ì ë¶ë¬ì¤ì§ 못íì´ì. ë¤ì ìëí´ ì£¼ì¸ì.",onRetry:()=>void ey(!0)})}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 shrink-0 relative",children:[(0,r.jsx)("div",{className:"flex items-center gap-1",children:(0,r.jsxs)("div",{className:"flex items-center p-1 bg-[#1C1C1E] rounded-xl border border-white/5 h-[42px]",children:[(0,r.jsx)(L.s,{value:Y,onChange:q,"aria-label":"ì¶ê²° 보기 ë°©ì",className:"h-full",itemClassName:"px-3 h-full rounded-lg attendance-mode-toggle",activeItemClassName:"text-black dark:text-white",inactiveItemClassName:"text-[#8E8E93] hover:text-white",indicatorClassName:"bg-[#EEEEE8] dark:bg-[#333335] shadow-sm",options:[{key:"calendar",label:(0,r.jsx)(p.Z,{size:16}),title:"ë¬ë ¥ 보기",ariaLabel:"ë¬ë ¥ 보기"},{key:"table",label:(0,r.jsx)(f.Z,{size:16}),title:"í 보기",ariaLabel:"í 보기"}]}),(0,r.jsx)("div",{className:"w-px h-6 bg-white/10 mx-1"}),[{key:"all",label:"ì ì²´"},{key:"thisMonth",label:"ì´ë²ë¬"},{key:"lastMonth",label:"ì§ëë¬"}].map(e=>(0,r.jsx)("button",{onClick:()=>"calendar"!==Y&&H(e.key),disabled:"calendar"===Y,className:(0,w.cn)("px-4 md:px-2.5 py-2 rounded-lg text-sm transition attendance-time-filter-btn whitespace-nowrap shrink-0","calendar"===Y?"opacity-30 text-[#8E8E93]":K===e.ke
1y?"text-white font-bold":"text-[#8E8E93] font-medium hover:text-white"),children:e.label},e.key))]})}),(0,r.jsxs)("div",{className:"hidden md:flex flex-[1_1_180px] min-w-[160px] h-[42px] items-center gap-2 px-3 rounded-xl border border-[var(--border-light-subtle,#E5E4E0)] dark:border-white/10 bg-[var(--bg-light-secondary,#f8f8f5)] dark:bg-[#1C1C1E] focus-within:bg-white dark:focus-within:bg-[#1C1C1E] focus-within:border-zinc-400 dark:focus-within:border-zinc-500 transition-colors",children:[(0,r.jsx)(b.Z,{size:16,className:"shrink-0 text-zinc-400","aria-hidden":"true"}),(0,r.jsx)("input",{type:"text","aria-label":"ì¶ê²° ê²ì",placeholder:"ì´ë¦\xb7ì í ê²ì",value:en,onChange:e=>er(e.target.value),onKeyDown:e=>{"Escape"===e.key&&er("")},className:"w-full min-w-0 h-full bg-transparent outline-none text-sm text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"}),en&&(0,r.jsx)("button",{type:"button","aria-label":"ê²ìì´ ì§ì°ê¸°",onClick:()=>er(""),className:"shrink-0 p-1 rounded text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200 focus-visible:outline focus-visible:outline-2",children:(0,r.jsx)(g.Z,{size:16})})]}),("table"===Y||"calendar"===Y)&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-3 shrink-0",children:[(0,r.jsx)(L.s,{value:J,onChange:et,"aria-label":"ì¶ê²° ì í íí°",className:"gap-0.5 bg-[#1C1C1E] rounded-xl border border-white/5 p-1 h-[42px]",itemClassName:"gap-1.5 px-2.5 h-full rounded-lg",inactiveItemClassName:"hover:bg-white/5",indicatorClassName:"bg-[#EEEEE8] dark:bg-white/10 shadow-sm",options:[{key:"all",label:"ì ì²´",value:e9.total},{key:"ê²°ì",label:"ê²°ì",value:e9.absent},{key:"ì§ê°",label:"ì§ê°",value:e9.late},{key:"ì¡°í´",label:"ì¡°í´",value:e9.earlyLeave},{key:"ê²°ê³¼",label:"ê²°ê³¼",value:e9.missing}].map(e=>({key:e.key,label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:(0,w.cn)("text-xs font-medium whitespace-nowrap",J===e.key?"text-black dark:text-[#E0E0E0]":"text-[#E0E0E0]"),children:e.label}),(0,r.jsx)("span",{className:(0,w.cn)("text-sm font-bold tabular-nums",0===e.value?"text-zinc-400 dark:text-[#5C5C5E]":"text-zinc-900 dark:text-white"),children:e.value})]})}))}),P&&(0,r.jsxs)("button",{onClick:()=>{U?window.dispatchEvent(new CustomEvent("open-login-modal")):eo(!0)},className:"flex items-center gap-2 px-3 h-[42px] bg-[#1C1C1E] text-white border border-white/10 rounded-xl font-medium text-sm hover:bg-white/5 active:scale-[0.98] transition",title:"naemo ì¶ê²° ë°ì´í°ë¥¼ NEISì ìë ì
ë ¥",children:[(0,r.jsx)(o.default,{src:"/icons/wired-outline-3181-magician-wand.svg",alt:"",width:18,height:18,className:"shrink-0 dark:invert",unoptimized:!0}),"NEIS ìëì
ë ¥"]}),(0,r.jsx)("button",{"aria-label":"ì¶ê²° ê¸°ë¡ ì¶ê°",onClick:"calendar"===Y?()=>eK(eI(),!0):()=>{er(""),ez()},className:"flex items-center gap-2 px-4 h-[42px] bg-white text-black rounded-xl font-semibold text-sm hover:bg-white/90 active:scale-[0.98] transition shadow-lg shadow-white/5 attendance-table-add-btn",children:(0,r.jsx)(h.Z,{size:16,strokeWidth:2.5})})]})]}),(0,r.jsx)("div",{className:(0,w.cn)("flex-1","calendar"!==Y&&"rounded-2xl bg-[#F8F8F5] dark:bg-[#1C1C1E] border border-zinc-200 dark:border-white/5 overflow-hidden"),children:"calendar"===Y?(0,r.jsx)(eU,{records:e2,filter:K,onOpenModal:eK,onMoveRecord:eH,onDeleteRecord:eV,onViewDateChange:G}):en.trim()&&0===e6.length&&!eh?(0,r.jsx)("div",{className:"h-full flex items-center justify-center p-8",role:"status",children:(0,r.jsx)(eD.Z,{size:"lg",title:"ê²ì ê²°ê³¼ê° ììµëë¤",description:"ê²ìì´ë 기ê°\xb7ì í íí°ë¥¼ ë°ê¿ ë³´ì¸ì."})}):0!==e1.length||eh?(0,r.jsxs)("div",{className:"h-full overflow-y-auto custom-scrollbar",children:[(0,r.jsxs)("div",{className:"sticky top-0 grid grid-cols-[1fr_1fr_1fr_1fr_0.5fr_1fr_40px_40px] gap-4 px-5 py-3 bg-[#F8F8F5] dark:bg-[#1C1C1E] border-b border-zinc-200 dark:border-white/5 text-xs text-zinc-500 dark:text-[#8E8E93] font-medium uppercase tracking-wider text-center z-10",children:[(0,r.jsx)("div",{children:"ë ì§"}),(0,r.jsxs)("div",{className:"relative flex items-center justify-center",children:[(0,r.jsx)("span",{children:"ì´ë¦"}),(0,r.jsx)("button",{type:"button",onClick:()=>ei(e=>!e),title:ea?"ì´ë¦ ì¤ë¦ì°¨ì ì ë ¬ í´ì ":"ì´ë¦ ì¤ë¦ì°¨ì(ã±ã´ã·) ì ë ¬","aria-pressed":ea,className:(0,w.cn)("absolute right-0 p-0.5 rounded transition-colors",ea?"text-red-500 dark:text-red-400":"text-zinc-400 dark:text-[#6E6E73] hover:text-zinc-600 dark:hover:text-zinc-300"),children:(0,r.jsx)(v.Z,{className:"w-3.5 h-3.5"})})]}),(0,r.jsx)("div",{children:"구ë¶"}),(0,r.jsx)("div",{children:"ì í"}),(0,r.jsx)("div",{children:"êµì"}),(0,r.jsx)("div",{children:"ì¬ì "}),(0,r.jsx)("div",{children:"ì
ë ¥"}),(0,r.jsx)("div",{})]}),(0,r.jsx)("div",{children:(t="",e6.map((e,n)=>{var a;let i=ea?e.studentName:e.date,s=i!==t;return t=i,(0,r.jsxs)("div",{className:(0,w.cn)("grid grid-cols-[1fr_1fr_1fr_1fr_0.5fr_1fr_40px_40px] gap-4 px-5 py-2.5 items-center transition-colors group text-center","bg-[#f8f8f5] dark:bg-transparent border-t",0===n?"border-transparent":"border-zinc-100 dark:border-white/5"),children:[(0,r.jsx)("div",{className:(0,w.cn)("transition",!ea&&!s&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:(0,r.jsx)(I.h,{value:e.date,onChange:t=>eF(e.id,"date",t),endDate:e.endDate,onEndDateChange:t=>eF(e.id,"endDate",t),className:"py-1"})}),(0,r.jsx)("div",{className:(0,w.cn)("h-[28px] flex items-center rounded-lg transition hover:bg-black/[0.03] dark:hover:bg-white/5 focus-within:bg-black/[0.03] dark:focus-within:bg-white/5",ea&&!s&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:(0,r.jsx)(A,{value:e.studentName,studentId:e.studentId,onChange:t=>eF(e.id,"studentName",t),onSelect:(t,n)=>eR(e.id,t,n),className:"px-2 !text-zinc-900 dark:!text-white"})}),(0,r.jsx)(M,{value:e.reason,options:eY,onChange:t=>eF(e.id,"reason",t),className:"attendance-table-pill"}),(0,r.jsx)(M,{value:e.type,options:eq,onChange:t=>{var n;let r={type:t};"ê²°ì"===t?r.period=null:("ì§ê°"===t||"ì¡°í´"===t)&&(null===(n=e.period)||void 0===n?void 0:n.includes(","))&&(r.period=e.period.split(",")[0]),eE(e.id,r)},className:"attendance-table-pill"}),(0,r.jsx)("div",{className:(0,w.cn)("h-[28px] flex items-center rounded-lg transition-colors","ê²°ì"===e.type?"opacity-40":"hover:bg-black/[0.03] dark:hover:bg-white/5 focus-within:bg-black/[0.03] dark:focus-within:bg-white/5"),children:(0,r.jsx)(R,{value:null!==(a=e.period)&&void 0!==a?a:null,onChange:t=>eF(e.id,"period",t),multi:"ê²°ê³¼"===e.type,disabled:"ê²°ì"===e.type,className:(0,w.cn)("px-2 !text-zinc-900 dark:!text-white","placeholder:text-transparent group-hover:placeholder:text-zinc-400 focus:placeholder:text-zinc-400 dark:group-hover:placeholder:text-[#5C5C5E] dark:focus:placeholder:text-[#5C5C5E] attendance-cell-input")})}),(0,r.jsx)("input",{type:"text",value:e.details,onChange:t=>eF(e.id,"details",t.target.value),placeholder:"ë´ì© ì
ë ¥",className:"bg-transparent text-sm text-zinc-900 dark:text-white placeholder:text-transparent group-hover:placeholder:text-zinc-400 focus:placeholder:text-zinc-400 dark:group-hover:placeholder:text-[#5C5C5E] dark:focus:placeholder:text-[#5C5C5E] focu
1s:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 w-full px-2 py-1 rounded-lg hover:bg-black/[0.03] dark:hover:bg-white/5 focus:bg-black/[0.03] dark:focus:bg-white/5 transition-colors text-center attendance-detail-input attendance-cell-input"}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)("input",{type:"checkbox",checked:e.submitted,onChange:t=>eF(e.id,"submitted",t.target.checked),className:"w-4 h-4 accent-[#3b82f6] cursor-pointer"})}),(0,r.jsx)("button",{"aria-label":"ìì ",onClick:()=>void eV(e.id).catch(()=>F("ì¶ê²°ì ìì íì§ ëª»íì´ì. ë¤ì ìëí´ ì£¼ì¸ì.","error")),className:"opacity-0 group-hover:opacity-100 p-1.5 rounded-lg text-[#5C5C5E] hover:text-red-500 transition flex items-center justify-center",children:(0,r.jsx)(m.Z,{size:14})})]},e.uniqueKey)}))})]}):(0,r.jsx)("div",{className:"h-full flex items-center justify-center p-8",children:(0,r.jsx)(eD.Z,{size:"lg",title:"ì¶ê²° 기ë¡ì´ ììµëë¤",description:"'ì¶ê²° ì¶ê°' ë²í¼ì ëë¬ ì ì¶ê²° ë³ë ë´ìì ë±ë¡íì¸ì.",action:(0,r.jsxs)("button",{onClick:()=>eK(eI(),!0),className:"px-5 py-2.5 bg-zinc-900 hover:bg-black dark:bg-white dark:hover:bg-zinc-100 text-white dark:text-zinc-900 rounded-xl text-sm font-semibold transition-all shadow-sm active:scale-95 flex items-center gap-1.5",children:[(0,r.jsx)(h.Z,{size:16}),"ì¶ê²° ì¶ê°í기"]})})})}),es&&(0,r.jsx)(T,{isOpen:es,onClose:()=>el(!1),onSave:eX,onDelete:eV,initialDate:ec,existingRecords:ec?V.filter(e=>e.date===ec||e.endDate&&e.date<=ec&&e.endDate>=ec):[],autoAddRow:ex}),P&&ed&&(0,r.jsx)($,{isOpen:ed,onClose:()=>eo(!1),onSynced:eG,defaultStart:eL(0).start,defaultEnd:eL(0).end})]})}},46173:function(e,t,n){n.d(t,{OL:function(){return r},on:function(){return d}});let r=["ì¡°í","1êµì","2êµì","3êµì","4êµì","5êµì","6êµì","7êµì","ì¢
ë¡"],a={fg:"#5B429E",darkFg:"#B29FEA"},i={ê²°ì:{fg:"#C40000",darkFg:"#FF5A5A"},ì¡°í´:a,ì§ê°:a,ê²°ê³¼:a},s={fg:"#52525B",darkFg:"#A1A1AA"},l={ì§ë³:s,ì¸ì :s,미ì¸ì :s,기í:s},d=e=>{var t;return null!==(t=i[e])&&void 0!==t?t:l[e]}},13376:function(e,t,n){n.d(t,{dp:function(){return a}});let r=[];function a(e){e&&(r.push(e),r.length>100&&r.shift())}},25450:function(e,t,n){n.d(t,{Fk:function(){return a}});var r=n(93448);function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return(0,r.cn)("inline-flex items-center justify-center h-8 px-3 rounded-full text-[13px] transition active:scale-[0.96]",e?"bg-white dark:bg-[#1C1C1E] text-zinc-900 dark:text-zinc-100 font-semibold border border-zinc-200/90 dark:border-white/[0.12] shadow-[0_1px_2px_rgba(0,0,0,0.04)]":"bg-zinc-100/80 dark:bg-zinc-800/60 text-zinc-500 dark:text-zinc-400 font-medium border border-transparent",...n)}}}]);
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.