/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.identity.ldap.LdapGroup
 *  com.l7tech.objectmodel.EntityHeaderSet
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.IdentityHeader
 */
package com.l7tech.server.identity.ldap;

import com.l7tech.identity.ldap.LdapGroup;
import com.l7tech.objectmodel.EntityHeaderSet;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.IdentityHeader;
import com.l7tech.server.identity.ldap.LdapGroupManagerImpl;
import com.l7tech.server.identity.ldap.k;
import java.util.Set;
import java.util.logging.Level;
import javax.naming.NamingException;
import javax.naming.directory.SearchResult;

class v
extends k {
    final String val$dn;
    final Set val$processedGroupIds;
    final int val$depth;
    final Set val$processedGroupNames;
    final EntityHeaderSet val$memberHeaders;
    final LdapGroupManagerImpl this$0;
    private static final String a = v.a(66, v.a("\u0003Cu9Q\u0003P\t^l?MD\u001c\u0000^uvPV^KVu9VS"));

    v(LdapGroupManagerImpl ldapGroupManagerImpl, String string, Set set, int n2, Set set2, EntityHeaderSet entityHeaderSet) {
        this.this$0 = ldapGroupManagerImpl;
        this.val$dn = string;
        this.val$processedGroupIds = set;
        this.val$depth = n2;
        this.val$processedGroupNames = set2;
        this.val$memberHeaders = entityHeaderSet;
    }

    /*
     * Loose catch block
     */
    @Override
    boolean a(SearchResult searchResult) throws NamingException {
        block9: {
            if (searchResult == null) break block9;
            try {
                block10: {
                    if (searchResult.getName() == null) break block9;
                    break block10;
                    catch (FindException findException) {
                        throw v.a(findException);
                    }
                }
                if (searchResult.getName().length() <= 0) break block9;
            }
            catch (FindException findException) {
                throw v.a(findException);
            }
            String string = searchResult.getNameInNamespace();
            try {
                if (string.equals(this.val$dn) || this.val$processedGroupIds.contains(string)) break block9;
            }
            catch (FindException findException) {
                throw v.a(findException);
            }
            try {
                LdapGroup ldapGroup = this.this$0.findByPrimaryKey(string);
                if (ldapGroup != null) {
                    EntityHeaderSet<IdentityHeader> entityHeaderSet = this.this$0.a(ldapGroup, this.val$depth + 1, this.val$processedGroupNames, this.val$processedGroupIds);
                    this.val$memberHeaders.addAll(entityHeaderSet);
                    this.val$processedGroupNames.add(ldapGroup.getName());
                    this.val$processedGroupIds.add(ldapGroup.getDn());
                }
            }
            catch (FindException findException) {
                LdapGroupManagerImpl.b.log(Level.FINE, a + string, findException);
            }
        }
        return true;
    }

    private static FindException a(FindException findException) {
        return findException;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x7E);
        }
        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 -> 36;
                    case 1 -> 115;
                    case 2 -> 69;
                    case 3 -> 20;
                    case 4 -> 97;
                    case 5 -> 97;
                    default -> 126;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

