PageSourceSearch

https://naemo.ai/_next/static/chunks/2952.3f74b7dcae916ff4.js

js naemo.ai collected 2026-10-02 01:14:15 UTC 42,542 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2952],{42952:function(e,t,n){n.r(t),n.d(t,{default:function(){return ea}});var a=n(57437),r=n(90982),l=n(30419),s=n(78529),i=n(28691),o=n(36013),d=n(98319),c=n(10136),u=n(2265),x=n(92451),m=n(10407),h=n(32489),f=n(18930),p=n(99397),g=n(93448),b=n(83008),v=n(67920),w=n(54887),j=n(54696),y=n(96214),D=n(4908),k=n(54292),E=n(65696),N=n(63070),C=n(86035),z=n(27742),S=n(54886),M=n(56942),A=n(60936),F=n(31667),T=n(35902),L=n(31091),W=n(72578),G=n(31047),O=n(35596),R=n(26710),_=n(33145),Z=n(17790),B=n(86407),I=n.n(B);function U(e){var t,n,r,l,s,i,o;let{onOpenAcademicScheduleImport:d,isGuest:c=!1,iconOnly:x=!1}=e,m=(0,u.useRef)(null),h=(0,u.useRef)(null),f=(0,u.useRef)("first"),[p,g]=(0,u.useState)(!1),[b,v]=(0,u.useState)({top:0,left:0}),j=(0,u.useId)(),y=(0,Z.s)(m,!c),D=!c&&(null===(t=y.status)||void 0===t?void 0:t.enabled)!==!1,k=!!d||D,E=y.error||(null===(r=y.status)||void 0===r?void 0:null===(n=r.connection)||void 0===n?void 0:n.status)==="PAUSED"||(null===(s=y.status)||void 0===s?void 0:null===(l=s.connection)||void 0===l?void 0:l.errorCode)||(null===(i=y.status)||void 0===i?void 0:i.issues.length)?"Google Calendar 연결 확인":(null===(o=y.status)||void 0===o?void 0:o.connection)?"Google Calendar 연결 관리":"Google Calendar 연결";(0,u.useLayoutEffect)(()=>{var e;if(!p||!k)return;let t=m.current,n=h.current;if(!t||!n)return;let a=t.getBoundingClientRect(),r=n.getBoundingClientRect();v({left:Math.max(8,Math.min(a.right-r.width,window.innerWidth-r.width-8)),top:Math.max(8,a.bottom+6+r.height<=window.innerHeight-8?a.bottom+6:a.top-r.height-6)});let l=n.querySelectorAll('[role="menuitem"]');null===(e="last"===f.current?l[l.length-1]:l[0])||void 0===e||e.focus()},[p,k,D]),(0,u.useEffect)(()=>{if(!p)return;let e=e=>{var t,n;let a=e.target;(null===(t=m.current)||void 0===t?void 0:t.contains(a))||(null===(n=h.current)||void 0===n?void 0:n.contains(a))||g(!1)},t=()=>g(!1);return document.addEventListener("pointerdown",e),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{document.removeEventListener("pointerdown",e),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[p]),(0,u.useEffect)(()=>{y.open&&g(!1)},[y.open]);let N=e=>{var t;g(!1),null===(t=m.current)||void 0===t||t.focus(),e()};return k?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{ref:m,id:"".concat(j,"-trigger"),type:"button",className:"".concat(I().trigger," ").concat(x?I().iconOnly:""),"aria-label":"연동하기",title:x?"연동하기":void 0,"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?j:void 0,onClick:()=>{f.current="first",g(e=>!e)},onKeyDown:e=>{("ArrowDown"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),f.current="ArrowUp"===e.key?"last":"first",g(!0))},children:[x?(0,a.jsx)("svg",{className:I().plugIcon,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.25 1a.75.75 0 0 1 .75.75V6h2.25a.75.75 0 0 1 .75.75v6.5A4.75 4.75 0 0 1 14.25 18h-1.5v4.25a.75.75 0 0 1-1.5 0V18h-1.5A4.75 4.75 0 0 1 5 13.25v-6.5A.75.75 0 0 1 5.75 6H8V1.75a.75.75 0 0 1 1.5 0V6h5V1.75a.75.75 0 0 1 .75-.75M6.5 13.25a3.25 3.25 0 0 0 3.25 3.25h4.5a3.25 3.25 0 0 0 3.25-3.25V7.5h-11z",clipRule:"evenodd"})}):(0,a.jsx)("svg",{className:I().plugIcon,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{fill:"currentColor",d:"M20.25 11.5a.75.75 0 0 1 .75.75V14a4.75 4.75 0 0 1-4.75 4.75H5.66l2.1 1.95a.751.751 0 0 1-1.02 1.1l-3.5-3.25-.013-.013-.017-.018a1 1 0 0 1-.078-.095l-.01-.016a1 1 0 0 1-.062-.114l-.004-.012a.75.75 0 0 1 0-.566l.004-.011a1 1 0 0 1 .061-.114l.01-.016a1 1 0 0 1 .082-.098l.007-.008.02-.02 3.5-3.25a.751.751 0 0 1 1.02 1.1l-2.1 1.95h10.59A3.25 3.25 0 0 0 19.5 14v-1.75a.75.75 0 0 1 .75-.75m-4.547-9.263a.75.75 0 0 1 1.06-.034l4 3.75.01.01.016.017a1 1 0 0 1 .074.089l.01.012.006.013c.077.12.12.26.121.406a.75.75 0 0 1-.12.402l-.015.024a1 1 0 0 1-.097.114l-.005.006-4 3.75a.75.75 0 1 1-1.026-1.093l2.617-2.453H7.75A3.25 3.25 0 0 0 4.5 10.5v1.75a.75.75 0 0 1-1.5 0V10.5a4.75 4.75 0 0 1 4.75-4.75h10.604l-2.617-2.454a.75.75 0 0 1-.034-1.06"})}),!x&&(0,a.jsx)("span",{children:"연동하기"})]}),p&&(0,w.createPortal)((0,a.jsxs)("div",{ref:h,id:j,role:"menu","aria-labelledby":"".concat(j,"-trigger"),className:I().menu,style:b,onKeyDown:e=>{var t,n,a,r;if("Escape"===e.key||"Tab"===e.key){"Escape"===e.key&&e.preventDefault(),g(!1),null===(a=m.current)||void 0===a||a.focus();return}
1if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;e.preventDefault();let l=Array.from(null!==(r=null===(t=h.current)||void 0===t?void 0:t.querySelectorAll('[role="menuitem"]'))&&void 0!==r?r:[]),s=l.indexOf(document.activeElement),i="Home"===e.key?0:"End"===e.key?l.length-1:(s+("ArrowDown"===e.key?1:-1)+l.length)%l.length;null===(n=l[i])||void 0===n||n.focus()},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||g(!1)},children:[d&&(0,a.jsxs)("button",{type:"button",role:"menuitem",tabIndex:-1,className:I().item,onClick:()=>N(d),children:[(0,a.jsx)(_.default,{className:I().menuIcon,src:"/icons/calendar/wired-lineal-486-school.svg",width:24,height:24,alt:"","aria-hidden":"true"}),"우리학교 학사일정 가져오기"]}),D&&(0,a.jsxs)("button",{type:"button",role:"menuitem",tabIndex:-1,className:I().item,onClick:()=>N(()=>y.setOpen(!0)),children:[(0,a.jsx)(_.default,{className:I().menuIcon,src:"/icons/calendar/wired-lineal-2557-logo-google.svg",width:24,height:24,alt:"","aria-hidden":"true"}),E]})]}),document.body),y.open&&(0,a.jsx)(Z.G,{onClose:y.close})]}):null}let Y={gray:"bg-[#EDEDED] dark:bg-zinc-500 border-zinc-200/50 dark:border-white/10",green:"bg-[#D1EBDD] dark:bg-emerald-600 border-emerald-200/50 dark:border-emerald-500/20",red:"bg-[#F2DCDC] dark:bg-rose-600 border-rose-200/50 dark:border-rose-500/20"},V={gray:"from-transparent to-[#EDEDED] dark:to-zinc-500",green:"from-transparent to-[#D1EBDD] dark:to-emerald-600",red:"from-transparent to-[#F2DCDC] dark:to-rose-600"},P={gray:"bg-[#8E8E93]",green:"bg-green-500",red:"bg-red-500"};function X(e){let{isGuest:t=!1,events:n,onCreateEvent:r,onSaveEvent:l,onDeleteEvent:s,onOpenAcademicScheduleImport:i}=e,[d,c]=(0,u.useState)(()=>t?(0,o.o)():new Date);(0,u.useEffect)(()=>{t&&c((0,o.o)())},[t]);let[h,f]=(0,u.useState)(null),[b,v]=(0,u.useState)("list"),[w,j]=(0,u.useState)(null),[y,D]=(0,u.useState)(""),[k,_]=(0,u.useState)("gray"),[Z,B]=(0,u.useState)(""),[I,X]=(0,u.useState)(void 0),H=(0,u.useMemo)(()=>{let e=(0,E.z)((0,N.N)(d),{weekStartsOn:0}),t=(0,C.v)((0,z.V)(d),{weekStartsOn:0});return(0,S.D)({start:e,end:t})},[d]),K=(0,u.useMemo)(()=>{let e={};return n.forEach(t=>{if(!t.date)return;let n=(0,M.b)((0,A.D)(t.date)),a=t.endDate?(0,M.b)((0,A.D)(t.endDate)):n,r=a<n?n:a;(0,S.D)({start:n,end:r}).forEach(n=>{let a=(0,F.WU)(n,"yyyy-MM-dd");e[a]||(e[a]=[]),e[a].push(t)})}),e},[n]),q=(0,u.useMemo)(()=>{let e=[];for(let t=0;t<H.length;t+=7){let n=H.slice(t,t+7),a=n.map(e=>(0,F.WU)(e,"yyyy-MM-dd"));e.push({days:n,dates:a,...function(e,t){let n=new Map;e.forEach((e,a)=>{(t[e]||[]).forEach(e=>{let t=n.get(e.id);t?t.endCol=a:n.set(e.id,{event:e,startCol:a,endCol:a})})});let a=Array.from(n.values()).sort((e,t)=>{let n=Number(!!e.event.endDate&&e.event.endDate>e.event.date);return Number(!!t.event.endDate&&t.event.endDate>t.event.date)-n||e.startCol-t.startCol||t.endCol-t.startCol-(e.endCol-e.startCol)}),r=[],l=e.map(()=>0);return{events:a.map(e=>{let t=(1<<e.endCol-e.startCol+1)-1<<e.startCol,n=0;for(;(r[n]||0)&t;)n++;if(r[n]=(r[n]||0)|t,n>=4)for(let t=e.startCol;t<=e.endCol;t++)l[t]++;return{...e,row:n}}),hiddenCounts:l}}(a,K)})}return e},[H,K]),Q=h&&K[h]||[],J=e=>{f(e),v("list")},$=(e,t)=>{e?(j(e.id),D(e.title),_(e.tag),B(e.date),X(e.endDate)):(j(null),D(""),_("gray"),B(t),X(void 0)),v("form")},ee=async()=>{let e=y.trim();if(!e||!Z)return;let t=Z,n=I;if(n&&n<t&&([t,n]=[n,t]),w){if(await l(w,e,k,t,n)===!1)return}else r(t,e,k,n);v("list")},et=t?o.b:(0,F.WU)(new Date,"yyyy-MM-dd");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col h-full bg-[#FBFBF9] dark:bg-[#111] overflow-hidden select-none mobile-safe-pad-bottom",children:[(0,a.jsxs)("header",{className:"shrink-0 z-40 bg-white/80 dark:bg-[#111]/80 backdrop-blur-lg border-b border-zinc-100/30 dark:border-white/5 h-14 flex items-center justify-between px-4",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1 group",children:[(0,a.jsx)("button",{"aria-label":"이전 달",onClick:()=>c((0,T.W)(d,1)),className:"p-2 -ml-2 rounded-xl text-zinc-400 active:bg-zinc-100 dark:active:bg-white/5 transition-colors",children:(0,a.jsx)(x.Z,{size:18,strokeWidth:2.5})}),(0,a.jsx)("h1",{className:"whitespace-nowrap text-[17px] font-bold text-zinc-900 dark:text-white px-1",children:(0,F.WU)(d,"yyyy년 M월")}),(0,a.jsx)("button",{"aria-label":"다음 달",onClick:()=>c((0,L.z)(d,1)),className:"p-2 rounded-xl text-zinc-400 active:bg-zinc-100 dark:active:bg-white/5 transition-colors",children:(0,a.jsx)(m.Z,{size:18,strokeWidth:2.5})})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,a.jsx)(U,{iconOnly:!0,isGuest:t,onOpenAcademicScheduleImport:i}
1),(0,a.jsxs)("button",{onClick:()=>{f(et),$(null,et)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-[#EDEDED] dark:bg-white text-black active:scale-95 transition",children:[(0,a.jsx)(p.Z,{size:16,strokeWidth:2}),(0,a.jsx)("span",{className:"text-[13px] font-medium text-zinc-800 dark:text-black",children:"추가"})]})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-7 border-b border-zinc-100/30 dark:border-white/5 bg-white/50 dark:bg-white/[0.01] px-3",children:["일","월","화","수","목","금","토"].map((e,t)=>(0,a.jsx)("div",{className:(0,g.cn)("py-2 text-center text-[10px] font-bold tracking-tighter uppercase",0===t?"text-rose-500/80":6===t?"text-blue-500/80":"text-zinc-400"),children:e},e))}),(0,a.jsx)("div",{className:"flex-1 min-h-0 grid overflow-hidden border-b border-zinc-100/30 dark:border-white/5 px-3 bg-white dark:bg-[#111]",style:{gridTemplateRows:"repeat(".concat(q.length,", minmax(0, 1fr))")},children:q.map(e=>(0,a.jsxs)("div",{className:"relative grid grid-cols-7 min-h-0 overflow-hidden",children:[e.days.map((t,n)=>{let r=e.dates[n],l=(0,F.WU)(t,"yyyy-MM-dd")===et,s=t.getMonth()===d.getMonth();return(0,a.jsx)("button",{type:"button","aria-label":"".concat((0,F.WU)(t,"yyyy년 M월 d일")," 일정 ").concat((K[r]||[]).length,"개"),onClick:()=>J(r),onContextMenu:e=>e.preventDefault(),className:(0,g.cn)("relative flex flex-col border-r border-b border-zinc-100/30 dark:border-white/5 p-0.5 min-h-0 overflow-hidden transition-colors active:bg-zinc-50 dark:active:bg-white/[0.02]",!s&&"bg-zinc-50/50 dark:bg-black/20 opacity-30",l&&"bg-blue-50/20 dark:bg-blue-500/[0.04]"),children:(0,a.jsx)("span",{className:(0,g.cn)("text-[10px] font-bold ml-0.5 mt-0.5 w-4 h-4 flex items-center justify-center rounded-full",l&&"today-indicator",l?"bg-blue-500 text-white":0===t.getDay()?"text-rose-500/80":6===t.getDay()?"text-blue-500/80":"text-zinc-500"),children:(0,F.WU)(t,"d")})},r)}),(0,a.jsxs)("div",{"aria-hidden":"true",className:"absolute inset-x-0 top-6 grid grid-cols-7 auto-rows-[15px] gap-y-0.5 pointer-events-none",children:[e.events.filter(e=>e.row<4).map(t=>{let{event:n,startCol:r,endCol:l,row:s}=t;return(0,a.jsxs)("div",{style:{gridColumn:"".concat(r+1," / ").concat(l+2),gridRow:s+1},className:(0,g.cn)("relative min-w-0 mx-0.5 h-[15px] rounded-[4px] px-1 text-left flex items-center overflow-hidden border-[0.5px]",Y[n.tag],"text-zinc-700 dark:text-white",n.date<e.dates[0]&&"rounded-l-none ml-0",n.endDate&&n.endDate>e.dates[6]&&"rounded-r-none mr-0",e.days[l]<(0,N.N)(d)&&"opacity-30",e.days[r]>(0,z.V)(d)&&"opacity-30"),children:[(0,a.jsx)("span",{className:"text-[9px] font-bold leading-none whitespace-nowrap overflow-hidden",children:n.title}),(0,a.jsx)("div",{className:(0,g.cn)("absolute inset-y-0 right-0 w-4 pointer-events-none bg-gradient-to-r",V[n.tag])})]},n.id)}),e.hiddenCounts.map((t,n)=>t>0&&(0,a.jsxs)("div",{style:{gridColumn:n+1,gridRow:5},className:"text-[8px] font-bold text-zinc-400 dark:text-zinc-500 ml-1 leading-none",children:["+ ",t]},e.dates[n]))]})]},e.dates[0]))})]}),(0,a.jsx)(O.Z,{isOpen:!!h,onClose:()=>{f(null),v("list")},footer:"form"===b?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[w&&(0,a.jsx)("button",{onClick:()=>{w&&s(w),v("list")},className:"px-4 py-3 rounded-xl text-sm 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,a.jsx)("button",{onClick:ee,disabled:!y.trim(),className:(0,g.cn)("flex-1 py-3 rounded-xl text-sm font-bold transition active:scale-[0.98]",y.trim()?"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 cursor-not-allowed"),children:"저장"})]}):void 0,children:"list"===b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{className:"text-[16px] font-bold text-zinc-900 dark:text-zinc-100 mb-3",children:h?(0,F.WU)((0,A.D)(h),"M월 d일 (EEE)",{locale:W.ko}):""}),0===Q.length?(0,a.jsx)("p",{className:"text-center text-zinc-400 dark:text-zinc-500 text-sm py-8",children:"일정이 없습니다"}):(0,a.jsx)("div",{className:"flex flex-col gap-1.5",children:Q.map(e=>(0,a.jsxs)("button",{onClick:()=>$(e,h),className:"w-full flex items-center gap-2.5 px-3 py-3 rounded-xl bg-zinc-50 dark:bg-zinc-800 active:bg-zinc-100 dark:active:bg-zinc-700 text-left transition-colors",children:[(0,a.jsx)("span",{className:(0,g.cn)("w-2.5 h-2.5 rounded-full shrink-0 border",Y[e.tag])}),(0,a.jsx)("span",{className:"flex-1 text-[14px] font-medium text-zinc-800 dark:text-zinc-200 truncate",children:e.title}),(0,a.jsx)(m.Z,{size:16,className:"text-zinc-300 dark:text-zinc-500 shrink-0"})]},e.id))}),(0,a.jsxs)("button",{onClick:()=>$(null,h),className:"mobile-sheet-primary w-full mt-3 mb-4 flex items-center justify-center gap-1.5 py-3.5 rounded-xl bg-zinc-900 text-white dark:bg-white dark:text-zinc-900 text-[15px] font-semibold active:scale-[0.98] transition-transform",children:[(0,a.jsx)(p.Z,{size:16})," 일정 추가"]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 mb-4",children:[(0,a.jsx)("button",{onClick:()=>v("list"),className:"-ml-1.5 p-1.5 rounded-lg text-zinc-500 dark:text-zinc-400 active:bg-zinc-100 dark:active:bg-zinc-800 transition-colors","aria-label":"뒤로",children:(0,a.jsx)(x.Z,{size:20})}),(0,a.jsx)("h3",{className:"text-[16px] font-bold text-zinc-900 dark:text-zinc-100",children:w?"일정 수정":"일정 추가"})]}),(0,a.jsx)("label",{className:"block text-xs text-zinc-400 dark:text-zinc-500 mb-2",children:"태그"}),(0,a.jsx)("div",{className:"flex items-center gap-3 mb-4",children:["gray","green","red"].map(e=>(0,a.jsx)("button",{onClick:()=>_(e),className:(0,g.cn)("w-8 h-8 rounded-full flex items-center justify-center border-2 transition",k===e?"border-zinc-800 dark:border-white scale-110":"border-transparent opacity-60 active:opacity-100"),children:(0,a.jsx)("span",{className:(0,g.cn)("w-4 h-4 rounded-full",P[e])})},e))}),(0,a.jsx)("label",{className:"block text-xs text-zinc-400 dark:text-zinc-500 mb-2",children:"내용"}),(0,a.jsx)("input",{type:"text",value:y,onChange:e=>D(e.target.value),placeholder:"일정 내용 입력...",autoFocus:!0,className:"w-full px-3.5 h-[46px] bg-zinc-100 dark:bg-zinc-800 rounded-xl text-zinc-900 dark:text-zinc-100 text-[16px] placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 mb-4"}),(0,a.jsx)("label",{className:"block text-xs text-zinc-400 dark:text-zinc-500 mb-2",children:"날짜"}),(0,a.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,a.jsx)(G.Z,{size:15,className:"text-zinc-400 dark:text-zinc-500 shrink-0 mr-1"}),(0,a.jsx)(R.h,{overlay:!0,value:Z,onChange:e=>{B(e),I&&I<e&&X(void 0)},endDate:I,onEndDateChange:e=>X(e||void 0),className:"text-[15px] font-medium text-left w-full py-2.5 text-zinc-800 dark:text-zinc-100"})]}),(0,a.jsx)("div",{className:"mb-2"})]})})]})}var H=n(67650),K=n(33098);let q={gray:"bg-[#8E8E93]",green:"bg-green-500",red:"bg-red-500"},Q=e=>{let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(a)},J=e=>{if(!e)return"";let t=new Date(e);return isNaN(t.getTime())?"":"".concat(t.getMonth()+1,"월 ").concat(t.getDate(),"일")},$=e=>{let{value:t,onChange:n,endDate:r,onEndDateChange:l,className:s}=e,[i,o]=(0,u.useState)(!1),[d,c]=(0,u.useState)(()=>{let e=new Date(t);return isNaN(e.getTime())?new Date:e}),[h,f]=(0,u.useState)(!!r),[p,b]=(0,u.useState)(!1),[v,j]=(0,u.useState)(null),y=(0,u.useRef)(null),D=(0,u.useRef)(null);(0,u.useEffect)(()=>{let e=e=>{var t,n;let a=e.target,r=null===(t=y.current)||void 0===t?void 0:t.contains(a),l=null===(n=D.current)||void 0===n?void 0:n.contains(a);r||l||o(!1)},t=()=>o(!1);return i&&(window.addEventListener("mouseup",e),window.addEventListener("scroll",t,{capture:!0})),()=>{window.removeEventListener("mouseup",e),window.removeEventListener("scroll",t,{capture:!0})}},[i]),(0,u.useEffect)(()=>{f(!!r)},[r]),(0,u.useEffect)(()=>
1{if(i&&y.current){let e=y.current.getBoundingClientRect();j({top:e.bottom+window.scrollY+4,left:e.left+window.scrollX+e.width/2})}},[i]);let k=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),E=new Date(d.getFullYear(),d.getMonth(),1).getDay(),N=Array.from({length:k},(e,t)=>t+1),C=Array.from({length:E},(e,t)=>null),z=e=>{let t=new Date(d);t.setMonth(t.getMonth()+e),c(t)},S=e=>{let a=Q(new Date(d.getFullYear(),d.getMonth(),e));h&&l?p?(a<t?(l(t),n(a)):l(a),b(!1),o(!1)):(n(a),l(void 0),b(!0)):(n(a),o(!1))},M=e=>{let t=new Date;return d.getFullYear()===t.getFullYear()&&d.getMonth()===t.getMonth()&&e===t.getDate()},A=e=>{if(!h||!r)return!1;let n=Q(new Date(d.getFullYear(),d.getMonth(),e));return n>t&&n<r},F=e=>Q(new Date(d.getFullYear(),d.getMonth(),e))===t,T=e=>!!r&&Q(new Date(d.getFullYear(),d.getMonth(),e))===r,L=r?"".concat(J(t)," ~ ").concat(J(r)):t?J(t):"미정";return(0,a.jsxs)("div",{className:"relative h-full",children:[(0,a.jsx)("button",{ref:y,type:"button",onClick:()=>o(!i),onMouseDown:e=>e.preventDefault(),className:(0,g.cn)("px-3 py-2 bg-[#1C1C1E] rounded-lg text-sm text-white transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",s),children:L}),i&&v&&(0,w.createPortal)((0,a.jsxs)("div",{ref:D,style:{top:v.top,left:v.left},className:"fixed bg-[#1C1C1E] border border-white/10 rounded-2xl shadow-2xl z-[9999] p-4 w-[280px] -translate-x-1/2 animate-in fade-in slide-in-from-top-2 duration-200 calendar-picker-popup",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("button",{"aria-label":"이전 달",type:"button",onClick:()=>z(-1),onMouseDown:e=>e.preventDefault(),className:"p-1.5 hover:bg-white/10 rounded-lg transition-colors",children:(0,a.jsx)(x.Z,{size:16,className:"text-[#8E8E93]"})}),(0,a.jsxs)("span",{className:"text-sm font-semibold text-white",children:[d.getFullYear(),"년 ",d.getMonth()+1,"월"]}),(0,a.jsx)("button",{"aria-label":"다음 달",type:"button",onClick:()=>z(1),onMouseDown:e=>e.preventDefault(),className:"p-1.5 hover:bg-white/10 rounded-lg transition-colors",children:(0,a.jsx)(m.Z,{size:16,className:"text-[#8E8E93]"})})]}),(0,a.jsx)("div",{className:"grid grid-cols-7 gap-1 text-center text-[11px] text-[#8E8E93] mb-2 font-medium",children:["일","월","화","수","목","금","토"].map(e=>(0,a.jsx)("div",{children:e},e))}),(0,a.jsxs)("div",{className:"grid grid-cols-7 gap-1",children:[C.map((e,t)=>(0,a.jsx)("div",{className:"w-8 h-8"},"b-".concat(t))),N.map(e=>{let t=F(e),n=T(e),r=A(e);return(0,a.jsx)("button",{type:"button",onClick:()=>S(e),onMouseDown:e=>e.preventDefault(),className:(0,g.cn)("w-8 h-8 rounded-lg text-xs font-medium transition flex items-center justify-center",t||n||r||M(e)?"":"calendar-date-normal text-white/70 hover:bg-white/10"),children:!M(e)||t||n||r?t||n?(0,a.jsx)("span",{className:"calendar-date-selected w-7 h-7 flex items-center justify-center rounded-md text-xs",children:e}):r?(0,a.jsx)("span",{className:"calendar-date-inrange w-7 h-7 flex items-center justify-center rounded-md text-xs",children:e}):e:(0,a.jsx)("span",{className:"calendar-date-today w-6 h-6 flex items-center justify-center rounded-full text-xs",children:e})},e)})]}),l&&(0,a.jsxs)("div",{className:"mt-[10px] pt-[10px] border-t border-white/10 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-[#8E8E93]","aria-live":"polite",children:h?p?"종료일을 선택하세요":"시작일을 선택하세요":"종료일 설정"}),(0,a.jsx)("button",{type:"button",onClick:()=>{let e=!h;f(e),!e&&l?(l(void 0),b(!1)):e&&b(!r)},onMouseDown:e=>e.preventDefault(),className:(0,g.cn)("w-11 h-6 rounded-full transition-all duration-200 relative calendar-picker-toggle",h?"bg-[#007AFF] dark:bg-[#2883DE]":"bg-[#3A3A3C]"),children:(0,a.jsx)("div",{className:(0,g.cn)("absolute top-1 w-4 h-4 bg-white rounded-full transition-all duration-200 shadow-sm",h?"left-6":"left-1")})})]})]}),document.body)]})},ee=e=>{let{isOpen:t,onClose:n,onSave:r,onDelete:l,initialDate:s,initialTitle:i="",initialTag:o="gray",initialEndDate:d}=e,[c,x]=(0,u.useState)([]),m=(0,u.useRef)(null);(0,u.useEffect)(()=>{t&&(x([{id:Math.random().toString(36).substr(2,9),title:i,tag:o||"gray",date:s,endDate:d}]),setTimeout(()=>{var e;return null===(e=m.current)||void 0===e?void 0:e.focus()},100))},[t,i,o,s,d]);let f=async()=>{let e=c.filter(e=>e.title.trim());e.length>0&&!1!==await r(e.map(e=>
1({title:e.title.trim(),tag:e.tag,date:e.date,endDate:e.endDate})))&&n()},p=e=>{"Enter"===e.key?f():"Escape"===e.key&&n()},b=(e,t,n)=>{x(a=>a.map(a=>a.id===e?{...a,[t]:n}:a))},v=e=>{x(t=>1===t.length?(n(),t):t.filter(t=>t.id!==e))};return t?(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:n,children:(0,a.jsxs)("div",{className:"bg-[#2C2C2E] rounded-2xl pt-5 pb-8 md:pb-8 px-4 md:px-5 w-full max-w-[95vw] md:max-w-[800px] shadow-2xl border border-white/10 max-h-[85vh] md:max-h-[80vh] flex flex-col overflow-hidden animate-in zoom-in-95 duration-200 md:-translate-y-12",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6 shrink-0 md:px-1",children:[(0,a.jsxs)("h3",{className:"text-lg font-bold text-white md:hidden",children:["일정 ",i?"수정":"추가"]}),(0,a.jsx)("button",{type:"button",onClick:n,onMouseDown:e=>e.preventDefault(),className:"md:hidden p-1.5 -mr-1 rounded-lg text-[#8E8E93] active:text-white transition-colors","aria-label":"닫기",children:(0,a.jsx)(h.Z,{size:22})}),(0,a.jsxs)("div",{className:"hidden md:flex items-center md:gap-2 ml-auto",children:[l?(0,a.jsx)("button",{type:"button",onClick:()=>{l(),n()},onMouseDown:e=>e.preventDefault(),className:"px-3 py-2 text-xs font-medium text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded-lg transition-colors",children:"삭제"}):(0,a.jsx)("button",{type:"button",onClick:n,onMouseDown:e=>e.preventDefault(),className:"px-3 py-2 text-xs font-medium text-[#8E8E93] hover:text-white hover:bg-white/10 rounded-lg transition-colors",children:"취소"}),(0,a.jsx)("button",{onClick:f,onMouseDown:e=>e.preventDefault(),disabled:c.some(e=>!e.title),className:"btn-primary-solid px-4 py-2 rounded-xl text-xs font-bold transition whitespace-nowrap event-modal-save-btn",children:"저장"})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto custom-scrollbar flex flex-col gap-6 md:gap-3 pr-1",children:c.map((e,t)=>(0,a.jsxs)("div",{className:"flex flex-col md:flex-row gap-3 items-stretch md:items-end animate-in fade-in slide-in-from-top-2 duration-200 pb-4 md:pb-0 border-b md:border-0 border-white/5 last:border-0",children:[(0,a.jsxs)("div",{className:"shrink-0 flex flex-col",children:[0===t?(0,a.jsx)("label",{className:"block text-xs text-[#8E8E93] mb-2 pl-1",children:"태그"}):(0,a.jsx)("div",{className:"hidden md:block h-[24px]"}),(0,a.jsx)("div",{className:"flex gap-2 items-center h-[38px] pl-1",children:["gray","green","red"].map(t=>(0,a.jsx)("button",{type:"button",onClick:()=>b(e.id,"tag",t),onMouseDown:e=>e.preventDefault(),className:(0,g.cn)("w-7 h-7 md:w-6 md:h-6 rounded-full flex items-center justify-center border-2 transition",e.tag===t?"border-white md:scale-100 scale-110":"border-transparent opacity-60 hover:opacity-100"),children:(0,a.jsx)("span",{className:(0,g.cn)("w-4 h-4 md:w-3 md:h-3 rounded-full",q[t])})},t))})]}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 md:flex-1 md:ml-1",children:[0===t?(0,a.jsx)("label",{className:"block text-xs text-[#8E8E93] mb-2 pl-1",children:"내용"}):(0,a.jsx)("div",{className:"hidden md:block h-[24px]"}),(0,a.jsx)("input",{ref:t===c.length-1?m:null,type:"text",value:e.title,onChange:t=>b(e.id,"title",t.target.value),onKeyDown:p,placeholder:"일정 내용 입력...",className:"w-full px-3.5 py-2 md:px-3 bg-[#1C1C1E] rounded-xl md:rounded-lg text-white text-[16px] md:text-sm placeholder:text-[#5C5C5E] focus:outline-none h-[44px] md:h-[38px] border border-white/5 md:border-transparent focus:border-white/10 transition-colors event-modal-input"})]}),(0,a.jsxs)("div",{className:"w-full md:w-auto md:min-w-[180px] md:flex-none",children:[0===t?(0,a.jsx)("label",{className:"block text-xs text-[#8E8E93] mb-2 pl-1",children:"날짜"}):(0,a.jsx)("div",{className:"hidden md:block h-[24px]"}),(0,a.jsx)("div",{className:"h-[42px] md:h-[38px]",children:(0,a.jsx)($,{value:e.date,onChange:t=>b(e.id,"date",t),endDate:e.endDate,onEndDateChange:t=>b(e.id,"endDate",t),className:"w-full justify-between flex items-center h-full event-modal-date-btn px-4 md:px-3"})})]}),(0,a.jsx)("div",{className:"hidden md:flex shrink-0 justify-end md:ml-auto",children:(0,a.jsx)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),v(e.id)},className:"p-2.5 bg-[#fafaf9] rounded-xl text-[#8E8E93] hover:text-red-400 transition-colors md:p-0 md:bg-[#fafaf9] md:h-[38px] md:w-[38px] md:flex md:items-center md:justify-center md:rounded-lg border-none",title:"삭제",children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-[18px] h-[18px] md:w-4 md:h-4",children:(0,a.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})})]},e.id))}),(0,a.jsxs)("div",{className:"md:hidden flex items-center gap-2 mt-5 shrink-0",children:[l&&(0,a.jsx)("button",{type:"button",onClick:()=>{l(),n()},className:"px-4 py-3 rounded-xl text-sm font-semibold text-red-400 bg-red-500/10 active:bg-red-500/20 transition-colors",children:"삭제"}),(0,a.jsx)("button",{type:"button",onClick:f,disabled:c.some(e=>!e.title),className:"flex-1 py-3 rounded-xl bg-white text-black text-sm font-bold disabled:opacity-50 active:bg-white/90 transition",children:"저장"})]})]})}):null},et=null,en=e=>{let{events:t,onAddEvent:n,onUpdateEvent:r,onDeleteEvent:l,onMoveEvent:s,onOpenAcademicScheduleImport:i,importToastCount:d,onDismissImportToast:c}=e,h=(0,j.Dv)(),[b,v]=(0,u.useState)(()=>h?new Date("".concat(o.b,"T12:00:00")):null!=et?et:new Date);(0,u.useEffect)(()=>{h&&v(e=>e.toDateString()===new Date("".concat(o.b,"T12:00:00")).toDateString()?e:new Date("".concat(o.b,"T12:00:00")))},[h]);let[w,y]=(0,u.useState)(null),D=b.getFullYear(),k=b.getMonth(),E=new Date(D,k,1).getDay(),N=new Date(D,k+1,0).getDate(),C=h?new Date("".concat(o.b,"T12:00:00")):new Date,[z,S]=(0,u.useState)(null),M={};
1t.forEach(e=>{if(e.date){let t=new Date(e.date),n=new Date(e.endDate?e.endDate:e.date),a=new Date(t);for(;a<=n;){let t=(0,g.FB)(a);M[t]||(M[t]=[]),M[t].push(e),a.setDate(a.getDate()+1)}}});let A=[],F=[],T=new Date(D,k,0).getDate();for(let e=0;e<E;e++)F.push({day:T-E+e+1,isCurrentMonth:!1});for(let e=1;e<=N;e++)F.push({day:e,isCurrentMonth:!0}),7===F.length&&(A.push(F),F=[]);if(F.length>0){let e=1;for(;F.length<7;)F.push({day:e++,isCurrentMonth:!1});A.push(F)}let L=[.5,1,1,1,1,1,.5],W=L.reduce((e,t)=>e+t,0),G=e=>{let t=0;for(let n=0;n<e;n++)t+=L[n];return t/W*100},O=(e,t)=>{let n=0;for(let a=e;a<=t;a++)n+=L[a];return n/W*100},R=e=>{let n=[],a=[];t.forEach(t=>{if(!t.date)return;let n=t.date,r=t.endDate||t.date;if(n===r)return;let l=e[0];if(n<=e[6]&&r>=l){let l=0,s=6;for(let t=0;t<7;t++)e[t]>=n&&0===l&&(l=t),e[t]===n&&(l=t);for(let t=6;t>=0;t--)if(e[t]<=r){s=t;break}if(n>e[6]||r<e[0])return;n<e[0]&&(l=0),r>e[6]&&(s=6),a.push({event:t,startCol:l,endCol:s})}}),a.sort((e,t)=>e.startCol!==t.startCol?e.startCol-t.startCol:t.endCol-t.startCol-(e.endCol-e.startCol));let r=[];return a.forEach(e=>{let t=!1,a=0;for(;!t;){let l=r[a];void 0===l||l<e.startCol?(r[a]=e.endCol,n.push({...e,rowIndex:a}),t=!0):a++}}),n},_=e=>{let{event:t,isCurrentMonth:n,onUpdateEvent:r,onDeleteEvent:l}=e;return(0,a.jsxs)("div",{draggable:!0,onDragStart:e=>{e.dataTransfer.setData("text/plain",t.id),e.dataTransfer.effectAllowed="move",e.target.style.opacity="0.5"},onDragEnd:e=>{e.target.style.opacity="1"},onClick:e=>{e.stopPropagation(),r(t)},className:(0,g.cn)("flex items-center justify-start gap-1 text-xs px-2 py-1 rounded-[4px] bg-[#2C2C2E] border border-white/5 text-[#E0E0E0] hover:bg-[#3A3A3C] transition-colors cursor-grab active:cursor-grabbing select-none shadow-sm group/event",!n&&"opacity-50"),children:[(0,a.jsx)("span",{className:(0,g.cn)("w-2 h-2 rounded-full shrink-0",q[t.tag||"gray"])}),(0,a.jsx)("span",{className:"truncate flex-1 font-semibold text-white",children:t.title}),(0,a.jsx)("button",{"aria-label":"삭제",onClick:e=>{e.stopPropagation(),l(t.id)},className:"opacity-0 group-hover/event:opacity-100 p-0.5 text-red-500/70 hover:text-red-400 transition-opacity shrink-0 event-trash-btn",children:(0,a.jsx)(f.Z,{size:12})})]})};return(0,a.jsxs)("div",{className:"flex gap-1 min-h-full flex-1 bg-[#09090b]",onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},children:[(0,a.jsxs)("div",{className:"relative flex flex-col flex-[6] rounded-xl border border-white/5 bg-[#1C1C1E] overflow-hidden",children:[(0,a.jsxs)("div",{className:"shrink-0 flex items-center justify-center relative px-6 py-3 border-b border-white/5",children:[(0,a.jsx)("button",{"aria-label":"이전 달",onClick:()=>{let e=new Date(D,k-1,1);et=e,v(e)},className:"absolute left-4 p-2 hover:bg-white/10 rounded-lg text-[#8E8E93] hover:text-white transition-colors",children:(0,a.jsx)(x.Z,{size:20})}),(0,a.jsxs)("div",{className:"text-lg font-bold text-white tracking-tight",children:[D,"년 ",k+1,"월"]}),(0,a.jsxs)("div",{className:"absolute right-4 flex items-center gap-2",children:[(0,a.jsx)(U,{isGuest:h,onOpenAcademicScheduleImport:i}),(0,a.jsx)("button",{"aria-label":"다음 달",onClick:()=>{let e=new Date(D,k+1,1);et=e,v(e)},className:"p-2 hover:bg-white/10 rounded-lg text-[#8E8E93] hover:text-white transition-colors",children:(0,a.jsx)(m.Z,{size:20})})]})]}),(0,a.jsx)("div",{className:"shrink-0 grid grid-cols-[0.5fr_1fr_1fr_1fr_1fr_1fr_0.5fr] border-b border-white/5 bg-[#1C1C1E]",children:["일","월","화","수","목","금","토"].map((e,t)=>(0,a.jsx)("div",{className:(0,g.cn)("text-center py-2 text-xs font-semibold uppercase tracking-wider border-r border-white/5 last:border-r-0 min-w-0",0===t?"text-red-400":6===t?"text-blue-400":"text-[#8E8E93]"),children:e},e))}),(0,a.jsx)("div",{className:"flex flex-col flex-1",children:A.map((e,t)=>{let i=e.map((e,n)=>{let{day:a,isCurrentMonth:r}=e,l=D,s=k;return!r&&(0===t||1===t&&a>20?(s=k-1)<0&&(s=11,l=D-1):(s=k+1)>11&&(s=0,l=D+1)),"".concat(l,"-").concat(String(s+1).padStart(2,"0"),"-").concat(String(a).padStart(2,"0"))}),o=R(i),d=new Set(o.map(e=>
1e.event.id));return(0,a.jsxs)("div",{className:"relative grid grid-cols-[0.5fr_1fr_1fr_1fr_1fr_1fr_0.5fr] border-b border-white/5 last:border-b-0 flex-[1_0_auto] min-h-[140px] min-w-0",children:[o.map(e=>{let{event:t,startCol:n,endCol:s,rowIndex:o}=e,d=t.date<i[0],c=(t.endDate||t.date)>i[6],u=d?0:8,x=z===t.id;return(0,a.jsxs)("div",{draggable:!0,onDragStart:e=>{e.dataTransfer.setData("text/plain",t.id),e.dataTransfer.effectAllowed="move",e.target.style.opacity="0.5"},onDragEnd:e=>{e.target.style.opacity="1",S(null)},className:(0,g.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 justify-start gap-1 group/event min-w-0 select-none",x?"event-block-hover":"event-block-base",d?"rounded-l-none border-l-0":"rounded-l-[4px]",c?"rounded-r-none border-r-0":"rounded-r-[4px]"),style:{left:"calc(".concat(G(n),"% + ").concat(u,"px)"),width:"calc(".concat(O(n,s),"% - ").concat(u+(c?0:8),"px)"),top:"".concat(40+30*o,"px")},onMouseEnter:()=>S(t.id),onMouseLeave:()=>S(null),onClick:e=>{e.stopPropagation(),r(t)},children:[(0,a.jsx)("span",{className:(0,g.cn)("w-2 h-2 rounded-full shrink-0",q[t.tag||"gray"])}),(0,a.jsx)("span",{className:"truncate flex-1 font-semibold text-white",children:t.title}),(0,a.jsx)("button",{"aria-label":"삭제",onClick:e=>{e.stopPropagation(),l(t.id)},className:"opacity-0 group-hover/event:opacity-100 p-0.5 text-red-500/70 hover:text-red-400 transition-opacity shrink-0 event-trash-btn",children:(0,a.jsx)(f.Z,{size:12})})]},t.id)}),e.map((e,t)=>{let{day:c,isCurrentMonth:u}=e,x=i[t],m=(M[x]||[]).filter(e=>!d.has(e.id)),h=u&&C.getFullYear()===D&&C.getMonth()===k&&c===C.getDate(),f=o.reduce((e,t)=>x>=t.event.date&&x<=(t.event.endDate||t.event.date)?Math.max(e,t.rowIndex):e,-1),b=-1!==f?(f+1)*30+8:0;return(0,a.jsxs)("div",{className:(0,g.cn)("relative p-2 border-r border-white/5 last:border-r-0 group transition-colors min-w-0",w===x&&"bg-white/10 ring-2 ring-white/20 ring-inset"),onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",u&&w!==x&&y(x)},onDragLeave:()=>y(null),onDrop:e=>{e.preventDefault(),y(null);let t=e.dataTransfer.getData("text/plain");t&&u&&s(t,x)},children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:(0,g.cn)("text-sm font-medium w-6 h-6 flex items-center justify-center rounded-full",h&&"today-indicator",!u&&"opacity-30",h?"bg-[#df5252] text-white":0===t?"text-red-400":6===t?"text-blue-400":"text-[#E0E0E0]"),children:c}),u&&(0,a.jsx)("button",{"aria-label":"일정 추가",onClick:()=>n(x),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-white/10 rounded text-[#8E8E93] hover:text-white transition",children:(0,a.jsx)(p.Z,{size:14,strokeWidth:3})})]}),(0,a.jsx)("div",{className:"space-y-1",style:{marginTop:b>0?"".concat(b,"px"):void 0},children:m.map(e=>(0,a.jsx)(_,{event:e,isCurrentMonth:u,onUpdateEvent:r,onDeleteEvent:l},e.id))})]},t)})]},t)})}),"number"==typeof d&&c&&(0,a.jsx)(H.h,{count:d,onClose:c,className:"absolute inset-x-0 bottom-6"})]}),(0,a.jsxs)("div",{className:"flex flex-col flex-1 rounded-xl border border-white/5 bg-[#1C1C1E] overflow-hidden",children:[(0,a.jsx)("div",{className:"shrink-0 flex items-center justify-center h-[52px]",children:(0,a.jsx)("span",{className:"text-sm font-medium text-[#E0E0E0]",children:"업무 메모"})}),(0,a.jsx)("div",{className:(0,g.cn)("flex-1 p-2 overflow-auto space-y-1 custom-scrollbar","memo"===w&&"bg-white/10 ring-2 ring-white/20 ring-inset"),onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move","memo"!==w&&y("memo")},onDragLeave:()=>y(null),onDrop:e=>{e.preventDefault(),y(null);let t=e.dataTransfer.getData("text/plain");t&&s(t,"")},children:t.filter(e=>!e.date).map(e=>(0,a.jsx)(_,{event:e,isCurrentMonth:!0,onUpdateEvent:r,onDeleteEvent:l},e.id))}),(0,a.jsx)("div",{className:"p-3",children:(0,a.jsxs)("button",{onClick:()=>n(""),className:"flex items-center justify-center gap-2 w-full px-3 py-2 text-sm text-[#E0E0E0] hover:bg-white/5 rounded-lg border border-white/10 transition whitespace-nowrap",children:[(0,a.jsx)(p.Z,{size:16}),(0,a.jsx)("span",{children:"새 업무"})]})})]})]})};function ea(){let e=(0,j.Dv)(),t=(0,v.XC)(),n=(0,c.N)(),{showToast:o}=(0,d.pm)(),{isLoaded:x}=(0,D.AF)(),[m,h]=(0,u.useState)([]),[f,p]=(0,u.useState)(!0),[w,E]=(0,u.useState)(!1),N=(0,u.useRef)(0),[C,z]=(0,u.useState)(!1),[S,M]=(0,u.useState)(""),[A,F]=(0,u.useState)(null),[T,L]=(0,u.useState)(!1),[W,G]=(0,u.useState)(null),O=!e,R=(0,u.useRef)(!1);(0,u.useEffect)(()=>(R.current=!0,()=>{R.current=!1}),[]);let _=(0,u.useRef)([]),Z=(0,u.useCallback)(()=>{_.current.push([...m]),_.current.length>20&&_.current.shift()},[m]);(0,u.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&"z"===e.key){e.preventDefault();let t=_.current.pop();t&&h(t)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let B=(0,u.useCallback)(async()=>
1{if(!R.current)return;let n=++N.current;p(!0),E(!1);try{let a;if(e){let e=await (0,i.W)(()=>(0,y.getGuestData)());e.scheduleEvents?a=e.scheduleEvents:(a=(await (0,y.generateMockData)()).scheduleEvents||[],await (0,y.saveGuestData)("scheduleEvents",a))}else{let e=await (0,i.W)(()=>(0,b.X)("getScheduleEvents",{startDate:"0001-01-01",endDate:"9999-12-31"},t));if(!e.success)throw Error(e.error);a=e.data}R.current&&n===N.current&&h(a)}catch(e){R.current&&n===N.current&&E(!0)}finally{R.current&&n===N.current&&p(!1)}},[e,t]);(0,u.useEffect)(()=>{if(e)return;let n="",a=e=>{let a=e.detail;a&&a!==n&&(n=a,(0,b.X)("getScheduleEvents",{startDate:"0001-01-01",endDate:"9999-12-31"},t).then(e=>{e.success&&R.current&&h(e.data)}))};return window.addEventListener("calendar-sync-updated",a),()=>window.removeEventListener("calendar-sync-updated",a)},[e,t]);let I=(0,u.useCallback)(()=>{G(null)},[]),U=(0,u.useCallback)(e=>{G(e),B()},[B]);(0,u.useEffect)(()=>{if(!x){console.log("[WorkScheduleView] Waiting for StudentContext...");return}return p(!0),B(),()=>{N.current++}},[B,x]);let Y=async(n,a,r,l)=>{if(e){let e={id:"guest-event-".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),title:a,date:n,endDate:l,tag:r,createdAt:new Date().toISOString()},t=[...(await (0,y.getGuestData)()).scheduleEvents||[],e];await (0,y.saveGuestData)("scheduleEvents",t),h(t);return}console.log("[WorkScheduleView] Adding event:",{date:n,title:a,tag:r,endDate:l});let s="temp-".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),i={id:s,title:a,date:n,endDate:l,tag:r,createdAt:new Date().toISOString()};h(e=>[...e,i]);let d=await (0,b.X)("upsertScheduleEvent",{title:a,date:n,endDate:l,tag:r},t);if(d.success&&d.data){let e=d.data;h(t=>t.map(t=>t.id===s?{id:e.id,title:e.title,date:e.date?(0,g.FB)(new Date(e.date)):"",endDate:e.endDate?(0,g.FB)(new Date(e.endDate)):void 0,tag:e.tag||"gray",createdAt:e.createdAt}:t))}else h(e=>e.filter(e=>e.id!==s)),o("일정 저장에 실패했습니다: "+(d.error||"알 수 없는 오류"),"error")},V=async(n,a,r,l,s)=>{if(e){let e=((await (0,y.getGuestData)()).scheduleEvents||[]).map(e=>e.id===n?{...e,title:a,tag:r,date:l,endDate:s}:e);return await (0,y.saveGuestData)("scheduleEvents",e),h(e),!0}if(!m.find(e=>e.id===n))return!1;let i=await (0,b.X)("upsertScheduleEvent",{id:n,title:a,date:l,endDate:s,tag:r},t);if(!i.success){var d;let e=null===(d=i.data)||void 0===d?void 0:d.calendarEditUrl;return o(i.error||"일정 저장에 실패했습니다.","error",e?{label:"Google에서 수정",onClick:()=>{(0,K.PQ)(e)}}:void 0),!1}return h(e=>e.map(e=>e.id===n?{...e,title:a,tag:r,date:l,endDate:s}:e)),!0},P=async a=>{if(Z(),e){if(!await n({title:"일정을 삭제할까요?",description:"삭제한 일정은 되돌릴 수 없습니다."}))return;let e=((await (0,y.getGuestData)()).scheduleEvents||[]).filter(e=>e.id!==a);await (0,y.saveGuestData)("scheduleEvents",e),h(e);return}let r=await (0,b.X)("deleteScheduleEvent",{id:a},t);if(!r.success){o(r.error||"일정 삭제에 실패했습니다.","error");return}h(e=>e.filter(e=>e.id!==a))},q=async(t,n)=>{let a;let r=m.find(e=>e.id===t);if(r&&r.date!==n){if(Z(),r.endDate&&r.date){let e=new Date(r.date),t=new Date(r.endDate).getTime()-e.getTime();a=Q(new Date(new Date(n).getTime()+t))}if(e){let e=((await (0,y.getGuestData)()).scheduleEvents||[]).map(e=>e.id===t?{...e,date:n,endDate:a||e.endDate}:e);await (0,y.saveGuestData)("scheduleEvents",e),h(e);return}await V(t,r.title,r.tag,n,a||r.endDate)}},J=async e=>{if(0!==e.length){if(A){let t=e[0];if(!await V(A.id,t.title,t.tag,t.date,t.endDate))return!1;for(let t=1;t<e.length;t++){let n=e[t];Y(n.date,n.title,n.tag,n.endDate)}}else e.forEach(e=>{Y(e.date,e.title,e.tag,e.endDate)})}};return(0,a.jsx)("div",{className:"h-full overflow-hidden md:overflow-y-auto custom-scrollbar transition-colors duration-300 bg-[#FBFBF9] dark:bg-zinc-950 md:bg-white md:dark:bg-[#09090b]",children:(0,a.jsx)("div",{className:"flex flex-col gap-0 md:gap-4 h-full md:min-h-full p-0 md:p-3",children:(0,a.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col h-full",children:[w&&(0,a.jsx)(s.A,{message:"일정을 불러오지 못했어요. 다시 시도해 주세요.",onRetry:()=>void B()}),f&&m.length>0&&(0,a.jsx)(r.Q,{label:"일정을 갱신하고 있어요",className:"p-3"}),f&&0===m.length?(0,a.jsx)(k.MobileLoadingSwap,{variant:"calendar",label:"일정을 불러오고 있어요",fallback:(0,a.jsx)("div",{className:"flex flex-1 flex-col",children:(0,a.jsx)(l.SP,{viewDate:et})})}):w&&0===m.length?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"md:hidden flex-1 min-h-0 h-full flex flex-col",children:[(0,a.jsx)(X,{isGuest:e,events:m,onCreateEvent:Y,onSaveEvent:V,onDeleteEvent:P,onOpenAcademicScheduleImport:O?()=>L(!0):void 0}),null!==W&&(0,a.jsx)(H.h,{count:W,onClose:I,className:"fixed inset-x-0 bottom-[calc(1.5rem+env(safe-area-inset-bottom,0px))]"})]}),(0,a.jsx)("div",{className:"hidden md:flex flex-1 flex-col",children:(0,a.jsx)(en,{events:m,onAddEvent:e=>{M(e),F(null),z(!0)},onUpdateEvent:e=>{M(e.date),F(e),z(!0)},onDeleteEvent:P,onMoveEvent:q,onOpenAcademicScheduleImport:O?()=>L(!0):void 0,importToastCount:W,onDismissImportToast:I})}),(0,a.jsx)(ee,{isOpen:C,onClose:()=>z(!1),onSave:J,onDelete:A?()=>{P(A.id),z(!1)}:void 0,initialDate:S,initialTitle:null==A?void 0:A.title,initialTag:null==A?void 0:A.tag,initialEndDate:null==A?void 0:A.endDate}),(0,a.jsx)(H.k,{isOpen:T,onClose:()=>L(!1),onImported:U})]})]})})})}}}]);

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.