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])},928756,a=>{"use strict";var b=a.i(53112);let c=b.z.object({name:b.z.string().min(1,"Name is required"),code:b.z.string().min(1,"Code is required").max(10,"Code must be 10 characters or fewer").regex(/^[A-Z0-9]+$/,"Code must be uppercase letters/numbers"),description:b.z.string().optional()});a.s(["sopCategorySchema",0,c])},863366,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(928756),i=a.i(713095),j=b([f,g]);async function k(a){await (0,g.requirePermission)("sop-categories.manage");let b=h.sopCategorySchema.safeParse(a);if(!b.success)return{error:b.error.issues[0].message};let c=b.data;return await f.prisma.sopCategory.findFirst({where:{OR:[{name:c.name},{code:c.code}]}})?{error:"A category with this name or code already exists"}:(await f.prisma.sopCategory.create({data:c}),(0,e.revalidatePath)("/sa-tools/categories"),{success:!0})}async function l(a,b){await (0,g.requirePermission)("sop-categories.manage");let c=h.sopCategorySchema.safeParse(b);if(!c.success)return{error:c.error.issues[0].message};let d=c.data;return await f.prisma.sopCategory.findFirst({where:{OR:[{name:d.name},{code:d.code}],NOT:{id:a}}})?{error:"Another category with this name or code already exists"}:(await f.prisma.sopCategory.update({where:{id:a},data:d}),(0,e.revalidatePath)("/sa-tools/categories"),{success:!0})}async function m(a){return(await (0,g.requirePermission)("sop-categories.manage"),await f.prisma.sop.count({where:{categoryId:a}})>0)?{error:"Cannot delete a category that has SOPs"}:(await f.prisma.sopCategory.delete({where:{id:a}}),(0,e.revalidatePath)("/sa-tools/categories"),{success:!0})}[f,g]=j.then?(await j)():j,(0,i.ensureServerEntryExports)([k,l,m]),(0,d.registerServerReference)(k,"40006da9b132467c4a0569f4b7c03a8648b003a059",null),(0,d.registerServerReference)(l,"60c586e860e76312b7d2f054301dd08403ca4d511b",null),(0,d.registerServerReference)(m,"40c866c9fa803a012ab1ae314ea714c29276ac976b",null),a.s(["createSopCategory",()=>k,"deleteSopCategory",()=>m,"updateSopCategory",()=>l]),c()}catch(a){c(a)}},!1),442587,a=>a.a(async(b,c)=>{try{var d=a.i(863366),e=b([d]);[d]=e.then?(await e)():e,a.s([]),c()}catch(a){c(a)}},!1),972359,a=>a.a(async(b,c)=>{try{var d=a.i(442587),e=a.i(863366),f=b([d,e]);[d,e]=f.then?(await f)():f,a.s(["40006da9b132467c4a0569f4b7c03a8648b003a059",()=>e.createSopCategory,"40c866c9fa803a012ab1ae314ea714c29276ac976b",()=>e.deleteSopCategory,"60c586e860e76312b7d2f054301dd08403ca4d511b",()=>e.updateSopCategory]),c()}catch(a){c(a)}},!1)];

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