package androidx.appcompat.app;

import android.R;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.app.UiModeManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.os.LocaleList;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PowerManager;
import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.ActionMode;
import android.view.ContextThemeWrapper;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.window.OnBackInvokedCallback;
import android.window.OnBackInvokedDispatcher;
import androidx.appcompat.widget.ActionBarContextView;
import androidx.appcompat.widget.AppCompatSpinner;
import androidx.appcompat.widget.ContentFrameLayout;
import androidx.appcompat.widget.Toolbar;
import c.b.c.n;
import c.b.c.s;
import c.b.c.w;
import c.b.c.x;
import c.b.c.y;
import c.b.c.z;
import c.b.e.a;
import c.b.e.e;
import c.b.e.h;
import c.b.e.i.g;
import c.b.e.i.m;
import c.b.f.d1;
import c.b.f.f0;
import c.b.f.h0;
import c.b.f.h1;
import c.b.f.i0;
import c.b.f.i1;
import c.b.f.q;
import c.b.f.t;
import c.b.f.t0;
import c.f.c.a;
import c.f.j.a0;
import c.f.j.k0;
import c.f.j.m0;
import com.cvte.vman.instance.InvokeCmd;
import com.seewo.sdk.model.SDKKeyboardCode;
import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Calendar;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.WeakHashMap;

/* JADX INFO: loaded from: classes.dex */
public class AppCompatDelegateImpl extends c.b.c.l implements g.a, LayoutInflater.Factory2 {
    public static final c.d.h<String, Integer> m = new c.d.h<>();
    public static final int[] n = {R.attr.windowBackground};
    public static final boolean o = !"robolectric".equals(Build.FINGERPRINT);
    public static final boolean p = true;
    public m A;
    public c.b.e.a B;
    public ActionBarContextView C;
    public PopupWindow D;
    public Runnable E;
    public boolean G;
    public ViewGroup H;
    public TextView I;
    public View J;
    public boolean K;
    public boolean L;
    public boolean M;
    public boolean N;
    public boolean O;
    public boolean P;
    public boolean Q;
    public boolean R;
    public PanelFeatureState[] S;
    public PanelFeatureState T;
    public boolean U;
    public boolean V;
    public boolean W;
    public boolean X;
    public Configuration Y;
    public int Z;
    public int a0;
    public int b0;
    public boolean c0;
    public j d0;
    public j e0;
    public boolean f0;
    public int g0;
    public boolean i0;
    public Rect j0;
    public Rect k0;
    public s l0;
    public OnBackInvokedDispatcher m0;
    public OnBackInvokedCallback n0;
    public final Object q;
    public final Context r;
    public Window s;
    public h t;
    public final c.b.c.k u;
    public c.b.c.e v;
    public MenuInflater w;
    public CharSequence x;
    public i0 y;
    public d z;
    public c.f.j.i0 F = null;
    public final Runnable h0 = new a();

    public static final class PanelFeatureState {
        public int a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public int f70b;

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

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public int f72d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public ViewGroup f73e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public View f74f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        public View f75g;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        public c.b.e.i.g f76h;

        /* JADX INFO: renamed from: i, reason: collision with root package name */
        public c.b.e.i.e f77i;

        /* JADX INFO: renamed from: j, reason: collision with root package name */
        public Context f78j;

        /* JADX INFO: renamed from: k, reason: collision with root package name */
        public boolean f79k;

        /* JADX INFO: renamed from: l, reason: collision with root package name */
        public boolean f80l;
        public boolean m;
        public boolean n;
        public boolean o = false;
        public boolean p;
        public Bundle q;

        @SuppressLint({"BanParcelableUsage"})
        public static class SavedState implements Parcelable {
            public static final Parcelable.Creator<SavedState> CREATOR = new a();

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            public int f81b;

            /* JADX INFO: renamed from: e, reason: collision with root package name */
            public boolean f82e;

            /* JADX INFO: renamed from: f, reason: collision with root package name */
            public Bundle f83f;

            public class a implements Parcelable.ClassLoaderCreator<SavedState> {
                @Override // android.os.Parcelable.ClassLoaderCreator
                public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
                    return SavedState.b(parcel, classLoader);
                }

                @Override // android.os.Parcelable.Creator
                public Object[] newArray(int i2) {
                    return new SavedState[i2];
                }

                @Override // android.os.Parcelable.Creator
                public Object createFromParcel(Parcel parcel) {
                    return SavedState.b(parcel, null);
                }
            }

            public static SavedState b(Parcel parcel, ClassLoader classLoader) {
                SavedState savedState = new SavedState();
                savedState.f81b = parcel.readInt();
                boolean z = parcel.readInt() == 1;
                savedState.f82e = z;
                if (z) {
                    savedState.f83f = parcel.readBundle(classLoader);
                }
                return savedState;
            }

            @Override // android.os.Parcelable
            public int describeContents() {
                return 0;
            }

            @Override // android.os.Parcelable
            public void writeToParcel(Parcel parcel, int i2) {
                parcel.writeInt(this.f81b);
                parcel.writeInt(this.f82e ? 1 : 0);
                if (this.f82e) {
                    parcel.writeBundle(this.f83f);
                }
            }
        }

        public PanelFeatureState(int i2) {
            this.a = i2;
        }

        public void a(c.b.e.i.g gVar) {
            c.b.e.i.e eVar;
            c.b.e.i.g gVar2 = this.f76h;
            if (gVar == gVar2) {
                return;
            }
            if (gVar2 != null) {
                gVar2.u(this.f77i);
            }
            this.f76h = gVar;
            if (gVar == null || (eVar = this.f77i) == null) {
                return;
            }
            gVar.b(eVar, gVar.f712b);
        }
    }

    public class a implements Runnable {
        public a() {
        }

        @Override // java.lang.Runnable
        public void run() {
            AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
            if ((appCompatDelegateImpl.g0 & 1) != 0) {
                appCompatDelegateImpl.M(0);
            }
            AppCompatDelegateImpl appCompatDelegateImpl2 = AppCompatDelegateImpl.this;
            if ((appCompatDelegateImpl2.g0 & 4096) != 0) {
                appCompatDelegateImpl2.M(108);
            }
            AppCompatDelegateImpl appCompatDelegateImpl3 = AppCompatDelegateImpl.this;
            appCompatDelegateImpl3.f0 = false;
            appCompatDelegateImpl3.g0 = 0;
        }
    }

    public class b implements c.b.c.f {
        public b(AppCompatDelegateImpl appCompatDelegateImpl) {
        }
    }

    public interface c {
    }

    public final class d implements m.a {
        public d() {
        }

        @Override // c.b.e.i.m.a
        public void b(c.b.e.i.g gVar, boolean z) {
            AppCompatDelegateImpl.this.I(gVar);
        }

        @Override // c.b.e.i.m.a
        public boolean c(c.b.e.i.g gVar) {
            Window.Callback callbackT = AppCompatDelegateImpl.this.T();
            if (callbackT == null) {
                return true;
            }
            callbackT.onMenuOpened(108, gVar);
            return true;
        }
    }

    public class e implements a.InterfaceC0003a {
        public a.InterfaceC0003a a;

        public class a extends k0 {
            public a() {
            }

            @Override // c.f.j.j0
            public void b(View view) {
                AppCompatDelegateImpl.this.C.setVisibility(8);
                AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
                PopupWindow popupWindow = appCompatDelegateImpl.D;
                if (popupWindow != null) {
                    popupWindow.dismiss();
                } else if (appCompatDelegateImpl.C.getParent() instanceof View) {
                    View view2 = (View) AppCompatDelegateImpl.this.C.getParent();
                    WeakHashMap<View, c.f.j.i0> weakHashMap = a0.a;
                    a0.g.c(view2);
                }
                AppCompatDelegateImpl.this.C.h();
                AppCompatDelegateImpl.this.F.d(null);
                AppCompatDelegateImpl appCompatDelegateImpl2 = AppCompatDelegateImpl.this;
                appCompatDelegateImpl2.F = null;
                ViewGroup viewGroup = appCompatDelegateImpl2.H;
                WeakHashMap<View, c.f.j.i0> weakHashMap2 = a0.a;
                a0.g.c(viewGroup);
            }
        }

        public e(a.InterfaceC0003a interfaceC0003a) {
            this.a = interfaceC0003a;
        }

        @Override // c.b.e.a.InterfaceC0003a
        public void a(c.b.e.a aVar) {
            this.a.a(aVar);
            AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
            if (appCompatDelegateImpl.D != null) {
                appCompatDelegateImpl.s.getDecorView().removeCallbacks(AppCompatDelegateImpl.this.E);
            }
            AppCompatDelegateImpl appCompatDelegateImpl2 = AppCompatDelegateImpl.this;
            if (appCompatDelegateImpl2.C != null) {
                appCompatDelegateImpl2.N();
                AppCompatDelegateImpl appCompatDelegateImpl3 = AppCompatDelegateImpl.this;
                c.f.j.i0 i0VarA = a0.a(appCompatDelegateImpl3.C);
                i0VarA.a(0.0f);
                appCompatDelegateImpl3.F = i0VarA;
                c.f.j.i0 i0Var = AppCompatDelegateImpl.this.F;
                a aVar2 = new a();
                View view = i0Var.a.get();
                if (view != null) {
                    i0Var.e(view, aVar2);
                }
            }
            AppCompatDelegateImpl appCompatDelegateImpl4 = AppCompatDelegateImpl.this;
            c.b.c.k kVar = appCompatDelegateImpl4.u;
            if (kVar != null) {
                kVar.onSupportActionModeFinished(appCompatDelegateImpl4.B);
            }
            AppCompatDelegateImpl appCompatDelegateImpl5 = AppCompatDelegateImpl.this;
            appCompatDelegateImpl5.B = null;
            ViewGroup viewGroup = appCompatDelegateImpl5.H;
            WeakHashMap<View, c.f.j.i0> weakHashMap = a0.a;
            a0.g.c(viewGroup);
            AppCompatDelegateImpl.this.d0();
        }

        @Override // c.b.e.a.InterfaceC0003a
        public boolean b(c.b.e.a aVar, Menu menu) {
            return this.a.b(aVar, menu);
        }

        @Override // c.b.e.a.InterfaceC0003a
        public boolean c(c.b.e.a aVar, Menu menu) {
            ViewGroup viewGroup = AppCompatDelegateImpl.this.H;
            WeakHashMap<View, c.f.j.i0> weakHashMap = a0.a;
            a0.g.c(viewGroup);
            return this.a.c(aVar, menu);
        }

        @Override // c.b.e.a.InterfaceC0003a
        public boolean d(c.b.e.a aVar, MenuItem menuItem) {
            return this.a.d(aVar, menuItem);
        }
    }

    public static class f {
        public static void a(Configuration configuration, Configuration configuration2, Configuration configuration3) {
            LocaleList locales = configuration.getLocales();
            LocaleList locales2 = configuration2.getLocales();
            if (locales.equals(locales2)) {
                return;
            }
            configuration3.setLocales(locales2);
            configuration3.locale = configuration2.locale;
        }

        public static c.f.f.d b(Configuration configuration) {
            return c.f.f.d.b(configuration.getLocales().toLanguageTags());
        }

        public static void c(c.f.f.d dVar) {
            LocaleList.setDefault(LocaleList.forLanguageTags(dVar.f()));
        }

        public static void d(Configuration configuration, c.f.f.d dVar) {
            configuration.setLocales(LocaleList.forLanguageTags(dVar.f()));
        }
    }

    public static class g {
        public static OnBackInvokedDispatcher a(Activity activity) {
            return activity.getOnBackInvokedDispatcher();
        }

        public static OnBackInvokedCallback b(Object obj, final AppCompatDelegateImpl appCompatDelegateImpl) {
            Objects.requireNonNull(appCompatDelegateImpl);
            OnBackInvokedCallback onBackInvokedCallback = new OnBackInvokedCallback() { // from class: c.b.c.c
                @Override // android.window.OnBackInvokedCallback
                public final void onBackInvoked() {
                    appCompatDelegateImpl.X();
                }
            };
            ((OnBackInvokedDispatcher) obj).registerOnBackInvokedCallback(1000000, onBackInvokedCallback);
            return onBackInvokedCallback;
        }

        public static void c(Object obj, Object obj2) {
            ((OnBackInvokedDispatcher) obj).unregisterOnBackInvokedCallback((OnBackInvokedCallback) obj2);
        }
    }

    public class h extends c.b.e.h {

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

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public boolean f88f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        public boolean f89g;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        public boolean f90h;

        public h(Window.Callback callback) {
            super(callback);
        }

        public void a(Window.Callback callback) {
            try {
                this.f88f = true;
                callback.onContentChanged();
            } finally {
                this.f88f = false;
            }
        }

        public final ActionMode b(ActionMode.Callback callback) {
            e.a aVar = new e.a(AppCompatDelegateImpl.this.r, callback);
            c.b.e.a aVarD = AppCompatDelegateImpl.this.D(aVar);
            if (aVarD != null) {
                return aVar.e(aVarD);
            }
            return null;
        }

        @Override // android.view.Window.Callback
        public boolean dispatchKeyEvent(KeyEvent keyEvent) {
            return this.f89g ? this.f659b.dispatchKeyEvent(keyEvent) : AppCompatDelegateImpl.this.L(keyEvent) || this.f659b.dispatchKeyEvent(keyEvent);
        }

        /* JADX WARN: Removed duplicated region for block: B:25:? A[RETURN, SYNTHETIC] */
        @Override // android.view.Window.Callback
        /*
            Code decompiled incorrectly, please refer to instructions dump.
            To view partially-correct add '--show-bad-code' argument
        */
        public boolean dispatchKeyShortcutEvent(android.view.KeyEvent r6) {
            /*
                r5 = this;
                android.view.Window$Callback r0 = r5.f659b
                boolean r0 = r0.dispatchKeyShortcutEvent(r6)
                r1 = 0
                r2 = 1
                if (r0 != 0) goto L4f
                androidx.appcompat.app.AppCompatDelegateImpl r0 = androidx.appcompat.app.AppCompatDelegateImpl.this
                int r3 = r6.getKeyCode()
                r0.U()
                c.b.c.e r4 = r0.v
                if (r4 == 0) goto L1f
                boolean r3 = r4.i(r3, r6)
                if (r3 == 0) goto L1f
            L1d:
                r6 = r2
                goto L4d
            L1f:
                androidx.appcompat.app.AppCompatDelegateImpl$PanelFeatureState r3 = r0.T
                if (r3 == 0) goto L34
                int r4 = r6.getKeyCode()
                boolean r3 = r0.Z(r3, r4, r6, r2)
                if (r3 == 0) goto L34
                androidx.appcompat.app.AppCompatDelegateImpl$PanelFeatureState r6 = r0.T
                if (r6 == 0) goto L1d
                r6.f80l = r2
                goto L1d
            L34:
                androidx.appcompat.app.AppCompatDelegateImpl$PanelFeatureState r3 = r0.T
                if (r3 != 0) goto L4c
                androidx.appcompat.app.AppCompatDelegateImpl$PanelFeatureState r3 = r0.S(r1)
                r0.a0(r3, r6)
                int r4 = r6.getKeyCode()
                boolean r6 = r0.Z(r3, r4, r6, r2)
                r3.f79k = r1
                if (r6 == 0) goto L4c
                goto L1d
            L4c:
                r6 = r1
            L4d:
                if (r6 == 0) goto L50
            L4f:
                r1 = r2
            L50:
                return r1
            */
            throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.h.dispatchKeyShortcutEvent(android.view.KeyEvent):boolean");
        }

        @Override // android.view.Window.Callback
        public void onContentChanged() {
            if (this.f88f) {
                this.f659b.onContentChanged();
            }
        }

        @Override // android.view.Window.Callback
        public boolean onCreatePanelMenu(int i2, Menu menu) {
            if (i2 != 0 || (menu instanceof c.b.e.i.g)) {
                return this.f659b.onCreatePanelMenu(i2, menu);
            }
            return false;
        }

        @Override // android.view.Window.Callback
        public View onCreatePanelView(int i2) {
            c cVar = this.f87e;
            if (cVar != null) {
                w.e eVar = (w.e) cVar;
                Objects.requireNonNull(eVar);
                View view = i2 == 0 ? new View(w.this.a.e()) : null;
                if (view != null) {
                    return view;
                }
            }
            return this.f659b.onCreatePanelView(i2);
        }

        @Override // android.view.Window.Callback
        public boolean onMenuOpened(int i2, Menu menu) {
            this.f659b.onMenuOpened(i2, menu);
            AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
            Objects.requireNonNull(appCompatDelegateImpl);
            if (i2 == 108) {
                appCompatDelegateImpl.U();
                c.b.c.e eVar = appCompatDelegateImpl.v;
                if (eVar != null) {
                    eVar.c(true);
                }
            }
            return true;
        }

        @Override // android.view.Window.Callback
        public void onPanelClosed(int i2, Menu menu) {
            if (this.f90h) {
                this.f659b.onPanelClosed(i2, menu);
                return;
            }
            this.f659b.onPanelClosed(i2, menu);
            AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
            Objects.requireNonNull(appCompatDelegateImpl);
            if (i2 == 108) {
                appCompatDelegateImpl.U();
                c.b.c.e eVar = appCompatDelegateImpl.v;
                if (eVar != null) {
                    eVar.c(false);
                    return;
                }
                return;
            }
            if (i2 == 0) {
                PanelFeatureState panelFeatureStateS = appCompatDelegateImpl.S(i2);
                if (panelFeatureStateS.m) {
                    appCompatDelegateImpl.J(panelFeatureStateS, false);
                }
            }
        }

        @Override // android.view.Window.Callback
        public boolean onPreparePanel(int i2, View view, Menu menu) {
            c.b.e.i.g gVar = menu instanceof c.b.e.i.g ? (c.b.e.i.g) menu : null;
            if (i2 == 0 && gVar == null) {
                return false;
            }
            if (gVar != null) {
                gVar.y = true;
            }
            c cVar = this.f87e;
            if (cVar != null) {
                w.e eVar = (w.e) cVar;
                if (i2 == 0) {
                    w wVar = w.this;
                    if (!wVar.f583d) {
                        wVar.a.c();
                        w.this.f583d = true;
                    }
                }
            }
            boolean zOnPreparePanel = this.f659b.onPreparePanel(i2, view, menu);
            if (gVar != null) {
                gVar.y = false;
            }
            return zOnPreparePanel;
        }

        @Override // android.view.Window.Callback
        public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> list, Menu menu, int i2) {
            c.b.e.i.g gVar = AppCompatDelegateImpl.this.S(0).f76h;
            if (gVar != null) {
                h.b.a(this.f659b, list, gVar, i2);
            } else {
                h.b.a(this.f659b, list, menu, i2);
            }
        }

        @Override // android.view.Window.Callback
        public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
            return null;
        }

        @Override // android.view.Window.Callback
        public ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i2) {
            Objects.requireNonNull(AppCompatDelegateImpl.this);
            return i2 != 0 ? h.a.b(this.f659b, callback, i2) : b(callback);
        }
    }

    public class i extends j {

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

        public i(Context context) {
            super();
            this.f92c = (PowerManager) context.getApplicationContext().getSystemService("power");
        }

        @Override // androidx.appcompat.app.AppCompatDelegateImpl.j
        public IntentFilter b() {
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction("android.os.action.POWER_SAVE_MODE_CHANGED");
            return intentFilter;
        }

        @Override // androidx.appcompat.app.AppCompatDelegateImpl.j
        public int c() {
            return this.f92c.isPowerSaveMode() ? 2 : 1;
        }

        @Override // androidx.appcompat.app.AppCompatDelegateImpl.j
        public void d() {
            AppCompatDelegateImpl.this.E(true, true);
        }
    }

    public abstract class j {
        public BroadcastReceiver a;

        public class a extends BroadcastReceiver {
            public a() {
            }

            @Override // android.content.BroadcastReceiver
            public void onReceive(Context context, Intent intent) {
                j.this.d();
            }
        }

        public j() {
        }

        public void a() {
            BroadcastReceiver broadcastReceiver = this.a;
            if (broadcastReceiver != null) {
                try {
                    AppCompatDelegateImpl.this.r.unregisterReceiver(broadcastReceiver);
                } catch (IllegalArgumentException unused) {
                }
                this.a = null;
            }
        }

        public abstract IntentFilter b();

        public abstract int c();

        public abstract void d();

        public void e() {
            a();
            IntentFilter intentFilterB = b();
            if (intentFilterB == null || intentFilterB.countActions() == 0) {
                return;
            }
            if (this.a == null) {
                this.a = new a();
            }
            AppCompatDelegateImpl.this.r.registerReceiver(this.a, intentFilterB);
        }
    }

    public class k extends j {

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

        public k(y yVar) {
            super();
            this.f95c = yVar;
        }

        @Override // androidx.appcompat.app.AppCompatDelegateImpl.j
        public IntentFilter b() {
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction("android.intent.action.TIME_SET");
            intentFilter.addAction("android.intent.action.TIMEZONE_CHANGED");
            intentFilter.addAction("android.intent.action.TIME_TICK");
            return intentFilter;
        }

        @Override // androidx.appcompat.app.AppCompatDelegateImpl.j
        public int c() {
            boolean z;
            long j2;
            y yVar = this.f95c;
            y.a aVar = yVar.f598d;
            if (aVar.f599b > System.currentTimeMillis()) {
                z = aVar.a;
            } else {
                Location locationA = c.f.b.h.g(yVar.f596b, "android.permission.ACCESS_COARSE_LOCATION") == 0 ? yVar.a("network") : null;
                Location locationA2 = c.f.b.h.g(yVar.f596b, "android.permission.ACCESS_FINE_LOCATION") == 0 ? yVar.a("gps") : null;
                if (locationA2 == null || locationA == null ? locationA2 != null : locationA2.getTime() > locationA.getTime()) {
                    locationA = locationA2;
                }
                if (locationA != null) {
                    y.a aVar2 = yVar.f598d;
                    long jCurrentTimeMillis = System.currentTimeMillis();
                    if (x.a == null) {
                        x.a = new x();
                    }
                    x xVar = x.a;
                    xVar.a(jCurrentTimeMillis - 86400000, locationA.getLatitude(), locationA.getLongitude());
                    xVar.a(jCurrentTimeMillis, locationA.getLatitude(), locationA.getLongitude());
                    boolean z2 = xVar.f595d == 1;
                    long j3 = xVar.f594c;
                    long j4 = xVar.f593b;
                    xVar.a(jCurrentTimeMillis + 86400000, locationA.getLatitude(), locationA.getLongitude());
                    long j5 = xVar.f594c;
                    if (j3 == -1 || j4 == -1) {
                        j2 = jCurrentTimeMillis + 43200000;
                    } else {
                        j2 = (jCurrentTimeMillis > j4 ? j5 + 0 : jCurrentTimeMillis > j3 ? j4 + 0 : j3 + 0) + 60000;
                    }
                    aVar2.a = z2;
                    aVar2.f599b = j2;
                    z = aVar.a;
                } else {
                    Log.i("TwilightManager", "Could not get last known location. This is probably because the app does not have any location permissions. Falling back to hardcoded sunrise/sunset values.");
                    int i2 = Calendar.getInstance().get(11);
                    z = i2 < 6 || i2 >= 22;
                }
            }
            return z ? 2 : 1;
        }

        @Override // androidx.appcompat.app.AppCompatDelegateImpl.j
        public void d() {
            AppCompatDelegateImpl.this.E(true, true);
        }
    }

    public class l extends ContentFrameLayout {
        public l(Context context) {
            super(context, null);
        }

        @Override // android.view.ViewGroup, android.view.View
        public boolean dispatchKeyEvent(KeyEvent keyEvent) {
            return AppCompatDelegateImpl.this.L(keyEvent) || super.dispatchKeyEvent(keyEvent);
        }

        @Override // android.view.ViewGroup
        public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
            if (motionEvent.getAction() == 0) {
                int x = (int) motionEvent.getX();
                int y = (int) motionEvent.getY();
                if (x < -5 || y < -5 || x > getWidth() + 5 || y > getHeight() + 5) {
                    AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
                    appCompatDelegateImpl.J(appCompatDelegateImpl.S(0), true);
                    return true;
                }
            }
            return super.onInterceptTouchEvent(motionEvent);
        }

        @Override // android.view.View
        public void setBackgroundResource(int i2) {
            setBackgroundDrawable(c.b.a.e(getContext(), i2));
        }
    }

    public final class m implements m.a {
        public m() {
        }

        @Override // c.b.e.i.m.a
        public void b(c.b.e.i.g gVar, boolean z) {
            c.b.e.i.g gVarK = gVar.k();
            boolean z2 = gVarK != gVar;
            AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
            if (z2) {
                gVar = gVarK;
            }
            PanelFeatureState panelFeatureStateQ = appCompatDelegateImpl.Q(gVar);
            if (panelFeatureStateQ != null) {
                if (!z2) {
                    AppCompatDelegateImpl.this.J(panelFeatureStateQ, z);
                } else {
                    AppCompatDelegateImpl.this.H(panelFeatureStateQ.a, panelFeatureStateQ, gVarK);
                    AppCompatDelegateImpl.this.J(panelFeatureStateQ, true);
                }
            }
        }

        @Override // c.b.e.i.m.a
        public boolean c(c.b.e.i.g gVar) {
            Window.Callback callbackT;
            if (gVar != gVar.k()) {
                return true;
            }
            AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
            if (!appCompatDelegateImpl.M || (callbackT = appCompatDelegateImpl.T()) == null || AppCompatDelegateImpl.this.X) {
                return true;
            }
            callbackT.onMenuOpened(108, gVar);
            return true;
        }
    }

    public AppCompatDelegateImpl(Context context, Window window, c.b.c.k kVar, Object obj) {
        c.d.h<String, Integer> hVar;
        Integer orDefault;
        c.b.c.j jVar;
        this.Z = -100;
        this.r = context;
        this.u = kVar;
        this.q = obj;
        if (obj instanceof Dialog) {
            while (context != null) {
                if (!(context instanceof c.b.c.j)) {
                    if (!(context instanceof ContextWrapper)) {
                        break;
                    } else {
                        context = ((ContextWrapper) context).getBaseContext();
                    }
                } else {
                    jVar = (c.b.c.j) context;
                    break;
                }
            }
            jVar = null;
            if (jVar != null) {
                this.Z = jVar.getDelegate().h();
            }
        }
        if (this.Z == -100 && (orDefault = (hVar = m).getOrDefault(this.q.getClass().getName(), null)) != null) {
            this.Z = orDefault.intValue();
            hVar.remove(this.q.getClass().getName());
        }
        if (window != null) {
            F(window);
        }
        c.b.f.m.d();
    }

    @Override // c.b.c.l
    public void A(Toolbar toolbar) {
        if (this.q instanceof Activity) {
            U();
            c.b.c.e eVar = this.v;
            if (eVar instanceof z) {
                throw new IllegalStateException("This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.");
            }
            this.w = null;
            if (eVar != null) {
                eVar.h();
            }
            this.v = null;
            if (toolbar != null) {
                Object obj = this.q;
                w wVar = new w(toolbar, obj instanceof Activity ? ((Activity) obj).getTitle() : this.x, this.t);
                this.v = wVar;
                this.t.f87e = wVar.f582c;
                toolbar.setBackInvokedCallbackEnabled(true);
            } else {
                this.t.f87e = null;
            }
            l();
        }
    }

    @Override // c.b.c.l
    public void B(int i2) {
        this.a0 = i2;
    }

    @Override // c.b.c.l
    public final void C(CharSequence charSequence) {
        this.x = charSequence;
        i0 i0Var = this.y;
        if (i0Var != null) {
            i0Var.setWindowTitle(charSequence);
            return;
        }
        c.b.c.e eVar = this.v;
        if (eVar != null) {
            eVar.n(charSequence);
            return;
        }
        TextView textView = this.I;
        if (textView != null) {
            textView.setText(charSequence);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:26:0x0043  */
    /* JADX WARN: Removed duplicated region for block: B:27:0x0047  */
    @Override // c.b.c.l
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public c.b.e.a D(c.b.e.a.InterfaceC0003a r8) {
        /*
            Method dump skipped, instruction units count: 437
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.D(c.b.e.a$a):c.b.e.a");
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:66:0x00fb  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean E(boolean r12, boolean r13) {
        /*
            Method dump skipped, instruction units count: 463
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.E(boolean, boolean):boolean");
    }

    public final void F(Window window) {
        OnBackInvokedDispatcher onBackInvokedDispatcher;
        OnBackInvokedCallback onBackInvokedCallback;
        if (this.s != null) {
            throw new IllegalStateException("AppCompat has already installed itself into the Window");
        }
        Window.Callback callback = window.getCallback();
        if (callback instanceof h) {
            throw new IllegalStateException("AppCompat has already installed itself into the Window");
        }
        h hVar = new h(callback);
        this.t = hVar;
        window.setCallback(hVar);
        d1 d1VarN = d1.n(this.r, null, n);
        Drawable drawableF = d1VarN.f(0);
        if (drawableF != null) {
            window.setBackgroundDrawable(drawableF);
        }
        d1VarN.f806b.recycle();
        this.s = window;
        if (Build.VERSION.SDK_INT < 33 || (onBackInvokedDispatcher = this.m0) != null) {
            return;
        }
        if (onBackInvokedDispatcher != null && (onBackInvokedCallback = this.n0) != null) {
            g.c(onBackInvokedDispatcher, onBackInvokedCallback);
            this.n0 = null;
        }
        Object obj = this.q;
        if (!(obj instanceof Activity) || ((Activity) obj).getWindow() == null) {
            this.m0 = null;
        } else {
            this.m0 = g.a((Activity) this.q);
        }
        d0();
    }

    public c.f.f.d G(Context context) {
        c.f.f.d dVar;
        c.f.f.d dVarA;
        if (Build.VERSION.SDK_INT >= 33 || (dVar = c.b.c.l.f555f) == null) {
            return null;
        }
        c.f.f.d dVarB = f.b(context.getApplicationContext().getResources().getConfiguration());
        if (dVar.d()) {
            dVarA = c.f.f.d.a;
        } else {
            LinkedHashSet linkedHashSet = new LinkedHashSet();
            int i2 = 0;
            while (i2 < dVarB.e() + dVar.e()) {
                Locale localeC = i2 < dVar.e() ? dVar.c(i2) : dVarB.c(i2 - dVar.e());
                if (localeC != null) {
                    linkedHashSet.add(localeC);
                }
                i2++;
            }
            dVarA = c.f.f.d.a((Locale[]) linkedHashSet.toArray(new Locale[linkedHashSet.size()]));
        }
        return dVarA.d() ? dVarB : dVarA;
    }

    public void H(int i2, PanelFeatureState panelFeatureState, Menu menu) {
        if (menu == null && panelFeatureState != null) {
            menu = panelFeatureState.f76h;
        }
        if ((panelFeatureState == null || panelFeatureState.m) && !this.X) {
            h hVar = this.t;
            Window.Callback callback = this.s.getCallback();
            Objects.requireNonNull(hVar);
            try {
                hVar.f90h = true;
                callback.onPanelClosed(i2, menu);
            } finally {
                hVar.f90h = false;
            }
        }
    }

    public void I(c.b.e.i.g gVar) {
        if (this.R) {
            return;
        }
        this.R = true;
        this.y.j();
        Window.Callback callbackT = T();
        if (callbackT != null && !this.X) {
            callbackT.onPanelClosed(108, gVar);
        }
        this.R = false;
    }

    public void J(PanelFeatureState panelFeatureState, boolean z) {
        ViewGroup viewGroup;
        i0 i0Var;
        if (z && panelFeatureState.a == 0 && (i0Var = this.y) != null && i0Var.b()) {
            I(panelFeatureState.f76h);
            return;
        }
        WindowManager windowManager = (WindowManager) this.r.getSystemService("window");
        if (windowManager != null && panelFeatureState.m && (viewGroup = panelFeatureState.f73e) != null) {
            windowManager.removeView(viewGroup);
            if (z) {
                H(panelFeatureState.a, panelFeatureState, null);
            }
        }
        panelFeatureState.f79k = false;
        panelFeatureState.f80l = false;
        panelFeatureState.m = false;
        panelFeatureState.f74f = null;
        panelFeatureState.o = true;
        if (this.T == panelFeatureState) {
            this.T = null;
        }
        if (panelFeatureState.a == 0) {
            d0();
        }
    }

    public final Configuration K(Context context, int i2, c.f.f.d dVar, Configuration configuration, boolean z) {
        int i3 = i2 != 1 ? i2 != 2 ? z ? 0 : context.getApplicationContext().getResources().getConfiguration().uiMode & 48 : 32 : 16;
        Configuration configuration2 = new Configuration();
        configuration2.fontScale = 0.0f;
        if (configuration != null) {
            configuration2.setTo(configuration);
        }
        configuration2.uiMode = i3 | (configuration2.uiMode & (-49));
        if (dVar != null) {
            f.d(configuration2, dVar);
        }
        return configuration2;
    }

    /* JADX WARN: Removed duplicated region for block: B:74:0x00d9  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public boolean L(android.view.KeyEvent r7) {
        /*
            Method dump skipped, instruction units count: 260
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.L(android.view.KeyEvent):boolean");
    }

    public void M(int i2) {
        PanelFeatureState panelFeatureStateS = S(i2);
        if (panelFeatureStateS.f76h != null) {
            Bundle bundle = new Bundle();
            panelFeatureStateS.f76h.w(bundle);
            if (bundle.size() > 0) {
                panelFeatureStateS.q = bundle;
            }
            panelFeatureStateS.f76h.z();
            panelFeatureStateS.f76h.clear();
        }
        panelFeatureStateS.p = true;
        panelFeatureStateS.o = true;
        if ((i2 == 108 || i2 == 0) && this.y != null) {
            PanelFeatureState panelFeatureStateS2 = S(0);
            panelFeatureStateS2.f79k = false;
            a0(panelFeatureStateS2, null);
        }
    }

    public void N() {
        c.f.j.i0 i0Var = this.F;
        if (i0Var != null) {
            i0Var.b();
        }
    }

    public final void O() {
        ViewGroup viewGroup;
        if (this.G) {
            return;
        }
        TypedArray typedArrayObtainStyledAttributes = this.r.obtainStyledAttributes(c.b.b.f541j);
        if (!typedArrayObtainStyledAttributes.hasValue(117)) {
            typedArrayObtainStyledAttributes.recycle();
            throw new IllegalStateException("You need to use a Theme.AppCompat theme (or descendant) with this activity.");
        }
        if (typedArrayObtainStyledAttributes.getBoolean(126, false)) {
            w(1);
        } else if (typedArrayObtainStyledAttributes.getBoolean(117, false)) {
            w(108);
        }
        if (typedArrayObtainStyledAttributes.getBoolean(118, false)) {
            w(109);
        }
        if (typedArrayObtainStyledAttributes.getBoolean(119, false)) {
            w(10);
        }
        this.P = typedArrayObtainStyledAttributes.getBoolean(0, false);
        typedArrayObtainStyledAttributes.recycle();
        P();
        this.s.getDecorView();
        LayoutInflater layoutInflaterFrom = LayoutInflater.from(this.r);
        if (this.Q) {
            viewGroup = this.O ? (ViewGroup) layoutInflaterFrom.inflate(com.ifpdos.debugmenu.R.layout.abc_screen_simple_overlay_action_mode, (ViewGroup) null) : (ViewGroup) layoutInflaterFrom.inflate(com.ifpdos.debugmenu.R.layout.abc_screen_simple, (ViewGroup) null);
        } else if (this.P) {
            viewGroup = (ViewGroup) layoutInflaterFrom.inflate(com.ifpdos.debugmenu.R.layout.abc_dialog_title_material, (ViewGroup) null);
            this.N = false;
            this.M = false;
        } else if (this.M) {
            TypedValue typedValue = new TypedValue();
            this.r.getTheme().resolveAttribute(com.ifpdos.debugmenu.R.attr.actionBarTheme, typedValue, true);
            viewGroup = (ViewGroup) LayoutInflater.from(typedValue.resourceId != 0 ? new c.b.e.c(this.r, typedValue.resourceId) : this.r).inflate(com.ifpdos.debugmenu.R.layout.abc_screen_toolbar, (ViewGroup) null);
            i0 i0Var = (i0) viewGroup.findViewById(com.ifpdos.debugmenu.R.id.decor_content_parent);
            this.y = i0Var;
            i0Var.setWindowCallback(T());
            if (this.N) {
                this.y.i(109);
            }
            if (this.K) {
                this.y.i(2);
            }
            if (this.L) {
                this.y.i(5);
            }
        } else {
            viewGroup = null;
        }
        if (viewGroup == null) {
            StringBuilder sbB = d.b.a.a.a.B("AppCompat does not support the current theme features: { windowActionBar: ");
            sbB.append(this.M);
            sbB.append(", windowActionBarOverlay: ");
            sbB.append(this.N);
            sbB.append(", android:windowIsFloating: ");
            sbB.append(this.P);
            sbB.append(", windowActionModeOverlay: ");
            sbB.append(this.O);
            sbB.append(", windowNoTitle: ");
            sbB.append(this.Q);
            sbB.append(" }");
            throw new IllegalArgumentException(sbB.toString());
        }
        c.b.c.m mVar = new c.b.c.m(this);
        WeakHashMap<View, c.f.j.i0> weakHashMap = a0.a;
        a0.h.u(viewGroup, mVar);
        if (this.y == null) {
            this.I = (TextView) viewGroup.findViewById(com.ifpdos.debugmenu.R.id.title);
        }
        Method method = i1.a;
        try {
            Method method2 = viewGroup.getClass().getMethod("makeOptionalFitsSystemWindows", new Class[0]);
            if (!method2.isAccessible()) {
                method2.setAccessible(true);
            }
            method2.invoke(viewGroup, new Object[0]);
        } catch (IllegalAccessException e2) {
            Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e2);
        } catch (NoSuchMethodException unused) {
            Log.d("ViewUtils", "Could not find method makeOptionalFitsSystemWindows. Oh well...");
        } catch (InvocationTargetException e3) {
            Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e3);
        }
        ContentFrameLayout contentFrameLayout = (ContentFrameLayout) viewGroup.findViewById(com.ifpdos.debugmenu.R.id.action_bar_activity_content);
        ViewGroup viewGroup2 = (ViewGroup) this.s.findViewById(R.id.content);
        if (viewGroup2 != null) {
            while (viewGroup2.getChildCount() > 0) {
                View childAt = viewGroup2.getChildAt(0);
                viewGroup2.removeViewAt(0);
                contentFrameLayout.addView(childAt);
            }
            viewGroup2.setId(-1);
            contentFrameLayout.setId(R.id.content);
            if (viewGroup2 instanceof FrameLayout) {
                ((FrameLayout) viewGroup2).setForeground(null);
            }
        }
        this.s.setContentView(viewGroup);
        contentFrameLayout.setAttachListener(new n(this));
        this.H = viewGroup;
        Object obj = this.q;
        CharSequence title = obj instanceof Activity ? ((Activity) obj).getTitle() : this.x;
        if (!TextUtils.isEmpty(title)) {
            i0 i0Var2 = this.y;
            if (i0Var2 != null) {
                i0Var2.setWindowTitle(title);
            } else {
                c.b.c.e eVar = this.v;
                if (eVar != null) {
                    eVar.n(title);
                } else {
                    TextView textView = this.I;
                    if (textView != null) {
                        textView.setText(title);
                    }
                }
            }
        }
        ContentFrameLayout contentFrameLayout2 = (ContentFrameLayout) this.H.findViewById(R.id.content);
        View decorView = this.s.getDecorView();
        contentFrameLayout2.f177j.set(decorView.getPaddingLeft(), decorView.getPaddingTop(), decorView.getPaddingRight(), decorView.getPaddingBottom());
        WeakHashMap<View, c.f.j.i0> weakHashMap2 = a0.a;
        if (a0.f.c(contentFrameLayout2)) {
            contentFrameLayout2.requestLayout();
        }
        TypedArray typedArrayObtainStyledAttributes2 = this.r.obtainStyledAttributes(c.b.b.f541j);
        typedArrayObtainStyledAttributes2.getValue(124, contentFrameLayout2.getMinWidthMajor());
        typedArrayObtainStyledAttributes2.getValue(125, contentFrameLayout2.getMinWidthMinor());
        if (typedArrayObtainStyledAttributes2.hasValue(122)) {
            typedArrayObtainStyledAttributes2.getValue(122, contentFrameLayout2.getFixedWidthMajor());
        }
        if (typedArrayObtainStyledAttributes2.hasValue(123)) {
            typedArrayObtainStyledAttributes2.getValue(123, contentFrameLayout2.getFixedWidthMinor());
        }
        if (typedArrayObtainStyledAttributes2.hasValue(120)) {
            typedArrayObtainStyledAttributes2.getValue(120, contentFrameLayout2.getFixedHeightMajor());
        }
        if (typedArrayObtainStyledAttributes2.hasValue(121)) {
            typedArrayObtainStyledAttributes2.getValue(121, contentFrameLayout2.getFixedHeightMinor());
        }
        typedArrayObtainStyledAttributes2.recycle();
        contentFrameLayout2.requestLayout();
        this.G = true;
        PanelFeatureState panelFeatureStateS = S(0);
        if (this.X || panelFeatureStateS.f76h != null) {
            return;
        }
        V(108);
    }

    public final void P() {
        if (this.s == null) {
            Object obj = this.q;
            if (obj instanceof Activity) {
                F(((Activity) obj).getWindow());
            }
        }
        if (this.s == null) {
            throw new IllegalStateException("We have not been given a Window");
        }
    }

    public PanelFeatureState Q(Menu menu) {
        PanelFeatureState[] panelFeatureStateArr = this.S;
        int length = panelFeatureStateArr != null ? panelFeatureStateArr.length : 0;
        for (int i2 = 0; i2 < length; i2++) {
            PanelFeatureState panelFeatureState = panelFeatureStateArr[i2];
            if (panelFeatureState != null && panelFeatureState.f76h == menu) {
                return panelFeatureState;
            }
        }
        return null;
    }

    public final j R(Context context) {
        if (this.d0 == null) {
            if (y.a == null) {
                Context applicationContext = context.getApplicationContext();
                y.a = new y(applicationContext, (LocationManager) applicationContext.getSystemService("location"));
            }
            this.d0 = new k(y.a);
        }
        return this.d0;
    }

    public PanelFeatureState S(int i2) {
        PanelFeatureState[] panelFeatureStateArr = this.S;
        if (panelFeatureStateArr == null || panelFeatureStateArr.length <= i2) {
            PanelFeatureState[] panelFeatureStateArr2 = new PanelFeatureState[i2 + 1];
            if (panelFeatureStateArr != null) {
                System.arraycopy(panelFeatureStateArr, 0, panelFeatureStateArr2, 0, panelFeatureStateArr.length);
            }
            this.S = panelFeatureStateArr2;
            panelFeatureStateArr = panelFeatureStateArr2;
        }
        PanelFeatureState panelFeatureState = panelFeatureStateArr[i2];
        if (panelFeatureState != null) {
            return panelFeatureState;
        }
        PanelFeatureState panelFeatureState2 = new PanelFeatureState(i2);
        panelFeatureStateArr[i2] = panelFeatureState2;
        return panelFeatureState2;
    }

    public final Window.Callback T() {
        return this.s.getCallback();
    }

    public final void U() {
        O();
        if (this.M && this.v == null) {
            Object obj = this.q;
            if (obj instanceof Activity) {
                this.v = new z((Activity) this.q, this.N);
            } else if (obj instanceof Dialog) {
                this.v = new z((Dialog) this.q);
            }
            c.b.c.e eVar = this.v;
            if (eVar != null) {
                eVar.l(this.i0);
            }
        }
    }

    public final void V(int i2) {
        this.g0 = (1 << i2) | this.g0;
        if (this.f0) {
            return;
        }
        View decorView = this.s.getDecorView();
        Runnable runnable = this.h0;
        WeakHashMap<View, c.f.j.i0> weakHashMap = a0.a;
        a0.d.m(decorView, runnable);
        this.f0 = true;
    }

    public int W(Context context, int i2) {
        if (i2 == -100) {
            return -1;
        }
        if (i2 != -1) {
            if (i2 == 0) {
                if (((UiModeManager) context.getApplicationContext().getSystemService("uimode")).getNightMode() == 0) {
                    return -1;
                }
                return R(context).c();
            }
            if (i2 != 1 && i2 != 2) {
                if (i2 != 3) {
                    throw new IllegalStateException("Unknown value set for night mode. Please use one of the MODE_NIGHT values from AppCompatDelegate.");
                }
                if (this.e0 == null) {
                    this.e0 = new i(context);
                }
                return this.e0.c();
            }
        }
        return i2;
    }

    public boolean X() {
        boolean z = this.U;
        this.U = false;
        PanelFeatureState panelFeatureStateS = S(0);
        if (panelFeatureStateS.m) {
            if (!z) {
                J(panelFeatureStateS, true);
            }
            return true;
        }
        c.b.e.a aVar = this.B;
        if (aVar != null) {
            aVar.c();
            return true;
        }
        U();
        c.b.c.e eVar = this.v;
        return eVar != null && eVar.b();
    }

    /* JADX WARN: Removed duplicated region for block: B:106:0x01d9  */
    /* JADX WARN: Removed duplicated region for block: B:110:? A[RETURN, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:82:0x015e  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void Y(androidx.appcompat.app.AppCompatDelegateImpl.PanelFeatureState r14, android.view.KeyEvent r15) {
        /*
            Method dump skipped, instruction units count: 480
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.Y(androidx.appcompat.app.AppCompatDelegateImpl$PanelFeatureState, android.view.KeyEvent):void");
    }

    public final boolean Z(PanelFeatureState panelFeatureState, int i2, KeyEvent keyEvent, int i3) {
        c.b.e.i.g gVar;
        boolean zPerformShortcut = false;
        if (keyEvent.isSystem()) {
            return false;
        }
        if ((panelFeatureState.f79k || a0(panelFeatureState, keyEvent)) && (gVar = panelFeatureState.f76h) != null) {
            zPerformShortcut = gVar.performShortcut(i2, keyEvent, i3);
        }
        if (zPerformShortcut && (i3 & 1) == 0 && this.y == null) {
            J(panelFeatureState, true);
        }
        return zPerformShortcut;
    }

    @Override // c.b.e.i.g.a
    public boolean a(c.b.e.i.g gVar, MenuItem menuItem) {
        PanelFeatureState panelFeatureStateQ;
        Window.Callback callbackT = T();
        if (callbackT == null || this.X || (panelFeatureStateQ = Q(gVar.k())) == null) {
            return false;
        }
        return callbackT.onMenuItemSelected(panelFeatureStateQ.a, menuItem);
    }

    public final boolean a0(PanelFeatureState panelFeatureState, KeyEvent keyEvent) {
        i0 i0Var;
        i0 i0Var2;
        Resources.Theme themeNewTheme;
        i0 i0Var3;
        i0 i0Var4;
        if (this.X) {
            return false;
        }
        if (panelFeatureState.f79k) {
            return true;
        }
        PanelFeatureState panelFeatureState2 = this.T;
        if (panelFeatureState2 != null && panelFeatureState2 != panelFeatureState) {
            J(panelFeatureState2, false);
        }
        Window.Callback callbackT = T();
        if (callbackT != null) {
            panelFeatureState.f75g = callbackT.onCreatePanelView(panelFeatureState.a);
        }
        int i2 = panelFeatureState.a;
        boolean z = i2 == 0 || i2 == 108;
        if (z && (i0Var4 = this.y) != null) {
            i0Var4.c();
        }
        if (panelFeatureState.f75g == null && (!z || !(this.v instanceof w))) {
            c.b.e.i.g gVar = panelFeatureState.f76h;
            if (gVar == null || panelFeatureState.p) {
                if (gVar == null) {
                    Context context = this.r;
                    int i3 = panelFeatureState.a;
                    if ((i3 == 0 || i3 == 108) && this.y != null) {
                        TypedValue typedValue = new TypedValue();
                        Resources.Theme theme = context.getTheme();
                        theme.resolveAttribute(com.ifpdos.debugmenu.R.attr.actionBarTheme, typedValue, true);
                        if (typedValue.resourceId != 0) {
                            themeNewTheme = context.getResources().newTheme();
                            themeNewTheme.setTo(theme);
                            themeNewTheme.applyStyle(typedValue.resourceId, true);
                            themeNewTheme.resolveAttribute(com.ifpdos.debugmenu.R.attr.actionBarWidgetTheme, typedValue, true);
                        } else {
                            theme.resolveAttribute(com.ifpdos.debugmenu.R.attr.actionBarWidgetTheme, typedValue, true);
                            themeNewTheme = null;
                        }
                        if (typedValue.resourceId != 0) {
                            if (themeNewTheme == null) {
                                themeNewTheme = context.getResources().newTheme();
                                themeNewTheme.setTo(theme);
                            }
                            themeNewTheme.applyStyle(typedValue.resourceId, true);
                        }
                        if (themeNewTheme != null) {
                            c.b.e.c cVar = new c.b.e.c(context, 0);
                            cVar.getTheme().setTo(themeNewTheme);
                            context = cVar;
                        }
                    }
                    c.b.e.i.g gVar2 = new c.b.e.i.g(context);
                    gVar2.f716f = this;
                    panelFeatureState.a(gVar2);
                    if (panelFeatureState.f76h == null) {
                        return false;
                    }
                }
                if (z && (i0Var2 = this.y) != null) {
                    if (this.z == null) {
                        this.z = new d();
                    }
                    i0Var2.a(panelFeatureState.f76h, this.z);
                }
                panelFeatureState.f76h.z();
                if (!callbackT.onCreatePanelMenu(panelFeatureState.a, panelFeatureState.f76h)) {
                    panelFeatureState.a(null);
                    if (z && (i0Var = this.y) != null) {
                        i0Var.a(null, this.z);
                    }
                    return false;
                }
                panelFeatureState.p = false;
            }
            panelFeatureState.f76h.z();
            Bundle bundle = panelFeatureState.q;
            if (bundle != null) {
                panelFeatureState.f76h.v(bundle);
                panelFeatureState.q = null;
            }
            if (!callbackT.onPreparePanel(0, panelFeatureState.f75g, panelFeatureState.f76h)) {
                if (z && (i0Var3 = this.y) != null) {
                    i0Var3.a(null, this.z);
                }
                panelFeatureState.f76h.y();
                return false;
            }
            boolean z2 = KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1;
            panelFeatureState.n = z2;
            panelFeatureState.f76h.setQwertyMode(z2);
            panelFeatureState.f76h.y();
        }
        panelFeatureState.f79k = true;
        panelFeatureState.f80l = false;
        this.T = panelFeatureState;
        return true;
    }

    @Override // c.b.e.i.g.a
    public void b(c.b.e.i.g gVar) {
        i0 i0Var = this.y;
        if (i0Var == null || !i0Var.d() || (ViewConfiguration.get(this.r).hasPermanentMenuKey() && !this.y.f())) {
            PanelFeatureState panelFeatureStateS = S(0);
            panelFeatureStateS.o = true;
            J(panelFeatureStateS, false);
            Y(panelFeatureStateS, null);
            return;
        }
        Window.Callback callbackT = T();
        if (this.y.b()) {
            this.y.g();
            if (this.X) {
                return;
            }
            callbackT.onPanelClosed(108, S(0).f76h);
            return;
        }
        if (callbackT == null || this.X) {
            return;
        }
        if (this.f0 && (1 & this.g0) != 0) {
            this.s.getDecorView().removeCallbacks(this.h0);
            this.h0.run();
        }
        PanelFeatureState panelFeatureStateS2 = S(0);
        c.b.e.i.g gVar2 = panelFeatureStateS2.f76h;
        if (gVar2 == null || panelFeatureStateS2.p || !callbackT.onPreparePanel(0, panelFeatureStateS2.f75g, gVar2)) {
            return;
        }
        callbackT.onMenuOpened(108, panelFeatureStateS2.f76h);
        this.y.h();
    }

    public final boolean b0() {
        ViewGroup viewGroup;
        if (this.G && (viewGroup = this.H) != null) {
            WeakHashMap<View, c.f.j.i0> weakHashMap = a0.a;
            if (a0.f.c(viewGroup)) {
                return true;
            }
        }
        return false;
    }

    @Override // c.b.c.l
    public void c(View view, ViewGroup.LayoutParams layoutParams) {
        O();
        ((ViewGroup) this.H.findViewById(R.id.content)).addView(view, layoutParams);
        this.t.a(this.s.getCallback());
    }

    public final void c0() {
        if (this.G) {
            throw new AndroidRuntimeException("Window feature must be requested before adding content");
        }
    }

    @Override // c.b.c.l
    public Context d(final Context context) {
        Configuration configuration;
        this.V = true;
        int i2 = this.Z;
        if (i2 == -100) {
            i2 = c.b.c.l.f554e;
        }
        int iW = W(context, i2);
        if (c.b.c.l.m(context) && c.b.c.l.m(context)) {
            if (!c.f.b.h.s()) {
                synchronized (c.b.c.l.f561l) {
                    c.f.f.d dVar = c.b.c.l.f555f;
                    if (dVar == null) {
                        if (c.b.c.l.f556g == null) {
                            c.b.c.l.f556g = c.f.f.d.b(c.b.a.h(context));
                        }
                        if (!c.b.c.l.f556g.d()) {
                            c.b.c.l.f555f = c.b.c.l.f556g;
                        }
                    } else if (!dVar.equals(c.b.c.l.f556g)) {
                        c.f.f.d dVar2 = c.b.c.l.f555f;
                        c.b.c.l.f556g = dVar2;
                        c.b.a.g(context, dVar2.f());
                    }
                }
            } else if (!c.b.c.l.f558i) {
                c.b.c.l.f553b.execute(new Runnable() { // from class: c.b.c.a
                    /* JADX WARN: Removed duplicated region for block: B:22:0x005e  */
                    /* JADX WARN: Removed duplicated region for block: B:25:0x0066  */
                    @Override // java.lang.Runnable
                    /*
                        Code decompiled incorrectly, please refer to instructions dump.
                        To view partially-correct add '--show-bad-code' argument
                    */
                    public final void run() {
                        /*
                            r7 = this;
                            android.content.Context r0 = r1
                            int r1 = android.os.Build.VERSION.SDK_INT
                            r2 = 33
                            r3 = 1
                            if (r1 < r2) goto L7e
                            android.content.ComponentName r1 = new android.content.ComponentName
                            java.lang.String r2 = "androidx.appcompat.app.AppLocalesMetadataHolderService"
                            r1.<init>(r0, r2)
                            android.content.pm.PackageManager r2 = r0.getPackageManager()
                            int r2 = r2.getComponentEnabledSetting(r1)
                            if (r2 == r3) goto L7e
                            boolean r2 = c.f.b.h.s()
                            java.lang.String r4 = "locale"
                            if (r2 == 0) goto L59
                            c.d.c<java.lang.ref.WeakReference<c.b.c.l>> r2 = c.b.c.l.f559j
                            java.util.Iterator r2 = r2.iterator()
                        L28:
                            boolean r5 = r2.hasNext()
                            if (r5 == 0) goto L47
                            java.lang.Object r5 = r2.next()
                            java.lang.ref.WeakReference r5 = (java.lang.ref.WeakReference) r5
                            java.lang.Object r5 = r5.get()
                            c.b.c.l r5 = (c.b.c.l) r5
                            if (r5 == 0) goto L28
                            android.content.Context r5 = r5.f()
                            if (r5 == 0) goto L28
                            java.lang.Object r2 = r5.getSystemService(r4)
                            goto L48
                        L47:
                            r2 = 0
                        L48:
                            if (r2 == 0) goto L5e
                            android.os.LocaleList r2 = c.b.c.l.b.a(r2)
                            c.f.f.d r5 = new c.f.f.d
                            c.f.f.f r6 = new c.f.f.f
                            r6.<init>(r2)
                            r5.<init>(r6)
                            goto L60
                        L59:
                            c.f.f.d r5 = c.b.c.l.f555f
                            if (r5 == 0) goto L5e
                            goto L60
                        L5e:
                            c.f.f.d r5 = c.f.f.d.a
                        L60:
                            boolean r2 = r5.d()
                            if (r2 == 0) goto L77
                            java.lang.String r2 = c.b.a.h(r0)
                            java.lang.Object r4 = r0.getSystemService(r4)
                            if (r4 == 0) goto L77
                            android.os.LocaleList r2 = c.b.c.l.a.a(r2)
                            c.b.c.l.b.b(r4, r2)
                        L77:
                            android.content.pm.PackageManager r0 = r0.getPackageManager()
                            r0.setComponentEnabledSetting(r1, r3, r3)
                        L7e:
                            c.b.c.l.f558i = r3
                            return
                        */
                        throw new UnsupportedOperationException("Method not decompiled: c.b.c.a.run():void");
                    }
                });
            }
        }
        c.f.f.d dVarG = G(context);
        if (p && (context instanceof ContextThemeWrapper)) {
            try {
                ((ContextThemeWrapper) context).applyOverrideConfiguration(K(context, iW, dVarG, null, false));
                return context;
            } catch (IllegalStateException unused) {
            }
        }
        if (context instanceof c.b.e.c) {
            try {
                ((c.b.e.c) context).a(K(context, iW, dVarG, null, false));
                return context;
            } catch (IllegalStateException unused2) {
            }
        }
        if (!o) {
            return context;
        }
        Configuration configuration2 = new Configuration();
        configuration2.uiMode = -1;
        configuration2.fontScale = 0.0f;
        Configuration configuration3 = context.createConfigurationContext(configuration2).getResources().getConfiguration();
        Configuration configuration4 = context.getResources().getConfiguration();
        configuration3.uiMode = configuration4.uiMode;
        if (configuration3.equals(configuration4)) {
            configuration = null;
        } else {
            Configuration configuration5 = new Configuration();
            configuration5.fontScale = 0.0f;
            if (configuration3.diff(configuration4) != 0) {
                float f2 = configuration3.fontScale;
                float f3 = configuration4.fontScale;
                if (f2 != f3) {
                    configuration5.fontScale = f3;
                }
                int i3 = configuration3.mcc;
                int i4 = configuration4.mcc;
                if (i3 != i4) {
                    configuration5.mcc = i4;
                }
                int i5 = configuration3.mnc;
                int i6 = configuration4.mnc;
                if (i5 != i6) {
                    configuration5.mnc = i6;
                }
                f.a(configuration3, configuration4, configuration5);
                int i7 = configuration3.touchscreen;
                int i8 = configuration4.touchscreen;
                if (i7 != i8) {
                    configuration5.touchscreen = i8;
                }
                int i9 = configuration3.keyboard;
                int i10 = configuration4.keyboard;
                if (i9 != i10) {
                    configuration5.keyboard = i10;
                }
                int i11 = configuration3.keyboardHidden;
                int i12 = configuration4.keyboardHidden;
                if (i11 != i12) {
                    configuration5.keyboardHidden = i12;
                }
                int i13 = configuration3.navigation;
                int i14 = configuration4.navigation;
                if (i13 != i14) {
                    configuration5.navigation = i14;
                }
                int i15 = configuration3.navigationHidden;
                int i16 = configuration4.navigationHidden;
                if (i15 != i16) {
                    configuration5.navigationHidden = i16;
                }
                int i17 = configuration3.orientation;
                int i18 = configuration4.orientation;
                if (i17 != i18) {
                    configuration5.orientation = i18;
                }
                int i19 = configuration3.screenLayout & 15;
                int i20 = configuration4.screenLayout & 15;
                if (i19 != i20) {
                    configuration5.screenLayout |= i20;
                }
                int i21 = configuration3.screenLayout & 192;
                int i22 = configuration4.screenLayout & 192;
                if (i21 != i22) {
                    configuration5.screenLayout |= i22;
                }
                int i23 = configuration3.screenLayout & 48;
                int i24 = configuration4.screenLayout & 48;
                if (i23 != i24) {
                    configuration5.screenLayout |= i24;
                }
                int i25 = configuration3.screenLayout & 768;
                int i26 = configuration4.screenLayout & 768;
                if (i25 != i26) {
                    configuration5.screenLayout |= i26;
                }
                int i27 = configuration3.colorMode & 3;
                int i28 = configuration4.colorMode & 3;
                if (i27 != i28) {
                    configuration5.colorMode |= i28;
                }
                int i29 = configuration3.colorMode & 12;
                int i30 = configuration4.colorMode & 12;
                if (i29 != i30) {
                    configuration5.colorMode |= i30;
                }
                int i31 = configuration3.uiMode & 15;
                int i32 = configuration4.uiMode & 15;
                if (i31 != i32) {
                    configuration5.uiMode |= i32;
                }
                int i33 = configuration3.uiMode & 48;
                int i34 = configuration4.uiMode & 48;
                if (i33 != i34) {
                    configuration5.uiMode |= i34;
                }
                int i35 = configuration3.screenWidthDp;
                int i36 = configuration4.screenWidthDp;
                if (i35 != i36) {
                    configuration5.screenWidthDp = i36;
                }
                int i37 = configuration3.screenHeightDp;
                int i38 = configuration4.screenHeightDp;
                if (i37 != i38) {
                    configuration5.screenHeightDp = i38;
                }
                int i39 = configuration3.smallestScreenWidthDp;
                int i40 = configuration4.smallestScreenWidthDp;
                if (i39 != i40) {
                    configuration5.smallestScreenWidthDp = i40;
                }
                int i41 = configuration3.densityDpi;
                int i42 = configuration4.densityDpi;
                if (i41 != i42) {
                    configuration5.densityDpi = i42;
                }
            }
            configuration = configuration5;
        }
        Configuration configurationK = K(context, iW, dVarG, configuration, true);
        c.b.e.c cVar = new c.b.e.c(context, 2131820820);
        cVar.a(configurationK);
        boolean z = context.getTheme() != null;
        if (z) {
            Resources.Theme theme = cVar.getTheme();
            if (Build.VERSION.SDK_INT >= 29) {
                c.f.c.b.m.a(theme);
            } else {
                synchronized (c.f.c.b.l.a) {
                    if (!c.f.c.b.l.f1321c) {
                        try {
                            Method declaredMethod = Resources.Theme.class.getDeclaredMethod("rebase", new Class[0]);
                            c.f.c.b.l.f1320b = declaredMethod;
                            declaredMethod.setAccessible(true);
                        } catch (NoSuchMethodException e2) {
                            Log.i("ResourcesCompat", "Failed to retrieve rebase() method", e2);
                        }
                        c.f.c.b.l.f1321c = true;
                    }
                    Method method = c.f.c.b.l.f1320b;
                    if (method != null) {
                        try {
                            method.invoke(theme, new Object[0]);
                        } catch (IllegalAccessException | InvocationTargetException e3) {
                            Log.i("ResourcesCompat", "Failed to invoke rebase() method via reflection", e3);
                            c.f.c.b.l.f1320b = null;
                        }
                    }
                }
            }
        }
        return cVar;
    }

    public void d0() {
        OnBackInvokedCallback onBackInvokedCallback;
        if (Build.VERSION.SDK_INT >= 33) {
            boolean z = false;
            if (this.m0 != null && (S(0).m || this.B != null)) {
                z = true;
            }
            if (z && this.n0 == null) {
                this.n0 = g.b(this.m0, this);
            } else {
                if (z || (onBackInvokedCallback = this.n0) == null) {
                    return;
                }
                g.c(this.m0, onBackInvokedCallback);
            }
        }
    }

    @Override // c.b.c.l
    public <T extends View> T e(int i2) {
        O();
        return (T) this.s.findViewById(i2);
    }

    public final int e0(m0 m0Var, Rect rect) {
        boolean z;
        boolean z2;
        int iA;
        int iD = m0Var.d();
        ActionBarContextView actionBarContextView = this.C;
        if (actionBarContextView == null || !(actionBarContextView.getLayoutParams() instanceof ViewGroup.MarginLayoutParams)) {
            z = false;
        } else {
            ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.C.getLayoutParams();
            if (this.C.isShown()) {
                if (this.j0 == null) {
                    this.j0 = new Rect();
                    this.k0 = new Rect();
                }
                Rect rect2 = this.j0;
                Rect rect3 = this.k0;
                rect2.set(m0Var.b(), m0Var.d(), m0Var.c(), m0Var.a());
                i1.a(this.H, rect2, rect3);
                int i2 = rect2.top;
                int i3 = rect2.left;
                int i4 = rect2.right;
                ViewGroup viewGroup = this.H;
                WeakHashMap<View, c.f.j.i0> weakHashMap = a0.a;
                m0 m0VarA = a0.i.a(viewGroup);
                int iB = m0VarA == null ? 0 : m0VarA.b();
                int iC = m0VarA == null ? 0 : m0VarA.c();
                if (marginLayoutParams.topMargin == i2 && marginLayoutParams.leftMargin == i3 && marginLayoutParams.rightMargin == i4) {
                    z2 = false;
                } else {
                    marginLayoutParams.topMargin = i2;
                    marginLayoutParams.leftMargin = i3;
                    marginLayoutParams.rightMargin = i4;
                    z2 = true;
                }
                if (i2 <= 0 || this.J != null) {
                    View view = this.J;
                    if (view != null) {
                        ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
                        int i5 = marginLayoutParams2.height;
                        int i6 = marginLayoutParams.topMargin;
                        if (i5 != i6 || marginLayoutParams2.leftMargin != iB || marginLayoutParams2.rightMargin != iC) {
                            marginLayoutParams2.height = i6;
                            marginLayoutParams2.leftMargin = iB;
                            marginLayoutParams2.rightMargin = iC;
                            this.J.setLayoutParams(marginLayoutParams2);
                        }
                    }
                } else {
                    View view2 = new View(this.r);
                    this.J = view2;
                    view2.setVisibility(8);
                    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, marginLayoutParams.topMargin, 51);
                    layoutParams.leftMargin = iB;
                    layoutParams.rightMargin = iC;
                    this.H.addView(this.J, -1, layoutParams);
                }
                View view3 = this.J;
                z = view3 != null;
                if (z && view3.getVisibility() != 0) {
                    View view4 = this.J;
                    if ((a0.d.g(view4) & InvokeCmd.CMD_TOUCH_CTRL_START) != 0) {
                        Context context = this.r;
                        Object obj = c.f.c.a.a;
                        iA = a.c.a(context, com.ifpdos.debugmenu.R.color.abc_decor_view_status_guard_light);
                    } else {
                        Context context2 = this.r;
                        Object obj2 = c.f.c.a.a;
                        iA = a.c.a(context2, com.ifpdos.debugmenu.R.color.abc_decor_view_status_guard);
                    }
                    view4.setBackgroundColor(iA);
                }
                if (!this.O && z) {
                    iD = 0;
                }
                z = z2;
            } else if (marginLayoutParams.topMargin != 0) {
                marginLayoutParams.topMargin = 0;
                z = false;
            } else {
                z = false;
                z = false;
            }
            if (z) {
                this.C.setLayoutParams(marginLayoutParams);
            }
        }
        View view5 = this.J;
        if (view5 != null) {
            view5.setVisibility(z ? 0 : 8);
        }
        return iD;
    }

    @Override // c.b.c.l
    public Context f() {
        return this.r;
    }

    @Override // c.b.c.l
    public final c.b.c.f g() {
        return new b(this);
    }

    @Override // c.b.c.l
    public int h() {
        return this.Z;
    }

    @Override // c.b.c.l
    public MenuInflater i() {
        if (this.w == null) {
            U();
            c.b.c.e eVar = this.v;
            this.w = new c.b.e.f(eVar != null ? eVar.e() : this.r);
        }
        return this.w;
    }

    @Override // c.b.c.l
    public c.b.c.e j() {
        U();
        return this.v;
    }

    @Override // c.b.c.l
    public void k() {
        LayoutInflater layoutInflaterFrom = LayoutInflater.from(this.r);
        if (layoutInflaterFrom.getFactory() == null) {
            layoutInflaterFrom.setFactory2(this);
        } else {
            if (layoutInflaterFrom.getFactory2() instanceof AppCompatDelegateImpl) {
                return;
            }
            Log.i("AppCompatDelegate", "The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's");
        }
    }

    @Override // c.b.c.l
    public void l() {
        if (this.v != null) {
            U();
            if (this.v.f()) {
                return;
            }
            V(0);
        }
    }

    @Override // c.b.c.l
    public void n(Configuration configuration) {
        if (this.M && this.G) {
            U();
            c.b.c.e eVar = this.v;
            if (eVar != null) {
                eVar.g(configuration);
            }
        }
        c.b.f.m mVarA = c.b.f.m.a();
        Context context = this.r;
        synchronized (mVarA) {
            t0 t0Var = mVarA.f895c;
            synchronized (t0Var) {
                c.d.e<WeakReference<Drawable.ConstantState>> eVar2 = t0Var.f959g.get(context);
                if (eVar2 != null) {
                    eVar2.a();
                }
            }
        }
        this.Y = new Configuration(this.r.getResources().getConfiguration());
        E(false, false);
    }

    @Override // c.b.c.l
    public void o(Bundle bundle) {
        this.V = true;
        E(false, true);
        P();
        Object obj = this.q;
        if (obj instanceof Activity) {
            String strP = null;
            try {
                Activity activity = (Activity) obj;
                try {
                    strP = c.f.b.h.p(activity, activity.getComponentName());
                } catch (PackageManager.NameNotFoundException e2) {
                    throw new IllegalArgumentException(e2);
                }
            } catch (IllegalArgumentException unused) {
            }
            if (strP != null) {
                c.b.c.e eVar = this.v;
                if (eVar == null) {
                    this.i0 = true;
                } else {
                    eVar.l(true);
                }
            }
            synchronized (c.b.c.l.f560k) {
                c.b.c.l.v(this);
                c.b.c.l.f559j.add(new WeakReference<>(this));
            }
        }
        this.Y = new Configuration(this.r.getResources().getConfiguration());
        this.W = true;
    }

    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    @Override // android.view.LayoutInflater.Factory2
    public final View onCreateView(View view, String str, Context context, AttributeSet attributeSet) {
        View xVar;
        if (this.l0 == null) {
            String string = this.r.obtainStyledAttributes(c.b.b.f541j).getString(116);
            if (string == null) {
                this.l0 = new s();
            } else {
                try {
                    this.l0 = (s) this.r.getClassLoader().loadClass(string).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
                } catch (Throwable th) {
                    Log.i("AppCompatDelegate", "Failed to instantiate custom view inflater " + string + ". Falling back to default.", th);
                    this.l0 = new s();
                }
            }
        }
        s sVar = this.l0;
        int i2 = h1.a;
        Objects.requireNonNull(sVar);
        byte b2 = 4;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, c.b.b.y, 0, 0);
        int resourceId = typedArrayObtainStyledAttributes.getResourceId(4, 0);
        if (resourceId != 0) {
            Log.i("AppCompatViewInflater", "app:theme is now deprecated. Please move to using android:theme instead.");
        }
        typedArrayObtainStyledAttributes.recycle();
        Context cVar = (resourceId == 0 || ((context instanceof c.b.e.c) && ((c.b.e.c) context).f619b == resourceId)) ? context : new c.b.e.c(context, resourceId);
        str.hashCode();
        switch (str.hashCode()) {
            case -1946472170:
                b2 = !str.equals("RatingBar") ? (byte) -1 : (byte) 0;
                break;
            case -1455429095:
                b2 = !str.equals("CheckedTextView") ? (byte) -1 : (byte) 1;
                break;
            case -1346021293:
                b2 = !str.equals("MultiAutoCompleteTextView") ? (byte) -1 : (byte) 2;
                break;
            case -938935918:
                b2 = !str.equals("TextView") ? (byte) -1 : (byte) 3;
                break;
            case -937446323:
                if (!str.equals("ImageButton")) {
                    b2 = -1;
                }
                break;
            case -658531749:
                b2 = !str.equals("SeekBar") ? (byte) -1 : (byte) 5;
                break;
            case -339785223:
                b2 = !str.equals("Spinner") ? (byte) -1 : (byte) 6;
                break;
            case 776382189:
                b2 = !str.equals("RadioButton") ? (byte) -1 : (byte) 7;
                break;
            case 799298502:
                b2 = !str.equals("ToggleButton") ? (byte) -1 : (byte) 8;
                break;
            case 1125864064:
                b2 = !str.equals("ImageView") ? (byte) -1 : (byte) 9;
                break;
            case 1413872058:
                b2 = !str.equals("AutoCompleteTextView") ? (byte) -1 : (byte) 10;
                break;
            case 1601505219:
                b2 = !str.equals("CheckBox") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_H;
                break;
            case 1666676343:
                b2 = !str.equals("EditText") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_I;
                break;
            case 2001146706:
                b2 = !str.equals("Button") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_J;
                break;
            default:
                b2 = -1;
                break;
        }
        View view2 = null;
        switch (b2) {
            case 0:
                xVar = new c.b.f.x(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 1:
                xVar = new c.b.f.j(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 2:
                xVar = new t(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 3:
                xVar = new f0(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 4:
                xVar = new q(cVar, attributeSet, com.ifpdos.debugmenu.R.attr.imageButtonStyle);
                sVar.b(xVar, str);
                break;
            case 5:
                xVar = new c.b.f.z(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 6:
                xVar = new AppCompatSpinner(cVar, attributeSet, com.ifpdos.debugmenu.R.attr.spinnerStyle);
                sVar.b(xVar, str);
                break;
            case 7:
                xVar = new c.b.f.w(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 8:
                xVar = new h0(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 9:
                xVar = new c.b.f.s(cVar, attributeSet, 0);
                sVar.b(xVar, str);
                break;
            case 10:
                xVar = new c.b.f.f(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 11:
                xVar = new c.b.f.i(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 12:
                xVar = new c.b.f.n(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            case 13:
                xVar = new c.b.f.h(cVar, attributeSet);
                sVar.b(xVar, str);
                break;
            default:
                xVar = null;
                break;
        }
        if (xVar == null && context != cVar) {
            if (str.equals("view")) {
                str = attributeSet.getAttributeValue(null, "class");
            }
            try {
                Object[] objArr = sVar.f571h;
                objArr[0] = cVar;
                objArr[1] = attributeSet;
                if (-1 == str.indexOf(46)) {
                    int i3 = 0;
                    while (true) {
                        String[] strArr = s.f569f;
                        if (i3 < strArr.length) {
                            View viewA = sVar.a(cVar, str, strArr[i3]);
                            if (viewA != null) {
                                Object[] objArr2 = sVar.f571h;
                                objArr2[0] = null;
                                objArr2[1] = null;
                                view2 = viewA;
                            } else {
                                i3++;
                            }
                        }
                    }
                } else {
                    View viewA2 = sVar.a(cVar, str, null);
                    Object[] objArr3 = sVar.f571h;
                    objArr3[0] = null;
                    objArr3[1] = null;
                    view2 = viewA2;
                }
            } catch (Exception unused) {
            } finally {
                Object[] objArr4 = sVar.f571h;
                objArr4[0] = null;
                objArr4[1] = null;
            }
            xVar = view2;
        }
        if (xVar != null) {
            Context context2 = xVar.getContext();
            if (context2 instanceof ContextWrapper) {
                WeakHashMap<View, c.f.j.i0> weakHashMap = a0.a;
                if (a0.c.a(xVar)) {
                    TypedArray typedArrayObtainStyledAttributes2 = context2.obtainStyledAttributes(attributeSet, s.f565b);
                    String string2 = typedArrayObtainStyledAttributes2.getString(0);
                    if (string2 != null) {
                        xVar.setOnClickListener(new s.a(xVar, string2));
                    }
                    typedArrayObtainStyledAttributes2.recycle();
                }
            }
            if (Build.VERSION.SDK_INT <= 28) {
                TypedArray typedArrayObtainStyledAttributes3 = cVar.obtainStyledAttributes(attributeSet, s.f566c);
                if (typedArrayObtainStyledAttributes3.hasValue(0)) {
                    boolean z = typedArrayObtainStyledAttributes3.getBoolean(0, false);
                    WeakHashMap<View, c.f.j.i0> weakHashMap2 = a0.a;
                    new c.f.j.z(com.ifpdos.debugmenu.R.id.tag_accessibility_heading, Boolean.class, 28).e(xVar, Boolean.valueOf(z));
                }
                typedArrayObtainStyledAttributes3.recycle();
                TypedArray typedArrayObtainStyledAttributes4 = cVar.obtainStyledAttributes(attributeSet, s.f567d);
                if (typedArrayObtainStyledAttributes4.hasValue(0)) {
                    a0.m(xVar, typedArrayObtainStyledAttributes4.getString(0));
                }
                typedArrayObtainStyledAttributes4.recycle();
                TypedArray typedArrayObtainStyledAttributes5 = cVar.obtainStyledAttributes(attributeSet, s.f568e);
                if (typedArrayObtainStyledAttributes5.hasValue(0)) {
                    boolean z2 = typedArrayObtainStyledAttributes5.getBoolean(0, false);
                    WeakHashMap<View, c.f.j.i0> weakHashMap3 = a0.a;
                    new c.f.j.w(com.ifpdos.debugmenu.R.id.tag_screen_reader_focusable, Boolean.class, 28).e(xVar, Boolean.valueOf(z2));
                }
                typedArrayObtainStyledAttributes5.recycle();
            }
        }
        return xVar;
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x004d  */
    @Override // c.b.c.l
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void p() {
        /*
            r3 = this;
            java.lang.Object r0 = r3.q
            boolean r0 = r0 instanceof android.app.Activity
            if (r0 == 0) goto L11
            java.lang.Object r0 = c.b.c.l.f560k
            monitor-enter(r0)
            c.b.c.l.v(r3)     // Catch: java.lang.Throwable -> Le
            monitor-exit(r0)     // Catch: java.lang.Throwable -> Le
            goto L11
        Le:
            r1 = move-exception
            monitor-exit(r0)     // Catch: java.lang.Throwable -> Le
            throw r1
        L11:
            boolean r0 = r3.f0
            if (r0 == 0) goto L20
            android.view.Window r0 = r3.s
            android.view.View r0 = r0.getDecorView()
            java.lang.Runnable r1 = r3.h0
            r0.removeCallbacks(r1)
        L20:
            r0 = 1
            r3.X = r0
            int r0 = r3.Z
            r1 = -100
            if (r0 == r1) goto L4d
            java.lang.Object r0 = r3.q
            boolean r1 = r0 instanceof android.app.Activity
            if (r1 == 0) goto L4d
            android.app.Activity r0 = (android.app.Activity) r0
            boolean r0 = r0.isChangingConfigurations()
            if (r0 == 0) goto L4d
            c.d.h<java.lang.String, java.lang.Integer> r0 = androidx.appcompat.app.AppCompatDelegateImpl.m
            java.lang.Object r1 = r3.q
            java.lang.Class r1 = r1.getClass()
            java.lang.String r1 = r1.getName()
            int r2 = r3.Z
            java.lang.Integer r2 = java.lang.Integer.valueOf(r2)
            r0.put(r1, r2)
            goto L5c
        L4d:
            c.d.h<java.lang.String, java.lang.Integer> r0 = androidx.appcompat.app.AppCompatDelegateImpl.m
            java.lang.Object r1 = r3.q
            java.lang.Class r1 = r1.getClass()
            java.lang.String r1 = r1.getName()
            r0.remove(r1)
        L5c:
            c.b.c.e r0 = r3.v
            if (r0 == 0) goto L63
            r0.h()
        L63:
            androidx.appcompat.app.AppCompatDelegateImpl$j r0 = r3.d0
            if (r0 == 0) goto L6a
            r0.a()
        L6a:
            androidx.appcompat.app.AppCompatDelegateImpl$j r0 = r3.e0
            if (r0 == 0) goto L71
            r0.a()
        L71:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.p():void");
    }

    @Override // c.b.c.l
    public void q(Bundle bundle) {
        O();
    }

    @Override // c.b.c.l
    public void r() {
        U();
        c.b.c.e eVar = this.v;
        if (eVar != null) {
            eVar.m(true);
        }
    }

    @Override // c.b.c.l
    public void s(Bundle bundle) {
    }

    @Override // c.b.c.l
    public void t() {
        E(true, false);
    }

    @Override // c.b.c.l
    public void u() {
        U();
        c.b.c.e eVar = this.v;
        if (eVar != null) {
            eVar.m(false);
        }
    }

    @Override // c.b.c.l
    public boolean w(int i2) {
        if (i2 == 8) {
            Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR id when requesting this feature.");
            i2 = 108;
        } else if (i2 == 9) {
            Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY id when requesting this feature.");
            i2 = 109;
        }
        if (this.Q && i2 == 108) {
            return false;
        }
        if (this.M && i2 == 1) {
            this.M = false;
        }
        if (i2 == 1) {
            c0();
            this.Q = true;
            return true;
        }
        if (i2 == 2) {
            c0();
            this.K = true;
            return true;
        }
        if (i2 == 5) {
            c0();
            this.L = true;
            return true;
        }
        if (i2 == 10) {
            c0();
            this.O = true;
            return true;
        }
        if (i2 == 108) {
            c0();
            this.M = true;
            return true;
        }
        if (i2 != 109) {
            return this.s.requestFeature(i2);
        }
        c0();
        this.N = true;
        return true;
    }

    @Override // c.b.c.l
    public void x(int i2) {
        O();
        ViewGroup viewGroup = (ViewGroup) this.H.findViewById(R.id.content);
        viewGroup.removeAllViews();
        LayoutInflater.from(this.r).inflate(i2, viewGroup);
        this.t.a(this.s.getCallback());
    }

    @Override // c.b.c.l
    public void y(View view) {
        O();
        ViewGroup viewGroup = (ViewGroup) this.H.findViewById(R.id.content);
        viewGroup.removeAllViews();
        viewGroup.addView(view);
        this.t.a(this.s.getCallback());
    }

    @Override // c.b.c.l
    public void z(View view, ViewGroup.LayoutParams layoutParams) {
        O();
        ViewGroup viewGroup = (ViewGroup) this.H.findViewById(R.id.content);
        viewGroup.removeAllViews();
        viewGroup.addView(view, layoutParams);
        this.t.a(this.s.getCallback());
    }

    @Override // android.view.LayoutInflater.Factory
    public View onCreateView(String str, Context context, AttributeSet attributeSet) {
        return onCreateView(null, str, context, attributeSet);
    }
}
