PageSourceSearch

https://naemo.ai/_next/static/chunks/3450.fd7ee9ed752ef06a.js

js naemo.ai collected 2026-10-02 01:14:35 UTC 68,943 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3450],{35596:function(e,t,n){n.d(t,{Z:function(){return N}});var s=n(57437),a=n(2265),r=n(52345),i=n(59717),l=n(81906),c=n(33728),o=n(57586),d=n(13100),u=n(32489),x=n(46977),m=n(93448),h=n(21652),b=n(8345),p=n(82941);let g=0,f=[],v=0,w=!1;function y(){v++,window.history.back()}let j="";function N(e){let{isOpen:t,onClose:n,title:N,children:k,footer:z,className:C}=e,S=(0,a.useId)(),A=(0,r.J)(),I=(0,i.o)(),E=(0,l.c)(0);(0,a.useEffect)(()=>{t&&E.set(0)},[t,E]);let D=(0,c.H)(E,[0,240],[1,0]),L=(0,a.useRef)(n),M=(0,a.useRef)(!1);(0,a.useEffect)(()=>{L.current=n},[n]),(0,a.useEffect)(()=>{if(!t)return;g||(j=document.body.style.overflow),g++,w||(w=!0,window.addEventListener("popstate",e=>{var t;if((v>0||f.length>0)&&(0,b.l)(e),v>0){v--;return}null===(t=f.at(-1))||void 0===t||t.onPop()},{capture:!0}));let e={id:S,onPop:()=>{M.current&&(M.current=!1,L.current())}};f.push(e),document.body.style.overflow="hidden";let n=(0,h.UM)(),s=window.history.state||{};return n&&!M.current&&(window.history.pushState({...s,isBottomSheet:!0,sheetId:S},""),M.current=!0),()=>{var t;M.current&&(null===(t=window.history.state)||void 0===t?void 0:t.sheetId)===S&&(M.current=!1,y()),f.splice(f.indexOf(e),1),--g<=0&&(g=0,document.body.style.overflow=j)}},[t,S]);let Z=(0,a.useCallback)(()=>{M.current&&(M.current=!1,y()),n()},[n]),T=(0,x.a)(t,Z),R=(0,a.useCallback)((e,t)=>{"pointercancel"!==e.type&&"touchcancel"!==e.type&&(t.velocity.y>500||t.offset.y>100)&&Z()}
1,[Z]),B=(0,a.useRef)(null),F=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!t)return;let e=B.current;if(!e)return;let n=[],s=function(t){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!e.contains(t)||F.current!==t)return;let s=e.getBoundingClientRect(),a=t.getBoundingClientRect(),r=(0,p.Wk)({top:a.top-s.top,bottom:a.bottom-s.top},e.clientHeight,12,12);0!==r&&e.scrollTo({top:Math.max(0,e.scrollTop+r),behavior:n?"smooth":"auto"})},a=e=>{let t=e.target;t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName||t.isContentEditable)&&(F.current=t,s(t,!1),n.push(setTimeout(()=>s(t,!0),120)),n.push(setTimeout(()=>s(t,!0),300)),n.push(setTimeout(()=>s(t,!0),500)))},r=()=>{F.current=null},i=()=>{F.current&&s(F.current,!0)};e.addEventListener("focusin",a),e.addEventListener("focusout",r);let l=window.visualViewport;return null==l||l.addEventListener("resize",i),()=>{n.forEach(clearTimeout),e.removeEventListener("focusin",a),e.removeEventListener("focusout",r),null==l||l.removeEventListener("resize",i)}},[t]),(0,s.jsx)(o.M,{children:t&&(0,s.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,s.jsx)(d.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,s.jsx)(d.E.div,{style:{opacity:D},onClick:Z,className:"absolute inset-0 bg-black/50 backdrop-blur-sm"})}),(0,s.jsxs)(d.E.div,{style:{y:E,maxHeight:"90%"},initial:A?{opacity:0}:{y:"100%"},animate:{y:0,opacity:1},exit:A?{opacity:0}:{y:"100%"},transition:A?{duration:.12}:{type:"spring",damping:30,stiffness:320,mass:.8},drag:"y",dragListener:!1,dragControls:I,dragConstraints:{top:0},dragSnapToOrigin:!0,dragMomentum:!1,dragElastic:{top:.12,bottom:.75},onDragEnd:R,ref:T,tabIndex:-1,"aria-label":N||"상세 설정",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",C),children:[(0,s.jsxs)("div",{onPointerDown:e=>{e.target.closest("button")||I.start(e)},className:"shrink-0 cursor-grab active:cursor-grabbing touch-none select-none",children:[(0,s.jsx)("div",{className:"flex justify-center pt-3 pb-2",children:(0,s.jsx)("div",{className:"w-9 h-1 rounded-full bg-zinc-400/70 dark:bg-zinc-700"})}),(0,s.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,s.jsx)("h3",{className:"text-[var(--mobile-font-h2)] font-semibold text-zinc-900 dark:text-zinc-100",children:N}),(0,s.jsx)("button",{type:"button",onClick:Z,"aria-label":"닫기",className:"flex h-11 w-11 items-center justify-center rounded-lg text-zinc-600 dark:text-zinc-300",children:(0,s.jsx)(u.Z,{size:20})})]})]}),(0,s.jsx)("div",{ref:B,className:"flex-1 overflow-y-auto overflow-x-hidden px-4 pt-3 pb-2 mobile-scroll mobile-sheet-scroll",children:k}),z&&(0,s.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})]})]})})}},93450:function(e,t,n){n.r(t),n.d(t,{default:function(){return H}});var s=n(57437),a=n(90982),r=n(28691),i=n(98319),l=n(2265),c=n(99376),o=n(21047),d=n(99397),u=n(49322),x=n(82431),m=n(52264),h=n(35224),b=n(40875),p=n(10407),g=n(30401),f=n(95468),v=n(18930),w=n(8522),y=n(41414),j=n(92735),N=n(34415),k=n(45884),z=n(66337),C=n(49589),S=n(93448),A=n(91455),I=n(98728),E=n(35596),D=n(92846);let L=e=>{let{label:t,value:n,min:a,max:r,onChange:i}=e;return(0,s.jsxs)("div",{className:"flex items-center justify-between bg-zinc-50 dark:bg-zinc-900 px-4 py-3 rounded-xl border border-zinc-200/70 dark:border-zinc-700",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-zinc-600 dark:text-zinc-400",children:t}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{"aria-label":"".concat(t," 줄이기"),onClick:()=>n>a&&i(n-1),disabled:n<=a,className:"w-8 h-8 rounded-lg bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 flex items-center justify-center text-zinc-600 dark:text-zinc-400 active:scale-90 transition disabled:opacity-30 shadow-sm",children:(0,s.jsx)(o.Z,{size:13})}),(0,s.jsx)("span",{className:"text-sm font-bold min-w-[24px] text-center text-zinc-900 dark:text-zinc-100",children:n}),(0,s.jsx)("button",{"aria-label":"".concat(t," 늘리기"),onClick:()=>n<r&&i(n+1),disabled:n>=r,className:"w-8 h-8 rounded-lg bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 flex items-center justify-center text-zinc-600 dark:text-zinc-400 active:scale-90 transition disabled:opacity-30 shadow-sm",children:(0,s.jsx)(d.Z,{size:13})})]})]})};function M(e){var t,n;let{students:a,seats:r,inactiveSeats:i,cols:c,rows:o,mode:d,groupCount:u,groupLayout:x,isRotated:m,isShuffling:h,constraints:b,onSwap:p,onToggleStatus:j,onShuffle:N,onRotate:k,onChangeMode:M,onChangeRows:Z,onChangeCols:T,onChangeGroupCount:R,onChangeGroupLayout:B,onAddBan:F,onRemoveBan:G,selectedClass:O,classList:P,onSelectClass:X,lockedSeats:W,onToggleLock:U,showStudentNumber:q=!1,onToggleShowStudentNumber:Y,distributeEvenlyByClass:H=!1,onToggleDistributeEvenlyByClass:_}=e,[K,J]=(0,l.useState)(null),[V,Q]=(0,l.useState)(null),$=(0,l.useRef)(null),ee=(0,l.useRef)(null),et=(0,l.useRef)(null);(0,l.useEffect)(()=>()=>{var e;return null===(e=et.current)||void 0===e?void 0:e.call(et)},[]);let en=(0,l.useRef)(null),[es,ea]=(0,l.useState)(!1),[er,ei]=(0,l.useState)(!1),[el,ec]=(0,l.useState)("add"),[eo,ed]=(0,l.useState)([]),[eu,ex]=(0,l.useState)(!1),em=()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},eh=(e,t)=>{var n;if(null===(n=et.current)||void 0===n||n.call(et),J(null),Q(null),h||1!==t.touches.length)return;let s=t.touches[0].clientX,a=t.touches[0].clientY,r=!1;ee.current=setTimeout(()=>{ee.current=null,r||i.has(e)||W.has(e)||(en.current={isDragging:!0,sourceIdx:e,currentOverIdx:null},J(e),D.MU.impact("medium"))},380);let l=t=>{var n,l;if(1!==t.touches.length){c(t);return}let o=t.touches[0],d=o.clientX-s,u=o.clientY-a;if(!(null===(n=en.current)||void 0===n?void 0:n.isDragging)){(Math.abs(d)>8||Math.abs(u)>8)&&(r=!0,em());return}t.cancelable&&t.preventDefault();let x=document.elementFromPoint(o.clientX,o.clientY),m=null==x?void 0:x.closest("[data-seat-idx]"),h=m?parseInt(null!==(l=m.dataset.seatIdx)&&void 0!==l?l:"-1"):null,b=null===h||isNaN(h)||h===e||i.has(h)||W.has(h)?null:h;if(en.current.currentOverIdx=b,Q(b),$.current){let e=$.current.getBoundingClientRect();o.clientY<e.top+60?$.current.scrollTop-=8:o.clientY>e.bottom-60&&($.current.scrollTop+=8)}},c=t=>{ek.current=Date.now();let n=en.current;if(d(),J(null),Q(null),"touchend"===t.type&&0===t.touches.length){if(null==n?void 0:n.isDragging){let{sourceIdx:e,currentOverIdx:t}=n;null!==t&&t!==e&&p(e,t)}else r||ez(e)}},o=e=>{1!==e.touches.length&&c(e)},d=()=>{em(),document.removeEventListener("touchstart",o),document.removeEventListener("touchmove",l),document.removeEventListener("touchend",c),document.removeEventListener("touchcancel",c),en.current=null,et.current=null};et.current=d,document.addEventListener("touchstart",o,{passive:!0}),document.addEventListener("touchmove",l,{passive:!1}),document.addEventListener("touchend",c),document.addEventListener("touchcancel",c)},eb=e=>{ed(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e].slice(-2))},ep=async()=>{2===eo.length&&(ex(!0),await F(eo[0],eo[1]),ed([]),ec("list"),ex(!1))},eg=e=>a.find(t=>
1t.id===e),ef=c<=3?"text-base":c<=5?"text-sm":c<=7?"text-xs":"text-[11px]",ev=null!==K,[ew,ey]=(0,l.useState)(!1),[ej,eN]=(0,l.useState)(null),ek=(0,l.useRef)(0),ez=e=>{if(!h){if(!ew){j(e);return}i.has(e)||W.has(e)||(null===ej?eN(e):(ej!==e&&p(ej,e),eN(null),ey(!1)))}},eC=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=i.has(e),a=r[e],l=K===e,c=V===e&&!n;return(0,s.jsxs)("div",{"data-seat-idx":e,className:(0,S.cn)("w-full aspect-square rounded-xl flex flex-col items-center justify-center relative","border transition duration-150 select-none overflow-hidden touch-pan-y",h&&"opacity-0 scale-90",ev&&!l&&!c&&"opacity-50",n?"border-dashed border-zinc-200 dark:border-zinc-800 opacity-30":l?"border-2 border-blue-400 bg-blue-50 dark:bg-blue-950/40 scale-105 dark:shadow-none z-10 opacity-70":c?"border-2 border-emerald-400 bg-emerald-50 dark:bg-emerald-950/40 scale-[1.08] dark:shadow-none z-20":"border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 shadow-sm"),children:[(0,s.jsx)("button",{type:"button",onTouchStart:t=>eh(e,t),onClick:t=>{t.detail&&Date.now()-ek.current<600||ez(e)},"aria-pressed":ew?ej===e:void 0,disabled:h||ew&&(n||W.has(e)),"aria-label":n?"".concat(e+1,"번 자리 (사용 안 함)"):a?"".concat(e+1,"번 자리, ").concat(a.name):"".concat(e+1,"번 자리 (빈자리)"),className:"absolute inset-0 z-10 rounded-xl focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-inset"}),!n&&!t&&(0,s.jsx)("span",{className:"absolute top-[2px] left-[3px] text-[8px] text-zinc-500 dark:text-zinc-400 font-mono leading-none pointer-events-none",children:e+1}),!n&&a&&(0,s.jsx)("button",{"aria-label":W.has(e)?"잠금 해제":"잠금",onTouchStart:e=>{e.stopPropagation()},onClick:t=>{t.stopPropagation(),U(e,t)},className:(0,S.cn)("absolute p-0.5 rounded transition-all z-20",m?"bottom-1 left-1 rotate-180":"top-1 right-1",W.has(e)?"text-amber-400 opacity-100":"text-zinc-500/50 dark:text-zinc-400/50 active:text-amber-400"),children:W.has(e)?(0,s.jsx)(z.Z,{size:t?10:12}):(0,s.jsx)(C.Z,{size:t?10:12})}),n?(0,s.jsx)(f.Z,{size:t?12:14,className:"text-zinc-400 dark:text-zinc-500",strokeWidth:1.5}):a?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center w-full pointer-events-none px-0.5",children:[q&&(0,s.jsxs)("span",{className:(0,S.cn)("font-medium text-zinc-400 dark:text-zinc-500 leading-none mb-0.5 select-none text-center truncate max-w-full",t?"text-[8px]":"text-[9px]"),children:[a.classNum?"".concat(a.classNum,"반 "):"",a.number,"번"]}),(0,s.jsx)("span",{className:(0,S.cn)("font-bold text-center leading-tight break-keep text-zinc-900 dark:text-zinc-100 w-full truncate",t?"text-[11px]":ef),children:a.name})]}):(0,s.jsx)("span",{className:(0,S.cn)("text-zinc-400 dark:text-zinc-500 leading-none pointer-events-none",t?"text-[8px]":"text-[9px]"),children:"빈자리"}),c&&(0,s.jsx)("span",{className:"absolute inset-0 rounded-[10px] border-2 border-emerald-400 pointer-events-none animate-pulse"})]},e)},eS=(e,t)=>{if(0===e)return[];let n="2x3"===t?2:3;if(e<=n)return Array(e).fill(1);let s=Math.min(2,Math.ceil(e/n)),a=[],r=e;for(;r>0;)a.push(Math.min(s,r)),r-=s;return a},eA=()=>0===a.length?4:Math.ceil(a.length/Math.max(1,u));return(0,s.jsxs)("div",{className:"flex flex-col h-full bg-[#FBFBF9] dark:bg-zinc-950",children:[(0,s.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden px-3 pt-[88px]",children:[!m&&(0,s.jsx)("div",{className:"w-full bg-zinc-800 dark:bg-zinc-700 text-white py-1.5 rounded-xl text-center text-xs font-bold mb-2 tracking-widest shadow-sm shrink-0",children:"칠판"}),(0,s.jsxs)("div",{className:"flex items-center gap-3 pb-2 text-sm",children:[(0,s.jsx)("button",{type:"button","aria-pressed":ew,onClick:()=>{ey(e=>!e),eN(null)},className:"min-h-11 rounded-lg border border-zinc-300 dark:border-zinc-700 px-3",children:ew?"자리 바꾸기 취소":"자리 바꾸기"}),ew&&(0,s.jsx)("span",{role:"status",children:null===ej?"첫 번째 자리를 선택하세요":"바꿀 자리를 선택하세요"})]}),(0,s.jsx)("div",{ref:$,className:"flex-1 overflow-y-auto pb-2",children:"grid"===d?(0,s.jsx)("div",{className:"grid gap-1.5",style:{gridTemplateColumns:"repeat(".concat(c,", 1fr)")},children:(m?Array.from({length:o*c},(e,t)=>o*c-1-t):Array.from({length:o*c},(e,t)=>t)).map(e=>eC(e))}):(()=>{let e=eS(u,x),t=m?[...e].reverse():e,n=eA(),a="2x3"===x?2:3,r=m?u-1:0,i=m?-1:1;return(0,s.jsx)("div",{className:"space-y-2.5",children:t.map((e,t)=>{let l=[];for(let t=0;t<e;t++)l.push(r),r+=i;return(0,s.jsx)("div",{className:"grid gap-2.5",style:{gridTemplateColumns:"repeat(".concat(e,", 1fr)")},children:l.map(e=>{let t=Array.from({length:n},(t,s)=>m?e*n+n-1-s:e*n+s);return(0,s.jsxs)("div",{className:"rounded-2xl border border-zinc-200 bg-white px-2 py-2 shadow-sm",children:[(0,s.jsxs)("p",{className:"text-[9px] font-bold tracking-widest text-zinc-300 text-center mb-1.5 pointer-events-none",children:["G",e+1]}
1),(0,s.jsx)("div",{className:"grid gap-1",style:{gridTemplateColumns:"repeat(".concat(a,", 1fr)")},children:t.map(e=>eC(e,!0))})]},e)})},t)})})})()}),m&&(0,s.jsx)("div",{className:"w-full bg-zinc-800 dark:bg-zinc-700 text-white py-1.5 rounded-xl text-center text-xs font-bold mt-2 tracking-widest shadow-sm shrink-0",children:"칠판"})]}),(0,s.jsx)("div",{className:"shrink-0 px-4 py-1 text-center",children:(0,s.jsx)("p",{className:(0,S.cn)("text-[10px] transition duration-200",ev?"text-emerald-600 font-semibold":"text-zinc-400"),children:ev?"교환할 자리에 손을 놓으세요":"탭 → 비활성/활성  \xb7  길게 누르고 드래그 → 자리 교환"})}),(0,s.jsx)("div",{className:"shrink-0 border-t border-zinc-200/60 dark:border-zinc-800 bg-white dark:bg-zinc-900 mobile-bottom-action-bar",children:(0,s.jsxs)("div",{className:"grid grid-cols-4 divide-x divide-zinc-100 dark:divide-zinc-800",children:[(0,s.jsxs)("button",{onClick:()=>N(),disabled:h||0===a.length,className:"flex flex-col items-center justify-center gap-1 py-3 active:bg-zinc-50 dark:active:bg-zinc-800 transition-colors disabled:opacity-40",children:[(0,s.jsx)(w.Z,{size:20,className:(0,S.cn)(h?"text-blue-400 animate-spin":"text-blue-500")}),(0,s.jsx)("span",{className:"text-[10px] font-medium text-blue-500",children:"섞기"})]}),(0,s.jsxs)("button",{onClick:()=>k(),className:(0,S.cn)("flex flex-col items-center justify-center gap-1 py-3 active:bg-zinc-50 dark:active:bg-zinc-800 transition-colors",m&&"bg-emerald-50/70 dark:bg-emerald-950/30"),children:[(0,s.jsx)(y.Z,{size:20,className:(0,S.cn)("transition-transform duration-500",m?"text-emerald-500 rotate-180":"text-zinc-500 dark:text-zinc-400")}),(0,s.jsx)("span",{className:(0,S.cn)("text-[10px] font-medium",m?"text-emerald-500":"text-zinc-500 dark:text-zinc-400"),children:"회전"})]}),(0,s.jsxs)("button",{onClick:()=>{ec("add"),ea(!0)},className:"flex flex-col items-center justify-center gap-1 py-3 active:bg-zinc-50 dark:active:bg-zinc-800 transition-colors",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(f.Z,{size:20,className:"text-zinc-500 dark:text-zinc-400"}),b.length>0&&(0,s.jsx)("span",{className:"absolute -top-1.5 -right-1.5 w-3.5 h-3.5 rounded-full bg-red-500 text-white text-[8px] flex items-center justify-center font-bold leading-none",children:b.length})]}),(0,s.jsx)("span",{className:"text-[10px] font-medium text-zinc-500 dark:text-zinc-400",children:"짝꿍금지"})]}),(0,s.jsxs)("button",{onClick:()=>ei(!0),className:"flex flex-col items-center justify-center gap-1 py-3 active:bg-zinc-50 dark:active:bg-zinc-800 transition-colors",children:[(0,s.jsx)(I.Z,{size:20,className:"text-zinc-500 dark:text-zinc-400"}),(0,s.jsx)("span",{className:"text-[10px] font-medium text-zinc-500 dark:text-zinc-400",children:"설정"})]})]})}),(0,s.jsxs)(E.Z,{isOpen:es,onClose:()=>{ea(!1),ed([])},title:"짝꿍 금지",children:[(0,s.jsx)(A.s,{value:el,onChange:ec,"aria-label":"짝꿍 금지 보기",equalWidth:!0,className:"bg-zinc-100 rounded-xl p-1 mb-4",itemClassName:"py-2 rounded-lg text-sm font-semibold",activeItem
1ClassName:"text-zinc-900",inactiveItemClassName:"text-zinc-500",indicatorClassName:"bg-white rounded-lg shadow-sm",options:[{key:"add",label:"새로 추가"},{key:"list",label:(0,s.jsxs)(s.Fragment,{children:["목록",b.length>0&&(0,s.jsxs)("span",{className:"ml-1 text-xs text-zinc-400",children:["(",b.length,")"]})]})}]}),"add"===el&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-4 px-1",children:[0,1].map(e=>{var t;return(0,s.jsx)("div",{className:(0,S.cn)("flex-1 h-10 rounded-xl border border-dashed flex items-center justify-center text-sm font-medium transition-colors",eo[e]?"border-zinc-300 text-zinc-800 dark:text-zinc-200":"border-zinc-200 text-zinc-300"),children:eo[e]?null===(t=eg(eo[e]))||void 0===t?void 0:t.name:0===e?"첫 번째":"두 번째"},e)})}),(0,s.jsx)("div",{className:"grid grid-cols-3 gap-2 mb-4",children:a.slice().sort((e,t)=>{var n,s;return(null!==(n=e.number)&&void 0!==n?n:0)-(null!==(s=t.number)&&void 0!==s?s:0)}).map(e=>{let t=eo.includes(e.id);return(0,s.jsxs)("button",{onClick:()=>eb(e.id),"aria-pressed":t,className:(0,S.cn)("py-2.5 px-2 rounded-xl border text-center transition-colors active:scale-95",t?"border-red-400 bg-white text-zinc-800 dark:text-zinc-200":"border-zinc-200 bg-white text-zinc-800 dark:text-zinc-200"),children:[(0,s.jsxs)("span",{className:"text-[9px] text-zinc-400 block leading-none mb-0.5",children:[e.number,"번"]}),(0,s.jsx)("span",{className:"text-xs font-semibold leading-tight",children:e.name}),t&&(0,s.jsx)(g.Z,{size:10,className:"text-red-500 mx-auto mt-0.5"})]},e.id)})}),(0,s.jsx)("button",{onClick:ep,disabled:2!==eo.length||eu,className:(0,S.cn)("seating-ban-register-btn w-full py-3.5 rounded-xl font-semibold text-sm transition-colors active:scale-[0.98]",2===eo.length?"bg-black !text-white":"bg-zinc-100 text-zinc-400"),children:eu?"등록하는 중…":2===eo.length?"".concat(null===(t=eg(eo[0]))||void 0===t?void 0:t.name," \xb7 ").concat(null===(n=eg(eo[1]))||void 0===n?void 0:n.name," 짝꿍 금지하기"):"학생 2명을 선택하세요"})]}),"list"===el&&(0===b.length?(0,s.jsxs)("div",{className:"text-center py-10",children:[(0,s.jsx)("p",{className:"text-sm text-zinc-500",children:"아직 금지한 짝꿍이 없습니다"}),(0,s.jsx)("button",{onClick:()=>ec("add"),className:"mt-3 text-xs text-blue-500 font-medium",children:"새로 추가하기"})]}):(0,s.jsx)("div",{className:"space-y-2",children:b.map(e=>{var t,n;let a=eg(e.studentAId),r=eg(e.studentBId);return a||r?(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 bg-zinc-50 rounded-xl border border-zinc-200/70",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-zinc-800 dark:text-zinc-200",children:[(0,s.jsx)("span",{children:null!==(t=null==a?void 0:a.name)&&void 0!==t?t:"?"}),(0,s.jsx)(f.Z,{size:11,className:"text-red-400",strokeWidth:2}),(0,s.jsx)("span",{children:null!==(n=null==r?void 0:r.name)&&void 0!==n?n:"?"})]}),(0,s.jsx)("button",{"aria-label":"삭제",onClick:()=>G(e.id),className:"p-1.5 rounded-lg text-zinc-400 active:text-red-500 active:bg-red-50 transition",children:(0,s.jsx)(v.Z,{size:14})})]},e.id):null})}))]}),(0,s.jsx)(E.Z,{isOpen:er,onClose:()=>ei(!1),title:"자리 설정",children:(0,s.jsxs)("div",{className:"space-y-5 py-1",children:[P.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-bold text-zinc-400 uppercase tracking-wider mb-2.5",children:"학급"}),(0,s.jsx)("div",{className:"flex flex-col gap-2",children:P.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>X(e),className:(0,S.cn)("w-full text-left px-4 py-3 rounded-xl text-sm font-semibold border transition active:scale-[0.99]",O===e?"bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 border-zinc-900 dark:border-zinc-100":"bg-white dark:bg-zinc-900 text-zinc-600 dark:text-zinc-300 border-zinc-200 dark:border-zinc-700"),children:e},e))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-bold text-zinc-400 uppercase tracking-wider mb-2.5",children:"배열 방식"}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:["grid","group"].map(e=>(0,s.jsx)("button",{onClick:()=>M(e),className:(0,S.cn)("py-3 rounded-xl text-sm font-semibold border transition active:scale-95",d===e?"bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 border-zinc-900 dark:border-zinc-100":"bg-white dark:bg-zinc-900 text-zinc-600 dark:text-zinc-300 border-zinc-200 dark:border-zinc-700"),children:"grid"===e?"기본 (줄)":"모둠"},e))})]}),"grid"===d&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-xs font-bold text-zinc-400 uppercase tracking-wider mb-2.5",children:"책상 구조"}),(0,s.jsx)(L,{label:"행 수 (가로)",value:o,min:1,max:12,onChange:Z}),(0,s.jsx)(L,{label:"열 수 (세로)",value:c,min:1,max:12,onChange:T})]}),"group"===d&&(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-xs font-bold text-zinc-400 uppercase tracking-wider mb-1",children:"모둠 구조"}),(0,s.jsx)(L,{label:"모둠 수",value:u,min:2,max:12,onChange:R}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-medium text-zinc-500 mb-2",children:"좌석 배열"}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:["2x3","3x2"].map(e=>(0,s.jsx)("button",{onClick:()=>B(e),className:(0,S.cn)("py-2.5 rounded-xl text-sm font-semibold border transition active:scale-95",x===e?"text-amber-500 dark:text-amber-400 bg-amber-500/10 border-amber-500 dark:border-amber-400 shadow-sm":"text-zinc-600 dark:text-zinc-400 hover:text-amber-500 dark:hover:text-amber-400 bg-white dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700"),children:"2x3"===e?"2열 배열":"3열 배열"},e))})]})]}),(Y||_)&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-bold text-zinc-400 uppercase tracking-wider mb-2.5",children:"상세 설정"}),(0,s.jsxs)("div",{className:"space-y-2",children:[Y&&(0,s.jsxs)("label",{className:"flex items-center gap-2.5 text-sm text-zinc-700 dark:text-zinc-300 cursor-pointer select-none py-0.5",children:[(0,s.jsx)("input",{type:"checkbox",checked:q,onCh
1ange:e=>Y(e.target.checked),className:"cursor-pointer"}),(0,s.jsx)("span",{className:"font-medium text-sm",children:"반 번호 표시"})]}),_&&(0,s.jsxs)("label",{className:(0,S.cn)("flex items-center gap-2.5 text-sm select-none py-0.5","담임 학급"===O?"text-zinc-400 dark:text-zinc-600 cursor-not-allowed":"text-zinc-700 dark:text-zinc-300 cursor-pointer"),title:"담임 학급"===O?"담임 학급은 반이 하나뿐이라 사용할 수 없습니다":"교과 학급에서 여러 반 학생들이 특정 줄이나 모둠에 몰리지 않도록 고르게 분산 배치합니다",children:[(0,s.jsx)("input",{type:"checkbox",checked:"담임 학급"!==O&&H,disabled:"담임 학급"===O,onChange:e=>_(e.target.checked),className:"cursor-pointer disabled:cursor-not-allowed"}),(0,s.jsx)("span",{className:"font-medium text-sm",children:"반 고르게 분배"})]})]})]}),(0,s.jsxs)("div",{className:"bg-zinc-50 dark:bg-zinc-800/60 rounded-xl p-3.5 border border-zinc-200/60 dark:border-white/10",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-zinc-700 dark:text-zinc-200 mb-1.5",children:"조작 방법"}),(0,s.jsxs)("ul",{className:"space-y-1",children:[(0,s.jsxs)("li",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[(0,s.jsx)("strong",{className:"text-zinc-800 dark:text-zinc-200",children:"탭"})," — 좌석 비활성/활성 전환"]}),(0,s.jsxs)("li",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[(0,s.jsx)("strong",{className:"text-zinc-800 dark:text-zinc-200",children:"길게 누른 뒤 드래그"})," — 두 좌석 교환"]})]})]})]})})]})}var Z=n(58652);let T=(e,t)=>{if(0===e)return[];let n="2x3"===t?2:3;if(e<=n)return Array(e).fill(1);let s=Math.ceil(e/n),a=[],r=e;for(let e=0;e<n;e++){let e=Math.min(s,r);a.push(e),r-=e}if(a.length>=2&&a[a.length-1]<=s/2&&a[a.length-1]>0){let e=a.pop();for(let t=0;t<e;t++)a[t%a.length]++}return a.filter(e=>e>0)},R=(e,t,n,s,a)=>{let r=e=>'<div style="height: '.concat(e,"px; line-height: ").concat(e,'px; font-size: 1px; overflow: hidden;">&nbsp;</div>');return a?function(e,t,n,s){let{groupCount:a,seatsPerGroup:r,groupLayout:i}=n,l=T(a,i),c="2x3"===i?2:3,o=Math.ceil(r/c),d=a<=6?55:45,u=a<=6?"12pt":"10pt",x=a<=6?"9pt":"8pt",m=a<=6?"11pt":"9pt",h=Math.max(...l),b=Math.floor(680/h)-20,p=(t,n)=>{let s='<td style="vertical-align: top; padding: 8px;">';s+='<table border="1" cellspacing="0" cellpadding="0" style="width: '.concat(b,"px; border-collapse: collapse; text-align: center; font-family: 'Malgun Gothic', sans-serif;\">")+'<tr><td colspan="'.concat(c,'" style="height: 28px; background-color: #f0f0f0; font-weight: bold; font-size: ').concat(m,';">GROUP ').concat(t+1,"</td></tr>");for(let a=0;a<o;a++){s+="<tr>";for(let i=0;i<c;i++){let l=a*c+i,o=t*r+l,m=l<r&&e[o]||null,h="&nbsp;";if(m){if("nameOnly"===n)h='<span style="font-size: '.concat(u,'; font-weight: bold;">').concat(m.name,"</span>");else{let e=m.number?"".concat(m.number,". "):"";h='<span style="font-size: '.concat(x,';">').concat(e,'</span><span style="font-size: ').concat(u,'; font-weight: bold;">').concat(m.name,"</span>")}}s+='<td style="width: '.concat(Math.floor(b/c),"px; height: ").concat(d,'px; vertical-align: middle; text-align: center;">').concat(h,"</td>")}s+="</tr>"}return s+"</table></td>"},g=e=>{let t="",n=0;for(let s of(t+='<table cellspacing="0" cellpadding="0" style="width: 100%; border-collapse: collapse;">',l)){t+="<tr>";for(let a=0;a<s;a++)t+=p(n++,e);for(let e=s;e<h;e++)t+="<td></td>";t+="</tr>"+'<tr><td colspan="'.concat(h,'" style="height: 16px;"></td></tr>')}return t+"</table>"};return B(t,'\n    <div style="display: block; width: 100%;">\n        '.concat(s(20),"\n        ").concat(g("nameOnly"),'\n    </div>\n\n    <div style="page-break-before: always;"></div>\n\n    <div style="display: block; width: 100%;">\n        ').concat(s(20),"\n        ").concat(g("nameNum"),"\n    </div>\n    "))}(e,s,a,r):function(e,t,n,s,a){let r=[],i=[];for(let s=0;s<t;s++){let t=[];for(let a=0;a<n;a++)t.push(e[s*n+a]);r.push(t)}let l=[...e].reverse();for(let e=0;e<t;e++){let t=[];for(let s=0;s<n;s++)t.push(l[e*n+s]);i.push(t)}let c=e=>"<div style=\"font-size: 13pt; font-weight: bold; margin-bottom: 8px; font-family: 'Malgun Gothic', sans-serif;\">".concat(e,"</div>"),o="<p style=\"margin: 0; font-size: 14pt; line-height: 1.6; font-family: 'Malgun Gothic', sans-serif;\">&nbsp;</p>",d=(e,s)=>{let a='\n        <div style="margin-bottom: 20px;">\n            <table border="1" cellspacing="0" cellpadding="0" style="width: 100%; border-collapse: collapse; text-align: center; font-family: \'Malgun Gothic\', sans-serif;">\n        ';
1return e.forEach(e=>{a+="<tr>",e.forEach(e=>{let r="&nbsp;";if(e){let n=t>8?"11pt":"14pt";if("nameOnly"===s)r='<div style="text-align: center; width: 100%;"><span style="font-size: '.concat(n,'; font-weight: bold;">').concat(e.name,"</span></div>");else{let s=e.number?"".concat(e.number,". "):"";r='<div style="text-align: center; width: 100%;"><span style="font-size: '.concat(t>8?"9pt":"11pt",';">').concat(s,'</span><span style="font-size: ').concat(n,'; font-weight: bold;">').concat(e.name,"</span></div>")}}a+='<td style="width: '.concat(100/n,"%; height: ").concat(60,'px; vertical-align: middle; text-align: center;">').concat(r,"</td>")}),a+="</tr>"}),a+="\n            </table>\n        </div>\n        "};return B(s,'\n    <div style="display: block; width: 100%;">\n        '.concat(a(20),"\n        ").concat(c("1. 선생님 시선 (이름만)"),"\n        ").concat(d(i,"nameOnly"),"\n        ").concat(o,'\n    </div>\n\n    <div style="page-break-before: always;"></div>\n\n    <div style="display: block; width: 100%;">\n        ').concat(a(20),"\n        ").concat(c("2. 학생 시선 (이름만)"),"\n        ").concat(d(r,"nameOnly"),"\n        ").concat(o,'\n    </div>\n\n    <div style="page-break-before: always;"></div>\n\n    <div style="display: block; width: 100%;">\n        ').concat(a(20),"\n        ").concat(c("3. 선생님 시선 (번호&이름)"),"\n        ").concat(d(i,"nameNum"),"\n        ").concat(o,'\n    </div>\n\n    <div style="page-break-before: always;"></div>\n\n    <div style="display: block; width: 100%;">\n        ').concat(a(20),"\n        ").concat(c("4. 학생 시선 (번호&이름)"),"\n        ").concat(d(r,"nameNum"),"\n        ").concat(o,"\n    </div>\n    "))}(e,t,n,s,r)};function B(e,t){return'\n<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n<title>'.concat(e," 자리 배치표</title>\n<style>\n    @page { margin: 15mm; size: A4 portrait; }\n    body { margin: 0; padding: 0; font-family: 'Malgun Gothic', sans-serif; }\n</style>\n</head>\n<body>\n    ").concat(t,"\n    ").concat((0,Z.mv)(),"\n</body>\n</html>\n    ")}var F=n(67920),G=n(4908),O=n(54696),P=n(64954),X=n(96214),W=n(83008);let U=e=>"guest-absent-".concat(e),q=(e,t)=>{let n=e.find(e=>(null==e?void 0:e.type)==="absent"&&e.id===U(t));return Array.isArray(null==n?void 0:n.studentIds)?n.studentIds:[]},Y=e=>{let{label:t,value:n,min:a,max:r,onChange:i}=e;return(0,s.jsxs)("div",{className:"flex items-center justify-between bg-black/20 p-2 rounded-lg border border-white/5",children:[(0,s.jsx)("span",{className:"text-sm text-[#B4B4B4] pl-1 seating-stepper-label",children:t}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{"aria-label":"".concat(t," 줄이기"),onClick:()=>n>a&&i(n-1),className:"w-6 h-6 rounded bg-[#3A3A3A] hover:bg-[#444] flex items-center justify-center text-white transition-colors disabled:opacity-30",disabled:n<=a,children:(0,s.jsx)(o.Z,{size:12})}),(0,s.jsx)("span",{className:"text-sm font-bold min-w-[20px] text-center seating-stepper-value",children:n}),(0,s.jsx)("button",{"aria-label":"".concat(t," 늘리기"),onClick:()=>n<r&&i(n+1),className:"w-6 h-6 rounded bg-[#3A3A3A] hover:bg-[#444] flex items-center justify-center text-white transition-colors disabled:opacity-30",disabled:n>=r,children:(0,s.jsx)(d.Z,{size:12})})]})]})};function H(){var e,t,n,o;let d=(0,F.XC)(),{showToast:I}=(0,i.pm)(),E=(0,c.useRouter)(),D=(0,O.Dv)(),{students:L,classes:Z,isLoading:T}=(0,G.AF)(),B=(0,l.useRef)(d);B.current=d;let[H,_]=(0,l.useState)(!1),[K,J]=(0,l.useState)(0),V=(0,c.useSearchParams)(),[Q,$]=(0,l.useState)(()=>new URLSearchParams(window.location.search).get("class")||"담임 학급");(0,l.useEffect)(()=>{let e=V.get("class");e&&e!==Q?$(e):e||"담임 학급"===Q||$("담임 학급")},[V,Q]);let ee=e=>{$(e);let t=new URLSearchParams(V.toString());"담임 학급"===e?t.delete("class"):t.set("class",e),E.push("?".concat(t.toString()).concat(window.location.hash),{scroll:!1})},[et,en]=(0,l.useState)("grid"),[es,ea]=(0,l.useState)(5),[er,ei]=(0,l.useState)(6),[el,ec]=(0,l.useState)(6),[eo,ed]=(0,l.useState)("2x3"),[eu,ex]=(0,l.useState)([]),[em,eh]=(0,l.useState)(new Set),eb=(0,l.useRef)(em);(0,l.useEffect)(()=>{eb.current=em},[em]);let[ep,eg]=(0,l.useState)(new Set),ef=(0,l.useRef)(ep);(0,l.useEffect)(()=>{ef.current=ep},[ep]);let[ev,ew]=(0,l.useState)([]),ey=(0,l.useRef)(ev);(0,l.useEffect)(()=>{ey.current=ev},[ev]);let[ej,eN]=(0,l.useState)(null),[ek,ez]=(0,l.useState)(""),[eC,eS]=(0,l.useState)([]),[eA,eI]=(0,l.useState)(!1),eE=(0,l.useRef)(!1),[eD,eL]=(0,l.useState)(!1),[eM,eZ]=(0,l.useState)(!1),[eT,eR]=(0,l.useState)(!1),eB=(0,l.useRef)(!1);(0,l.useEffect)(()=>{let e=eB.current;if(eB.current=eM,e&&!eM){eR(!0);let e=setTimeout(()=>eR(!1),360);return()=>clearTimeout(e)}},[eM]);let[eF,eG]=(0,l.useState)(()=>window.innerWidth<1024),[eO,eP]=(0,l.useState)(!1),[eX,eW]=(0,l.useState)(!1),[eU,eq]=(0,l.useState)(!1),eY=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=()=>
1{eq(!!(document.fullscreenElement||document.webkitFullscreenElement))};return document.addEventListener("fullscreenchange",e),document.addEventListener("webkitfullscreenchange",e),()=>{document.removeEventListener("fullscreenchange",e),document.removeEventListener("webkitfullscreenchange",e)}},[]);let[eH,e_]=(0,l.useState)(1),eK=(0,l.useRef)(null),eJ=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=()=>{let e=eK.current,t=eJ.current;if(!eU||"group"!==et||!e||!t){e_(1);return}let n=e.offsetWidth,s=e.offsetHeight;n&&s&&e_(Math.max(1,Math.min(Math.min(t.clientWidth/n,t.clientHeight/s),2.5)))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[eU,et,el,eo,eu.length]);let eV=async()=>{if(eU)try{let e=document;e.exitFullscreen?await e.exitFullscreen():e.webkitExitFullscreen?await e.webkitExitFullscreen():eq(!1)}catch(e){eq(!1)}else try{let e=eY.current;if(!e)return;e.requestFullscreen?await e.requestFullscreen():e.webkitRequestFullscreen?await e.webkitRequestFullscreen():eq(!0)}catch(e){eq(!0)}},[eQ,e$]=(0,l.useState)(null),[e0,e1]=(0,l.useState)(null),[e2,e5]=(0,l.useState)(null),e4=null!==eQ,[e3,e8]=(0,l.useState)("select"),[e6,e9]=(0,l.useState)([]),[e7,te]=(0,l.useState)(!0);(0,l.useEffect)(()=>{let e=localStorage.getItem("seating-ban-visible");null!==e&&te("true"===e)},[]);let[tt,tn]=(0,l.useState)(new Set),[ts,ta]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=localStorage.getItem("seating-exclude-visible");null!==e&&ta("true"===e)},[]);let[tr,ti]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=localStorage.getItem("seating-show-student-number");null!==e&&ti("true"===e)},[]);let tl=e=>{ti(e),localStorage.setItem("seating-show-student-number",String(e))},[tc,to]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=localStorage.getItem("seating-distribute-evenly");null!==e&&to("true"===e)},[]);let td=e=>{to(e),localStorage.setItem("seating-distribute-evenly",String(e))},tu=e=>{let t=[];return e.classNum&&t.push("".concat(e.classNum,"반")),e.number&&t.push("".concat(e.number,"번")),t.length>0?t.join(" "):""},tx=L.filter(e=>"담임 학급"===Q?"담임 학급"===e.homeClassId:e.homeClassId===Q||Array.isArray(e.customClassIds)&&e.customClassIds.includes(Q)),tm=e=>L.filter(t=>"담임 학급"===e?"담임 학급"===t.homeClassId:t.homeClassId===e||Array.isArray(t.customClassIds)&&t.customClassIds.includes(e)).length,th=()=>0===tx.length?4:Math.ceil(tx.length/Math.max(1,el)),tb=(e,t)=>{if(0===e)return[];let n="2x3"===t?2:3;if(e<=n)return Array(e).fill(1);let s=Math.ceil(e/n),a=[],r=e;for(let e=0;e<n;e++){let e=Math.min(s,r);a.push(e),r-=e}if(a.length>=2&&a[a.length-1]<=s/2&&a[a.length-1]>0){let e=a.pop();for(let t=0;t<e;t++)a[t%a.length]++}return a.filter(e=>e>0)},tp=(0,l.useCallback)(async()=>{if(D){let e=(await (0,X.getGuestData)()).seatConstraints||[];eS(e.filter(e=>"absent"!==e.type).map(e=>({id:e.id,studentAId:e.studentAId,studentBId:e.studentBId,type:e.type}))),tn(new Set(q(e,Q)));return}let e=await (0,W.X)("getSeatConstraints",{classId:Q},d);if(e.success&&e.data){var t;let n=e.data;eS(n.filter(e=>"absent"!==e.type).map(e=>({id:e.id,studentAId:e.studentIds[0]||"",studentBId:e.studentIds[1]||"",type:e.type}))),tn(new Set((null===(t=n.find(e=>"absent"===e.type))||void 0===t?void 0:t.studentIds)||[]))}},[Q,D,d]),[tg,tf]=(0,l.useState)(!0);(0,l.useEffect)(()=>{let e=!1;return tf(!0),(async()=>{var t,n;_(!1);let s=[],a=[];if(D){let t=await (0,X.getGuestData)();if(e)return;let n=t.seatConstraints||[];s=n.filter(e=>"absent"!==e.type).map(e=>({id:e.id,studentAId:e.studentAId,studentBId:e.studentBId,type:e.type})),a=q(n,Q)}else{let n=await (0,r.W)(()=>(0,W.X)("getSeatConstraints",{classId:Q},B.current));if(e)return;if(!n.success)throw Error(n.error);if(n.data){let e=n.data;s=e.filter(e=>"absent"!==e.type).map(e=>({id:e.id,studentAId:e.studentIds[0]||"",studentBId:e.studentIds[1]||"",type:e.type})),a=(null===(t=e.find(e=>"absent"===e.type))||void 0===t?void 0:t.studentIds)||[]}}if(e||(eS(s),tn(new Set(a))),D){let t=await (0,X.getGuestData)();if(e)return;let s=(null===(n=t.seatLayouts)||void 0===n?void 0:n[Q])||null;s?(ex(s.grid||[]),s.rows&&ea(s.rows),s.cols&&ei(s.cols),"group"===et&&s.rows&&ec(s.rows),eh(new Set(s.inactiveSeats||[])),eg(new Set(s.lockedSeats||[])),ew(s.groupNames||[])):("grid"===et?(ea(5),ei(6)):ec(6),ex([]),eh(new Set),eg(new Set),ew([]))}else{let t=await (0,r.W)(()=>(0,W.X)("getSeatLayout",{classId:Q,mode:et},B.current));if(e)return;if(t.success&&t.data){let e=t.data;ex(e.grid||[]),e.rows&&ea(e.rows),e.cols&&ei(e.cols),"group"===et&&e.rows&&ec(e.rows),eh(new Set(e.inactiveSeats||[])),eg(new Set(e.lockedSeats||[])),ew(e.groupNames||[])}else t.success?("grid"===et?(ea(5),ei(6)):ec(6),ex([]),eh(new Set),eg(new Set),ew([])):_(!0)}})().catch(()=>{e||_(!0)}).finally(()=>{e||tf(!1)}),()=>{e=!0}},[Q,et,D,K]);let tv=(0,l.useRef)(et);(0,l.useEffect)(()=>{let e=tv.current!==et;tv.current=et;let t=th(),n="grid"===et?es*er:el*t;ex(t=>{if(t.length===n)return t;let s=Array(n).fill(null);for(let e=0;e<Math.min(t.length,n);e++)s[e]=t[e];return t.length>0&&!e&&tw(eb.current,s),s})},[es,er,el,et]);let tw=async(e,t,n,s)=>{if(tg||H)return;let a=null!=n?n:ef.current,r=null!=s?s:ey.current;if(D){let n=(await (0,X.getGuestData)()).seatLayouts||{};n[Q]={rows:"grid"===et?es:el,cols:"grid"===et?er:0,grid:t,inactiveSeats:Array.from(e),lockedSeats:Array.from(a),groupNames:r},(0,X.saveGuestData)("seatLayouts",n);return}let i={classId:Q,mode:et,rows:"grid"===et?es:el,cols:"grid"===et?er:0,grid:t,inactiveSeats:Array.from(e),lockedSeats:Array.from(a),groupNames:r};await (0,W.X)("saveSeatLayout",i,d)},ty=async e=>{let t=new Set(em);t.has(e)?t.delete(e):t.add(e),eh(t),await tw(t,eu)},tj=e=>{(!eu[e]||em.has(e))&&ty(e)},tN=async()=>
1{if(!eE.current){eE.current=!0,eI(!0),eL(!0),window.setTimeout(()=>eL(!1),450),eZ(!0),window.setTimeout(()=>eZ(!1),1500);try{if(D){await new Promise(e=>setTimeout(e,800));let e=th(),t="grid"===et?es*er:el*e,n="담임 학급"!==Q&&tc,s=new Set,a=Array(t).fill(null);Array.from(ep).forEach(e=>{if(e<0||e>=t||em.has(e))return;let n=eu[e];!n||tt.has(n.id)||(a[e]=n,s.add(n.id))});let r=[];for(let e=0;e<t;e++)em.has(e)||ep.has(e)||r.push(e);let i=tx.filter(e=>!s.has(e.id)&&!tt.has(e.id));if(r.length<i.length){I("자리가 부족합니다. (배치할 학생: ".concat(i.length,"명, 빈 자리: ").concat(r.length,"개)"),"error");return}let l=eC.filter(e=>e.studentAId&&e.studentBId&&"absent"!==e.type),c=t=>{for(let n of l){let s=t.findIndex(e=>(null==e?void 0:e.id)===n.studentAId),a=t.findIndex(e=>(null==e?void 0:e.id)===n.studentBId);if(!(s<0)&&!(a<0)){if("grid"===et){let e=Math.floor(s/er),t=s%er,n=Math.floor(a/er),r=a%er;if(e===n&&1===Math.abs(t-r))return!0}else if(Math.floor(s/e)===Math.floor(a/e))return!0}}return!1},o=e=>{let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}if(!n)return t;let s=new Map;for(let e of t){let t=e.classNum?"".concat(e.classNum,"반"):e.homeClassId||"default";s.has(t)||s.set(t,[]),s.get(t).push(e)}let a=Array.from(s.keys());for(let e=a.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[a[e],a[t]]=[a[t],a[e]]}let r=[],i=!0,l=0;for(;i;){for(let e of(i=!1,a)){let t=s.get(e);l<t.length&&(r.push(t[l]),i=!0)}l++}return r},d=null,u=l.length>0?200:1;for(let e=0;e<u;e++){let e=o(i),t=[...a];if(e.forEach((e,n)=>{t[r[n]]=e}),!c(t)){d=t;break}}if(!d){I("짝꿍 금지를 지키면서 배치하지 못했습니다. 금지를 줄이거나 다시 시도해 주세요.","error");return}ex(d),await tw(em,d);return}let e="grid"===et?{classId:Q,rows:es,cols:er,inactiveSeats:Array.from(em),lockedSeats:Array.from(ep),respectConstraints:!0,distributeEvenlyByClass:"담임 학급"!==Q&&tc,mode:"grid"}:{classId:Q,rows:el,cols:th(),inactiveSeats:Array.from(em),lockedSeats:Array.from(ep),respectConstraints:!0,distributeEvenlyByClass:"담임 학급"!==Q&&tc,mode:"group"},t=await (0,W.X)("shuffleSeats",e,d);t.success?ex(t.data.seats):I(t.error||"요청을 처리하지 못했습니다.","error")}finally{eE.current=!1,eI(!1)}}},tk=async(e,t)=>{if(t.stopPropagation(),em.has(e)||!eu[e])return;let n=new Set(ep);n.has(e)?n.delete(e):n.add(e),eg(n),await tw(em,eu,n)},tz=async e=>{let t=new Set(tt);t.has(e)?t.delete(e):t.add(e),tn(t);let n=Array.from(t);if(D){let e=await (0,X.getGuestData)(),t=U(Q),s=(e.seatConstraints||[]).filter(e=>e.id!==t);n.length>0&&s.push({id:t,type:"absent",classId:Q,studentIds:n}),(0,X.saveGuestData)("seatConstraints",s);return}await (0,W.X)("setAbsentStudents",{classId:Q,studentIds:n},d)},tC=e=>{e9(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e].slice(-2))},tS=async()=>{if(2!==e6.length)return;let[e,t]=e6;if(D){let n=(await (0,X.getGuestData)()).seatConstraints||[];if(!n.some(n=>n.studentAId===e&&n.studentBId===t||n.studentAId===t&&n.studentBId===e)){let s={id:"guest-constraint-".concat(Date.now()),studentAId:e,studentBId:t,type:"ban"};(0,X.saveGuestData)("seatConstraints",[...n,s]),await tp(),e9([]),e8("list")}return}let n=await (0,W.X)("addForbiddenPair",{classId:Q,studentAId:e,studentBId:t},d);n.success?(await tp(),e9([]),e8("list")):I(n.error||"요청을 처리하지 못했습니다.","error")},tA=(0,l.useCallback)(async(e,t)=>{if(D){let n=(await (0,X.getGuestData)()).seatConstraints||[];if(!n.some(n=>n.studentAId===e&&n.studentBId===t||n.studentAId===t&&n.studentBId===e)){let s={id:"guest-constraint-".concat(Date.now()),studentAId:e,studentBId:t,type:"ban"};(0,X.saveGuestData)("seatConstraints",[...n,s]),await tp()}return}(await (0,W.X)("addForbiddenPair",{classId:Q,studentAId:e,studentBId:t},d)).success&&await tp()},[D,d,tp,Q]),tI=async e=>{if(D){let t=((await (0,X.getGuestData)()).seatConstraints||[]).filter(t=>t.id!==e);(0,X.saveGuestData)("seatConstraints",t),await tp();return}let t=await (0,W.X)("removeConstraint",{constraintId:e},d);t.success?await tp():I(t.error||"요청을 처리하지 못했습니다.","error")},tE=async(e,t)=>{if(e===t||em.has(e)||em.has(t))return;let n=[...eu];[n[e],n[t]]=[n[t],n[e]],ex(n),await tw(em,n)},tD=(e,t)=>{if(em.has(t)||!eu[t]||eA){e.preventDefault();return}e$(t),e5(null),e.dataTransfer.effectAllowed="move";let n=e.currentTarget,s=n.cloneNode(!0);s.id="drag-ghost-clone",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px";let a=n.getBoundingClientRect();s.style.width="".concat(a.width,"px"),s.style.height="".concat(a.height,"px"),s.classList.remove("hover:ring-2","hover:scale-[1.02]","cursor-grab"),s.classList.add("shadow-2xl","ring-2","ring-blue-500","opacity-90"),eX&&s.querySelectorAll(".rotate-180").forEach(e
1=>e.classList.remove("rotate-180")),document.body.appendChild(s),e.dataTransfer.setDragImage(s,a.width/2,a.height/2),setTimeout(()=>{s.parentNode&&s.parentNode.removeChild(s)},0)},tL=(e,t)=>{e.preventDefault(),null===eQ||eQ===t||em.has(t)||(e.dataTransfer.dropEffect="move",e1(t))},tM=()=>{e1(null)},tZ=async(e,t)=>{e.preventDefault(),null===eQ||eQ===t||em.has(t)||await tE(eQ,t),e1(null),setTimeout(()=>e$(null),50)},tT=()=>{e1(null),setTimeout(()=>e$(null),50)};return tg||T&&0===L.length?(0,s.jsx)(a.ContentLoadingState,{variant:"zones",label:"좌석 배치를 불러오고 있어요"}):(0,s.jsxs)("div",{className:"flex h-full overflow-hidden bg-[#0D0D0D] print:overflow-visible print:h-auto print:bg-white relative",children:[H&&(0,s.jsxs)("div",{className:"seating-load-error absolute inset-0 z-[60] flex flex-col items-center justify-center bg-[#0D0D0D]/95 backdrop-blur-sm p-8 text-center print:hidden",children:[(0,s.jsx)(u.Z,{className:"w-12 h-12 text-red-400 mb-3 opacity-80"}),(0,s.jsx)("p",{className:"seating-load-error-title text-white text-[15px] font-medium mb-1",children:"자리 배치를 불러오지 못했습니다"}),(0,s.jsx)("p",{className:"seating-load-error-desc text-[#888] text-[13px] mb-6 max-w-xs",children:"네트워크 상태를 확인한 뒤 다시 시도해 주세요. 문제가 계속되면 페이지를 새로고침해 주세요."}),(0,s.jsxs)("button",{onClick:()=>{_(!1),J(e=>e+1)},className:"seating-load-error-retry flex items-center gap-2 px-5 py-2.5 bg-white/10 hover:bg-white/20 text-white rounded-full font-medium text-[14px] transition-colors active:scale-95",children:[(0,s.jsx)(x.Z,{size:16,strokeWidth:2}),(0,s.jsx)("span",{children:"다시 시도"})]})]}),(0,s.jsx)("div",{className:"absolute inset-0 z-50 md:hidden w-full h-full bg-[#FBFBF9] dark:bg-zinc-950",children:(0,s.jsx)(M,{students:tx,seats:eu,inactiveSeats:em,cols:er,rows:e
1s,mode:et,groupCount:el,groupLayout:eo,isRotated:eX,isShuffling:eA,onSwap:tE,onToggleStatus:ty,onShuffle:tN,onRotate:()=>eW(e=>!e),onChangeMode:en,onChangeRows:ea,onChangeCols:ei,onChangeGroupCount:ec,onChangeGroupLayout:ed,constraints:eC,onAddBan:tA,onRemoveBan:tI,selectedClass:Q,classList:Z,onSelectClass:ee,lockedSeats:ep,onToggleLock:tk,showStudentNumber:tr,onToggleShowStudentNumber:tl,distributeEvenlyByClass:tc,onToggleDistributeEvenlyByClass:td})}),(0,s.jsxs)("div",{className:(0,S.cn)("flex flex-col border-r transition-all duration-500 relative z-20 print:hidden overflow-hidden ease-[cubic-bezier(0.4,0,0.2,1)] seating-sidebar nav-rail-shadow sub-sidebar-enter",eF?"w-[4.5rem] bg-[#0D0D0D] border-none":"w-64 h-full bg-[#121212] border-white/5"),children:[(0,s.jsx)("button",{onClick:()=>eG(!eF),onMouseDown:e=>e.preventDefault(),className:(0,S.cn)("absolute top-3 flex items-center justify-center w-10 h-10 rounded-lg text-[#71717a] hover:text-white hover:bg-white/5 transition-all duration-500 ease-[cubic-bezier(0.4,0,0.2,1)] z-50",eF?"right-4 active:scale-95":"right-1.5"),title:eF?"메뉴 펼치기":"메뉴 접기",children:eF?(0,s.jsx)(m.Z,{size:18}):(0,s.jsx)(h.Z,{size:18})}),!eF&&(0,s.jsxs)("div",{className:"flex flex-col flex-1 overflow-hidden px-3 pb-5 pt-7 gap-6 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsx)("h3",{className:"text-sm font-bold text-[#888] mb-3 seating-section-label",children:"학급 선택"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("select",{value:Q,onChange:e=>ee(e.target.value),className:"w-full bg-[#1A1A1A] border border-white/10 rounded-xl px-3 py-2.5 text-sm text-white appearance-none focus:outline-none focus:ring-0 focus:border-white/10 transition cursor-pointer hover:bg-[#222] seating-class-select",children:Z.map(e=>(0,s.jsxs)("option",{value:e,children:[e," (",tm(e),"명)"]},e))}),(0,s.jsx)(b.Z,{className:"absolute right-4 top-1/2 -translate-y-1/2 text-white/30 pointer-events-none",size:16})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-bold text-[#888] mb-3 seating-section-label",children:"배열 방식"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2 mb-4",children:[(0,s.jsx)("button",{onClick:()=>en("grid"),className:(0,S.cn)("py-1.5 rounded-lg text-sm font-bold transition duration-200 border seating-layout-toggle","grid"===et?"border-white/20 bg-white/10 text-white":"bg-[#1A1A1A] border-white/5 text-[#666] hover:bg-[#222] hover:text-white"),children:"기본"}),(0,s.jsx)("button",{onClick:()=>en("group"),className:(0,S.cn)("py-1.5 rounded-lg text-sm font-bold transition duration-200 border seating-layout-toggle","group"===et?"border-white/20 bg-white/10 text-white":"bg-[#1A1A1A] border-white/5 text-[#666] hover:bg-[#222] hover:text-white"),children:"모둠"})]}),"grid"===et?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(Y,{label:"행",value:es,min:1,max:12,onChange:ea}),(0,s.jsx)(Y,{label:"열",value:er,min:1,max:12,onChange:ei})]}):(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(Y,{label:"모둠 수",value:el,min:2,max:12,onChange:ec}),(0,s.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,s.jsx)("button",{onClick:()=>ed("2x3"),className:(0,S.cn)("flex-1 py-1.5 text-sm font-medium rounded-lg border transition-colors seating-group-layout-btn","2x3"===eo?"border-white/20 bg-white/10 text-white":"border-white/5 bg-[#1A1A1A] text-[#666]"),children:"2xN"}),(0,s.jsx)("button",{onClick:()=>ed("3x2"),className:(0,S.cn)("flex-1 py-1.5 text-sm font-medium rounded-lg border transition-colors seating-group-layout-btn","3x2"===eo?"border-white/20 bg-white/10 text-white":"border-white/5 bg-[#1A1A1A] text-[#666]"),children:"3xN"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-bold text-[#888] mb-3 seating-section-label",children:"상세 설정"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"flex items-center gap-2.5 text-sm text-[var(--text-primary)] cursor-pointer select-none py-0.5",children:[(0,s.jsx)("input",{type:"checkbox",checked:tr,onChange:e=>tl(e.target.checked),className:"cursor-pointer"}),(0,s.jsx)("span",{className:"font-medium text-sm",children:"반 번호 표시"})]}),(0,s.jsxs)("label",{className:(0,S.cn)("flex items-center gap-2.5 text-sm text-[var(--text-primary)] select-none py-0.5","담임 학급"===Q?"opacity-40 cursor-not-allowed":"cursor-pointer"),title:"담임 학급"===Q?"담임 학급은 반이 하나뿐이라 사용할 수 없습니다":"교과 학급에서 여러 반 학생들이 특정 줄이나 모둠에 몰리지 않도록 고르게 분산 배치합니다",children:[(0,s.jsx)("input",{type:"checkbox",checked:"담임 학급"!==Q&&tc,disabled:"담임 학급"===Q,onChange:e=>td(e.target.checked),className:"cursor-pointer disabled:!cursor-not-allowed"}),(0,s.jsx)("span",{className:"font-medium text-sm",children:"반 고르게 분배"})]})]})]}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 gap-3",children:[(0,s.jsxs)("div",{className:(0,S.cn)("flex flex-col min-h-0 transition duration-300",e7?"flex-1":"shrink-0"),children:[(0,s.jsxs)("div",{className:(0,S.cn)("flex items-center justify-between h-8",e7&&"mb-3"),children:[(0,s.jsx)("h3",{className:"text-sm font-bold text-[#888] seating-section-label",children:(0,s.jsxs)("button",{onClick:()=>{let e=!e7;te(e),localStorage.setItem("seating-ban-visible",String(e))},className:"flex items-center gap-1.5 hover:text-white transition-colors",title:e7?"접기":"펼치기","aria-expanded":e7,children:[e7?(0,s.jsx)(b.Z,{size:14}):(0,s.jsx)(p.Z,{size:14}),"짝꿍 금지"]})}),e7&&(0,s.jsx)(A.s,{value:e3,onChange:e8,"aria-label":"짝꿍 금지 보기",className:"seating-ban-tabs bg-[#1A1A1A] rounded-lg p-0.5 border border-white/5",itemClassName:"px-2 py-0.5 text-xs rounded font-medium",activeItem
1ClassName:"text-white",inactiveItemClassName:"text-[#666] hover:text-[#888]",indicatorClassName:"bg-[#333] rounded",options:[{key:"select",label:"선택"},{key:"list",label:"목록"}]})]}),e7&&(0,s.jsx)("div",{className:"flex-1 overflow-y-auto custom-scrollbar -mr-2 pr-2 animate-in fade-in duration-200",children:"select"===e3?(0,s.jsx)("div",{className:"space-y-1.5 pb-4",children:tx.map(e=>{let t=e6.includes(e.id);return(0,s.jsxs)("button",{onClick:()=>tC(e.id),"aria-pressed":t,className:(0,S.cn)("seating-ban-row w-full flex items-center justify-between px-3 py-2 rounded-lg border transition-colors group",t?"bg-red-600/10 border-red-600/50":"bg-[#1A1A1A] border-white/5 hover:bg-[#222] hover:border-white/10"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"text-sm font-medium truncate text-[#CCC] group-hover:text-white transition-colors seating-ban-student-name",children:e.name}),(0,s.jsx)("div",{className:"text-xs font-medium whitespace-nowrap text-[#555] group-hover:text-[#777] transition-colors",children:"담임 학급"!==Q?(0,s.jsxs)(s.Fragment,{children:[e.grade?"".concat(e.grade,"학년 "):"",e.classNum?"".concat(e.classNum,"반 "):"",e.number,"번"]}):"".concat(e.number,"번")})]}),t&&(0,s.jsx)(g.Z,{size:14,className:"text-red-600 shrink-0"})]},e.id)})}):(0,s.jsx)("div",{className:"space-y-2 pb-4",children:0===eC.length?(0,s.jsx)(P.Z,{size:"sm",title:"금지한 짝꿍이 없습니다",description:"‘선택’에서 두 학생을 고르면 짝꿍 금지 조건을 등록할 수 있습니다."}):eC.map(e=>{let t=tx.find(t=>t.id===e.studentAId),n=tx.find(t=>t.id===e.studentBId);return t||n?(0,s.jsxs)("div",{className:"flex items-center justify-between p-2.5 bg-[#1A1A1A] border border-white/5 rounded-lg group",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,s.jsx)("span",{className:"text-[#CCC]",children:(null==t?void 0:t.name)||"?"}),(0,s.jsx)(f.Z,{size:10,className:"text-red-600 opacity-50"}),(0,s.jsx)("span",{className:"text-[#CCC]",children:(null==n?void 0:n.name)||"?"})]}),(0,s.jsx)("button",{"aria-label":"삭제",onClick:()=>tI(e.id),className:"text-[#555] hover:text-red-600 transition-colors",children:(0,s.jsx)(v.Z,{size:12})})]},e.id):null})})}),e7&&"select"===e3&&2===e6.length&&(0,s.jsx)("div",{className:"pt-3 animate-in fade-in duration-200",children:(0,s.jsx)("button",{onClick:tS,className:"seating-ban-register-btn w-full py-2.5 bg-black hover:bg-[#1a1a1a] border border-white/15 text-white rounded-lg font-medium text-sm transition-colors truncate px-3",children:"".concat(null!==(n=null===(e=tx.find(e=>e.id===e6[0]))||void 0===e?void 0:e.name)&&void 0!==n?n:""," \xb7 ").concat(null!==(o=null===(t=tx.find(e=>e.id===e6[1]))||void 0===t?void 0:t.name)&&void 0!==o?o:""," 짝꿍 금지하기")})})]}),(0,s.jsxs)("div",{className:(0,S.cn)("flex flex-col min-h-0 transition duration-300",ts?"flex-1":"shrink-0"),children:[(0,s.jsx)("div",{className:(0,S.cn)("flex items-center justify-between h-8",ts&&"mb-1"),children:(0,s.jsx)("h3",{className:"text-sm font-bold text-[#888] seating-section-label",children:(0,s.jsxs)("button",{onClick:()=>{let e=!ts;ta(e),localStorage.setItem("seating-exclude-visible",String(e))},className:"flex items-center gap-1.5 hover:text-white transition-colors",title:ts?"접기":"펼치기","aria-expanded":ts,children:[ts?(0,s.jsx)(b.Z,{size:14}):(0,s.jsx)(p.Z,{size:14}),"결석자 제외"]})})}),ts&&(0,s.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 animate-in fade-in duration-200",children:[(0,s.jsx)("p",{className:"text-xs text-[#555] mb-2 leading-relaxed shrink-0",children:"자리를 섞을 때 제외됩니다."}),(0,s.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar -mr-2 pr-2 space-y-1.5 pb-4",children:0===tx.length?(0,s.jsx)("div",{className:"py-8 text-center",children:(0,s.jsx)("p",{className:"text-sm text-[#888]",children:"학생이 없습니다"})}):tx.map(e=>{let t=tt.has(e.id);return(0,s.jsxs)("button",{onClick:()=>tz(e.id),"aria-pressed":t,className:(0,S.cn)("seating-exclude-row w-full flex items-center justify-between px-3 py-2 rounded-lg border transition-colors group",t?"bg-red-600/10 border-red-600/50":"bg-[#1A1A1A] border-white/5 hover:bg-[#222] hover:border-white/10"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"text-sm font-medium truncate text-[#CCC] group-hover:text-white transition-colors seating-exclude-student-name",children:e.name}),(0,s.jsx)("div",{className:"text-xs font-medium whitespace-nowrap text-[#555] group-hover:text-[#777] transition-colors",children:"담임 학급"!==Q?(0,s.jsxs)(s.Fragment,{children:[e.grade?"".concat(e.grade,"학년 "):"",e.classNum?"".concat(e.classNum,"반 "):"",e.number,"번"]}):"".concat(e.number,"번")})]}),t&&(0,s.jsx)(g.Z,{size:14,className:"text-red-600 shrink-0"})]},e.id)})})]})]})]})]})]}),(0,s.jsxs)("div",{ref:eY,className:(0,S.cn)("flex-1 overflow-y-auto custom-scrollbar flex flex-col bg-[#0D0D0D] print:overflow-visible print:h-auto",eU&&"absolute inset-0 z-[9999]"),children:[(0,s.jsx)("div",{className:(0,S.cn)("py-1 flex items-center justify-start shrink-0 transition-all duration-500",eF?"pl-2":"px-6"),children:(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 print:hidden [&>button]:whitespace-nowrap",children:[(0,s.jsxs)("button",{onClick:tN,disabled:eA||0===L.length,className:"h-10 px-3.5 rounded-lg bg-blue-600 hover:bg-blue-500 border border-blue-500/50 text-white transition-all flex items-center justify-center gap-1.5 text-sm font-medium hover:shadow-xl active:scale-95 disabled:opacity-30 hover:ring-2 hover:ring-blue-400/30 shuffle-seats-btn",title:"자리 섞기",children:[(0,s.jsx)(w.Z,{size:18,className:(0,S.cn)("text-white",eD&&"animate-shuffle-shake")}),(0,s.jsx)("span",{children:"자리 섞기"})]}),(0,s.jsxs)("button",{onClick:()=>eW(e=>!e),className:(0,S.cn)("seating-rotate-btn h-10 px-3.5 rounded-lg border transition flex items-center justify-center gap-1.5 text-sm font-medium shadow-lg hover:shadow-xl active:scale-95 hover:ring-2",eX?"bg-green-600 hover:bg-green-500 border-green-500/50 text-white shadow-green-900/20 hover:ring-green-400/30":"bg-[#2A2A2A] hover:bg-[#333] border-white/10 text-white/70 hover:text-white shadow-black/20 hover:ring-white/20"),title:"구조 변경 (180도 회전)",children:[(0,s.jsx)(y.Z,{size:18,className:(0,S.cn)("transition-transform",eX&&"rotate-180")}
1),(0,s.jsx)("span",{children:"회전"})]}),(0,s.jsxs)("button",{onClick:()=>{let e;if("group"===et){let t=th(),n=el*t,s=eu;eu.length<n?s=[...eu,...Array(n-eu.length).fill(null)]:eu.length>n&&(s=eu.slice(0,n)),e=R(s,0,0,Q,{groupCount:el,seatsPerGroup:t,groupLayout:eo})}else{let t=es*er,n=eu;eu.length<t?n=[...eu,...Array(t-eu.length).fill(null)]:eu.length>t&&(n=eu.slice(0,t)),e=R(n,es,er,Q)}let t=new Blob([e],{type:"application/hwp"}),n=URL.createObjectURL(t),s=document.createElement("a");s.href=n,s.download="".concat(Q,"_자리 배치.hwp"),document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(n)},className:"h-10 px-3.5 rounded-lg bg-[#2A2A2A] hover:bg-[#333] border border-white/10 text-white/70 hover:text-white transition flex items-center justify-center gap-1.5 text-sm font-medium hover:shadow-xl active:scale-95",title:"한글 파일 다운로드",children:[(0,s.jsx)(j.Z,{size:18}),(0,s.jsx)("span",{children:"한글"})]}),(0,s.jsxs)("button",{onClick:eV,className:"h-10 px-3.5 rounded-lg bg-[#2A2A2A] hover:bg-[#333] border border-white/10 text-white/70 hover:text-white transition-all flex items-center justify-center gap-1.5 text-sm font-medium hover:shadow-xl active:scale-95",title:eU?"전체화면 끄기":"전체화면으로 크게 보기",children:[eU?(0,s.jsx)(N.Z,{size:18}):(0,s.jsx)(k.Z,{size:18}),(0,s.jsx)("span",{children:eU?"전체화면 끄기":"전체화면"})]})]})}),(0,s.jsx)("div",{className:(0,S.cn)("flex-1 flex items-center justify-center",eU?"p-6":"p-4 lg:p-8"),children:(0,s.jsx)("div",{className:(0,S.cn)("w-full h-full rounded-xl p-2 flex items-center justify-center",eU?"max-w-none":"max-w-[1400px]"),children:(0,s.jsxs)("div",{className:(0,S.cn)("w-full h-full flex flex-col transition-transform duration-500",eX&&"rotate-180"),style:{transformOrigin:"center center"},children:[(0,s.jsx)("div",{className:(0,S.cn)("self-center bg-[#2A2A2A] text-[#EEE] rounded-lg text-center font-bold border border-white/5 shrink-0 shadow-lg tracking-widest bg-opacity-90 backdrop-blur-sm z-10 transition-transform duration-500 mb-4 seating-blackboard-text",eU?"w-[900px] max-w-full py-4 text-xl":"w-[600px] max-w-full py-3 text-base",eX&&"rotate-180"),children:"칠판"}),(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center overflow-visible p-2",children:"grid"===et?(0,s.jsx)("div",{className:"grid gap-2 lg:gap-3 transition-all duration-300 w-full h-full",style:{gridTemplateColumns:"repeat(".concat(er,", minmax(3.25rem, 1fr))"),gridTemplateRows:"repeat(".concat(es,", minmax(0, 1fr))")},children:Array.from({length:es*er}).map((e,t)=>{let n=em.has(t),a=eu[t];return(0,s.jsxs)("div",{onClick:()=>tj(t),onDoubleClick:()=>ty(t),role:"button",tabIndex:0,"aria-label":n?"".concat(t+1,"번 자리 (사용 안 함)"):a?"".concat(t+1,"번 자리, ").concat(a.name):"".concat(t+1,"번 자리 (빈자리)"),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),ty(t))},onMouseEnter:()=>e5(t),onMouseLeave:()=>e5(null),draggable:!n&&!!a&&!eA,onDragStart:e=>tD(e,t),onDragOver:e=>tL(e,t),onDragLeave:tM,onDrop:e=>tZ(e,t),onDragEnd:tT,className:(0,S.cn)("group w-full h-full rounded-xl border flex flex-col items-center justify-center relative transition select-none duration-200",n?"opacity-20 border-dashed border-white/10 bg-transparent":"bg-[#252525] border-white/5 shadow-black/20 shadow-lg",!n&&!a&&"hover:bg-[#2A2A2A]",n&&"bg-red-600/5 border-red-600/30 opacity-100 print:opacity-20 print:bg-transparent print:border-white/10",eM&&!n&&"animate-shuffle-jitter !border-black seating-desk-shaking",!e4&&"curs
1or-pointer hover:ring-2 hover:ring-red-500/50 hover:scale-[1.02]",!e4&&!n&&!!a&&!eA&&"cursor-grab",eQ===t&&"opacity-40 scale-95 ring-2 ring-blue-500 cursor-grabbing",e0===t&&!n&&eQ!==t&&"ring-2 ring-green-400 scale-105 bg-green-500/10",e4&&eQ!==t&&!n&&"cursor-pointer hover:ring-2 hover:ring-green-400/50"),children:[!n&&(0,s.jsx)("span",{className:(0,S.cn)("absolute top-2.5 left-2.5 text-white/10 font-mono transition-transform duration-500",eU?"text-base":"text-xs",eX&&"rotate-180"),children:t+1}),!n&&a&&(0,s.jsx)("button",{onClick:e=>tk(t,e),className:(0,S.cn)("absolute p-1 rounded transition-all z-20",eX?"bottom-0.5 left-0.5 rotate-180":"top-0.5 right-0.5",ep.has(t)?"text-amber-400 opacity-100":"text-zinc-500/50 hover:text-amber-400 opacity-0 group-hover:opacity-100"),title:ep.has(t)?"자리 고정 해제":"자리 고정",children:ep.has(t)?(0,s.jsx)(z.Z,{size:14}):(0,s.jsx)(C.Z,{size:14})}),!n&&a?(0,s.jsxs)("div",{className:(0,S.cn)("transition-transform relative z-10 w-full text-center flex flex-col items-center justify-center px-1",eX&&"rotate-180"),children:[tr&&(0,s.jsx)("span",{className:(0,S.cn)("font-medium text-white/50 leading-none select-none seating-desk-student-number truncate max-w-full",eU?"text-base md:text-lg lg:text-xl mb-1.5":"text-xs mb-1",eM?"opacity-0":eT&&"animate-snap-in"),children:tu(a)}),(0,s.jsx)("div",{className:(0,S.cn)("font-bold text-white tracking-tight seating-desk-student-name w-full truncate",eU?"text-[clamp(1.5rem,2.5vw,3.25rem)]":"text-base lg:text-lg"),children:(0,s.jsx)("span",{className:(0,S.cn)("inline-block",eM?"opacity-0":eT&&"animate-snap-in"),children:a.name})})]}):!n&&(0,s.jsx)("span",{className:(0,S.cn)("text-white/10 font-medium transition-transform duration-500",eU?"text-xl":"text-sm",eX&&"rotate-180"),children:"빈 자리"}),!e4&&(0,s.jsx)("div",{className:(0,S.cn)("absolute inset-0 flex items-center justify-center transition-all duration-300 print:hidden pointer-events-none z-10",n?"text-red-600 opacity-100 scale-100":e2!==t||ep.has(t)?"opacity-0 scale-90":"opacity-20 scale-100"),children:n?(0,s.jsx)(f.Z,{size:40,strokeWidth:1.5}):(0,s.jsx)(f.Z,{size:65,className:"text-white/20",strokeWidth:1.5})})]},t)})}):(()=>{let e=tb(el,eo),t=el<=4?"1.5rem":el<=6?"1rem":el<=9?"0.75rem":el<=15?"0.5rem":"0.375rem",n=el<=4?"1.5rem":el<=6?"1rem":el<=9?"0.75rem":el<=15?"0.5rem":"0.375rem",a=0;return(0,s.jsx)("div",{ref:eJ,className:"w-full h-full flex items-center justify-center overflow-hidden",children:(0,s.jsx)("div",{ref:eK,className:"flex flex-col justify-center items-center shrink-0",style:{gap:t,transform:1!==eH?"scale(".concat(eH,")"):void 0,transformOrigin:"center center"},children:e.map((e,t)=>(0,s.jsx)("div",{className:"flex justify-center",style:{gap:n},children:Array.from({length:e}).map(()=>
1{let e=a++,t="2x3"===eo?2:3,n=th(),r=el<=4?"w-32":el<=6?"w-24":el<=9?"w-20":el<=12?"w-16":el<=15?"w-14":"w-12",i=el<=4?"h-24":el<=6?"h-20":el<=9?"h-16":el<=12?"h-14":el<=15?"h-12":"h-10",l=el<=4?"p-5":el<=6?"p-4":el<=9?"p-3":el<=15?"p-2":"p-1.5",c=el<=4?"text-xl":el<=6?"text-lg":el<=9?"text-base":el<=15?"text-xs":"text-[10px]",o=el<=6?"text-sm":el<=15?"text-xs":"text-[10px]";return(0,s.jsxs)("div",{className:(0,S.cn)("border flex flex-col items-center shadow-2xl transition hover:-translate-y-1 hover:shadow-black/40","border-white/10 bg-[#1E1E1E] text-white/90",l,el<=6?"gap-2":"gap-1.5",el<=9?"rounded-[2rem]":"rounded-[1.5rem]"),children:[(0,s.jsx)("div",{className:(0,S.cn)("font-bold tracking-[0.1em] opacity-60 border-b border-white/5 w-full text-center transition-transform duration-500",o,el<=9?"pb-1.5":"pb-1",eX&&"rotate-180"),children:ej===e?(0,s.jsx)("input",{type:"text",autoFocus:!0,value:ek,onChange:e=>ez(e.target.value),onBlur:()=>{let t=[...ev];for(;t.length<=e;)t.push("");t[e]=ek.trim(),ew(t),eN(null),tw(em,eu,void 0,t)},onKeyDown:e=>{"Enter"===e.key&&e.target.blur(),"Escape"===e.key&&eN(null)},className:(0,S.cn)("bg-transparent text-center w-full outline-none border-b border-white/30 focus:border-white/60 opacity-100",o),maxLength:20}):(0,s.jsx)("span",{className:"cursor-pointer hover:opacity-100 transition-opacity print:cursor-default",onClick:t=>{t.stopPropagation(),eN(e),ez(ev[e]||"".concat(e+1,"모둠"))},children:ev[e]||"".concat(e+1,"모둠")})}),(0,s.jsx)("div",{className:"grid",style:{gridTemplateColumns:"repeat(".concat(t,", 1fr)"),gap:el<=6?"0.75rem":el<=9?"0.5rem":"0.375rem"},children:Array.from({length:n}).map((t,a)=>{let l=e*n+a,o=em.has(l),d=eu[l];return(0,s.jsxs)("div",{onClick:()=>tj(l),onDoubleClick:()=>ty(l),onMouseEnter:()=>e5(l),onMouseLeave:()=>e5(null),draggable:!o&&!!d&&!eA,onDragStart:e=>tD(e,l),onDragOver:e=>tL(e,l),onDragLeave:tM,onDrop:e=>tZ(e,l),onDragEnd:tT,className:(0,S.cn)("group/seat border flex flex-col items-center justify-center relative transition select-none shadow-md",el<=9?"rounded-xl":"rounded-lg",r,i,o?"opacity-100 border-dashed border-red-600/30 bg-red-600/5 shadow-none print:opacity-20 print:bg-transparent print:border-white/10":"bg-white/5 border-white/5",!o&&!e4&&"cursor-pointer hover:ring-2 hover:ring-white/50 hover:bg-white/10",eM&&!o&&"animate-shuffle-jitter !border-black seating-desk-shaking",!e4&&!o&&!!d&&!eA&&"cursor-grab",eQ===l&&"opacity-40 scale-95 ring-2 ring-blue-500 cursor-grabbing",e0===l&&!o&&eQ!==l&&"ring-2 ring-green-400 scale-105 bg-green-500/10",e4&&eQ!==l&&!o&&"cursor-pointer hover:ring-2 hover:ring-green-400/50"),children:[!o&&d&&(0,s.jsx)("button",{onClick:e=>tk(l,e),className:(0,S.cn)("absolute p-1 rounded transition-colors z-20",eX?"bottom-0.5 left-0.5 rotate-180":"top-0.5 right-0.5",ep.has(l)?"text-amber-400 opacity-100":"text-[#666] hover:text-amber-400 opacity-0 group-hover/seat:opacity-100"),title:ep.has(l)?"자리 고정 해제":"자리 고정",children:ep.has(l)?(0,s.jsx)(z.Z,{size:12}):(0,s.jsx)(C.Z,{size:12})}),!o&&d?(0,s.jsxs)("div",{className:(0,S.cn)("transition-transform relative z-10 w-full text-center flex flex-col items-center justify-center",el<=9?"px-1":"px-0.5",eX&&"rotate-180"),children:[tr&&(0,s.jsx)("span",{className:(0,S.cn)("font-medium text-white/50 leading-none select-none seating-desk-student-number truncate max-w-full",el<=4?"text-xs mb-1":el<=6?"text-[10px] mb-0.5":el<=9?"text-[9px] mb-0.5":"text-[8px] mb-0.5",eM?"opacity-0":eT&&"animate-snap-in"),children:tu(d)}),(0,s.jsx)("div",{className:(0,S.cn)("font-bold truncate w-full text-center seating-desk-student-name",c),children:(0,s.jsx)("span",{className:(0,S.cn)("inline-block",eM?"opacity-0":eT&&"animate-snap-in"),children:d.name})})]}):!o&&(0,s.jsx)("span",{className:(0,S.cn)("opacity-20 transition-transform duration-500",el<=6?"text-[10px]":el<=9?"text-[9px]":el<=15?"text-[8px]":"text-[7px]",eX&&"rotate-180"),children:"빈 자리"}),!e4&&(0,s.jsx)("div",{className:(0,S.cn)("absolute inset-0 flex items-center justify-center transition-opacity print:hidden pointer-events-none",o?"text-red-600 opacity-100":e2===l?"opacity-35 text-white":"opacity-0 text-white"),children:o?(0,s.jsx)(f.Z,{size:el<=4?48:32,strokeWidth:1.5}):(0,s.jsx)(f.Z,{size:el<=4?40:el<=6?32:el<=9?28:el<=15?24:20,className:"text-white/20"})})]},a)})})]},e)})},t))})})})()})]})})})]})]})}},58652:function(e,t,n){n.d(t,{mv:function(){return s}});let s=()=>"<div style=\"margin-top: 6mm; text-align: right; font-size: 8pt; color: #A0A0A0; font-family: 'Malgun Gothic', sans-serif;\">".concat("내모","&nbsp;&nbsp;").concat("https://naemo.ai","</div>")}}]);

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.