import{n as e}from"./hooks-CIB34lAK.js";import{o as t}from"./usersRtkApi-CxqBEUpQ.js";var n={none:0,view:1,view_edit:2,full:3};function r(r){let i=e(e=>e.auth.user)?.user_type===`admin`,{data:a,isLoading:o}=t(void 0,{skip:!i});if(!i)return{canView:!0,canEdit:!0,canDelete:!0,level:`full`,isLoading:!1,isSuperuser:!1};if(a?.is_superuser)return{canView:!0,canEdit:!0,canDelete:!0,level:`full`,isLoading:!1,isSuperuser:!0};let s=a?.modules?.[r]??`none`,c=n[s];return{canView:c>=1,canEdit:c>=2,canDelete:c>=3,level:s,isLoading:o,isSuperuser:!1}}function i(r){let i=e(e=>e.auth.user)?.user_type===`admin`,{data:a,isLoading:o}=t(void 0,{skip:!i});if(!i)return{canView:!0,canEdit:!0,canDelete:!0,level:`full`,isLoading:!1,isSuperuser:!1};if(a?.is_superuser)return{canView:!0,canEdit:!0,canDelete:!0,level:`full`,isLoading:!1,isSuperuser:!0};let s=r.includes(`.`)?r.split(`.`)[0]:r,c=a?.screens?.[r]??a?.modules?.[s]??`none`,l=n[c];return{canView:l>=1,canEdit:l>=2,canDelete:l>=3,level:c,isLoading:o,isSuperuser:!1}}function a(r){let i=e(e=>e.auth.user)?.user_type===`admin`,{data:a,isLoading:o}=t(void 0,{skip:!i}),s={};for(let e of r){if(!i){s[e]={canView:!0,canEdit:!0,canDelete:!0,level:`full`,isLoading:!1,isSuperuser:!1};continue}if(a?.is_superuser){s[e]={canView:!0,canEdit:!0,canDelete:!0,level:`full`,isLoading:!1,isSuperuser:!0};continue}let t=a?.modules?.[e]??`none`,r=n[t];s[e]={canView:r>=1,canEdit:r>=2,canDelete:r>=3,level:t,isLoading:o,isSuperuser:!1}}return s}export{a as n,i as r,r as t};