package F1;

import android.graphics.Rect;
import android.util.Log;
import android.view.WindowInsets;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;

/* JADX INFO: loaded from: classes.dex */
public final class W extends a0 {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static Field f1409e = null;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static boolean f1410f = false;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static Constructor f1411g = null;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public static boolean f1412h = false;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public WindowInsets f1413c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public z1.b f1414d;

    public W() {
        this.f1413c = i();
    }

    private static WindowInsets i() {
        if (!f1410f) {
            try {
                f1409e = WindowInsets.class.getDeclaredField("CONSUMED");
            } catch (ReflectiveOperationException e6) {
                Log.i("WindowInsetsCompat", "Could not retrieve WindowInsets.CONSUMED field", e6);
            }
            f1410f = true;
        }
        Field field = f1409e;
        if (field != null) {
            try {
                WindowInsets windowInsets = (WindowInsets) field.get(null);
                if (windowInsets != null) {
                    return new WindowInsets(windowInsets);
                }
            } catch (ReflectiveOperationException e7) {
                Log.i("WindowInsetsCompat", "Could not get value from WindowInsets.CONSUMED field", e7);
            }
        }
        if (!f1412h) {
            try {
                f1411g = WindowInsets.class.getConstructor(Rect.class);
            } catch (ReflectiveOperationException e8) {
                Log.i("WindowInsetsCompat", "Could not retrieve WindowInsets(Rect) constructor", e8);
            }
            f1412h = true;
        }
        Constructor constructor = f1411g;
        if (constructor != null) {
            try {
                return (WindowInsets) constructor.newInstance(new Rect());
            } catch (ReflectiveOperationException e9) {
                Log.i("WindowInsetsCompat", "Could not invoke WindowInsets(Rect) constructor", e9);
            }
        }
        return null;
    }

    @Override // F1.a0
    public m0 b() {
        a();
        m0 m0VarC = m0.c(null, this.f1413c);
        z1.b[] bVarArr = this.f1418b;
        h0 h0Var = m0VarC.f1458a;
        h0Var.r(bVarArr);
        h0Var.u(this.f1414d);
        return m0VarC;
    }

    @Override // F1.a0
    public void e(z1.b bVar) {
        this.f1414d = bVar;
    }

    @Override // F1.a0
    public void g(z1.b bVar) {
        WindowInsets windowInsets = this.f1413c;
        if (windowInsets != null) {
            this.f1413c = windowInsets.replaceSystemWindowInsets(bVar.f26269a, bVar.f26270b, bVar.f26271c, bVar.f26272d);
        }
    }

    public W(m0 m0Var) {
        super(m0Var);
        this.f1413c = m0Var.b();
    }
}
