导航菜单

页面标题

页面副标题

КЛ£ v1.0.0 - AppProtectManager.java 源代码

正在查看: КЛ£ v1.0.0 应用的 AppProtectManager.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.app.protect;

import a.a.a.pro5131;
import a.a.a.pro5132;
import a.a.a.pro5133;
import a.a.a.pro5134;
import a.a.a.pro5136;
import a.a.a.pro5137;
import a.a.a.pro5138;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.text.TextUtils;
import androidx.core.app.NotificationCompat;
import androidx.core.view.InputDeviceCompat;
import androidx.core.view.PointerIconCompat;
import androidx.exifinterface.media.ExifInterface;
import androidx.recyclerview.widget.ItemTouchHelper;
import com.baidu.lbsapi.auth.LBSAuthManager;
import com.baidu.mapapi.UIMsg;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.offline.DownloadAction;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.gms.common.internal.ImagesContract;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.king.zxing.util.LogUtils;
import com.litesuits.orm.db.assit.SQLBuilder;
import com.zhy.http.okhttp.OkHttpUtils;
import im.pggrnmxjgs.messenger.ImageLoader;
import im.pggrnmxjgs.ui.components.banner.config.BannerConfig;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.net.BindException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Scanner;
import java.util.Stack;
import java.util.TimeZone;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java9.util.concurrent.CompletableFuture;
import java9.util.concurrent.CompletionStage;
import java9.util.concurrent.ThreadLocalRandom;
import java9.util.function.BiConsumer;
import java9.util.function.Function;
import java9.util.function.Supplier;
import kotlin.text.Typography;
import org.json.JSONObject;
import org.xbill.DNS.Lookup;
import org.xbill.DNS.Record;
import org.xbill.DNS.SimpleResolver;
import org.xbill.DNS.TXTRecord;

public class AppProtectManager {
    public static Map<Integer, Integer> pro5133 = null;
    public static boolean pro5134 = false;
    public static Selector pro5137;
    public static CompletableFuture<Void> pro5141;
    public static CompletableFuture<Void> pro5142;
    public static CompletableFuture<Void> pro5143;
    public static CompletableFuture<String> pro5149;
    public static ExecutorService pro5150;
    public static ExecutorService pro5151;
    public static ExecutorService pro5152;
    public static ExecutorService pro5153;
    public static ScheduledExecutorService pro5154;
    public static ScheduledExecutorService pro5155;
    public static ScheduledExecutorService pro5156;
    public static Future<?> pro5157;
    public static Future<?> pro5158;
    public static Future<?> pro5159;
    public static String pro5160;
    public static String pro5161;
    public static String pro5162;
    public static long pro5164;
    public static long pro5166;
    public static long pro5167;
    public static Context pro5171;
    public static String pro5178;
    public static String pro5208;
    public static String pro5209;
    public static Map<Integer, Integer> pro5210;
    public static String pro5211;
    public static String pro5234;
    public static String pro5235;
    public static String pro5236;
    public static String pro5237;
    public static String pro5238;
    public static volatile ExecutorService pro5250;
    public static AlertDialog pro5252;
    public static final int[] pro5109 = {445, 593, 707, 901, InputDeviceCompat.SOURCE_GAMEPAD, 1068, 1353, 1434, 1723, 2745, 3127, 3128, 3129, 3130, 3333, 4444, 4786, 539};
    public static final int[] pro5130 = {4900, 4901, 4902, 4903, 4904, 4905, 4906, 4907, 4908, 4909, 4910, 4911, 4912, 4913, 4914, 4915, 4916, 4917};
    public static final int[] pro5131 = {5554, 5800, 5900, 6167, 6667, 8998, 9996, 8866};
    public static final int[] pro5132 = {7800, 7801, 7802, 7803, 7804, 7805, 7806, 7807};
    public static final ArrayList<HashMap<pro5130, pro5130>> pro5135 = new ArrayList<>();
    public static final ArrayList<HashMap<pro5130, pro5130>> pro5136 = new ArrayList<>();
    public static final List<pro5136> pro5138 = new ArrayList();
    public static final List<pro5138> pro5139 = new ArrayList();
    public static final AtomicBoolean pro5140 = new AtomicBoolean(false);
    public static int pro5144 = 0;
    public static long pro5145 = 0;
    public static final AtomicReference<CompletableFuture<Void>> pro5146 = new AtomicReference<>();
    public static final List<CompletableFuture<String>> pro5147 = new ArrayList();
    public static final List<CompletableFuture<String>> pro5148 = new ArrayList();
    public static String pro5163 = "";
    public static long pro5165 = -1;
    public static final AtomicLong pro5168 = new AtomicLong(-1);
    public static final AtomicLong pro5169 = new AtomicLong(-1);
    public static final AtomicLong pro5170 = new AtomicLong(-1);
    public static final ConcurrentLinkedQueue<pro5136> pro5172 = new ConcurrentLinkedQueue<>();
    public static boolean pro5173 = false;
    public static boolean pro5174 = false;
    public static final String[] pro5175 = new String[4];
    public static final int[] pro5176 = new int[4];
    public static final String[] pro5177 = new String[4];
    public static final int[] pro5179 = new int[4];
    public static final int[] pro5180 = new int[4];
    public static final int[] pro5181 = new int[4];
    public static final int[] pro5182 = new int[4];
    public static final int[] pro5183 = new int[4];
    public static final pro5137[] pro5184 = new pro5137[3];
    public static final String[] pro5185 = new String[3];
    public static final SocketChannel[] pro5186 = new SocketChannel[6];
    public static final SocketChannel[] pro5187 = new SocketChannel[5];
    public static pro5109 pro5188 = new pro5109();
    public static boolean pro5189 = false;
    public static String pro5190 = "";
    public static String pro5191 = "";
    public static boolean pro5192 = false;
    public static boolean pro5193 = false;
    public static int pro5194 = 1;
    public static int pro5196 = 0;
    public static boolean pro5197 = false;
    public static int pro5198 = 0;
    public static int pro5199 = 0;
    public static int pro5200 = 0;
    public static int pro5201 = 0;
    public static String pro5202 = "0";
    public static int pro5203 = 0;
    public static int pro5204 = 0;
    public static int pro5205 = 0;
    public static int pro5206 = 1;
    public static int pro5207 = 0;
    public static String pro5212 = "0";
    public static boolean pro5213 = false;
    public static boolean pro5214 = false;
    public static boolean pro5215 = false;
    public static boolean pro5216 = true;
    public static boolean pro5217 = false;
    public static long pro5218 = -1;
    public static double pro5219 = -1.0d;
    public static final Object pro5220 = new Object();
    public static String pro5221 = "";
    public static final int[] pro5222 = new int[4];
    public static int pro5223 = ItemTouchHelper.Callback.DEFAULT_DRAG_ANIMATION_DURATION;
    public static String pro5224 = "";
    public static final int[] pro5225 = new int[4];
    public static String pro5226 = "";
    public static int pro5227 = 0;
    public static final StringBuilder pro5228 = new StringBuilder();
    public static final AtomicInteger pro5229 = new AtomicInteger(0);
    public static long pro5230 = System.currentTimeMillis();
    public static final AtomicInteger pro5231 = new AtomicInteger(0);
    public static long pro5232 = System.currentTimeMillis();
    public static final String[] pro5233 = {"https://2024.ipchaxun.com", "https://myip.ipip.net", "https://ifconfig.me", "https://ident.me", "https://api.ipify.org", "https://whois.pconline.com.cn/ipJson.jsp?ip=&json=true"};
    public static final String[] pro5239 = new String[3];
    public static boolean pro5240 = false;
    public static final String[] pro5241 = {"2,1,4,3", "1,3,4,2", "3,4,2,1", "4,2,3,1"};
    public static final String[] pro5242 = {"30,21,90,210", "23,33,77,55", "43,66,43,21", "90,21,45,61"};
    public static final AtomicLong pro5243 = new AtomicLong(0);
    public static final AtomicBoolean pro5244 = new AtomicBoolean(false);
    public static final long[] pro5245 = new long[12];
    public static int pro5246 = -1;
    public static String pro5247 = "";
    public static int pro5248 = 0;
    public static final AtomicReference<Future<?>> pro5249 = new AtomicReference<>();
    public static final DialogInterface.OnClickListener pro5251 = new DialogInterface.OnClickListener() {
        @Override
        public final void onClick(DialogInterface dialogInterface, int i) {
            AppProtectManager.pro5109(dialogInterface, i);
        }
    };
    public static final Handler pro5253 = new Handler(Looper.getMainLooper());

    public static class pro5109 {
        public int pro5109;
        public String pro5130;
        public String pro5131;
        public int pro5132;
        public int pro5133;
        public String pro5134;
        public int pro5135;
        public int pro5136;
        public int pro5137;
        public int pro5138;
        public int pro5139;
        public String pro5140;
        public String pro5141;
        public String pro5142;
        public int pro5143;
        public int pro5144;
        public int pro5145;
        public int pro5146;
        public String pro5147;
        public String pro5148;
        public String pro5149;
        public int pro5150;
        public int pro5151;
        public int pro5152;
        public int pro5153;
        public String pro5154;
        public String pro5155;
        public String pro5156;
        public int pro5157;
        public int pro5158;
        public int pro5159;
        public int pro5160;
        public String pro5161;
        public String pro5162;
        public String pro5163;
        public int pro5164;
        public String pro5165;
        public int pro5166;
        public int pro5167;
        public int pro5168;
        public int pro5169;
        public int pro5170;
        public int pro5171;
        public int pro5172;
        public int pro5173;
        public String pro5174;
        public String pro5175;
        public String pro5176;
        public String pro5177;
        public String pro5178;
        public String pro5179;
        public int pro5180;
        public long pro5181;
    }

    public static class pro5130 {
        public final String pro5109;
        public final int pro5130;
        public final int pro5131;
        public int pro5132;
        public int pro5133;
        public boolean pro5134;
        public String pro5135 = "";

        public pro5130(String str, int i, int i2, boolean z, int i3, int i4) {
            this.pro5109 = str;
            this.pro5130 = i;
            this.pro5131 = i4;
            this.pro5132 = i2;
            this.pro5133 = i3;
            this.pro5134 = z;
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || pro5130.class != obj.getClass()) {
                return false;
            }
            pro5130 pro5130Var = (pro5130) obj;
            return this.pro5130 == pro5130Var.pro5130 && Objects.equals(this.pro5109, pro5130Var.pro5109);
        }

        public int hashCode() {
            return Objects.hash(this.pro5109, Integer.valueOf(this.pro5130));
        }
    }

    public static String getUniqueID() {
        String str;
        SharedPreferences sharedPreferences;
        if (pro5171 == null) {
            return null;
        }
        if (TextUtils.isEmpty(a.a.a.pro5109.pro5109)) {
            SharedPreferences sharedPreferences2 = a.a.a.pro5109.pro5130.getSharedPreferences("KEY_UDID_NEW", 0);
            String string = sharedPreferences2 != null ? sharedPreferences2.getString("KEY_UDID_NEW", null) : null;
            if (TextUtils.isEmpty(string)) {
                try {
                    String string2 = Settings.Secure.getString(a.a.a.pro5109.pro5130.getContentResolver(), "android_id");
                    if ("9774d56d682e549c".equals(string2)) {
                        string2 = a.a.a.pro5109.pro5109(16);
                    }
                    str = Build.MANUFACTURER + "-" + Build.HARDWARE + "-" + Build.BOOTLOADER + "-" + string2;
                } catch (Exception e) {
                    str = "";
                }
                if (str.isEmpty()) {
                    str = UUID.randomUUID().toString();
                }
                if (!TextUtils.isEmpty(str) && (sharedPreferences = a.a.a.pro5109.pro5130.getSharedPreferences("KEY_UDID_NEW", 0)) != null) {
                    sharedPreferences.edit().putString("KEY_UDID_NEW", str).apply();
                }
                a.a.a.pro5109.pro5109 = str;
            } else {
                a.a.a.pro5109.pro5109 = string;
                str = string;
            }
        } else {
            str = a.a.a.pro5109.pro5109;
        }
        return pro5134(str);
    }

    public static int init(Context context, String str) {
        int i;
        int i2;
        File parentFile;
        int pro51402;
        String str2;
        String str3;
        boolean z;
        boolean z2;
        int pro51302;
        String pro51092;
        String str4;
        String str5;
        String str6;
        if (pro5136(str)) {
            return -2;
        }
        try {
            String str7 = new String(pro5133.pro5109(str), pro5133.pro5109);
            try {
                String[] pro51093 = pro5109(a.a.a.pro5109.pro5109(str7, pro5133.pro5109()), '|');
                String str8 = pro51093[1];
                String str9 = pro51093[2];
                pro5208 = pro51093[5];
                StringBuilder sb = new StringBuilder();
                for (int i3 = 6; i3 < 10; i3++) {
                    sb.append(pro51093[i3]);
                    if (i3 < pro51093.length - 1) {
                        sb.append(LogUtils.VERTICAL);
                    }
                }
                String sb2 = sb.toString();
                pro5211 = sb2;
                pro5237 = "";
                pro5236 = "";
                pro5235 = "";
                pro5234 = "";
                pro5141(sb2);
                if (pro51093.length > 11) {
                    pro5212 = pro51093[11];
                }
                if (pro51093.length > 15) {
                    pro5190 = pro51093[15];
                }
                if (pro51093.length > 16) {
                    pro5191 = pro51093[16];
                }
                if (pro51093.length > 23) {
                    pro5185[0] = pro51093[23];
                }
                if (pro51093.length > 24) {
                    pro5185[1] = pro51093[24];
                }
                if (pro51093.length > 25) {
                    pro5185[2] = pro51093[25];
                }
                if (pro51093.length > 26) {
                    pro5216 = "1".equals(pro51093[26]);
                }
                if (pro51093.length > 27) {
                    pro5217 = "1".equals(pro51093[27]);
                }
                Locale locale = Locale.getDefault();
                String language = locale.getLanguage();
                String country = locale.getCountry();
                if ("zh".equals(language)) {
                    if ("CN".equals(country)) {
                        i = 1;
                    } else if ("TW".equals(country) || "HK".equals(country)) {
                        i = 2;
                    }
                    pro5206 = i;
                    if (pro5135.isEmpty()) {
                        for (int i4 = 0; i4 < 4; i4++) {
                            pro5135.add(new HashMap<>());
                        }
                        for (int i5 = 0; i5 < 4; i5++) {
                            pro5136.add(new HashMap<>());
                        }
                        Arrays.fill(pro5175, "");
                        Arrays.fill(pro5176, 0);
                        Arrays.fill(pro5177, "");
                        Arrays.fill(pro5179, 0);
                        Arrays.fill(pro5180, 0);
                        Arrays.fill(pro5181, 0);
                        Arrays.fill(pro5182, 0);
                        Arrays.fill(pro5183, -1);
                        Arrays.fill(pro5222, 0);
                        Arrays.fill(pro5225, 0);
                        Arrays.fill(pro5184, new pro5137());
                        HashMap hashMap = new HashMap();
                        int i6 = 0;
                        while (true) {
                            int[] iArr = pro5109;
                            if (i6 >= iArr.length) {
                                break;
                            }
                            hashMap.put(Integer.valueOf(iArr[i6]), Integer.valueOf(pro5130[i6]));
                            i6++;
                        }
                        int i7 = 0;
                        while (true) {
                            int[] iArr2 = pro5131;
                            if (i7 >= iArr2.length) {
                                break;
                            }
                            hashMap.put(Integer.valueOf(iArr2[i7]), Integer.valueOf(pro5132[i7]));
                            i7++;
                        }
                        pro5133 = Collections.unmodifiableMap(hashMap);
                    }
                    String pro51342 = pro5134(str8 + "protect");
                    pro5160 = new File(context.getExternalFilesDir(null), pro51342 + ".txt").getAbsolutePath();
                    pro5161 = str9;
                    pro5162 = str8;
                    pro5171 = context;
                    a.a.a.pro5109.pro5130 = context.getApplicationContext();
                    for (i2 = 0; i2 < 3 && pro5136(pro5234) && pro5136(pro5235) && pro5136(pro5236) && pro5136(pro5237); i2++) {
                        try {
                            str6 = a.a.a.pro5109.pro5109(str7, pro5133.pro5109());
                        } catch (Exception e) {
                            str6 = "";
                        }
                        if (pro5136(str6)) {
                            String[] pro51094 = pro5109(str6, '|');
                            StringBuilder sb3 = new StringBuilder();
                            for (int i8 = 6; i8 < 10; i8++) {
                                sb3.append(pro51094[i8]);
                                if (i8 < pro51094.length - 1) {
                                    sb3.append(LogUtils.VERTICAL);
                                }
                            }
                            String sb4 = sb3.toString();
                            pro5211 = sb4;
                            pro5141(sb4);
                        }
                    }
                    parentFile = new File(pro5160).getParentFile();
                    if (parentFile != null) {
                        parentFile.toString();
                        pro5134.pro5130();
                    }
                    if (!pro5136(pro5234) && pro5136(pro5235) && pro5136(pro5236) && pro5136(pro5237)) {
                        int i9 = pro5206;
                        if (i9 == 2) {
                            str4 = "解析錯誤";
                            str5 = "SDKKEY解析出錯";
                        } else if (i9 == 3) {
                            str4 = "Call Error";
                            str5 = "SDK decryption failed";
                        } else {
                            str4 = "解析错误";
                            str5 = "SDKKEY解析出错";
                        }
                        pro5109(str4, str5, true, 0);
                        return -5;
                    }
                    pro5132 pro51312 = pro5132.pro5131();
                    String str10 = pro5160;
                    String str11 = pro5161;
                    pro51312.pro5109 = str10;
                    pro51312.pro5130 = str11;
                    String pro51303 = pro5132.pro5131().pro5130();
                    pro51402 = pro5140("10910");
                    if (pro51402 != 0 && !pro5136(pro51303) && pro51303.length() <= 6 && pro5140(pro51303) >= pro51402) {
                        pro51092 = pro5132.pro5131().pro5109();
                        if (!pro5136(pro51092)) {
                            pro5109 pro51095 = pro5109(pro51092);
                            pro5134 = !pro5136(pro51095.pro5179) && "High".equals(pro51095.pro5179);
                            pro5144 = pro51095.pro5180;
                            pro5145 = pro51095.pro5181;
                            if (pro51095.pro5109 == 200) {
                                if (!pro5136(pro51095.pro5165)) {
                                    pro5141(a.a.a.pro5109.pro5109(pro51095.pro5165, pro5133.pro5132()));
                                }
                                if (!pro5136(pro51095.pro5174)) {
                                    String str12 = pro51095.pro5174;
                                    if (!pro5136(str12)) {
                                        String[] pro51096 = pro5109(str12, '|');
                                        if (pro51096.length >= 3) {
                                            for (int i10 = 0; i10 < 3; i10++) {
                                                if (!pro5136(pro51096[i10])) {
                                                    pro5185[i10] = pro51096[i10];
                                                }
                                            }
                                        }
                                    }
                                }
                                if (!pro5136(pro51095.pro5175)) {
                                    pro5216 = "1".equals(pro51095.pro5175);
                                }
                                if (!pro5136(pro51095.pro5176)) {
                                    pro5217 = "1".equals(pro51095.pro5176);
                                }
                            }
                        }
                    }
                    if (pro5157 == null) {
                        pro5133.pro5130(0);
                        pro5165 = -1L;
                        pro5164 = -1L;
                        pro5133();
                        pro5170.set(-1L);
                        pro5109(-1L, -1L);
                        pro5156();
                        System.currentTimeMillis();
                        pro5133.pro5130(1);
                        pro5150();
                        pro5133.pro5130(2);
                        pro5154();
                        pro5133.pro5130(3);
                        if (pro5136(pro5163) && (pro5165 == -1 || System.currentTimeMillis() - pro5165 > OkHttpUtils.DEFAULT_MILLISECONDS)) {
                            pro5165 = System.currentTimeMillis();
                            pro5152();
                        }
                        pro5213 = false;
                        pro5214 = false;
                        pro5140.set(false);
                        long currentTimeMillis = System.currentTimeMillis();
                        pro5166 = currentTimeMillis;
                        pro5165 = currentTimeMillis;
                        pro5164 = currentTimeMillis;
                        File file = new File(pro5160);
                        if (!file.exists() || file.isDirectory()) {
                            str2 = "首次激活app";
                        } else {
                            try {
                                String pro51304 = pro5132.pro5131().pro5130();
                                int pro51403 = pro5140("10910");
                                if (pro51403 != 0 && !pro5136(pro51304) && pro51304.length() <= 6 && pro5140(pro51304) >= pro51403) {
                                    pro5109(pro5132.pro5131().pro5109(), pro5161, false, false);
                                    String[] strArr = pro5175;
                                    int length = strArr.length;
                                    int i11 = 0;
                                    int i12 = 0;
                                    while (true) {
                                        if (i11 < length) {
                                            String str13 = strArr[i11];
                                            if (pro5136(str13)) {
                                                i12++;
                                            } else if (!pro5137(str13) && !pro5138(str13)) {
                                                break;
                                            }
                                            i11++;
                                        } else if (i12 != pro5175.length) {
                                            z = true;
                                        }
                                    }
                                    z = false;
                                    if (z) {
                                        for (int i13 = 0; i13 < pro5181.length; i13++) {
                                            if (pro5136(pro5175[i13]) || ((pro51302 = pro5130(i13)) >= 1 && pro51302 <= 65535)) {
                                            }
                                            z2 = false;
                                        }
                                        z2 = true;
                                        if (z2 && pro5135() != 0) {
                                            pro5153();
                                            pro5157();
                                            pro5167 = System.currentTimeMillis() - 11000;
                                            testActivity();
                                        }
                                    }
                                    file.delete();
                                    str3 = "本地文件取不到转发服务器IP或规则为空";
                                    pro5130(1, 0, str3);
                                }
                                file.delete();
                                str3 = "SDK版本升级:10910";
                                pro5130(1, 0, str3);
                            } catch (Exception e2) {
                                str2 = "本地文件读取异常";
                            }
                        }
                        pro5130(1, 0, str2);
                    }
                    synchronized (pro5220) {
                        long currentTimeMillis2 = System.currentTimeMillis();
                        while (!pro5213 && System.currentTimeMillis() - currentTimeMillis2 < 3000) {
                            try {
                                pro5220.wait(3000L);
                            } catch (InterruptedException e3) {
                                Thread.currentThread().interrupt();
                            }
                        }
                    }
                    return pro5213 ? 1 : 0;
                }
                i = 3;
                pro5206 = i;
                if (pro5135.isEmpty()) {
                }
                String pro513422 = pro5134(str8 + "protect");
                pro5160 = new File(context.getExternalFilesDir(null), pro513422 + ".txt").getAbsolutePath();
                pro5161 = str9;
                pro5162 = str8;
                pro5171 = context;
                a.a.a.pro5109.pro5130 = context.getApplicationContext();
                while (i2 < 3) {
                    str6 = a.a.a.pro5109.pro5109(str7, pro5133.pro5109());
                    if (pro5136(str6)) {
                    }
                }
                parentFile = new File(pro5160).getParentFile();
                if (parentFile != null) {
                }
                if (!pro5136(pro5234)) {
                }
                pro5132 pro513122 = pro5132.pro5131();
                String str102 = pro5160;
                String str112 = pro5161;
                pro513122.pro5109 = str102;
                pro513122.pro5130 = str112;
                String pro513032 = pro5132.pro5131().pro5130();
                pro51402 = pro5140("10910");
                if (pro51402 != 0) {
                    pro51092 = pro5132.pro5131().pro5109();
                    if (!pro5136(pro51092)) {
                    }
                }
                if (pro5157 == null) {
                }
                synchronized (pro5220) {
                }
            } catch (Exception e4) {
                return -2;
            }
        } catch (Exception e5) {
            return -2;
        }
    }

    public static int init(Context context, String str, String str2) {
        if (pro5136(pro5209)) {
            pro5209 = str2;
        }
        return init(context, str);
    }

    public static String init(Context context, String str, String str2, String str3) {
        int nextInt;
        if (pro5136(str3)) {
            return Integer.toString(init(context, str, str2));
        }
        if (pro5210 == null) {
            pro5210 = new HashMap();
            for (String str4 : pro5109(str3, '|')) {
                pro5210.put(Integer.valueOf(pro5140(str4)), 0);
            }
            Random random = new Random();
            Iterator<Integer> it = pro5210.keySet().iterator();
            while (it.hasNext()) {
                int intValue = it.next().intValue();
                while (true) {
                    nextInt = random.nextInt(64512) + 1024;
                    if (pro5210.containsKey(Integer.valueOf(nextInt)) || pro5210.containsValue(Integer.valueOf(nextInt))) {
                    }
                }
                pro5210.put(Integer.valueOf(intValue), Integer.valueOf(nextInt));
            }
            StringBuilder sb = new StringBuilder();
            for (Map.Entry<Integer, Integer> entry : pro5210.entrySet()) {
                sb.append(entry.getKey());
                sb.append(",");
                sb.append(entry.getValue());
                sb.append(LogUtils.VERTICAL);
            }
            pro5247 = sb.substring(0, sb.length() - 1);
        }
        int init = init(context, str, str2);
        return (init != 1 || pro5136(pro5247)) ? Integer.toString(init) : pro5247;
    }

    public static int pro5109(int i) {
        ArrayList arrayList;
        synchronized (pro5138) {
            arrayList = new ArrayList(pro5138);
        }
        int i2 = 0;
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            pro5136 pro5136Var = (pro5136) it.next();
            if (pro5136Var.pro5153 == i) {
                i2 += pro5136Var.pro5109();
            }
        }
        return i2;
    }

    public static int pro5109(int i, int i2, int i3) {
        int i4;
        int i5;
        if (i > 10000 && i < 30000) {
            return (((i3 + 10000) + (i2 * 100)) + i) - 1;
        }
        if (i <= 5000) {
            i5 = i2 * 2;
        } else {
            if (i > 10000) {
                if (i > 100000 && i <= 105000) {
                    i4 = i3 + 18000;
                    i2 *= 2;
                } else {
                    if (i > 105001 && i <= 110000) {
                        return i3 + 18000 + (i2 * 2) + 1;
                    }
                    if (i >= 1000000) {
                        return i3 + 22000 + ((i2 - 1800) * 10) + (i - 1000001);
                    }
                    i4 = i3 + UIMsg.m_AppUI.MSG_RADAR_SEARCH_RETURN_RESULT;
                }
                return i4 + i2;
            }
            i5 = (i2 * 2) + 1;
        }
        return i3 + i5 + 10000;
    }

    public static int pro5109(String str, int i, int i2) {
        try {
            if (!pro5136(str)) {
                int[] iArr = new int[4];
                iArr[0] = i - 5;
                String[] pro51092 = pro5109(str, '.');
                iArr[1] = ((iArr[0] * (pro5140(pro51092[2]) + pro5140(pro51092[3]))) % 1000) + 33300;
                iArr[2] = (iArr[0] % 444) + 8500;
                iArr[3] = iArr[2] + 26;
                i = i2 < 2 ? iArr[i2] + 79 : iArr[i2];
            }
        } catch (Exception e) {
        }
        return i;
    }

    public static int pro5109(String str, int i, int i2, int i3) {
        int i4;
        int i5;
        int i6;
        int i7;
        Integer num;
        if (i > 10000 && i < 30000) {
            return (((i3 + 10000) + (i2 * 100)) + i) - 1;
        }
        int i8 = 0;
        if (pro5136(str)) {
            i4 = 0;
        } else {
            String[] pro51092 = pro5109(str, '.');
            int pro51402 = pro5140(pro51092[1]);
            int pro51403 = pro5140(pro51092[2]);
            int pro51404 = pro5140(pro51092[3]);
            int i9 = (pro51402 * pro51404) % 66;
            i4 = ((pro51403 * pro51404) + 25887) % 49;
            i8 = i9;
        }
        if (i <= 5000) {
            i7 = i2 * 2;
        } else {
            if (i > 10000) {
                if (i <= 100000 || i > 105000) {
                    if (i > 105001 && i <= 110000) {
                        i6 = i3 + 18000 + (i2 * 2) + 1;
                    } else if (i >= 1000000) {
                        i6 = i4 + 4520 + i3 + ((i2 - 1800) * 10) + (i - 1000001);
                    } else {
                        i5 = i3 + UIMsg.m_AppUI.MSG_RADAR_SEARCH_RETURN_RESULT;
                    }
                    return (pro5133.containsKey(Integer.valueOf(i6)) || (num = pro5133.get(Integer.valueOf(i6))) == null) ? i6 : num.intValue();
                }
                i5 = i3 + 18000;
                i2 *= 2;
                i6 = i5 + i2;
                if (pro5133.containsKey(Integer.valueOf(i6))) {
                    return i6;
                }
            }
            i7 = (i2 * 2) + 1;
        }
        i6 = (i7 - 280) + i8 + i3;
        if (pro5133.containsKey(Integer.valueOf(i6))) {
        }
    }

    public static int pro5109(String str, int i, String str2) {
        int i2 = 0;
        try {
            if (!pro5136(str)) {
                int[] iArr = new int[4];
                iArr[0] = pro5140(str) + 56666;
                String[] pro51092 = pro5109(str2, '.');
                iArr[1] = ((iArr[0] * (pro5140(pro51092[2]) + pro5140(pro51092[3]))) % 1000) + 33300;
                iArr[2] = (iArr[0] % 444) + 8500;
                iArr[3] = iArr[2] + 26;
                i2 = i < 2 ? iArr[i] + 79 : iArr[i];
            }
        } catch (Exception e) {
        }
        return i2;
    }

    public static pro5109 pro5109(String str) {
        pro5109 pro5109Var = new pro5109();
        try {
            JSONObject jSONObject = new JSONObject(str);
            if (!jSONObject.isNull("result")) {
                pro5109Var.pro5109 = jSONObject.getInt("result");
            }
            if (!jSONObject.isNull("uid")) {
                pro5109Var.pro5130 = jSONObject.getString("uid");
            }
            if (!jSONObject.isNull("start_ip")) {
                pro5109Var.pro5131 = jSONObject.getString("start_ip");
            }
            if (!jSONObject.isNull("conn_mode")) {
                pro5109Var.pro5132 = jSONObject.getInt("conn_mode");
            }
            if (!jSONObject.isNull("conn_num")) {
                pro5109Var.pro5133 = jSONObject.getInt("conn_num");
            }
            if (!jSONObject.isNull("conn_num2")) {
                pro5109Var.pro5134 = jSONObject.getString("conn_num2");
            }
            if (!jSONObject.isNull("mobile_mode")) {
                pro5109Var.pro5135 = jSONObject.getInt("mobile_mode");
            }
            if (!jSONObject.isNull("encrypt")) {
                pro5109Var.pro5136 = jSONObject.getInt("encrypt");
            }
            if (!jSONObject.isNull("start_port")) {
                pro5109Var.pro5137 = jSONObject.getInt("start_port");
            }
            if (!jSONObject.isNull("comm_port")) {
                pro5109Var.pro5138 = jSONObject.getInt("comm_port");
            }
            if (!jSONObject.isNull("add_port")) {
                pro5109Var.pro5139 = jSONObject.getInt("add_port");
            }
            if (!jSONObject.isNull("version")) {
                pro5109Var.pro5140 = jSONObject.getString("version");
            }
            if (!jSONObject.isNull("to_ip")) {
                pro5109Var.pro5141 = jSONObject.getString("to_ip");
            }
            if (!jSONObject.isNull(NotificationCompat.CATEGORY_MESSAGE)) {
                pro5109Var.pro5142 = jSONObject.getString(NotificationCompat.CATEGORY_MESSAGE);
            }
            if (!jSONObject.isNull("encrypt2")) {
                pro5109Var.pro5143 = jSONObject.getInt("encrypt2");
            }
            if (!jSONObject.isNull("start_port2")) {
                pro5109Var.pro5144 = jSONObject.getInt("start_port2");
            }
            if (!jSONObject.isNull("comm_port2")) {
                pro5109Var.pro5145 = jSONObject.getInt("comm_port2");
            }
            if (!jSONObject.isNull("add_port2")) {
                pro5109Var.pro5146 = jSONObject.getInt("add_port2");
            }
            if (!jSONObject.isNull("version2")) {
                pro5109Var.pro5147 = jSONObject.getString("version2");
            }
            if (!jSONObject.isNull("to_ip2")) {
                pro5109Var.pro5148 = jSONObject.getString("to_ip2");
            }
            if (!jSONObject.isNull("msg2")) {
                pro5109Var.pro5149 = jSONObject.getString("msg2");
            }
            if (!jSONObject.isNull("encrypt3")) {
                pro5109Var.pro5150 = jSONObject.getInt("encrypt3");
            }
            if (!jSONObject.isNull("start_port3")) {
                pro5109Var.pro5151 = jSONObject.getInt("start_port3");
            }
            if (!jSONObject.isNull("comm_port3")) {
                pro5109Var.pro5152 = jSONObject.getInt("comm_port3");
            }
            if (!jSONObject.isNull("add_port3")) {
                pro5109Var.pro5153 = jSONObject.getInt("add_port3");
            }
            if (!jSONObject.isNull("version3")) {
                pro5109Var.pro5154 = jSONObject.getString("version3");
            }
            if (!jSONObject.isNull("to_ip3")) {
                pro5109Var.pro5155 = jSONObject.getString("to_ip3");
            }
            if (!jSONObject.isNull("msg3")) {
                pro5109Var.pro5156 = jSONObject.getString("msg3");
            }
            if (!jSONObject.isNull("encrypt4")) {
                pro5109Var.pro5157 = jSONObject.getInt("encrypt4");
            }
            if (!jSONObject.isNull("start_port4")) {
                pro5109Var.pro5158 = jSONObject.getInt("start_port4");
            }
            if (!jSONObject.isNull("comm_port4")) {
                pro5109Var.pro5159 = jSONObject.getInt("comm_port4");
            }
            if (!jSONObject.isNull("add_port4")) {
                pro5109Var.pro5160 = jSONObject.getInt("add_port4");
            }
            if (!jSONObject.isNull("version4")) {
                pro5109Var.pro5161 = jSONObject.getString("version4");
            }
            if (!jSONObject.isNull("to_ip4")) {
                pro5109Var.pro5162 = jSONObject.getString("to_ip4");
            }
            if (!jSONObject.isNull("msg4")) {
                pro5109Var.pro5163 = jSONObject.getString("msg4");
            }
            if (!jSONObject.isNull("uniq_mode")) {
                pro5109Var.pro5164 = jSONObject.getInt("uniq_mode");
            }
            if (!jSONObject.isNull("band_str")) {
                pro5109Var.pro5173 = jSONObject.getInt("band_str");
            }
            if (!jSONObject.isNull("now_version")) {
                pro5109Var.pro5178 = jSONObject.getString("now_version");
            }
            if (!jSONObject.isNull(ImagesContract.URL)) {
                pro5109Var.pro5165 = jSONObject.getString(ImagesContract.URL);
            }
            if (!jSONObject.isNull("dnsGroup")) {
                pro5109Var.pro5174 = jSONObject.getString("dnsGroup");
            }
            if (!jSONObject.isNull("sniOpen")) {
                pro5109Var.pro5175 = jSONObject.getString("sniOpen");
            }
            if (!jSONObject.isNull("shortConnection")) {
                pro5109Var.pro5176 = jSONObject.getString("shortConnection");
            }
            if (!jSONObject.isNull("id1")) {
                pro5109Var.pro5166 = jSONObject.getInt("id1");
            }
            if (!jSONObject.isNull("id2")) {
                pro5109Var.pro5167 = jSONObject.getInt("id2");
            }
            if (!jSONObject.isNull("id3")) {
                pro5109Var.pro5168 = jSONObject.getInt("id3");
            }
            if (!jSONObject.isNull("id4")) {
                pro5109Var.pro5169 = jSONObject.getInt("id4");
            }
            if (!jSONObject.isNull("pack_mode")) {
                pro5109Var.pro5170 = jSONObject.getInt("pack_mode");
            }
            if (!jSONObject.isNull("pack_num")) {
                pro5109Var.pro5171 = jSONObject.getInt("pack_num");
            }
            if (!jSONObject.isNull("conn_num3")) {
                pro5109Var.pro5172 = jSONObject.getInt("conn_num3");
            }
            if (!jSONObject.isNull("useHighPort")) {
                pro5109Var.pro5179 = jSONObject.getString("useHighPort");
            }
        } catch (Exception e) {
        }
        return pro5109Var;
    }

    public static String pro5109() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 3; i++) {
            sb.append(pro5185[i]);
            sb.append('|');
        }
        return sb.toString();
    }

    public static String pro5109(pro5109 pro5109Var) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("result", pro5109Var.pro5109);
            jSONObject.put("uid", pro5109Var.pro5130 != null ? pro5109Var.pro5130 : JSONObject.NULL);
            jSONObject.put("start_ip", pro5109Var.pro5131 != null ? pro5109Var.pro5131 : JSONObject.NULL);
            jSONObject.put("conn_mode", pro5109Var.pro5132);
            jSONObject.put("conn_num", pro5109Var.pro5133);
            jSONObject.put("conn_num2", pro5109Var.pro5134 != null ? pro5109Var.pro5134 : JSONObject.NULL);
            jSONObject.put("mobile_mode", pro5109Var.pro5135);
            jSONObject.put("encrypt", pro5109Var.pro5136);
            jSONObject.put("start_port", pro5109Var.pro5137);
            jSONObject.put("comm_port", pro5109Var.pro5138);
            jSONObject.put("add_port", pro5109Var.pro5139);
            jSONObject.put("version", pro5109Var.pro5140 != null ? pro5109Var.pro5140 : JSONObject.NULL);
            jSONObject.put("to_ip", pro5109Var.pro5141 != null ? pro5109Var.pro5141 : JSONObject.NULL);
            jSONObject.put(NotificationCompat.CATEGORY_MESSAGE, pro5109Var.pro5142 != null ? pro5109Var.pro5142 : JSONObject.NULL);
            jSONObject.put("encrypt2", pro5109Var.pro5143);
            jSONObject.put("start_port2", pro5109Var.pro5144);
            jSONObject.put("comm_port2", pro5109Var.pro5145);
            jSONObject.put("add_port2", pro5109Var.pro5146);
            jSONObject.put("version2", pro5109Var.pro5147 != null ? pro5109Var.pro5147 : JSONObject.NULL);
            jSONObject.put("to_ip2", pro5109Var.pro5148 != null ? pro5109Var.pro5148 : JSONObject.NULL);
            jSONObject.put("msg2", pro5109Var.pro5149 != null ? pro5109Var.pro5149 : JSONObject.NULL);
            jSONObject.put("encrypt3", pro5109Var.pro5150);
            jSONObject.put("start_port3", pro5109Var.pro5151);
            jSONObject.put("comm_port3", pro5109Var.pro5152);
            jSONObject.put("add_port3", pro5109Var.pro5153);
            jSONObject.put("version3", pro5109Var.pro5154 != null ? pro5109Var.pro5154 : JSONObject.NULL);
            jSONObject.put("to_ip3", pro5109Var.pro5155 != null ? pro5109Var.pro5155 : JSONObject.NULL);
            jSONObject.put("msg3", pro5109Var.pro5156 != null ? pro5109Var.pro5156 : JSONObject.NULL);
            jSONObject.put("encrypt4", pro5109Var.pro5157);
            jSONObject.put("start_port4", pro5109Var.pro5158);
            jSONObject.put("comm_port4", pro5109Var.pro5159);
            jSONObject.put("add_port4", pro5109Var.pro5160);
            jSONObject.put("version4", pro5109Var.pro5161 != null ? pro5109Var.pro5161 : JSONObject.NULL);
            jSONObject.put("to_ip4", pro5109Var.pro5162 != null ? pro5109Var.pro5162 : JSONObject.NULL);
            jSONObject.put("msg4", pro5109Var.pro5163 != null ? pro5109Var.pro5163 : JSONObject.NULL);
            jSONObject.put("uniq_mode", pro5109Var.pro5164);
            jSONObject.put("band_str", pro5109Var.pro5173);
            jSONObject.put("now_version", pro5109Var.pro5178 != null ? pro5109Var.pro5178 : JSONObject.NULL);
            jSONObject.put(ImagesContract.URL, pro5109Var.pro5165 != null ? pro5109Var.pro5165 : JSONObject.NULL);
            jSONObject.put("dnsGroup", pro5109Var.pro5174 != null ? pro5109Var.pro5174 : JSONObject.NULL);
            jSONObject.put("sniOpen", pro5109Var.pro5175 != null ? pro5109Var.pro5175 : JSONObject.NULL);
            jSONObject.put("shortConnection", pro5109Var.pro5176 != null ? pro5109Var.pro5176 : JSONObject.NULL);
            jSONObject.put("id1", pro5109Var.pro5166);
            jSONObject.put("id2", pro5109Var.pro5167);
            jSONObject.put("id3", pro5109Var.pro5168);
            jSONObject.put("id4", pro5109Var.pro5169);
            jSONObject.put("pack_mode", pro5109Var.pro5170);
            jSONObject.put("pack_num", pro5109Var.pro5171);
            jSONObject.put("conn_num3", pro5109Var.pro5172);
            jSONObject.put("response", pro5109Var.pro5177 != null ? pro5109Var.pro5177 : JSONObject.NULL);
            jSONObject.put("useHighPort", pro5109Var.pro5179 != null ? pro5109Var.pro5179 : JSONObject.NULL);
            return jSONObject.toString();
        } catch (Exception e) {
            return "";
        }
    }

    public static String pro5109(String str, int i) {
        try {
            if (!pro5136(str)) {
                long parseLong = Long.parseLong(str);
                int i2 = (int) (parseLong % 25718923);
                int i3 = i2 % 98600;
                int[] iArr = {(int) (parseLong / 25718923), i2 / 98600, i3 / 364, i3 % 364};
                String[] pro51092 = pro5109(pro5241[i], ',');
                int[] iArr2 = new int[4];
                for (int i4 = 0; i4 < pro51092.length; i4++) {
                    iArr2[i4] = iArr[pro5140(pro51092[i4]) - 1];
                }
                String[] pro51093 = pro5109(pro5242[i], ',');
                for (int i5 = 0; i5 < pro51093.length; i5++) {
                    int pro51402 = iArr2[i5] - pro5140(pro51093[i5]);
                    if (pro51402 < 0) {
                        pro51402 += 256;
                    }
                    iArr2[i5] = pro51402;
                }
                StringBuilder sb = new StringBuilder();
                for (int i6 = 0; i6 < 4; i6++) {
                    sb.append(iArr2[i6]);
                    if (i6 < 3) {
                        sb.append('.');
                    }
                }
                return sb.toString();
            }
        } catch (Exception e) {
        }
        return "";
    }

    public static String pro5109(SocketChannel socketChannel) {
        Socket socket;
        InetAddress inetAddress;
        if (socketChannel == null || !socketChannel.isConnected() || (socket = socketChannel.socket()) == null || (inetAddress = socket.getInetAddress()) == null) {
            return null;
        }
        return inetAddress.getHostAddress();
    }

    public static Thread pro5109(Runnable runnable) {
        Thread thread = new Thread(runnable, "TestBusinessPort");
        thread.setDaemon(true);
        return thread;
    }

    public static Void pro5109(Throwable th) {
        Throwable cause = th.getCause();
        if (cause instanceof InterruptedException) {
            Thread.currentThread().interrupt();
        } else {
            if (!(cause instanceof SocketTimeoutException)) {
                pro5196++;
                pro5148();
            } else if (pro5193) {
                pro5199++;
            } else {
                pro5198 = PointerIconCompat.TYPE_ALIAS;
            }
            if (!pro5193) {
                pro5193 = true;
            }
            if (pro5136()) {
                pro5197 = pro5198 == 0;
                pro5157();
            }
        }
        String str = "Exception getDynamicIP: " + th.getMessage();
        pro5134.pro5131();
        return null;
    }

    public static CompletableFuture<Void> pro5109(final String str, final String str2, final String str3, final long j) {
        return CompletableFuture.supplyAsync(new Supplier() {
            @Override
            public final Object get() {
                return AppProtectManager.pro5109(str, j, str3, str2);
            }
        });
    }

    public static void pro5109(int i, int i2, String str) {
        StringBuilder sb;
        if (pro5214) {
            return;
        }
        pro5214 = true;
        if (i <= 5 || i != i2) {
            StringBuilder sb2 = new StringBuilder();
            sb2.append("本地端口已被占用,监听失败(");
            sb2.append(str);
            String str2 = ")";
            sb2.append(")");
            String sb3 = sb2.toString();
            int i3 = pro5206;
            if (i3 != 2) {
                if (i3 == 3) {
                    sb = new StringBuilder();
                    sb.append("Local port listening failed (Port number: ");
                    sb.append(str);
                    str2 = ")\nPlease avoid popular ports and consider using higher port numbers.";
                }
                pro5109("", sb3, false, 5000);
            }
            sb = new StringBuilder();
            sb.append("本地端口已被占用,監聽失敗(");
            sb.append(str);
            sb.append(str2);
            sb3 = sb.toString();
            pro5109("", sb3, false, 5000);
        }
    }

    public static void pro5109(int i, long j, AtomicReference atomicReference, AtomicReference atomicReference2, boolean z, int i2, String str, int i3, boolean z2, String str2, List list) {
        String str3 = str;
        try {
            if (i > 0) {
                try {
                    Thread.sleep(i * j);
                    if (((Boolean) atomicReference.get()).booleanValue() || atomicReference2.get() != null) {
                        if (atomicReference2.get() != null) {
                            Iterator it = list.iterator();
                            while (it.hasNext()) {
                                ((CompletableFuture) it.next()).cancel(true);
                            }
                            atomicReference.set(true);
                            return;
                        }
                        return;
                    }
                } catch (IOException e) {
                    if (atomicReference2.get() == null) {
                        return;
                    }
                    Iterator it2 = list.iterator();
                    while (it2.hasNext()) {
                        ((CompletableFuture) it2.next()).cancel(true);
                    }
                } catch (InterruptedException e2) {
                    Thread.currentThread().interrupt();
                    if (atomicReference2.get() == null) {
                        return;
                    }
                    Iterator it3 = list.iterator();
                    while (it3.hasNext()) {
                        ((CompletableFuture) it3.next()).cancel(true);
                    }
                }
            }
            if (z && pro5141 != null && pro5141.isDone()) {
                if (atomicReference2.get() != null) {
                    Iterator it4 = list.iterator();
                    while (it4.hasNext()) {
                        ((CompletableFuture) it4.next()).cancel(true);
                    }
                    atomicReference.set(true);
                    return;
                }
                return;
            }
            SocketChannel[] socketChannelArr = z ? pro5186 : pro5187;
            SocketChannel socketChannel = socketChannelArr[i2];
            if (z || socketChannel == null || !socketChannel.isConnected()) {
                socketChannelArr[i2] = null;
                socketChannel = SocketChannel.open();
                socketChannel.socket().connect(new InetSocketAddress(str3, i3), 8000);
                socketChannel.socket().setSoTimeout(2000);
                if (z2) {
                    String pro51342 = pro5134(pro5133.pro5130() + str3);
                    ByteBuffer wrap = ByteBuffer.wrap(pro5136.pro5109(pro51342.getBytes(pro5133.pro5109), (a.a.a.pro5109.pro5109() + LogUtils.VERTICAL + a.a.a.pro5109.pro5109(new Random().nextInt(10) + 11)).getBytes(pro5133.pro5109)));
                    while (wrap.hasRemaining()) {
                        socketChannel.write(wrap);
                    }
                    pro5109(i2, socketChannel, pro51342, z);
                }
                socketChannelArr[i2] = socketChannel;
            }
            if (socketChannelArr[i2] != null) {
                if (!((Boolean) atomicReference.get()).booleanValue() && atomicReference2.get() == null) {
                    String pro51092 = pro5109(socketChannel);
                    StringBuilder sb = new StringBuilder();
                    sb.append(pro5133.pro5131());
                    if (!pro5136(pro51092)) {
                        str3 = pro51092;
                    }
                    sb.append(str3);
                    String pro51343 = pro5134(sb.toString());
                    ByteBuffer wrap2 = ByteBuffer.wrap(a.a.a.pro5109.pro5130(str2, pro51343).getBytes(pro5133.pro5109));
                    while (wrap2.hasRemaining()) {
                        socketChannel.write(wrap2);
                    }
                    String str4 = "";
                    StringBuilder sb2 = new StringBuilder();
                    ByteBuffer allocate = ByteBuffer.allocate(16384);
                    while (true) {
                        try {
                            try {
                                int read = socketChannel.read(allocate);
                                if (read > 0) {
                                    allocate.flip();
                                    sb2.append((CharSequence) pro5133.pro5109.decode(allocate));
                                    allocate.clear();
                                    String pro51093 = a.a.a.pro5109.pro5109(sb2.toString(), pro51343);
                                    if (!pro5136(pro51093) && pro5135(pro51093)) {
                                        str4 = pro51093;
                                        break;
                                    }
                                } else if (read == -1) {
                                    break;
                                } else {
                                    Thread.sleep(100L);
                                }
                            } finally {
                                if (!pro5136("")) {
                                    atomicReference2.set(z ? pro5130("") : pro5109(""));
                                }
                            }
                        } catch (IOException e3) {
                            if (!pro5136("")) {
                                if (z) {
                                }
                            }
                        } catch (InterruptedException e4) {
                            Thread.currentThread().interrupt();
                            if (!pro5136("")) {
                                if (z) {
                                }
                            }
                        } catch (SocketTimeoutException e5) {
                            if (!pro5136("")) {
                                if (z) {
                                }
                            }
                        }
                    }
                }
                if (atomicReference2.get() != null) {
                    Iterator it5 = list.iterator();
                    while (it5.hasNext()) {
                        ((CompletableFuture) it5.next()).cancel(true);
                    }
                    atomicReference.set(true);
                    return;
                }
                return;
            }
            if (atomicReference2.get() != null) {
                Iterator it6 = list.iterator();
                while (it6.hasNext()) {
                    ((CompletableFuture) it6.next()).cancel(true);
                }
                atomicReference.set(true);
            }
        } catch (Throwable th) {
            if (atomicReference2.get() != null) {
                Iterator it7 = list.iterator();
                while (it7.hasNext()) {
                    ((CompletableFuture) it7.next()).cancel(true);
                }
                atomicReference.set(true);
            }
            throw th;
        }
    }

    public static void pro5109(final int i, final String str, final int i2, final String str2, final AtomicReference<pro5109> atomicReference, ExecutorService executorService, final boolean z, final boolean z2, boolean z3) {
        AtomicReference atomicReference2;
        Iterator it;
        int i3 = 0;
        AtomicReference atomicReference3 = new AtomicReference(false);
        final ArrayList arrayList = new ArrayList();
        final long j = z3 ? DefaultRenderersFactory.DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS : AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS;
        while (i3 < 3) {
            final int i4 = i3;
            final AtomicReference atomicReference4 = atomicReference3;
            arrayList.add(CompletableFuture.runAsync(new Runnable() {
                @Override
                public final void run() {
                    AppProtectManager.pro5109(i4, j, atomicReference4, atomicReference, z2, i, str, i2, z, str2, arrayList);
                }
            }, executorService));
            i3++;
            atomicReference3 = atomicReference3;
        }
        AtomicReference atomicReference5 = atomicReference3;
        try {
            long currentTimeMillis = System.currentTimeMillis();
            int i5 = z3 ? 12000 : 8000;
            while (System.currentTimeMillis() - currentTimeMillis < i5 && atomicReference.get() == null) {
                Thread.sleep(200L);
                if (Thread.currentThread().isInterrupted()) {
                    throw new InterruptedException();
                }
            }
            Iterator it2 = arrayList.iterator();
            while (it2.hasNext()) {
                ((CompletableFuture) it2.next()).cancel(true);
            }
            atomicReference5.set(true);
            if (!z || pro5215) {
                return;
            }
        } catch (InterruptedException e) {
            atomicReference2 = atomicReference5;
            try {
                Thread.currentThread().interrupt();
                Iterator it3 = arrayList.iterator();
                while (it3.hasNext()) {
                    ((CompletableFuture) it3.next()).cancel(true);
                }
                atomicReference2.set(true);
                if (!z || pro5215) {
                    return;
                }
            } catch (Throwable th) {
                th = th;
                it = arrayList.iterator();
                while (it.hasNext()) {
                    ((CompletableFuture) it.next()).cancel(true);
                }
                atomicReference2.set(true);
                if (z && !pro5215) {
                    pro5151();
                }
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
            atomicReference2 = atomicReference5;
            it = arrayList.iterator();
            while (it.hasNext()) {
            }
            atomicReference2.set(true);
            if (z) {
                pro5151();
            }
            throw th;
        }
        pro5151();
    }

    public static void pro5109(int i, SocketChannel socketChannel, String str, boolean z) {
        ByteBuffer allocate = ByteBuffer.allocate(16384);
        try {
            if (socketChannel.read(allocate) > 0) {
                allocate.flip();
                byte[] bArr = new byte[allocate.remaining()];
                allocate.get(bArr);
                byte[] bytes = str.getBytes(pro5133.pro5109);
                String replace = new String(pro5136.pro5109(bytes, bArr), pro5133.pro5109).replace("\u0000", "");
                if (!z && i < pro5225.length) {
                    int[] iArr = pro5225;
                    iArr[i] = iArr[i] + 10;
                }
                pro5215 = true;
                int nextInt = new Random().nextInt(10) + 11;
                StringBuilder sb = new StringBuilder();
                sb.append(0);
                sb.append(LogUtils.VERTICAL);
                StringBuilder sb2 = new StringBuilder();
                sb2.append(0);
                sb2.append(replace);
                sb2.append("-pZERyQYmz5mIYHWOxifKerOLYpR9tm0i");
                sb.append(pro5134(sb2.toString()));
                sb.append(LogUtils.VERTICAL);
                sb.append(a.a.a.pro5109.pro5109(nextInt));
                ByteBuffer wrap = ByteBuffer.wrap(pro5136.pro5109(bytes, sb.toString().getBytes(pro5133.pro5109)));
                while (wrap.hasRemaining()) {
                    socketChannel.write(wrap);
                }
                allocate.compact();
                Thread.sleep(3L);
            }
        } catch (Exception e) {
        }
    }

    public static void pro5109(long j) {
        Arrays.fill(pro5245, j);
        pro5246 = -1;
    }

    public static void pro5109(long j, long j2) {
        pro5168.set(j);
        pro5169.set(j2);
    }

    public static void pro5109(pro5137 pro5137Var, int i) {
        for (CompletableFuture<String> completableFuture : pro5137Var.pro5109) {
            if (!completableFuture.isCancelled()) {
                pro5134(completableFuture.join(), i);
            }
        }
    }

    public static void pro5109(pro5137 pro5137Var, CompletableFuture completableFuture, String str, Throwable th) {
        if (pro5136(str)) {
            return;
        }
        for (CompletableFuture<String> completableFuture2 : pro5137Var.pro5109) {
            if (completableFuture2 != completableFuture) {
                completableFuture2.cancel(true);
            }
        }
        pro5137Var.pro5130.complete(null);
    }

    public static void pro5109(DialogInterface dialogInterface, int i) {
        pro5158();
        Context context = pro5171;
        if (context instanceof Activity) {
            ((Activity) context).finishAffinity();
        }
    }

    public static void pro5109(final String str, final long j) {
        int i = pro5188.pro5109;
        if (i == 1088 || i == 1004 || i == 1005 || i == 1024) {
            return;
        }
        CompletableFuture.completedFuture(null).thenCompose(new Function() {
            @Override
            public <V> Function<T, V> andThen(Function<? super R, ? extends V> function) {
                return Function.CC.$default$andThen(this, function);
            }

            @Override
            public final Object apply(Object obj) {
                CompletionStage pro51092;
                pro51092 = AppProtectManager.pro5109(str, AppProtectManager.pro5162, AppProtectManager.pro5161, j);
                return pro51092;
            }

            @Override
            public <V> Function<V, R> compose(Function<? super V, ? extends T> function) {
                return Function.CC.$default$compose(this, function);
            }
        }).thenRun((Runnable) new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5145();
            }
        }).exceptionally((Function<Throwable, ? extends Void>) new Function() {
            @Override
            public <V> Function<T, V> andThen(Function<? super R, ? extends V> function) {
                return Function.CC.$default$andThen(this, function);
            }

            @Override
            public final Object apply(Object obj) {
                return AppProtectManager.pro5133((Throwable) obj);
            }

            @Override
            public <V> Function<V, R> compose(Function<? super V, ? extends T> function) {
                return Function.CC.$default$compose(this, function);
            }
        });
    }

    public static void pro5109(String str, final String str2, final boolean z, final int i) {
        Context context = pro5171;
        if (context instanceof Activity) {
            final Activity activity = (Activity) context;
            activity.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    AppProtectManager.pro5109(str2, z, activity, i);
                }
            });
        }
    }

    public static void pro5109(String str, boolean z, Activity activity, int i) {
        pro5253.removeCallbacksAndMessages(null);
        AlertDialog alertDialog = pro5252;
        if (alertDialog == null || !alertDialog.isShowing()) {
            AlertDialog.Builder builder = new AlertDialog.Builder(activity);
            builder.setMessage(str).setPositiveButton(z ? "关闭" : "确认", z ? pro5251 : null);
            AlertDialog create = builder.create();
            pro5252 = create;
            create.show();
        } else {
            pro5252.setMessage(str);
            pro5252.setButton(-1, z ? "关闭" : "确认", z ? pro5251 : null);
        }
        if (i > 0) {
            pro5253.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    AppProtectManager.pro5138();
                }
            }, i);
        }
    }

    public static void pro5109(CompletableFuture completableFuture, String str, Throwable th) {
        if (pro5136(str)) {
            return;
        }
        for (CompletableFuture<String> completableFuture2 : pro5148) {
            if (completableFuture2 != completableFuture) {
                completableFuture2.cancel(true);
            }
        }
        pro5142.complete(null);
    }

    public static void pro5109(boolean z) {
        pro5244.set(z);
        if (z && pro5170.get() == -1) {
            long currentTimeMillis = System.currentTimeMillis();
            pro5109(currentTimeMillis, DefaultRenderersFactory.DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS + currentTimeMillis);
        }
    }

    public static void pro5109(SocketChannel[] socketChannelArr, int i) {
        if (socketChannelArr[i] != null) {
            try {
                socketChannelArr[i].close();
            } catch (Exception e) {
            }
            socketChannelArr[i] = null;
        }
    }

    public static String[] pro5109(String str, char c) {
        int i = 1;
        for (int i2 = 0; i2 < str.length(); i2++) {
            if (str.charAt(i2) == c) {
                i++;
            }
        }
        String[] strArr = new String[i];
        int i3 = 0;
        int i4 = 0;
        for (int i5 = 0; i5 < str.length(); i5++) {
            if (str.charAt(i5) == c) {
                strArr[i4] = str.substring(i3, i5);
                i3 = i5 + 1;
                i4++;
            }
        }
        strArr[i4] = str.substring(i3);
        return strArr;
    }

    public static int pro5130(int i) {
        if (i < 0) {
            return 0;
        }
        int[] iArr = pro5181;
        if (i < iArr.length) {
            return iArr[i] + 5;
        }
        return 0;
    }

    public static String pro5130(String str, Map map, int i, String[] strArr) {
        int length = strArr.length;
        return "";
    }

    public static Thread pro5130(Runnable runnable) {
        Thread thread = new Thread(runnable);
        thread.setDaemon(true);
        return thread;
    }

    public static Void pro5130(Throwable th) {
        if (th.getCause() instanceof InterruptedException) {
            Thread.currentThread().interrupt();
        }
        String str = "Exception getLocalIP: " + th.getMessage();
        pro5134.pro5131();
        return null;
    }

    public static void pro5130() {
        ArrayList arrayList;
        ArrayList arrayList2;
        if (pro5188.pro5109 == 1088) {
            return;
        }
        synchronized (pro5135) {
            arrayList = new ArrayList(pro5135);
        }
        boolean z = false;
        for (int i = 0; i < arrayList.size(); i++) {
            if ((pro5188.pro5164 != 1 || i != 2) && (pro5188.pro5164 != 2 || (i != 2 && i != 3))) {
                Iterator it = ((Map) arrayList.get(i)).entrySet().iterator();
                while (it.hasNext()) {
                    pro5130 pro5130Var = (pro5130) ((Map.Entry) it.next()).getKey();
                    pro5136 pro51312 = pro5131(pro5130Var.pro5109, pro5130Var.pro5130);
                    if (pro51312 != null) {
                        int i2 = pro51312.pro5146.get();
                        if (pro51312.pro5152 && i2 > 0) {
                            long j = pro51312.pro5147.get();
                            try {
                                int pro51092 = pro51312.pro5109();
                                if (i2 == pro51312.pro5148.get() && pro51092 == pro51312.pro5150.get() && j < pro51312.pro5149.get()) {
                                    pro51312.pro5131();
                                    z = true;
                                }
                                pro51312.pro5148.set(i2);
                                pro51312.pro5150.set(pro51092);
                                pro51312.pro5149.set(System.currentTimeMillis());
                            } catch (Exception e) {
                            }
                        }
                    }
                    z = true;
                }
                if (z) {
                    break;
                }
            }
        }
        if (!z) {
            synchronized (pro5136) {
                arrayList2 = new ArrayList(pro5136);
            }
            for (int i3 = 0; i3 < arrayList2.size(); i3++) {
                Iterator it2 = ((Map) arrayList2.get(i3)).entrySet().iterator();
                while (true) {
                    if (!it2.hasNext()) {
                        break;
                    }
                    pro5130 pro5130Var2 = (pro5130) ((Map.Entry) it2.next()).getKey();
                    if (pro5132(pro5130Var2.pro5109, pro5130Var2.pro5130) == null) {
                        z = true;
                        break;
                    }
                }
                if (z) {
                    break;
                }
            }
        }
        if (z) {
            pro5153();
        }
        CompletableFuture<Void> completableFuture = pro5146.get();
        if (completableFuture == null || completableFuture.isDone()) {
            if (pro5134() > 0 || pro5244.get()) {
                pro5109(false);
            } else if (pro5164 != -1) {
            }
            pro5157();
        }
        if (System.currentTimeMillis() - pro5167 > 60000) {
            testActivity();
        }
    }

    public static void pro5130(String str, int i, String str2) {
        int i2;
        pro5130 pro5130Var;
        int i3;
        int i4;
        int i5;
        pro5227 = 500;
        pro5228.append(str);
        char c = '@';
        pro5228.append('@');
        pro5228.append(i);
        int i6 = pro5179[i];
        int i7 = pro5182[i];
        pro5227 = UIMsg.d_ResultType.VERSION_CHECK;
        pro5228.append('@');
        pro5228.append(i6);
        pro5228.append('@');
        pro5228.append(i7);
        char c2 = 0;
        char c3 = 1;
        boolean z = pro5180[i] == 1;
        pro5227 = UIMsg.d_ResultType.NEWVERSION_DOWNLOAD;
        pro5228.append('@');
        pro5228.append(z);
        if (str == null || str.isEmpty()) {
            return;
        }
        pro5227 = UIMsg.d_ResultType.CELLID_LOCATE_REQ;
        String[] pro51092 = pro5109(str, '|');
        int length = pro51092.length;
        int i8 = 0;
        while (i8 < length) {
            String str3 = pro51092[i8];
            pro5227 = UIMsg.d_ResultType.LOC_INFO_UPLOAD;
            pro5228.append(c);
            pro5228.append(str3);
            if (str3 == null || str3.isEmpty()) {
                i2 = i8;
            } else {
                String[] pro51093 = pro5109(str3, ',');
                pro5227 = 505;
                int parseInt = Integer.parseInt(pro51093[c2]);
                pro5227 = UIMsg.d_ResultType.SUGGESTION_SEARCH;
                pro5228.append(c);
                pro5228.append(parseInt);
                String pro51094 = pro5207 == 0 ? pro5109(pro5178, pro51093[c3]) : str2;
                pro5227 = 507;
                int parseInt2 = Integer.parseInt(pro51093[2]);
                pro5227 = UIMsg.d_ResultType.LONG_URL;
                pro5228.append(c);
                pro5228.append(parseInt2);
                i2 = i8;
                pro5130 pro5130Var2 = new pro5130(pro51094, parseInt2, 0, z, parseInt, 0);
                pro5227 = 509;
                pro5130Var2.pro5135 = pro5109(pro5178, pro51093[c3]);
                Map<Integer, Integer> map = pro5210;
                if (map == null || !map.containsKey(Integer.valueOf(parseInt2))) {
                    pro5130Var = null;
                } else {
                    pro5130Var = r14;
                    pro5130 pro5130Var3 = new pro5130(pro51094, pro5210.get(Integer.valueOf(parseInt2)).intValue(), 0, z, parseInt, 0);
                    pro5130Var.pro5135 = pro5130Var2.pro5135;
                }
                String str4 = pro5175[i];
                pro5227 = 510;
                int pro51095 = pro5109(str4, parseInt, i6, i7);
                int pro51096 = pro5109(parseInt, i6, i7);
                if (parseInt <= 10000 || parseInt >= 30000) {
                    if (parseInt <= 5000) {
                        pro5227 = 511;
                        pro5228.append(c);
                        pro5228.append(pro51095);
                        i4 = parseInt - 1;
                        pro5227 = 512;
                        pro5228.append(c);
                        pro5228.append(i4);
                    } else if (parseInt <= 10000) {
                        i4 = parseInt - 5001;
                    } else {
                        if (parseInt <= 100000 || parseInt > 105000) {
                            i3 = 105001;
                            if (parseInt <= 105001 || parseInt > 110000) {
                                if (parseInt >= 1000000) {
                                    i5 = 1;
                                    pro5227 = 513;
                                    pro5130 pro5130Var4 = new pro5130(str4, pro51095, i5, z, parseInt, pro51096);
                                    pro5227 = 514;
                                    synchronized (pro5135) {
                                        HashMap<pro5130, pro5130> hashMap = pro5135.get(i);
                                        hashMap.put(pro5130Var2, pro5130Var4);
                                        if (pro5130Var != null) {
                                            hashMap.put(pro5130Var, pro5130Var4);
                                        }
                                    }
                                    pro5227 = 515;
                                } else {
                                    i4 = parseInt - 30000;
                                }
                            }
                        } else {
                            i3 = 100001;
                        }
                        i4 = parseInt - i3;
                    }
                    i5 = i4;
                    pro5227 = 513;
                    pro5130 pro5130Var42 = new pro5130(str4, pro51095, i5, z, parseInt, pro51096);
                    pro5227 = 514;
                    synchronized (pro5135) {
                    }
                } else {
                    pro5130 pro5130Var5 = new pro5130(str4, pro51095, 0, false, parseInt, pro51096);
                    synchronized (pro5136) {
                        pro5136.get(i).put(pro5130Var2, pro5130Var5);
                    }
                }
            }
            i8 = i2 + 1;
            c = '@';
            c2 = 0;
            c3 = 1;
        }
    }

    public static boolean pro5130(String str, int i) {
        int i2 = pro5200;
        if (i2 == 1) {
            int pro51342 = pro5134();
            int i3 = pro5201;
            if (i3 == 0 || pro51342 < i3) {
                return true;
            }
        } else if (i2 == 2) {
            int pro51312 = pro5131(str);
            int i4 = pro5201;
            if (i4 == 0 || pro51312 < i4) {
                return true;
            }
        } else if (i2 == 3) {
            int i5 = pro5201;
            if (i5 == 0 || i < i5) {
                return true;
            }
        } else {
            if (i2 != 4) {
                return true;
            }
            int pro51313 = pro5131(str);
            int pro51332 = pro5133(str);
            if (pro51332 == 0 || pro51313 < pro51332) {
                return true;
            }
        }
        return false;
    }

    public static int pro5131(String str) {
        ArrayList arrayList;
        int i = 0;
        if (pro5136(str)) {
            return 0;
        }
        synchronized (pro5138) {
            arrayList = new ArrayList(pro5138);
        }
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            pro5136 pro5136Var = (pro5136) it.next();
            if (str.equals(pro5136Var.pro5156)) {
                i += pro5136Var.pro5109();
            }
        }
        return i;
    }

    public static pro5136 pro5131(String str, int i) {
        ArrayList arrayList;
        synchronized (pro5138) {
            arrayList = new ArrayList(pro5138);
        }
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            pro5136 pro5136Var = (pro5136) it.next();
            if (pro5136Var.pro5130 == i && str.equals(pro5136Var.pro5109)) {
                return pro5136Var;
            }
        }
        return null;
    }

    public static Void pro5131(Throwable th) {
        if (th.getCause() instanceof InterruptedException) {
            Thread.currentThread().interrupt();
        }
        String str = "Exception getTxtRecord: " + th.getMessage();
        pro5134.pro5131();
        return null;
    }

    public static void pro5131() {
        File file = new File(pro5160);
        if (pro5188.pro5109 == 1088 || ((file.exists() && !file.isDirectory()) || pro5213)) {
            int i = pro5188.pro5109;
            Future<?> future = pro5158;
            if (future != null) {
                future.cancel(true);
                pro5155.shutdownNow();
                return;
            }
            return;
        }
        if (!pro5189) {
            pro5158();
            return;
        }
        if (!pro5162()) {
            pro5130(1, 0, "本地文件不存在,间隔10秒");
        }
        pro5155();
    }

    public static int pro5132(String str) {
        int i = 0;
        while (true) {
            String[] strArr = pro5175;
            if (i >= strArr.length) {
                return 0;
            }
            if (str.equals(strArr[i])) {
                return pro5176[i];
            }
            i++;
        }
    }

    public static pro5138 pro5132(String str, int i) {
        ArrayList arrayList;
        synchronized (pro5139) {
            arrayList = new ArrayList(pro5139);
        }
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            pro5138 pro5138Var = (pro5138) it.next();
            if (pro5138Var.pro5130.getLocalPort() == i && str.equals(pro5138Var.pro5130.getLocalAddress().getHostAddress())) {
                return pro5138Var;
            }
        }
        return null;
    }

    public static Void pro5132(Throwable th) {
        String str = "Exception sendError: " + th.getMessage();
        pro5134.pro5131();
        return null;
    }

    public static void pro5132() {
        int i;
        synchronized (pro5135) {
            for (int i2 = 0; i2 < pro5135.size(); i2++) {
                pro5135.get(i2).clear();
            }
        }
        synchronized (pro5136) {
            for (i = 0; i < pro5136.size(); i++) {
                pro5136.get(i).clear();
            }
        }
    }

    public static void pro5132(final int i) {
        if (i != 1 && !pro5240 && pro5136(pro5163)) {
            pro5158();
            return;
        }
        String str = null;
        if (i >= 0 && i < 3) {
            str = pro5185[i];
        }
        if (pro5136(str)) {
            return;
        }
        String[] pro51092 = pro5109(str, ',');
        if (pro51092.length < 3) {
            return;
        }
        final String str2 = pro51092[0];
        String str3 = pro51092[1];
        String str4 = pro51092[2];
        final pro5137 pro5137Var = pro5184[i];
        Iterator<CompletableFuture<String>> it = pro5137Var.pro5109.iterator();
        while (it.hasNext()) {
            it.next().cancel(true);
        }
        pro5137Var.pro5109.clear();
        CompletableFuture<String> completableFuture = pro5137Var.pro5130;
        if (completableFuture != null) {
            completableFuture.cancel(true);
            pro5137Var.pro5131.shutdownNow();
        }
        pro5137Var.pro5131 = Executors.newCachedThreadPool();
        pro5137Var.pro5130 = new CompletableFuture<>();
        String[] strArr = {str3, str4};
        final int i2 = -1;
        for (int i3 = 0; i3 < 2; i3++) {
            final String str5 = strArr[i3];
            i2++;
            final CompletableFuture<String> supplyAsync = CompletableFuture.supplyAsync(new Supplier() {
                @Override
                public final Object get() {
                    return AppProtectManager.pro5109(str2, str5, i2, pro5137Var);
                }
            }, pro5137Var.pro5131);
            pro5137Var.pro5109.add(supplyAsync);
            supplyAsync.whenComplete(new BiConsumer() {
                @Override
                public final void accept(Object obj, Object obj2) {
                    AppProtectManager.pro5109(pro5137.this, supplyAsync, (String) obj, (Throwable) obj2);
                }

                @Override
                public BiConsumer<T, U> andThen(BiConsumer<? super T, ? super U> biConsumer) {
                    return BiConsumer.CC.$default$andThen(this, biConsumer);
                }
            });
        }
        pro5137Var.pro5130.thenRun(new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5109(pro5137.this, i);
            }
        }).exceptionally((Function<Throwable, ? extends Void>) new Function() {
            @Override
            public <V> Function<T, V> andThen(Function<? super R, ? extends V> function) {
                return Function.CC.$default$andThen(this, function);
            }

            @Override
            public final Object apply(Object obj) {
                return AppProtectManager.pro5131((Throwable) obj);
            }

            @Override
            public <V> Function<V, R> compose(Function<? super V, ? extends T> function) {
                return Function.CC.$default$compose(this, function);
            }
        });
    }

    public static int pro5133(String str) {
        if (pro5136(str)) {
            return 0;
        }
        try {
            int parseInt = Integer.parseInt(pro5109(str, '.')[r6.length - 1]) % 10;
            String[] pro51092 = pro5109(pro5202, '|');
            ArrayList arrayList = new ArrayList();
            for (String str2 : pro51092) {
                try {
                    arrayList.add(Integer.valueOf(Integer.parseInt(str2)));
                } catch (NumberFormatException e) {
                    return 0;
                }
            }
            if (parseInt < 0 || parseInt >= arrayList.size()) {
                return 0;
            }
            return ((Integer) arrayList.get(parseInt)).intValue();
        } catch (NumberFormatException e2) {
            return 0;
        }
    }

    public static Boolean pro5133(String str, int i) throws Exception {
        SocketChannel open = SocketChannel.open();
        boolean z = true;
        try {
            open.configureBlocking(true);
            open.socket().connect(new InetSocketAddress(str, i));
            open.socket().setSoTimeout(2000);
            byte[] bytes = pro5161.getBytes(pro5133.pro5109);
            ThreadLocalRandom current = ThreadLocalRandom.current();
            ByteBuffer wrap = ByteBuffer.wrap(pro5136.pro5109(bytes, (a.a.a.pro5109.pro5109() + LogUtils.VERTICAL + a.a.a.pro5109.pro5109(current.nextInt(10) + 11)).getBytes(pro5133.pro5109)));
            while (wrap.hasRemaining()) {
                open.write(wrap);
            }
            ByteBuffer allocate = ByteBuffer.allocate(16384);
            if (open.read(allocate) <= 0) {
                open.close();
                z = false;
            } else {
                allocate.flip();
                byte[] bArr = new byte[allocate.remaining()];
                allocate.get(bArr);
                String replace = new String(pro5136.pro5109(bytes, bArr), pro5133.pro5109).replace("\u0000", "");
                StringBuilder sb = new StringBuilder();
                sb.append(0);
                sb.append(LogUtils.VERTICAL);
                StringBuilder sb2 = new StringBuilder();
                sb2.append(0);
                sb2.append(replace);
                sb2.append("-pZERyQYmz5mIYHWOxifKerOLYpR9tm0i");
                sb.append(pro5134(sb2.toString()));
                sb.append(LogUtils.VERTICAL);
                sb.append(a.a.a.pro5109.pro5109(current.nextInt(10) + 11));
                ByteBuffer wrap2 = ByteBuffer.wrap(pro5136.pro5109(bytes, sb.toString().getBytes(pro5133.pro5109)));
                while (wrap2.hasRemaining()) {
                    open.write(wrap2);
                }
                open.close();
            }
            return Boolean.valueOf(z);
        } catch (Throwable th) {
            try {
                throw th;
            } catch (Throwable th2) {
                if (open != null) {
                    try {
                        open.close();
                    } catch (Throwable th3) {
                        th.addSuppressed(th3);
                    }
                }
                throw th2;
            }
        }
    }

    public static Void pro5133(Throwable th) {
        String str = "Exception syncStatus: " + th.getMessage();
        pro5134.pro5131();
        return null;
    }

    public static void pro5133() {
        pro5243.set(0L);
    }

    public static int pro5134() {
        ArrayList arrayList;
        synchronized (pro5138) {
            arrayList = new ArrayList(pro5138);
        }
        int i = 0;
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            i += ((pro5136) it.next()).pro5109();
        }
        return i;
    }

    public static String pro5134(String str) {
        if (str != null && !str.isEmpty()) {
            try {
                byte[] digest = MessageDigest.getInstance("MD5").digest(str.getBytes(pro5133.pro5109));
                StringBuilder sb = new StringBuilder();
                for (byte b : digest) {
                    sb.append(String.format("%02x", Byte.valueOf(b)));
                }
                return sb.toString();
            } catch (Exception e) {
            }
        }
        return "";
    }

    public static void pro5134(String str, int i) {
        int i2;
        String sb;
        boolean z;
        if (pro5136(str)) {
            return;
        }
        String pro51092 = a.a.a.pro5109.pro5109(str, pro5133.pro5109(i));
        if (pro5136(pro51092)) {
            return;
        }
        String[] pro51093 = pro5109(pro51092, '@');
        if (i == 1) {
            pro5240 = true;
        }
        if (i == 1 && pro51093.length > 2 && !pro5136(pro51093[2])) {
            String[] pro51094 = pro5109(pro51093[2], '|');
            int pro51402 = pro5140(pro5162.substring(1));
            if (pro51402 == 0) {
                sb = "0";
            } else {
                StringBuilder sb2 = new StringBuilder();
                while (pro51402 > 0) {
                    sb2.insert(0, "0123456789ABCDEFGHIJKLMNOPQRSTUV".charAt(pro51402 % 32));
                    pro51402 /= 32;
                }
                sb = sb2.toString();
            }
            int length = pro51094.length;
            int i3 = 0;
            while (true) {
                if (i3 >= length) {
                    z = false;
                    break;
                } else {
                    if (sb.equals(pro51094[i3])) {
                        pro5189 = true;
                        z = true;
                        break;
                    }
                    i3++;
                }
            }
            if (!z) {
                pro5158();
                return;
            }
        }
        String[] pro51095 = pro5109(pro51093[0], '|');
        if (pro51095.length >= 3) {
            if (i == 2) {
                i2 = new Random().nextInt(3);
            } else {
                String uniqueID = getUniqueID();
                if (!pro5136(uniqueID)) {
                    BigInteger bigInteger = new BigInteger(uniqueID, 16);
                    if (bigInteger.compareTo(BigInteger.ZERO) > 0) {
                        i2 = bigInteger.mod(BigInteger.valueOf(3)).intValue();
                    }
                }
                i2 = 0;
            }
            String[] pro51096 = pro5109(pro51095[i2], ',');
            if (pro51096.length == 2) {
                String pro51097 = pro5109(pro51096[0], i2);
                pro5239[i] = pro51097 + LogUtils.COLON + pro51096[1];
            }
        }
        if (i != 0 || pro51095.length <= 4) {
            return;
        }
        String[] pro51098 = pro5109(pro51095[3], ',');
        if (pro51098.length == 2) {
            pro5238 = "5," + pro5109(pro51098[0], 3) + LogUtils.COLON + (pro5140(pro51098[1]) + 8888) + ",0,0,2";
        }
    }

    public static int pro5135() {
        int i = 0;
        for (int i2 = 0; i2 < pro5135.size(); i2++) {
            i += pro5135.get(i2).size();
        }
        for (int i3 = 0; i3 < pro5136.size(); i3++) {
            i += pro5136.get(i3).size();
        }
        return i;
    }

    public static boolean pro5135(String str) {
        if (str == null || str.trim().isEmpty()) {
            return false;
        }
        String trim = str.trim();
        Stack stack = new Stack();
        for (int i = 0; i < trim.length(); i++) {
            char charAt = trim.charAt(i);
            if (charAt != '[') {
                if (charAt == ']') {
                    if (stack.isEmpty() || ((Character) stack.pop()).charValue() != '[') {
                        return false;
                    }
                } else if (charAt != '{') {
                    if (charAt == '}' && (stack.isEmpty() || ((Character) stack.pop()).charValue() != '{')) {
                        return false;
                    }
                }
            }
            stack.push(Character.valueOf(charAt));
        }
        return stack.isEmpty();
    }

    public static boolean pro5135(final String str, final int i) {
        ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() {
            @Override
            public final Thread newThread(Runnable runnable) {
                return AppProtectManager.pro5130(runnable);
            }
        });
        Future submit = newSingleThreadExecutor.submit(new Callable() {
            @Override
            public final Object call() {
                return AppProtectManager.pro5133(str, i);
            }
        });
        try {
            try {
                return ((Boolean) submit.get(3L, TimeUnit.SECONDS)).booleanValue();
            } finally {
                newSingleThreadExecutor.shutdownNow();
            }
        } catch (InterruptedException | ExecutionException | TimeoutException e) {
            submit.cancel(true);
            newSingleThreadExecutor.shutdownNow();
            return false;
        }
    }

    public static boolean pro5136() {
        for (String str : pro5175) {
            if (!pro5136(str) && (pro5137(str) || pro5138(str))) {
                return true;
            }
        }
        return false;
    }

    public static boolean pro5136(String str) {
        return str == null || str.isEmpty();
    }

    public static boolean pro5137() {
        CompletableFuture<Void> completableFuture = pro5146.get();
        return completableFuture == null || completableFuture.isCancelled();
    }

    public static boolean pro5137(String str) {
        String[] pro51092 = pro5109(str, '.');
        if (pro51092.length != 4) {
            return false;
        }
        try {
            for (String str2 : pro51092) {
                int parseInt = Integer.parseInt(str2);
                if (parseInt < 0 || parseInt > 255) {
                    return false;
                }
            }
            return true;
        } catch (NumberFormatException e) {
            return false;
        }
    }

    public static void pro5138() {
        AlertDialog alertDialog = pro5252;
        if (alertDialog == null || !alertDialog.isShowing()) {
            return;
        }
        pro5252.dismiss();
    }

    public static boolean pro5138(String str) {
        int parseInt;
        String[] pro51092 = pro5109(str, ':');
        if (pro51092.length >= 3 && pro51092.length <= 8) {
            try {
                for (String str2 : pro51092) {
                    if (!str2.isEmpty() && (str2.length() > 4 || (parseInt = Integer.parseInt(str2, 16)) < 0 || parseInt > 65535)) {
                        return false;
                    }
                }
                return true;
            } catch (NumberFormatException e) {
            }
        }
        return false;
    }

    public static Void pro5139() {
        String uniqueID = getUniqueID();
        HashMap hashMap = new HashMap();
        hashMap.put("device_uid", uniqueID);
        hashMap.put("instance_id", pro5162);
        hashMap.put("err_data", pro5227 + "|Android|(1910)|Main:" + pro5226 + "|Local:" + pro5132.pro5131().pro5109() + "|Debug:" + ((Object) pro5228));
        if (pro5213) {
            Future<?> future = pro5158;
            if (future != null) {
                future.cancel(true);
                pro5155.shutdownNow();
            }
            return null;
        }
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("https://api.gameshield.top/log_error.php").openConnection();
            httpURLConnection.setConnectTimeout(5000);
            httpURLConnection.setReadTimeout(5000);
            httpURLConnection.setRequestMethod("POST");
            httpURLConnection.setDoOutput(true);
            StringBuilder sb = new StringBuilder();
            for (Map.Entry entry : hashMap.entrySet()) {
                if (sb.length() != 0) {
                    sb.append(Typography.amp);
                }
                sb.append(URLEncoder.encode((String) entry.getKey(), "UTF-8"));
                sb.append('=');
                sb.append(URLEncoder.encode((String) entry.getValue(), "UTF-8"));
            }
            httpURLConnection.getOutputStream().write(sb.toString().getBytes(pro5133.pro5109));
            if (httpURLConnection.getResponseCode() == 200 && pro5109(new Scanner(httpURLConnection.getInputStream()).useDelimiter("\\A").next()).pro5109 == 200 && pro5158 != null) {
                pro5158.cancel(true);
                pro5155.shutdownNow();
            }
            httpURLConnection.disconnect();
            return null;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static void pro5139(String str) {
        StringBuilder sb;
        if (pro5214) {
            return;
        }
        pro5214 = true;
        String str2 = "本地端口已被占用,监听失败(" + str + ")";
        int i = pro5206;
        if (i != 2) {
            if (i == 3) {
                sb = new StringBuilder();
                sb.append("Local port listening failed (Port number: ");
                sb.append(str);
                sb.append(")\nPlease avoid popular ports and consider using higher port numbers.");
            }
            pro5109("", str2, false, 5000);
        }
        sb = new StringBuilder();
        sb.append("本地端口已被占用,監聽失敗(");
        sb.append(str);
        sb.append(")");
        str2 = sb.toString();
        pro5109("", str2, false, 5000);
    }

    public static int pro5140(String str) {
        try {
            return Integer.parseInt(str);
        } catch (NumberFormatException e) {
            return 0;
        }
    }

    public static String pro5140() {
        String str = "";
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("https://acs.m.taobao.com/gw/mtop.common.getTimestamp/").openConnection();
            httpURLConnection.setRequestMethod("GET");
            if (httpURLConnection.getResponseCode() == 200) {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
                StringBuilder sb = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    sb.append(readLine);
                }
                bufferedReader.close();
                try {
                    JSONObject jSONObject = new JSONObject(sb.toString());
                    if (!jSONObject.isNull("data")) {
                        JSONObject jSONObject2 = jSONObject.getJSONObject("data");
                        if (!jSONObject2.isNull("t")) {
                            String string = jSONObject2.getString("t");
                            try {
                                if (Math.abs(Long.parseLong(string) - System.currentTimeMillis()) > 7200000) {
                                    pro5109("", pro5206 == 2 ? "請校準本地時間" : pro5206 == 3 ? "Please check local time" : "请校准本地时间", false, 0);
                                } else {
                                    pro5215 = true;
                                }
                                str = string;
                            } catch (Exception e) {
                                str = string;
                            }
                        }
                    }
                } catch (Exception e2) {
                }
            }
            httpURLConnection.disconnect();
        } catch (Exception e3) {
        }
        return str;
    }

    public static void pro5141() {
    }

    public static void pro5141(String str) {
        if (pro5136(str) || str.length() < 20) {
            return;
        }
        for (String str2 : pro5109(str, '|')) {
            if (!pro5136(str2)) {
                if (str2.startsWith("1")) {
                    pro5234 = str2;
                } else if (str2.startsWith("2")) {
                    pro5235 = str2;
                } else if (str2.startsWith(ExifInterface.GPS_MEASUREMENT_3D)) {
                    pro5236 = str2;
                } else if (str2.startsWith("4")) {
                    pro5237 = str2;
                }
            }
        }
    }

    public static void pro5142() {
        for (CompletableFuture<String> completableFuture : pro5148) {
            if (!completableFuture.isCancelled()) {
                String join = completableFuture.join();
                if (!pro5136(join)) {
                    pro5163 = join;
                }
            }
        }
    }

    public static void pro5143() {
        pro5140.set(true);
        pro5173 = false;
        Selector selector = pro5137;
        if (selector != null) {
            try {
                selector.close();
            } catch (Exception e) {
                pro5134.pro5109("关闭选择器时出错: " + e.getMessage());
            }
        }
        synchronized (pro5138) {
            Iterator<pro5136> it = pro5138.iterator();
            while (it.hasNext()) {
                it.next().pro5131();
            }
        }
    }

    public static void pro5144() {
    }

    public static void pro5145() {
    }

    public static void pro5146() {
    }

    public static void pro5147() {
        int i;
        boolean z;
        boolean z2;
        int i2;
        Socket socket;
        int i3;
        String str;
        int i4;
        StringBuilder sb;
        String str2;
        int i5;
        int i6;
        String str3;
        int parseInt;
        int parseInt2;
        String str4;
        boolean z3;
        while (!Thread.currentThread().isInterrupted() && (i = pro5188.pro5109) != 1088 && i != 1004 && i != 1005 && i != 1024) {
            if (pro5197) {
                pro5197 = false;
                for (int i7 = 0; i7 < pro5194 * 60; i7++) {
                    try {
                        Thread.sleep(1000L);
                        if (Thread.currentThread().isInterrupted()) {
                            throw new InterruptedException();
                        }
                    } catch (InterruptedException e) {
                        Thread.currentThread().interrupt();
                        return;
                    }
                }
            }
            pro5164 = System.currentTimeMillis();
            boolean z4 = false;
            int i8 = 0;
            boolean z5 = false;
            while (true) {
                String[] strArr = pro5175;
                if (i8 >= strArr.length) {
                    z = false;
                    break;
                }
                String str5 = strArr[i8];
                if (z4) {
                    i2 = pro5109(str5, pro5130(i8), new Random().nextInt(2));
                    z2 = false;
                } else {
                    SocketChannel socketChannel = pro5187[i8];
                    int port = (socketChannel == null || !socketChannel.isConnected() || (socket = socketChannel.socket()) == null) ? 0 : socket.getPort();
                    if (port == 0) {
                        z2 = z4;
                        i2 = pro5109(str5, pro5130(i8), new Random().nextInt(2) + 2);
                    } else {
                        z2 = z4;
                        i2 = port;
                    }
                }
                int i9 = pro5183[i8];
                if (pro5136(str5) || i2 == 0) {
                    pro5225[i8] = 0;
                } else {
                    String format = String.format("{\"type\":\"check4\",\"username\":\"%s\",\"version_num\":\"%s\",\"device_uid\":\"%s\"}", pro5162, pro5177[i8], getUniqueID());
                    AtomicReference atomicReference = new AtomicReference(null);
                    int i10 = pro5225[i8];
                    String pro51092 = pro5109(pro5187[i8]);
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append(pro5133.pro5131());
                    if (pro5136(pro51092)) {
                        pro51092 = str5;
                    }
                    sb2.append(pro51092);
                    String pro51342 = pro5134(sb2.toString());
                    int i11 = i2;
                    pro5109(i8, str5, i2, format, atomicReference, pro5150, true, false, false);
                    pro5109 pro5109Var = (pro5109) atomicReference.get();
                    if (pro5109Var == null) {
                        pro5109(pro5187, i8);
                        i4 = 10;
                        pro5109(i8, str5, i11, format, atomicReference, pro5150, true, false, false);
                        pro5109Var = (pro5109) atomicReference.get();
                        if (pro5109Var != null) {
                            i3 = i11;
                            str = format;
                        } else if (i11 < 10000) {
                            pro5225[i8] = 0;
                            z4 = true;
                        } else {
                            if (pro5217) {
                                pro5109(pro5187, i8);
                            }
                            int i12 = pro5198;
                            if (i12 > 0) {
                                pro5198 = 0;
                                pro5131(i12);
                            }
                            int[] iArr = pro5225;
                            if (iArr[i8] >= 10) {
                                iArr[i8] = iArr[i8] % 10;
                                iArr[i8] = iArr[i8] + 1;
                                z3 = true;
                            } else {
                                iArr[i8] = iArr[i8] + 5;
                                z3 = false;
                            }
                            int i13 = pro5225[i8];
                            if (i13 > 3 && !pro5137()) {
                                pro5130(pro5222[i8] >= 10 ? 3 : 2, i8 + 1, pro5183[i8] + LogUtils.VERTICAL + pro5181[i8] + LogUtils.VERTICAL + i11 + "连接超时, json:" + format + "。本轮开始分数:" + i10 + "|本轮结束分数:" + i13 + "|本轮四次握手?" + z3 + "|KEY:" + pro51342);
                            }
                        }
                    } else {
                        i3 = i11;
                        str = format;
                        i4 = 10;
                    }
                    if (pro5217) {
                        pro5109(pro5187, i8);
                    }
                    pro5225[i8] = 0;
                    int i14 = pro5109Var.pro5109;
                    if (i14 == 201) {
                        if ("高带宽".equals(pro5109Var.pro5142)) {
                            if (!pro5137()) {
                                sb = new StringBuilder();
                                sb.append(i9);
                                sb.append(LogUtils.COLON);
                                sb.append(i3);
                                str2 = "高带宽, json:";
                                sb.append(str2);
                                sb.append(str);
                            }
                        } else if (!pro5137()) {
                            sb = new StringBuilder();
                            sb.append(i9);
                            sb.append(LogUtils.COLON);
                            sb.append(i3);
                            str2 = "规则不存在, json:";
                            sb.append(str2);
                            sb.append(str);
                        }
                    } else if (i14 == 202) {
                        if (!pro5136(pro5109Var.pro5165)) {
                            String pro51093 = a.a.a.pro5109.pro5109(pro5109Var.pro5165, pro5133.pro5132());
                            pro5237 = "";
                            pro5236 = "";
                            pro5235 = "";
                            pro5234 = "";
                            pro5141(pro5211);
                            pro5141(pro51093);
                        }
                        pro5177[i8] = pro5109Var.pro5178;
                        String[] pro51094 = pro5109(pro5109Var.pro5142, '@');
                        String str6 = pro51094[0];
                        int parseInt3 = Integer.parseInt(pro51094[1]);
                        pro5180[i8] = parseInt3;
                        if (pro51094.length > 3) {
                            i6 = 2;
                            pro5200 = Integer.parseInt(pro51094[2]);
                            pro5201 = Integer.parseInt(pro51094[3]);
                        } else {
                            i6 = 2;
                        }
                        if (pro51094.length > 4) {
                            pro5202 = pro51094[4];
                        }
                        if (pro51094.length > 5) {
                            int parseInt4 = Integer.parseInt(pro51094[5]);
                            int i15 = parseInt4 / 100;
                            int i16 = (parseInt4 - (i15 * 100)) / i4;
                            int i17 = parseInt4 % 10;
                            if (i15 <= 0 || !pro5136(pro5175[i6])) {
                                if (i16 <= 0 || !pro5136(pro5175[1])) {
                                    if (i17 > 0 && pro5136(pro5175[0])) {
                                        if (!pro5137()) {
                                            sb = new StringBuilder();
                                            sb.append(i9);
                                            sb.append(LogUtils.COLON);
                                            sb.append(i3);
                                            str4 = "大陆IP为空, openNum:";
                                        }
                                    }
                                } else if (!pro5137()) {
                                    sb = new StringBuilder();
                                    sb.append(i9);
                                    sb.append(LogUtils.COLON);
                                    sb.append(i3);
                                    str4 = "海外IP为空, openNum:";
                                }
                            } else if (!pro5137()) {
                                sb = new StringBuilder();
                                sb.append(i9);
                                sb.append(LogUtils.COLON);
                                sb.append(i3);
                                str4 = "大带宽IP为空, openNum:";
                            }
                        }
                        if (pro51094.length > 6) {
                            pro5207 = Integer.parseInt(pro51094[6]);
                        }
                        if (pro51094.length <= 8 || (parseInt4 = Integer.parseInt(pro51094[8])) <= 0 || !pro5136(pro5175[3])) {
                            if (pro51094.length > i4) {
                                pro5178 = pro51094[i4];
                            }
                            if (pro51094.length > 11 && !pro5136(pro51094[11]) && (parseInt2 = Integer.parseInt(pro51094[11])) >= 0) {
                                pro5182[i8] = parseInt2;
                            }
                            if (pro51094.length > 19 && !pro5136(pro51094[19])) {
                                pro5203 = Integer.parseInt(pro51094[19]);
                            }
                            if (pro51094.length > 20 && !pro5136(pro51094[20])) {
                                pro5204 = Integer.parseInt(pro51094[20]);
                            }
                            if (pro51094.length > 21 && !pro5136(pro51094[21])) {
                                pro5205 = Integer.parseInt(pro51094[21]);
                            }
                            if (pro51094.length > 22 && !pro5136(pro51094[22])) {
                                pro5185[0] = pro51094[22];
                            }
                            if (pro51094.length > 23 && !pro5136(pro51094[23])) {
                                pro5185[1] = pro51094[23];
                            }
                            if (pro51094.length > 24 && !pro5136(pro51094[24])) {
                                pro5185[i6] = pro51094[24];
                            }
                            if (pro51094.length > 26 && !pro5136(pro51094[26])) {
                                pro5216 = "1".equals(pro51094[26]);
                            }
                            if (pro51094.length > 27 && !pro5136(pro51094[27]) && (parseInt = Integer.parseInt(pro51094[27])) > 0) {
                                pro5179[i8] = parseInt;
                            }
                            if (pro51094.length > 28 && !pro5136(pro51094[28])) {
                                boolean equals = "1".equals(pro51094[28]);
                                pro5217 = equals;
                                if (equals) {
                                    pro5109(pro5187, i8);
                                }
                            }
                            synchronized (pro5135) {
                                pro5135.get(i8).clear();
                            }
                            synchronized (pro5136) {
                                pro5136.get(i8).clear();
                            }
                            pro5130(str6, i8, "127.0.0.1");
                            if (pro5207 != 0 && i8 == 0) {
                                int i18 = pro5188.pro5164;
                                if (i18 == 1) {
                                    str3 = "127.0.0.2";
                                } else if (i18 == i6) {
                                    pro5130(str6, 0, "127.0.0.2");
                                    str3 = "127.0.0.3";
                                }
                                pro5130(str6, 0, str3);
                            }
                            String str7 = pro5109Var.pro5178;
                            String str8 = pro5109Var.pro5165;
                            int i19 = pro5179[i8];
                            String str9 = pro5178;
                            int i20 = pro5182[i8];
                            pro5109 pro5109Var2 = pro5188;
                            pro5109Var2.pro5165 = str8;
                            pro5109Var2.pro5174 = pro5109();
                            pro5188.pro5175 = pro5216 ? "1" : "0";
                            pro5188.pro5176 = pro5217 ? "1" : "0";
                            pro5109 pro5109Var3 = pro5188;
                            pro5109Var3.pro5131 = str9;
                            pro5109Var3.pro5132 = pro5200;
                            pro5109Var3.pro5133 = pro5201;
                            pro5109Var3.pro5134 = pro5202;
                            pro5109Var3.pro5170 = pro5203;
                            pro5109Var3.pro5171 = pro5204;
                            pro5109Var3.pro5172 = pro5205;
                            pro5109Var3.pro5135 = pro5207;
                            if (i8 == 0) {
                                pro5109Var3.pro5137 = i19;
                                pro5109Var3.pro5139 = i20;
                                pro5109Var3.pro5140 = str7;
                                pro5109Var3.pro5142 = a.a.a.pro5109.pro5130(str6, pro5161);
                                pro5188.pro5136 = parseInt3;
                            } else if (i8 == 1) {
                                pro5109Var3.pro5144 = i19;
                                pro5109Var3.pro5146 = i20;
                                pro5109Var3.pro5147 = str7;
                                pro5109Var3.pro5149 = a.a.a.pro5109.pro5130(str6, pro5161);
                                pro5188.pro5143 = parseInt3;
                            } else if (i8 == i6) {
                                pro5109Var3.pro5151 = i19;
                                pro5109Var3.pro5153 = i20;
                                pro5109Var3.pro5154 = str7;
                                pro5109Var3.pro5156 = a.a.a.pro5109.pro5130(str6, pro5161);
                                pro5188.pro5150 = parseInt3;
                            } else {
                                if (i8 == 3) {
                                    pro5109Var3.pro5158 = i19;
                                    pro5109Var3.pro5160 = i20;
                                    pro5109Var3.pro5161 = str7;
                                    pro5109Var3.pro5163 = a.a.a.pro5109.pro5130(str6, pro5161);
                                    pro5188.pro5157 = parseInt3;
                                }
                                z5 = true;
                                int[] iArr2 = pro5176;
                                iArr2[i8] = 0;
                                i5 = pro5109Var.pro5109;
                                if (i5 == 200) {
                                    iArr2[i8] = pro5109Var.pro5173;
                                    pro5223 = i5;
                                    pro5224 = "";
                                }
                            }
                            String str10 = pro5188.pro5130;
                            if (str10 != null && str10.equals(getUniqueID())) {
                                pro5109 pro5109Var4 = pro5188;
                                if (pro5109Var4.pro5109 == 200) {
                                    pro5109Var4.pro5179 = pro5134 ? "High" : "Low";
                                    pro5132.pro5131().pro5109("10910", pro5109(pro5188));
                                }
                            }
                            z5 = true;
                            int[] iArr22 = pro5176;
                            iArr22[i8] = 0;
                            i5 = pro5109Var.pro5109;
                            if (i5 == 200) {
                            }
                        } else if (!pro5137()) {
                            sb = new StringBuilder();
                            sb.append(i9);
                            sb.append(LogUtils.COLON);
                            sb.append(i3);
                            str4 = "大陆转发IP为空, openNum:";
                        }
                    } else {
                        if (i14 == 208 || i14 == 209) {
                            pro5223 = pro5109Var.pro5109;
                            pro5224 = pro5109Var.pro5142;
                        } else if (i14 != 200) {
                            int i21 = pro5198;
                            if (i21 > 0) {
                                pro5198 = 0;
                                pro5131(i21);
                            }
                            if (!pro5137()) {
                                pro5130(1, i8 + 1, i9 + LogUtils.COLON + i3 + "返回值:" + pro5109Var.pro5109 + ", json:" + str);
                            }
                        }
                        int[] iArr222 = pro5176;
                        iArr222[i8] = 0;
                        i5 = pro5109Var.pro5109;
                        if (i5 == 200) {
                        }
                    }
                }
                i8++;
                z4 = z2;
            }
            z = true;
            if (z5) {
                pro5153();
            }
            if (pro5198 > 0) {
                pro5198 = 0;
                String str11 = pro5188.pro5130;
                if (str11 != null && str11.equals(getUniqueID())) {
                    pro5109 pro5109Var5 = pro5188;
                    if (pro5109Var5.pro5109 == 200) {
                        pro5109Var5.pro5179 = pro5134 ? "High" : "Low";
                        pro5132.pro5131().pro5109("10910", pro5109(pro5188));
                    }
                }
            }
            if (z) {
                return;
            }
            if (!z5 && pro5138.isEmpty() && pro5139.isEmpty()) {
                if (pro5135() == 0) {
                    if (pro5137()) {
                        return;
                    }
                    pro5130(1, 0, "无转发信息,实例:" + pro5162);
                    return;
                }
                pro5153();
            }
            if (pro5134() <= 0 && !pro5244.get()) {
                return;
            }
            pro5109(false);
            for (int i22 = 0; i22 < pro5194 * 60; i22++) {
                Thread.sleep(1000L);
                if (Thread.currentThread().isInterrupted()) {
                    throw new InterruptedException();
                }
            }
        }
    }

    public static void pro5148() {
        int i = pro5196;
        if (i >= 10) {
            pro5194 = 5;
        } else {
            pro5194 = i >= 5 ? 3 : 1;
        }
    }

    public static CompletableFuture<Void> pro5149() {
        return CompletableFuture.supplyAsync(new Supplier() {
            @Override
            public final Object get() {
                return AppProtectManager.pro5139();
            }
        });
    }

    public static void pro5150() {
        Future<?> future = pro5157;
        if (future != null) {
            future.cancel(true);
            pro5154.shutdownNow();
        }
        ScheduledExecutorService newSingleThreadScheduledExecutor = Executors.newSingleThreadScheduledExecutor();
        pro5154 = newSingleThreadScheduledExecutor;
        pro5157 = newSingleThreadScheduledExecutor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5130();
            }
        }, 0L, 15L, TimeUnit.SECONDS);
    }

    public static void pro5151() {
        CompletableFuture<String> completableFuture = pro5149;
        if (completableFuture != null) {
            completableFuture.cancel(true);
            pro5153.shutdownNow();
        }
        pro5153 = Executors.newCachedThreadPool();
        pro5149 = CompletableFuture.supplyAsync(new Supplier() {
            @Override
            public final Object get() {
                return AppProtectManager.pro5140();
            }
        }, pro5153);
    }

    public static void pro5152() {
        Iterator<CompletableFuture<String>> it = pro5148.iterator();
        while (it.hasNext()) {
            it.next().cancel(true);
        }
        pro5148.clear();
        CompletableFuture<Void> completableFuture = pro5142;
        if (completableFuture != null) {
            completableFuture.cancel(true);
            pro5152.shutdownNow();
        }
        pro5152 = Executors.newCachedThreadPool();
        pro5142 = new CompletableFuture<>();
        final String[] strArr = pro5233;
        final int i = -1;
        for (final String str : strArr) {
            i++;
            final CompletableFuture<String> supplyAsync = CompletableFuture.supplyAsync(new Supplier() {
                @Override
                public final Object get() {
                    return AppProtectManager.pro5109(str, i, strArr);
                }
            }, pro5152);
            pro5148.add(supplyAsync);
            supplyAsync.whenComplete(new BiConsumer() {
                @Override
                public final void accept(Object obj, Object obj2) {
                    AppProtectManager.pro5109(CompletableFuture.this, (String) obj, (Throwable) obj2);
                }

                @Override
                public BiConsumer<T, U> andThen(BiConsumer<? super T, ? super U> biConsumer) {
                    return BiConsumer.CC.$default$andThen(this, biConsumer);
                }
            });
        }
        pro5142.thenRun((Runnable) new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5142();
            }
        }).exceptionally((Function<Throwable, ? extends Void>) new Function() {
            @Override
            public <V> Function<T, V> andThen(Function<? super R, ? extends V> function) {
                return Function.CC.$default$andThen(this, function);
            }

            @Override
            public final Object apply(Object obj) {
                return AppProtectManager.pro5130((Throwable) obj);
            }

            @Override
            public <V> Function<V, R> compose(Function<? super V, ? extends T> function) {
                return Function.CC.$default$compose(this, function);
            }
        });
    }

    public static void pro5153() {
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        Iterator it;
        int i;
        ArrayList arrayList5;
        ArrayList arrayList6;
        StringBuilder sb;
        pro5138 pro5138Var;
        String str;
        ArrayList arrayList7;
        ArrayList arrayList8;
        ArrayList arrayList9;
        int i2;
        int i3;
        int i4;
        int i5;
        pro5136 pro51312;
        ArrayList arrayList10;
        ArrayList arrayList11;
        ArrayList arrayList12;
        pro5130 pro5130Var;
        pro5130 pro5130Var2;
        String str2;
        pro5136 pro5136Var;
        if (pro5188.pro5109 == 1088) {
            pro5227 = 218;
            return;
        }
        pro5227 = 217;
        try {
            arrayList = new ArrayList();
            arrayList2 = new ArrayList();
            if (pro5137 == null) {
                pro5137 = Selector.open();
            }
            pro5227 = 214;
            synchronized (pro5138) {
                arrayList3 = new ArrayList(pro5138);
            }
            synchronized (pro5135) {
                arrayList4 = new ArrayList(pro5135);
            }
            it = arrayList3.iterator();
        } catch (Exception e) {
            pro5134.pro5109("Networking initialization error: " + e.getMessage());
            return;
        }
        while (true) {
            i = 1;
            if (!it.hasNext()) {
                break;
            }
            pro5136 pro5136Var2 = (pro5136) it.next();
            boolean z = false;
            for (int i6 = 0; i6 < arrayList4.size(); i6++) {
                try {
                    Iterator it2 = ((Map) arrayList4.get(i6)).entrySet().iterator();
                    while (true) {
                        if (!it2.hasNext()) {
                            break;
                        }
                        pro5130 pro5130Var3 = (pro5130) ((Map.Entry) it2.next()).getKey();
                        if (pro5136Var2.pro5130 == pro5130Var3.pro5130 && pro5130Var3.pro5109.equals(pro5136Var2.pro5109)) {
                            z = true;
                            break;
                        }
                    }
                    if (z) {
                        break;
                    }
                } catch (Exception e2) {
                    pro5134.pro5109("Listener stop error: " + e2.getMessage());
                }
            }
            pro5136Var2.pro5152 = z;
            if (!z && pro5136Var2.pro5109() == 0) {
                pro5136Var2.pro5131();
            }
            pro5134.pro5109("Networking initialization error: " + e.getMessage());
            return;
        }
        pro5227 = 213;
        int i7 = 0;
        while (true) {
            char c = 3;
            int i8 = 2;
            if (i7 >= arrayList4.size()) {
                break;
            }
            if ((pro5188.pro5164 == i && i7 == 2) || (pro5188.pro5164 == 2 && (i7 == 2 || i7 == 3))) {
                arrayList7 = arrayList;
                arrayList8 = arrayList2;
                arrayList9 = arrayList4;
            } else {
                String str3 = "";
                if (i7 == 0) {
                    if (pro5188.pro5164 == i) {
                        str = pro5175[2];
                    } else if (pro5188.pro5164 == 2) {
                        str = pro5175[2];
                        str3 = pro5175[3];
                    }
                    String str4 = str;
                    for (Map.Entry entry : ((Map) arrayList4.get(i7)).entrySet()) {
                        pro5130 pro5130Var4 = (pro5130) entry.getKey();
                        pro5130 pro5130Var5 = (pro5130) entry.getValue();
                        if (i7 == 0) {
                            if (pro5188.pro5164 == i) {
                                i2 = pro5109(str4, pro5130Var5.pro5133, pro5179[i8], pro5182[i8]);
                                i4 = pro5109(pro5130Var5.pro5133, pro5179[i8], pro5182[i8]);
                                i3 = 0;
                                i5 = 0;
                            } else if (pro5188.pro5164 == i8) {
                                int pro51092 = pro5109(str4, pro5130Var5.pro5133, pro5179[i8], pro5182[i8]);
                                int pro51093 = pro5109(pro5130Var5.pro5133, pro5179[i8], pro5182[i8]);
                                int pro51094 = pro5109(str3, pro5130Var5.pro5133, pro5179[c], pro5182[c]);
                                i5 = pro5109(pro5130Var5.pro5133, pro5179[c], pro5182[c]);
                                i2 = pro51092;
                                i4 = pro51093;
                                i3 = pro51094;
                            }
                            pro51312 = pro5131(pro5130Var4.pro5109, pro5130Var4.pro5130);
                            if (pro51312 == null) {
                                arrayList12 = arrayList4;
                                pro5130Var = pro5130Var5;
                                arrayList11 = arrayList2;
                                pro5130Var2 = pro5130Var4;
                                str2 = str4;
                                arrayList10 = arrayList;
                                pro5136Var = pro51312;
                                pro51312.pro5109(pro5130Var5.pro5109, pro5130Var5.pro5130, i7, pro5130Var5.pro5132, pro5130Var5.pro5134, pro5130Var4.pro5135, str2, i2, str3, i3, pro5130Var5.pro5131, i4, i5, pro5134);
                                ServerSocketChannel serverSocketChannel = pro5136Var.pro5145;
                                if (serverSocketChannel != null && serverSocketChannel.isOpen()) {
                                    arrayList4 = arrayList12;
                                    arrayList2 = arrayList11;
                                    str4 = str2;
                                    arrayList = arrayList10;
                                    i = 1;
                                    i8 = 2;
                                    c = 3;
                                }
                            } else {
                                arrayList10 = arrayList;
                                arrayList11 = arrayList2;
                                arrayList12 = arrayList4;
                                pro5130Var = pro5130Var5;
                                pro5130Var2 = pro5130Var4;
                                str2 = str4;
                                pro5136Var = new pro5136();
                            }
                            String str5 = pro5130Var2.pro5109;
                            int i9 = pro5130Var2.pro5130;
                            String str6 = pro5130Var.pro5109;
                            int i10 = pro5130Var.pro5130;
                            int i11 = pro5130Var.pro5132;
                            boolean z2 = pro5130Var.pro5134;
                            String str7 = pro5130Var2.pro5135;
                            int i12 = pro5130Var.pro5131;
                            boolean z3 = pro5134;
                            pro5136Var.pro5109 = str5;
                            pro5136Var.pro5130 = i9;
                            pro5136Var.pro5109(str6, i10, i7, i11, z2, str7, str2, i2, str3, i3, i12, i4, i5, z3);
                            synchronized (pro5172) {
                                pro5172.add(pro5136Var);
                            }
                            arrayList4 = arrayList12;
                            arrayList2 = arrayList11;
                            str4 = str2;
                            arrayList = arrayList10;
                            i = 1;
                            i8 = 2;
                            c = 3;
                        }
                        i2 = 0;
                        i3 = 0;
                        i4 = 0;
                        i5 = 0;
                        pro51312 = pro5131(pro5130Var4.pro5109, pro5130Var4.pro5130);
                        if (pro51312 == null) {
                        }
                        String str52 = pro5130Var2.pro5109;
                        int i92 = pro5130Var2.pro5130;
                        String str62 = pro5130Var.pro5109;
                        int i102 = pro5130Var.pro5130;
                        int i112 = pro5130Var.pro5132;
                        boolean z22 = pro5130Var.pro5134;
                        String str72 = pro5130Var2.pro5135;
                        int i122 = pro5130Var.pro5131;
                        boolean z32 = pro5134;
                        pro5136Var.pro5109 = str52;
                        pro5136Var.pro5130 = i92;
                        pro5136Var.pro5109(str62, i102, i7, i112, z22, str72, str2, i2, str3, i3, i122, i4, i5, z32);
                        synchronized (pro5172) {
                        }
                    }
                    arrayList7 = arrayList;
                    arrayList8 = arrayList2;
                    arrayList9 = arrayList4;
                }
                str = "";
                String str42 = str;
                while (r22.hasNext()) {
                }
                arrayList7 = arrayList;
                arrayList8 = arrayList2;
                arrayList9 = arrayList4;
            }
            i7++;
            arrayList4 = arrayList9;
            arrayList2 = arrayList8;
            arrayList = arrayList7;
            i = 1;
        }
        ArrayList arrayList13 = arrayList;
        final ArrayList arrayList14 = arrayList2;
        pro5227 = 212;
        synchronized (pro5136) {
            try {
                arrayList5 = new ArrayList(pro5136);
            } catch (Throwable th) {
                throw th;
            }
        }
        for (int i13 = 0; i13 < arrayList5.size(); i13++) {
            for (Map.Entry entry2 : ((Map) arrayList5.get(i13)).entrySet()) {
                pro5130 pro5130Var6 = (pro5130) entry2.getKey();
                pro5130 pro5130Var7 = (pro5130) entry2.getValue();
                pro5138 pro51322 = pro5132(pro5130Var6.pro5109, pro5130Var6.pro5130);
                if (pro51322 != null) {
                    try {
                        pro51322.pro5132 = new InetSocketAddress(pro5130Var7.pro5109, pro5130Var7.pro5130);
                    } catch (Exception e3) {
                    }
                } else {
                    try {
                        pro5138Var = new pro5138(pro5130Var6.pro5109, pro5130Var6.pro5130, pro5130Var7.pro5109, pro5130Var7.pro5130);
                    } catch (Exception e4) {
                        e = e4;
                    }
                    try {
                        pro5138Var.pro5109();
                        synchronized (pro5139) {
                            pro5139.add(pro5138Var);
                        }
                    } catch (Exception e5) {
                        e = e5;
                        pro51322 = pro5138Var;
                        if (pro51322 != null) {
                            pro51322.pro5132();
                        }
                        if (!(e instanceof BindException)) {
                            arrayList6 = arrayList13;
                            if (pro51322 != null) {
                                String str8 = "监听端口(" + pro51322.pro5130.getLocalPort() + ")失败,错误码:2012";
                                if (pro5206 == 2) {
                                    sb = new StringBuilder();
                                    sb.append("監聽端口(");
                                    sb.append(pro51322.pro5130.getLocalPort());
                                    sb.append(")失敗,錯誤碼:2012");
                                } else {
                                    if (pro5206 == 3) {
                                        sb = new StringBuilder();
                                        sb.append("Failed to start, failed to listen to the local port(");
                                        sb.append(pro51322.pro5130.getLocalPort());
                                        sb.append("), error code 2012");
                                    }
                                    pro5109("", str8, false, 0);
                                    arrayList13 = arrayList6;
                                }
                                str8 = sb.toString();
                                pro5109("", str8, false, 0);
                                arrayList13 = arrayList6;
                            }
                        } else if (!pro5214 && "1".equals(pro5212)) {
                            int i14 = pro5130Var6.pro5130;
                            arrayList6 = arrayList13;
                            if (!arrayList6.contains(Integer.valueOf(i14))) {
                                arrayList6.add(Integer.valueOf(i14));
                            }
                            StringBuilder sb2 = new StringBuilder();
                            int min = Math.min(arrayList6.size(), 5);
                            for (int i15 = 0; i15 < min; i15++) {
                                sb2.append(arrayList6.get(i15));
                                if (i15 < min - 1) {
                                    sb2.append(',');
                                }
                            }
                            if (arrayList6.size() > 5) {
                                sb2.append("...");
                            }
                            final String sb3 = sb2.toString();
                            pro5131.pro5109(AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS, new Runnable() {
                                @Override
                                public final void run() {
                                    AppProtectManager.pro5139(sb3);
                                }
                            });
                        }
                        arrayList13 = arrayList6;
                    }
                }
            }
        }
        if (!pro5172.isEmpty()) {
            pro5137.wakeup();
        }
        pro5227 = 211;
        if (!pro5173) {
            pro5173 = true;
            new Thread(new Runnable() {
                @Override
                public final void run() {
                    AppProtectManager.pro5109(arrayList14);
                }
            }, "Selector-Thread").start();
        }
        if (!pro5174) {
            pro5174 = true;
            Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
                @Override
                public final void run() {
                    AppProtectManager.pro5143();
                }
            }));
        }
        pro5213 = true;
        pro5134.pro5109();
        pro5227 = ItemTouchHelper.Callback.DEFAULT_DRAG_ANIMATION_DURATION;
    }

    public static void pro5154() {
        Future<?> future = pro5158;
        if (future != null) {
            future.cancel(true);
            pro5155.shutdownNow();
        }
        ScheduledExecutorService newSingleThreadScheduledExecutor = Executors.newSingleThreadScheduledExecutor();
        pro5155 = newSingleThreadScheduledExecutor;
        pro5158 = newSingleThreadScheduledExecutor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5131();
            }
        }, 15L, 10L, TimeUnit.SECONDS);
    }

    public static void pro5155() {
        String str;
        if (pro5136(pro5226) || pro5213) {
            return;
        }
        pro5109 pro5109Var = pro5188;
        if (pro5109Var.pro5109 != 200) {
            return;
        }
        if (pro5227 != 200) {
            pro5109Var.pro5109 = PointerIconCompat.TYPE_WAIT;
            String str2 = "开启监听失败(" + pro5227 + ")";
            int i = pro5206;
            if (i == 2) {
                str2 = "開啟監聽失敗(" + pro5227 + ")";
                str = "監聽出錯";
            } else if (i == 3) {
                str2 = "Local listener failed to start (" + pro5227 + SQLBuilder.PARENTHESES_RIGHT;
                str = "Call Error";
            } else {
                str = "监听出错";
            }
            pro5109(str, str2, true, 0);
        }
        CompletableFuture<Void> completableFuture = pro5143;
        if (completableFuture != null) {
            completableFuture.cancel(true);
        }
        pro5143 = pro5149().thenRun((Runnable) new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5144();
            }
        }).exceptionally((Function<Throwable, ? extends Void>) new Function() {
            @Override
            public <V> Function<T, V> andThen(Function<? super R, ? extends V> function) {
                return Function.CC.$default$andThen(this, function);
            }

            @Override
            public final Object apply(Object obj) {
                return AppProtectManager.pro5132((Throwable) obj);
            }

            @Override
            public <V> Function<V, R> compose(Function<? super V, ? extends T> function) {
                return Function.CC.$default$compose(this, function);
            }
        });
    }

    public static void pro5156() {
        Future<?> future = pro5159;
        if (future != null) {
            future.cancel(true);
            pro5156.shutdownNow();
        }
        pro5109(-1L);
        ScheduledExecutorService newSingleThreadScheduledExecutor = Executors.newSingleThreadScheduledExecutor();
        pro5156 = newSingleThreadScheduledExecutor;
        pro5159 = newSingleThreadScheduledExecutor.scheduleWithFixedDelay(new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5159();
            }
        }, 0L, 1L, TimeUnit.SECONDS);
    }

    public static void pro5157() {
        CompletableFuture<Void> andSet = pro5146.getAndSet(null);
        if (andSet != null) {
            andSet.cancel(true);
        }
        ExecutorService executorService = pro5150;
        if (executorService != null) {
            executorService.shutdownNow();
        }
        pro5150 = Executors.newFixedThreadPool(25);
        CompletableFuture<Void> pro51612 = pro5161();
        pro5146.set(pro51612);
        pro51612.thenRunAsync((Runnable) new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5146();
            }
        }, (Executor) pro5150);
    }

    public static void pro5158() {
        pro5133();
        pro5170.set(-1L);
        pro5109(-1L, -1L);
        pro5109("close", pro5170.get());
        int i = 0;
        while (true) {
            SocketChannel[] socketChannelArr = pro5186;
            if (i >= socketChannelArr.length) {
                break;
            }
            pro5109(socketChannelArr, i);
            i++;
        }
        int i2 = 0;
        while (true) {
            SocketChannel[] socketChannelArr2 = pro5187;
            if (i2 >= socketChannelArr2.length) {
                break;
            }
            pro5109(socketChannelArr2, i2);
            i2++;
        }
        pro5140.set(true);
        pro5173 = false;
        Selector selector = pro5137;
        if (selector != null) {
            try {
                selector.close();
            } catch (Exception e) {
                pro5134.pro5109("关闭选择器时出错: " + e.getMessage());
            }
        }
        Iterator<pro5136> it = pro5138.iterator();
        while (it.hasNext()) {
            it.next().pro5131();
        }
        pro5138.clear();
        Iterator<pro5138> it2 = pro5139.iterator();
        while (it2.hasNext()) {
            it2.next().pro5132();
        }
        pro5139.clear();
        pro5132();
        pro5134.pro5132();
        Iterator<CompletableFuture<String>> it3 = pro5148.iterator();
        while (it3.hasNext()) {
            it3.next().cancel(true);
        }
        pro5148.clear();
        CompletableFuture<Void> completableFuture = pro5142;
        if (completableFuture != null) {
            completableFuture.cancel(true);
            pro5152.shutdownNow();
        }
        for (int i3 = 0; i3 < 3; i3++) {
            pro5137 pro5137Var = pro5184[i3];
            Iterator<CompletableFuture<String>> it4 = pro5137Var.pro5109.iterator();
            while (it4.hasNext()) {
                it4.next().cancel(true);
            }
            pro5137Var.pro5109.clear();
            CompletableFuture<String> completableFuture2 = pro5137Var.pro5130;
            if (completableFuture2 != null) {
                completableFuture2.cancel(true);
                pro5137Var.pro5131.shutdownNow();
            }
        }
        Iterator<CompletableFuture<String>> it5 = pro5147.iterator();
        while (it5.hasNext()) {
            it5.next().cancel(true);
        }
        pro5147.clear();
        CompletableFuture<Void> completableFuture3 = pro5141;
        if (completableFuture3 != null) {
            completableFuture3.cancel(true);
            pro5151.shutdownNow();
        }
        CompletableFuture<Void> andSet = pro5146.getAndSet(null);
        if (andSet != null) {
            andSet.cancel(true);
        }
        ExecutorService executorService = pro5150;
        if (executorService != null) {
            executorService.shutdownNow();
        }
        Future<?> future = pro5159;
        if (future != null) {
            future.cancel(true);
            pro5156.shutdownNow();
        }
        pro5109(-1L);
        Future<?> future2 = pro5157;
        if (future2 != null) {
            future2.cancel(true);
            pro5154.shutdownNow();
        }
        Future<?> future3 = pro5158;
        if (future3 != null) {
            future3.cancel(true);
            pro5155.shutdownNow();
        }
        CompletableFuture<Void> completableFuture4 = pro5143;
        if (completableFuture4 != null) {
            completableFuture4.cancel(true);
        }
        CompletableFuture<String> completableFuture5 = pro5149;
        if (completableFuture5 != null) {
            completableFuture5.cancel(true);
            pro5153.shutdownNow();
        }
        Future<?> andSet2 = pro5249.getAndSet(null);
        if (andSet2 != null) {
            andSet2.cancel(true);
        }
        ExecutorService executorService2 = pro5250;
        if (executorService2 != null) {
            executorService2.shutdownNow();
            try {
                if (executorService2.awaitTermination(2L, TimeUnit.SECONDS)) {
                    return;
                }
                executorService2.shutdownNow();
            } catch (InterruptedException e2) {
                executorService2.shutdownNow();
            }
        }
    }

    public static void pro5159() {
        long j;
        int i;
        boolean z;
        long j2 = pro5169.get();
        long j3 = pro5170.get();
        if (System.currentTimeMillis() < j2) {
            return;
        }
        if (pro5134() == 0) {
            if (j3 != -1) {
                pro5133();
                pro5170.set(-1L);
                pro5109(-1L, -1L);
                pro5109("disconnect", j3);
                return;
            }
            return;
        }
        long j4 = pro5168.get();
        long j5 = j2 - j4;
        if (j4 != -1) {
            long j6 = j5 / 1000;
            if (j6 > 0) {
                j = (long) Math.ceil(pro5243.get() / j6);
                pro5133();
                long currentTimeMillis = System.currentTimeMillis();
                pro5109(currentTimeMillis, 15000 + currentTimeMillis);
                if (j3 != -1 && j5 == DefaultRenderersFactory.DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS) {
                    pro5109("connect", j);
                    return;
                }
                i = pro5246 + 1;
                pro5246 = i;
                if (i < 0) {
                    pro5246 = 0;
                }
                int i2 = pro5246;
                long[] jArr = pro5245;
                int length = i2 % jArr.length;
                pro5246 = length;
                z = length != 0 && jArr[length] == -1;
                long[] jArr2 = pro5245;
                int i3 = pro5246;
                jArr2[i3] = j;
                if (!z) {
                    if (j3 > j) {
                        j = (j3 * (new Random().nextInt(11) + 95)) / 100;
                    }
                    pro5109("sysn", j);
                    return;
                }
                if (i3 == jArr2.length - 1 || (j3 != -1 && j > j3 * 3)) {
                    long j7 = 0;
                    for (long j8 : pro5245) {
                        if (j8 > j7) {
                            j7 = j8;
                        }
                    }
                    long j9 = 0;
                    int i4 = 0;
                    for (long j10 : pro5245) {
                        if (j10 > 0) {
                            j9 += j10;
                            i4++;
                        }
                    }
                    long j11 = i4 > 0 ? j9 / i4 : 0L;
                    if (j7 > j11 * 2) {
                        j7 = (j7 + j11) / 2;
                    }
                    pro5109("sysn", j7);
                    return;
                }
                return;
            }
        }
        j = 0;
        pro5133();
        long currentTimeMillis2 = System.currentTimeMillis();
        pro5109(currentTimeMillis2, 15000 + currentTimeMillis2);
        if (j3 != -1) {
        }
        i = pro5246 + 1;
        pro5246 = i;
        if (i < 0) {
        }
        int i22 = pro5246;
        long[] jArr3 = pro5245;
        int length2 = i22 % jArr3.length;
        pro5246 = length2;
        if (length2 != 0) {
        }
        long[] jArr22 = pro5245;
        int i32 = pro5246;
        jArr22[i32] = j;
        if (!z) {
        }
    }

    public static void pro5160() {
        ArrayList arrayList;
        String str;
        Iterator it;
        int i;
        int i2;
        String str2;
        boolean z;
        try {
            if (!Thread.currentThread().isInterrupted() && pro5188.pro5109 != 1088 && pro5188.pro5109 != 1004 && pro5188.pro5109 != 1005 && pro5188.pro5109 != 1024) {
                synchronized (pro5135) {
                    arrayList = new ArrayList(pro5135);
                }
                if (arrayList.isEmpty()) {
                    return;
                }
                pro5167 = System.currentTimeMillis();
                HashSet hashSet = new HashSet();
                int i3 = 0;
                boolean z2 = false;
                while (i3 < arrayList.size()) {
                    if (Thread.currentThread().isInterrupted()) {
                        return;
                    }
                    if (pro5188.pro5164 != 1 || i3 != 2) {
                        char c = 3;
                        if (pro5188.pro5164 != 2 || (i3 != 2 && i3 != 3)) {
                            String str3 = "";
                            if (i3 == 0) {
                                if (pro5188.pro5164 == 1) {
                                    str = pro5175[2];
                                } else if (pro5188.pro5164 == 2) {
                                    str = pro5175[2];
                                    str3 = pro5175[3];
                                }
                                it = ((Map) arrayList.get(i3)).entrySet().iterator();
                                while (true) {
                                    if (it.hasNext()) {
                                        break;
                                    }
                                    Map.Entry entry = (Map.Entry) it.next();
                                    if (Thread.currentThread().isInterrupted()) {
                                        return;
                                    }
                                    pro5130 pro5130Var = (pro5130) entry.getValue();
                                    if (i3 == 0) {
                                        if (pro5188.pro5164 == 1) {
                                            i = pro5109(str, pro5130Var.pro5133, pro5179[2], pro5182[2]);
                                            i2 = 0;
                                        } else if (pro5188.pro5164 == 2) {
                                            i = pro5109(str, pro5130Var.pro5133, pro5179[2], pro5182[2]);
                                            i2 = pro5109(str3, pro5130Var.pro5133, pro5179[c], pro5182[c]);
                                        }
                                        str2 = pro5130Var.pro5109;
                                        int i4 = pro5130Var.pro5130;
                                        if (!pro5136(str2) || i4 <= 0) {
                                            z = false;
                                        } else {
                                            StringBuilder sb = new StringBuilder();
                                            sb.append(str2);
                                            sb.append(LogUtils.COLON);
                                            sb.append(i4);
                                            z = hashSet.add(sb.toString()) ? pro5135(str2, i4) : true;
                                        }
                                        if (!z && !pro5136(str) && i > 0) {
                                            StringBuilder sb2 = new StringBuilder();
                                            sb2.append(str);
                                            sb2.append(LogUtils.COLON);
                                            sb2.append(i);
                                            z = !hashSet.add(sb2.toString()) ? pro5135(str, i) : true;
                                        }
                                        if (!z && !pro5136(str3) && i2 > 0) {
                                            StringBuilder sb3 = new StringBuilder();
                                            sb3.append(str3);
                                            sb3.append(LogUtils.COLON);
                                            sb3.append(i2);
                                            z = !hashSet.add(sb3.toString()) ? pro5135(str3, i2) : true;
                                        }
                                        if (z) {
                                            z2 = true;
                                            break;
                                        }
                                        c = 3;
                                    }
                                    i = 0;
                                    i2 = 0;
                                    str2 = pro5130Var.pro5109;
                                    int i42 = pro5130Var.pro5130;
                                    if (pro5136(str2)) {
                                    }
                                    z = false;
                                    if (!z) {
                                        StringBuilder sb22 = new StringBuilder();
                                        sb22.append(str);
                                        sb22.append(LogUtils.COLON);
                                        sb22.append(i);
                                        if (!hashSet.add(sb22.toString())) {
                                        }
                                    }
                                    if (!z) {
                                        StringBuilder sb32 = new StringBuilder();
                                        sb32.append(str3);
                                        sb32.append(LogUtils.COLON);
                                        sb32.append(i2);
                                        if (!hashSet.add(sb32.toString())) {
                                        }
                                    }
                                    if (z) {
                                    }
                                }
                            }
                            str = "";
                            it = ((Map) arrayList.get(i3)).entrySet().iterator();
                            while (true) {
                                if (it.hasNext()) {
                                }
                                c = 3;
                            }
                        }
                    }
                    i3++;
                }
                if (z2) {
                    pro5130(2, 0, (i3 + 1) + "组测活不通");
                }
            }
        } catch (Exception e) {
        }
    }

    public static CompletableFuture<Void> pro5161() {
        return CompletableFuture.runAsync(new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5147();
            }
        }, pro5150);
    }

    public static boolean pro5162() {
        boolean z;
        String str = pro5190;
        if (pro5136(str)) {
            return false;
        }
        String[] pro51092 = pro5109(str, ',');
        String str2 = pro51092[new Random().nextInt(pro51092.length)];
        if (pro5136(str2)) {
            return false;
        }
        String pro51093 = a.a.a.pro5109.pro5109(str2, pro5134(pro5161));
        pro5109 pro5109Var = new pro5109();
        try {
            JSONObject jSONObject = new JSONObject(pro51093);
            if (!jSONObject.isNull("a")) {
                pro5109Var.pro5109 = jSONObject.getInt("a");
            }
            if (!jSONObject.isNull("r")) {
                pro5109Var.pro5130 = jSONObject.getString("r");
            }
            if (!jSONObject.isNull("d")) {
                pro5109Var.pro5131 = jSONObject.getString("d");
            }
            if (!jSONObject.isNull("s")) {
                pro5109Var.pro5132 = jSONObject.getInt("s");
            }
            if (!jSONObject.isNull("t")) {
                pro5109Var.pro5133 = jSONObject.getInt("t");
            }
            if (!jSONObject.isNull("u")) {
                pro5109Var.pro5134 = jSONObject.getString("u");
            }
            if (!jSONObject.isNull("v")) {
                pro5109Var.pro5135 = jSONObject.getInt("v");
            }
            if (!jSONObject.isNull("c")) {
                pro5109Var.pro5136 = jSONObject.getInt("c");
            }
            if (!jSONObject.isNull("f")) {
                pro5109Var.pro5137 = jSONObject.getInt("f");
            }
            if (!jSONObject.isNull("bb")) {
                pro5109Var.pro5138 = jSONObject.getInt("bb");
            }
            if (!jSONObject.isNull("mm")) {
                pro5109Var.pro5139 = jSONObject.getInt("mm");
            }
            if (!jSONObject.isNull(ImageLoader.AUTOPLAY_FILTER)) {
                pro5109Var.pro5140 = jSONObject.getString(ImageLoader.AUTOPLAY_FILTER);
            }
            if (!jSONObject.isNull("b")) {
                pro5109Var.pro5141 = a.a.a.pro5109.pro5130(jSONObject.getString("b"), pro5161);
            }
            if (!jSONObject.isNull("e")) {
                pro5109Var.pro5142 = a.a.a.pro5109.pro5130(jSONObject.getString("e"), pro5161);
            }
            if (!jSONObject.isNull("i")) {
                pro5109Var.pro5143 = jSONObject.getInt("i");
            }
            if (!jSONObject.isNull("j")) {
                pro5109Var.pro5144 = jSONObject.getInt("j");
            }
            if (!jSONObject.isNull("cc")) {
                pro5109Var.pro5145 = jSONObject.getInt("cc");
            }
            if (!jSONObject.isNull("nn")) {
                pro5109Var.pro5146 = jSONObject.getInt("nn");
            }
            if (!jSONObject.isNull("l")) {
                pro5109Var.pro5147 = jSONObject.getString("l");
            }
            if (!jSONObject.isNull("h")) {
                pro5109Var.pro5148 = a.a.a.pro5109.pro5130(jSONObject.getString("h"), pro5161);
            }
            if (!jSONObject.isNull("k")) {
                pro5109Var.pro5149 = a.a.a.pro5109.pro5130(jSONObject.getString("k"), pro5161);
            }
            if (!jSONObject.isNull("n")) {
                pro5109Var.pro5150 = jSONObject.getInt("n");
            }
            if (!jSONObject.isNull("o")) {
                pro5109Var.pro5151 = jSONObject.getInt("o");
            }
            if (!jSONObject.isNull("dd")) {
                pro5109Var.pro5152 = jSONObject.getInt("dd");
            }
            if (!jSONObject.isNull("oo")) {
                pro5109Var.pro5153 = jSONObject.getInt("oo");
            }
            if (!jSONObject.isNull("q")) {
                pro5109Var.pro5154 = jSONObject.getString("q");
            }
            if (!jSONObject.isNull("m")) {
                pro5109Var.pro5155 = a.a.a.pro5109.pro5130(jSONObject.getString("m"), pro5161);
            }
            if (!jSONObject.isNull(TtmlNode.TAG_P)) {
                pro5109Var.pro5156 = a.a.a.pro5109.pro5130(jSONObject.getString(TtmlNode.TAG_P), pro5161);
            }
            if (!jSONObject.isNull("ll")) {
                pro5109Var.pro5157 = jSONObject.getInt("ll");
            }
            if (!jSONObject.isNull("y")) {
                pro5109Var.pro5158 = jSONObject.getInt("y");
            }
            if (!jSONObject.isNull("ee")) {
                pro5109Var.pro5159 = jSONObject.getInt("ee");
            }
            if (!jSONObject.isNull("pp")) {
                pro5109Var.pro5160 = jSONObject.getInt("pp");
            }
            if (!jSONObject.isNull("x")) {
                pro5109Var.pro5161 = jSONObject.getString("x");
            }
            if (!jSONObject.isNull("z")) {
                pro5109Var.pro5162 = a.a.a.pro5109.pro5130(jSONObject.getString("z"), pro5161);
            }
            if (!jSONObject.isNull("aa")) {
                pro5109Var.pro5163 = a.a.a.pro5109.pro5130(jSONObject.getString("aa"), pro5161);
            }
            if (!jSONObject.isNull("ff")) {
                pro5109Var.pro5164 = jSONObject.getInt("ff");
            }
            if (!jSONObject.isNull("gg")) {
                pro5109Var.pro5165 = a.a.a.pro5109.pro5130(jSONObject.getString("gg"), pro5133.pro5132());
            }
            if (!jSONObject.isNull("hh")) {
                pro5109Var.pro5166 = jSONObject.getInt("hh");
            }
            if (!jSONObject.isNull("ii")) {
                pro5109Var.pro5167 = jSONObject.getInt("ii");
            }
            if (!jSONObject.isNull("jj")) {
                pro5109Var.pro5168 = jSONObject.getInt("jj");
            }
            if (!jSONObject.isNull("kk")) {
                pro5109Var.pro5169 = jSONObject.getInt("kk");
            }
            if (!jSONObject.isNull("qq")) {
                pro5109Var.pro5170 = jSONObject.getInt("qq");
            }
            if (!jSONObject.isNull("rr")) {
                pro5109Var.pro5171 = jSONObject.getInt("rr");
            }
            if (!jSONObject.isNull(DownloadAction.TYPE_SS)) {
                pro5109Var.pro5172 = jSONObject.getInt(DownloadAction.TYPE_SS);
            }
        } catch (Exception e) {
        }
        if (pro5136(pro5109Var.pro5130)) {
            pro5109Var.pro5130 = getUniqueID();
        }
        if (pro5109(pro5109(pro5109Var), pro5161, true, true)) {
            pro5192 = true;
            pro5199 = 0;
            pro5196 = 0;
            pro5148();
            pro5153();
            z = true;
        } else {
            z = false;
        }
        if (!pro5193) {
            pro5193 = true;
        }
        if (pro5136()) {
            pro5197 = pro5198 == 0;
            pro5157();
        }
        return z;
    }

    public static boolean reassignIP() {
        CompletableFuture<Void> completableFuture = pro5141;
        if (completableFuture != null && !completableFuture.isDone()) {
            return false;
        }
        long currentTimeMillis = System.currentTimeMillis() - pro5145;
        int i = pro5144;
        if (i > 0 && ((i != 1 || currentTimeMillis <= 10800000) && (pro5144 != 2 || currentTimeMillis <= 21600000))) {
            return false;
        }
        pro5144++;
        pro5145 = System.currentTimeMillis();
        String str = pro5188.pro5130;
        if (str != null && str.equals(getUniqueID())) {
            pro5109 pro5109Var = pro5188;
            if (pro5109Var.pro5109 == 200) {
                pro5109Var.pro5180 = pro5144;
                pro5109Var.pro5181 = pro5145;
                pro5132.pro5131().pro5109("10910", pro5109(pro5109Var));
            }
        }
        pro5130(1, 0, "用户主动请求调度");
        return true;
    }

    public static int testActivity() {
        CompletableFuture<Void> completableFuture = pro5141;
        if (completableFuture != null && !completableFuture.isDone()) {
            return 10;
        }
        long currentTimeMillis = OkHttpUtils.DEFAULT_MILLISECONDS - (System.currentTimeMillis() - pro5167);
        if (currentTimeMillis > 0) {
            return (int) Math.ceil(currentTimeMillis / 1000.0d);
        }
        Future<?> future = pro5249.get();
        if (future != null && !future.isDone()) {
            return 0;
        }
        if (pro5250 == null || pro5250.isShutdown()) {
            pro5250 = Executors.newSingleThreadExecutor(new ThreadFactory() {
                @Override
                public final Thread newThread(Runnable runnable) {
                    return AppProtectManager.pro5109(runnable);
                }
            });
        }
        pro5249.set(pro5250.submit(new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5160();
            }
        }));
        return 0;
    }

    public static String pro5109(int i, String str) {
        String str2 = (i == 1 || i == 2) ? pro5235 : i == 3 ? pro5237 : i == 4 ? pro5238 : pro5234;
        if (pro5136(str2)) {
            return "";
        }
        String[] pro51092 = pro5109(str2, ',');
        if (pro51092.length < 5) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        sb.append(("0".equals(pro51092[4]) || "1".equals(pro51092[4])) ? "https://" : "http://");
        sb.append(pro51092[1]);
        String sb2 = sb.toString();
        String str3 = pro51092[2];
        String str4 = pro51092[3];
        String str5 = "vercode=" + a.a.a.pro5109.pro5109(new Random().nextInt(32) + 1) + "&url_id=" + (i + 1);
        if ("1".equals(str3)) {
            StringBuilder sb3 = new StringBuilder();
            String l = Long.toString(a.a.a.pro5109.pro5109());
            sb3.append(sb2 + str + "?auth_key=" + l + "-0-0-" + pro5134(str + "-" + l + "-0-0-" + str4));
            sb3.append("&");
            sb3.append(str5);
            return sb3.toString();
        }
        if ("2".equals(str3)) {
            StringBuilder sb4 = new StringBuilder();
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm", Locale.CHINA);
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
            String format = simpleDateFormat.format(Long.valueOf(System.currentTimeMillis()));
            sb4.append(sb2 + "/" + format + "/" + pro5134(str4 + format + str) + str);
            sb4.append("?");
            sb4.append(str5);
            return sb4.toString();
        }
        if (ExifInterface.GPS_MEASUREMENT_3D.equals(str3) || "4".equals(str3)) {
            StringBuilder sb5 = new StringBuilder();
            String lowerCase = Long.toHexString(a.a.a.pro5109.pro5109()).toLowerCase();
            sb5.append(sb2 + "/" + pro5134(str4 + str + lowerCase) + "/" + lowerCase + str);
            sb5.append("?");
            sb5.append(str5);
            return sb5.toString();
        }
        if (!"5".equals(str3)) {
            return sb2 + str + "?" + str5;
        }
        StringBuilder sb6 = new StringBuilder();
        String l2 = Long.toString(a.a.a.pro5109.pro5109());
        sb6.append(sb2 + str + "?sign=" + l2 + "-0-0-" + pro5134(str + "-" + l2 + "-0-0-" + str4));
        sb6.append("&");
        sb6.append(str5);
        return sb6.toString();
    }

    public static void pro5131(int i) {
        String str;
        if (i == 1001) {
            int i2 = pro5206;
            str = i2 == 2 ? "請校準本地時間,錯誤碼:2001" : i2 == 3 ? "Startup failed, please calibrate the local time and try again, error code 2001" : "请校准本地时间,错误码:2001";
        } else if (i == 1002) {
            int i3 = pro5206;
            str = i3 == 2 ? "數據解析出錯,錯誤碼:2002" : i3 == 3 ? "Startup failed, data decryption error, error code 2002" : "数据解析出错,错误码:2002";
        } else if (i == 1003) {
            int i4 = pro5206;
            str = i4 == 2 ? "實例不存在,錯誤碼:2003" : i4 == 3 ? "Startup failed, instance ID does not exist, please contact the administrator, error code 2003" : "实例不存在,错误码:2003";
        } else if (i == 1010) {
            int i5 = pro5206;
            str = i5 == 2 ? "連接服務器失敗,錯誤碼:2010" : i5 == 3 ? "Failed to start, failed to communicate with the server, please contact the administrator, error code 2010" : "连接服务器失败,错误码:2010";
        } else {
            if (i != 1011) {
                return;
            }
            int i6 = pro5206;
            str = i6 == 2 ? "數據解密出錯,錯誤碼:2011" : i6 == 3 ? "Startup failed, data decryption error, error code 2011" : "数据解密出错,错误码:2011";
        }
        pro5109("", str, true, 0);
    }

    public static String getUniqueID(Context context) {
        pro5171 = context;
        a.a.a.pro5109.pro5130 = context.getApplicationContext();
        return getUniqueID();
    }

    public static boolean pro5109(String str, String str2, boolean z, boolean z2) {
        String str3;
        String str4;
        String str5;
        StringBuilder sb;
        String str6;
        StringBuilder sb2;
        String str7;
        pro5227 = 300;
        if (z) {
            pro5227 = 400;
            if (str.equals(pro5221)) {
                System.currentTimeMillis();
            }
            pro5221 = str;
        }
        pro5109 pro51092 = (!z || z2) ? pro5109(str) : pro5130(str);
        int i = pro51092.pro5109;
        int i2 = 0;
        boolean z3 = true;
        if (i != 200 && i != 1088) {
            int i3 = 1001;
            if (i != 1001) {
                i3 = 1002;
                if (i != 1002) {
                    i3 = 1003;
                    if (i != 1003) {
                        if (i == 1004) {
                            int i4 = pro5206;
                            str4 = i4 == 2 ? "實例已過期,錯誤碼:2004" : i4 == 3 ? "Startup failed, the current protection instance has expired, please contact the administrator, error code 2004" : "实例已过期,错误码:2004";
                        } else if (i == 1005) {
                            int i5 = pro5206;
                            str4 = i5 == 2 ? "實例未開啟,錯誤碼:2005" : i5 == 3 ? "Startup failed, the current protection instance is not started, please contact the administrator, error code 2005" : "实例未开启,错误码:2005";
                            if (pro5193) {
                                int i6 = pro5199 + 1;
                                pro5199 = i6;
                            }
                            z3 = false;
                        } else if (i == 1006) {
                            str5 = "连接数上限[" + pro51092.pro5142 + "],错误码:2006";
                            int i7 = pro5206;
                            if (i7 == 2) {
                                sb2 = new StringBuilder();
                                sb2.append("連接數上限[");
                                sb2.append(pro51092.pro5142);
                                str7 = "],錯誤碼:2006";
                            } else if (i7 == 3) {
                                sb2 = new StringBuilder();
                                sb2.append("Startup failed. The number of current protection instance connections has reached the upper limit [");
                                sb2.append(pro51092.pro5142);
                                str7 = "]. Please contact the administrator. Error code 2006";
                            }
                            sb2.append(str7);
                            str5 = sb2.toString();
                        } else if (i == 1007) {
                            str5 = "设备数上限[" + pro51092.pro5142 + "],错误码:2007";
                            int i8 = pro5206;
                            if (i8 == 2) {
                                sb = new StringBuilder();
                                sb.append("設備數上限[");
                                sb.append(pro51092.pro5142);
                                str6 = "],錯誤碼:2007";
                            } else if (i8 == 3) {
                                sb = new StringBuilder();
                                sb.append("Startup failed. The number of current protection instance devices has reached the upper limit [");
                                sb.append(pro51092.pro5142);
                                str6 = "]. Please contact the administrator. Error code 2007";
                            }
                            sb.append(str6);
                            str5 = sb.toString();
                        } else if (i == 1013) {
                            int i9 = pro5206;
                            str4 = i9 == 2 ? "設備已拉黑,錯誤碼:2013" : i9 == 3 ? "Startup failed, your device has been blacklisted, please contact the administrator, error code 2013" : "设备已拉黑,错误码:2013";
                        } else if (i == 1024) {
                            int i10 = pro5206;
                            str4 = i10 == 2 ? "SDK已過期,錯誤碼:2024" : i10 == 3 ? "Startup failed, SDK key has expired, please contact the program publisher, error code 2024" : "SDK已过期,错误码:2024";
                        }
                        pro5109("", str4, z3, 0);
                    }
                }
                pro5198 = i3;
            }
            return false;
        }
        if (pro51092.pro5109 == 1088) {
            File file = new File(pro5160);
            if (file.exists() && !file.isDirectory()) {
                Future<?> future = pro5158;
                if (future != null) {
                    future.cancel(true);
                    pro5155.shutdownNow();
                }
                file.delete();
            }
            Iterator<pro5136> it = pro5138.iterator();
            while (it.hasNext()) {
                it.next().pro5131();
            }
            pro5138.clear();
            Iterator<pro5138> it2 = pro5139.iterator();
            while (it2.hasNext()) {
                it2.next().pro5132();
            }
            pro5139.clear();
        }
        try {
            pro5227++;
            String pro51093 = a.a.a.pro5109.pro5109(pro51092.pro5142, str2);
            pro5227++;
            String pro51094 = a.a.a.pro5109.pro5109(pro51092.pro5149, str2);
            pro5227++;
            String pro51095 = a.a.a.pro5109.pro5109(pro51092.pro5156, str2);
            pro5227++;
            String pro51096 = a.a.a.pro5109.pro5109(pro51092.pro5163, str2);
            pro5227++;
            pro5175[0] = a.a.a.pro5109.pro5109(pro51092.pro5141, str2);
            pro5227++;
            pro5175[1] = a.a.a.pro5109.pro5109(pro51092.pro5148, str2);
            pro5227++;
            pro5175[2] = a.a.a.pro5109.pro5109(pro51092.pro5155, str2);
            pro5227++;
            pro5175[3] = a.a.a.pro5109.pro5109(pro51092.pro5162, str2);
            String[] strArr = pro5177;
            strArr[0] = pro51092.pro5140;
            strArr[1] = pro51092.pro5147;
            strArr[2] = pro51092.pro5154;
            strArr[3] = pro51092.pro5161;
            pro5200 = pro51092.pro5132;
            pro5201 = pro51092.pro5133;
            pro5202 = pro51092.pro5134;
            pro5203 = pro51092.pro5170;
            pro5204 = pro51092.pro5171;
            pro5205 = pro51092.pro5172;
            pro5207 = pro51092.pro5135;
            pro5227 += 2;
            if (pro51092.pro5109 == 200 && !pro5136(pro51092.pro5165)) {
                String pro51097 = a.a.a.pro5109.pro5109(pro51092.pro5165, pro5133.pro5132());
                pro5237 = "";
                pro5236 = "";
                pro5235 = "";
                pro5234 = "";
                pro5227++;
                pro5141(pro5211);
                pro5227++;
                pro5141(pro51097);
            }
            pro5132();
            pro5178 = pro51092.pro5131;
            int[] iArr = pro5179;
            iArr[0] = pro51092.pro5137;
            iArr[1] = pro51092.pro5144;
            iArr[2] = pro51092.pro5151;
            iArr[3] = pro51092.pro5158;
            int[] iArr2 = pro5181;
            iArr2[0] = pro51092.pro5138;
            iArr2[1] = pro51092.pro5145;
            iArr2[2] = pro51092.pro5152;
            iArr2[3] = pro51092.pro5159;
            int[] iArr3 = pro5182;
            iArr3[0] = pro51092.pro5139;
            iArr3[1] = pro51092.pro5146;
            iArr3[2] = pro51092.pro5153;
            iArr3[3] = pro51092.pro5160;
            int[] iArr4 = pro5183;
            iArr4[0] = pro51092.pro5166;
            iArr4[1] = pro51092.pro5167;
            iArr4[2] = pro51092.pro5168;
            iArr4[3] = pro51092.pro5169;
            int[] iArr5 = pro5180;
            iArr5[0] = pro51092.pro5136;
            iArr5[1] = pro51092.pro5143;
            iArr5[2] = pro51092.pro5150;
            iArr5[3] = pro51092.pro5157;
            pro5227 += 10;
            pro5130(pro51093, 0, "127.0.0.1");
            if (pro5207 != 0) {
                int i11 = pro51092.pro5164;
                if (i11 == 1) {
                    pro5130(pro51093, 0, "127.0.0.2");
                } else if (i11 == 2) {
                    pro5130(pro51093, 0, "127.0.0.2");
                    pro5130(pro51093, 0, "127.0.0.3");
                }
            }
            pro5227 += 10;
            pro5130(pro51094, 1, "127.0.0.1");
            pro5227 += 10;
            pro5130(pro51095, 2, "127.0.0.1");
            pro5227 += 10;
            pro5130(pro51096, 3, "127.0.0.1");
            int i12 = 0;
            while (true) {
                SocketChannel[] socketChannelArr = pro5186;
                if (i12 >= socketChannelArr.length) {
                    break;
                }
                pro5109(socketChannelArr, i12);
                i12++;
            }
            while (true) {
                SocketChannel[] socketChannelArr2 = pro5187;
                if (i2 >= socketChannelArr2.length) {
                    break;
                }
                pro5109(socketChannelArr2, i2);
                i2++;
            }
            if (z || pro5188.pro5130 == null) {
                pro5188 = pro51092;
                pro51092.pro5174 = pro5109();
                pro5188.pro5175 = pro5216 ? "1" : "0";
                pro5188.pro5176 = pro5217 ? "1" : "0";
            }
            pro5227 += 10;
            if (z && (str3 = pro51092.pro5130) != null && str3.equals(getUniqueID()) && pro51092.pro5109 == 200) {
                pro5188.pro5179 = pro5134 ? "High" : "Low";
                pro5132.pro5131().pro5109("10910", pro5109(pro5188));
            }
            pro5227 += 10;
            return true;
        } catch (Exception e) {
            if (pro5193) {
                pro5199++;
            } else {
                pro5198 = PointerIconCompat.TYPE_COPY;
            }
            return false;
        }
    }

    public static String pro5109(String str, String str2) {
        pro5227 = BannerConfig.SCROLL_TIME;
        try {
            String[] pro51092 = pro5109(str, '.');
            if (pro51092.length == 4) {
                int[] iArr = new int[4];
                for (int i = 0; i < 4; i++) {
                    iArr[i] = pro5140(pro51092[i].trim());
                }
                pro5227 = LBSAuthManager.CODE_UNAUTHENTICATE;
                iArr[3] = iArr[3] + pro5140(str2.trim());
                if (iArr[3] < 0) {
                    iArr[3] = 0;
                } else if (iArr[3] > 255) {
                    iArr[3] = 255;
                }
                pro5227 = LBSAuthManager.CODE_AUTHENTICATING;
                StringBuilder sb = new StringBuilder();
                sb.append(iArr[0]);
                for (int i2 = 1; i2 < 4; i2++) {
                    sb.append('.');
                    sb.append(iArr[i2]);
                }
                return sb.toString();
            }
            throw new IllegalArgumentException("Invalid IP address");
        } catch (Exception e) {
            return str;
        }
    }

    public static String pro5109(String str, Map map, int i, String[] strArr) {
        int i2;
        String str2;
        int i3;
        pro5109 pro5109Var;
        String str3;
        int i4;
        int length = strArr.length;
        double[] dArr = {FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE, 1.2d, 3.0d, 4.0d, 5.0d, 6.0d};
        try {
            i2 = Integer.parseInt(str);
            if (i2 > 0 && i2 < 6) {
                try {
                    Thread.sleep((long) (dArr[i2] * 1000.0d));
                } catch (Exception e) {
                    e = e;
                    if (e instanceof InterruptedException) {
                        throw new RuntimeException(e);
                    }
                    boolean z = e instanceof SocketTimeoutException;
                    if (i2 != length - 1) {
                        return "";
                    }
                    throw new RuntimeException(e);
                }
            }
            if (pro5141 != null && pro5141.isDone()) {
                return "";
            }
            int i5 = i2 / 2;
            int i6 = i5 == 0 ? 1 : i5 == 1 ? 0 : i5;
            if (i2 % 2 == 0) {
                if (i6 >= 0 && i6 < 3) {
                    pro5239[i6] = null;
                }
                pro5132(i6);
            }
            String str4 = null;
            for (int i7 = 0; i7 < 40; i7++) {
                try {
                    Thread.sleep(100L);
                    if (Thread.currentThread().isInterrupted()) {
                        break;
                    }
                    str4 = (i6 < 0 || i6 >= 3) ? null : pro5239[i6];
                    if (!pro5136(str4)) {
                        break;
                    }
                } catch (Exception e2) {
                }
            }
            if (pro5141 != null && pro5141.isDone()) {
                return "";
            }
            if (i6 == 0 && pro5136(str4)) {
                pro5134(pro5191, 0);
            }
            if (!pro5136(str4)) {
                String[] pro51092 = pro5109(str4, ':');
                if (pro51092.length == 2) {
                    String str5 = pro51092[0];
                    if (i2 % 2 == 0) {
                        i4 = new Random().nextInt(2) + 2;
                        pro5248 = i4;
                    } else {
                        i4 = pro5248 + 2;
                        if (i4 > 3) {
                            i4 -= 4;
                        }
                    }
                    i3 = pro5109(pro51092[1], i4, str5);
                    str2 = str5;
                    if (pro5136(str2) && i3 != 0) {
                        String jSONObject = new JSONObject(map).toString();
                        int parseInt = Integer.parseInt(str);
                        AtomicReference atomicReference = new AtomicReference(null);
                        pro5109(parseInt, str2, i3, jSONObject, atomicReference, pro5151, true, true, false);
                        pro5109Var = (pro5109) atomicReference.get();
                        if (pro5109Var != null || pro5109Var.pro5109 == 0) {
                            pro5109(pro5186, parseInt);
                            if (pro5141 != null) {
                                if (pro5141.isDone()) {
                                }
                                str3 = "";
                                if (pro5136(str3)) {
                                    return "";
                                }
                                if (!str3.contains("response")) {
                                    if (((pro5109) Objects.requireNonNull(pro5109Var)).pro5109 == 0) {
                                        return "";
                                    }
                                }
                                return str3;
                            }
                            pro5109(parseInt, str2, i3, jSONObject, atomicReference, pro5151, true, true, false);
                            pro5109Var = (pro5109) atomicReference.get();
                            if (pro5109Var != null && pro5109Var.pro5109 != 0) {
                            }
                            str3 = "";
                            if (pro5136(str3)) {
                            }
                        }
                        str3 = pro5109(pro5109Var);
                        if (pro5136(str3)) {
                        }
                    }
                    return "";
                }
            }
            str2 = "";
            i3 = 0;
            if (pro5136(str2)) {
                return "";
            }
            String jSONObject2 = new JSONObject(map).toString();
            int parseInt2 = Integer.parseInt(str);
            AtomicReference atomicReference2 = new AtomicReference(null);
            pro5109(parseInt2, str2, i3, jSONObject2, atomicReference2, pro5151, true, true, false);
            pro5109Var = (pro5109) atomicReference2.get();
            if (pro5109Var != null) {
            }
            pro5109(pro5186, parseInt2);
            if (pro5141 != null) {
            }
            pro5109(parseInt2, str2, i3, jSONObject2, atomicReference2, pro5151, true, true, false);
            pro5109Var = (pro5109) atomicReference2.get();
            if (pro5109Var != null) {
                str3 = pro5109(pro5109Var);
                if (pro5136(str3)) {
                }
            }
            str3 = "";
            if (pro5136(str3)) {
            }
        } catch (Exception e3) {
            e = e3;
            i2 = i;
        }
    }

    public static pro5109 pro5130(String str) {
        pro5109 pro5109Var = new pro5109();
        try {
            JSONObject jSONObject = new JSONObject(str);
            if (!jSONObject.isNull("a")) {
                pro5109Var.pro5109 = jSONObject.getInt("a");
            }
            if (!jSONObject.isNull("r")) {
                pro5109Var.pro5130 = jSONObject.getString("r");
            }
            if (!jSONObject.isNull("d")) {
                pro5109Var.pro5131 = jSONObject.getString("d");
            }
            if (!jSONObject.isNull("s")) {
                pro5109Var.pro5132 = jSONObject.getInt("s");
            }
            if (!jSONObject.isNull("t")) {
                pro5109Var.pro5133 = jSONObject.getInt("t");
            }
            if (!jSONObject.isNull("u")) {
                pro5109Var.pro5134 = jSONObject.getString("u");
            }
            if (!jSONObject.isNull("v")) {
                pro5109Var.pro5135 = jSONObject.getInt("v");
            }
            if (!jSONObject.isNull("c")) {
                pro5109Var.pro5136 = jSONObject.getInt("c");
            }
            if (!jSONObject.isNull("f")) {
                pro5109Var.pro5137 = jSONObject.getInt("f");
            }
            if (!jSONObject.isNull("bb")) {
                pro5109Var.pro5138 = jSONObject.getInt("bb");
            }
            if (!jSONObject.isNull("mm")) {
                pro5109Var.pro5139 = jSONObject.getInt("mm");
            }
            if (!jSONObject.isNull(ImageLoader.AUTOPLAY_FILTER)) {
                pro5109Var.pro5140 = jSONObject.getString(ImageLoader.AUTOPLAY_FILTER);
            }
            if (!jSONObject.isNull("b")) {
                pro5109Var.pro5141 = jSONObject.getString("b");
            }
            if (!jSONObject.isNull("e")) {
                pro5109Var.pro5142 = jSONObject.getString("e");
            }
            if (!jSONObject.isNull("i")) {
                pro5109Var.pro5143 = jSONObject.getInt("i");
            }
            if (!jSONObject.isNull("j")) {
                pro5109Var.pro5144 = jSONObject.getInt("j");
            }
            if (!jSONObject.isNull("cc")) {
                pro5109Var.pro5145 = jSONObject.getInt("cc");
            }
            if (!jSONObject.isNull("nn")) {
                pro5109Var.pro5146 = jSONObject.getInt("nn");
            }
            if (!jSONObject.isNull("l")) {
                pro5109Var.pro5147 = jSONObject.getString("l");
            }
            if (!jSONObject.isNull("h")) {
                pro5109Var.pro5148 = jSONObject.getString("h");
            }
            if (!jSONObject.isNull("k")) {
                pro5109Var.pro5149 = jSONObject.getString("k");
            }
            if (!jSONObject.isNull("n")) {
                pro5109Var.pro5150 = jSONObject.getInt("n");
            }
            if (!jSONObject.isNull("o")) {
                pro5109Var.pro5151 = jSONObject.getInt("o");
            }
            if (!jSONObject.isNull("dd")) {
                pro5109Var.pro5152 = jSONObject.getInt("dd");
            }
            if (!jSONObject.isNull("oo")) {
                pro5109Var.pro5153 = jSONObject.getInt("oo");
            }
            if (!jSONObject.isNull("q")) {
                pro5109Var.pro5154 = jSONObject.getString("q");
            }
            if (!jSONObject.isNull("m")) {
                pro5109Var.pro5155 = jSONObject.getString("m");
            }
            if (!jSONObject.isNull(TtmlNode.TAG_P)) {
                pro5109Var.pro5156 = jSONObject.getString(TtmlNode.TAG_P);
            }
            if (!jSONObject.isNull("ll")) {
                pro5109Var.pro5157 = jSONObject.getInt("ll");
            }
            if (!jSONObject.isNull("y")) {
                pro5109Var.pro5158 = jSONObject.getInt("y");
            }
            if (!jSONObject.isNull("ee")) {
                pro5109Var.pro5159 = jSONObject.getInt("ee");
            }
            if (!jSONObject.isNull("pp")) {
                pro5109Var.pro5160 = jSONObject.getInt("pp");
            }
            if (!jSONObject.isNull("x")) {
                pro5109Var.pro5161 = jSONObject.getString("x");
            }
            if (!jSONObject.isNull("z")) {
                pro5109Var.pro5162 = jSONObject.getString("z");
            }
            if (!jSONObject.isNull("aa")) {
                pro5109Var.pro5163 = jSONObject.getString("aa");
            }
            if (!jSONObject.isNull("ff")) {
                pro5109Var.pro5164 = jSONObject.getInt("ff");
            }
            if (!jSONObject.isNull("gg")) {
                pro5109Var.pro5165 = jSONObject.getString("gg");
            }
            if (!jSONObject.isNull("hh")) {
                pro5109Var.pro5166 = jSONObject.getInt("hh");
            }
            if (!jSONObject.isNull("ii")) {
                pro5109Var.pro5167 = jSONObject.getInt("ii");
            }
            if (!jSONObject.isNull("jj")) {
                pro5109Var.pro5168 = jSONObject.getInt("jj");
            }
            if (!jSONObject.isNull("kk")) {
                pro5109Var.pro5169 = jSONObject.getInt("kk");
            }
            if (!jSONObject.isNull("qq")) {
                pro5109Var.pro5170 = jSONObject.getInt("qq");
            }
            if (!jSONObject.isNull("rr")) {
                pro5109Var.pro5171 = jSONObject.getInt("rr");
            }
            if (!jSONObject.isNull(DownloadAction.TYPE_SS)) {
                pro5109Var.pro5172 = jSONObject.getInt(DownloadAction.TYPE_SS);
            }
            if (!jSONObject.isNull("response")) {
                pro5109Var.pro5177 = jSONObject.getString("response");
            }
        } catch (Exception e) {
        }
        return pro5109Var;
    }

    public static void pro5130(int i, final int i2, String str) {
        int i3 = pro5188.pro5109;
        if (i3 == 1088 || i3 == 1004 || i3 == 1005 || i3 == 1024) {
            return;
        }
        int i4 = i2 - 1;
        if (i4 >= 0) {
            int[] iArr = pro5225;
            if (i4 < iArr.length) {
                iArr[i4] = 0;
            }
        }
        String str2 = "(1910)" + str;
        CompletableFuture<Void> andSet = pro5146.getAndSet(null);
        if (andSet != null) {
            andSet.cancel(true);
        }
        ExecutorService executorService = pro5150;
        if (executorService != null) {
            executorService.shutdownNow();
        }
        Iterator<CompletableFuture<String>> it = pro5147.iterator();
        while (it.hasNext()) {
            it.next().cancel(true);
        }
        pro5147.clear();
        CompletableFuture<Void> completableFuture = pro5141;
        if (completableFuture != null) {
            completableFuture.cancel(true);
            pro5151.shutdownNow();
        }
        pro5151 = Executors.newCachedThreadPool();
        pro5141 = new CompletableFuture<>();
        String str3 = pro5162;
        String str4 = pro5161;
        final String[] strArr = !pro5136(pro5191) ? new String[]{"0", "1", pro5109(4, "/n_d_api.php"), "2", ExifInterface.GPS_MEASUREMENT_3D, "4", "5", pro5109(3, "/n_api.php")} : !pro5136(pro5237) ? new Random().nextInt(2) == 0 ? new String[]{pro5109(0, "/n_api.php"), pro5109(1, "/n_api.php"), pro5109(2, "/n_api.php"), pro5109(3, "/n_api.php")} : new String[]{pro5109(0, "/n_api.php"), pro5109(2, "/n_api.php"), pro5109(1, "/n_api.php"), pro5109(3, "/n_api.php")} : !pro5136(pro5236) ? new String[]{pro5109(0, "/n_api.php"), pro5109(1, "/n_api.php"), pro5109(2, "/n_api.php")} : new String[]{pro5109(0, "/n_api.php"), pro5109(1, "/n_api.php")};
        String uniqueID = getUniqueID();
        String l = Long.toString(a.a.a.pro5109.pro5109());
        String pro51342 = pro5134("device_type=2&device_uid=" + uniqueID + "&device_time=" + l + "&key=" + str4);
        StringBuilder sb = new StringBuilder();
        sb.append("device_uid=");
        sb.append(uniqueID);
        sb.append("&device_time=");
        sb.append(l);
        sb.append("&key=");
        StringBuilder sb2 = new StringBuilder();
        for (String str5 : pro5133.pro5134) {
            sb2.append(str5);
        }
        sb.append(sb2.toString());
        String pro51343 = pro5134(sb.toString());
        final HashMap hashMap = new HashMap();
        hashMap.put("device_type", "2");
        hashMap.put("device_uid", uniqueID);
        hashMap.put("device_time", l);
        hashMap.put("token", pro51342);
        hashMap.put("first_token", pro51343);
        hashMap.put("username", str3);
        hashMap.put("request_type", Long.toString(i));
        hashMap.put("request_area", Long.toString(i2));
        hashMap.put("request_reason", str2);
        hashMap.put("sdk_code", pro5208);
        if (!pro5136(pro5209)) {
            hashMap.put("ad_code", pro5209);
        }
        hashMap.put("maxband_flg", str2.contains("高带宽") ? "1" : "0");
        hashMap.put("type", "t_dispatch2");
        hashMap.put("version", "10910");
        final int i5 = -1;
        final AtomicInteger atomicInteger = new AtomicInteger(0);
        for (final String str6 : strArr) {
            i5++;
            final CompletableFuture<String> supplyAsync = CompletableFuture.supplyAsync((pro5136(str6) || str6.length() != 1) ? new Supplier() {
                @Override
                public final Object get() {
                    return AppProtectManager.pro5130(str6, hashMap, i5, strArr);
                }
            } : new Supplier() {
                @Override
                public final Object get() {
                    return AppProtectManager.pro5109(str6, hashMap, i5, strArr);
                }
            }, pro5151);
            pro5147.add(supplyAsync);
            supplyAsync.whenComplete(new BiConsumer() {
                @Override
                public final void accept(Object obj, Object obj2) {
                    AppProtectManager.pro5109(CompletableFuture.this, i2, atomicInteger, strArr, (String) obj, (Throwable) obj2);
                }

                @Override
                public BiConsumer<T, U> andThen(BiConsumer<? super T, ? super U> biConsumer) {
                    return BiConsumer.CC.$default$andThen(this, biConsumer);
                }
            });
        }
        pro5141.thenRun((Runnable) new Runnable() {
            @Override
            public final void run() {
                AppProtectManager.pro5141();
            }
        }).exceptionally((Function<Throwable, ? extends Void>) new Function() {
            @Override
            public <V> Function<T, V> andThen(Function<? super R, ? extends V> function) {
                return Function.CC.$default$andThen(this, function);
            }

            @Override
            public final Object apply(Object obj) {
                return AppProtectManager.pro5109((Throwable) obj);
            }

            @Override
            public <V> Function<V, R> compose(Function<? super V, ? extends T> function) {
                return Function.CC.$default$compose(this, function);
            }
        });
    }

    public static void pro5109(CompletableFuture completableFuture, int i, AtomicInteger atomicInteger, String[] strArr, String str, Throwable th) {
        int i2;
        String str2;
        String str3;
        if (pro5136(str)) {
            atomicInteger.getAndIncrement();
            if (atomicInteger.get() == strArr.length) {
                String pro51092 = pro5132.pro5131().pro5109();
                if (pro5136(pro51092)) {
                    return;
                }
                pro5109(pro51092, pro5161, false, false);
                if (pro5188.pro5109 == 200) {
                    System.currentTimeMillis();
                    return;
                }
                return;
            }
            return;
        }
        for (CompletableFuture<String> completableFuture2 : pro5147) {
            if (completableFuture2 != completableFuture) {
                completableFuture2.cancel(true);
            }
        }
        pro5141.complete(null);
        pro5226 = str;
        try {
            if (!pro5136(str)) {
                JSONObject jSONObject = new JSONObject(str);
                if (!jSONObject.isNull("response")) {
                    str = a.a.a.pro5109.pro5109(jSONObject.getString("response"), pro5134(pro5161));
                    pro5226 = str;
                }
            }
        } catch (Exception e) {
        }
        String str4 = pro5161;
        if (!pro5136(str) && (i2 = i - 1) >= 0 && i2 < 4) {
            pro5109 pro51302 = pro5130(str);
            if (pro51302.pro5109 == 200) {
                if (i2 == 0) {
                    str3 = pro51302.pro5141;
                } else if (i2 == 1) {
                    str3 = pro51302.pro5148;
                } else if (i2 == 2) {
                    str3 = pro51302.pro5155;
                } else if (i2 == 3) {
                    str3 = pro51302.pro5162;
                } else {
                    str2 = "";
                    if (pro5136(str2) && str2.equals(pro5175[i2])) {
                        int[] iArr = pro5222;
                        iArr[i2] = iArr[i2] + 1;
                    } else {
                        pro5222[i2] = 0;
                    }
                }
                str2 = a.a.a.pro5109.pro5109(str3, str4);
                if (pro5136(str2)) {
                }
                pro5222[i2] = 0;
            }
        }
        if (pro5136(str) || !pro5109(str, pro5161, true, false)) {
            pro5196++;
            pro5148();
        } else {
            pro5199 = 0;
            pro5196 = 0;
            pro5148();
            pro5153();
        }
        if (!pro5193) {
            pro5193 = true;
        }
        if (pro5136()) {
            pro5197 = pro5198 == 0;
            pro5157();
        }
    }

    public static String pro5109(String str, int i, String[] strArr) {
        String str2 = "";
        int length = strArr.length;
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
            httpURLConnection.setRequestMethod("GET");
            if (httpURLConnection.getResponseCode() == 200) {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
                StringBuilder sb = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    sb.append(readLine);
                }
                bufferedReader.close();
                String sb2 = sb.toString();
                if (!pro5136(sb2)) {
                    Matcher matcher = Pattern.compile("\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b" + LogUtils.VERTICAL + "\\b(?:[a-fA-F0-9]{1,4}:){7}[a-fA-F0-9]{1,4}\\b").matcher(sb2);
                    if (matcher.find()) {
                        str2 = matcher.group();
                    }
                }
            }
            httpURLConnection.disconnect();
        } catch (Exception e) {
            boolean z = e instanceof SocketTimeoutException;
            if (i == length - 1) {
                throw new RuntimeException(e);
            }
        }
        return str2;
    }

    public static String pro5109(String str, String str2, int i, pro5137 pro5137Var) {
        if (i > 0) {
            try {
                Thread.sleep(i * 500);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
        String str3 = "";
        if (pro5137Var.pro5130 != null && pro5137Var.pro5130.isDone()) {
            return null;
        }
        Lookup lookup = new Lookup(str, 16);
        lookup.setResolver(new SimpleResolver(str2));
        Record[] run = lookup.run();
        if (lookup.getResult() != 0) {
            pro5134.pro5109("Lookup failed: " + lookup.getErrorString());
            return "";
        }
        for (Record record : run) {
            if (record instanceof TXTRecord) {
                TXTRecord tXTRecord = (TXTRecord) record;
                if (!pro5136(tXTRecord.rdataToString())) {
                    str3 = tXTRecord.rdataToString();
                }
            }
        }
        return str3;
    }

    public static void pro5109(List list) {
        pro5136 pro5136Var;
        pro5136 poll;
        StringBuilder sb;
        final int size = pro5172.size();
        while (!pro5140.get()) {
            while (!pro5172.isEmpty()) {
                try {
                    synchronized (pro5172) {
                        poll = pro5172.isEmpty() ? null : pro5172.poll();
                    }
                    if (poll != null) {
                        try {
                            poll.pro5109(pro5137);
                            synchronized (pro5138) {
                                pro5138.add(poll);
                            }
                        } catch (Exception e) {
                            poll.pro5131();
                            if (!(e instanceof BindException)) {
                                String str = "监听端口(" + poll.pro5130 + ")失败,错误码:2012";
                                if (pro5206 == 2) {
                                    sb = new StringBuilder();
                                    sb.append("監聽端口(");
                                    sb.append(poll.pro5130);
                                    sb.append(")失敗,錯誤碼:2012");
                                } else {
                                    if (pro5206 == 3) {
                                        sb = new StringBuilder();
                                        sb.append("Failed to start, failed to listen to the local port(");
                                        sb.append(poll.pro5130);
                                        sb.append("), error code 2012");
                                    }
                                    pro5109("", str, false, 0);
                                }
                                str = sb.toString();
                                pro5109("", str, false, 0);
                            } else if (!pro5214 && "1".equals(pro5212)) {
                                int i = poll.pro5130;
                                if (!list.contains(Integer.valueOf(i))) {
                                    list.add(Integer.valueOf(i));
                                }
                                StringBuilder sb2 = new StringBuilder();
                                int min = Math.min(list.size(), 5);
                                for (int i2 = 0; i2 < min; i2++) {
                                    sb2.append(list.get(i2));
                                    if (i2 < min - 1) {
                                        sb2.append(',');
                                    }
                                }
                                if (list.size() > 5) {
                                    sb2.append("...");
                                }
                                final int size2 = list.size();
                                final String sb3 = sb2.toString();
                                pro5131.pro5109(AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS, new Runnable() {
                                    @Override
                                    public final void run() {
                                        AppProtectManager.pro5109(size2, size, sb3);
                                    }
                                });
                            }
                        }
                    }
                } catch (Exception e2) {
                    pro5134.pro5109("Selector handling error: " + e2.getMessage());
                }
            }
            if (pro5137.select() > 0) {
                Iterator<SelectionKey> it = pro5137.selectedKeys().iterator();
                while (it.hasNext()) {
                    SelectionKey next = it.next();
                    it.remove();
                    if (next.isValid()) {
                        try {
                            if (next.isAcceptable()) {
                                pro5136Var = (pro5136) next.attachment();
                                if (pro5136Var != null) {
                                }
                            } else if (next.isConnectable() || next.isReadable() || next.isWritable()) {
                                a.a.a.pro5130 pro5130Var = (a.a.a.pro5130) next.attachment();
                                if (pro5130Var != null && pro5130Var.pro5132 != null) {
                                    pro5136Var = pro5130Var.pro5132;
                                }
                            }
                            pro5136Var.pro5130(next);
                        } catch (Exception e3) {
                            pro5134.pro5109("handleSelectionKey error: " + e3.getMessage());
                        }
                    }
                }
            }
        }
    }

    public static Void pro5109(String str, long j, String str2, String str3) {
        int i;
        Socket socket;
        String str4 = pro5175[0];
        SocketChannel socketChannel = pro5187[4];
        int port = (socketChannel == null || !socketChannel.isConnected() || (socket = socketChannel.socket()) == null) ? 0 : socket.getPort();
        if (port != 0) {
            i = port;
        } else {
            i = pro5109(str4, pro5130(0), new Random().nextInt(2) + 2);
        }
        if (!pro5136(str4) && i != 0) {
            if ("connect".equals(str)) {
                pro5109(-1L);
            } else {
                pro5109(0L);
            }
            if (("connect".equals(str) || "sysn".equals(str)) && j > 0) {
                pro5170.set(j);
            }
            String l = Long.toString(j);
            String uniqueID = getUniqueID();
            String l2 = Long.toString(a.a.a.pro5109.pro5109());
            String l3 = Long.toString(pro5134());
            String pro51342 = pro5134("opt_type=" + str + "&device_uid=" + uniqueID + "&device_time=" + l2 + "&connect_num=" + l3 + "&connect_speed=" + l + "&key=" + str2);
            Object[] objArr = new Object[8];
            objArr[0] = str;
            objArr[1] = str3;
            objArr[2] = uniqueID;
            objArr[3] = l2;
            objArr[4] = l3;
            objArr[5] = l;
            objArr[6] = pro51342;
            objArr[7] = pro5192 ? "-10910" : "10910";
            String format = String.format("{\"type\":\"sysn3\",\"opt_type\":\"%s\",\"instance_id\":\"%s\",\"device_uid\":\"%s\",\"device_time\":\"%s\",\"connect_num\":\"%s\",\"connect_speed\":\"%s\",\"token\":\"%s\",\"version\":\"%s\"}", objArr);
            AtomicReference atomicReference = new AtomicReference(null);
            int i2 = i;
            pro5109(4, str4, i, format, atomicReference, pro5150, true, false, true);
            pro5109 pro5109Var = (pro5109) atomicReference.get();
            if (pro5109Var == null) {
                pro5109(pro5187, 4);
                if (i2 < 10000) {
                    pro5109(4, str4, pro5109(str4, pro5130(0), new Random().nextInt(2)), format, atomicReference, pro5150, true, false, true);
                    pro5109Var = (pro5109) atomicReference.get();
                    if (pro5109Var == null) {
                        pro5109(pro5187, 4);
                    }
                }
                return null;
            }
            if (pro5217) {
                pro5109(pro5187, 4);
            }
            if (pro5192) {
                pro5192 = false;
            }
            pro5109(pro5109Var);
            return null;
        }
        return null;
    }
}