最右.apk(点击下载) / ThirdPartyAPIEngine.java


package cn.xiaochuankeji.xcad.sdk.api;

import cn.xiaochuankeji.xcad.sdk.XcADSdk;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import defpackage.dy5;
import java.util.HashMap;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.TuplesKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.OkHttpClient;

public final class ThirdPartyAPIEngine {
    public static final String NO_HOST;
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: a */
    public final Lazy f15158a = LazyKt__LazyJVMKt.lazy(new ThirdPartyAPIEngine$httpClient$2(this));

    /* renamed from: b */
    public final HashMap<String, dy5> f15159b = MapsKt__MapsKt.hashMapOf(TuplesKt.to("http://no.host", a("http://no.host")));
    public final XcADSdk c;

    public static final class Companion {
        public Companion() {
        }

        public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    static {
        new Companion(null);
    }

    public ThirdPartyAPIEngine(XcADSdk xcADSdk) {
        Intrinsics.checkNotNullParameter(xcADSdk, "sdk");
        this.c = xcADSdk;
    }

    public static /* synthetic */ Object createService$default(ThirdPartyAPIEngine thirdPartyAPIEngine, Class cls, String str, int i, Object obj) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{thirdPartyAPIEngine, cls, str, new Integer(i), obj}, null, changeQuickRedirect, true, 68474, new Class[]{ThirdPartyAPIEngine.class, Class.class, String.class, Integer.TYPE, Object.class}, Object.class);
        if (proxy.isSupported) {
            return proxy.result;
        }
        if ((i & 2) != 0) {
            str = "http://no.host";
        }
        return thirdPartyAPIEngine.createService(cls, str);
    }

    public final dy5 a(String str) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 68472, new Class[]{String.class}, dy5.class);
        if (proxy.isSupported) {
            return (dy5) proxy.result;
        }
        dy5.b bVar = new dy5.b();
        bVar.c(str);
        bVar.g(b());
        bVar.a(vy5.e());
        bVar.b(wy5.a());
        dy5 e = bVar.e();
        Intrinsics.checkNotNullExpressionValue(e, "Retrofit.Builder()\n     …e())\n            .build()");
        return e;
    }

    public final OkHttpClient b() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 68471, new Class[0], OkHttpClient.class);
        return (OkHttpClient) (proxy.isSupported ? proxy.result : this.f15158a.getValue());
    }

    public final <T> T createService(Class<T> cls, String str) {
        T t;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{cls, str}, this, changeQuickRedirect, false, 68473, new Class[]{Class.class, String.class}, Object.class);
        if (proxy.isSupported) {
            return (T) proxy.result;
        }
        Intrinsics.checkNotNullParameter(cls, "serviceClass");
        Intrinsics.checkNotNullParameter(str, "baseUrl");
        dy5 dy5 = this.f15159b.get(str);
        if (dy5 != null && (t = (T) dy5.c(cls)) != null) {
            return t;
        }
        dy5 a2 = a(str);
        this.f15159b.put(str, a2);
        return (T) a2.c(cls);
    }
}