package g.a.n2;

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

/* JADX INFO: compiled from: MainDispatchers.kt */
/* JADX INFO: loaded from: classes.dex */
public final class u {
    private static final boolean a = true;

    private static final v a(Throwable th, String str) throws Throwable {
        if (a) {
            return new v(th, str);
        }
        if (th != null) {
            throw th;
        }
        d();
        throw null;
    }

    static /* synthetic */ v b(Throwable th, String str, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            th = null;
        }
        if ((i2 & 2) != 0) {
            str = null;
        }
        return a(th, str);
    }

    public static final boolean c(y1 y1Var) {
        return y1Var.B() instanceof v;
    }

    public static final Void d() {
        throw new IllegalStateException("Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'");
    }

    public static final y1 e(s sVar, List<? extends s> list) {
        try {
            return sVar.createDispatcher(list);
        } catch (Throwable th) {
            return a(th, sVar.hintOnError());
        }
    }
}
