package o;

import com.google.android.gms.common.R;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Qm0 implements InterfaceC0399Pk, InterfaceC0707aL {
    public final C2207q3 l;
    public final C0555Vk m;
    public boolean n;

    /* renamed from: o, reason: collision with root package name */
    public WK f300o;
    public SC p = AbstractC2456sk.a;

    public Qm0(C2207q3 c2207q3, C0555Vk c0555Vk) {
        this.l = c2207q3;
        this.m = c0555Vk;
    }

    public final void a() {
        if (!this.n) {
            this.n = true;
            this.l.getView().setTag(R.id.wrapped_composition_tag, null);
            WK wk = this.f300o;
            if (wk != null) {
                wk.c(this);
            }
        }
        C0555Vk c0555Vk = this.m;
        synchronized (c0555Vk.f385o) {
            try {
                if (c0555Vk.E.E) {
                    AbstractC1102eY.b("Composition is disposed while composing. If dispose is triggered by a call in @Composable function, consider wrapping it with SideEffect block.");
                }
                if (c0555Vk.F != 3) {
                    c0555Vk.F = 3;
                    C0554Vj c0554Vj = AbstractC0742ak.b;
                    C0603Xg c0603Xg = c0555Vk.E.K;
                    if (c0603Xg != null) {
                        c0555Vk.e(c0603Xg);
                    }
                    boolean z = c0555Vk.q.m > 0;
                    if (z || !c0555Vk.p.l.g()) {
                        C0312Mb c0312Mb = c0555Vk.D;
                        try {
                            c0312Mb.k(c0555Vk.p, c0555Vk.E.y());
                            if (z) {
                                C1365h90 c1365h90D = c0555Vk.q.d();
                                try {
                                    AbstractC0373Ok.f(c1365h90D, c0555Vk.D);
                                    c1365h90D.e(true);
                                    c0555Vk.m.j();
                                    c0555Vk.m.s();
                                    c0312Mb.h();
                                } catch (Throwable th) {
                                    c1365h90D.e(false);
                                    throw th;
                                }
                            }
                            c0312Mb.g();
                            c0312Mb.d();
                        } catch (Throwable th2) {
                            c0312Mb.d();
                            throw th2;
                        }
                    }
                    c0555Vk.E.n();
                }
            } catch (Throwable th3) {
                throw th3;
            }
        }
        c0555Vk.l.q(c0555Vk);
    }

    public final void e(SC sc) {
        this.l.setOnViewTreeOwnersAvailable(new K3(17, this, sc));
    }

    @Override // o.InterfaceC0707aL
    public final void f(InterfaceC0898cL interfaceC0898cL, UK uk) {
        if (uk == UK.ON_DESTROY) {
            a();
        } else {
            if (uk != UK.ON_CREATE || this.n) {
                return;
            }
            e(this.p);
        }
    }
}
