module.exports=[451569,a=>{"use strict";let b={"products.view":["SUPER_ADMIN","MODERATOR"],"products.create":["SUPER_ADMIN"],"products.edit":["SUPER_ADMIN","MODERATOR"],"products.delete":["SUPER_ADMIN"],"blog.view":["SUPER_ADMIN","BLOG_EDITOR","MODERATOR"],"blog.create":["SUPER_ADMIN","BLOG_EDITOR"],"blog.edit":["SUPER_ADMIN","BLOG_EDITOR","MODERATOR"],"blog.publish":["SUPER_ADMIN","BLOG_EDITOR"],"blog.delete":["SUPER_ADMIN"],"team.view":["SUPER_ADMIN"],"team.manage":["SUPER_ADMIN"],"jobs.view":["SUPER_ADMIN","HR_MANAGER"],"jobs.manage":["SUPER_ADMIN","HR_MANAGER"],"inquiries.view":["SUPER_ADMIN","SUPPORT_AGENT","MODERATOR"],"inquiries.manage":["SUPER_ADMIN","SUPPORT_AGENT"],"tickets.view":["SUPER_ADMIN","SUPPORT_AGENT"],"tickets.manage":["SUPER_ADMIN","SUPPORT_AGENT"],"tickets.assign":["SUPER_ADMIN"],"leads.view":["SUPER_ADMIN","SUPPORT_AGENT"],"leads.manage":["SUPER_ADMIN","SUPPORT_AGENT"],"users.view":["SUPER_ADMIN"],"users.manage":["SUPER_ADMIN"],"services.view":["SUPER_ADMIN","MODERATOR"],"services.create":["SUPER_ADMIN"],"services.edit":["SUPER_ADMIN","MODERATOR"],"services.delete":["SUPER_ADMIN"],"pages.view":["SUPER_ADMIN","MODERATOR"],"pages.create":["SUPER_ADMIN"],"pages.edit":["SUPER_ADMIN","MODERATOR"],"pages.delete":["SUPER_ADMIN"],"publications.view":["SUPER_ADMIN","BLOG_EDITOR","MODERATOR"],"publications.create":["SUPER_ADMIN","BLOG_EDITOR"],"publications.edit":["SUPER_ADMIN","BLOG_EDITOR","MODERATOR"],"publications.delete":["SUPER_ADMIN"],"outlets.view":["SUPER_ADMIN","MODERATOR"],"outlets.create":["SUPER_ADMIN"],"outlets.edit":["SUPER_ADMIN","MODERATOR"],"outlets.delete":["SUPER_ADMIN"],"settings.view":["SUPER_ADMIN"],"settings.edit":["SUPER_ADMIN"],"sops.view":["SUPER_ADMIN","BLOG_EDITOR","HR_MANAGER","MODERATOR","SUPPORT_AGENT"],"sops.create":["SUPER_ADMIN","MODERATOR"],"sops.edit":["SUPER_ADMIN","MODERATOR"],"sops.approve":["SUPER_ADMIN"],"sops.delete":["SUPER_ADMIN"],"sop-categories.view":["SUPER_ADMIN","MODERATOR"],"sop-categories.manage":["SUPER_ADMIN"],"media.view":["SUPER_ADMIN","MODERATOR"],"media.upload":["SUPER_ADMIN","MODERATOR"],"media.delete":["SUPER_ADMIN"]};function c(a,c){return b[c].includes(a)}a.s(["hasPermission",()=>c])},903648,a=>{"use strict";var b=a.i(53112);let c=b.z.object({content:b.z.string().min(1,"Note content is required"),isInternal:b.z.boolean().default(!0)}),d=b.z.object({status:b.z.enum(["NEW","IN_PROGRESS","RESOLVED","CLOSED"]).optional(),priority:b.z.enum(["LOW","MEDIUM","HIGH","URGENT"]).optional(),assigneeId:b.z.string().optional().nullable()});a.s(["ticketNoteSchema",0,c,"ticketUpdateSchema",0,d])},140533,a=>a.a(async(b,c)=>{try{var d=a.i(137936),e=a.i(118558),f=a.i(766518),g=a.i(705949),h=a.i(903648),i=a.i(713095),j=b([f,g]);async function k(a,b){await (0,g.requirePermission)("tickets.manage");let c=h.ticketUpdateSchema.safeParse(b);if(!c.success)return{error:c.error.issues[0].message};let d={};return void 0!==c.data.status&&(d.status=c.data.status,"RESOLVED"===c.data.status&&(d.resolvedAt=new Date),"CLOSED"===c.data.status&&(d.closedAt=new Date)),void 0!==c.data.priority&&(d.priority=c.data.priority),void 0!==c.data.assigneeId&&(d.assigneeId=c.data.assigneeId||null),await f.prisma.ticket.update({where:{id:a},data:d}),(0,e.revalidatePath)("/admin/support/tickets"),(0,e.revalidatePath)(`/admin/support/tickets/${a}`),{success:!0}}async function l(a,b){let c=await (0,g.requireAuth)();await (0,g.requirePermission)("tickets.manage");let d=h.ticketNoteSchema.safeParse(b);return d.success?(await f.prisma.ticketNote.create({data:{content:d.data.content,isInternal:d.data.isInternal,ticketId:a,authorId:c.user.id}}),(0,e.revalidatePath)(`/admin/support/tickets/${a}`),{success:!0}):{error:d.error.issues[0].message}}async function m(a,b){return await (0,g.requirePermission)("tickets.assign"),await f.prisma.ticket.update({where:{id:a},data:{assigneeId:b}}),(0,e.revalidatePath)("/admin/support/tickets"),(0,e.revalidatePath)(`/admin/support/tickets/${a}`),{success:!0}}[f,g]=j.then?(await j)():j,(0,i.ensureServerEntryExports)([k,l,m]),(0,d.registerServerReference)(k,"6005499aa7a4aff64c9b8b2bb28e71b7da71e71632",null),(0,d.registerServerReference)(l,"6012d5f7b436da45007fec7dd883b4e79ecb2464f5",null),(0,d.registerServerReference)(m,"604b9d20374774724f1b27d929c7c094babde90438",null),a.s(["addTicketNote",()=>l,"updateTicket",()=>k]),c()}catch(a){c(a)}},!1),432925,a=>a.a(async(b,c)=>{try{var d=a.i(140533),e=b([d]);[d]=e.then?(await e)():e,a.s([]),c()}catch(a){c(a)}},!1),937870,a=>a.a(async(b,c)=>{try{var d=a.i(432925),e=a.i(140533),f=b([d,e]);[d,e]=f.then?(await f)():f,a.s(["6005499aa7a4aff64c9b8b2bb28e71b7da71e71632",()=>e.updateTicket,"6012d5f7b436da45007fec7dd883b4e79ecb2464f5",()=>e.addTicketNote]),c()}catch(a){c(a)}},!1)];

//# sourceMappingURL=_b7c7d1cc._.js.map