Fing.apk(点击下载) / j0.java


package com.overlook.android.fing.engine.services.netbox;

import android.os.Build;
import android.text.TextUtils;
import com.overlook.android.fing.engine.l.q;
import com.overlook.android.fing.engine.l.u;
import com.overlook.android.fing.engine.model.catalog.FullTextSearchResponse;
import com.overlook.android.fing.engine.model.catalog.RecogCatalog;
import com.overlook.android.fing.engine.model.catalog.b;
import com.overlook.android.fing.engine.model.internet.IspLookup;
import com.overlook.android.fing.engine.model.internet.IspQuery;
import com.overlook.android.fing.engine.model.internet.OutageInfo;
import com.overlook.android.fing.engine.model.internet.OutagesOverview;
import com.overlook.android.fing.engine.model.internet.UserRating;
import com.overlook.android.fing.engine.model.internet.UserRatingsQuery;
import com.overlook.android.fing.engine.model.net.DeviceRecognition;
import com.overlook.android.fing.engine.model.net.Node;
import com.overlook.android.fing.engine.model.net.p;
import com.overlook.android.fing.engine.model.speedtest.InternetSpeedTestRecord;
import com.overlook.android.fing.engine.model.speedtest.InternetSpeedTestScore;
import e.f.a.a.a.a0;
import e.f.a.a.a.a9;
import e.f.a.a.a.c;
import e.f.a.a.a.c1;
import e.f.a.a.a.c6;
import e.f.a.a.a.d0;
import e.f.a.a.a.d1;
import e.f.a.a.a.d6;
import e.f.a.a.a.d9;
import e.f.a.a.a.e6;
import e.f.a.a.a.e9;
import e.f.a.a.a.f0;
import e.f.a.a.a.f6;
import e.f.a.a.a.f9;
import e.f.a.a.a.g0;
import e.f.a.a.a.g6;
import e.f.a.a.a.g9;
import e.f.a.a.a.h0;
import e.f.a.a.a.h6;
import e.f.a.a.a.i6;
import e.f.a.a.a.j6;
import e.f.a.a.a.k;
import e.f.a.a.a.l;
import e.f.a.a.a.l0;
import e.f.a.a.a.l6;
import e.f.a.a.a.m0;
import e.f.a.a.a.o6;
import e.f.a.a.a.s9;
import e.f.a.a.a.u7;
import e.f.a.a.a.u9;
import e.f.a.a.a.w;
import e.f.a.a.a.w6;
import e.f.a.a.a.x;
import e.f.a.a.a.x9;
import e.f.a.a.a.y;
import e.f.a.a.a.z;
import e.f.a.a.a.z9;
import h.b0;
import h.c0;
import h.e0;
import h.i0;
import h.k0;
import h.y;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import okhttp3.internal.connection.e;

/* compiled from: NetBoxApiClient */
public class j0 {

    /* renamed from: f  reason: collision with root package name */
    public static final /* synthetic */ int f16265f = 0;

    /* renamed from: a  reason: collision with root package name */
    protected final c0 f16266a;
    protected String b;

    /* renamed from: c  reason: collision with root package name */
    protected String f16267c;

    /* renamed from: d  reason: collision with root package name */
    protected String f16268d;

    /* renamed from: e  reason: collision with root package name */
    private String f16269e;

    /* access modifiers changed from: protected */
    /* compiled from: NetBoxApiClient */
    public interface a {
        void a(y.a aVar) throws Exception;
    }

    /* access modifiers changed from: protected */
    /* compiled from: NetBoxApiClient */
    public interface b {
        void a(b0.a aVar) throws Exception;
    }

    public j0(String str) {
        c0.a a2 = com.overlook.android.fing.engine.j.h.b.a();
        TimeUnit timeUnit = TimeUnit.SECONDS;
        a2.b(30, timeUnit);
        a2.L(30, timeUnit);
        a2.I(30, timeUnit);
        this.f16266a = new c0(a2);
        this.f16269e = str;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:41:0x00e8, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:42:0x00e9, code lost:
        if (r5 != null) goto L_0x00eb;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:44:?, code lost:
        r5.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:45:0x00ef, code lost:
        r5 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:46:0x00f0, code lost:
        r6.addSuppressed(r5);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:47:0x00f3, code lost:
        throw r0;
     */
    private InputStream a(String str, a aVar) throws NetBoxApiException {
        try {
            y j = y.j(str);
            if (j != null) {
                y.a i2 = j.i();
                if (!TextUtils.isEmpty(this.b)) {
                    i2.b("ci", this.b);
                }
                if (!TextUtils.isEmpty(this.f16268d)) {
                    i2.b("uai", this.f16268d);
                }
                aVar.a(i2);
                e0.a aVar2 = new e0.a();
                if (this.f16267c != null) {
                    aVar2.a("Authorization", "Bearer " + com.overlook.android.fing.engine.i.a.e(this.f16267c.getBytes(StandardCharsets.UTF_8)));
                }
                aVar2.i(i2.c());
                i0 k = ((e) this.f16266a.A(aVar2.b())).k();
                if (k.x()) {
                    k0 b2 = k.b();
                    if (b2 != null) {
                        byte[] b3 = b2.b();
                        b2.close();
                        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(b3);
                        c b0 = c.b0(byteArrayInputStream);
                        if (b0.P() == c.EnumC0200c.OK) {
                            return q.x(b0, byteArrayInputStream);
                        }
                        if (b0.P() == c.EnumC0200c.AUTHFAIL) {
                            throw NetBoxApiException.g("Auth error", b0.U());
                        } else if (b0.P() == c.EnumC0200c.ACCOUNTEXPIRED) {
                            throw NetBoxApiException.e("Account expired", b0.U());
                        } else if (b0.P() == c.EnumC0200c.NETLIMITHIT) {
                            throw NetBoxApiException.i("Network limit reached", b0.U());
                        } else {
                            throw NetBoxApiException.h("Api error", String.valueOf(b0.P()));
                        }
                    } else {
                        throw new IOException("HTTP response body is empty!");
                    }
                } else {
                    throw new IOException("HTTP response invalid (code=" + k.i() + ",message=" + k.y() + ")");
                }
            } else {
                throw new NetBoxApiException("Invalid endpoint: " + str);
            }
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:39:0x00d4, code lost:
        r0 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:40:0x00d5, code lost:
        if (r4 != null) goto L_0x00d7;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:42:?, code lost:
        r4.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:43:0x00db, code lost:
        r4 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:44:0x00dc, code lost:
        r5.addSuppressed(r4);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:45:0x00df, code lost:
        throw r0;
     */
    private InputStream b(String str, b bVar) throws NetBoxApiException {
        try {
            b0.a aVar = new b0.a();
            aVar.d(b0.f22794g);
            if (!TextUtils.isEmpty(this.b)) {
                aVar.a("ci", this.b);
            }
            if (!TextUtils.isEmpty(this.f16267c)) {
                aVar.a("ct", this.f16267c);
            }
            if (!TextUtils.isEmpty(this.f16268d)) {
                aVar.a("uai", this.f16268d);
            }
            bVar.a(aVar);
            e0.a aVar2 = new e0.a();
            aVar2.h(str);
            aVar2.f(aVar.c());
            i0 k = ((e) this.f16266a.A(aVar2.b())).k();
            if (k.x()) {
                k0 b2 = k.b();
                if (b2 != null) {
                    byte[] b3 = b2.b();
                    b2.close();
                    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(b3);
                    c b0 = c.b0(byteArrayInputStream);
                    if (b0.P() == c.EnumC0200c.OK) {
                        return q.x(b0, byteArrayInputStream);
                    }
                    if (b0.P() == c.EnumC0200c.AUTHFAIL) {
                        throw NetBoxApiException.g("Auth error", b0.U());
                    } else if (b0.P() == c.EnumC0200c.ACCOUNTEXPIRED) {
                        throw NetBoxApiException.e("Account expired", b0.U());
                    } else if (b0.P() == c.EnumC0200c.NETLIMITHIT) {
                        throw NetBoxApiException.i("Network limit reached", b0.U());
                    } else {
                        throw NetBoxApiException.h("Api error", String.valueOf(b0.P()));
                    }
                } else {
                    throw new IOException("HTTP response body is empty!");
                }
            } else {
                throw new IOException("HTTP response invalid (code=" + k.i() + ",message=" + k.y() + ")");
            }
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public InternetSpeedTestRecord A(InternetSpeedTestRecord internetSpeedTestRecord) throws NetBoxApiException {
        try {
            return u9.s((s9) ((com.google.protobuf.c) s9.n).c(b("https://api.fing.io/1/putSpeedTest", new w(u9.t(internetSpeedTestRecord, true)))));
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public i0 B(n0 n0Var, AtomicBoolean atomicBoolean) throws NetBoxApiException {
        try {
            InputStream b2 = b("https://api.fing.io/1/removeNetwork", new f(n0Var));
            atomicBoolean.set(false);
            return u9.C(w6.U(b2));
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public void C(String str, String str2, Node node) throws NetBoxApiException {
        try {
            a0.b d0 = a0.d0();
            d0.D(str);
            d0.E(str2);
            if (node != null) {
                d0.C(u9.I(node));
            }
            b("https://api.fing.io/1/PUTCATALOGUSERHINT", new h(d0));
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public void D(String str, String str2, List<String> list) throws NetBoxApiException {
        try {
            b("https://api.fing.io/1/accountSendMail", new a(str, str2, list));
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public void E(String str) {
        this.f16268d = str;
    }

    public void F(String str) {
        this.b = str;
    }

    public void G(String str) {
        this.f16267c = str;
    }

    public String c() throws NetBoxApiException {
        try {
            return ((x9) ((com.google.protobuf.c) x9.j).c(a("https://api.fing.io/1/getAccessNonce", d.f16243a))).P();
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public i0 d(AtomicBoolean atomicBoolean) throws NetBoxApiException {
        try {
            InputStream a2 = a("https://api.fing.io/1/getNetworks", g.f16255a);
            atomicBoolean.set(false);
            return u9.C(w6.U(a2));
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public p e(n0 n0Var, d1 d1Var, AtomicBoolean atomicBoolean) throws NetBoxApiException {
        try {
            InputStream a2 = a("https://api.fing.io/1/getNetwork", new y(n0Var));
            atomicBoolean.set(false);
            return ((c1) d1Var).a(a2);
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public o0 f(String str, AtomicBoolean atomicBoolean, String str2, String str3) throws NetBoxApiException {
        try {
            InputStream a2 = a("https://api.fing.io/1/getProfile", new q(this, str, str2, str3));
            atomicBoolean.set(false);
            o0 d0 = u9.d0(z9.T1(a2));
            d0.A();
            return d0;
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public o0 g(String str, String str2, String str3, String str4, String str5, String str6, AtomicBoolean atomicBoolean, AtomicReference<String> atomicReference) throws NetBoxApiException {
        Throwable th;
        try {
            try {
                InputStream a2 = a("https://sdkapi.fing.com/1/kitAttach", new v(this, str, str3, str2, null, null, null));
                atomicBoolean.set(false);
                o0 d0 = u9.d0(z9.T1(a2));
                atomicReference.set(d0.f());
                d0.A();
                return d0;
            } catch (NetBoxApiException e2) {
                throw e2;
            } catch (Throwable th2) {
                th = th2;
                throw new NetBoxApiException(th);
            }
        } catch (NetBoxApiException e3) {
            throw e3;
        } catch (Throwable th3) {
            th = th3;
            throw new NetBoxApiException(th);
        }
    }

    public List<d.g.f.b<Node, RecogCatalog>> h(List<Node> list) throws NetBoxApiException {
        Throwable th;
        try {
            w.b L = w.L();
            for (Node node : list) {
                L.z(u9.I(node));
            }
            try {
                x xVar = (x) ((com.google.protobuf.c) x.j).c(b("https://api.fing.io/1/identifyDevices", new u(L)));
                ArrayList arrayList = new ArrayList();
                for (int i2 = 0; i2 < xVar.V(); i2++) {
                    Node H = u9.H(xVar.U(i2));
                    if (H.K() != null) {
                        RecogCatalog recogCatalog = null;
                        DeviceRecognition r = H.r();
                        if (r != null) {
                            if (r.c() != -1) {
                                int i3 = 0;
                                while (true) {
                                    if (i3 >= xVar.a0()) {
                                        break;
                                    }
                                    l0 Y = xVar.Y(i3);
                                    if (Y.P0() && Y.x0() == r.c()) {
                                        recogCatalog = new RecogCatalog();
                                        recogCatalog.f(u9.S(Y));
                                        break;
                                    }
                                    i3++;
                                }
                            }
                            if (r.e() != -1) {
                                int i4 = 0;
                                while (true) {
                                    if (i4 >= xVar.X()) {
                                        break;
                                    }
                                    e.f.a.a.a.k0 W = xVar.W(i4);
                                    if (!W.k1() || W.K0() != r.e()) {
                                        i4++;
                                    } else {
                                        if (recogCatalog == null) {
                                            recogCatalog = new RecogCatalog();
                                        }
                                        recogCatalog.e(u9.R(W));
                                    }
                                }
                            }
                            if (r.h() != -1) {
                                int i5 = 0;
                                while (true) {
                                    if (i5 >= xVar.c0()) {
                                        break;
                                    }
                                    m0 b0 = xVar.b0(i5);
                                    if (!b0.a1() || b0.D0() != r.h()) {
                                        i5++;
                                    } else {
                                        if (recogCatalog == null) {
                                            recogCatalog = new RecogCatalog();
                                        }
                                        recogCatalog.g(u9.T(b0));
                                    }
                                }
                            }
                        }
                        arrayList.add(new d.g.f.b(H, recogCatalog));
                    }
                }
                return arrayList;
            } catch (NetBoxApiException e2) {
                throw e2;
            } catch (Throwable th2) {
                th = th2;
                throw new NetBoxApiException(th);
            }
        } catch (NetBoxApiException e3) {
            throw e3;
        } catch (Throwable th3) {
            th = th3;
            throw new NetBoxApiException(th);
        }
    }

    public p i(n0 n0Var, p pVar, d1 d1Var, String str, String str2) throws NetBoxApiException {
        String str3 = str2 != null ? "https://sdkapi.fing.com/1/kitIdentifyNetwork" : "https://api.fing.io/1/identifyNetwork";
        try {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            c1 c1Var = (c1) d1Var;
            c1Var.d(pVar, byteArrayOutputStream);
            return c1Var.a(b(str3, new p(byteArrayOutputStream, n0Var, str, str2)));
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public RecogCatalog j(DeviceRecognition deviceRecognition) throws NetBoxApiException {
        try {
            k.b u0 = k.u0();
            f0.b O = f0.O();
            O.C(u9.e(deviceRecognition));
            u0.E(O);
            l r0 = l.r0(b("https://api.fing.io/1/disLookup", new c(u0)));
            if (r0.o0()) {
                g0 e0 = r0.e0();
                RecogCatalog recogCatalog = new RecogCatalog();
                if (e0.W()) {
                    recogCatalog.f(u9.S(e0.S()));
                }
                if (e0.V()) {
                    recogCatalog.e(u9.R(e0.P()));
                }
                if (e0.X()) {
                    recogCatalog.g(u9.T(e0.T()));
                }
                if (e0.Y()) {
                    recogCatalog.h(u9.S(e0.U()));
                }
                return recogCatalog;
            }
            throw new NetBoxApiException("Missing recog catalog response");
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public /* synthetic */ void k(String str, String str2, String str3, y.a aVar) {
        aVar.b("cy", "MOBILE");
        aVar.b("cp", "Android " + Build.VERSION.CODENAME + " " + Build.VERSION.RELEASE);
        aVar.b("cv", this.f16269e);
        aVar.b("cn", str);
        aVar.b("ulcc", u.a());
        aVar.b("ullc", u.c());
        if (str2 != null) {
            aVar.b("cnt", "fcm:" + str2);
        } else if (str3 != null) {
            aVar.b("cnt", "hms:" + str3);
        }
    }

    public /* synthetic */ void l(String str, String str2, String str3, String str4, String str5, String str6, y.a aVar) {
        aVar.b("cn", str);
        aVar.b("cy", "MOBILE");
        aVar.b("cp", "Android " + Build.VERSION.CODENAME + " " + Build.VERSION.RELEASE);
        aVar.b("cv", this.f16269e);
        aVar.b("klid", str2);
        aVar.b("u", str3);
        if (str4 != null) {
            aVar.b("kun", str4);
        }
        if (str5 != null) {
            aVar.b("kue", str5);
        }
        if (str6 != null) {
            aVar.b("kwht", str6);
        }
    }

    public /* synthetic */ void m(String str, String str2, String str3, String str4, String str5, y.a aVar) {
        aVar.b("u", str);
        aVar.b("p", str2);
        aVar.b("cy", "MOBILE");
        aVar.b("cp", "Android " + Build.VERSION.CODENAME + " " + Build.VERSION.RELEASE);
        aVar.b("cv", this.f16269e);
        aVar.b("cn", str3);
        aVar.b("ulcc", u.a());
        aVar.b("ullc", u.c());
        if (str4 != null) {
            aVar.b("cnt", "fcm:" + str4);
        } else if (str5 != null) {
            aVar.b("cnt", "hms:" + str5);
        }
    }

    public o0 n(String str, String str2, String str3, AtomicBoolean atomicBoolean, AtomicReference<String> atomicReference, String str4, String str5) throws NetBoxApiException {
        Throwable th;
        try {
            try {
                InputStream a2 = a("https://api.fing.io/1/getProfile", new t(this, str2, str3, str, str4, str5));
                atomicBoolean.set(false);
                o0 d0 = u9.d0(z9.T1(a2));
                atomicReference.set(d0.f());
                d0.A();
                return d0;
            } catch (NetBoxApiException e2) {
                throw e2;
            } catch (Throwable th2) {
                th = th2;
                throw new NetBoxApiException(th);
            }
        } catch (NetBoxApiException e3) {
            throw e3;
        } catch (Throwable th3) {
            th = th3;
            throw new NetBoxApiException(th);
        }
    }

    public FullTextSearchResponse o(String str, int i2) throws NetBoxApiException {
        try {
            k.b u0 = k.u0();
            d0.b a0 = d0.a0();
            a0.C(str);
            a0.D(i2);
            u0.D(a0);
            l r0 = l.r0(b("https://api.fing.io/1/disLookup", new o(u0)));
            if (r0.n0()) {
                e.f.a.a.a.e0 d0 = r0.d0();
                ArrayList arrayList = new ArrayList();
                for (e.f.a.a.a.k0 k0Var : d0.Y()) {
                    arrayList.add(u9.R(k0Var));
                }
                ArrayList arrayList2 = new ArrayList();
                for (l0 l0Var : d0.b0()) {
                    arrayList2.add(u9.S(l0Var));
                }
                ArrayList arrayList3 = new ArrayList();
                for (e.f.a.a.a.k0 k0Var2 : d0.a0()) {
                    arrayList3.add(u9.R(k0Var2));
                }
                FullTextSearchResponse fullTextSearchResponse = new FullTextSearchResponse();
                fullTextSearchResponse.d(arrayList);
                fullTextSearchResponse.f(arrayList2);
                fullTextSearchResponse.e(arrayList3);
                return fullTextSearchResponse;
            }
            throw new NetBoxApiException("Missing full text search response object in DIS response");
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public com.overlook.android.fing.engine.model.catalog.b p() throws NetBoxApiException {
        try {
            k.b u0 = k.u0();
            u0.F(e.f.a.a.a.i0.J());
            l r0 = l.r0(b("https://api.fing.io/1/disLookup", new m(u0)));
            if (r0.p0()) {
                e.f.a.a.a.j0 f0 = r0.f0();
                b.a aVar = new b.a();
                aVar.e(f0.a0());
                aVar.f(f0.b0());
                aVar.i(f0.g0());
                aVar.h(f0.f0());
                aVar.j(f0.i0());
                aVar.g(f0.d0());
                for (Long l : f0.e0()) {
                    aVar.b(l);
                }
                for (h0 h0Var : f0.j0()) {
                    aVar.c(new com.overlook.android.fing.engine.model.catalog.a(h0Var.O(), h0Var.P()));
                }
                for (h0 h0Var2 : f0.c0()) {
                    aVar.a(new com.overlook.android.fing.engine.model.catalog.a(h0Var2.O(), h0Var2.P()));
                }
                return aVar.d();
            }
            throw new NetBoxApiException("Missing catalog stats response object in DIS response");
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public IspLookup q(IspQuery ispQuery) throws NetBoxApiException {
        try {
            c6.b D0 = c6.D0();
            if (ispQuery.f()) {
                d9.b V = d9.V();
                V.D(ispQuery.c());
                V.C(ispQuery.b());
                f9.b T = f9.T();
                T.D(V);
                D0.G(T);
            } else {
                e9.b j0 = e9.j0();
                j0.E(ispQuery.c());
                j0.D(ispQuery.b());
                if (!TextUtils.isEmpty(ispQuery.d())) {
                    j0.G(ispQuery.d());
                }
                if (!TextUtils.isEmpty(ispQuery.a())) {
                    j0.C(ispQuery.a());
                }
                f9.b T2 = f9.T();
                T2.E(j0);
                D0.G(T2);
            }
            if (ispQuery.e() > 0) {
                D0.F(ispQuery.e());
            }
            D0.C(System.currentTimeMillis());
            D0.E(System.currentTimeMillis() - 5184000000L);
            D0.D(true);
            d6 d6Var = (d6) ((com.google.protobuf.c) d6.p).c(b("https://api.fing.io/1/ispLookup", new b(D0)));
            IspLookup ispLookup = new IspLookup();
            if (d6Var.n0()) {
                ispLookup.l(u9.A(d6Var.g0()));
            }
            if (d6Var.o0()) {
                ispLookup.m(u9.w(d6Var.i0()));
            }
            ArrayList arrayList = new ArrayList();
            for (g9 g9Var : d6Var.b0()) {
                arrayList.add(u9.f0(g9Var));
            }
            ispLookup.i(arrayList);
            ArrayList arrayList2 = new ArrayList();
            for (g9 g9Var2 : d6Var.c0()) {
                arrayList2.add(u9.f0(g9Var2));
            }
            ispLookup.j(arrayList2);
            ArrayList arrayList3 = new ArrayList();
            for (a9 a9Var : d6Var.a0()) {
                arrayList3.add(u9.Z(a9Var));
            }
            ispLookup.h(arrayList3);
            if (d6Var.p0()) {
                ispLookup.p(u9.M(d6Var.k0()));
            }
            ArrayList arrayList4 = new ArrayList();
            for (o6 o6Var : d6Var.j0()) {
                arrayList4.add(u9.L(o6Var));
            }
            ispLookup.o(arrayList4);
            ispLookup.n(System.currentTimeMillis());
            return ispLookup;
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public InternetSpeedTestScore r(String str, String str2, String str3, boolean z) throws NetBoxApiException {
        try {
            k.b u0 = k.u0();
            y.b o0 = e.f.a.a.a.y.o0();
            o0.G(z ? u7.c.MOBILE_CELLULAR : u7.c.BOX_MOBILE_WIFI);
            o0.D(str2);
            o0.E(true);
            if (!TextUtils.isEmpty(str3)) {
                o0.C(str3);
            }
            if (!TextUtils.isEmpty(str)) {
                o0.F(str);
            }
            u0.C(o0);
            l r0 = l.r0(b("https://api.fing.io/1/disLookup", new j(u0)));
            if (!r0.l0()) {
                return null;
            }
            z b0 = r0.b0();
            InternetSpeedTestScore internetSpeedTestScore = new InternetSpeedTestScore();
            if (b0.c0()) {
                internetSpeedTestScore.j(u9.w(b0.Y()));
            }
            ArrayList arrayList = new ArrayList();
            for (u7 u7Var : b0.W()) {
                arrayList.add(u9.w(u7Var));
            }
            internetSpeedTestScore.h(arrayList);
            ArrayList arrayList2 = new ArrayList();
            for (u7 u7Var2 : b0.X()) {
                arrayList2.add(u9.w(u7Var2));
            }
            internetSpeedTestScore.i(arrayList2);
            if (b0.a0()) {
                internetSpeedTestScore.f(b0.U());
            }
            if (b0.b0()) {
                internetSpeedTestScore.g(b0.V());
            }
            return internetSpeedTestScore;
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public List<OutageInfo> s() throws NetBoxApiException {
        try {
            i6.b V = i6.V();
            V.D(64);
            V.C(5184000000L);
            InputStream b2 = b("https://api.fing.io/1/getOutages", new r(V));
            ArrayList arrayList = new ArrayList();
            for (o6 o6Var : ((j6) ((com.google.protobuf.c) j6.f20706g).c(b2)).L()) {
                arrayList.add(u9.L(o6Var));
            }
            return arrayList;
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public FullTextSearchResponse t(String str, int i2) throws NetBoxApiException {
        try {
            k.b u0 = k.u0();
            d0.b a0 = d0.a0();
            a0.E(str);
            a0.D(i2);
            u0.D(a0);
            l r0 = l.r0(b("https://api.fing.io/1/disLookup", new l(u0)));
            if (r0.n0()) {
                e.f.a.a.a.e0 d0 = r0.d0();
                ArrayList arrayList = new ArrayList();
                for (m0 m0Var : d0.c0()) {
                    arrayList.add(u9.T(m0Var));
                }
                ArrayList arrayList2 = new ArrayList();
                for (l0 l0Var : d0.b0()) {
                    arrayList2.add(u9.S(l0Var));
                }
                ArrayList arrayList3 = new ArrayList();
                for (m0 m0Var2 : d0.d0()) {
                    arrayList3.add(u9.T(m0Var2));
                }
                FullTextSearchResponse fullTextSearchResponse = new FullTextSearchResponse();
                fullTextSearchResponse.g(arrayList);
                fullTextSearchResponse.f(arrayList2);
                fullTextSearchResponse.h(arrayList3);
                return fullTextSearchResponse;
            }
            throw new NetBoxApiException("Missing full text search response object in DIS response");
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public OutageInfo u(String str) throws NetBoxApiException {
        try {
            e6.b O = e6.O();
            O.C(str);
            f6 f6Var = (f6) ((com.google.protobuf.c) f6.f20277h).c(b("https://api.fing.io/1/outageLookup", new n(O)));
            if (f6Var.M()) {
                return u9.L(f6Var.L());
            }
            return null;
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public OutagesOverview v() throws NetBoxApiException {
        try {
            g6.b T = g6.T();
            T.D(64);
            T.C(5184000000L);
            h6 h6Var = (h6) ((com.google.protobuf.c) h6.j).c(b("https://api.fing.io/1/getOutagesOverview", new s(T)));
            OutagesOverview outagesOverview = new OutagesOverview();
            if (h6Var.T()) {
                outagesOverview.c(u9.K(h6Var.M()));
            }
            if (h6Var.U()) {
                outagesOverview.d(u9.K(h6Var.P()));
            }
            if (h6Var.V()) {
                outagesOverview.e(h6Var.S());
            }
            return outagesOverview;
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public List<UserRating> w(UserRatingsQuery userRatingsQuery) throws NetBoxApiException {
        try {
            InputStream b2 = b("https://api.fing.io/1/getRatings", new k(u9.j(userRatingsQuery)));
            ArrayList arrayList = new ArrayList();
            for (g9 g9Var : ((l6) ((com.google.protobuf.c) l6.f20946g).c(b2)).L()) {
                arrayList.add(u9.f0(g9Var));
            }
            return arrayList;
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public i0 x(n0 n0Var, File file) throws NetBoxApiException {
        try {
            byte[] bArr = new byte[1024];
            FileInputStream fileInputStream = new FileInputStream(file);
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            while (true) {
                int read = fileInputStream.read(bArr, 0, 1024);
                if (-1 != read) {
                    byteArrayOutputStream.write(bArr, 0, read);
                } else {
                    fileInputStream.close();
                    return u9.C(w6.U(b("https://api.fing.io/1/putNetwork", new x(n0Var, byteArrayOutputStream.toByteArray()))));
                }
            }
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public o0 y(o0 o0Var) throws NetBoxApiException {
        try {
            return u9.d0(z9.T1(b("https://api.fing.io/1/putProfile", new e(o0Var))));
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }

    public void z(UserRating userRating) throws NetBoxApiException {
        try {
            b("https://api.fing.io/1/putRating", new i(userRating));
        } catch (NetBoxApiException e2) {
            throw e2;
        } catch (Throwable th) {
            throw new NetBoxApiException(th);
        }
    }
}