(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58346],{11012:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},14577:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},31966:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},35484:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(99537).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},54722:(e,s,t)=>{Promise.resolve().then(t.bind(t,96218))},96218:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>f});var a=t(95155),i=t(35484),l=t(11012),n=t(14577),r=t(92571),c=t(31966),d=t(65738),x=t(73321),h=t(12115),o=t(3765),m=t(64233),u=t(89239),j=t(42763);function f(){(0,o.si)("Inbox");let{id:e}=(0,x.useParams)(),s=(0,x.useRouter)(),[t,f]=(0,h.useState)(null),[p,y]=(0,h.useState)(!0),[k,v]=(0,h.useState)(!1),N=(0,h.useCallback)(async()=>{let s=await fetch("/api/inbox");if(s.ok){let t=((await s.json()).messages||[]).find(s=>s.id===e);f(t||null),t&&!t.read&&await fetch(`/api/inbox/${t.id}`,{method:"PATCH"})}y(!1)},[e]);(0,h.useEffect)(()=>{N()},[N]);let b=async()=>{await fetch(`/api/inbox/${e}`,{method:"DELETE"}),s.push("/inbox")};return p?(0,a.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,a.jsx)(r.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):t?(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(u.$,{variant:"ghost",size:"sm",onClick:()=>s.push("/inbox"),children:[(0,a.jsx)(c.A,{className:"h-4 w-4 mr-1"}),"Back"]}),(0,a.jsxs)(u.$,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>v(!0),children:[(0,a.jsx)(d.A,{className:"h-4 w-4 mr-1"}),"Delete"]})]}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[function(e){switch(e){case"error":return(0,a.jsx)(i.A,{className:"h-5 w-5 text-destructive shrink-0"});case"warning":return(0,a.jsx)(l.A,{className:"h-5 w-5 text-yellow-500 shrink-0"});default:return(0,a.jsx)(n.A,{className:"h-5 w-5 text-blue-500 shrink-0"})}}(t.priority),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-lg font-semibold",children:t.title}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-xs text-muted-foreground",children:[t.jobName&&(0,a.jsx)("span",{children:t.jobName}),(0,a.jsx)("span",{children:new Date(t.createdAt).toLocaleString()})]})]})]}),(0,a.jsx)("div",{className:"border-t pt-4",children:(0,a.jsx)(m.Y,{content:t.body,variant:"full"})}),(0,a.jsx)(j.lG,{open:k,onOpenChange:()=>v(!1),children:(0,a.jsxs)(j.Cf,{children:[(0,a.jsx)(j.c7,{children:(0,a.jsx)(j.L3,{children:"Delete Message"})}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Delete this message? This cannot be undone."}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(u.$,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),(0,a.jsx)(u.$,{variant:"destructive",onClick:b,children:"Delete"})]})]})})]}):(0,a.jsxs)("div",{className:"flex-1 p-4",children:[(0,a.jsxs)(u.$,{variant:"ghost",size:"sm",onClick:()=>s.push("/inbox"),children:[(0,a.jsx)(c.A,{className:"h-4 w-4 mr-1"}),"Back"]}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-8 text-center",children:"Message not found."})]})}}},e=>{e.O(0,[989,11242,3765,28441,93794,77358],()=>e(e.s=54722)),_N_E=e.O()}]);