PageSourceSearch

https://naemo.ai/_next/static/chunks/1255-59563407d90035a9.js

js naemo.ai collected 2026-10-02 01:12:48 UTC 50,746 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1255],{61255:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return et}});var s=t(57437),n=t(39561),r=t(90982),o=t(30166),i=t(2265),l=t(27526),c=t(32660),d=t(56096),u=t(82431),h=t(76858),m=t(99397),p=t(98319),g=t(36950),v=t(60850),x=t(55369),j=t(50647),_=t.n(j),b=t(77261),f=t.n(b),y=t(75855),N=t(92735),w=t(98420),C=t(30401),S=t(78867),k=t(40875),I=t(40291),A=t(71719),O=t(85461),R=t(44425),D=t.n(R);function E(e,a){return[...e.map(e=>{var a,t;return{id:"member:".concat(e.id),office:e.office||"",position:e.position,name:(null===(a=e.user)||void 0===a?void 0:a.name)||(null===(t=e.user)||void 0===t?void 0:t.email)||"선생님",member:e,seat:null}}),...a.filter(e=>!e.holder).map(e=>{var a;return{id:"seat:".concat(e.key),office:(0,O.s4)(e),position:null===(a=e.invitation)||void 0===a?void 0:a.position,name:"".concat((0,O.oX)(e)," 초대할 선생님"),member:null,seat:e}})].sort((e,a)=>{var t,s;return(null!==(t=e.position)&&void 0!==t?t:Number.MAX_SAFE_INTEGER)-(null!==(s=a.position)&&void 0!==s?s:Number.MAX_SAFE_INTEGER)})}var M=t(31235);function L(e,a){let t=Array.from(new Set(e.assignments.map(e=>{var a;return null!==(a=e.viewScope)&&void 0!==a?a:(0,x.Qs)(e)}).filter(e=>"none"!==e)));return t.includes("school")?"학교 전체":t.filter(e=>{let s=a.classes.find(a=>"class:".concat(a.id)===e);return!s||!t.includes("grade:".concat(s.grade))}).map(e=>(function(e,a){if("school"===e)return"학교 전체";if(e.startsWith("grade:"))return"".concat(e.slice(6),"학년 전체");let t=a.classes.find(a=>"class:".concat(a.id)===e);return t?"".concat(t.grade,"학년 ").concat(t.classNum,"반"):"none"===e?"조회 없음":"현재 학년도 범위 확인 필요"})(e,a)).join(" \xb7 ")||"조회 없음"}let H=e=>"HOMEROOM"===e.kind?"class:".concat(e.classId):"GRADE_ADMIN"===e.kind?"grade:".concat(e.grade):"MOCK_COORDINATOR"===e.kind?"mock:".concat(e.grade):e.kind;function F(e,a){var t,s;if(e.length<2)return null!==(s=e[0])&&void 0!==s?s:null;let n=e.find(e=>"HOMEROOM"===e.kind),r=e.find(e=>"GRADE_ADMIN"===e.kind);if(2!==e.length||!n||!r||(null===(t=a.classes.find(e=>e.id===n.classId))||void 0===t?void 0:t.grade)!==r.grade)return;let o=e.map(e=>{var a;return null!==(a=e.viewScope)&&void 0!==a?a:(0,x.Qs)(e)}),i=(e,t)=>e===t||"none"===t||"school"===e||e.startsWith("grade:")&&a.classes.some(a=>"class:".concat(a.id)===t&&"grade:".concat(a.grade)===e),l=o.find(e=>o.every(a=>i(e,a)));return void 0===l?void 0:{...n,viewScope:l===(0,x.Qs)(n)?null:l}}function z(e){var a,t,n;let{member:r,tone:o,detail:l,run:c,busy:d,open:u,onToggle:h,onDone:m,handle:p,rowDrag:g}=e,v=(0,i.useId)(),x=(null===(a=r.user)||void 0===a?void 0:a.name)||(null===(t=r.user)||void 0===t?void 0:t.email)||"이름 미등록",j=F(r.assignments,l);return(0,s.jsxs)("tbody",{"data-office":r.office||"",children:[(0,s.jsxs)("tr",{className:D().personRow,"data-expanded":u,...g,children:[(0,s.jsx)("td",{children:(0,s.jsxs)("div",{className:D().identity,children:[p,(0,s.jsx)("span",{className:f().avatar,"data-tone":o,"aria-hidden":"true"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:x}),r.id===l.me.id&&(0,s.jsx)("span",{className:D().selfLabel,children:"나"})]})]})}),(0,s.jsx)("td",{className:D().account,children:(null===(n=r.user)||void 0===n?void 0:n.email)||"계정 정보 없음"}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{children:(j?[j]:r.assignments).filter(e=>"MOCK_COORDINATOR"!==e.kind).map(e=>(function(e,a){if("GRADE_ADMIN"===e.kind)return"".concat(e.grade,"학년 관리자");if("HOMEROOM"===e.kind){let t=a.classes.find(a=>a.id===e.classId);if(t)return"".concat(t.grade,"학년 ").concat(t.classNum,"반 담임")}return(0,M.S4)(e,a)})(e,l)).join(" \xb7 ")||"미배정"})}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:D().state,"data-state":"filled",children:"참여 중"})}),(0,s.jsx)("td",{className:D().actions,children:(0,s.jsx)("button",{className:D().menuButton,"aria-label":"".concat(x," 역할 수정"),"aria-expanded":u,"aria-controls":u?v:void 0,disabled:d,onClick:h,children:(0,s.jsx)(k.Z,{size:18})})})]}),u&&(0,s.jsx)("tr",{className:D().expandedRow,children:(0,s.jsx)("td",{colSpan:5,children:(0,s.jsx)("div",{id:v,role:"region","aria-label":"".concat(x," 역할"),children:(0,s.jsx)(T,{member:r,detail
1:l,busy:d,run:c,onDone:m},"".concat(r.id,":").concat(r.revision))})})})]})}function T(e){var a,t;let{member:n,detail:r,busy:o,run:l,onDone:c}=e,[d]=(0,i.useState)(()=>n.assignments.map(e=>{var a;return{kind:e.kind,grade:e.grade,classId:e.classId,title:e.title,viewScope:null!==(a=e.viewScope)&&void 0!==a?a:null}})),[u,h]=(0,i.useState)(()=>F(d,r)),m=void 0===u?d:u?[u]:[],p=e=>JSON.stringify(e.map(e=>{var a,t;return{...e,title:null!==(a=e.title)&&void 0!==a?a:null,viewScope:null!==(t=e.viewScope)&&void 0!==t?t:null}}).sort((e,a)=>H(e).localeCompare(H(a)))),g=p(m)!==p(d),v=e=>{h("none"===e?null:{kind:e.startsWith("class:")?"HOMEROOM":e.startsWith("grade:")?"GRADE_ADMIN":e.startsWith("mock:")?"MOCK_COORDINATOR":e,grade:e.startsWith("grade:")?Number(e.slice(6)):e.startsWith("mock:")?Number(e.slice(5)):null,classId:e.startsWith("class:")?e.slice(6):null,title:null,viewScope:null})},j=[...r.classes].sort((e,a)=>e.grade-a.grade||e.classNum-a.classNum);return(0,s.jsxs)("form",{className:D().scopeForm,onSubmit:async e=>{e.preventDefault(),g&&!o&&await l({action:"roles",spaceId:r.space.id,memberId:n.id,revision:n.revision,roles:m})&&c()},children:[(0,s.jsxs)("fieldset",{disabled:o,className:D().roleRows,children:[(0,s.jsx)("legend",{className:D().srOnly,children:"역할 및 조회 범위 수정"}),(0,s.jsxs)("div",{className:D().scopeFields,children:[(0,s.jsxs)("label",{children:["역할",(0,s.jsxs)("span",{className:D().selectWrap,children:[(0,s.jsxs)("select",{"aria-label":"역할",value:void 0===u?"legacy":u?H(u):"none",onChange:e=>v(e.target.value),children:[void 0===u&&(0,s.jsx)("option",{value:"legacy",disabled:!0,children:"기존 역할 유지"}),(0,s.jsx)("option",{value:"none",children:"역할 없음"}),(0,s.jsx)("option",{value:"SCHOOL_ADMIN",children:"학교 관리자"}),[1,2,3].map(e=>(0,s.jsxs)(i.Fragment,{children:[(0,s.jsxs)("option",{value:"grade:".concat(e),children:[e,"학년 관리자"]}),j.filter(a=>a.grade===e).map(a=>(0,s.jsxs)("option",{value:"class:".concat(a.id),disabled:r.members.some(e=>e.id!==n.id&&e.assignments.some(e=>"HOMEROOM"===e.kind&&e.classId===a.id)),children:[e,"학년 ",a.classNum,"반 담임"]},a.id))]},e)),(0,s.jsx)("option",{value:"SCORE_COORDINATOR",children:"성적업무 담당"}),d.filter(e=>"MOCK_COORDINATOR"===e.kind).map(e=>(0,s.jsxs)("option",{value:H(e),children:[e.grade,"학년 모의고사 담당 (기존)"]},H(e)))]}),(0,s.jsx)(k.Z,{size:16,"aria-hidden":"true"})]})]}),(0,s.jsxs)("label",{children:["조회 범위",(0,s.jsxs)("span",{className:D().selectWrap,children:[(0,s.jsxs)("select",{"aria-label":"조회 범위",value:void 0===u?"legacy":u?null!==(t=u.viewScope)&&void 0!==t?t:(0,x.Qs)(u):"none",disabled:!u,onChange:e=>{let a=e.target.value;h(e=>e?{...e,viewScope:a}:e)},children:[void 0===u&&(0,s.jsx)("option",{value:"legacy",children:L(n,r)}),(0,s.jsx)("option",{value:"school",children:"학교 전체"}),[1,2,3].map(e=>(0,s.jsxs)(i.Fragment,{children:[(0,s.jsxs)("option",{value:"grade:".concat(e),children:[e,"학년 전체"]}),j.filter(a=>a.grade===e).map(a=>(0,s.jsxs)("option",{value:"class:".concat(a.id),children:[e,"학년 ",a.classNum,"반 담임"]},a.id))]},e)),(0,s.jsx)("option",{value:"none",children:"조회 없음"}),(null==u?void 0:null===(a=u.viewScope)||void 0===a?void 0:a.startsWith("class:"))&&!j.some(e=>"class:".concat(e.id)===u.viewScope)&&(0,s.jsx)("option",{value:u.viewScope,children:"이전 학급 \xb7 다시 선택해 주세요"})]}),(0,s.jsx)(k.Z,{size:16,"aria-hidden":"true"})]})]})]})]}),void 0===u&&(0,s.jsx)("p",{className:D().scopeHint,children:"기존 역할과 조회 범위는 유지됩니다. 역할을 새로 선택하면 기존 역할 전체를 대체합니다."}),(null==u?void 0:u.kind)==="SCHOOL_ADMIN"&&(0,s.jsx)("p",{className:D().scopeHint,children:"학교 관리자는 구성원과 초대도 관리할 수 있습니다."}),(0,s.jsxs)("div",{className:D().editorFooter,children:[n.id!==r.me.id&&(0,s.jsx)("button",{className:D().danger,type:"button",disabled:o,onClick:async()=>{var e;window.confirm("".concat((null===(e=n.user)||void 0===e?void 0:e.name)||"선생님","을 학교에서 내보낼까요? 학교 접근 권한이 종료되고, 맡은 역할은 새 초대 코드로 열립니다."))&&await l({action:"leave",spaceId:r.space.id,memberId:n.id,revision:n.revision})&&c()},children:"학교에서 내보내기"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("button",{type:"button",className:_().secondary,disabled:o,onClick:c,children:"취소"}),(0,s.jsx)("button",{className:_().primary,disabled:o||!g,children:"저장"})]})]})]})}var Z=t(41905);let Y=[2,5,7,0,4,1,6,3],B=e=>new Date(e).toLocaleDateString("ko-KR"),P=e=>e.holder?"filled":e.invitation?e.invitation.expired?"expired":"pending":"empty";function U(e){let{detail:a,run:n,busy:r,onEditStructure:o}=e,[l,c]=(0,i.useState)(!1),[d,u]=(0,i.useState)(!1),[h,p]=(0,i.useState)(""),g=a.seats,v=E(a.members,g),[x,j]=(0,i.useState)(""),[b,f]=(0,i.useState)("all"),[y,C]=(0,i.useState)(""),S=function(e,a,t){var n;let r=E(e.members,e.seats),o=(0,i.useId)(),[l,c]=(0,i.useState)(""),[d,u]=(0,i.useState)(null),h=(0,i.useRef)(null),m=(0,i.useRef)(null),[p,g]=(0,i.useState)(null),[v,x]=(0,i.useState)(null),[j,_]=(0,i.useState)(""),b=(0,i.useRef)(!1),f=(0,i.useRef)(null),y=()=>{h.current=null,m.current=null,u(null),f.current=null,c(""),g(null),x(null)},N=async function(s,n,r,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.space.directoryRevision;
1if(!t&&!b.current&&n!==s.id){b.current=!0,y(),_("구성원 배치를 저장하고 있습니다.");try{let t=await a({action:"move-directory",spaceId:e.space.id,entryId:s.id,directoryRevision:i,anchorId:n,placement:r,...void 0!==o?{office:o||null}:{}});_(t?void 0!==o&&(s.office||"")!==o?"".concat(s.name," \xb7 ").concat((0,M.cM)(o),"로 이동했습니다. 담당\xb7권한은 유지됩니다."):"구성원 순서를 저장했습니다.":"이동을 저장하지 못했습니다. 목록을 새로고침한 뒤 다시 시도해 주세요.")}catch(e){_("이동을 저장하지 못했습니다. 목록을 새로고침한 뒤 다시 시도해 주세요.")}finally{b.current=!1,requestAnimationFrame(()=>{var e,a;return null===(a=Array.from(document.querySelectorAll("[data-member-id]")).find(e=>e.dataset.memberId===s.id))||void 0===a?void 0:null===(e=a.querySelector("button"))||void 0===e?void 0:e.focus({preventScroll:!0})})}}},w=e=>{let a=h.current;if(!a||!f.current||!a.active&&5>Math.hypot(e.clientX-a.x,e.clientY-a.y))return;a.active=!0,c(f.current.member.id),u({x:e.clientX,y:e.clientY});let t=document.elementFromPoint(e.clientX,e.clientY),s=e.currentTarget.closest("[data-member-directory]"),n=null==t?void 0:t.closest("[data-member-id]"),r=null==t?void 0:t.closest("[data-office]");if(m.current=null,g(null),x(null),!t||!(null==s?void 0:s.contains(t)))return;if(n&&n.dataset.memberId!==f.current.member.id){let a=n.getBoundingClientRect(),t=e.clientY<a.top+a.height/2?"before":"after";m.current={memberId:n.dataset.memberId,placement:t,...r?{office:r.dataset.office}:{}},g({id:n.dataset.memberId,placement:t})}else!n&&r&&(m.current={office:r.dataset.office,placement:"after"},x(r.dataset.office));let o=e.currentTarget.parentElement;for(;o&&!(o.scrollHeight>o.clientHeight&&/auto|scroll/.test(getComputedStyle(o).overflowY));)o=o.parentElement;if(o){let a=o.getBoundingClientRect(),t=Math.max(0,a.top),s=Math.min(window.innerHeight,a.bottom);e.clientY<t+60?o.scrollTop-=18:e.clientY>s-60&&(o.scrollTop+=18)}};return{handle:a=>(0,s.jsx)("button",{type:"button",className:D().dragHandle,disabled:t,"aria-label":"".concat(a.name," 순서 이동"),"aria-describedby":o,"aria-keyshortcuts":"Alt+ArrowUp Alt+ArrowDown Alt+Shift+ArrowUp Alt+Shift+ArrowDown",title:"끌어서 이동 \xb7 Alt + ↑/↓ 순서 변경 \xb7 Alt + Shift + ↑/↓ 교무실 이동",onPointerDown:s=>{0!==s.button||t||b.current||(s.currentTarget.setPointerCapture(s.pointerId),h.current={x:s.clientX,y:s.clientY,active:!1},f.current={member:a,directoryRevision:e.space.directoryRevision},_(""))},onPointerMove:w,onPointerCancel:y,onLostPointerCapture:y,onPointerUp:e=>{var a,t;let s=f.current,n=m.current,o=null===(a=h.current)||void 0===a?void 0:a.active;if(y(),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),!s||!n||!o)return;let i=n.memberId||(null===(t=r.filter(e=>(e.office||"")===n.office&&e.id!==s.member.id).at(-1))||void 0===t?void 0:t.id)||null;N(s.member,i,n.placement,n.office,s.directoryRevision)},onKeyDown:e=>{if("Escape"===e.key){y();return}if(!e.altKey||!["ArrowUp","ArrowDown"].includes(e.key))return;if(e.preventDefault(),e.shiftKey){let s=M.fU.findIndex(e=>e.value===(a.office||"")),n=M.fU[s+("ArrowUp"===e.key?-1:1)];if(n){var t;let e=r.filter(e=>e.office===n.value&&e.id!==a.id).at(-1);N(a,null!==(t=null==e?void 0:e.id)&&void 0!==t?t:null,"after",n.value)}return}let s=r.filter(e=>e.office===a.office),n=s.findIndex(e=>e.id===a.id),o=s[n+("ArrowUp"===e.key?-1:1)];o&&N(a,o.id,"ArrowUp"===e.key?"before":"after")},children:(0,s.jsx)(Z.Z,{size:16,"aria-hidden":"true"})}),rowProps:e=>({"data-member-id":e.id,"data-dragging":l===e.id,"data-drop":(null==p?void 0:p.id)===e.id?p.placement:void 0}),dropOffice:v,help:(0,s.jsxs)("div",{className:D().dragHelp,children:[(0,s.jsxs)("p",{id:o,children:["끌어서 순서\xb7교무실 변경 ",(0,s.jsx)("span",{children:"Alt + ↑/↓ 순서 \xb7 Alt + Shift + ↑/↓ 교무실 이동"})]}),(0,s.jsx)("span",{role:"status",children:j})]}),preview:d&&(0,s.jsxs)("div",{className:D().dragPreview,"aria-hidden":"true",style:{left:d.x+14,top:d.y+14},children:[(0,s.jsx)(Z.Z,{size:14}),null===(n=f.current)||void 0===n?void 0:n.member.name]})}}(a,async e=>{let a=await n(e);return a&&"all"!==b&&f("all"),a},r||!!y),k=x.trim().toLocaleLowerCase(),R=g.filter(e=>"expired"===P(e)).length,H=g.filter(e=>e.holder).length,F=async()=>{c(!0);try{let e=await Promise.all([t.e(1425),t.e(6919)]).then(t.bind(t,2093)),s=g.map(e=>{var t,s;return{구분:"SCHOOL_ADMIN"===e.kind?"학교 전체":"".concat(e.grade,"학년"),역할:(0,O.oX)(e),"볼 수 있는 학생":e.holder&&a.members.some(a=>a.id===e.holder.memberId)?L(a.members.find(a=>a.id===e.holder.memberId),a):(0,O.PO)(e),"초대 코드":(null===(t=e.invitation)||void 0===t?void 0:t.code)?(0,I.Aw)(e.invitation.code):"","바로 참여 링크":(null===(s=e.invitation)||void 0===s?void 0:s.code)?(0,A.P)(window.location.origin,e.invitation.code):"","사용 기한":e.invitation&&!e.invitation.expired?B(e.invitation.expiresAt):"",상태:e.holder?"참여 중 (".concat(e.holder.name||e.holder.email||"선생님",")"):e.invitation?e.invitation.expired?"사용 기한 지남 \xb7 재발급 필요":e.invitation.code?"수락 대기 중":"재발급 필요":"초대 전"}}),n=e.utils.json_to_sheet(s);n["!cols"]=[{wch:10},{wch:18},{wch:16},{wch:18},{wch:60},{wch:12},{wch:22}];let r=e.utils.aoa_to_sheet([["".concat(a.space.name," 내모 학교 협업 참여 안내")],[],["1. 내모에 로그인한 뒤 [설정] → [일반] → [코드 입력]을 누릅니다. (휴대폰은 [설정] → [코드 입력])"],["2. [초대 코드] 칸에 있는 내 자리의 12자리를 넣고 [등록하기]를 누르면 끝입니다."],["   바로 참여 링크를 열어도 됩니다."],[],["코드는 한 사람만 쓸 수 있습니다. 내 역할의 코드만 입력해 주세요."],["이용권 코드와 같은 칸에 넣으면 됩니다. 어느 코드인지는 내모가 알아서 가려냅니다."]]
1);r["!cols"]=[{wch:80}];let o=e.utils.book_new();e.utils.book_append_sheet(o,n,"초대 코드"),e.utils.book_append_sheet(o,r,"참여 방법"),e.writeFile(o,"".concat(a.space.name," 초대 코드 (").concat(new Date().toLocaleDateString("sv-SE"),").xlsx"))}finally{c(!1)}};return(0,s.jsxs)("section",{className:D().chart,"aria-busy":r,"data-member-directory":!0,children:[(0,s.jsxs)("div",{className:D().top,children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{children:"구성원"}),(0,s.jsxs)("p",{children:["역할 ",g.length,"개 중 ",H,"개 참여 \xb7 학교 관리자가 구성원과 초대를 관리합니다."]})]}),(0,s.jsxs)("div",{className:D().topActions,children:[(0,s.jsx)("button",{className:_().secondary,disabled:r,onClick:o,children:a.classes.length?"반 구성 바꾸기":"반 구성하기"}),(0,s.jsxs)("button",{className:_().primary,disabled:r||l||!g.length,onClick:()=>void F(),children:[(0,s.jsx)(N.Z,{size:16}),l?"만드는 중…":"전체 코드 엑셀로 받기"]})]})]}),R>0&&(0,s.jsxs)("div",{className:D().banner,role:"status",children:[(0,s.jsxs)("span",{children:["사용 기한이 지난 코드가 ",R,"개 있습니다. 재발급하면 새 코드가 만들어집니다."]}),(0,s.jsx)("button",{className:_().secondary,disabled:r,onClick:()=>void n({action:"reissue-expired",spaceId:a.space.id}),children:"모두 재발급"})]}),(0,s.jsxs)("div",{className:D().filters,children:[(0,s.jsxs)("label",{children:["이름\xb7계정 검색",(0,s.jsx)("input",{type:"search",placeholder:"이름 또는 이메일",value:x,disabled:!!y,onChange:e=>j(e.target.value)})]}),(0,s.jsxs)("label",{children:["교무실",(0,s.jsxs)("select",{value:b,disabled:!!y,onChange:e=>f(e.target.value),children:[(0,s.jsx)("option",{value:"all",children:"모든 교무실"}),M.fU.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]})]})]}),S.help,S.preview,(0,s.jsx)("div",{className:D().tableScroll,children:(0,s.jsxs)("table",{className:D().table,children:[(0,s.jsx)("caption",{className:D().srOnly,children:"교무실별 구성원 및 역할별 초대"}),(0,s.jsxs)("colgroup",{children:[(0,s.jsx)("col",{className:D().nameColumn}),(0,s.jsx)("col",{className:D().accountColumn}),(0,s.jsx)("col",{className:D().roleColumn}),(0,s.jsx)("col",{className:D().statusColumn}),(0,s.jsx)("col",{className:D().actionColumn})]}),(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"col",children:"이름"}),(0,s.jsx)("th",{scope:"col",children:"계정\xb7초대 코드"}),(0,s.jsx)("th",{scope:"col",children:"역할"}),(0,s.jsx)("th",{scope:"col",children:"참여\xb7초대 상태"}),(0,s.jsx)("th",{scope:"col",children:"관리"})]})}),M.fU.filter(e=>"all"===b||e.value===b).map(e=>{let t=v.filter(a=>a.office===e.value),o=t.filter(e=>{var a,t;return"".concat(e.name," ").concat((null===(t=e.member)||void 0===t?void 0:null===(a=t.user)||void 0===a?void 0:a.email)||"").toLocaleLowerCase().includes(k)}),l=new Map([...t].sort((e,a)=>e.id.localeCompare(a.id)).map((e,a)=>[e.id,Y[a%Y.length]]));return(0,s.jsxs)(i.Fragment,{children:[(0,s.jsxs)("tbody",{"data-office":e.value,"data-drop-office":S.dropOffice===e.value,children:[(0,s.jsx)("tr",{className:D().officeRow,children:(0,s.jsx)("th",{colSpan:5,scope:"rowgroup",children:(0,s.jsxs)("div",{className:D().groupHead,children:[(0,s.jsx)(w.Z,{size:17,"aria-hidden":"true"}),(0,s.jsx)("h3",{children:e.label}),(0,s.jsx)("span",{children:o.length}),e.value.startsWith("GRADE_")&&a.classes.some(a=>"GRADE_".concat(a.grade)===e.value)&&(0,s.jsxs)("button",{className:D().addSeat,disabled:r,onClick:()=>void n({action:"issue-seat",spaceId:a.space.id,kind:"GRADE_ADMIN",grade:Number(e.value.slice(6))}),children:[(0,s.jsx)(m.Z,{size:16}),"관리자 초대"]}),"SCHOOL"===e.value&&(0,s.jsxs)("button",{className:D().addSeat,disabled:r,onClick:()=>u(e=>!e),children:[(0,s.jsx)(m.Z,{size:16}),"역할 추가"]})]})})}),"SCHOOL"===e.value&&d&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:5,children:(0,s.jsx)(K,{busy:r,onCancel:()=>u(!1),onAdd:async e=>{await n({action:"add-seats",spaceId:a.space.id,count:e})&&u(!1)}})})}),!o.length&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:5,className:D().empty,children:k?"검색 ê²°ê
1³¼ê°€ 없습니다.":""===e.value?"교무실에서 빼려면 이곳으로 끌어 놓으세요.":"배치된 구성원이 없습니다."})})]}),o.map(e=>e.member?(0,s.jsx)(z,{member:e.member,tone:l.get(e.id),detail:a,run:n,busy:r,open:y===e.member.id,onToggle:()=>C(y===e.member.id?"":e.member.id),onDone:()=>C(""),handle:S.handle(e),rowDrag:S.rowProps(e)},e.id):(0,s.jsx)(W,{seat:e.seat,tone:l.get(e.id),detail:a,run:n,busy:r,renaming:h===e.seat.key,onRename:a=>p(a?e.seat.key:""),handle:S.handle(e),rowDrag:S.rowProps(e)},e.id))]},e.value)})]})})]})}function K(e){let{busy:a,onAdd:t,onCancel:n}=e,[r,o]=(0,i.useState)(1);return(0,s.jsxs)("form",{className:D().addForm,onSubmit:e=>{e.preventDefault(),t(r)},children:[(0,s.jsxs)("label",{children:["몇 개",(0,s.jsx)("input",{type:"number",min:1,max:10,value:r,autoFocus:!0,onChange:e=>o(Math.min(10,Math.max(1,Number(e.target.value)||1)))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("button",{className:_().primary,disabled:a,children:"추가"}),(0,s.jsx)("button",{type:"button",className:_().secondary,disabled:a,onClick:n,children:"취소"})]}),(0,s.jsx)("small",{children:"추가한 뒤 이름을 눌러 바꿀 수 있습니다."})]})}function W(e){var a,t,n,r,o,l,c;let{seat:d,tone:u,detail:h,run:m,busy:p,renaming:g,onRename:v,handle:x,rowDrag:j}=e,[_,b]=(0,i.useState)(!1),y=(0,i.useId)(),[N,w]=(0,i.useState)(!1),[A,R]=(0,i.useState)(d.title||""),E=(0,i.useRef)(null),M=P(d),L=h.space.id,H=(0,O.oX)(d),F=(null===(a=d.holder)||void 0===a?void 0:a.memberId)===h.me.id;(0,i.useEffect)(()=>{if(!_)return;let e=e=>{var a;(null===(a=E.current)||void 0===a?void 0:a.contains(e.target))||b(!1)},a=e=>{"Escape"===e.key&&b(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",a)}},[_]);let z=(e,a)=>{b(!1),(!a||window.confirm(a))&&m(e)},T=d.holder?{assignmentId:d.holder.assignmentId}:{invitationId:null!==(c=null===(t=d.invitation)||void 0===t?void 0:t.id)&&void 0!==c?c:""},Z=async()=>{let e=A.trim();if(!e||e===d.title){v(!1),R(d.title||"");return}await m({action:"rename-seat",spaceId:L,title:e,...T})&&v(!1)},Y=async()=>{var e;if(null===(e=d.invitation)||void 0===e?void 0:e.code)try{await navigator.clipboard.writeText((0,I.Aw)(d.invitation.code)),w(!0),window.setTimeout(()=>w(!1),1500)}catch(e){}},U=[];return"SCHOOL_ADMIN"===d.kind&&U.push({label:"이름 바꾸기",onClick:()=>{b(!1),v(!0)}}),("pending"===M||"expired"===M)&&(U.push({label:"내가 이 역할 맡기",onClick:()=>z({action:"claim-seat",spaceId:L,invitationId:d.invitation.id},"".concat(H," 역할을 직접 맡을까요?"))}),U.push({label:"코드 재발급",onClick:()=>z({action:"reissue-invite",spaceId:L,invitationId:d.invitation.id},"pending"===M?"새 코드를 만들까요? 지금 코드는 더 이상 쓸 수 없습니다.":void 0)})),"SCHOOL_ADMIN"!==d.kind&&d.invitation&&U.push({label:"초대 취소",danger:!0,onClick:()=>z({action:"revoke-invite",spaceId:L,invitationId:d.invitation.id},"".concat(H," 초대를 취소할까요?"))}),"SCHOOL_ADMIN"===d.kind&&U.push({label:"역할 지우기",danger:!0,onClick:()=>z({action:"remove-seat",spaceId:L,...T},"".concat(H," 역할을 지울까요? 이 역할을 맡은 선생님은 학교 관리자 권한이 끝납니다."))}),(0,s.jsxs)("tbody",{ref:E,"data-office":(0,O.s4)(d),children:[(0,s.jsxs)("tr",{className:D().personRow,"data-state":M,"data-expanded":_,...j,children:[(0,s.jsx)("td",{children:(0,s.jsxs)("div",{className:D().identity,children:[x,(0,s.jsx)("span",{className:f().avatar,"data-tone":u,"aria-hidden":"true"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:d.holder?d.holder.name||"이름 미등록":"초대할 선생님"}),F&&(0,s.jsx)("span",{className:D().selfLabel,children:"나"}),(null===(n=d.holder)||void 0===n?void 0:n.manager)&&(0,s.jsx)("span",{className:D().managerTag,children:"학교 관리자"})]})]})}),(0,s.jsx)("td",{className:D().account,children:d.holder?d.holder.email||"계정 정보 없음":"pending"===M&&(null===(r=d.invitation)||void 0===r?void 0:r.code)?(0,s.jsxs)("button",{className:D().code,disabled:p,onClick:()=>void Y(),"aria-label":"".concat(H," 코드 복사"),children:[(0,I.Aw)(d.invitation.code),N?(0,s.jsx)(C.Z,{size:14}):(0,s.jsx)(S.Z,{size:14})]}):(0,s.jsx)("span",{className:D().muted,children:"empty"===M?"아직 발급된 코드가 없습니다":"코드를 다시 발급해 주세요"})}),(0,s.jsx)("td",{children:g?(0,s.jsx)("input",{className:D().seatInput,"aria-label":"역할 이름",autoFocus:!0,maxLength:30,value:A,disabled:p,onChange:e=>R(e.target.value),onBlur:()=>void Z(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Z()),"Escape"===e.key&&(R(d.title||""),v(!1))}}):"SCHOOL_ADMIN"===d.kind?(0,s.jsx)("button",{className:D().seatNameButton,disabled:p,title:"이름 바꾸기",onClick:()=>v(!0),children:H}):H}),(0,s.jsxs)("td",{children:[(0,s.jsx)("span",{className:D().state,"data-state":M,children:"filled"===M?"참여 중":"pending"===M?"수락 대기 중":"expired"===M?"사용 기한 지남":"초대 전"}),"pending"===M&&(null===(o=d.invitation)||void 0===o?void 0:o.code)&&(0,s.jsxs)("small",{className:D().expiry,children:[B(d.invitation.expiresAt),"까지"]}),("expired"===M||"pending"===M&&!(null===(l=d.invitation)||void 0===l?void 0:l.code))&&(0,s.jsx)("button",{className:D().inlineAction,disabled:p,onClick:()=>void m({action:"reissue-invite",spaceId:L,invitationId:d.invitation.id}),children:"재발급"}),"empty"===M&&"SCHOOL_ADMIN"!==d.kind&&(0,s.jsx)("button",{className:D().inlineAction,disabled:p,onClick:()=>void m("HOMEROOM"===d.kind?{action:"issue-seat",spaceId:L,kind:"HOMEROOM",classId:d.classId}:{action:"issue-seat",spaceId:L,kind:"GRADE_ADMIN",grade:d.grade}),children:"코드 발급"})]}),(0,s.jsx)("td",{className:D().actions,children:U.length>0&&(0,s.jsx)("button",{className:D().menuButton,"aria-label":"".concat(H," 메뉴"),"aria-expanded":_,"aria-controls":_?y:void 0,disabled:p||g,onClick:()=>b(e=>!e),children:(0,s.jsx)(k.Z,{size:18})})})]}),_&&(0,s.jsx)("tr",{className:D().expandedRow,children:(0,s.jsx)("td",{colSpan:5,children:(0,s.jsx)("div",{id:y,className:D().rowActions,role:"group","aria-label":"".concat(H," 관리"),children:U.map(e=>(0,s.jsx)("button",{className:e.danger?D().danger:void 0,disabled:p,onClick:e.onClick,children:e.label},e.label))})})})]})}var q=t(21047),G=t(29633),X=t.n(G);function J(e){let{detail:a,busy:t,run:n,onCancel:o}=e,[l,c]=(0,i.useState)(null),[d,u]=(0,i.useState)(!1),h=a.classes.length>0;if((0,i.useEffect)(()=>{let e=!0;return(0,g.F)({action:"suggest-structure",spaceId:a.space.id}).then(a=>{if(!e)return;let t=a.success&&!Array.isArray(a.data)&&"structure"in a.data&&a.data.structure||[1,2,3].map(e=>({grade:e,current:0,suggested:0}));u(t.some(e=>e.suggested>0)),c(t.map(e=>{let a=e.current||e.suggested;return{grade:e.grade,on:h?e.current>0:a>0||!t.some(e=>e.suggested>0),count:a||1,suggested:e.suggested}}
1))}).catch(()=>{e&&c([1,2,3].map(e=>({grade:e,on:!0,count:1,suggested:0})))}),()=>{e=!1}},[a.space.id,h]),!l)return(0,s.jsx)(r.ContentLoadingState,{variant:"table",label:"학급 정보를 불러오는 중입니다."});let p=(e,a)=>c(l.map(t=>t.grade===e?{...t,...a}:t)),v=l.filter(e=>e.on),x=v.reduce((e,a)=>e+a.count,0);return(0,s.jsxs)("section",{className:"".concat(_().section," ").concat(X().setup),children:[(0,s.jsx)("h2",{children:h?"반 구성 바꾸기":"우리 학교는 몇 반인가요?"}),(0,s.jsxs)("p",{className:X().setupNote,children:[d?"나이스에 등록된 ".concat(a.space.currentYear,"학년도 학급 수로 채웠습니다. 다르면 고쳐 주세요."):"학년마다 반 수를 입력해 주세요."," 쓰지 않는 학년은 체크를 끄면 됩니다."]}),l.map(e=>(0,s.jsxs)("div",{className:X().gradeRow,children:[(0,s.jsxs)("label",{className:X().gradeToggle,children:[(0,s.jsx)("input",{type:"checkbox",checked:e.on,disabled:t,onChange:a=>p(e.grade,{on:a.target.checked})}),e.grade,"학년",e.suggested>0&&e.suggested!==e.count&&(0,s.jsxs)("small",{children:["나이스 ",e.suggested,"반"]})]}),(0,s.jsxs)("div",{className:"".concat(X().stepper," ").concat(e.on?"":X().stepperOff),children:[(0,s.jsx)("button",{type:"button","aria-label":"".concat(e.grade,"학년 반 수 줄이기"),disabled:t||!e.on||e.count<=1,onClick:()=>p(e.grade,{count:e.count-1}),children:(0,s.jsx)(q.Z,{size:16})}),(0,s.jsx)("input",{"aria-label":"".concat(e.grade,"학년 반 수"),inputMode:"numeric",value:e.count,disabled:t||!e.on,onChange:a=>{let t=Number(a.target.value.replace(/\D/g,""));p(e.grade,{count:Math.min(20,Math.max(1,t||1))})}}),(0,s.jsx)("button",{type:"button","aria-label":"".concat(e.grade,"학년 반 수 늘리기"),disabled:t||!e.on||e.count>=20,onClick:()=>p(e.grade,{count:e.count+1}),children:(0,s.jsx)(m.Z,{size:16})})]})]},e.grade)),(0,s.jsxs)("p",{className:X().setupSummary,children:[v.length?"학년 관리자 ".concat(v.length,"명과 담임 ").concat(x,"명의 역할을 만들고, 역할마다 초대 코드를 발급합니다."):"한 학년 이상 선택해 주세요.",h?" 이미 참여한 선생님과 발급된 코드는 그대로 둡니다.":""]}),(0,s.jsxs)("div",{className:X().setupActions,children:[(0,s.jsx)("button",{className:_().primary,disabled:t||!v.length,onClick:async()=>{await n({action:"setup-structure",spaceId:a.space.id,grades:l.map(e=>({grade:e.grade,classCount:e.on?e.count:0}))})&&(null==o||o())},children:t?"만드는 중…":h?"반 구성 저장":"구성원 역할 만들기"}),o&&h&&(0,s.jsx)("button",{className:_().secondary,disabled:t,onClick:o,children:"취소"})]})]})}let Q=(0,o.default)(()=>Promise.all([t.e(3878),t.e(2558),t.e(3145),t.e(5708),t.e(6740)]).then(t.bind(t,25708)),{loadableGenerated:{webpack:()=>[25708]},loading:()=>(0,s.jsx)(r.ContentLoadingState,{variant:"table"})}),V=(0,o.default)(()=>t.e(7597).then(t.bind(t,17597)),{loadableGenerated:{webpack:()=>[17597]},loading:()=>(0,s.jsx)(r.ContentLoadingState,{variant:"table"})}),$=(0,o.default)(()=>t.e(9005).then(t.bind(t,49005)),{loadableGenerated:{webpack:()=>[49005]},loading:()=>(0,s.jsx)(r.ContentLoadingState,{variant:"table"})}),ee=(0,o.default)(()=>t.e(9355).then(t.bind(t,79355)),{loadableGenerated:{webpack:()=>[79355]},loading:()=>(0,s.jsx)(r.ContentLoadingState,{variant:"table"})}),ea=["default","members","uploads","classes"];function et(){var e,a;let{status:t,data:n}=(0,l.kP)(),o=(null==n?void 0:null===(e=n.user)||void 0===e?void 0:e.id)||"",[m,v]=(0,i.useState)(""),[j,b]=(0,i.useState)([]),[y,N]=(0,i.useState)(""),[w,C]=(0,i.useState)(null),[S,k]=(0,i.useState)(""),[I,A]=(0,i.useState)("default"),[O,R]=(0,i.useState)(!0),[D,E]=(0,i.useState)(!1),[M,L]=(0,i.useState)(""),[H,F]=(0,i.useState)(!1),[z,T]=(0,i.useState)(!1),Z=(0,i.useRef)(0),Y=(0,i.useRef)(!1),B=(0,i.useRef)(y);B.current=y,(0,i.useEffect)(()=>{if("loading"===t)return;Z.current++,C(null),b([]),k(""),L(""),F(!1);let e="",a="default";if("authenticated"===t&&o)try{let t=JSON.parse(sessionStorage.getItem("school-collaboration:navigation:".concat(o))||"null");t&&"string"==typeof t.spaceId&&t.spaceId.length<=100&&(e=t.spaceId,ea.includes(t.tab)&&(a=t.tab),"string"==typeof t.classId&&t.classId.length<=100&&k(t.classId))}catch(e){}N(e),A(a),v(o)},[t,o]),(0,i.useEffect)(()=>
1{if("authenticated"===t&&o&&m===o)try{sessionStorage.setItem("school-collaboration:navigation:".concat(o),JSON.stringify({spaceId:y,tab:I,classId:S}))}catch(e){}},[t,o,m,y,I,S]);let P=(0,i.useCallback)(async function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=++Z.current;R(!0),L("");try{let s=await (0,g.F)(e?{action:"detail",spaceId:e}:{action:"list"});if(t!==Z.current)return;if(!s.success){a&&"FORBIDDEN"!==s.code&&"UNAUTHORIZED"!==s.code||C(null),L(s.error),F("NOT_READY"===s.code);return}F(!1),Array.isArray(s.data)?b(s.data):"space"in s.data&&s.data.space&&C(s.data)}catch(e){t===Z.current&&(a||C(null),L("연결을 확인한 뒤 다시 시도해 주세요."))}finally{t===Z.current&&R(!1)}},[]);(0,i.useEffect)(()=>("authenticated"===t&&o&&m===o?P(y):"unauthenticated"===t&&(R(!1),C(null),b([])),()=>{Z.current++}),[t,o,m,y,P]),(0,i.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&"authenticated"===t&&m===o&&o&&!Y.current&&P(B.current)};return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[P,t,m,o]);let{showToast:K}=(0,p.pm)(),W=async e=>{if(Y.current)return!1;Y.current=!0,E(!0),L("");try{let a=await (0,g.F)(e);if(!a.success)return L(a.error),!1;let t=a.data;return!Array.isArray(t)&&"spaceId"in t&&("create"===e.action||"join"===e.action)?(C(null),N(t.spaceId),A("default")):"leave"===e.action&&(null==w?void 0:w.me.id)===e.memberId?(C(null),N(""),A("default"),k("")):await P(y),"register-roster"===e.action&&K("학교 학생 명단을 등록했습니다. 담임 선생님의 학생 명단과 자동으로 이어집니다.","success"),!0}catch(e){return L("요청을 처리하지 못했습니다. 연결을 확인한 뒤 다시 시도해 주세요."),!1}finally{Y.current=!1,E(!1)}},q=null!==(a=null==w?void 0:w.classes.some(e=>["grades","mock"].some(a=>(0,x.yV)(w.me.assignments,{academicYear:w.space.currentYear,grade:e.grade,classId:e.id},a))))&&void 0!==a&&a,G=(null==w?void 0:w.me.operator)?"members":q?"uploads":"classes",X="default"!==I&&("members"!==I||(null==w?void 0:w.me.operator))&&("uploads"!==I||q)?I:G;return(0,s.jsxs)("main",{className:"".concat(_().page," ").concat(f().surface),"aria-busy":O||D,children:[(0,s.jsxs)("header",{className:_().header,children:[(0,s.jsxs)("div",{children:[y&&(0,s.jsxs)("button",{className:_().link,onClick:()=>{C(null),N(""),k(""),A("default")},disabled:D,children:[(0,s.jsx)(c.Z,{size:16})," 학교 목록"]}),(0,s.jsxs)("div",{className:f().schoolTitle,children:[(0,s.jsx)("span",{className:f().schoolMark,"aria-hidden":"true",children:(0,s.jsx)(d.Z,{size:22,strokeWidth:1.5})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{children:(null==w?void 0:w.space.name)||"학교 협업"}),(0,s.jsx)("p",{children:w?"".concat(w.space.currentYear,"학년도 \xb7 학교 설정"):"우리 학교의 학급, 구성원, 학업 자료를 함께 관리하세요."})]})]})]}),"authenticated"===t&&(0,s.jsx)("button",{className:_().iconButton,onClick:()=>void P(y),disabled:D||O,"aria-label":"학교 협업 새로고침",children:(0,s.jsx)(u.Z,{size:18})})]}),M&&!H&&(0,s.jsx)("div",{role:"alert",className:_().error,children:M}),"unauthenticated"===t?(0,s.jsxs)("section",{className:_().empty,children:[(0,s.jsx)(d.Z,{size:36}),(0,s.jsx)("h2",{children:"로그인하고 학교 협업을 시작하세요"}),(0,s.jsx)("p",{children:"무료 계정도 학교를 만들거나 초대받아 참여할 수 있습니다."}),(0,s.jsx)("a",{className:_().primary,href:"/",children:"로그인하러 가기"})]}):O&&!w?(0,s.jsx)(r.ContentLoadingState,{variant:"table",label:"학교 정보를 불러오는 중입니다."}):H?(0,s.jsxs)("section",{className:_().empty,children:[(0,s.jsx)(d.Z,{size:36}),(0,s.jsx)("h2",{children:"학교 협업을 준비하고 있어요"}),(0,s.jsx)("p",{children:"준비가 끝나면 요금제와 관계없이 이곳에서 시작할 수 있습니다."})]}):y?w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("nav",{className:_().tabs,"aria-label":"학교 협업 메뉴",children:[...w.me.operator?["members"]:[],...q?["uploads"]:[],"classes"].map(e=>(0,s.jsx)("button",{"aria-current":X===e?"page":void 0,disabled:D,onClick:()=>A(e),children:"members"===e?"구성원":"uploads"===e?"파일 업로드":"학급\xb7학생 명단"},e))}),"uploads"===X&&q&&(0,s.jsx)(Q,{detail:w,initialClassId:S,onRosterChange:()=>P(y,!0),onBusyChange:e=>{Y.current=e,E(e)},onOpenRoster:e=>{k(e),A("classes")}},"".concat(w.space.id,":").concat(w.me.revision,":").concat(S)),"classes"===X&&(0,s.jsx)(en,{initialClassId:S,onSelectClass:k,onUpload:e=>{k(e),A("uploads")},detail:w,run:W,busy:D,onBusyChange:e=>{Y.current=e,E(e)},onRosterChange:()=>P(y)}),"classes"===X&&w.me.operator&&(0,s.jsx)(V,{detail:w,onBusyChange:e=>{Y.current=e,E(e)},onComplete:async()=>{await P(y),A("members"),K("새 학년도를 시작했습니다. 새 담당을 배정해 주세요.","success")}},"".concat(w.space.id,":").concat(w.space.currentYear)),"members"===X&&w.me.operator&&(z?(0,s.jsx)(J,{detail:w,busy:D,run:W,onCancel:()=>T(!1)},w.space.id):(0,s.jsx)(U,{detail:w,run:W,busy:D,onEditStructure:()=>T(!0)})),(0,s.jsx)("footer",{className:_().actions,children:(0,s.jsx)("button",{className:_().dangerLink,disabled:D,onClick:()=>{window.confirm("이 학교에서 탈퇴할까요? 개인 계정과 개인 자료는 유지됩니다. 맡은 역할은 새 코드로 다시 열립니다.")&&W({action:"leave",spaceId:y,memberId:w.me.id,revision:w.me.revision})},children:"학교에서 탈퇴"})})]}):null:(0,s.jsxs)(s.Fragment,{children:[j.length>0&&(0,s.jsxs)("section",{className:_().section,children:[(0,s.jsx)("h2",{children:"참여 중인 학교"}),(0,s.jsx)("div",{className:_().list,children:j.map(e=>(0,s.jsxs)("button",{className:_().schoolRow,onClick:()=>N(e.space.id),children:[(0,s.jsx)(d.Z,{size:22}),(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{children:e.space.name}),(0,s.jsxs)("small",{children:[e.space.currentYear,"학년도",e.operator?" \xb7 학교 관리자":""]})]}),(0,s.jsx)(h.Z,{size:18})]},e.id))})]}),(0,s.jsx)(es,{busy:D,run:W})]})]})}function es(e){let{run:a,busy:t}=e,r=(0,n.g)(),[o,l]=(0,i.useState)("choose"),[d,u]=(0,i.useState)(""),[p,g]=(0,i.useState)([]),[x,j]=(0,i.useState)(null),[b,N]=(0,i.useState)(!1),[w,C]=(0,i.useState)(""),[S,k]=(0,i.useState)(!1),[I,A]=(0,i.useState)(-1),O=(0,i.useRef)(0),R=d.trim();(0,i.useEffect)(()=>{let e=++O.current;if("create"!==o||R.length<2||R===(null==x?void 0:x.schoolName)){N(!1),R.length<2&&(g([]),C(""));return}N(!0),C("");let a=setTimeout(async()=>{try{let a=await (0,v.R2)(R);if(e!==O.current)return;g(a.data),A(-1),a.success?a.data.length||C("검색된 학교가 없습니다. 학교 이름을 확인해 주세요."):C(a.error||"다시 검색해 주세요.")}catch(a){e===O.current&&C("학교를 검색하지 못했습니다. 다시 시도해 주세요.")}finally{e===O.current&&N(!1)}},250);return()=>clearTimeout(a)},[R,o,null==x?void 0:x.schoolName]);let D=e=>{j(e),u(e.schoolName),k(!1),g([])};if(r)return(0,s.jsxs)("section",{className:"".concat(_().section," ").concat(f().entrySection),children:[(0,s.jsx)("h2",{children:"초대받은 학교에 참여하기"}),(0,s.jsx)(y.default,{})]});if("choose"===o)return(0,s.jsxs)("section",{className:_().start,children:[(0,s.jsxs)("div",{className:f().welcomeCopy,children:[(0,s.jsx)("h2",{children:"우리 학교와 함께 시작하세요"}),(0,s.jsxs)("p",{children:["한 학년부터 학교 전체까지, 학교마다 하나의 학교 협업에서 함께합니다.",(0,s.jsx)("br",{}
1),"유료 구독 없이 모든 선생님이 참여할 수 있습니다."]})]}),(0,s.jsxs)("div",{className:f().welcomeActions,children:[(0,s.jsxs)("button",{className:_().primary,disabled:t,onClick:()=>l("create"),children:[(0,s.jsx)(m.Z,{size:16}),"학교 만들기"]}),(0,s.jsxs)("button",{className:_().secondary,disabled:t,onClick:()=>l("join"),children:["초대 코드로 참여",(0,s.jsx)(h.Z,{size:15})]})]}),(0,s.jsx)("p",{className:_().note,children:"이미 학교가 만들어져 있다면 학교 관리자에게 초대 코드를 요청하세요."})]});let E=S&&R.length>=2&&!x&&(b||p.length>0||!!w);return(0,s.jsxs)("section",{className:"".concat(_().section," ").concat(f().entrySection),children:[(0,s.jsxs)("button",{className:"".concat(_().link," ").concat(f().returnLink),disabled:t,onClick:()=>l("choose"),children:[(0,s.jsx)(c.Z,{size:16})," 돌아가기"]}),(0,s.jsx)("h2",{children:"create"===o?"어느 학교에서 함께 사용하시나요?":"초대받은 학교에 참여하기"}),"join"===o?(0,s.jsx)(y.default,{}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:_().search,children:(0,s.jsxs)("label",{children:["학교 이름",(0,s.jsxs)("div",{className:_().combo,children:[(0,s.jsx)("input",{role:"combobox","aria-expanded":E,"aria-controls":"school-search-list","aria-autocomplete":"list","aria-activedescendant":E&&I>=0?"school-option-".concat(I):void 0,autoComplete:"off",value:d,maxLength:80,placeholder:"학교 이름을 입력하세요",disabled:t,onChange:e=>{u(e.target.value),j(null),k(!0)},onFocus:()=>k(!0),onBlur:()=>k(!1),onKeyDown:e=>{if("ArrowDown"===e.key&&p.length)e.preventDefault(),k(!0),A(e=>(e+1)%p.length);else if("ArrowUp"===e.key&&p.length)e.preventDefault(),A(e=>(e<=0?p.length:e)-1);else if("Enter"===e.key){e.preventDefault();let a=p[I>=0?I:1===p.length?0:-1];a&&D(a)}else"Escape"===e.key&&k(!1)}}),E&&(0,s.jsxs)("ul",{id:"school-search-list",role:"listbox",className:_().dropdown,children:[p.map((e,a)=>(0,s.jsxs)("li",{id:"school-option-".concat(a),role:"option","aria-selected":a===I,className:_().option,onMouseDown:a=>{a.preventDefault(),D(e)},onMouseEnter:()=>A(a),children:[(0,s.jsx)("strong",{children:e.schoolName}),(0,s.jsx)("small",{children:e.address||e.region})]},"".concat(e.officeCode,":").concat(e.schoolCode))),!p.length&&(0,s.jsx)("li",{className:_().optionHint,role:"presentation",children:b?"찾는 중…":w})]})]})]})}),x&&(0,s.jsxs)("div",{className:_().confirm,children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("strong",{children:x.schoolName}),(x.address||x.region)&&(0,s.jsx)("small",{children:x.address||x.region})]}),(0,s.jsx)("p",{children:"이 학교의 학교 관리자로 시작합니다. 개설 후 본인의 담당도 배정할 수 있습니다."}),(0,s.jsx)("button",{className:_().primary,disabled:t,onClick:()=>void a({action:"create",schoolCode:x.schoolCode,officeCode:x.officeCode}),children:"이 학교로 시작하기"})]})]})]})}function en(e){let{detail:a,run:t,busy:n,onBusyChange:r,onRosterChange:o,initialClassId:l,onSelectClass:c,onUpload:d}=e,[u,p]=(0,i.useState)(""),[g,v]=(0,i.useState)(1),[j,b]=(0,i.useState)(1),[y,N]=(0,i.useState)(l),[w,C]=(0,i.useState)(""),[S,k]=(0,i.useState)(""),I=a.classes.find(e=>e.id===y),A=a.enrollments.filter(e=>e.classId===y),O=I&&(a.me.operator||(0,x.Ko)(a.me.assignments,{academicYear:a.space.currentYear,grade:I.grade,classId:I.id}));return(0,s.jsxs)("section",{className:_().section,children:[(0,s.jsx)("h2",{children:"학급\xb7학생 명단"}),a.me.operator&&(0,s.jsxs)("form",{className:_().inlineForm,onSubmit:e=>{e.preventDefault(),t({action:"class",spaceId:a.space.id,academicYear:a.space.currentYear,grade:g,classNum:j})},children:[(0,s.jsxs)("label",{children:["학년",(0,s.jsx)("select",{value:g,onChange:e=>v(Number(e.target.value)),children:[1,2,3].map(e=>(0,s.jsxs)("option",{value:e,children:[e,"학년"]},e))})]}),(0,s.jsxs)("label",{children:["반",(0,s.jsx)("input",{type:"number",min:1,max:99,required:!0,value:j,onChange:e=>b(Number(e.target.value))})]}),(0,s.jsxs)("button",{className:_().secondary,disabled:n,type:"submit",children:[(0,s.jsx)(m.Z,{size:16})," 학급 추가"]})]}),a.classes.length?(0,s.jsxs)("div",{className:_().classLayout,children:[(0,s.jsx)("div",{className:_().classList,children:a.classes.map(e=>(0,s.jsxs)("button",{"aria-pressed":y===e.id,disabled:n,onClick:()=>{N(e.id),c(e.id),p(""),C(""),k("")},children:[(0,s.jsxs)("strong",{children:[e.grade,"학년 ",e.classNum,"반"]}),(0,s.jsxs)("span",{children:[e._count.enrollments,"명"]})]},e.id))}),(0,s.jsx)("div",{children:I?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("h3",{children:[I.grade,"학년 ",I.classNum,"반"]}),A.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:f().nextStep,children:[(0,s.jsxs)("p",{className:_().note,children:["학교 학생 명단 \xb7 ",A.length,"명"]}),["grades","mock"].some(e=>(0,x.yV)(a.me.assignments,{academicYear:a.space.currentYear,grade:I.grade,classId:I.id},e))&&(0,s.jsxs)("button",{className:_().primary,disabled:n,onClick:()=>d(I.id),children:["이 반 성적 업로드 ",(0,s.jsx)(h.Z,{size:16})]})]}),(0,s.jsxs)("table",{className:_().table,children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{scope:"col",children:"번호"}),(0,s.jsx)("th",{scope:"col",children:"이름"}
1),a.me.operator&&(0,s.jsx)("th",{scope:"col",children:"학생 명단 관리"})]})}),(0,s.jsx)("tbody",{children:A.map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:e.number}),(0,s.jsx)("td",{children:e.student.name}),a.me.operator&&(0,s.jsx)("td",{children:(0,s.jsx)("button",{className:_().link,disabled:n,"aria-label":"".concat(e.student.name," 학급 이동\xb7전출"),onClick:()=>p(e.id),children:"이동\xb7전출"})})]},e.id))})]})]}):O?(0,s.jsxs)("form",{className:_().form,onSubmit:async e=>{e.preventDefault(),k("");try{await t({action:"register-roster",spaceId:a.space.id,classId:I.id,revision:I.revision,rows:function(){let e=w.trim().split(/\r?\n/).map(e=>{let a=e.trim().match(/^(\d+)[\t, ]+(.+)$/);if(!a)throw Error("각 줄에 번호와 이름을 입력해 주세요. 예: 1 김민수");return{number:Number(a[1]),name:a[2].trim()}});if(new Set(e.map(e=>e.number)).size!==e.length)throw Error("중복된 번호가 있습니다. 확인해 주세요.");return e}()})&&C("")}catch(e){k(e instanceof Error?e.message:"학생 명단을 확인해 주세요.")}},children:[(0,s.jsx)("p",{children:"학생 명단을 처음 등록합니다. 이름과 번호를 확인한 뒤 등록해 주세요."}),(0,s.jsxs)("label",{children:["번호와 이름",(0,s.jsx)("textarea",{value:w,onChange:e=>C(e.target.value),rows:9,maxLength:1e4,required:!0,placeholder:"1 김민수\n2 이서연\n\n엑셀의 번호\xb7이름 두 열을 복사해 붙여 넣어도 됩니다."})]}),(0,s.jsx)("p",{className:_().note,children:"등록하면 담임 선생님의 학생 명단과 자동으로 이어집니다. 번호와 이름이 모두 같은 학생끼리 잇고, 학교 명단에만 있는 학생은 담임 학급에 추가합니다. 지워지는 자료는 없습니다."}),S&&(0,s.jsx)("p",{className:_().error,role:"alert",children:S}),(0,s.jsx)("button",{className:_().primary,disabled:n||!w.trim(),children:"학교 학생 명단 등록"})]}):(0,s.jsx)("p",{className:_().empty,children:"담임 또는 학교 관리자가 학생 명단을 등록하면 이곳에 표시됩니다."}),a.me.operator&&(0,s.jsx)($,{detail:a,schoolClass:I,busy:n,onBusyChange:r,onComplete:o},"".concat(I.id,":").concat(I.revision)),a.me.operator&&A.filter(e=>e.id===u).map(e=>(0,s.jsx)(ee,{detail:a,schoolClass:I,row:e,busy:n,onBusyChange:r,onClose:()=>p(""),onComplete:async()=>{p(""),await o()}},"".concat(e.id,":").concat(I.revision)))]}):(0,s.jsx)("p",{className:_().empty,children:"확인할 학급을 선택하세요."})})]}):(0,s.jsx)("p",{className:_().empty,children:a.me.operator?"함께 사용할 학급을 먼저 추가해 주세요.":"배정된 학급이 없습니다. 학교 관리자에게 담당 배정을 요청해 주세요."})]})}},29633:function(e){e.exports={chart:"school-org-chart_chart__F08cp",top:"school-org-chart_top___r_eH",topActions:"school-org-chart_topActions__s2Og8",banner:"school-org-chart_banner__tzCJz",group:"school-org-chart_group___v2Ba",groupHead:"school-org-chart_groupHead__0rXAi",grid:"school-org-chart_grid__ZTyKp",seat:"school-org-chart_seat__JoSgm",seatHead:"school-org-chart_seatHead__L86Sf",seatName:"school-org-chart_seatName__U6UhN",seatNameButton:"school-org-chart_seatNameButton__LPzo_",seatInput:"school-org-chart_seatInput__qeWwy",holder:"school-org-chart_holder__pt33Z",managerTag:"school-org-chart_managerTag__ErVdz",code:"school-org-chart_code__9U3fP",state:"school-org-chart_state__b3tK_",inlineAction:"school-org-chart_inlineAction__ezMau",menuButton:"school-org-chart_menuButton__LwHpX",menu:"school-org-chart_menu__V6v9n",danger:"school-org-chart_danger__Tcqqh",addSeat:"school-org-chart_addSeat__D61bv",addForm:"school-org-chart_addForm__WeOJ_",setup:"school-org-chart_setup__aBFXy",setupNote:"school-org-chart_setupNote__2Y6vK",gradeRow:"school-org-chart_gradeRow__Ystws",gradeToggle:"school-org-chart_gradeToggle__QcNVR",stepper:"school-org-chart_stepper__v0lG3",stepperOff:"school-org-chart_stepperOff__bh06B",setupSummary:"school-org-chart_setupSummary__9m_QI",setupActions:"school-org-chart_setupActions__n_T9v"}},44425:function(e){e.exports={chart:"school-org-directory_chart__yFUad",top:"school-org-directory_top__l7DSn",topActions:"school-org-directory_topActions__2EfRJ",banner:"school-org-directory_banner__5ut1Z",group:"school-org-directory_group__zN13w",groupHead:"school-org-directory_groupHead__qLq2J",addSeat:"school-org-directory_addSeat__JYQ78",tableScroll:"school-org-directory_tableScroll__6t8sY",table:"school-org-directory_table__E8pUT",nameColumn:"school-org-directory_nameColumn__fBDSh",accountColumn:"school-org-directory_accountColumn__o0JYo",roleColumn:"school-org-directory_roleColumn__RkXnU",statusColumn:"school-org-directory_statusColumn__IKC6E",actionColumn:"school-org-directory_actionColumn__j8pl3",identity:"school-org-directory_identity__wvqiD",selfLabel:"school-org-directory_selfLabel__uEdLa",muted:"school-org-directory_muted____jQU",account:"school-org-directory_account__pWeJu",inviteAvatar:"school-org-directory_inviteAvatar__AjVCl",managerTag:"school-org-directory_managerTag__q6mUq",code:"school-org-directory_code__K2Loq",state:"school-org-directory_state__QXEAd",expiry:"school-org-directory_expiry__DEztL",inlineAction:"school-org-directory_inlineAction__aATLs",seatNameButton:"school-org-directory_seatNameButton__LFDPL",seatInput:"school-org-directory_seatInput__wZeHH",actions:"school-org-directory_actions__Z796q",menuButton:"school-org-directory_menuButton__M_ONt",personRow:"school-org-directory_personRow__65zSE",expandedRow:"school-org-directory_expandedRow__0O_ki",rowActions:"school-org-directory_rowActions__Mr1oq",danger:"school-org-directory_danger__FS6hF",addForm:"school-org-directory_addForm__iSjPb",empty:"school-org-directory_empty__crQza",srOnly:"school-org-directory_srOnly__UZO6M",officeRow:"school-org-directory_officeRow__nhC_6",filters:"school-org-directory_filters__2a20T",dragHelp:"school-org-directory_dragHelp__3xraJ",dragHandle:"school-org-directory_dragHandle__LcgYu",dragPreview:"school-org-directory_dragPreview__gU4wc",scopeSummary:"school-org-directory_scopeSummary__OYeMb",scopeForm:"school-org-directory_scopeForm__MlvDc",
1scopeIntro:"school-org-directory_scopeIntro__ThMKg",scopeFields:"school-org-directory_scopeFields__gnQtb",scopeHint:"school-org-directory_scopeHint__KuYZt",editorFooter:"school-org-directory_editorFooter__azPuK","waiting-dot":"school-org-directory_waiting-dot__vf6JU",roleRows:"school-org-directory_roleRows__GpcHt",selectWrap:"school-org-directory_selectWrap___PpoB"}}}]);

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.