/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.log.HybridDiagnosticContext
 *  com.l7tech.common.log.HybridDiagnosticContext$SavedDiagnosticContext
 *  com.l7tech.gateway.common.audit.AuditDetail
 *  com.l7tech.gateway.common.audit.AuditDetailEvent$AuditDetailWithInfo
 *  com.l7tech.gateway.common.audit.AuditDetailMessage
 *  com.l7tech.gateway.common.audit.MessagesUtil
 *  com.l7tech.util.Functions$Nullary
 *  com.l7tech.util.Pair
 */
package com.l7tech.server.audit;

import com.l7tech.common.log.HybridDiagnosticContext;
import com.l7tech.gateway.common.audit.AuditDetail;
import com.l7tech.gateway.common.audit.AuditDetailEvent;
import com.l7tech.gateway.common.audit.AuditDetailMessage;
import com.l7tech.gateway.common.audit.MessagesUtil;
import com.l7tech.server.audit.AuditContext;
import com.l7tech.server.audit.AuditLogFormatter;
import com.l7tech.server.audit.AuditLogListener;
import com.l7tech.server.audit.ak;
import com.l7tech.util.Functions;
import com.l7tech.util.Pair;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class LogOnlyAuditContext
implements AuditContext {
    private final AuditLogListener a;
    private static final String[] b;

    public LogOnlyAuditContext(AuditLogListener auditLogListener) {
        this.a = auditLogListener;
    }

    @Override
    public void addDetail(AuditDetail auditDetail, Object object) {
        this.addDetail(new AuditDetailEvent.AuditDetailWithInfo(object, auditDetail, null, null));
    }

    @Override
    public void addDetail(AuditDetailEvent.AuditDetailWithInfo auditDetailWithInfo) {
        if (this.a != null) {
            int n2 = auditDetailWithInfo.getDetail().getMessageId();
            Pair pair = MessagesUtil.getAuditDetailMessageByIdWithFilter((int)n2);
            try {
                if (!((Boolean)pair.left).booleanValue()) {
                    throw new RuntimeException(b[1] + n2 + b[2]);
                }
            }
            catch (RuntimeException runtimeException) {
                throw LogOnlyAuditContext.a(runtimeException);
            }
            AuditDetailMessage auditDetailMessage = (AuditDetailMessage)pair.right;
            try {
                if (auditDetailMessage == null) {
                    return;
                }
            }
            catch (RuntimeException runtimeException) {
                throw LogOnlyAuditContext.a(runtimeException);
            }
            AuditLogFormatter auditLogFormatter = new AuditLogFormatter(Collections.emptyMap());
            String string = auditDetailWithInfo.getSource().getClass().getName();
            HybridDiagnosticContext.doWithContext((HybridDiagnosticContext.SavedDiagnosticContext)auditDetailWithInfo.getContext(), (Functions.Nullary)new ak(this, string, auditDetailWithInfo, auditDetailMessage, auditLogFormatter));
        }
    }

    @Override
    public Set getHints() {
        return Collections.emptySet();
    }

    @Override
    public Map<Object, List<AuditDetail>> getDetails() {
        return Collections.emptyMap();
    }

    @Override
    public void setContextVariables(Map<String, Object> map) {
        throw new IllegalStateException(b[0]);
    }

    private static RuntimeException a(RuntimeException runtimeException) {
        return runtimeException;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "\u001e\u0013\u001fA6\u00151g\u0014\u0014\r#Z7?\u001f\u0013\u0015z\u00199$\u000f\u001f\u0019.Z2%\u001e\tA4\u0015\"j\b\u000f\u0011*\u0015$>[\u0019\u000e4\u000e32\u000fZ\u0017;\b?+\u0019\u0016\u0004)Z~+\u000f\u000e\u00047\n\"j\u000f\u0015A>\u0015v'\u001e\t\u0012;\u001d3j\b\u000f\f7\u001b$3[\u001b\u0014>\u0013\"#\u0015\u001dA-\u0013\"\"\u0014\u000f\u0015z\t3>\u000f\u0013\u000f=Z7?\u001f\u0013\u0015z\u00199$\u000f\u001f\u0019.E\u007f\u001c\t\u001a\u0014\u000f5\u000ev,\u0012\u0014\u0005z\u000e>/[\u0017\u0004)\t7-\u001eZI3\u001ek\u0015c[\u0013\u000fz\u000e>/[7\u0004)\t7-\u001eZ,;\nx";
        int n3 = "\u001e\u0013\u001fA6\u00151g\u0014\u0014\r#Z7?\u001f\u0013\u0015z\u00199$\u000f\u001f\u0019.Z2%\u001e\tA4\u0015\"j\b\u000f\u0011*\u0015$>[\u0019\u000e4\u000e32\u000fZ\u0017;\b?+\u0019\u0016\u0004)Z~+\u000f\u000e\u00047\n\"j\u000f\u0015A>\u0015v'\u001e\t\u0012;\u001d3j\b\u000f\f7\u001b$3[\u001b\u0014>\u0013\"#\u0015\u001dA-\u0013\"\"\u0014\u000f\u0015z\t3>\u000f\u0013\u000f=Z7?\u001f\u0013\u0015z\u00199$\u000f\u001f\u0019.E\u007f\u001c\t\u001a\u0014\u000f5\u000ev,\u0012\u0014\u0005z\u000e>/[\u0017\u0004)\t7-\u001eZI3\u001ek\u0015c[\u0013\u000fz\u000e>/[7\u0004)\t7-\u001eZ,;\nx".length();
        int n4 = 133;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = LogOnlyAuditContext.a(60, LogOnlyAuditContext.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                b = stringArray;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x6A);
        }
        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 -> 118;
                    case 1 -> 71;
                    case 2 -> 70;
                    case 3 -> 93;
                    case 4 -> 102;
                    case 5 -> 70;
                    default -> 106;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

