package O3;

import B0.I;
import P2.C0253j;
import P2.w;
import android.content.Context;
import android.content.res.TypedArray;
import android.view.View;
import androidx.lifecycle.EnumC0510o;
import androidx.lifecycle.InterfaceC0515u;
import com.google.crypto.tink.shaded.protobuf.AbstractC0735a;
import com.google.crypto.tink.shaded.protobuf.AbstractC0742h;
import d3.B0;
import d3.C0815q0;
import d3.C0817r0;
import d3.Z;
import d5.AbstractC0844a;
import h0.b0;
import java.util.Collections;
import java.util.Map;
import u0.M;
import u0.Q;
import u0.S;
import v2.C1673c;

/* JADX INFO: loaded from: classes.dex */
public abstract class e implements B0, M {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final Object f5146q;

    public void A() {
        int iE;
        int iE2;
        I i = (I) this;
        if (i.O().p() || i.W()) {
            n();
            return;
        }
        S sO = i.O();
        if (sO.p()) {
            iE = -1;
        } else {
            int iL = i.L();
            i.p0();
            int i5 = i.f550W;
            if (i5 == 1) {
                i5 = 0;
            }
            i.p0();
            iE = sO.e(iL, i5, i.X);
        }
        if (!(iE != -1)) {
            if (q() && p()) {
                z(i.L(), -9223372036854775807L, false);
                return;
            } else {
                n();
                return;
            }
        }
        S sO2 = i.O();
        if (sO2.p()) {
            iE2 = -1;
        } else {
            int iL2 = i.L();
            i.p0();
            int i8 = i.f550W;
            if (i8 == 1) {
                i8 = 0;
            }
            i.p0();
            iE2 = sO2.e(iL2, i8, i.X);
        }
        if (iE2 == -1) {
            n();
        } else if (iE2 == i.L()) {
            z(i.L(), -9223372036854775807L, true);
        } else {
            z(iE2, -9223372036854775807L, false);
        }
    }

    public void B(long j8, int i) {
        I i5 = (I) this;
        long jM = i5.M() + j8;
        long jR = i5.R();
        if (jR != -9223372036854775807L) {
            jM = Math.min(jM, jR);
        }
        z(i5.L(), Math.max(jM, 0L), false);
    }

    public void C() {
        int iK;
        int iK2;
        int iK3;
        I i = (I) this;
        if (i.O().p() || i.W()) {
            n();
            return;
        }
        S sO = i.O();
        if (sO.p()) {
            iK = -1;
        } else {
            int iL = i.L();
            i.p0();
            int i5 = i.f550W;
            if (i5 == 1) {
                i5 = 0;
            }
            i.p0();
            iK = sO.k(iL, i5, i.X);
        }
        boolean z8 = iK != -1;
        if (q() && !r()) {
            if (!z8) {
                n();
                return;
            }
            S sO2 = i.O();
            if (sO2.p()) {
                iK3 = -1;
            } else {
                int iL2 = i.L();
                i.p0();
                int i8 = i.f550W;
                if (i8 == 1) {
                    i8 = 0;
                }
                i.p0();
                iK3 = sO2.k(iL2, i8, i.X);
            }
            if (iK3 == -1) {
                n();
                return;
            } else if (iK3 == i.L()) {
                z(i.L(), -9223372036854775807L, true);
                return;
            } else {
                z(iK3, -9223372036854775807L, false);
                return;
            }
        }
        if (z8) {
            long jM = i.M();
            i.p0();
            if (jM <= i.f541N) {
                S sO3 = i.O();
                if (sO3.p()) {
                    iK2 = -1;
                } else {
                    int iL3 = i.L();
                    i.p0();
                    int i9 = i.f550W;
                    if (i9 == 1) {
                        i9 = 0;
                    }
                    i.p0();
                    iK2 = sO3.k(iL3, i9, i.X);
                }
                if (iK2 == -1) {
                    n();
                    return;
                } else if (iK2 == i.L()) {
                    z(i.L(), -9223372036854775807L, true);
                    return;
                } else {
                    z(iK2, -9223372036854775807L, false);
                    return;
                }
            }
        }
        z(i.L(), 0L, false);
    }

    public abstract void D(AbstractC0735a abstractC0735a);

    public void E() {
        C0815q0 c0815q0 = ((C0817r0) this.f5146q).f12151z;
        C0817r0.k(c0815q0);
        c0815q0.E();
    }

    @Override // d3.B0
    public Context a() {
        throw null;
    }

    @Override // d3.B0
    public C0253j b() {
        throw null;
    }

    @Override // d3.B0
    public C0815q0 c() {
        throw null;
    }

    @Override // d3.B0
    public T2.a d() {
        throw null;
    }

    @Override // d3.B0
    public Z e() {
        throw null;
    }

    public abstract void f(InterfaceC0515u interfaceC0515u);

    public C1673c g() {
        C1673c c1673c = (C1673c) this.f5146q;
        int i = c1673c.f18076f;
        int[] iArr = c1673c.f18072b;
        if (i != 1) {
            int i5 = c1673c.f18075e;
            iArr[0] = i5;
            int i8 = c1673c.f18074d;
            iArr[1] = i8;
            iArr[2] = i8;
            iArr[3] = i5;
        } else {
            int i9 = c1673c.f18074d;
            iArr[0] = i9;
            iArr[1] = i9;
            int i10 = c1673c.f18075e;
            iArr[2] = i10;
            iArr[3] = i10;
        }
        float[] fArr = c1673c.f18071a;
        if (i != 1) {
            fArr[0] = Math.max(((1.0f - c1673c.f18080k) - c1673c.f18081l) / 2.0f, 0.0f);
            fArr[1] = Math.max(((1.0f - c1673c.f18080k) - 0.001f) / 2.0f, 0.0f);
            fArr[2] = Math.min(((c1673c.f18080k + 1.0f) + 0.001f) / 2.0f, 1.0f);
            fArr[3] = Math.min(((c1673c.f18080k + 1.0f) + c1673c.f18081l) / 2.0f, 1.0f);
            return c1673c;
        }
        fArr[0] = 0.0f;
        fArr[1] = Math.min(c1673c.f18080k, 1.0f);
        fArr[2] = Math.min(c1673c.f18080k + c1673c.f18081l, 1.0f);
        fArr[3] = 1.0f;
        return c1673c;
    }

    public e h(TypedArray typedArray) {
        boolean zHasValue = typedArray.hasValue(3);
        C1673c c1673c = (C1673c) this.f5146q;
        if (zHasValue) {
            c1673c.f18083n = typedArray.getBoolean(3, c1673c.f18083n);
        }
        if (typedArray.hasValue(0)) {
            c1673c.f18084o = typedArray.getBoolean(0, c1673c.f18084o);
        }
        if (typedArray.hasValue(1)) {
            c1673c.f18075e = (((int) (Math.min(1.0f, Math.max(0.0f, typedArray.getFloat(1, 0.3f))) * 255.0f)) << 24) | (c1673c.f18075e & 16777215);
        }
        if (typedArray.hasValue(11)) {
            c1673c.f18074d = (((int) (Math.min(1.0f, Math.max(0.0f, typedArray.getFloat(11, 1.0f))) * 255.0f)) << 24) | (c1673c.f18074d & 16777215);
        }
        if (typedArray.hasValue(7)) {
            long j8 = typedArray.getInt(7, (int) c1673c.f18088s);
            if (j8 < 0) {
                throw new IllegalArgumentException(AbstractC0844a.i(j8, "Given a negative duration: "));
            }
            c1673c.f18088s = j8;
        }
        if (typedArray.hasValue(14)) {
            c1673c.f18086q = typedArray.getInt(14, c1673c.f18086q);
        }
        if (typedArray.hasValue(15)) {
            long j9 = typedArray.getInt(15, (int) c1673c.f18089t);
            if (j9 < 0) {
                throw new IllegalArgumentException(AbstractC0844a.i(j9, "Given a negative repeat delay: "));
            }
            c1673c.f18089t = j9;
        }
        if (typedArray.hasValue(16)) {
            c1673c.f18087r = typedArray.getInt(16, c1673c.f18087r);
        }
        if (typedArray.hasValue(5)) {
            int i = typedArray.getInt(5, c1673c.f18073c);
            if (i == 1) {
                c1673c.f18073c = 1;
            } else if (i == 2) {
                c1673c.f18073c = 2;
            } else if (i != 3) {
                c1673c.f18073c = 0;
            } else {
                c1673c.f18073c = 3;
            }
        }
        if (typedArray.hasValue(17)) {
            if (typedArray.getInt(17, c1673c.f18076f) != 1) {
                c1673c.f18076f = 0;
            } else {
                c1673c.f18076f = 1;
            }
        }
        if (typedArray.hasValue(6)) {
            float f3 = typedArray.getFloat(6, c1673c.f18081l);
            if (f3 < 0.0f) {
                throw new IllegalArgumentException("Given invalid dropoff value: " + f3);
            }
            c1673c.f18081l = f3;
        }
        if (typedArray.hasValue(9)) {
            int dimensionPixelSize = typedArray.getDimensionPixelSize(9, c1673c.f18077g);
            if (dimensionPixelSize < 0) {
                throw new IllegalArgumentException(AbstractC0844a.j("Given invalid width: ", dimensionPixelSize));
            }
            c1673c.f18077g = dimensionPixelSize;
        }
        if (typedArray.hasValue(8)) {
            int dimensionPixelSize2 = typedArray.getDimensionPixelSize(8, c1673c.f18078h);
            if (dimensionPixelSize2 < 0) {
                throw new IllegalArgumentException(AbstractC0844a.j("Given invalid height: ", dimensionPixelSize2));
            }
            c1673c.f18078h = dimensionPixelSize2;
        }
        if (typedArray.hasValue(13)) {
            float f7 = typedArray.getFloat(13, c1673c.f18080k);
            if (f7 < 0.0f) {
                throw new IllegalArgumentException("Given invalid intensity value: " + f7);
            }
            c1673c.f18080k = f7;
        }
        if (typedArray.hasValue(19)) {
            float f8 = typedArray.getFloat(19, c1673c.i);
            if (f8 < 0.0f) {
                throw new IllegalArgumentException("Given invalid width ratio: " + f8);
            }
            c1673c.i = f8;
        }
        if (typedArray.hasValue(10)) {
            float f9 = typedArray.getFloat(10, c1673c.f18079j);
            if (f9 < 0.0f) {
                throw new IllegalArgumentException("Given invalid height ratio: " + f9);
            }
            c1673c.f18079j = f9;
        }
        if (typedArray.hasValue(18)) {
            c1673c.f18082m = typedArray.getFloat(18, c1673c.f18082m);
        }
        return m();
    }

    public abstract AbstractC0735a i(AbstractC0735a abstractC0735a);

    public long j() {
        I i = (I) this;
        S sO = i.O();
        if (sO.p()) {
            return -9223372036854775807L;
        }
        return x0.v.W(sO.m(i.L(), (Q) this.f5146q, 0L).f17195m);
    }

    public abstract EnumC0510o l();

    public abstract e m();

    public void n() {
        ((I) this).p0();
    }

    public boolean o(int i) {
        I i5 = (I) this;
        i5.p0();
        return i5.f557e0.f17162a.f17298a.get(i);
    }

    public boolean p() {
        I i = (I) this;
        S sO = i.O();
        return !sO.p() && sO.m(i.L(), (Q) this.f5146q, 0L).i;
    }

    public boolean q() {
        I i = (I) this;
        S sO = i.O();
        return !sO.p() && sO.m(i.L(), (Q) this.f5146q, 0L).a();
    }

    public boolean r() {
        I i = (I) this;
        S sO = i.O();
        return !sO.p() && sO.m(i.L(), (Q) this.f5146q, 0L).f17191h;
    }

    public boolean s() {
        I i = (I) this;
        if (i.T() != 3 || !i.S()) {
            return false;
        }
        i.p0();
        return i.f580w0.f827n == 0;
    }

    public boolean t() {
        int i;
        b0 b0Var = (b0) this.f5146q;
        View view = b0Var.f13181c.X;
        if (view != null) {
            i = 4;
            if (view.getAlpha() != 0.0f || view.getVisibility() != 0) {
                int visibility = view.getVisibility();
                if (visibility == 0) {
                    i = 2;
                } else if (visibility != 4) {
                    if (visibility != 8) {
                        throw new IllegalArgumentException(AbstractC0844a.j("Unknown visibility ", visibility));
                    }
                    i = 3;
                }
            }
        } else {
            i = 0;
        }
        int i5 = b0Var.f13179a;
        if (i != i5) {
            return (i == 2 || i5 == 2) ? false : true;
        }
        return true;
    }

    public Map u() {
        return Collections.EMPTY_MAP;
    }

    public abstract AbstractC0735a v(AbstractC0742h abstractC0742h);

    public void w() {
        I i = (I) this;
        i.p0();
        i.m0(1, false);
    }

    public void x() {
        I i = (I) this;
        i.p0();
        i.m0(1, true);
    }

    public abstract void y(InterfaceC0515u interfaceC0515u);

    public abstract void z(int i, long j8, boolean z8);

    public e(C0817r0 c0817r0) {
        w.f(c0817r0);
        this.f5146q = c0817r0;
    }

    public e(int i) {
        switch (i) {
            case 5:
                this.f5146q = new Q();
                break;
            case Z.g.STRING_SET_FIELD_NUMBER /* 6 */:
                this.f5146q = new C1673c();
                break;
            default:
                this.f5146q = new P.g(19);
                break;
        }
    }

    public e(b0 b0Var) {
        P6.g.e(b0Var, "operation");
        this.f5146q = b0Var;
    }
}
