package b0;

import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import rm.n0;
import tp.m0;
import y0.q1;
import y0.s3;
import z.g0;
import z.i0;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class i implements x {

    /* renamed from: a, reason: collision with root package name */
    private final dn.l f6369a;

    /* renamed from: b, reason: collision with root package name */
    private final u f6370b = new b();

    /* renamed from: c, reason: collision with root package name */
    private final i0 f6371c = new i0();

    /* renamed from: d, reason: collision with root package name */
    private final q1 f6372d;

    /* renamed from: e, reason: collision with root package name */
    private final q1 f6373e;

    /* renamed from: f, reason: collision with root package name */
    private final q1 f6374f;

    /* loaded from: classes.dex */
    static final class a extends kotlin.coroutines.jvm.internal.l implements dn.p {

        /* renamed from: p, reason: collision with root package name */
        int f6375p;

        /* renamed from: r, reason: collision with root package name */
        final /* synthetic */ g0 f6377r;

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ dn.p f6378s;

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: b0.i$a$a, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        public static final class C0169a extends kotlin.coroutines.jvm.internal.l implements dn.p {

            /* renamed from: p, reason: collision with root package name */
            int f6379p;

            /* renamed from: q, reason: collision with root package name */
            private /* synthetic */ Object f6380q;

            /* renamed from: r, reason: collision with root package name */
            final /* synthetic */ i f6381r;

            /* renamed from: s, reason: collision with root package name */
            final /* synthetic */ dn.p f6382s;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0169a(i iVar, dn.p pVar, vm.d dVar) {
                super(2, dVar);
                this.f6381r = iVar;
                this.f6382s = pVar;
            }

            @Override // dn.p
            /* renamed from: b, reason: merged with bridge method [inline-methods] */
            public final Object invoke(u uVar, vm.d dVar) {
                return ((C0169a) create(uVar, dVar)).invokeSuspend(n0.f34904a);
            }

            @Override // kotlin.coroutines.jvm.internal.a
            public final vm.d create(Object obj, vm.d dVar) {
                C0169a c0169a = new C0169a(this.f6381r, this.f6382s, dVar);
                c0169a.f6380q = obj;
                return c0169a;
            }

            /* JADX WARN: Multi-variable type inference failed */
            /* JADX WARN: Type inference failed for: r5v6, types: [java.lang.Object, rm.n0] */
            @Override // kotlin.coroutines.jvm.internal.a
            public final Object invokeSuspend(Object obj) {
                Object f10;
                f10 = wm.d.f();
                int i10 = this.f6379p;
                try {
                    if (i10 == 0) {
                        rm.y.b(obj);
                        u uVar = (u) this.f6380q;
                        this.f6381r.f6372d.setValue(kotlin.coroutines.jvm.internal.b.a(true));
                        dn.p pVar = this.f6382s;
                        this.f6379p = 1;
                        if (pVar.invoke(uVar, this) == f10) {
                            return f10;
                        }
                    } else {
                        if (i10 != 1) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        rm.y.b(obj);
                    }
                    this.f6381r.f6372d.setValue(kotlin.coroutines.jvm.internal.b.a(false));
                    this = n0.f34904a;
                    return this;
                } catch (Throwable th2) {
                    this.f6381r.f6372d.setValue(kotlin.coroutines.jvm.internal.b.a(false));
                    throw th2;
                }
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(g0 g0Var, dn.p pVar, vm.d dVar) {
            super(2, dVar);
            this.f6377r = g0Var;
            this.f6378s = pVar;
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            return new a(this.f6377r, this.f6378s, dVar);
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            f10 = wm.d.f();
            int i10 = this.f6375p;
            if (i10 == 0) {
                rm.y.b(obj);
                i0 i0Var = i.this.f6371c;
                u uVar = i.this.f6370b;
                g0 g0Var = this.f6377r;
                C0169a c0169a = new C0169a(i.this, this.f6378s, null);
                this.f6375p = 1;
                if (i0Var.d(uVar, g0Var, c0169a, this) == f10) {
                    return f10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                rm.y.b(obj);
            }
            return n0.f34904a;
        }

        @Override // dn.p
        public final Object invoke(m0 m0Var, vm.d dVar) {
            return ((a) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
        }
    }

    /* loaded from: classes.dex */
    public static final class b implements u {
        b() {
        }

        @Override // b0.u
        public float a(float f10) {
            if (Float.isNaN(f10)) {
                return BitmapDescriptorFactory.HUE_RED;
            }
            float floatValue = ((Number) i.this.l().invoke(Float.valueOf(f10))).floatValue();
            i.this.f6373e.setValue(Boolean.valueOf(floatValue > BitmapDescriptorFactory.HUE_RED));
            i.this.f6374f.setValue(Boolean.valueOf(floatValue < BitmapDescriptorFactory.HUE_RED));
            return floatValue;
        }
    }

    public i(dn.l lVar) {
        q1 d10;
        q1 d11;
        q1 d12;
        this.f6369a = lVar;
        Boolean bool = Boolean.FALSE;
        d10 = s3.d(bool, null, 2, null);
        this.f6372d = d10;
        d11 = s3.d(bool, null, 2, null);
        this.f6373e = d11;
        d12 = s3.d(bool, null, 2, null);
        this.f6374f = d12;
    }

    @Override // b0.x
    public boolean a() {
        return ((Boolean) this.f6372d.getValue()).booleanValue();
    }

    @Override // b0.x
    public Object d(g0 g0Var, dn.p pVar, vm.d dVar) {
        Object f10;
        Object f11 = tp.n0.f(new a(g0Var, pVar, null), dVar);
        f10 = wm.d.f();
        return f11 == f10 ? f11 : n0.f34904a;
    }

    @Override // b0.x
    public float f(float f10) {
        return ((Number) this.f6369a.invoke(Float.valueOf(f10))).floatValue();
    }

    public final dn.l l() {
        return this.f6369a;
    }
}
