/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.io.WhirlycacheFactory
 *  com.l7tech.identity.GroupBean
 *  com.l7tech.identity.User
 *  com.l7tech.identity.ldap.GroupMappingConfig
 *  com.l7tech.identity.ldap.LdapGroup
 *  com.l7tech.identity.ldap.LdapIdentityProviderConfig
 *  com.l7tech.identity.ldap.LdapUser
 *  com.l7tech.identity.ldap.MemberStrategy
 *  com.l7tech.identity.ldap.UserMappingConfig
 *  com.l7tech.objectmodel.EntityHeader
 *  com.l7tech.objectmodel.EntityHeaderSet
 *  com.l7tech.objectmodel.EntityType
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.IdentityHeader
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.Pair
 *  com.l7tech.util.ResourceUtils
 *  com.whirlycott.cache.Cache
 *  org.jetbrains.annotations.NotNull
 */
package com.l7tech.server.identity.ldap;

import com.l7tech.common.io.WhirlycacheFactory;
import com.l7tech.identity.GroupBean;
import com.l7tech.identity.User;
import com.l7tech.identity.ldap.GroupMappingConfig;
import com.l7tech.identity.ldap.LdapGroup;
import com.l7tech.identity.ldap.LdapIdentityProviderConfig;
import com.l7tech.identity.ldap.LdapUser;
import com.l7tech.identity.ldap.MemberStrategy;
import com.l7tech.identity.ldap.UserMappingConfig;
import com.l7tech.objectmodel.EntityHeader;
import com.l7tech.objectmodel.EntityHeaderSet;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.IdentityHeader;
import com.l7tech.server.Lifecycle;
import com.l7tech.server.LifecycleException;
import com.l7tech.server.identity.ldap.LdapClassLoaderRequired;
import com.l7tech.server.identity.ldap.LdapGroupManager;
import com.l7tech.server.identity.ldap.LdapIdentityProvider;
import com.l7tech.server.identity.ldap.LdapRuntimeConfig;
import com.l7tech.server.identity.ldap.LdapUserManager;
import com.l7tech.server.identity.ldap.LdapUtils;
import com.l7tech.server.identity.ldap.ad;
import com.l7tech.server.identity.ldap.ae;
import com.l7tech.server.identity.ldap.e;
import com.l7tech.server.identity.ldap.h;
import com.l7tech.server.identity.ldap.k;
import com.l7tech.server.identity.ldap.n;
import com.l7tech.server.identity.ldap.o;
import com.l7tech.server.identity.ldap.p;
import com.l7tech.server.identity.ldap.q;
import com.l7tech.server.identity.ldap.r;
import com.l7tech.server.identity.ldap.s;
import com.l7tech.server.identity.ldap.t;
import com.l7tech.server.identity.ldap.u;
import com.l7tech.server.identity.ldap.v;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.Pair;
import com.l7tech.util.ResourceUtils;
import com.whirlycott.cache.Cache;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.AuthenticationException;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
import javax.naming.OperationNotSupportedException;
import javax.naming.SizeLimitExceededException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.ldap.LdapName;
import org.jetbrains.annotations.NotNull;

@LdapClassLoaderRequired
public class LdapGroupManagerImpl
implements LdapGroupManager,
Lifecycle {
    private static final String a;
    private static final Logger b;
    private static final String c;
    private static final boolean d;
    private static final boolean e;
    private static final int f = 0;
    private static final long g = 60000L;
    private static final int h = 0;
    private LdapIdentityProviderConfig i;
    private LdapIdentityProvider j;
    private LdapRuntimeConfig k;
    private Goid l;
    private ad m;
    private Cache n;
    private int o = 0;
    private long p = 60000L;
    private int q = 0;
    private static final String[] r;

    @Override
    public synchronized void configure(LdapIdentityProvider ldapIdentityProvider) {
        this.j = ldapIdentityProvider;
        this.i = this.j.getConfig();
        this.o = this.a(this.i.getGroupCacheSize(), 0) * 2;
        this.p = this.a(this.i.getGroupCacheMaxAge(), 60000L);
        this.q = this.a(this.i.getGroupMaxNesting(), 0);
        this.m = new ae(this, this.i.getSearchBase(), this.a());
    }

    public void setLdapRuntimeConfig(LdapRuntimeConfig ldapRuntimeConfig) {
        this.k = ldapRuntimeConfig;
    }

    @Override
    public void start() throws LifecycleException {
        Cache cache;
        try {
            LdapGroupManagerImpl ldapGroupManagerImpl = this;
            cache = this.o < 1 ? null : WhirlycacheFactory.createCache((String)(r[14] + this.f() + ")"), (int)this.o, (int)33, (String)WhirlycacheFactory.POLICY_LFU);
        }
        catch (LifecycleException lifecycleException) {
            throw LdapGroupManagerImpl.a(lifecycleException);
        }
        ldapGroupManagerImpl.n = cache;
    }

    @Override
    public void stop() throws LifecycleException {
        Cache cache = this.n;
        try {
            this.n = null;
            if (cache != null) {
                WhirlycacheFactory.shutdown((Cache)cache);
            }
        }
        catch (LifecycleException lifecycleException) {
            throw LdapGroupManagerImpl.a(lifecycleException);
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    public LdapGroup findByPrimaryKey(String string) throws FindException {
        GroupCacheKey groupCacheKey = GroupCacheKey.buildDnKey(string);
        LdapGroup ldapGroup = this.a(groupCacheKey);
        if (ldapGroup == null) {
            Object object = groupCacheKey.getSync();
            synchronized (object) {
                ldapGroup = this.a(groupCacheKey);
                if (ldapGroup == null) {
                    LdapGroup[] ldapGroupArray = new LdapGroup[1];
                    LdapIdentityProviderConfig ldapIdentityProviderConfig = this.g();
                    try {
                        this.m.a(string, new o(this, ldapGroupArray));
                    }
                    catch (NameNotFoundException nameNotFoundException) {
                        if (b.isLoggable(Level.FINEST)) {
                            String string2 = ExceptionUtils.getMessage((Throwable)nameNotFoundException);
                            String string3 = ldapIdentityProviderConfig.getName();
                            String string4 = string;
                            String[] stringArray = r;
                            b.finest(stringArray[15] + string4 + stringArray[25] + string3 + stringArray[16] + string2 + ")");
                        }
                    }
                    catch (AuthenticationException authenticationException) {
                        String[] stringArray = r;
                        b.log(Level.WARNING, stringArray[9] + authenticationException.getMessage(), ExceptionUtils.getDebugException((Throwable)authenticationException));
                        throw new FindException(stringArray[0] + authenticationException.getMessage(), (Throwable)authenticationException);
                    }
                    catch (NamingException namingException) {
                        b.log(Level.WARNING, () -> r[10] + namingException.getMessage());
                        throw new FindException(r[8] + namingException.getMessage(), ExceptionUtils.getDebugException((Throwable)namingException));
                    }
                    ldapGroup = ldapGroupArray[0];
                }
            }
        }
        return ldapGroup;
    }

    public LdapGroup reify(GroupBean groupBean) {
        LdapGroup ldapGroup = new LdapGroup(groupBean.getProviderId(), groupBean.getId(), groupBean.getName());
        ldapGroup.setDescription(groupBean.getDescription());
        return ldapGroup;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    public LdapGroup findByName(String string) throws FindException {
        GroupCacheKey groupCacheKey = GroupCacheKey.buildCnKey(string);
        LdapGroup ldapGroup = this.a(groupCacheKey);
        if (ldapGroup == null) {
            Object object = groupCacheKey.getSync();
            synchronized (object) {
                ldapGroup = this.a(groupCacheKey);
                if (ldapGroup == null) {
                    LdapIdentityProvider ldapIdentityProvider = this.d();
                    String string2 = ldapIdentityProvider.groupSearchFilterWithParam(string, new MemberStrategy[0]);
                    LdapGroup[] ldapGroupArray = new LdapGroup[1];
                    try {
                        this.m.a(string2, 2L, null, new p(this, ldapGroupArray));
                    }
                    catch (AuthenticationException authenticationException) {
                        String[] stringArray = r;
                        b.log(Level.WARNING, stringArray[36] + authenticationException.getMessage(), ExceptionUtils.getDebugException((Throwable)authenticationException));
                        throw new FindException(stringArray[8] + authenticationException.getMessage(), (Throwable)authenticationException);
                    }
                    catch (NamingException namingException) {
                        b.log(Level.WARNING, namingException, () -> r[3] + namingException.getMessage());
                        throw new FindException(r[8] + namingException.getMessage(), (Throwable)namingException);
                    }
                    ldapGroup = ldapGroupArray[0];
                }
            }
        }
        return ldapGroup;
    }

    public void delete(LdapGroup ldapGroup) {
        throw new UnsupportedOperationException();
    }

    public void deleteAll(Goid goid) {
        throw new UnsupportedOperationException();
    }

    public void deleteAllVirtual(Goid goid) {
        throw new UnsupportedOperationException();
    }

    public void delete(String string) {
        throw new UnsupportedOperationException();
    }

    public String saveGroup(LdapGroup ldapGroup) {
        throw new UnsupportedOperationException();
    }

    public void update(LdapGroup ldapGroup) {
        throw new UnsupportedOperationException();
    }

    public String save(LdapGroup ldapGroup, Set set) {
        throw new UnsupportedOperationException();
    }

    public String save(Goid goid, LdapGroup ldapGroup, Set set) {
        throw new UnsupportedOperationException();
    }

    public void update(LdapGroup ldapGroup, Set set) {
        throw new UnsupportedOperationException();
    }

    public Collection<IdentityHeader> search(String string) throws FindException {
        LdapIdentityProvider ldapIdentityProvider = this.d();
        return ldapIdentityProvider.search(new EntityType[]{EntityType.GROUP}, string);
    }

    public Class getImpClass() {
        return LdapGroup.class;
    }

    public boolean isMember(User user, LdapGroup ldapGroup) throws FindException {
        try {
            if (!user.getProviderId().equals((Object)this.e())) {
                b.log(Level.FINE, r[19]);
                return false;
            }
        }
        catch (FindException findException) {
            throw LdapGroupManagerImpl.a((Exception)((Object)findException));
        }
        return this.a(user, ldapGroup, true, 1);
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    private boolean a(User user, LdapGroup ldapGroup, boolean bl2, int n2) throws FindException {
        LdapIdentityProviderConfig ldapIdentityProviderConfig = this.g();
        for (GroupMappingConfig groupMappingConfig : ldapIdentityProviderConfig.getGroupMappings()) {
            Attribute attribute;
            Object object2;
            Cloneable cloneable;
            MemberStrategy memberStrategy;
            block40: {
                memberStrategy = groupMappingConfig.getMemberStrategy();
                try {
                    if (!MemberStrategy.MEMBERS_BY_OU.equals((Object)memberStrategy) || !bl2) break block40;
                }
                catch (NamingException namingException) {
                    throw LdapGroupManagerImpl.a(namingException);
                }
                try {
                    cloneable = new LdapName(user.getId());
                    object2 = new LdapName(ldapGroup.getDn());
                    if (((LdapName)cloneable).startsWith((Name)object2)) {
                        return true;
                    }
                    if (!this.a(n2)) continue;
                    ArrayList<LdapGroup> arrayList = new ArrayList<LdapGroup>();
                    if (!this.b(ldapGroup, arrayList)) {
                        Object object3 = this.c(ldapGroup);
                        synchronized (object3) {
                            if (!this.b(ldapGroup, arrayList)) {
                                String namingException = this.j.groupSearchFilterWithParam("*", new MemberStrategy[0]);
                                this.m.a(ldapGroup.getDn(), namingException, 0L, null, (k)new q(this, ldapGroup, arrayList));
                                this.c(ldapGroup, arrayList);
                            }
                        }
                    }
                    for (LdapGroup ldapGroup2 : arrayList) {
                        if (!this.a(user, ldapGroup2, false, n2 + 1)) continue;
                        return true;
                    }
                    continue;
                }
                catch (NamingException namingException) {
                    String[] stringArray = r;
                    object2 = stringArray[29];
                    b.log(Level.WARNING, namingException, () -> LdapGroupManagerImpl.lambda$isMember$2((String)object2, namingException));
                    throw new FindException((String)object2 + namingException.getMessage(), (Throwable)namingException);
                }
            }
            cloneable = ldapGroup.getAttributes();
            try {
                attribute = cloneable == null ? null : cloneable.get(groupMappingConfig.getMemberAttrName());
            }
            catch (NamingException namingException) {
                throw LdapGroupManagerImpl.a(namingException);
            }
            object2 = attribute;
            try {
                if (object2 == null) {
                    continue;
                }
            }
            catch (NamingException namingException) {
                throw LdapGroupManagerImpl.a(namingException);
            }
            for (int i2 = 0; i2 < object2.size(); ++i2) {
                try {
                    String string2;
                    block42: {
                        block41: {
                            string2 = (String)object2.get(i2);
                            try {
                                if (!MemberStrategy.MEMBERS_ARE_LOGIN.equals((Object)memberStrategy)) break block41;
                                if (!this.a(string2, user.getLogin())) continue;
                            }
                            catch (NamingException namingException) {
                                throw LdapGroupManagerImpl.a(namingException);
                            }
                            return true;
                        }
                        try {
                            if (!MemberStrategy.MEMBERS_ARE_DN.equals((Object)memberStrategy)) break block42;
                            if (!this.a(string2, user.getId())) continue;
                        }
                        catch (NamingException namingException) {
                            throw LdapGroupManagerImpl.a(namingException);
                        }
                        return true;
                    }
                    if (!MemberStrategy.MEMBERS_ARE_NVPAIR.equals((Object)memberStrategy)) continue;
                    for (String string2 : this.b()) {
                        if (!this.a(string2, string2 + "=" + user.getName())) continue;
                        return true;
                    }
                    if (!this.a(string2, user.getId())) continue;
                    return true;
                }
                catch (NamingException namingException) {
                    b.log(Level.WARNING, r[37] + namingException.getMessage(), ExceptionUtils.getDebugException((Throwable)namingException));
                }
            }
            if (!this.a(n2)) continue;
            ArrayList<String> arrayList = new ArrayList<String>();
            try {
                for (int i3 = 0; i3 < object2.size(); ++i3) {
                    String string;
                    block43: {
                        String string2;
                        string = (String)object2.get(i3);
                        if (this.a(ldapGroup, string)) continue;
                        string2 = null;
                        if (MemberStrategy.MEMBERS_ARE_LOGIN.equals((Object)memberStrategy)) {
                            string2 = this.findByName((String)object2.get(i3));
                        } else if (MemberStrategy.MEMBERS_ARE_DN.equals((Object)memberStrategy)) {
                            string2 = this.findByPrimaryKey(string);
                        } else if (MemberStrategy.MEMBERS_ARE_NVPAIR.equals((Object)memberStrategy)) {
                            String string3 = this.a(string);
                            string2 = this.findByName(string3);
                        }
                        try {
                            if (string2 == null) break block43;
                            if (!this.a(user, (LdapGroup)string2, true, n2 + 1)) continue;
                        }
                        catch (NamingException namingException) {
                            throw LdapGroupManagerImpl.a(namingException);
                        }
                        boolean bl3 = true;
                        return bl3;
                    }
                    try {
                        arrayList.add(string);
                        continue;
                    }
                    catch (NamingException namingException) {
                        // empty catch block
                    }
                }
            }
            finally {
                this.a(ldapGroup, arrayList);
            }
        }
        return false;
    }

    private boolean a(String string, String string2) {
        boolean bl2;
        block3: {
            block2: {
                try {
                    if (!this.g().isGroupMembershipCaseInsensitive() && e) break block2;
                }
                catch (UnsupportedOperationException unsupportedOperationException) {
                    throw LdapGroupManagerImpl.a(unsupportedOperationException);
                }
                bl2 = string.equalsIgnoreCase(string2);
                break block3;
            }
            bl2 = string.equals(string2);
        }
        return bl2;
    }

    private String a(String string) {
        String string2 = string;
        int n2 = string2.indexOf(61);
        if (n2 > 0) {
            string2 = string2.substring(n2 + 1);
        }
        return string2;
    }

    public void addUsers(LdapGroup ldapGroup, Set set) {
        throw new UnsupportedOperationException();
    }

    public void removeUsers(LdapGroup ldapGroup, Set set) {
        throw new UnsupportedOperationException();
    }

    public void addUser(LdapUser ldapUser, Set set) {
        throw new UnsupportedOperationException();
    }

    public void removeUser(LdapUser ldapUser, Set set) {
        throw new UnsupportedOperationException();
    }

    public void addUser(LdapUser ldapUser, LdapGroup ldapGroup) {
        throw new UnsupportedOperationException();
    }

    public void removeUser(LdapUser ldapUser, LdapGroup ldapGroup) {
        throw new UnsupportedOperationException();
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    public Set<IdentityHeader> getGroupHeaders(LdapUser ldapUser) throws FindException {
        String string;
        Object object;
        LdapIdentityProvider ldapIdentityProvider = this.d();
        LdapIdentityProviderConfig ldapIdentityProviderConfig = this.g();
        EntityHeaderSet entityHeaderSet = ldapIdentityProviderConfig.getGroupMappings();
        boolean bl2 = false;
        h h2 = new h();
        h2.or();
        for (Object object2 : entityHeaderSet) {
            object = object2.getObjClass();
            string = object2.getMemberAttrName();
            MemberStrategy memberStrategy = object2.getMemberStrategy();
            if (MemberStrategy.MEMBERS_BY_OU.equals((Object)memberStrategy)) {
                bl2 = true;
                continue;
            }
            try {
                if (MemberStrategy.MEMBERS_ARE_LOGIN.equals((Object)memberStrategy)) {
                    h2.and();
                    h2.objectClass((String)object);
                    h2.attrEquals(string, ldapUser.getLogin());
                    h2.end();
                    continue;
                }
            }
            catch (AuthenticationException authenticationException) {
                throw LdapGroupManagerImpl.a(authenticationException);
            }
            try {
                if (MemberStrategy.MEMBERS_ARE_DN.equals((Object)memberStrategy)) {
                    h2.and();
                    h2.objectClass((String)object);
                    h2.attrEquals(string, ldapUser.getId());
                    h2.end();
                    continue;
                }
            }
            catch (AuthenticationException authenticationException) {
                throw LdapGroupManagerImpl.a(authenticationException);
            }
            if (!MemberStrategy.MEMBERS_ARE_NVPAIR.equals((Object)memberStrategy)) continue;
            h2.and();
            h2.objectClass((String)object);
            Set<String> set = this.b();
            h2.or();
            for (String string2 : set) {
                h2.attrEquals(string, string2 + "=" + ldapUser.getName());
            }
            h2.attrEquals(string, ldapUser.getId());
            h2.end();
            h2.end();
        }
        h2.end();
        EntityHeaderSet entityHeaderSet2 = new EntityHeaderSet();
        if (!h2.isEmpty()) {
            DirContext dirContext = null;
            try {
                Object object2;
                try {
                    dirContext = ldapIdentityProvider.getBrowseContext();
                }
                catch (AuthenticationException authenticationException) {
                    String[] stringArray = r;
                    object2 = stringArray[41];
                    b.log(Level.WARNING, stringArray[33] + authenticationException.getMessage(), ExceptionUtils.getDebugException((Throwable)authenticationException));
                    throw new FindException((String)object2 + authenticationException.getMessage(), (Throwable)authenticationException);
                }
                catch (NamingException namingException) {
                    String[] stringArray = r;
                    object2 = stringArray[13];
                    b.log(Level.WARNING, namingException, () -> LdapGroupManagerImpl.lambda$getGroupHeaders$3((String)object2, namingException));
                    throw new FindException((String)object2 + namingException.getMessage(), (Throwable)namingException);
                }
                long l2 = this.k.getMaxGroupSearchResultSize();
                try {
                    object = dirContext;
                    this.m.a(dirContext, h2.buildFilter(), l2, null, (k)new r(this, ldapIdentityProvider, entityHeaderSet2, (DirContext)object));
                }
                catch (SizeLimitExceededException sizeLimitExceededException) {
                    String[] stringArray = r;
                    b.log(Level.FINE, stringArray[11], sizeLimitExceededException);
                    entityHeaderSet2.setMaxExceeded(l2);
                }
                catch (NamingException namingException) {
                    string = r[39];
                    b.log(Level.WARNING, namingException, () -> string + namingException.getMessage());
                    throw new FindException(string + namingException.getMessage(), (Throwable)namingException);
                }
                try {
                    if (bl2) {
                        this.a(dirContext, (EntityHeaderSet<IdentityHeader>)entityHeaderSet2, ldapUser.getId(), 1);
                    }
                }
                catch (AuthenticationException authenticationException) {
                    throw LdapGroupManagerImpl.a(authenticationException);
                }
            }
            finally {
                ResourceUtils.closeQuietly((Context)dirContext);
            }
        }
        return entityHeaderSet2;
    }

    public Set<IdentityHeader> getGroupHeadersForNestedGroup(@NotNull String string) throws FindException {
        try {
            if (string == null) {
                LdapGroupManagerImpl.b(0);
            }
        }
        catch (NamingException namingException) {
            throw LdapGroupManagerImpl.a(namingException);
        }
        EntityHeaderSet entityHeaderSet = new EntityHeaderSet();
        if (this.c()) {
            IdentityHeader identityHeader = new IdentityHeader(this.e(), string, EntityType.GROUP, null, null, null, null);
            try {
                DirContext dirContext = this.d().getBrowseContext();
                this.a(dirContext, (EntityHeaderSet<IdentityHeader>)entityHeaderSet, identityHeader, 1);
            }
            catch (NamingException namingException) {
                throw new FindException(r[35] + string, (Throwable)namingException);
            }
        }
        return entityHeaderSet;
    }

    /*
     * Loose catch block
     */
    private void a(DirContext dirContext, EntityHeaderSet<IdentityHeader> entityHeaderSet, String string, int n2) {
        String string2 = string.toLowerCase();
        int n3 = 1;
        String[] stringArray = r;
        int n4 = string2.indexOf(stringArray[7], n3);
        while (n4 >= 0) {
            block7: {
                try {
                    LdapGroup ldapGroup = this.findByPrimaryKey(string.substring(n4));
                    if (ldapGroup == null) break block7;
                    IdentityHeader identityHeader = this.a(ldapGroup);
                    if (!entityHeaderSet.add((EntityHeader)identityHeader)) break block7;
                    try {
                        block8: {
                            if (!this.a(n2)) break block7;
                            break block8;
                            catch (FindException findException) {
                                throw LdapGroupManagerImpl.a((Exception)((Object)findException));
                            }
                        }
                        this.a(dirContext, entityHeaderSet, identityHeader, n2 + 1);
                    }
                    catch (FindException findException) {
                        throw LdapGroupManagerImpl.a((Exception)((Object)findException));
                    }
                }
                catch (FindException findException) {
                    stringArray = r;
                    b.finest(stringArray[38] + findException.getMessage());
                }
            }
            n3 = n4 + 2;
            n4 = string2.indexOf(r[20], n3);
        }
    }

    public Set<IdentityHeader> getGroupHeaders(String string) throws FindException {
        return this.getGroupHeaders((LdapUser)this.getUserManager().findByPrimaryKey(string));
    }

    public void setGroupHeaders(LdapUser ldapUser, Set set) {
        throw new UnsupportedOperationException();
    }

    public void setGroupHeaders(String string, Set set) {
        throw new UnsupportedOperationException();
    }

    private void a(DirContext dirContext, EntityHeaderSet<IdentityHeader> entityHeaderSet, IdentityHeader identityHeader, int n2) {
        LdapIdentityProvider ldapIdentityProvider = this.d();
        String string = this.a(identityHeader);
        if (string != null) {
            long l2 = this.k.getMaxGroupSearchResultSize();
            try {
                this.m.a(dirContext, string, l2, null, (k)new s(this, ldapIdentityProvider, entityHeaderSet, n2, dirContext));
            }
            catch (SizeLimitExceededException sizeLimitExceededException) {
                String[] stringArray = r;
                b.log(Level.FINE, stringArray[34], sizeLimitExceededException);
                entityHeaderSet.setMaxExceeded(l2);
            }
            catch (NamingException namingException) {
                b.log(Level.WARNING, r[4] + string, namingException);
            }
        }
        this.a(dirContext, entityHeaderSet, identityHeader.getStrId(), n2);
    }

    private IdentityHeader a(LdapGroup ldapGroup) {
        return new IdentityHeader(this.e(), ldapGroup.getDn(), EntityType.GROUP, ldapGroup.getCn(), ldapGroup.getDescription(), null, null);
    }

    private String a(IdentityHeader identityHeader) {
        LdapIdentityProviderConfig ldapIdentityProviderConfig = this.g();
        GroupMappingConfig[] groupMappingConfigArray = ldapIdentityProviderConfig.getGroupMappings();
        h h2 = new h();
        h2.or();
        for (GroupMappingConfig groupMappingConfig : groupMappingConfigArray) {
            try {
                if (groupMappingConfig.getMemberStrategy().equals((Object)MemberStrategy.MEMBERS_ARE_DN)) {
                    h2.and();
                    h2.objectClass(groupMappingConfig.getObjClass());
                    h2.attrEquals(groupMappingConfig.getMemberAttrName(), identityHeader.getStrId());
                    h2.end();
                    continue;
                }
            }
            catch (UnsupportedOperationException unsupportedOperationException) {
                throw LdapGroupManagerImpl.a(unsupportedOperationException);
            }
            try {
                if (groupMappingConfig.getMemberStrategy().equals((Object)MemberStrategy.MEMBERS_ARE_LOGIN)) {
                    h2.and();
                    h2.objectClass(groupMappingConfig.getObjClass());
                    h2.attrEquals(groupMappingConfig.getMemberAttrName(), identityHeader.getName());
                    h2.end();
                    continue;
                }
            }
            catch (UnsupportedOperationException unsupportedOperationException) {
                throw LdapGroupManagerImpl.a(unsupportedOperationException);
            }
            try {
                if (!groupMappingConfig.getMemberStrategy().equals((Object)MemberStrategy.MEMBERS_ARE_NVPAIR)) continue;
                h2.and();
                h2.objectClass(groupMappingConfig.getObjClass());
                h2.attrEqualsUnsafe(groupMappingConfig.getMemberAttrName(), groupMappingConfig.getNameAttrName() + "=" + LdapUtils.filterEscape(identityHeader.getName()));
                h2.end();
                h2.and();
                h2.objectClass(groupMappingConfig.getObjClass());
                h2.attrEquals(groupMappingConfig.getMemberAttrName(), identityHeader.getStrId());
                h2.end();
            }
            catch (UnsupportedOperationException unsupportedOperationException) {
                throw LdapGroupManagerImpl.a(unsupportedOperationException);
            }
        }
        try {
            h2.end();
            if (h2.isEmpty()) {
                return null;
            }
        }
        catch (UnsupportedOperationException unsupportedOperationException) {
            throw LdapGroupManagerImpl.a(unsupportedOperationException);
        }
        return h2.buildFilter();
    }

    public EntityHeaderSet<IdentityHeader> getUserHeaders(LdapGroup ldapGroup) throws FindException {
        return this.a(ldapGroup, 1, new HashSet<String>(), new HashSet<String>());
    }

    /*
     * Loose catch block
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private EntityHeaderSet<IdentityHeader> a(LdapGroup ldapGroup, int n2, Set<String> set, Set<String> set2) throws FindException {
        EntityHeaderSet entityHeaderSet;
        LdapIdentityProvider ldapIdentityProvider = this.d();
        LdapIdentityProviderConfig ldapIdentityProviderConfig = this.g();
        GroupMappingConfig[] groupMappingConfigArray = ldapIdentityProviderConfig.getGroupMappings();
        EntityHeaderSet entityHeaderSet2 = new EntityHeaderSet();
        DirContext dirContext = null;
        try {
            String string = ldapGroup.getDn();
            DirContext dirContext2 = dirContext = ldapIdentityProvider.getBrowseContext();
            this.m.a(dirContext, string, new t(this, groupMappingConfigArray, dirContext2, entityHeaderSet2, n2, set, set2));
            entityHeaderSet = entityHeaderSet2;
        }
        catch (AuthenticationException authenticationException) {
            try {
                b.log(Level.WARNING, r[31] + authenticationException.getMessage(), ExceptionUtils.getDebugException((Throwable)authenticationException));
                throw new FindException(authenticationException.getMessage(), (Throwable)authenticationException);
                catch (NamingException namingException) {
                    try {
                        if (ExceptionUtils.causedBy((Throwable)namingException, FindException.class)) {
                            throw (FindException)ExceptionUtils.getCauseIfCausedBy((Throwable)namingException, FindException.class);
                        }
                    }
                    catch (AuthenticationException authenticationException2) {
                        throw LdapGroupManagerImpl.a(authenticationException2);
                    }
                    b.log(Level.SEVERE, null, namingException);
                    throw new FindException(namingException.getMessage(), (Throwable)namingException);
                }
            }
            catch (Throwable throwable) {
                ResourceUtils.closeQuietly(dirContext);
                throw throwable;
            }
        }
        ResourceUtils.closeQuietly((Context)dirContext);
        return entityHeaderSet;
    }

    public Set<IdentityHeader> getUserHeaders(String string) throws FindException {
        return this.getUserHeaders(this.findByPrimaryKey(string));
    }

    public void setUserHeaders(LdapGroup ldapGroup, Set set) {
        throw new UnsupportedOperationException();
    }

    public void setUserHeaders(String string, Set set) {
        throw new UnsupportedOperationException();
    }

    public EntityHeaderSet<IdentityHeader> findAllHeaders() throws FindException {
        LdapIdentityProvider ldapIdentityProvider = this.d();
        return ldapIdentityProvider.search(new EntityType[]{EntityType.GROUP}, "*");
    }

    public Collection findAll() throws FindException {
        EntityHeaderSet<IdentityHeader> entityHeaderSet = this.findAllHeaders();
        ArrayList<LdapGroup> arrayList = new ArrayList<LdapGroup>();
        for (IdentityHeader identityHeader : entityHeaderSet) {
            arrayList.add(this.findByPrimaryKey(identityHeader.getStrId()));
        }
        return arrayList;
    }

    protected LdapUserManager getUserManager() {
        LdapIdentityProvider ldapIdentityProvider = this.d();
        return (LdapUserManager)ldapIdentityProvider.getUserManager();
    }

    private void a(DirContext dirContext, String string, EntityHeaderSet<IdentityHeader> entityHeaderSet, int n2, Set<String> set, Set<String> set2) throws NamingException {
        block9: {
            LdapIdentityProvider ldapIdentityProvider = this.d();
            long l2 = this.k.getMaxGroupSearchResultSize();
            try {
                if ((long)entityHeaderSet.size() >= l2) {
                    return;
                }
            }
            catch (SizeLimitExceededException sizeLimitExceededException) {
                throw LdapGroupManagerImpl.a(sizeLimitExceededException);
            }
            String string2 = ldapIdentityProvider.userSearchFilterWithParam("*");
            try {
                this.m.a(dirContext, string, string2, l2, null, new u(this, ldapIdentityProvider, entityHeaderSet));
            }
            catch (SizeLimitExceededException sizeLimitExceededException) {
                String[] stringArray = r;
                b.log(Level.FINE, stringArray[6], sizeLimitExceededException);
                entityHeaderSet.setMaxExceeded(l2);
            }
            try {
                if ((long)entityHeaderSet.size() >= l2 || !this.a(n2)) break block9;
            }
            catch (SizeLimitExceededException sizeLimitExceededException) {
                throw LdapGroupManagerImpl.a(sizeLimitExceededException);
            }
            string2 = ldapIdentityProvider.groupSearchFilterWithParam("*", new MemberStrategy[0]);
            try {
                this.m.a(dirContext, string, string2, l2, null, new v(this, string, set2, n2, set, entityHeaderSet));
            }
            catch (SizeLimitExceededException sizeLimitExceededException) {
                b.log(Level.FINE, r[6], sizeLimitExceededException);
                entityHeaderSet.setMaxExceeded(l2);
            }
        }
    }

    private boolean a(DirContext dirContext, String string, Set<IdentityHeader> set) throws NamingException {
        UserMappingConfig[] userMappingConfigArray;
        LdapIdentityProvider ldapIdentityProvider = this.d();
        LdapIdentityProviderConfig ldapIdentityProviderConfig = this.g();
        long l2 = this.k.getMaxGroupSearchResultSize();
        try {
            if ((long)set.size() >= l2) {
                return true;
            }
        }
        catch (OperationNotSupportedException operationNotSupportedException) {
            throw LdapGroupManagerImpl.a(operationNotSupportedException);
        }
        h h2 = new h();
        h2.or();
        for (UserMappingConfig userMappingConfig : userMappingConfigArray = ldapIdentityProviderConfig.getUserMappings()) {
            h2.and();
            h2.objectClass(userMappingConfig.getObjClass());
            h2.expression(string);
            h2.end();
        }
        h2.end();
        boolean[] blArray = new boolean[1];
        try {
            this.m.a(dirContext, h2.buildFilter(), l2, null, (k)new n(this, ldapIdentityProvider, set, blArray));
        }
        catch (OperationNotSupportedException operationNotSupportedException) {
            b.log(Level.FINE, ldapIdentityProviderConfig.getName() + r[21] + string, operationNotSupportedException);
        }
        return blArray[0];
    }

    private String[] a() {
        String[] stringArray = null;
        Collection<String> collection = this.j.getReturningAttributes();
        if (collection != null) {
            stringArray = collection.toArray(new String[collection.size()]);
        }
        return stringArray;
    }

    private Set<String> b() {
        Set<String> set;
        if (d) {
            set = Collections.singleton(c);
        } else {
            set = new HashSet<String>();
            for (UserMappingConfig userMappingConfig : this.i.getUserMappings()) {
                set.add(userMappingConfig.getNameAttrName());
            }
        }
        return set;
    }

    private int a(Integer n2, int n3) {
        int n4 = n3;
        if (n2 != null) {
            n4 = n2;
        }
        return n4;
    }

    private long a(Long l2, long l3) {
        long l4 = l3;
        if (l2 != null) {
            l4 = l2;
        }
        return l4;
    }

    private boolean c() {
        boolean bl2;
        try {
            bl2 = this.q != 1;
        }
        catch (UnsupportedOperationException unsupportedOperationException) {
            throw LdapGroupManagerImpl.a(unsupportedOperationException);
        }
        return bl2;
    }

    private boolean a(int n2) {
        boolean bl2;
        block5: {
            block4: {
                try {
                    try {
                        if (this.q != 0 && n2 >= this.q) break block4;
                    }
                    catch (UnsupportedOperationException unsupportedOperationException) {
                        throw LdapGroupManagerImpl.a(unsupportedOperationException);
                    }
                    bl2 = true;
                    break block5;
                }
                catch (UnsupportedOperationException unsupportedOperationException) {
                    throw LdapGroupManagerImpl.a(unsupportedOperationException);
                }
            }
            bl2 = false;
        }
        return bl2;
    }

    private LdapIdentityProvider d() {
        LdapIdentityProvider ldapIdentityProvider = this.j;
        try {
            if (ldapIdentityProvider == null) {
                throw new IllegalStateException(r[32]);
            }
        }
        catch (UnsupportedOperationException unsupportedOperationException) {
            throw LdapGroupManagerImpl.a(unsupportedOperationException);
        }
        return ldapIdentityProvider;
    }

    private Goid e() {
        try {
            if (this.l == null) {
                this.l = this.i.getGoid();
            }
        }
        catch (UnsupportedOperationException unsupportedOperationException) {
            throw LdapGroupManagerImpl.a(unsupportedOperationException);
        }
        return this.l;
    }

    private String f() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(this.e());
        stringBuilder.append(',');
        stringBuilder.append(this.i.getVersion());
        return stringBuilder.toString();
    }

    private LdapIdentityProviderConfig g() {
        LdapIdentityProviderConfig ldapIdentityProviderConfig = this.i;
        try {
            if (ldapIdentityProviderConfig == null) {
                throw new IllegalStateException(r[28]);
            }
        }
        catch (UnsupportedOperationException unsupportedOperationException) {
            throw LdapGroupManagerImpl.a(unsupportedOperationException);
        }
        return ldapIdentityProviderConfig;
    }

    private LdapGroup a(GroupCacheKey groupCacheKey) {
        e e10;
        LdapGroup ldapGroup = null;
        Cache cache = this.n;
        if (cache != null && !this.a(e10 = (e)cache.retrieve((Object)groupCacheKey))) {
            ldapGroup = e10.a();
        }
        return ldapGroup;
    }

    private void b(LdapGroup ldapGroup) {
        block2: {
            Cache cache = this.n;
            try {
                if (cache == null || ldapGroup == null) break block2;
            }
            catch (UnsupportedOperationException unsupportedOperationException) {
                throw LdapGroupManagerImpl.a(unsupportedOperationException);
            }
            e e10 = new e(ldapGroup);
            cache.store((Object)GroupCacheKey.buildDnKey(ldapGroup.getDn()), (Object)e10, e10.f);
            cache.store((Object)GroupCacheKey.buildCnKey(ldapGroup.getCn()), (Object)e10, e10.f);
        }
    }

    private boolean a(LdapGroup ldapGroup, String string) {
        e e10;
        boolean bl2 = false;
        Cache cache = this.n;
        if (cache != null && !this.a(e10 = (e)cache.retrieve((Object)GroupCacheKey.buildDnKey(ldapGroup.getDn())))) {
            bl2 = e10.isNonGroup(string);
        }
        return bl2;
    }

    private void a(LdapGroup ldapGroup, Collection<String> collection) {
        block5: {
            Cache cache = this.n;
            try {
                if (cache == null || collection.isEmpty()) break block5;
            }
            catch (UnsupportedOperationException unsupportedOperationException) {
                throw LdapGroupManagerImpl.a(unsupportedOperationException);
            }
            e e10 = (e)cache.retrieve((Object)GroupCacheKey.buildDnKey(ldapGroup.getDn()));
            try {
                if (!this.a(e10)) {
                    e10.addNonGroups(collection);
                }
            }
            catch (UnsupportedOperationException unsupportedOperationException) {
                throw LdapGroupManagerImpl.a(unsupportedOperationException);
            }
        }
    }

    private Object c(LdapGroup ldapGroup) {
        return (this.getClass().getName() + r[40] + ldapGroup.getDn()).intern();
    }

    private boolean b(LdapGroup ldapGroup, Collection<LdapGroup> collection) {
        Collection<LdapGroup> collection2;
        e e10;
        boolean bl2 = false;
        Cache cache = this.n;
        if (cache != null && !this.a(e10 = (e)cache.retrieve((Object)GroupCacheKey.buildDnKey(ldapGroup.getDn()))) && (collection2 = e10.getSubgroups()) != null) {
            bl2 = true;
            collection.addAll(collection2);
        }
        return bl2;
    }

    private void c(LdapGroup ldapGroup, Collection<LdapGroup> collection) {
        Cache cache = this.n;
        if (cache != null) {
            e e10 = (e)cache.retrieve((Object)GroupCacheKey.buildDnKey(ldapGroup.getDn()));
            try {
                if (!this.a(e10)) {
                    e10.setSubgroups(collection);
                }
            }
            catch (UnsupportedOperationException unsupportedOperationException) {
                throw LdapGroupManagerImpl.a(unsupportedOperationException);
            }
        }
    }

    private LdapGroup a(String string, Attributes attributes) throws NamingException {
        LdapGroup ldapGroup = null;
        LdapIdentityProviderConfig ldapIdentityProviderConfig = this.g();
        GroupMappingConfig[] groupMappingConfigArray = ldapIdentityProviderConfig.getGroupMappings();
        String[] stringArray = r;
        Attribute attribute = attributes.get(stringArray[18]);
        for (GroupMappingConfig groupMappingConfig : groupMappingConfigArray) {
            String string2;
            String string3;
            String string4;
            Goid goid;
            String string5 = groupMappingConfig.getObjClass();
            if (!LdapUtils.a(attribute, string5)) continue;
            Object object = LdapUtils.a(attributes, groupMappingConfig.getNameAttrName());
            Object object2 = LdapUtils.a(attributes, r[1]);
            try {
                goid = this.e();
                string4 = string;
                string3 = object != null ? object.toString() : null;
            }
            catch (NamingException namingException) {
                throw LdapGroupManagerImpl.a(namingException);
            }
            try {
                string2 = object2 != null ? object2.toString() : null;
            }
            catch (NamingException namingException) {
                throw LdapGroupManagerImpl.a(namingException);
            }
            ldapGroup = LdapGroupManagerImpl.a(goid, string4, string3, string2, attributes);
            break;
        }
        return ldapGroup;
    }

    private static LdapGroup a(Goid goid, String string, String string2, String string3, Attributes attributes) {
        LdapGroup ldapGroup = new LdapGroup();
        try {
            ldapGroup.setProviderId(goid);
            ldapGroup.setDn(string);
            ldapGroup.setDescription(string3);
            ldapGroup.setAttributes(attributes);
            if (string2 != null) {
                ldapGroup.setCn(string2);
            }
        }
        catch (UnsupportedOperationException unsupportedOperationException) {
            throw LdapGroupManagerImpl.a(unsupportedOperationException);
        }
        return ldapGroup;
    }

    private boolean a(e e10) {
        boolean bl2 = true;
        if (e10 != null) {
            boolean bl3;
            long l2 = e10.f;
            try {
                bl3 = l2 + this.p < System.currentTimeMillis();
            }
            catch (UnsupportedOperationException unsupportedOperationException) {
                throw LdapGroupManagerImpl.a(unsupportedOperationException);
            }
            bl2 = bl3;
        }
        return bl2;
    }

    private static /* synthetic */ String lambda$getGroupHeaders$3(String string, NamingException namingException) {
        String string2 = namingException.getMessage();
        String string3 = string;
        return r[12] + string3 + string2;
    }

    private static /* synthetic */ String lambda$isMember$2(String string, NamingException namingException) {
        String string2 = namingException.getMessage();
        String string3 = string;
        return r[27] + string3 + string2;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[42];
                var3_1 = 0;
                var2_2 = "e\u000f:oZ$&n\u00164cD7od\u0000y&\u000bo\u000b$eF*v\u007f\u00078h\u0002h\u0000\"G*\u0016V\u0014&ty\u0001%*\u00144nb\u00022&V6og\n>hScay\u0001\"v\u000ec\u001de\u000f:oZ$&n\u00164cD7od\u0000wq]7n+\b>j@&t+=h\u0001:(Xtrn\r?(G&t}\u000b%(]'ce\u001a>rMmjo\u000f'(W,k{\u000f%cy&ki\u000b%uw\"un=2hG*rb\u00182jM(\u007f\u00062&G&gy\r?&F&u~\u0002#u\u0014&~h\u000b2bQ'&\u007f\u00062&Y\"~b\u0003\"k\u001a\u0003d\u001bj\u0012e\u000f:oZ$&n\u00164cD7od\u0000y&1G*\u0016V\u0014\"s\u007f\u00062h@*ej\u001a>iZccy\u001c8t\u0018cqc\u0007;c\u0014!sb\u00023oZ$&l\u001c8sDy&\"G*\u0016V\u0014&ty\u0001%*\u00144nb\u00022&V6og\n>hScay\u0001\"v\u000ecc\u007f\u00062&G&gy\r?&F&u~\u0002#u\u0014&~h\u000b2bQ'&\u007f\u00062&Y\"~b\u0003\"k\u001acgo\n>hScg++9r]7\u007f_\u0017'c\u001a\u000eGS+\u0013Y{\u0016RT=\u0012Gf\u0000NT<\u0012Ua\u000fR+\u001a8&@+c+\u001c2uA/rx\fG*\u0016V\u0014&ty\u0001%<\u0014\u0014h\u000f9h[7&l\u000b#&W,h\u007f\u000b/r\u000ec\u0012G*\u0016V\u0014\u0004td\u001b'&w\"ec\u000bw.\u0006L\u001c8sDc\u0002+F>J\u001c0sY&h\u007fN1iFcFE\u0001#HA/j+\u001e6tU.c\u007f\u000b%&\u0013fu,N8`\u0014fu%K$&Y6u\u007fN9i@cdnN9sX/\u000bd\f=cW7eg\u000f$u'^\u001d2t\u0014*u+\u00008r\u0014%td\u0003wr\\*u+'3cZ7o\u007f\u0017wVF,pb\n2t\u0003d\u001bj\u001ao\u0007%cW7iy\u0017weU-hd\u001awuQ\"th\u0006wiZ.h\u0001:(Xtrn\r?(G&t}\u000b%(]'ce\u001a>rMmjo\u000f'(Y&ki\u000b%G@7tE\u000f:c\u0007l\u001c8sD\nb1h\u0001:(Xtrn\r?(G&t}\u000b%(]'ce\u001a>rMmjo\u000f'(A0cF\u000b:dQ1G\u007f\u001a%HU.c\u0012+\n8cGchd\u001awcL*u\u007fN>h4h\u0001:)Xtrn\r?)G&t}\u000b%)]'ce\u001a>rMljo\u000f')x'g{)%iA3Kj\u00006aQ1Of\u001e;\fG*\u0016V\u0014&ty\u0001%<\u0014\u000fE\u0001#&W,hm\u00070sF&b*\"m\u000f>jQ'&\u007f\u0001we\\&e`N0t[6v+\u00032kV&tx\u0006>v\u000ec\u001dl\u000b#AF,s{&2gP&tx(8tz&u\u007f\u000b3AF,s{\u001bG*\u0016V\u0014\"s\u007f\u00062h@*ej\u001a>iZccy\u001c8t\u000ec\u000fE\u0001#&W,hm\u00070sF&b*\u001bG*\u0016V\u0014\"s\u007f\u00062h@*ej\u001a>iZccy\u001c8t\u000ec(\u007f\u00062&G&gy\r?&F&u~\u0002#u\u0014&~h\u000b2bQ'&\u007f\u00062&Y\"~b\u0003\"k\u001a%^\u00006dX&&\u007f\u0001wtQ7tb\u000b!c\u0014$td\u001b'u\u0014%iyN0t[6v1N1G*\u0016V\u0014\"s\u007f\u00062h@*ej\u001a>iZccy\u001c8t\u0018cqc\u0007;c\u0014!sb\u00023oZ$&l\u001c8sDy&\u001bG*\u0016V\u0014\"r\u007f\u001c>dA7c+\u001c2gPccy\u001c8t\u000ec\u001dh\u0001\"jPchd\u001awtQ0ig\u00182&@+oxN0t[6v+\u0016n\u001c%iFcan\u001a#oZ$&j\u0000$qQ1<+";
                var4_3 = "e\u000f:oZ$&n\u00164cD7od\u0000y&\u000bo\u000b$eF*v\u007f\u00078h\u0002h\u0000\"G*\u0016V\u0014&ty\u0001%*\u00144nb\u00022&V6og\n>hScay\u0001\"v\u000ec\u001de\u000f:oZ$&n\u00164cD7od\u0000wq]7n+\b>j@&t+=h\u0001:(Xtrn\r?(G&t}\u000b%(]'ce\u001a>rMmjo\u000f'(W,k{\u000f%cy&ki\u000b%uw\"un=2hG*rb\u00182jM(\u007f\u00062&G&gy\r?&F&u~\u0002#u\u0014&~h\u000b2bQ'&\u007f\u00062&Y\"~b\u0003\"k\u001a\u0003d\u001bj\u0012e\u000f:oZ$&n\u00164cD7od\u0000y&1G*\u0016V\u0014\"s\u007f\u00062h@*ej\u001a>iZccy\u001c8t\u0018cqc\u0007;c\u0014!sb\u00023oZ$&l\u001c8sDy&\"G*\u0016V\u0014&ty\u0001%*\u00144nb\u00022&V6og\n>hScay\u0001\"v\u000ecc\u007f\u00062&G&gy\r?&F&u~\u0002#u\u0014&~h\u000b2bQ'&\u007f\u00062&Y\"~b\u0003\"k\u001acgo\n>hScg++9r]7\u007f_\u0017'c\u001a\u000eGS+\u0013Y{\u0016RT=\u0012Gf\u0000NT<\u0012Ua\u000fR+\u001a8&@+c+\u001c2uA/rx\fG*\u0016V\u0014&ty\u0001%<\u0014\u0014h\u000f9h[7&l\u000b#&W,h\u007f\u000b/r\u000ec\u0012G*\u0016V\u0014\u0004td\u001b'&w\"ec\u000bw.\u0006L\u001c8sDc\u0002+F>J\u001c0sY&h\u007fN1iFcFE\u0001#HA/j+\u001e6tU.c\u007f\u000b%&\u0013fu,N8`\u0014fu%K$&Y6u\u007fN9i@cdnN9sX/\u000bd\f=cW7eg\u000f$u'^\u001d2t\u0014*u+\u00008r\u0014%td\u0003wr\\*u+'3cZ7o\u007f\u0017wVF,pb\n2t\u0003d\u001bj\u001ao\u0007%cW7iy\u0017weU-hd\u001awuQ\"th\u0006wiZ.h\u0001:(Xtrn\r?(G&t}\u000b%(]'ce\u001a>rMmjo\u000f'(Y&ki\u000b%G@7tE\u000f:c\u0007l\u001c8sD\nb1h\u0001:(Xtrn\r?(G&t}\u000b%(]'ce\u001a>rMmjo\u000f'(A0cF\u000b:dQ1G\u007f\u001a%HU.c\u0012+\n8cGchd\u001awcL*u\u007fN>h4h\u0001:)Xtrn\r?)G&t}\u000b%)]'ce\u001a>rMljo\u000f')x'g{)%iA3Kj\u00006aQ1Of\u001e;\fG*\u0016V\u0014&ty\u0001%<\u0014\u000fE\u0001#&W,hm\u00070sF&b*\"m\u000f>jQ'&\u007f\u0001we\\&e`N0t[6v+\u00032kV&tx\u0006>v\u000ec\u001dl\u000b#AF,s{&2gP&tx(8tz&u\u007f\u000b3AF,s{\u001bG*\u0016V\u0014\"s\u007f\u00062h@*ej\u001a>iZccy\u001c8t\u000ec\u000fE\u0001#&W,hm\u00070sF&b*\u001bG*\u0016V\u0014\"s\u007f\u00062h@*ej\u001a>iZccy\u001c8t\u000ec(\u007f\u00062&G&gy\r?&F&u~\u0002#u\u0014&~h\u000b2bQ'&\u007f\u00062&Y\"~b\u0003\"k\u001a%^\u00006dX&&\u007f\u0001wtQ7tb\u000b!c\u0014$td\u001b'u\u0014%iyN0t[6v1N1G*\u0016V\u0014\"s\u007f\u00062h@*ej\u001a>iZccy\u001c8t\u0018cqc\u0007;c\u0014!sb\u00023oZ$&l\u001c8sDy&\u001bG*\u0016V\u0014\"r\u007f\u001c>dA7c+\u001c2gPccy\u001c8t\u000ec\u001dh\u0001\"jPchd\u001awtQ0ig\u00182&@+oxN0t[6v+\u0016n\u001c%iFcan\u001a#oZ$&j\u0000$qQ1<+".length();
                var1_4 = 18;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 89;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block9;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = LdapGroupManagerImpl.a(v0, LdapGroupManagerImpl.b(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "2\t6pG%}j\n0?F8`2\u0014|\u001b-|O#2x\u001f72C8|k\u001f;f\u001aw";
                    var4_3 = "2\t6pG%}j\n0?F8`2\u0014|\u001b-|O#2x\u001f72C8|k\u001f;f\u001aw".length();
                    var1_4 = 15;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 77;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block9;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = LdapGroupManagerImpl.a(v0, LdapGroupManagerImpl.b(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        LdapGroupManagerImpl.r = var5;
        LdapGroupManagerImpl.a = LdapGroupManagerImpl.r[8];
        LdapGroupManagerImpl.b = Logger.getLogger(LdapGroupManagerImpl.class.getName());
        var0_6 = LdapGroupManagerImpl.r;
        LdapGroupManagerImpl.c = ConfigFactory.getProperty((String)var0_6[22], (String)var0_6[2]);
        LdapGroupManagerImpl.d = ConfigFactory.getBooleanProperty((String)var0_6[24], (boolean)false);
        LdapGroupManagerImpl.e = ConfigFactory.getBooleanProperty((String)var0_6[5], (boolean)true);
    }

    private static /* synthetic */ void b(int n2) {
        String[] stringArray = r;
        throw new IllegalArgumentException(String.format(stringArray[17], stringArray[23], stringArray[26], stringArray[30]));
    }

    private static Exception a(Exception exception) {
        return exception;
    }

    private static char[] b(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x5F);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 82;
                    case 1 -> 55;
                    case 2 -> 14;
                    case 3 -> 95;
                    case 4 -> 109;
                    case 5 -> 26;
                    default -> 95;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }

    private static final class GroupCacheKey
    extends Pair<String, String> {
        static final long serialVersionUID = 4771537123965738825L;
        private static final String[] b;

        private GroupCacheKey(String string, String string2) {
            super((Object)string, (Object)string2);
        }

        private static GroupCacheKey buildDnKey(String string) {
            return new GroupCacheKey(b[1], string);
        }

        private static GroupCacheKey buildCnKey(String string) {
            return new GroupCacheKey(b[2], string);
        }

        private Object getSync() {
            return (((Object)((Object)this)).getClass().getName() + b[0] + (String)this.left + "," + (String)this.right + ")").intern();
        }

        /*
         * Enabled aggressive block sorting
         */
        static {
            String[] stringArray = new String[3];
            int n2 = 0;
            String string = "L\u0013\u00180\u0010\u000b\u0007\u0007\u001b\u0018rM\u0002\u0005\u001a\u0002\u0002\u001a";
            int n3 = "L\u0013\u00180\u0010\u000b\u0007\u0007\u001b\u0018rM\u0002\u0005\u001a\u0002\u0002\u001a".length();
            int n4 = 12;
            int n5 = -1;
            while (true) {
                int n6 = ++n5;
                stringArray[n2++] = GroupCacheKey.b(78, GroupCacheKey.b(string.substring(n6, n6 + n4)));
                if ((n5 += n4) >= n3) {
                    b = stringArray;
                    return;
                }
                n4 = string.charAt(n5);
            }
        }

        private static char[] b(String string) {
            char[] cArray = string.toCharArray();
            if (cArray.length < 2) {
                cArray = cArray;
                cArray[0] = (char)(cArray[0] ^ 0x64);
            }
            return cArray;
        }

        /*
         * Handled impossible loop by duplicating code
         * Enabled aggressive block sorting
         */
        private static String b(int n2, char[] cArray) {
            char[] cArray2;
            block11: {
                int n3;
                int n4;
                int n5;
                block10: {
                    n5 = n2;
                    cArray2 = cArray;
                    n4 = cArray.length;
                    n3 = 0;
                    if (!true) break block10;
                    n4 = n4;
                    if (n4 <= n3) break block11;
                }
                do {
                    n5 = n5;
                    cArray2 = cArray2;
                    int n6 = n3;
                    cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                        case 0 -> 47;
                        case 1 -> 58;
                        case 2 -> 36;
                        case 3 -> 17;
                        case 4 -> 43;
                        case 5 -> 53;
                        default -> 100;
                    })));
                    ++n3;
                    n4 = n4;
                } while (n4 > n3);
            }
            return new String(cArray2).intern();
        }
    }
}

