package ob;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
import com.google.zxing.ReaderException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class c implements e {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final e[] f31461c = new e[0];

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public e[] f31463b;

    @Override // ob.e
    public final f a(xyz.stream.utils.f fVar, Map map) {
        d(map);
        return c(fVar);
    }

    @Override // ob.e
    public final f b(xyz.stream.utils.f fVar) {
        d(null);
        return c(fVar);
    }

    public final f c(xyz.stream.utils.f fVar) throws NotFoundException {
        e[] eVarArr = this.f31463b;
        if (eVarArr != null) {
            for (e eVar : eVarArr) {
                if (Thread.currentThread().isInterrupted()) {
                    throw NotFoundException.a();
                }
                try {
                    return eVar.a(fVar, this.f31462a);
                } catch (ReaderException unused) {
                }
            }
            Map map = this.f31462a;
            if (map != null && map.containsKey(DecodeHintType.f24326k)) {
                tb.b bVarO = fVar.o();
                int length = bVarO.f33008d.length;
                for (int i10 = 0; i10 < length; i10++) {
                    int[] iArr = bVarO.f33008d;
                    iArr[i10] = ~iArr[i10];
                }
                for (e eVar2 : this.f31463b) {
                    if (Thread.currentThread().isInterrupted()) {
                        throw NotFoundException.a();
                    }
                    try {
                        return eVar2.a(fVar, this.f31462a);
                    } catch (ReaderException unused2) {
                    }
                }
            }
        }
        throw NotFoundException.a();
    }

    public final void d(Map map) {
        this.f31462a = map;
        boolean z10 = map != null && map.containsKey(DecodeHintType.f24318c);
        Collection collection = map == null ? null : (Collection) map.get(DecodeHintType.f24317b);
        ArrayList arrayList = new ArrayList();
        if (collection != null) {
            boolean z11 = collection.contains(BarcodeFormat.R) || collection.contains(BarcodeFormat.S) || collection.contains(BarcodeFormat.f24309h) || collection.contains(BarcodeFormat.f24308g) || collection.contains(BarcodeFormat.f24303b) || collection.contains(BarcodeFormat.f24304c) || collection.contains(BarcodeFormat.f24305d) || collection.contains(BarcodeFormat.f24306e) || collection.contains(BarcodeFormat.f24310i) || collection.contains(BarcodeFormat.f24314m) || collection.contains(BarcodeFormat.Q);
            if (z11 && !z10) {
                arrayList.add(new zb.h(map));
            }
            if (collection.contains(BarcodeFormat.f24313l)) {
                arrayList.add(new hc.a());
            }
            if (collection.contains(BarcodeFormat.f24307f)) {
                arrayList.add(new vb.a());
            }
            if (collection.contains(BarcodeFormat.f24302a)) {
                arrayList.add(new pb.b());
            }
            if (collection.contains(BarcodeFormat.f24312k)) {
                arrayList.add(new dc.b());
            }
            if (collection.contains(BarcodeFormat.f24311j)) {
                arrayList.add(new xb.a());
            }
            if (z11 && z10) {
                arrayList.add(new zb.h(map));
            }
        }
        if (arrayList.isEmpty()) {
            if (!z10) {
                arrayList.add(new zb.h(map));
            }
            arrayList.add(new hc.a());
            arrayList.add(new vb.a());
            arrayList.add(new pb.b());
            arrayList.add(new dc.b());
            arrayList.add(new xb.a());
            if (z10) {
                arrayList.add(new zb.h(map));
            }
        }
        this.f31463b = (e[]) arrayList.toArray(f31461c);
    }

    @Override // ob.e
    public final void reset() {
        e[] eVarArr = this.f31463b;
        if (eVarArr != null) {
            for (e eVar : eVarArr) {
                eVar.reset();
            }
        }
    }
}
