/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.message.Message
 *  com.l7tech.message.MimeKnob
 *  com.l7tech.policy.variable.Syntax$SyntaxErrorHandler
 */
package com.l7tech.server.policy.variable;

import com.l7tech.message.Message;
import com.l7tech.message.MimeKnob;
import com.l7tech.policy.variable.Syntax;
import com.l7tech.server.policy.variable.ExpandVariables;
import com.l7tech.server.policy.variable.MessageSelector;
import java.io.IOException;

class er
implements MessageSelector.MessageAttributeSelector {
    private static final String a = er.a(82, er.a("\u0005\u007fk&[Zk8YA0\u0018Hs%\\K~JZo>YK(QQ|l]O7V\u001fk-BZ~[Pu8U@*\u0018Kb<U"));

    er() {
    }

    @Override
    public ExpandVariables.Selector.Selection select(Message message, String string, Syntax.SyntaxErrorHandler syntaxErrorHandler, boolean bl2) {
        MimeKnob mimeKnob = (MimeKnob)message.getKnob(MimeKnob.class);
        try {
            if (mimeKnob == null) {
                return null;
            }
        }
        catch (IOException iOException) {
            throw er.a(iOException);
        }
        try {
            return new ExpandVariables.Selector.Selection(mimeKnob.getFirstPart().getContentType().getFullValue());
        }
        catch (IOException iOException) {
            String string2 = syntaxErrorHandler.handleBadVariable(a);
            try {
                if (bl2) {
                    throw new IllegalArgumentException(string2);
                }
            }
            catch (IOException iOException2) {
                throw er.a(iOException2);
            }
            return null;
        }
    }

    private static IOException a(IOException iOException) {
        return iOException;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x49);
        }
        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 -> 30;
                    case 1 -> 98;
                    case 2 -> 124;
                    case 3 -> 12;
                    case 4 -> 106;
                    case 5 -> 109;
                    default -> 73;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

