package com.ss.android.ugc.aweme.net.monitor;

import X.C23868bx;
import X.C47049Vv;
import X.C47059Vw;
import X.C50229dN;
import X.C51029ef;
import X.C51489fP;
import X.M12;
import com.bytedance.covode.number.Covode;
import com.bytedance.retrofit2.client.Request;
import kotlin.h.b.n;

public final class TTNetMonitorInterceptor implements C23868bx {
    static {
        Covode.recordClassIndex(94772);
    }

    public final C51029ef<?> intercept(C51489fP r6) {
        M12.LIZ(r6);
        C47049Vv<Request, C51029ef<?>> LIZ = C50229dN.LJ.LIZ(new C47049Vv(r6.LIZ(), (C47059Vw) null, 62));
        if (LIZ.LJFF == C47059Vw.INTERCEPT && LIZ.LIZIZ != null) {
            R r = LIZ.LIZIZ;
            if (r == null) {
                n.LIZIZ();
            }
            return (C51029ef) r;
        } else if (LIZ.LJFF != C47059Vw.EXCEPTION || LIZ.LJ == null) {
            Q q = LIZ.LIZ;
            if (q == null) {
                n.LIZIZ();
            }
            LIZ.LIZIZ = r6.LIZ((Request) q);
            C47049Vv<Request, C51029ef<?>> LIZIZ = C50229dN.LJ.LIZIZ(LIZ);
            if (LIZIZ.LJFF != C47059Vw.EXCEPTION || LIZIZ.LJ == null) {
                R r2 = LIZIZ.LIZIZ;
                if (r2 == null) {
                    n.LIZIZ();
                }
                return (C51029ef) r2;
            }
            RuntimeException runtimeException = LIZIZ.LJ;
            if (runtimeException == null) {
                n.LIZIZ();
            }
            throw runtimeException;
        } else {
            RuntimeException runtimeException2 = LIZ.LJ;
            if (runtimeException2 == null) {
                n.LIZIZ();
            }
            throw runtimeException2;
        }
    }
}
