package kotlinx.coroutines;

import io.netty.util.internal.StringUtil;

/* JADX INFO: compiled from: AbstractCoroutine.kt */
/* JADX INFO: loaded from: classes.dex */
public abstract class c<T> extends z1 implements s1, h.u.d<T>, n0 {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private final h.u.g f1074e;

    public c(h.u.g gVar, boolean z, boolean z2) {
        super(z2);
        if (z) {
            a0((s1) gVar.b(s1.f1166d));
        }
        this.f1074e = gVar.j(this);
    }

    protected void D0(Object obj) {
        w(obj);
    }

    protected void E0(Throwable th, boolean z) {
    }

    protected void F0(T t) {
    }

    public final <R> void G0(p0 p0Var, R r, h.x.c.p<? super R, ? super h.u.d<? super T>, ? extends Object> pVar) throws Throwable {
        p0Var.invoke(pVar, r, this);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // kotlinx.coroutines.z1
    public String K() {
        return h.x.d.k.i(s0.a(this), " was cancelled");
    }

    @Override // kotlinx.coroutines.z1
    public final void Z(Throwable th) {
        k0.a(this.f1074e, th);
    }

    @Override // kotlinx.coroutines.n0
    public h.u.g f() {
        return this.f1074e;
    }

    @Override // h.u.d
    public final void g(Object obj) {
        Object objG0 = g0(f0.d(obj, null, 1, null));
        if (objG0 == a2.b) {
            return;
        }
        D0(objG0);
    }

    @Override // h.u.d
    public final h.u.g getContext() {
        return this.f1074e;
    }

    @Override // kotlinx.coroutines.z1
    public String i0() {
        String strB = h0.b(this.f1074e);
        if (strB == null) {
            return super.i0();
        }
        return StringUtil.DOUBLE_QUOTE + strB + "\":" + super.i0();
    }

    @Override // kotlinx.coroutines.z1, kotlinx.coroutines.s1
    public boolean isActive() {
        return super.isActive();
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // kotlinx.coroutines.z1
    protected final void n0(Object obj) {
        if (!(obj instanceof b0)) {
            F0(obj);
        } else {
            b0 b0Var = (b0) obj;
            E0(b0Var.a, b0Var.a());
        }
    }
}
