package p025.p026;

import java.util.concurrent.CancellationException;
import kotlin.TypeCastException;
import p025.p026.p027.C1273;
import p025.p026.p030.AbstractRunnableC1430;
import p025.p026.p030.InterfaceC1431;
import p138.p176.p177.p242.p246.p251.C4303;
import p402.C6542;
import p402.C6549;
import p402.p405.InterfaceC6575;
import p402.p405.InterfaceC6578;
import p402.p411.p413.C6635;

/* JADX INFO: renamed from: އ.֏.ޡ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC1339<T> extends AbstractRunnableC1430 {

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public int f4486;

    public AbstractC1339(int i) {
        this.f4486 = i;
    }

    @Override // java.lang.Runnable
    public final void run() {
        Object objM7010;
        Object objM70102;
        InterfaceC1431 interfaceC1431 = this.f4620;
        try {
            InterfaceC6575<T> interfaceC6575Mo2632 = mo2632();
            if (interfaceC6575Mo2632 == null) {
                throw new TypeCastException("null cannot be cast to non-null type kotlinx.coroutines.DispatchedContinuation<T>");
            }
            C1336 c1336 = (C1336) interfaceC6575Mo2632;
            InterfaceC6575<T> interfaceC6575 = c1336.f4482;
            InterfaceC6578 interfaceC6578Mo2607 = interfaceC6575.mo2607();
            Object objMo2633 = mo2633();
            Object objM2563 = C1273.m2563(interfaceC6578Mo2607, c1336.f4480);
            try {
                C1318 c1318 = (C1318) (!(objMo2633 instanceof C1318) ? null : objMo2633);
                Throwable th = c1318 != null ? c1318.f4456 : null;
                InterfaceC1363 interfaceC1363 = C4303.m7169(this.f4486) ? (InterfaceC1363) interfaceC6578Mo2607.get(InterfaceC1363.f4514) : null;
                if (th == null && interfaceC1363 != null && !interfaceC1363.mo2610()) {
                    CancellationException cancellationExceptionMo2686 = interfaceC1363.mo2686();
                    mo2629(objMo2633, cancellationExceptionMo2686);
                    C6542.C6543 c6543 = C6542.f19318;
                    interfaceC6575.mo2608(C4303.m7010((Throwable) cancellationExceptionMo2686));
                } else if (th != null) {
                    C6542.C6543 c65432 = C6542.f19318;
                    interfaceC6575.mo2608(C4303.m7010(th));
                } else {
                    T tMo2631 = mo2631(objMo2633);
                    C6542.C6543 c65433 = C6542.f19318;
                    interfaceC6575.mo2608(tMo2631);
                }
                try {
                    C6542.C6543 c65434 = C6542.f19318;
                    interfaceC1431.mo2770();
                    objM70102 = C6549.f19328;
                } catch (Throwable th2) {
                    C6542.C6543 c65435 = C6542.f19318;
                    objM70102 = C4303.m7010(th2);
                }
                m2664((Throwable) null, C6542.m9768(objM70102));
            } finally {
                C1273.m2562(interfaceC6578Mo2607, objM2563);
            }
        } catch (Throwable th3) {
            try {
                C6542.C6543 c65436 = C6542.f19318;
                interfaceC1431.mo2770();
                objM7010 = C6549.f19328;
                C6542.m9767(objM7010);
            } catch (Throwable th4) {
                C6542.C6543 c65437 = C6542.f19318;
                objM7010 = C4303.m7010(th4);
            }
            m2664(th3, C6542.m9768(objM7010));
        }
    }

    /* JADX INFO: renamed from: ֏ */
    public void mo2629(Object obj, Throwable th) {
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m2664(Throwable th, Throwable th2) {
        if (th == null && th2 == null) {
            return;
        }
        if (th != null && th2 != null) {
            C4303.m7093(th, th2);
        }
        if (th == null) {
            th = th2;
        }
        String str = "Fatal exception in coroutines machinery for " + this + ". Please read KDoc to 'handleFatalException' method and report this incident to maintainers";
        if (th == null) {
            C6635.m9822();
            throw null;
        }
        C4303.m7111(mo2632().mo2607(), (Throwable) new C1329(str, th));
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX INFO: renamed from: ؠ */
    public <T> T mo2631(Object obj) {
        return obj;
    }

    /* JADX INFO: renamed from: ؠ */
    public abstract InterfaceC6575<T> mo2632();

    /* JADX INFO: renamed from: ހ */
    public abstract Object mo2633();
}
