/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.fasterxml.jackson.core.JsonProcessingException
 *  com.fasterxml.jackson.databind.node.ObjectNode
 *  com.l7tech.common.http.HttpConstants
 *  com.l7tech.gateway.common.LicenseException
 *  com.l7tech.gateway.pm2.graphql.beans.PM2GraphQLRequest
 *  com.l7tech.gateway.pm2.graphql.service.PM2GraphQLService
 *  com.l7tech.identity.User
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.ConfigFactory$ConfigurationListener
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.SyspropUtil
 *  jakarta.servlet.ServletConfig
 *  jakarta.servlet.ServletException
 *  jakarta.servlet.http.HttpServletRequest
 *  jakarta.servlet.http.HttpServletResponse
 *  org.jetbrains.annotations.Nullable
 *  org.springframework.context.ApplicationContext
 */
package com.l7tech.server.pm2;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.l7tech.common.http.HttpConstants;
import com.l7tech.gateway.common.LicenseException;
import com.l7tech.gateway.pm2.graphql.beans.PM2GraphQLRequest;
import com.l7tech.gateway.pm2.graphql.service.PM2GraphQLService;
import com.l7tech.identity.User;
import com.l7tech.server.boot.GatewayBoot;
import com.l7tech.server.boot.GatewayBootUtil;
import com.l7tech.server.oauth2.OAuth2Exception;
import com.l7tech.server.oauth2.OAuth2VerifierResult;
import com.l7tech.server.pm2.PM2AbstractServlet;
import com.l7tech.server.pm2.PM2State;
import com.l7tech.server.pm2.a;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.SyspropUtil;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.security.Principal;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.security.auth.Subject;
import org.jetbrains.annotations.Nullable;
import org.springframework.context.ApplicationContext;

public class PM2Servlet
extends PM2AbstractServlet {
    private static final Logger logger;
    private static final String TOKEN_TYPE_AT_JWT;
    private static final String ENABLED_PROP;
    private static final String SESSION_EXTENSION_THRESHOLD_SYS_PROP;
    private static final String SESSION_EXPIRY_SYS_PROP;
    private static final int SESSION_EXPIRY_DEFAULT = 1800;
    private static final int SESSION_EXTENSION_THRESHOLD_DEFAULT = 43200;
    @Nullable
    private PM2GraphQLService pm2GraphQLService;
    static final long serialVersionUID = -5968290025755970901L;
    private static final String[] c;

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        try {
            super.init(servletConfig);
            this.initPM2State();
            if (!GatewayBoot.Mode.RUNTIME.equals((Object)GatewayBootUtil.getMode())) {
                this.pm2GraphQLService = PM2GraphQLService.getInstance((ApplicationContext)this.getApplicationContext());
            }
        }
        catch (ServletException servletException) {
            throw PM2Servlet.b((Exception)((Object)servletException));
        }
    }

    public void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
        block7: {
            block8: {
                String string;
                block6: {
                    try {
                        this.licenseManager.requireFeature(this.getFeature());
                    }
                    catch (LicenseException licenseException) {
                        String[] stringArray = c;
                        logger.warning(stringArray[10]);
                        this.respondError(httpServletResponse, 503, stringArray[49]);
                        return;
                    }
                    string = httpServletRequest.getRequestURI();
                    try {
                        if (!string.endsWith(c[56])) break block6;
                        this.doManageSession(httpServletRequest, httpServletResponse);
                        break block7;
                    }
                    catch (LicenseException licenseException) {
                        throw PM2Servlet.b((Exception)((Object)licenseException));
                    }
                }
                try {
                    if (!string.endsWith(c[1])) break block8;
                    this.doGraphQLRequest(httpServletRequest, httpServletResponse);
                    break block7;
                }
                catch (LicenseException licenseException) {
                    throw PM2Servlet.b((Exception)((Object)licenseException));
                }
            }
            this.respondError(httpServletResponse, 404, c[14]);
        }
    }

    private void doManageSession(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException {
        block19: {
            block22: {
                PM2AbstractServlet.PM2AuthContext pM2AuthContext;
                String string;
                block21: {
                    block20: {
                        block18: {
                            PM2AbstractServlet.PM2AuthType pM2AuthType;
                            String[] stringArray = c;
                            string = httpServletRequest.getParameter(stringArray[50]);
                            boolean bl2 = stringArray[3].equalsIgnoreCase(string);
                            try {
                                pM2AuthType = bl2 ? PM2AbstractServlet.PM2AuthType.BASIC : PM2AbstractServlet.PM2AuthType.COOKIE;
                            }
                            catch (IOException iOException) {
                                throw PM2Servlet.b(iOException);
                            }
                            PM2AbstractServlet.PM2AuthType pM2AuthType2 = pM2AuthType;
                            pM2AuthContext = this.authenticate(httpServletRequest, httpServletResponse, pM2AuthType2);
                            try {
                                if (!pM2AuthContext.isAuthenticated()) {
                                    return;
                                }
                            }
                            catch (IOException iOException) {
                                throw PM2Servlet.b(iOException);
                            }
                            try {
                                if (!this.verifyRBAC(pM2AuthContext)) {
                                    this.respondError(httpServletResponse, 403, c[40]);
                                    return;
                                }
                            }
                            catch (IOException iOException) {
                                throw PM2Servlet.b(iOException);
                            }
                            try {
                                if (!bl2) break block18;
                                this.doLogin(httpServletResponse, pM2AuthContext);
                                break block19;
                            }
                            catch (IOException iOException) {
                                throw PM2Servlet.b(iOException);
                            }
                        }
                        try {
                            if (!c[48].equalsIgnoreCase(string)) break block20;
                            this.doLogout(httpServletResponse, pM2AuthContext);
                            break block19;
                        }
                        catch (IOException iOException) {
                            throw PM2Servlet.b(iOException);
                        }
                    }
                    try {
                        if (!c[13].equalsIgnoreCase(string)) break block21;
                        this.doRenewSession(httpServletResponse, pM2AuthContext);
                        break block19;
                    }
                    catch (IOException iOException) {
                        throw PM2Servlet.b(iOException);
                    }
                }
                try {
                    try {
                        if (!c[23].equalsIgnoreCase(string) && string != null) break block22;
                    }
                    catch (IOException iOException) {
                        throw PM2Servlet.b(iOException);
                    }
                    this.doSessionInfo(httpServletResponse, pM2AuthContext);
                    break block19;
                }
                catch (IOException iOException) {
                    throw PM2Servlet.b(iOException);
                }
            }
            this.respondError(httpServletResponse, 400, c[11]);
        }
    }

    private void doLogin(HttpServletResponse httpServletResponse, PM2AbstractServlet.PM2AuthContext pM2AuthContext) throws IOException {
        try {
            int n2 = this.getSessionExpiry();
            HashMap<String, Object> hashMap = new HashMap<String, Object>();
            String[] stringArray = c;
            hashMap.put(stringArray[17], UUID.randomUUID().toString());
            hashMap.put(stringArray[38], this.getCurrentEpoch());
            String string = this.ssgOAuth2Issuer.getSigner().generateJwt(pM2AuthContext.getAuthenticatedUser(), hashMap, n2, stringArray[42]);
            httpServletResponse.setHeader(HttpConstants.HEADER_SET_COOKIE, this.getL7SessionIdCookie(string));
            this.respondSuccess(httpServletResponse, this.generateTokenResponse(n2));
            logger.log(Level.INFO, stringArray[12], pM2AuthContext.getAuthenticatedUser().getLogin());
        }
        catch (JsonProcessingException | OAuth2Exception throwable) {
            this.respondError(httpServletResponse, 500, c[54]);
        }
    }

    private void doRenewSession(HttpServletResponse httpServletResponse, PM2AbstractServlet.PM2AuthContext pM2AuthContext) throws IOException {
        OAuth2VerifierResult oAuth2VerifierResult = pM2AuthContext.getOAuthResult();
        try {
            if (oAuth2VerifierResult == null) {
                this.respondSuccess(httpServletResponse, c[45]);
                return;
            }
        }
        catch (JsonProcessingException jsonProcessingException) {
            throw PM2Servlet.b((Exception)((Object)jsonProcessingException));
        }
        int n2 = this.getSessionExpiry();
        int n3 = this.getSessionExtensionThreshold();
        long l2 = this.getAuthTime(oAuth2VerifierResult);
        try {
            if ((long)this.getCurrentEpoch() - l2 > (long)n3) {
                this.respondError(httpServletResponse, 403, c[26]);
            }
        }
        catch (JsonProcessingException jsonProcessingException) {
            throw PM2Servlet.b((Exception)((Object)jsonProcessingException));
        }
        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        String[] stringArray = c;
        hashMap.put(stringArray[17], oAuth2VerifierResult.getResult().get(stringArray[17]));
        hashMap.put(stringArray[8], l2);
        hashMap.put(stringArray[2], oAuth2VerifierResult.getResult().get(stringArray[2]));
        hashMap.put(stringArray[37], oAuth2VerifierResult.getResult().get(stringArray[37]));
        hashMap.put(stringArray[41], oAuth2VerifierResult.getResult().get(stringArray[41]));
        try {
            String string = this.ssgOAuth2Issuer.getSigner().generateJwt(hashMap, n2, stringArray[43]);
            this.ssgOAuth2Issuer.getSigner().revokeJwt(oAuth2VerifierResult.getResult());
            httpServletResponse.setHeader(HttpConstants.HEADER_SET_COOKIE, this.getL7SessionIdCookie(string));
            this.respondSuccess(httpServletResponse, this.generateTokenResponse(n2));
            logger.log(Level.INFO, stringArray[22], hashMap.get(stringArray[37]));
        }
        catch (JsonProcessingException | OAuth2Exception throwable) {
            this.respondError(httpServletResponse, 500, c[24]);
        }
    }

    /*
     * Loose catch block
     */
    private void doLogout(HttpServletResponse httpServletResponse, PM2AbstractServlet.PM2AuthContext pM2AuthContext) throws IOException {
        block6: {
            try {
                OAuth2VerifierResult oAuth2VerifierResult = pM2AuthContext.getOAuthResult();
                if (oAuth2VerifierResult == null) break block6;
                try {
                    block7: {
                        if (!this.ssgOAuth2Issuer.getSigner().revokeJwt(oAuth2VerifierResult.getResult())) break block6;
                        break block7;
                        catch (OAuth2Exception oAuth2Exception) {
                            throw PM2Servlet.b(oAuth2Exception);
                        }
                    }
                    logger.log(Level.INFO, c[51], oAuth2VerifierResult.getResult().get(c[37]));
                }
                catch (OAuth2Exception oAuth2Exception) {
                    throw PM2Servlet.b(oAuth2Exception);
                }
            }
            catch (OAuth2Exception oAuth2Exception) {
                String[] stringArray = c;
                logger.log(Level.INFO, stringArray[5], ExceptionUtils.getMessageWithCause((Throwable)oAuth2Exception));
            }
        }
        this.respondSuccess(httpServletResponse, "", c[28]);
    }

    private void doSessionInfo(HttpServletResponse httpServletResponse, PM2AbstractServlet.PM2AuthContext pM2AuthContext) throws IOException {
        String[] stringArray;
        ObjectNode objectNode = this.objectMapper.createObjectNode();
        User user = pM2AuthContext.getAuthenticatedUser();
        OAuth2VerifierResult oAuth2VerifierResult = pM2AuthContext.getOAuthResult();
        if (oAuth2VerifierResult != null) {
            stringArray = c;
            Object object = oAuth2VerifierResult.getResult().get(stringArray[31]);
            objectNode.put(stringArray[18], String.valueOf(object));
            objectNode.put(stringArray[19], this.getExpiryTime(oAuth2VerifierResult) - (long)this.getCurrentEpoch());
        } else {
            stringArray = c;
            objectNode.put(stringArray[0], UUID.randomUUID().toString());
        }
        stringArray = c;
        objectNode.putObject(stringArray[27]).put(stringArray[29], user.getName()).put(stringArray[47], user.getLogin()).put(stringArray[4], user.getSubjectDn()).put(stringArray[7], user.getEmail()).put(stringArray[33], user.getFirstName()).put(stringArray[55], user.getLastName()).put(stringArray[30], user.getProviderId().toString());
        this.respondSuccess(httpServletResponse, objectNode.toString());
    }

    private void doGraphQLRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException {
        PM2AbstractServlet.PM2AuthContext pM2AuthContext = this.authenticate(httpServletRequest, httpServletResponse);
        try {
            if (!pM2AuthContext.isAuthenticated()) {
                return;
            }
        }
        catch (IOException iOException) {
            throw PM2Servlet.b(iOException);
        }
        try {
            if (!this.verifyRBAC(pM2AuthContext)) {
                this.respondError(httpServletResponse, 403, c[52]);
                return;
            }
        }
        catch (IOException iOException) {
            throw PM2Servlet.b(iOException);
        }
        try {
            if (this.pm2GraphQLService == null) {
                this.respondError(httpServletResponse, 503, "");
                return;
            }
        }
        catch (IOException iOException) {
            throw PM2Servlet.b(iOException);
        }
        PM2GraphQLRequest pM2GraphQLRequest = this.getPM2GraphQLRequest(httpServletRequest);
        try {
            if (pM2GraphQLRequest == null) {
                this.respondError(httpServletResponse, 500, c[6]);
                return;
            }
        }
        catch (IOException iOException) {
            throw PM2Servlet.b(iOException);
        }
        Subject subject = new Subject();
        subject.getPrincipals().add((Principal)pM2AuthContext.getAuthenticatedUser());
        Subject.callAs(subject, () -> {
            String[] stringArray = c;
            logger.log(Level.FINE, stringArray[34], new Object[]{pM2GraphQLRequest.getQuery(), pM2GraphQLRequest.getVariables()});
            try {
                Map map = this.pm2GraphQLService.executeGraphQL(pM2GraphQLRequest);
                this.respondSuccess(httpServletResponse, this.toJSONString(map));
            }
            catch (Exception exception) {
                logger.warning(String.format(c[15], pM2GraphQLRequest.getQuery(), pM2GraphQLRequest.getVariables(), ExceptionUtils.getMessage((Throwable)exception)));
                this.respondError(httpServletResponse, 500, ExceptionUtils.getMessage((Throwable)exception));
            }
            return null;
        });
    }

    private int getCurrentEpoch() {
        return (int)(System.currentTimeMillis() / 1000L);
    }

    private int getSessionExpiry() {
        int n2 = SyspropUtil.getInteger((String)c[57], (int)1800);
        return n2 > 0 ? Math.max(300, n2) : 1800;
    }

    private int getSessionExtensionThreshold() {
        int n2 = SyspropUtil.getInteger((String)c[44], (int)43200);
        return n2 > 0 ? Math.max(this.getSessionExpiry(), n2) : 43200;
    }

    private long getAuthTime(OAuth2VerifierResult oAuth2VerifierResult) {
        try {
            long l2;
            Long l3 = (Long)oAuth2VerifierResult.getResult().get(c[8]);
            try {
                l2 = l3 != null ? l3 : 0L;
            }
            catch (Exception exception) {
                throw PM2Servlet.b(exception);
            }
            return l2;
        }
        catch (Exception exception) {
            return 0L;
        }
    }

    private long getExpiryTime(OAuth2VerifierResult oAuth2VerifierResult) {
        try {
            long l2;
            Long l3 = (Long)oAuth2VerifierResult.getResult().get(c[9]);
            try {
                l2 = l3 != null ? l3 : 0L;
            }
            catch (Exception exception) {
                throw PM2Servlet.b(exception);
            }
            return l2;
        }
        catch (Exception exception) {
            return 0L;
        }
    }

    private String generateTokenResponse(int n2) {
        ObjectNode objectNode = this.objectMapper.createObjectNode();
        return objectNode.put(c[36], n2).toString();
    }

    private PM2GraphQLRequest getPM2GraphQLRequest(HttpServletRequest httpServletRequest) {
        try {
            return (PM2GraphQLRequest)this.objectMapper.readValue((InputStream)httpServletRequest.getInputStream(), PM2GraphQLRequest.class);
        }
        catch (IOException iOException) {
            logger.warning(c[58] + iOException.getMessage());
            return null;
        }
    }

    private String toJSONString(Map<String, Object> map) {
        try {
            return this.objectMapper.writeValueAsString(map);
        }
        catch (JsonProcessingException jsonProcessingException) {
            String[] stringArray = c;
            logger.warning(stringArray[39] + jsonProcessingException.getMessage() + stringArray[32]);
            return map.toString();
        }
    }

    private String getL7SessionIdCookie(String string) {
        String[] stringArray = c;
        return stringArray[21] + string + stringArray[46] + this.getSessionExpiry() + stringArray[53];
    }

    private void initPM2State() {
        PM2State.a(this.serverConfig.getBooleanProperty(c[25], false));
        ConfigFactory.addListener((ConfigFactory.ConfigurationListener)new a(this), (String[])new String[0]);
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[59];
                var3_1 = 0;
                var2_2 = "L.\b\n-n>]N\u000fI\nU8s)DB\u001bW\u0003x\u0006F8y>YC\tV?~5HE\na$/`8n0_\u0006\u001bK)s*CR\u001bW/x\u007f_C\bJ!u1J\u0006\nM/<+BM\u001bKf<<LS\r@wgoP\u000fl$j>AO\u001a\u0005\u0018y.XC\rQ\u0005@'}6A\tD?h7rR\u0017H/\u0003@2l\u001au\u0007.\u007f^C\fS#\u007f:\rO\r\u0005?r3DE\u001bK9y;\u0003\u0012l$j>AO\u001a\u0005%l:_G\nL%rq\u0015p9y-\r\u000e\u0005\u001575\u007fAI\u0019B/x\u007fDHP\u0006P:x>YC\u0014p$w1BQ\u0010\u00058y.XC\rQjI\rd\bJ`8n0_\u0006\tM#p:\rC\u0006@)i+DH\u0019\u0005>t:\rV\u0013\u0017j{-LV\u0016T&<.XC\f\\p<z^\n^S+n6LD\u0012@9&\u007f\bUR\u00058y>^I\u0010\u001fj9,/F%qqA\u0011\n@)tq^C\fS/nq]KL\u000b9y,^O\u0011K\u000fd+HH\rL%r\u000bET\u001bV\"s3I\u0003V#x\u0002L.\n@2l6_C\rz#r#F%qqA\u0011\n@)tq^C\fS/nq]KL\u000b9y,^O\u0011K\u000fd/DT\u0007\bi}O\fjo:\u0018$p9y-\r\u000e\u0005\u001575\u007f^C\rV#s1\rN\u001fVj~:HH^W/r:ZC\u001a\u000b\u0004W/};%f%i3I\u0006\u0010J><8HH\u001bW+h:\rR\u0016@jo:^U\u0017J$<+BM\u001bKd\u000bU'.qHH\u001fG&y;6v/o,DI\u0010\u0005)}1CI\n\u0005(y\u007fH^\n@$x:I\u0006\u001c@3s1I\u0006\nM/<+ET\u001bV\"s3I\u0006\u0012L'u+\u0003\u0004P9y-\u0019Q/d+\u0002V\u0012D#rd\rE\u0016D8o:Y\u001b\u000bQ,1g\u0004K+q:\nU8s)DB\u001bW\u0003x\u0003V#x\u001a\tjn:YS\fK#r8\rT\u001bV:s1^C^D9<6^\tC#n,Yh\u001fH//u\u0007.\u007fjT\u001fU\"M\u0013\rt\u001bT?y,Y\u001c^t?y-T\u001c^^zas\rp\u001fW#}=AC\r\u001fjgnP\u000bU'.qHH\u001fG&y;\n@2l6_C\rz#r\u0005I%{6C\tD?h7rR\u0017H/8`8n0_\u0006\tM#p:\rV\u001fW9u1J\u0006\tM#p:\rv3\u0017j[-LV\u0016T&<-HU\u000eJ$o:\u0001\u0006\u001dD?o:\u0017\u0006^\rp$}*YN\u0011W#f:I\b\tV?~5HE\na$\u0006D>7\u0015zr\u0006D>7\u0015zr/F%qqA\u0011\n@)tq^C\fS/nq]KL\u000b9y,^O\u0011K\u000fd+HH\rL%r\u000bET\u001bV\"s3I\u0002^7\u0010\u001e\u001a}+E\u001bQ\u001e\u0007}'\u0000g\u0019@w\u0005I%{6C\u0006A/p:YC\u000bp$p6NC\u0010V/xq\tJ:y-LR\u0017J$\u0016p9y-\r\u000e\u0005\u001575\u007fAI\u0019B/x\u007fBS\n\u000b\rp$}*YN\u0011W#f:I\b \u001e\u0019y<XT\u001b\u001e\u0002h+]i\u0010I3'\fLK\u001bv#h:\u0010u\nW#\u007f+%f%i3I\u0006\u0010J><8HH\u001bW+h:\rR\u0016@jo:^U\u0017J$<+BM\u001bKd\bI+o+cG\u0013@\b\n9y,^O\u0011K";
                var4_3 = "L.\b\n-n>]N\u000fI\nU8s)DB\u001bW\u0003x\u0006F8y>YC\tV?~5HE\na$/`8n0_\u0006\u001bK)s*CR\u001bW/x\u007f_C\bJ!u1J\u0006\nM/<+BM\u001bKf<<LS\r@wgoP\u000fl$j>AO\u001a\u0005\u0018y.XC\rQ\u0005@'}6A\tD?h7rR\u0017H/\u0003@2l\u001au\u0007.\u007f^C\fS#\u007f:\rO\r\u0005?r3DE\u001bK9y;\u0003\u0012l$j>AO\u001a\u0005%l:_G\nL%rq\u0015p9y-\r\u000e\u0005\u001575\u007fAI\u0019B/x\u007fDHP\u0006P:x>YC\u0014p$w1BQ\u0010\u00058y.XC\rQjI\rd\bJ`8n0_\u0006\tM#p:\rC\u0006@)i+DH\u0019\u0005>t:\rV\u0013\u0017j{-LV\u0016T&<.XC\f\\p<z^\n^S+n6LD\u0012@9&\u007f\bUR\u00058y>^I\u0010\u001fj9,/F%qqA\u0011\n@)tq^C\fS/nq]KL\u000b9y,^O\u0011K\u000fd+HH\rL%r\u000bET\u001bV\"s3I\u0003V#x\u0002L.\n@2l6_C\rz#r#F%qqA\u0011\n@)tq^C\fS/nq]KL\u000b9y,^O\u0011K\u000fd/DT\u0007\bi}O\fjo:\u0018$p9y-\r\u000e\u0005\u001575\u007f^C\rV#s1\rN\u001fVj~:HH^W/r:ZC\u001a\u000b\u0004W/};%f%i3I\u0006\u0010J><8HH\u001bW+h:\rR\u0016@jo:^U\u0017J$<+BM\u001bKd\u000bU'.qHH\u001fG&y;6v/o,DI\u0010\u0005)}1CI\n\u0005(y\u007fH^\n@$x:I\u0006\u001c@3s1I\u0006\nM/<+ET\u001bV\"s3I\u0006\u0012L'u+\u0003\u0004P9y-\u0019Q/d+\u0002V\u0012D#rd\rE\u0016D8o:Y\u001b\u000bQ,1g\u0004K+q:\nU8s)DB\u001bW\u0003x\u0003V#x\u001a\tjn:YS\fK#r8\rT\u001bV:s1^C^D9<6^\tC#n,Yh\u001fH//u\u0007.\u007fjT\u001fU\"M\u0013\rt\u001bT?y,Y\u001c^t?y-T\u001c^^zas\rp\u001fW#}=AC\r\u001fjgnP\u000bU'.qHH\u001fG&y;\n@2l6_C\rz#r\u0005I%{6C\tD?h7rR\u0017H/8`8n0_\u0006\tM#p:\rV\u001fW9u1J\u0006\tM#p:\rv3\u0017j[-LV\u0016T&<-HU\u000eJ$o:\u0001\u0006\u001dD?o:\u0017\u0006^\rp$}*YN\u0011W#f:I\b\tV?~5HE\na$\u0006D>7\u0015zr\u0006D>7\u0015zr/F%qqA\u0011\n@)tq^C\fS/nq]KL\u000b9y,^O\u0011K\u000fd+HH\rL%r\u000bET\u001bV\"s3I\u0002^7\u0010\u001e\u001a}+E\u001bQ\u001e\u0007}'\u0000g\u0019@w\u0005I%{6C\u0006A/p:YC\u000bp$p6NC\u0010V/xq\tJ:y-LR\u0017J$\u0016p9y-\r\u000e\u0005\u001575\u007fAI\u0019B/x\u007fBS\n\u000b\rp$}*YN\u0011W#f:I\b \u001e\u0019y<XT\u001b\u001e\u0002h+]i\u0010I3'\fLK\u001bv#h:\u0010u\nW#\u007f+%f%i3I\u0006\u0010J><8HH\u001bW+h:\rR\u0016@jo:^U\u0017J$<+BM\u001bKd\bI+o+cG\u0013@\b\n9y,^O\u0011K".length();
                var1_4 = 2;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = PM2Servlet.c(v0, PM2Servlet.c(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "E&rrB\u0012\tC*wr]@\u000fP,mr^HO\b:z/]L\u0012H\fg,GW\u00047c;m3\\\u0005\nN s9\u000eU\u001cT:v2I\u0005\nN s9\u000eu0\u0014iX.OU\u0015W%?.KT\bC:kp\u000eF\u001cS:zf\u000e\u0005";
                    var4_3 = "E&rrB\u0012\tC*wr]@\u000fP,mr^HO\b:z/]L\u0012H\fg,GW\u00047c;m3\\\u0005\nN s9\u000eU\u001cT:v2I\u0005\nN s9\u000eu0\u0014iX.OU\u0015W%?.KT\bC:kp\u000eF\u001cS:zf\u000e\u0005".length();
                    var1_4 = 35;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 21;
                        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++] = PM2Servlet.c(v0, PM2Servlet.c(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;
            }
        }
        PM2Servlet.c = var5;
        PM2Servlet.ENABLED_PROP = PM2Servlet.c[35];
        PM2Servlet.SESSION_EXPIRY_SYS_PROP = PM2Servlet.c[20];
        PM2Servlet.SESSION_EXTENSION_THRESHOLD_SYS_PROP = PM2Servlet.c[16];
        PM2Servlet.TOKEN_TYPE_AT_JWT = PM2Servlet.c[43];
        PM2Servlet.logger = Logger.getLogger(PM2Servlet.class.getName());
    }

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

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String c(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 -> 51;
                    case 1 -> 92;
                    case 2 -> 10;
                    case 3 -> 73;
                    case 4 -> 59;
                    case 5 -> 48;
                    default -> 104;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

