function permissionInSet(_0x43d7c9,_0x487a81){if(!_0x43d7c9||!_0x487a81)return![];if(_0x43d7c9['includes']('*'))return!![];if(_0x43d7c9['includes'](_0x487a81))return!![];const [_0x350c25]=_0x487a81['split'](':');if(_0x43d7c9['includes'](_0x350c25+':*'))return!![];return![];}function hasServerPermission(_0x5dcb48,_0x9e23fc){const _0x55ef85=_0x5dcb48?.['permissions']?.['server'];if(!_0x55ef85)return![];return permissionInSet(_0x55ef85,_0x9e23fc);}function hasEnvPermission(_0x19da2f,_0xb2b7f9){if(hasServerPermission(_0x19da2f,'*'))return!![];const _0x584213=_0x19da2f?.['permissions']?.['environments'];if(!_0x584213)return![];for(const _0x2beafd of Object['values'](_0x584213)){if(permissionInSet(_0x2beafd,_0xb2b7f9))return!![];}return![];}function hasEnvPermissionOn(_0x92e89a,_0x1afd44,_0x186688){if(hasServerPermission(_0x92e89a,'*'))return!![];const _0x3b9983=_0x92e89a?.['permissions']?.['environments']?.[_0x1afd44];if(!_0x3b9983)return![];return permissionInSet(_0x3b9983,_0x186688);}function hasTeamPermission(_0x5975ef,_0x436ebe){if(hasServerPermission(_0x5975ef,'*'))return!![];const _0x141345=_0x5975ef?.['permissions']?.['teams'];if(!_0x141345)return![];for(const _0x92487 of Object['values'](_0x141345)){if(permissionInSet(_0x92487,_0x436ebe))return!![];}return![];}function hasAnyEnvironment(_0x571d8d){if(hasServerPermission(_0x571d8d,'*'))return!![];const _0xd1246e=_0x571d8d?.['permissions']?.['environments'];return _0xd1246e!=null&&Object['keys'](_0xd1246e)['length']>0x0;}function canDeleteTask(_0x3611e3,_0x21a1a3){if(!_0x3611e3||!_0x21a1a3||!_0x21a1a3['environment'])return![];if(hasEnvPermissionOn(_0x3611e3,_0x21a1a3['environment'],'tasks:delete_any'))return!![];if(!hasEnvPermissionOn(_0x3611e3,_0x21a1a3['environment'],'tasks:delete'))return![];return _0x21a1a3['createdBy']?.['userId']===_0x3611e3['id'];}window['Permissions']={'hasServerPermission':hasServerPermission,'hasEnvPermission':hasEnvPermission,'hasEnvPermissionOn':hasEnvPermissionOn,'hasTeamPermission':hasTeamPermission,'hasAnyEnvironment':hasAnyEnvironment,'canDeleteTask':canDeleteTask};