package g.a.n2;

import g.a.y1;
import java.util.Iterator;
import java.util.List;

/* JADX INFO: compiled from: MainDispatchers.kt */
/* JADX INFO: loaded from: classes.dex */
public final class t {
    public static final t a = new t();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private static final boolean f4099b = c0.e("kotlinx.coroutines.fast.service.loader", true);

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final y1 f4100c = a.a();

    private t() {
    }

    private final y1 a() {
        Object next;
        y1 y1VarE;
        try {
            List<s> listC = f4099b ? j.a.c() : f.d0.h.e(f.d0.f.a(defpackage.a.b()));
            Iterator<T> it = listC.iterator();
            if (it.hasNext()) {
                next = it.next();
                if (it.hasNext()) {
                    int loadPriority = ((s) next).getLoadPriority();
                    do {
                        Object next2 = it.next();
                        int loadPriority2 = ((s) next2).getLoadPriority();
                        if (loadPriority < loadPriority2) {
                            next = next2;
                            loadPriority = loadPriority2;
                        }
                    } while (it.hasNext());
                }
            } else {
                next = null;
            }
            s sVar = (s) next;
            return (sVar == null || (y1VarE = u.e(sVar, listC)) == null) ? u.b(null, null, 3, null) : y1VarE;
        } catch (Throwable th) {
            return u.b(th, null, 2, null);
        }
    }
}
