翰林优商.apk(点击下载) / d.java


package com.mbridge.msdk.foundation.same.net.f;

import android.text.TextUtils;
import com.mbridge.msdk.c.b;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.tools.r;
import com.mbridge.msdk.foundation.tools.w;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.regex.Pattern;

/* compiled from: RequestUrlUtil */
public final class d {
    public String A;
    public String B;
    public int C;
    public int D;
    public boolean E;
    public ArrayList<String> F;
    public ArrayList<String> G;
    private final String H;
    private boolean I;
    private int J;

    /* renamed from: K  reason: collision with root package name */
    private String f115K;
    private String L;
    private String M;
    private String N;
    private String O;
    private String P;
    private String Q;
    private String R;
    private String S;
    private String T;
    private String U;
    private String V;
    public String a;
    public String b;
    public String c;
    public String d;
    public String e;
    public int f;
    public int g;
    public boolean h;
    public int i;
    public String j;
    public String k;
    public String l;
    public String m;
    public String n;
    public String o;
    public String p;
    public String q;
    public String r;
    public String s;
    public String t;
    public String u;
    public String v;
    public String w;
    public String x;
    public String y;
    public String z;

    /* access modifiers changed from: private */
    /* compiled from: RequestUrlUtil */
    public static class a {
        private static final d a = new d();
    }

    private d() {
        this.H = "RequestUrlUtil";
        this.I = true;
        this.J = 0;
        this.f115K = "https://{}hb.rayjump.com";
        this.a = "https://analytics.rayjump.com";
        this.b = "https://net.rayjump.com";
        this.c = "https://configure.rayjump.com";
        this.d = "configure-tcp.rayjump.com";
        this.e = r.b("DkPtYdQTLkfAW+xUhoPwLkPTHkJBDkM/Yr5T");
        this.f = 9377;
        this.g = 9377;
        this.h = false;
        this.i = 1;
        this.L = "/bid";
        this.M = "/load";
        this.N = "/openapi/ad/v3";
        this.O = "/openapi/ad/v4";
        this.P = "/openapi/ad/v5";
        this.Q = "/image";
        this.R = "/mapping";
        this.S = "/setting";
        this.T = "/sdk/customid";
        this.U = "/rewardsetting";
        this.V = "/appwall/setting";
        this.j = this.f115K + this.L;
        this.k = this.f115K + this.M;
        this.l = this.b + this.N;
        this.m = this.b + this.O;
        this.n = this.b + this.P;
        this.o = this.b + this.Q;
        this.p = this.c + this.S;
        this.q = this.c + this.T;
        this.r = this.c + this.U;
        this.s = this.c + this.R;
        this.t = this.c + this.V;
        this.u = this.d + this.S;
        this.v = this.d + this.T;
        this.w = this.d + this.U;
        this.x = this.d + this.R;
        this.y = this.d + this.V;
        this.z = "https://detect.rayjump.com/mapi/find";
        this.A = "https://detect.rayjump.com/mapi/result";
        this.B = "https://d1tru86qrby720.cloudfront.net/hostsetting";
        this.C = 0;
        this.D = 0;
        this.E = false;
        this.F = new ArrayList<>(Arrays.asList("https://configure.rayjump.com", "https://policy.rayjump.com", "https://lazy.rayjump.com", "https://check.rayjump.com"));
        this.G = new ArrayList<>(Arrays.asList("configure-tcp.rayjump.com", "policy-tcp.rayjump.com", "lazy-tcp.rayjump.com", "check-tcp.rayjump.com"));
    }

    public static d a() {
        return a.a;
    }

    public final int b() {
        return this.J;
    }

    public final void a(int i2) {
        this.J = i2;
    }

    public final String a(String str, int i2) {
        try {
            if (!TextUtils.isEmpty(str)) {
                String[] split = str.split("_");
                if (split.length > 1) {
                    return a(true, split[1]);
                }
                return a(true, "");
            }
        } catch (Exception e2) {
            w.d("RequestUrlUtil", e2.getMessage());
        }
        return i2 % 2 == 0 ? this.n : this.l;
    }

    public final String a(boolean z2, String str) {
        if (!z2) {
            return this.j.replace("{}", "");
        }
        if (!this.k.contains("{}") || TextUtils.isEmpty(str)) {
            return this.k.replace("{}", "");
        }
        String str2 = this.k;
        return str2.replace("{}", str + "-");
    }

    public final void c() {
        HashMap<String, String> aU;
        com.mbridge.msdk.c.a b2 = b.a().b(com.mbridge.msdk.foundation.controller.a.f().k());
        if (b2 != null) {
            this.h = b2.aY() == 2;
            this.i = b2.aY();
            this.I = !b2.l(2);
            if (b2.aU() != null && b2.aU().size() > 0 && (aU = b2.aU()) != null && aU.size() > 0) {
                if (aU.containsKey("v") && !TextUtils.isEmpty(aU.get("v")) && a(aU.get("v"))) {
                    this.b = aU.get("v");
                    this.l = this.b + this.N;
                    this.m = this.b + this.O;
                    this.n = this.b + this.P;
                    this.o = this.b + this.Q;
                }
                if (aU.containsKey(CampaignEx.JSON_KEY_HB) && !TextUtils.isEmpty(aU.get(CampaignEx.JSON_KEY_HB)) && a(aU.get(CampaignEx.JSON_KEY_HB))) {
                    this.f115K = aU.get(CampaignEx.JSON_KEY_HB);
                    this.j = this.f115K + this.L;
                    this.k = this.f115K + this.M;
                }
                if (aU.containsKey("lg") && !TextUtils.isEmpty(aU.get("lg"))) {
                    String str = aU.get("lg");
                    if (a(str)) {
                        this.a = str;
                    } else {
                        this.e = str;
                    }
                }
                if (aU.containsKey("dr") && !TextUtils.isEmpty(aU.get("dr")) && a(aU.get("dr"))) {
                    this.A = aU.get("dr");
                }
                if (aU.containsKey("df") && !TextUtils.isEmpty(aU.get("df")) && a(aU.get("df"))) {
                    this.z = aU.get("df");
                }
            }
            String aj = b2.aj();
            if (!TextUtils.isEmpty(aj)) {
                this.c = aj;
                e();
                this.F.add(0, aj);
            }
            String ak = b2.ak();
            if (!TextUtils.isEmpty(ak)) {
                this.d = ak;
                f();
                this.G.add(0, ak);
            }
        }
    }

    public final boolean d() {
        try {
            if (!this.h) {
                ArrayList<String> arrayList = this.F;
                if (arrayList != null && this.C <= arrayList.size() - 1) {
                    this.c = this.F.get(this.C);
                    e();
                    return true;
                }
            } else {
                ArrayList<String> arrayList2 = this.G;
                if (arrayList2 != null && this.D <= arrayList2.size() - 1) {
                    if (!a(this.G.get(this.D))) {
                        this.d = this.G.get(this.D);
                        f();
                    }
                    return true;
                }
            }
            if (this.E) {
                this.C = 0;
                this.D = 0;
            }
            return false;
        } catch (Throwable th) {
            w.a("RequestUrlUtil", th.getMessage());
            return false;
        }
    }

    private boolean a(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        return Pattern.compile("(https|http)://[-A-Za-z0-9{}+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]").matcher(str.trim()).matches();
    }

    public final void e() {
        this.p = this.c + this.S;
        this.q = this.c + this.T;
        this.r = this.c + this.U;
        this.s = this.c + this.R;
        this.t = this.c + this.V;
    }

    public final void f() {
        this.u = this.d + this.S;
        this.v = this.d + this.T;
        this.w = this.d + this.U;
        this.x = this.d + this.R;
        this.y = this.d + this.V;
    }
}