package P;

import android.os.Build;
import android.view.View;
import android.view.WindowInsets;
import java.lang.reflect.Field;
import java.util.Objects;

/* JADX INFO: loaded from: classes.dex */
public final class s0 {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final s0 f2485b;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final p0 f2486a;

    static {
        int i = Build.VERSION.SDK_INT;
        if (i >= 34) {
            f2485b = o0.f2475s;
        } else if (i >= 30) {
            f2485b = m0.f2471r;
        } else {
            f2485b = p0.f2481b;
        }
    }

    public s0(WindowInsets windowInsets) {
        int i = Build.VERSION.SDK_INT;
        if (i >= 34) {
            this.f2486a = new o0(this, windowInsets);
            return;
        }
        if (i >= 31) {
            this.f2486a = new n0(this, windowInsets);
            return;
        }
        if (i >= 30) {
            this.f2486a = new m0(this, windowInsets);
            return;
        }
        if (i >= 29) {
            this.f2486a = new l0(this, windowInsets);
        } else if (i >= 28) {
            this.f2486a = new k0(this, windowInsets);
        } else {
            this.f2486a = new j0(this, windowInsets);
        }
    }

    public static G.b b(G.b bVar, int i, int i5, int i6, int i7) {
        int iMax = Math.max(0, bVar.f759a - i);
        int iMax2 = Math.max(0, bVar.f760b - i5);
        int iMax3 = Math.max(0, bVar.f761c - i6);
        int iMax4 = Math.max(0, bVar.f762d - i7);
        return (iMax == i && iMax2 == i5 && iMax3 == i6 && iMax4 == i7) ? bVar : G.b.b(iMax, iMax2, iMax3, iMax4);
    }

    public static s0 d(View view, WindowInsets windowInsets) {
        windowInsets.getClass();
        s0 s0Var = new s0(windowInsets);
        if (view != null && view.isAttachedToWindow()) {
            Field field = Q.f2392a;
            s0 s0VarA = J.a(view);
            p0 p0Var = s0Var.f2486a;
            p0Var.q(s0VarA);
            p0Var.d(view.getRootView());
            p0Var.s(view.getWindowSystemUiVisibility());
        }
        return s0Var;
    }

    public final int a() {
        return this.f2486a.j().f760b;
    }

    public final WindowInsets c() {
        p0 p0Var = this.f2486a;
        if (p0Var instanceof i0) {
            return ((i0) p0Var).f2455c;
        }
        return null;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof s0)) {
            return false;
        }
        return Objects.equals(this.f2486a, ((s0) obj).f2486a);
    }

    public final int hashCode() {
        p0 p0Var = this.f2486a;
        if (p0Var == null) {
            return 0;
        }
        return p0Var.hashCode();
    }

    public s0() {
        this.f2486a = new p0(this);
    }
}
