package 㴹.K.Ԕ.ඓ.ῲ;

import io.reactivex.internal.disposables.EmptyDisposable;
import java.util.Iterator;
import ඓ.ⁱ.K.ඓ.C1252;
import 㴹.K.AbstractC2500;
import 㴹.K.AbstractC2520;
import 㴹.K.Ԕ.ῲ.C2456;
import 㴹.K.Ԕ.㸾.AbstractC2488;

/* renamed from: 㴹.K.Ԕ.ඓ.ῲ.㸾  reason: contains not printable characters */
/* compiled from: ObservableFromIterable */
public final class C2447<T> extends AbstractC2500<T> {

    /* renamed from: ῲ  reason: contains not printable characters */
    public final Iterable<? extends T> f8390;

    /* renamed from: 㴹.K.Ԕ.ඓ.ῲ.㸾$K  reason: contains not printable characters */
    /* compiled from: ObservableFromIterable */
    public static final class C2448<T> extends AbstractC2488<T> {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final Iterator<? extends T> f8391;

        /* renamed from: ඓ  reason: contains not printable characters */
        public boolean f8392;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final AbstractC2520<? super T> f8393;

        /* renamed from: ⁱ  reason: contains not printable characters */
        public boolean f8394;

        /* renamed from: 㴹  reason: contains not printable characters */
        public boolean f8395;

        /* renamed from: 㸾  reason: contains not printable characters */
        public volatile boolean f8396;

        public C2448(AbstractC2520<? super T> r1, Iterator<? extends T> it2) {
            this.f8393 = r1;
            this.f8391 = it2;
        }

        @Override // 㴹.K.Ԕ.ʬ.AbstractC2439
        public void clear() {
            this.f8395 = true;
        }

        @Override // 㴹.K.㑃.AbstractC2514
        public void dispose() {
            this.f8396 = true;
        }

        @Override // 㴹.K.㑃.AbstractC2514
        public boolean isDisposed() {
            return this.f8396;
        }

        @Override // 㴹.K.Ԕ.ʬ.AbstractC2439
        public boolean isEmpty() {
            return this.f8395;
        }

        @Override // 㴹.K.Ԕ.ʬ.AbstractC2439
        public T poll() {
            if (this.f8395) {
                return null;
            }
            if (!this.f8394) {
                this.f8394 = true;
            } else if (!this.f8391.hasNext()) {
                this.f8395 = true;
                return null;
            }
            T t = (T) this.f8391.next();
            C2456.m6500(t, "The iterator returned a null value");
            return t;
        }

        @Override // 㴹.K.Ԕ.ʬ.AbstractC2438
        public int requestFusion(int i) {
            if ((i & 1) == 0) {
                return 0;
            }
            this.f8392 = true;
            return 1;
        }
    }

    public C2447(Iterable<? extends T> iterable) {
        this.f8390 = iterable;
    }

    @Override // 㴹.K.AbstractC2500
    /* renamed from: ῲ  reason: contains not printable characters */
    public void m6491(AbstractC2520<? super T> r3) {
        try {
            Iterator<? extends T> it2 = this.f8390.iterator();
            try {
                if (!it2.hasNext()) {
                    EmptyDisposable.complete(r3);
                    return;
                }
                C2448 k = new C2448(r3, it2);
                r3.onSubscribe(k);
                if (!k.f8392) {
                    while (!k.f8396) {
                        try {
                            Object next = k.f8391.next();
                            C2456.m6500(next, "The iterator returned a null value");
                            k.f8393.onNext(next);
                            if (!k.f8396) {
                                try {
                                    if (!k.f8391.hasNext()) {
                                        if (!k.f8396) {
                                            k.f8393.onComplete();
                                            return;
                                        }
                                        return;
                                    }
                                } catch (Throwable th) {
                                    C1252.m3329(th);
                                    k.f8393.onError(th);
                                    return;
                                }
                            } else {
                                return;
                            }
                        } catch (Throwable th2) {
                            C1252.m3329(th2);
                            k.f8393.onError(th2);
                            return;
                        }
                    }
                }
            } catch (Throwable th3) {
                C1252.m3329(th3);
                EmptyDisposable.error(th3, r3);
            }
        } catch (Throwable th4) {
            C1252.m3329(th4);
            EmptyDisposable.error(th4, r3);
        }
    }
}
