/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.identity.IdentityProvider
 *  com.l7tech.identity.User
 *  com.l7tech.identity.cert.CertEntryRow
 *  com.l7tech.objectmodel.FindException
 *  org.springframework.context.ApplicationContext
 */
package com.l7tech.server.event;

import com.l7tech.identity.IdentityProvider;
import com.l7tech.identity.User;
import com.l7tech.identity.cert.CertEntryRow;
import com.l7tech.objectmodel.FindException;
import com.l7tech.server.event.EntityChangeSet;
import com.l7tech.server.identity.IdentityProviderFactory;
import org.springframework.context.ApplicationContext;

public class UserCertEventInfo {
    private final User a;
    private final String b;
    private static final String[] c;

    public UserCertEventInfo(CertEntryRow certEntryRow, String string, EntityChangeSet entityChangeSet, ApplicationContext applicationContext) {
        try {
            String string2;
            block14: {
                String[] stringArray = c;
                IdentityProviderFactory identityProviderFactory = (IdentityProviderFactory)applicationContext.getBean(stringArray[4]);
                IdentityProvider identityProvider = identityProviderFactory.getProvider(certEntryRow.getProvider());
                try {
                    if (identityProvider == null) {
                        throw new FindException(stringArray[0]);
                    }
                }
                catch (FindException findException) {
                    throw UserCertEventInfo.a(findException);
                }
                this.a = identityProvider.getUserManager().findByPrimaryKey(certEntryRow.getUserId());
                string2 = string;
                if (entityChangeSet != null) {
                    Object object;
                    Object object2;
                    block13: {
                        block12: {
                            stringArray = c;
                            object2 = entityChangeSet.getOldValue(stringArray[5]);
                            object = entityChangeSet.getNewValue(stringArray[3]);
                            try {
                                if (object2 != null || object == null) break block12;
                            }
                            catch (FindException findException) {
                                throw UserCertEventInfo.a(findException);
                            }
                            stringArray = c;
                            string2 = stringArray[1];
                            break block14;
                        }
                        try {
                            if (object != null || object2 == null) break block13;
                        }
                        catch (FindException findException) {
                            throw UserCertEventInfo.a(findException);
                        }
                        stringArray = c;
                        string2 = stringArray[6];
                        break block14;
                    }
                    try {
                        if (object == null || object.equals(object2)) break block14;
                    }
                    catch (FindException findException) {
                        throw UserCertEventInfo.a(findException);
                    }
                    string2 = c[2];
                }
            }
            this.b = string2;
        }
        catch (FindException findException) {
            throw new RuntimeException(findException);
        }
    }

    public User getUser() {
        return this.a;
    }

    public String getNote() {
        return this.b;
    }

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

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[7];
                var3_1 = 0;
                var2_2 = ")N/K\u0012OI\u0013R#\u001f\u0002\u000b\\\u000fI<\u0002\u001fN^]G9\u0018\u0014HE\u001cR/\u000f[\\E\tNj\u001f\u0013N\f\u001eJ#\u000e\u0015_\f\u001eC8\u001f\u0012ME\u001eG>\u000e[OC\u0018Uj\u0005\u0014_\f\u0018^#\u0018\u000f\u0005\u000f\u000eC>K\u0018N^\tO,\u0002\u0018JX\u0018\u0013\bV.\n\u000fNH]E/\u0019\u000fBJ\u0014E+\u001f\u001e\u0004\u001eC8\u001f\u0017\u0014B/\u0005\u000fBX\u0004v8\u0004\rBH\u0018T\f\n\u0018_C\u000f_";
                var4_3 = ")N/K\u0012OI\u0013R#\u001f\u0002\u000b\\\u000fI<\u0002\u001fN^]G9\u0018\u0014HE\u001cR/\u000f[\\E\tNj\u001f\u0013N\f\u001eJ#\u000e\u0015_\f\u001eC8\u001f\u0012ME\u001eG>\u000e[OC\u0018Uj\u0005\u0014_\f\u0018^#\u0018\u000f\u0005\u000f\u000eC>K\u0018N^\tO,\u0002\u0018JX\u0018\u0013\bV.\n\u000fNH]E/\u0019\u000fBJ\u0014E+\u001f\u001e\u0004\u001eC8\u001f\u0017\u0014B/\u0005\u000fBX\u0004v8\u0004\rBH\u0018T\f\n\u0018_C\u000f_".length();
                var1_4 = 76;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = UserCertEventInfo.a(v0, UserCertEventInfo.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "4i\u00125\u00134`\u0005 #dbwo\u00053%h`>o\u000154";
                    var4_3 = "4i\u00125\u00134`\u0005 #dbwo\u00053%h`>o\u000154".length();
                    var1_4 = 4;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 99;
                        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++] = UserCertEventInfo.a(v0, UserCertEventInfo.a(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;
            }
        }
        UserCertEventInfo.c = var5;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x65);
        }
        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 -> 52;
                    case 1 -> 111;
                    case 2 -> 3;
                    case 3 -> 34;
                    case 4 -> 50;
                    case 5 -> 98;
                    default -> 101;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

