1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1254,3390],{41254:function(e,t,n){n.r(t),n.d(t,{NotificationIcon:function(){return x}});var i=n(57437),s=n(64067),a=n(23390),r=n(23121),o=n(74610),c=n(29827),l=n(58962),d=n(71632),u=n(94906),m=n(76994),f=n(56410),h=n(2265);function x(e){let{defaultOpen:t=!1}=e,n=(0,m.tv)(),[x,g]=(0,h.useState)(t),[y,p]=(0,h.useState)("ALL"),[v,w]=(0,h.useState)(null),[b,j]=(0,h.useState)(!1),[N,E]=(0,h.useState)("center"),[S,k]=(0,h.useState)(new Set),[A,R]=(0,h.useState)(new Set),[q,C]=(0,h.useState)(new Set),L=(0,h.useRef)(null),D=(0,h.useRef)(null),Q=(0,h.useRef)(null),K=(0,c.NL)(),F=(0,h.useCallback)(()=>{var e;let t=window.innerWidth,n=null===(e=D.current)||void 0===e?void 0:e.getBoundingClientRect();n&&(n.left+n.width/2+192>t-16?E("right"):E("center"))},[!1]),{data:I,isLoading:P,isFetchingNextPage:T,hasNextPage:U,fetchNextPage:_,refetch:W}=(0,l.N)({queryKey:["notifications"],queryFn:e=>{let{pageParam:t=1}=e;return(0,a.Jq)({page:t,limit:20,days:7})},getNextPageParam:(e,t)=>{if(!(e.items.length<20))return t.length+1},refetchInterval:!!x&&6e4,staleTime:3e4,initialPageParam:1}),{data:M=0,isLoading:z,error:H,refetch:Z}=(0,d.a)({queryKey:["unread-notifications-count"],queryFn:a.tn,refetchInterval:6e4,staleTime:3e4});(0,h.useEffect)(()=>{x&&F()},[x,F]);let B=(0,h.useRef)(!1);(0,h.useEffect)(()=>{if(!B.current){B.current=!0;return}x&&W()},[x,W]),(0,h.useEffect)(()=>{if(x)return document.addEventListener("mousedown",e),window.addEventListener("resize",t),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("resize",t)};function e(e){L.current&&!L.current.contains(e.target)&&(G(),w(null),C(new Set))}function t(){x&&F()}},[x,F]);let J=(0,h.useMemo)(()=>(null==I?void 0:I.pages.flatMap(e=>e.items))||[],[null==I?void 0:I.pages]),O=(0,h.useMemo)(()=>J.filter(e=>"ALL"===y||e.status===y),[J,y]),Y=(0,h.useMemo)(()=>O.filter(e=>"UNREAD"===e.status).length,[O]);(0,h.useEffect)(()=>{let e=Q.current;if(!e||!x)return;let t=()=>{let{scrollTop:t,scrollHeight:n,clientHeight:i}=e;n-t-i<100&&U&&!T&&_()};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},[x,U,T,_]),(0,h.useEffect)(()=>{if(x&&O.length>0){let e=setTimeout(()=>{x&&O.length&&(R(e=>new Set(e)),C(e=>{let t=new Set,n=new Set(e);return O.forEach(i=>{if(e.has(i.id)){t.add(i.id);return}let s=document.querySelector('[data-message-id="'.concat(i.id,'"]'));s&&s.scrollHeight>s.clientHeight&&(t.add(i.id),n.add(i.id))}),R(t),n}))},100);return()=>clearTimeout(e)}},[x,O]);let G=()=>{g(!1),p("ALL"),k(new Set),R(new Set),C(new Set),w(null)},V=(e,t)=>{t.stopPropagation(),k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},X=async()=>{j(!0),R(new Set),C(new Set),k(new Set),await Promise.all([W(),Z()]),setTimeout(()=>{j(!1),setTimeout(()=>{x&&(R(e=>new Set(e)),C(e=>{let t=new Set,n=new Set(e);return O.forEach(e=>{let i=document.querySelector('[data-message-id="'.concat(e.id,'"]'));i&&i.scrollHeight>i.clientHeight&&(t.add(e.id),n.add(e.id))}),R(t),n}))},100)},500)},$=(e,t)=>{t.stopPropagation(),w(v===e?null:e)},ee=async e=>{K.setQueryData(["notifications"],t=>(null==t?void 0:t.pages)?{...t,pages:t.pages.map(t=>({...t,items:t.items.map(t=>t.id===e?{...t,status:"READ"}:t)}))}:t);try{await (0,a.S1)(e,"READ")||K.invalidateQueries({queryKey:["notifications"]}),K.invalidateQueries({queryKey:["unread-notifications-count"]})}catch(e){console.error("ì½ì ì²ë¦¬ ì¤í¨:",e),K.invalidateQueries({queryKey:["notifications"]}),K.invalidateQueries({queryKey:["unread-notifications-count"]})}w(null)},et=async e=>{K.setQueryData(["notifications"],t=>(null==t?void 0:t.pages)?{...t,pages:t.pages.map(t=>({...t,items:t.items.map(t=>t.id===e?{...t,status:"UNREAD"}:t)}))}:t);try{await (0,a.S1)(e,"UNREAD")||K.invalidateQueries({queryKey:["notifications"]}),K.invalidateQueries({queryKey:["unread-notifications-count"]})}catch(e){console.error("ì ì½ì ì²ë¦¬ ì¤í¨:",e),K.invalidateQueries({queryKey:["notifications"]}),K.invalidateQueries({queryKey:["unread-notifications-count"]})}w(null)},en=async e=>
1{K.setQueryData(["notifications"],t=>(null==t?void 0:t.pages)?{...t,pages:t.pages.map(t=>({...t,items:t.items.filter(t=>t.id!==e)}))}:t);try{await (0,a.S1)(e,"DELETED")||K.invalidateQueries({queryKey:["notifications"]}),K.invalidateQueries({queryKey:["unread-notifications-count"]})}catch(e){console.error("ì림 ìì ì¤í¨:",e),K.invalidateQueries({queryKey:["notifications"]}),K.invalidateQueries({queryKey:["unread-notifications-count"]})}w(null)},ei=async()=>{let e=O.filter(e=>"UNREAD"===e.status);if(0===e.length)return;let t=e.map(e=>e.id);K.setQueryData(["notifications"],e=>(null==e?void 0:e.pages)?{...e,pages:e.pages.map(e=>({...e,items:e.items.map(e=>t.includes(e.id)?{...e,status:"READ"}:e)}))}:e);try{let e=await (0,a.FY)(t);e.failedCount>0&&(console.warn("".concat(e.failedCount,"ê° ì림 ì½ì ì²ë¦¬ ì¤í¨:"),e.failedNotificationIds),K.invalidateQueries({queryKey:["notifications"]})),K.invalidateQueries({queryKey:["unread-notifications-count"]})}catch(e){console.error("ì ì²´ ì½ì ì²ë¦¬ ì¤í¨:",e),K.invalidateQueries({queryKey:["notifications"]}),K.invalidateQueries({queryKey:["unread-notifications-count"]})}},es=async e=>{if("UNREAD"===e.status){K.setQueryData(["notifications"],t=>(null==t?void 0:t.pages)?{...t,pages:t.pages.map(t=>({...t,items:t.items.map(t=>t.id===e.id?{...t,status:"READ"}:t)}))}:t);try{await (0,a.S1)(e.id,"READ")||K.invalidateQueries({queryKey:["notifications"]}),K.invalidateQueries({queryKey:["unread-notifications-count"]})}catch(e){console.error("ì림 ì½ì ì²ë¦¬ ì¤í¨:",e),K.invalidateQueries({queryKey:["notifications"]}),K.invalidateQueries({queryKey:["unread-notifications-count"]})}}if(e.link){if(e.link.startsWith("inquiryThreadsId_")){let t=e.link.replace("inquiryThreadsId_","").split("&"),i=t[0],s=t.find(e=>e.startsWith("userCode_")),a=s?"?userCode=".concat(s.replace("userCode_","")):"";n.push("/admin/inquiry/".concat(i).concat(a))}else e.link.startsWith("http")?window.open(e.link,"_blank"):e.link.startsWith("/admin")?n.push(e.link):window.location.href=e.link}G()},ea=e=>{try{let t=new Date(e);return(0,u.Q)(t,{addSuffix:!0,locale:f.ko})}catch(e){return"ë°©ê¸ ì "}};return(0,i.jsxs)("div",{className:"relative",ref:L,children:[(0,i.jsxs)("button",{ref:D,onClick:()=>{x?G():(F(),g(!0))},className:"relative flex items-center justify-center w-9 h-9 rounded-lg hover:bg-[--muted] transition-colors",children:[(0,i.jsx)(r.Z,{className:"w-5 h-5",strokeWidth:2.5}),M>0&&(0,i.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2.5 h-2.5 bg-[--primary] rounded-full border-2 border-[--card-background] animate-pulse"})]}),x&&(0,i.jsxs)(i.Fragment,{children:[!1,(0,i.jsxs)("div",{className:"".concat("absolute top-full mt-2 w-96 z-[60] h-[740px] rounded-lg ".concat("center"===N?"left-1/2 -translate-x-1/2":"right-0")," bg-[--card-background] border border-[--border] shadow-lg overflow-hidden"),children:[(0,i.jsxs)("div",{className:"p-4 border-b border-[--border]",children:[!1,(0,i.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("h3",{className:"text-sm font-medium text-[--foreground]",children:"ì림"}),(0,i.jsx)("span",{className:"text-[--muted-foreground] ".concat("text-xs"),children:"ìµê·¼ 7ì¼ ì림 ë´ì"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("button",{onClick:ei,className:"bg-[#FF4717] text-white rounded hover:bg-[#FF4717]/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed ".concat("px-2 py-1 text-xs"),disabled:0===Y||b,title:0===Y?"ì½ì§ ìì ìë¦¼ì´ ììµëë¤":"".concat(Y,"ê° ì림ì ì½ì ì²ë¦¬"),children:"ì ì²´ ì½ì"}),(0,i.jsx)("button",{onClick:X,className:"hover:bg-[--muted] rounded transition-colors ".concat("p-1"),disabled:b,children:b?(0,i.jsxs)("svg",{className:"animate-spin ".concat("w-4 h-4"),viewBox:"0 0 24 24",children:[(0,i.jsx)("path",{fill:"currentColor",d:"M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z",opacity:".25"}),(0,i.jsx)("path",{fill:"currentColor",d:"M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"})]}):(0,i.jsx)("svg",{className:"".concat("w-4 h-4"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]}),(0,i.jsx)("div",{className:"flex gap-2",children:["ALL","UNREAD","READ"].map(e=>(0,i.jsx)("button",{onClick:()=>
1p(e),className:"py-2 px-4 rounded-full border transition-colors ".concat("text-xs"," ").concat(y===e?"bg-[#FF4717] text-white border-[#FF4717]":"bg-transparent text-[--muted-foreground] border-[--border] hover:text-[--foreground]"),children:"ALL"===e?"ì ì²´":"UNREAD"===e?"ìì½ì":"ì½ì"},e))})]}),(0,i.jsx)("div",{ref:Q,className:"overflow-y-auto ".concat("h-[620px]"),children:P?(0,i.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,i.jsx)(s.a,{size:"sm",text:"ë¡ë© ì¤..."})}):0===O.length?(0,i.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,i.jsx)("div",{className:"text-sm text-[--muted-foreground]",children:"ìë¡ì´ ìë¦¼ì´ ììµëë¤"})}):(0,i.jsxs)("div",{className:"divide-y divide-[--border]",children:[O.map(e=>(0,i.jsxs)("div",{className:"relative hover:bg-[--muted] transition-colors ".concat("p-4"," ").concat("UNREAD"===e.status?"bg-blue-50/10":""),children:[(0,i.jsxs)("div",{onClick:()=>es(e),className:"flex items-start gap-3 cursor-pointer ".concat("pr-8"),children:[(0,i.jsx)("div",{className:"w-2 h-2 rounded-full mt-2 flex-shrink-0 ".concat("UNREAD"===e.status?"bg-blue-500":"bg-gray-300")}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("div",{className:"font-medium text-[--foreground] truncate ".concat("text-sm"),children:e.title}),(0,i.jsx)("div",{"data-message-id":e.id,className:"text-[--muted-foreground] mt-1 ".concat("text-sm"," ").concat(S.has(e.id)?"max-h-32 overflow-y-auto":""),style:S.has(e.id)?{}:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.message}),(0,i.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,i.jsx)("div",{children:(A.has(e.id)||S.has(e.id)||q.has(e.id))&&(0,i.jsx)("button",{onClick:t=>V(e.id,t),className:"text-xs text-[--primary] hover:underline cursor-pointer",children:S.has(e.id)?"ì 기":"ë보기"})}),(0,i.jsx)("div",{className:"text-xs text-[--muted-foreground]",children:ea(e.createdAt)})]})]})]}),(0,i.jsxs)("div",{className:"absolute ".concat("top-4 right-4"),children:[(0,i.jsx)("button",{onClick:t=>$(e.id,t),className:"hover:bg-[--muted] rounded transition-colors ".concat("p-1"),children:(0,i.jsx)(o.Z,{className:"text-[--muted-foreground] ".concat("w-4 h-4")})}),v===e.id&&(0,i.jsxs)("div",{className:"absolute top-full right-0 mt-1 bg-[--card-background] border border-[--border] rounded-lg shadow-lg z-50 ".concat("min-w-[120px]"),children:["UNREAD"===e.status&&(0,i.jsx)("button",{onClick:()=>ee(e.id),className:"w-full text-left px-3 py-2 ".concat("text-sm"," text-[--foreground] hover:bg-[--muted] first:rounded-t-lg"),children:"ì½ì ì²ë¦¬"}),"READ"===e.status&&(0,i.jsx)("button",{onClick:()=>et(e.id),className:"w-full text-left px-3 py-2 ".concat("text-sm"," text-[--foreground] hover:bg-[--muted] first:rounded-t-lg"),children:"ì ì½ì ì²ë¦¬"}),(0,i.jsx)("button",{onClick:()=>en(e.id),className:"w-full text-left px-3 py-2 ".concat("text-sm"," text-red-600 hover:bg-[--muted] last:rounded-b-lg"),children:"ìì "})]})]})]},e.id)),T&&(0,i.jsx)("div",{className:"p-4 flex items-center justify-center",children:(0,i.jsx)(s.a,{size:"sm",text:"ë ë§ì ì림ì ë¶ë¬ì¤ë ì¤..."})}),!U&&O.length>0&&(0,i.jsx)("div",{className:"p-4 text-center",children:(0,i.jsx)("div",{className:"text-xs text-[--muted-foreground]",children:"모ë ì림ì íì¸íìµëë¤"})})]})})]})]})]})}},64067:function(e,t,n){n.d(t,{a:function(){return s}});var i=n(57437);function s(e){let{size:t="md",text:n,fullScreen:s=!1,inline:a=!1,className:r}=e,o=!s&&(a||"xs"===t||"sm"===t),c=null!=n?n:o?void 0:"ë¶ë¬ì¤ë ì¤...",l=o?(0,i.jsx)("div",{className:"animate-spin rounded-full border-t-2 border-b-2 border-[--primary] ".concat({xs:"h-4 w-4",sm:"h-8 w-8",md:"h-12 w-12",lg:"h-16 w-16"}[t]," ").concat(null!=r?r:"")}):(0,i.jsx)("img",{src:"/lingo_jump_transparent.webp",alt:"","aria-hidden":"true",className:"object-contain ".concat({xs:"h-4 w-4",sm:"h-8 w-8",md:"h-24 w-24",lg:"h-32 w-32"}[t]," ").concat(null!=r?r:"")});if(o)return c?(0,i.jsxs)("span",{className:"inline-flex items-center gap-2",children:[l,(0,i.jsx)("span",{className:"text-[--muted-foreground] font-[inherit]",children:c})]}):l;let d=(0,i.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[l,c&&(0,i.jsx)("div",{className:"text-[--muted-foreground] font-[inherit]",children:c})]});return s?(0,i.jsx)("div",{className:"flex items-center justify-center min-h-screen",children:d}):(0,i.jsx)("div",{className:"flex items-center justify-center w-full h-full",children:d})}},23390:function(e,t,n){n.d(t,{FY:function(){return c},Jq:function(){return o},S1:function(){return a},notifyArticlePublishers:function(){return f},tn:function(){return l}});var i=n(93340),s=n(59578);async function a(e,t){try{return(await (0,s.nc)("/api/notifications/status",{notificationId:e,status:t})).success||!1}catch(e){return console.error("ì림 ìí ë³ê²½ ì¤í¨:",e),!1}}async function r(e){try{return await (0,s.nc)("/api/notifications/batch-status",e)}catch(t){return console.error("ë¤ì¤ ì림 ìí ë³ê²½ ì¤í¨:",t),{message:"ë¤ì¤ ì림 ìí ë³ê²½ì ì¤í¨íìµëë¤.",totalRequested:e.notificationIdList.length,successCount:0,failedCount:e.notificationIdList.length,failedNotificationIds:e.notificationIdList}}}async function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=new URLSearchParams;e.status&&t.set("status",e.status),e.page&&t.set("page",e.page.toString()),e.limit&&t.set("limit",e.limit.toString()),e.days&&t.set("days",e.days.toString());let n="/api/notifications".concat(t.toString()?"?".concat(t.toString()):"");return await (0,s.R1)(n)}catch(e){return console.error("ì림 ëª©ë¡ ì¡°í ì¤í¨:",e),{items:[],total:0,page:1,totalPages:0}}}async function c(e){return r({notificationIdList:e,status:"READ"})}async function l(){try{return(await (0,s.R1)("/api/notifications/count")).unreadCount||0}catch(e){return console.error("ì½ì§ ìì ì림 ê°ì ì¡°í ì¤í¨:",e),0}}async function d(e){try{return await (0,s.sg)("/api/notifications",e)}catch(e){var t;if(console.error("ì림 ìì± ì¤í¨:",e),null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.data)return e.response.data;return{error:"ì림 ìì± ì¤ ììì¹ ëª»í ì¤ë¥ê° ë°ìíìµëë¤.",details:[{field:"system",message:"ë¤í¸ìí¬ ì¤ë¥ ëë ìë² ì¤ë¥ê° ë°ìíìµëë¤."}]}}}async function u(e,t,n,i){return d({title:t,message:n,link:i,externalUserKeys:e})}async function m(e,t){try{let n=new URLSearchParams;n.set("action",e),n.set("subject",t),n.set("keysOnly","true");let i="/api/users/by-permission?".concat(n.toString());return(await (0,s.R1)(i)).userKeys||[]}catch(e){return console.error("ê¶íë³ ì¬ì©ì í¤ ì¡°í ì¤í¨:",e),[]}}async function f(e,t,n){let s=await m(i.PermissionAction.CREATE,i.PermissionSubject.ARTICLE);return 0===s.length?(console.warn("â ï¸ ë°í ê¶íì ê°ì§ ì¬ì©ìê° ììµëë¤."),{error:"ë°í ê¶íì ê°ì§ ì¬ì©ìê° ììµëë¤.",details:[{field:"permission",message:"CREATE ARTICLE ê¶íì ê°ì§ ì¬ì©ìê° ì¡´ì¬íì§ ììµëë¤."}]}):u(s,e,t,n)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.