import{a as r,b as n}from"./chunk-E6DFULXS.js";import{O as a}from"./chunk-KBLF2WKH.js";var u=(()=>{let i=class i{constructor(){}normalizeRole(e){let t=String(e||"").toLowerCase().trim();return["super_admin","super-admin","superadmin","owner","root"].includes(t)?r.SUPER_ADMIN:["admin","administrator","moderator_admin"].includes(t)?r.ADMIN:["moderator","mod"].includes(t)?r.MODERATOR:Object.values(r).includes(t)?t:r.USER}getUserPermissions(e){if(!e)return n[r.USER];let t=this.normalizeRole(e.role);return n[t]||n[r.USER]}hasPermission(e,t){return this.getUserPermissions(e)[t]}isAdmin(e){return this.normalizeRole(e?.role)===r.ADMIN}isSuperAdmin(e){return this.normalizeRole(e?.role)===r.SUPER_ADMIN}isModerator(e){let t=this.normalizeRole(e?.role);return t===r.MODERATOR||t===r.ADMIN||t===r.SUPER_ADMIN}canAccessAdmin(e){return this.hasPermission(e,"canAccessAdmin")}getAllRoles(){return Object.values(r)}getRoleLabel(e){return{[r.USER]:"Utilisateur",[r.MODERATOR]:"Mod\xE9rateur",[r.ADMIN]:"Administrateur",[r.SUPER_ADMIN]:"Super Administrateur"}[e]}getRoleColor(e){return{[r.USER]:"primary",[r.MODERATOR]:"warning",[r.ADMIN]:"danger",[r.SUPER_ADMIN]:"dark"}[e]}isHigherRole(e,t){let s={[r.USER]:1,[r.MODERATOR]:2,[r.ADMIN]:3,[r.SUPER_ADMIN]:4};return s[e]>s[t]}};i.\u0275fac=function(t){return new(t||i)},i.\u0275prov=a({token:i,factory:i.\u0275fac,providedIn:"root"});let o=i;return o})();export{u as a};
