package d;

import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.window.OnBackInvokedDispatcher;
import androidx.lifecycle.C1115y;
import androidx.lifecycle.EnumC1107p;
import androidx.lifecycle.InterfaceC1113w;
import androidx.lifecycle.X;
import com.debridstream.tv.R;
import d3.C1931v0;
import m3.AbstractC2478m;
import n2.C2616g;
import n2.C2617h;
import n2.InterfaceC2618i;
import p2.C2720a;

/* JADX INFO: renamed from: d.m, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class DialogC1834m extends Dialog implements InterfaceC1113w, InterfaceC1819C, InterfaceC2618i {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public C1115y f14490a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final C2617h f14491b;

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public DialogC1834m(Context context, int i6) {
        super(context, i6);
        kotlin.jvm.internal.o.h(context, "context");
        this.f14491b = new C2617h(new C2720a(this, new C1931v0(this, 9)));
        this.f14492c = new C1818B(new F1.r(this, 17));
    }

    public static void a(DialogC1834m dialogC1834m) {
        super.onBackPressed();
    }

    @Override // android.app.Dialog
    public final void addContentView(View view, ViewGroup.LayoutParams layoutParams) {
        kotlin.jvm.internal.o.h(view, "view");
        b();
        super.addContentView(view, layoutParams);
    }

    public final void b() {
        Window window = getWindow();
        kotlin.jvm.internal.o.e(window);
        View decorView = window.getDecorView();
        kotlin.jvm.internal.o.g(decorView, "window!!.decorView");
        X.i(decorView, this);
        Window window2 = getWindow();
        kotlin.jvm.internal.o.e(window2);
        View decorView2 = window2.getDecorView();
        kotlin.jvm.internal.o.g(decorView2, "window!!.decorView");
        decorView2.setTag(R.id.view_tree_on_back_pressed_dispatcher_owner, this);
        Window window3 = getWindow();
        kotlin.jvm.internal.o.e(window3);
        View decorView3 = window3.getDecorView();
        kotlin.jvm.internal.o.g(decorView3, "window!!.decorView");
        AbstractC2478m.p(decorView3, this);
    }

    @Override // androidx.lifecycle.InterfaceC1113w
    public final androidx.lifecycle.r getLifecycle() {
        C1115y c1115y = this.f14490a;
        if (c1115y != null) {
            return c1115y;
        }
        C1115y c1115y2 = new C1115y(this, true);
        this.f14490a = c1115y2;
        return c1115y2;
    }

    @Override // d.InterfaceC1819C
    public final C1818B getOnBackPressedDispatcher() {
        return this.f14492c;
    }

    @Override // n2.InterfaceC2618i
    public final C2616g getSavedStateRegistry() {
        return this.f14491b.f21615b;
    }

    @Override // android.app.Dialog
    public final void onBackPressed() {
        this.f14492c.c();
    }

    @Override // android.app.Dialog
    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (Build.VERSION.SDK_INT >= 33) {
            OnBackInvokedDispatcher onBackInvokedDispatcher = getOnBackInvokedDispatcher();
            kotlin.jvm.internal.o.g(onBackInvokedDispatcher, "onBackInvokedDispatcher");
            C1818B c1818b = this.f14492c;
            c1818b.f14460e = onBackInvokedDispatcher;
            c1818b.d(c1818b.f14462g);
        }
        this.f14491b.b(bundle);
        C1115y c1115y = this.f14490a;
        if (c1115y == null) {
            c1115y = new C1115y(this, true);
            this.f14490a = c1115y;
        }
        c1115y.c(EnumC1107p.ON_CREATE);
    }

    @Override // android.app.Dialog
    public final Bundle onSaveInstanceState() {
        Bundle bundleOnSaveInstanceState = super.onSaveInstanceState();
        kotlin.jvm.internal.o.g(bundleOnSaveInstanceState, "super.onSaveInstanceState()");
        this.f14491b.c(bundleOnSaveInstanceState);
        return bundleOnSaveInstanceState;
    }

    @Override // android.app.Dialog
    public final void onStart() {
        super.onStart();
        C1115y c1115y = this.f14490a;
        if (c1115y == null) {
            c1115y = new C1115y(this, true);
            this.f14490a = c1115y;
        }
        c1115y.c(EnumC1107p.ON_RESUME);
    }

    @Override // android.app.Dialog
    public final void onStop() {
        C1115y c1115y = this.f14490a;
        if (c1115y == null) {
            c1115y = new C1115y(this, true);
            this.f14490a = c1115y;
        }
        c1115y.c(EnumC1107p.ON_DESTROY);
        this.f14490a = null;
        super.onStop();
    }

    @Override // android.app.Dialog
    public final void setContentView(int i6) {
        b();
        super.setContentView(i6);
    }

    @Override // android.app.Dialog
    public final void setContentView(View view) {
        kotlin.jvm.internal.o.h(view, "view");
        b();
        super.setContentView(view);
    }

    @Override // android.app.Dialog
    public final void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
        kotlin.jvm.internal.o.h(view, "view");
        b();
        super.setContentView(view, layoutParams);
    }
}
