package b.f.j;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.WindowInsets;
import com.cvte.vman.R;
import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicInteger;

/* JADX INFO: loaded from: classes.dex */
@SuppressLint({"PrivateConstructorForUtilityClass"})
public class n {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static WeakHashMap<View, s> f1007a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static boolean f1008b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final l f1009c;

    public class a implements l {
        @Override // b.f.j.l
        public b.f.j.c a(b.f.j.c cVar) {
            return cVar;
        }
    }

    public static abstract class b<T> {

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

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final Class<T> f1011b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public final int f1012c;

        public b(int i, Class<T> cls, int i2) {
            this.f1010a = i;
            this.f1011b = cls;
            this.f1012c = i2;
        }

        public b(int i, Class<T> cls, int i2, int i3) {
            this.f1010a = i;
            this.f1011b = cls;
            this.f1012c = i3;
        }

        public abstract T a(View view);

        public T b(View view) {
            if (Build.VERSION.SDK_INT >= this.f1012c) {
                return a(view);
            }
            T t = (T) view.getTag(this.f1010a);
            if (this.f1011b.isInstance(t)) {
                return t;
            }
            return null;
        }
    }

    public static class c {

        public class a implements View.OnApplyWindowInsetsListener {

            /* JADX INFO: renamed from: a, reason: collision with root package name */
            public w f1013a = null;

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            public final /* synthetic */ View f1014b;

            /* JADX INFO: renamed from: c, reason: collision with root package name */
            public final /* synthetic */ j f1015c;

            public a(View view, j jVar) {
                this.f1014b = view;
                this.f1015c = jVar;
            }

            @Override // android.view.View.OnApplyWindowInsetsListener
            public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) {
                w wVarH = w.h(windowInsets, view);
                this.f1013a = wVarH;
                return ((b.b.c.k) this.f1015c).a(view, wVarH).f();
            }
        }

        public static w a(View view, w wVar, Rect rect) {
            WindowInsets windowInsetsF = wVar.f();
            if (windowInsetsF != null) {
                return w.h(view.computeSystemWindowInsets(windowInsetsF, rect), view);
            }
            rect.setEmpty();
            return wVar;
        }

        public static void b(View view, j jVar) {
            if (jVar == null) {
                view.setOnApplyWindowInsetsListener((View.OnApplyWindowInsetsListener) view.getTag(R.id.tag_window_insets_animation_callback));
            } else {
                view.setOnApplyWindowInsetsListener(new a(view, jVar));
            }
        }
    }

    public static class d {
        public static w a(View view) {
            WindowInsets rootWindowInsets = view.getRootWindowInsets();
            if (rootWindowInsets == null) {
                return null;
            }
            w wVarH = w.h(rootWindowInsets, null);
            wVarH.f1023b.l(wVarH);
            wVarH.f1023b.d(view.getRootView());
            return wVarH;
        }
    }

    public static class e {
        public static void a(View view, Context context, int[] iArr, AttributeSet attributeSet, TypedArray typedArray, int i, int i2) {
            view.saveAttributeDataForStyleable(context, iArr, attributeSet, typedArray, i, i2);
        }
    }

    static {
        new AtomicInteger(1);
        f1007a = null;
        f1008b = false;
        f1009c = new a();
        new WeakHashMap();
    }

    public static s a(View view) {
        if (f1007a == null) {
            f1007a = new WeakHashMap<>();
        }
        s sVar = f1007a.get(view);
        if (sVar != null) {
            return sVar;
        }
        s sVar2 = new s(view);
        f1007a.put(view, sVar2);
        return sVar2;
    }

    public static w b(View view, w wVar) {
        WindowInsets windowInsetsF = wVar.f();
        if (windowInsetsF != null) {
            WindowInsets windowInsetsDispatchApplyWindowInsets = view.dispatchApplyWindowInsets(windowInsetsF);
            if (!windowInsetsDispatchApplyWindowInsets.equals(windowInsetsF)) {
                return w.h(windowInsetsDispatchApplyWindowInsets, view);
            }
        }
        return wVar;
    }

    public static CharSequence c(View view) {
        return new p(R.id.tag_accessibility_pane_title, CharSequence.class, 8, 28).b(view);
    }

    public static w d(View view, w wVar) {
        WindowInsets windowInsetsF = wVar.f();
        if (windowInsetsF != null) {
            WindowInsets windowInsetsOnApplyWindowInsets = view.onApplyWindowInsets(windowInsetsF);
            if (!windowInsetsOnApplyWindowInsets.equals(windowInsetsF)) {
                return w.h(windowInsetsOnApplyWindowInsets, view);
            }
        }
        return wVar;
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static b.f.j.c e(View view, b.f.j.c cVar) {
        if (Log.isLoggable("ViewCompat", 3)) {
            Log.d("ViewCompat", "performReceiveContent: " + cVar + ", view=" + view.getClass().getSimpleName() + "[" + view.getId() + "]");
        }
        k kVar = (k) view.getTag(R.id.tag_on_receive_content_listener);
        if (kVar == null) {
            return (view instanceof l ? (l) view : f1009c).a(cVar);
        }
        b.f.j.c cVarA = kVar.a(view, cVar);
        if (cVarA == null) {
            return null;
        }
        return (view instanceof l ? (l) view : f1009c).a(cVarA);
    }
}
