得物.apk(点击下载) / a.java


package ku;

import bj1.e;
import com.liulishuo.okdownload.core.cause.EndCause;
import com.liulishuo.okdownload.core.cause.ResumeFailedCause;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.ObservableSource;
import io.reactivex.schedulers.Schedulers;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt__IterablesKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import s9.c;

/* compiled from: PublishDownloadUtils.kt */
public final class a {
    @NotNull

    /* renamed from: a  reason: collision with root package name */
    public static final a f34913a = new a();
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: ku.a$a  reason: collision with other inner class name */
    /* compiled from: PublishDownloadUtils.kt */
    public static final class C0540a<T> implements ObservableOnSubscribe<String> {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ String f34914a;

        /* renamed from: ku.a$a$a  reason: collision with other inner class name */
        /* compiled from: PumpExtension.kt */
        public static final class C0541a extends vl.a {
            public static ChangeQuickRedirect changeQuickRedirect;

            /* renamed from: a  reason: collision with root package name */
            public final /* synthetic */ ObservableEmitter f34915a;
            public final /* synthetic */ ObservableEmitter b;

            public C0541a(ObservableEmitter observableEmitter, ObservableEmitter observableEmitter2) {
                this.f34915a = observableEmitter;
                this.b = observableEmitter2;
            }

            @Override // com.liulishuo.okdownload.core.listener.assist.Listener1Assist.Listener1Callback, vl.a
            public void connected(@NotNull c cVar, int i, long j, long j12) {
                Object[] objArr = {cVar, new Integer(i), new Long(j), new Long(j12)};
                ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
                Class cls = Long.TYPE;
                if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 49624, new Class[]{c.class, Integer.TYPE, cls, cls}, Void.TYPE).isSupported) {
                    super.connected(cVar, i, j, j12);
                }
            }

            /* JADX DEBUG: Multi-variable search result rejected for r10v2, resolved type: io.reactivex.ObservableEmitter */
            /* JADX WARN: Multi-variable type inference failed */
            @Override // vl.a
            public void onTaskEnd(@NotNull c cVar, @NotNull EndCause endCause, @Nullable Exception exc) {
                if (!PatchProxy.proxy(new Object[]{cVar, endCause, exc}, this, changeQuickRedirect, false, 49625, new Class[]{c.class, EndCause.class, Exception.class}, Void.TYPE).isSupported) {
                    if (endCause == EndCause.COMPLETED) {
                        ObservableEmitter observableEmitter = this.f34915a;
                        File i = cVar.i();
                        String path = i != null ? i.getPath() : null;
                        if (path == null) {
                            path = "";
                        }
                        observableEmitter.onNext(path);
                        this.f34915a.onComplete();
                    } else if (!this.b.isDisposed()) {
                        this.b.onError(new Exception(endCause.name()));
                    }
                }
            }

            @Override // vl.a
            public void onTaskStart(@NotNull c cVar) {
                boolean z = PatchProxy.proxy(new Object[]{cVar}, this, changeQuickRedirect, false, 49622, new Class[]{c.class}, Void.TYPE).isSupported;
            }

            @Override // vl.a
            public void progress(@NotNull c cVar, float f, long j, long j12) {
                Object[] objArr = {cVar, new Float(f), new Long(j), new Long(j12)};
                ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
                Class cls = Long.TYPE;
                if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 49626, new Class[]{c.class, Float.TYPE, cls, cls}, Void.TYPE).isSupported) {
                    super.progress(cVar, f, j, j12);
                }
            }

            @Override // com.liulishuo.okdownload.core.listener.assist.Listener1Assist.Listener1Callback, vl.a
            public void retry(@NotNull c cVar, @NotNull ResumeFailedCause resumeFailedCause) {
                if (!PatchProxy.proxy(new Object[]{cVar, resumeFailedCause}, this, changeQuickRedirect, false, 49623, new Class[]{c.class, ResumeFailedCause.class}, Void.TYPE).isSupported) {
                    super.retry(cVar, resumeFailedCause);
                }
            }
        }

        public C0540a(String str) {
            this.f34914a = str;
        }

        @Override // io.reactivex.ObservableOnSubscribe
        public final void subscribe(@NotNull ObservableEmitter<String> observableEmitter) {
            if (!PatchProxy.proxy(new Object[]{observableEmitter}, this, changeQuickRedirect, false, 49621, new Class[]{ObservableEmitter.class}, Void.TYPE).isSupported) {
                tl.a.r(this.f34914a, null, null, new C0541a(observableEmitter, observableEmitter));
            }
        }
    }

    public static /* synthetic */ List c(a aVar, String str, String str2, String str3, int i) {
        if ((i & 2) != 0) {
            str2 = null;
        }
        return aVar.b(str, str2, null);
    }

    @NotNull
    public final e<List<String>> a(@NotNull List<String> list) {
        e eVar;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{list}, this, changeQuickRedirect, false, 49609, new Class[]{List.class}, e.class);
        if (proxy.isSupported) {
            return (e) proxy.result;
        }
        if (list.isEmpty()) {
            return e.empty();
        }
        ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(list, 10));
        for (T t : list) {
            a aVar = f34913a;
            if (aVar.d(t)) {
                eVar = e.just(aVar.g(t));
            } else {
                eVar = e.create(new C0540a(t)).subscribeOn(Schedulers.io());
            }
            arrayList.add(eVar);
        }
        e[] eVarArr = (e[]) arrayList.toArray(new e[0]);
        return e.mergeArrayDelayError((ObservableSource[]) Arrays.copyOf(eVarArr, eVarArr.length)).toList().e();
    }

    @NotNull
    public final List<String> b(@NotNull String str, @Nullable String str2, @Nullable String str3) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, str2, str3}, this, changeQuickRedirect, false, 49614, new Class[]{String.class, String.class, String.class}, List.class);
        if (proxy.isSupported) {
            return (List) proxy.result;
        }
        String[] strArr = new String[5];
        strArr[0] = "https://cdn.poizon.com/node-common/b7de77d19e74232e84e26c816c56af18.ttf";
        strArr[1] = "https://cdn.poizon.com/node-common/ef524a633553b91eaa2094647903c447.ttf";
        strArr[2] = str;
        if (str2 == null) {
            str2 = "";
        }
        strArr[3] = str2;
        if (str3 == null) {
            str3 = "";
        }
        strArr[4] = str3;
        ArrayList arrayListOf = CollectionsKt__CollectionsKt.arrayListOf(strArr);
        ArrayList arrayList = new ArrayList();
        for (Object obj : arrayListOf) {
            String str4 = (String) obj;
            if (!(str4 == null || str4.length() == 0)) {
                arrayList.add(obj);
            }
        }
        return arrayList;
    }

    public final boolean d(@NotNull String str) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 49612, new Class[]{String.class}, Boolean.TYPE);
        return proxy.isSupported ? ((Boolean) proxy.result).booleanValue() : tl.a.x(str);
    }

    public final boolean e(@NotNull List<String> list) {
        T t;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{list}, this, changeQuickRedirect, false, 49613, new Class[]{List.class}, Boolean.TYPE);
        if (proxy.isSupported) {
            return ((Boolean) proxy.result).booleanValue();
        }
        Iterator<T> it2 = list.iterator();
        while (true) {
            if (!it2.hasNext()) {
                t = null;
                break;
            }
            t = it2.next();
            if (!f34913a.d(t)) {
                break;
            }
        }
        if (t == null) {
            return true;
        }
        return false;
    }

    @Nullable
    public final File f(@NotNull String str) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 49611, new Class[]{String.class}, File.class);
        return proxy.isSupported ? (File) proxy.result : tl.a.t(str);
    }

    @NotNull
    public final String g(@NotNull String str) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 49610, new Class[]{String.class}, String.class);
        if (proxy.isSupported) {
            return (String) proxy.result;
        }
        File f = f(str);
        String path = f != null ? f.getPath() : null;
        return path != null ? path : "";
    }
}