package ῲ.ᓣ.K;

import android.os.Bundle;
import android.os.Looper;
import androidx.lifecycle.LiveData;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.reflect.Modifier;
import ඓ.K.K.K.C1293;
import ῲ.ؿ.AbstractC1567;
import ῲ.ؿ.AbstractC1570;
import ῲ.ؿ.AbstractC1574;
import ῲ.ؿ.AbstractC1580;
import ῲ.ؿ.AbstractC1587;
import ῲ.ؿ.C1568;
import ῲ.ؿ.C1578;
import ῲ.ᓣ.ῲ.C1683;
import ῲ.ᓣ.K.AbstractC1695;
import ῲ.㴹.C2276;
import K.K.K.ʬ.C2369;

/* renamed from: ῲ.ᓣ.K.ῲ  reason: contains not printable characters */
/* compiled from: LoaderManagerImpl */
public class C1690 extends AbstractC1695 {

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C1691 f5956;

    /* renamed from: K  reason: contains not printable characters */
    public final AbstractC1574 f5957;

    /* renamed from: ῲ.ᓣ.K.ῲ$ʬ  reason: contains not printable characters */
    /* compiled from: LoaderManagerImpl */
    public static class C1691 extends AbstractC1567 {

        /* renamed from: 㸾  reason: contains not printable characters */
        public static final AbstractC1570 f5958 = new C1692();

        /* renamed from: ʬ  reason: contains not printable characters */
        public boolean f5959 = false;

        /* renamed from: ῲ  reason: contains not printable characters */
        public C2276<C1694> f5960 = new C2276<>(10);

        /* renamed from: ῲ.ᓣ.K.ῲ$ʬ$K  reason: contains not printable characters */
        /* compiled from: LoaderManagerImpl */
        public static class C1692 implements AbstractC1570 {
            @Override // ῲ.ؿ.AbstractC1570
            /* renamed from: K  reason: contains not printable characters */
            public <T extends AbstractC1567> T m4329(Class<T> cls) {
                return new C1691();
            }
        }

        /* renamed from: ʬ  reason: contains not printable characters */
        public void m4320() {
            this.f5959 = false;
        }

        /* renamed from: ඓ  reason: contains not printable characters */
        public void m4321() {
            int r0 = this.f5960.m5923();
            for (int i = 0; i < r0; i++) {
                this.f5960.m5929(i).m4331();
            }
        }

        /* renamed from: ῲ  reason: contains not printable characters */
        public void m4323(int i) {
            this.f5960.m5921(i);
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m4325(int i, C1694 k) {
            this.f5960.m5922(i, k);
        }

        /* renamed from: 㴹  reason: contains not printable characters */
        public void m4327() {
            this.f5959 = true;
        }

        /* renamed from: 㸾  reason: contains not printable characters */
        public boolean m4328() {
            return this.f5959;
        }

        @Override // ῲ.ؿ.AbstractC1567
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m4322() {
            int r0 = this.f5960.m5923();
            for (int i = 0; i < r0; i++) {
                this.f5960.m5929(i).m4335(true);
            }
            C2276<C1694> r02 = this.f5960;
            int i2 = r02.f7872;
            Object[] objArr = r02.f7874;
            for (int i3 = 0; i3 < i2; i3++) {
                objArr[i3] = null;
            }
            r02.f7872 = 0;
            r02.f7873 = false;
        }

        /* renamed from: K  reason: contains not printable characters */
        public <D> C1694<D> m4324(int i) {
            return this.f5960.m5925(i, null);
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m4326(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
            if (this.f5960.m5923() > 0) {
                printWriter.print(str);
                printWriter.println("Loaders:");
                String str2 = str + "    ";
                for (int i = 0; i < this.f5960.m5923(); i++) {
                    C1694 r2 = this.f5960.m5929(i);
                    printWriter.print(str);
                    printWriter.print("  #");
                    printWriter.print(this.f5960.m5924(i));
                    printWriter.print(": ");
                    printWriter.println(r2.toString());
                    printWriter.print(str2);
                    printWriter.print("mId=");
                    printWriter.print(r2.f5966);
                    printWriter.print(" mArgs=");
                    printWriter.println(r2.f5967);
                    printWriter.print(str2);
                    printWriter.print("mLoader=");
                    printWriter.println(r2.f5969);
                    r2.f5969.m4285(C1293.m3412(str2, "  "), fileDescriptor, printWriter, strArr);
                    if (r2.f5968 != null) {
                        printWriter.print(str2);
                        printWriter.print("mCallbacks=");
                        printWriter.println(r2.f5968);
                        r2.f5968.m4330(str2 + "  ", printWriter);
                    }
                    printWriter.print(str2);
                    printWriter.print("mData=");
                    C1683<D> r3 = r2.f5969;
                    D d = (D) r2.f1342;
                    if (d == LiveData.f1334) {
                        d = null;
                    }
                    printWriter.println(r3.m4282(d));
                    printWriter.print(str2);
                    printWriter.print("mStarted=");
                    printWriter.println(r2.f1335 > 0);
                }
            }
        }
    }

    /* renamed from: ῲ.ᓣ.K.ῲ$ῲ  reason: contains not printable characters */
    /* compiled from: LoaderManagerImpl */
    public static class C1693<D> implements AbstractC1587<D> {

        /* renamed from: ʬ  reason: contains not printable characters */
        public boolean f5961 = false;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final AbstractC1695.AbstractC1696<D> f5962;

        /* renamed from: K  reason: contains not printable characters */
        public final C1683<D> f5963;

        public C1693(C1683<D> r2, AbstractC1695.AbstractC1696<D> k) {
            this.f5963 = r2;
            this.f5962 = k;
        }

        public String toString() {
            return this.f5962.toString();
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m4330(String str, PrintWriter printWriter) {
            printWriter.print(str);
            printWriter.print("mDeliveredData=");
            printWriter.println(this.f5961);
        }
    }

    /* renamed from: ῲ.ᓣ.K.ῲ$K  reason: contains not printable characters */
    /* compiled from: LoaderManagerImpl */
    public static class C1694<D> extends C1578<D> implements C1683.AbstractC1684<D> {

        /* renamed from: Ԕ  reason: contains not printable characters */
        public AbstractC1574 f5964;

        /* renamed from: ؿ  reason: contains not printable characters */
        public C1683<D> f5965;

        /* renamed from: ᕣ  reason: contains not printable characters */
        public final int f5966;

        /* renamed from: 㑃  reason: contains not printable characters */
        public final Bundle f5967;

        /* renamed from: 㗗  reason: contains not printable characters */
        public C1693<D> f5968;

        /* renamed from: 䁗  reason: contains not printable characters */
        public final C1683<D> f5969;

        public C1694(int i, Bundle bundle, C1683<D> r3, C1683<D> r4) {
            this.f5966 = i;
            this.f5967 = bundle;
            this.f5969 = r3;
            this.f5965 = r4;
            this.f5969.m4284(i, this);
        }

        public String toString() {
            StringBuilder sb = new StringBuilder(64);
            sb.append("LoaderInfo{");
            sb.append(Integer.toHexString(System.identityHashCode(this)));
            sb.append(" #");
            sb.append(this.f5966);
            sb.append(" : ");
            C2369.m6334((Object) this.f5969, sb);
            sb.append("}}");
            return sb.toString();
        }

        /* renamed from: ʬ  reason: contains not printable characters */
        public void m4331() {
            AbstractC1574 r0 = this.f5964;
            C1693<D> r1 = this.f5968;
            if (r0 != null && r1 != null) {
                super.m700((AbstractC1587) r1);
                m699(r0, r1);
            }
        }

        @Override // androidx.lifecycle.LiveData
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m4332() {
            this.f5969.m4293();
        }

        @Override // androidx.lifecycle.LiveData
        /* renamed from: K  reason: contains not printable characters */
        public void m4336() {
            this.f5969.m4274();
        }

        @Override // androidx.lifecycle.LiveData, ῲ.ؿ.C1578
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m4333(D d) {
            super.m4127((Object) d);
            C1683<D> r1 = this.f5965;
            if (r1 != null) {
                r1.m4276();
                this.f5965 = null;
            }
        }

        /* renamed from: K  reason: contains not printable characters */
        public C1683<D> m4334(AbstractC1574 r3, AbstractC1695.AbstractC1696<D> k) {
            C1693<D> r0 = new C1693<>(this.f5969, k);
            m699(r3, r0);
            C1693<D> r4 = this.f5968;
            if (r4 != null) {
                m4337((AbstractC1587) r4);
            }
            this.f5964 = r3;
            this.f5968 = r0;
            return this.f5969;
        }

        /* JADX DEBUG: Multi-variable search result rejected for r1v0, resolved type: ῲ.ؿ.䁗<? super D> */
        /* JADX WARN: Multi-variable type inference failed */
        @Override // androidx.lifecycle.LiveData
        /* renamed from: K  reason: contains not printable characters */
        public void m4337(AbstractC1587<? super D> r1) {
            super.m700((AbstractC1587) r1);
            this.f5964 = null;
            this.f5968 = null;
        }

        /* renamed from: K  reason: contains not printable characters */
        public C1683<D> m4335(boolean z) {
            this.f5969.m4280();
            this.f5969.m4283();
            C1693<D> r0 = this.f5968;
            if (r0 != null) {
                super.m700((AbstractC1587) r0);
                this.f5964 = null;
                this.f5968 = null;
                if (z && r0.f5961) {
                    r0.f5962.m4343(r0.f5963);
                }
            }
            this.f5969.unregisterListener(this);
            if ((r0 == null || r0.f5961) && !z) {
                return this.f5969;
            }
            this.f5969.m4276();
            return this.f5965;
        }

        /* renamed from: K  reason: contains not printable characters */
        public void m4338(C1683<D> r2, D d) {
            if (Looper.myLooper() == Looper.getMainLooper()) {
                super.m4127((Object) d);
                C1683<D> r22 = this.f5965;
                if (r22 != null) {
                    r22.m4276();
                    this.f5965 = null;
                    return;
                }
                return;
            }
            m4128((Object) d);
        }
    }

    public C1690(AbstractC1574 r5, C1568 r6) {
        AbstractC1567 r52;
        this.f5957 = r5;
        AbstractC1570 r53 = C1691.f5958;
        String canonicalName = C1691.class.getCanonicalName();
        if (canonicalName != null) {
            String str = "androidx.lifecycle.ViewModelProvider.DefaultKey:" + canonicalName;
            AbstractC1567 r2 = r6.f5739.get(str);
            if (!C1691.class.isInstance(r2)) {
                if (r53 instanceof AbstractC1580) {
                    r52 = ((AbstractC1580) r53).m4132(str, C1691.class);
                } else {
                    r52 = r53.m4114(C1691.class);
                }
                r2 = r52;
                AbstractC1567 put = r6.f5739.put(str, r2);
                if (put != null) {
                    put.m4110();
                }
            }
            this.f5956 = (C1691) r2;
            return;
        }
        throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
    }

    public String toString() {
        StringBuilder sb = new StringBuilder(128);
        sb.append("LoaderManager{");
        sb.append(Integer.toHexString(System.identityHashCode(this)));
        sb.append(" in ");
        C2369.m6334((Object) this.f5957, sb);
        sb.append("}}");
        return sb.toString();
    }

    /* JADX INFO: finally extract failed */
    @Override // ῲ.ᓣ.K.AbstractC1695
    /* renamed from: K  reason: contains not printable characters */
    public <D> C1683<D> m4318(int i, Bundle bundle, AbstractC1695.AbstractC1696<D> k) {
        if (this.f5956.m4328()) {
            throw new IllegalStateException("Called while creating a loader");
        } else if (Looper.getMainLooper() == Looper.myLooper()) {
            C1694<D> r0 = this.f5956.m4324(i);
            if (r0 != null) {
                return r0.m4334(this.f5957, k);
            }
            try {
                this.f5956.m4327();
                C1683<D> r1 = k.m4342(i, bundle);
                if (r1 != null) {
                    if (r1.getClass().isMemberClass()) {
                        if (!Modifier.isStatic(r1.getClass().getModifiers())) {
                            throw new IllegalArgumentException("Object returned from onCreateLoader must not be a non-static inner member class: " + r1);
                        }
                    }
                    C1694 k2 = new C1694(i, bundle, r1, null);
                    this.f5956.m4325(i, k2);
                    this.f5956.m4320();
                    return k2.m4334(this.f5957, k);
                }
                throw new IllegalArgumentException("Object returned from onCreateLoader must not be null");
            } catch (Throwable th) {
                this.f5956.m4320();
                throw th;
            }
        } else {
            throw new IllegalStateException("initLoader must be called on the main thread");
        }
    }

    @Override // ῲ.ᓣ.K.AbstractC1695
    /* renamed from: K  reason: contains not printable characters */
    public void m4319(int i) {
        if (this.f5956.m4328()) {
            throw new IllegalStateException("Called while creating a loader");
        } else if (Looper.getMainLooper() == Looper.myLooper()) {
            C1694 r0 = this.f5956.m4324(i);
            if (r0 != null) {
                r0.m4335(true);
                this.f5956.m4323(i);
            }
        } else {
            throw new IllegalStateException("destroyLoader must be called on the main thread");
        }
    }
}
