package e.w;

import e.s.b.p;
import e.s.c.k;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;

/* JADX INFO: loaded from: classes.dex */
public final class b implements e.v.b<e.t.c> {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final CharSequence f6046a;

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final p<CharSequence, Integer, e.e<Integer, Integer>> f6049d;

    public static final class a implements Iterator<e.t.c>, e.s.c.u.a {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public int f6050b = -1;

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

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

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

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

        public a() {
            int i2 = b.this.f6047b;
            int length = b.this.f6046a.length();
            if (length >= 0) {
                if (i2 < 0) {
                    i2 = 0;
                } else if (i2 > length) {
                    i2 = length;
                }
                this.f6051c = i2;
                this.f6052d = i2;
                return;
            }
            throw new IllegalArgumentException("Cannot coerce value to an empty range: maximum " + length + " is less than minimum 0.");
        }

        /* JADX WARN: Removed duplicated region for block: B:11:0x0022  */
        /* JADX WARN: Removed duplicated region for block: B:9:0x001a  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
            To view partially-correct add '--show-bad-code' argument
        */
        public final void a() {
            /*
                r7 = this;
                int r0 = r7.f6052d
                r1 = 0
                if (r0 >= 0) goto Lc
                r7.f6050b = r1
                r0 = 0
                r7.f6053e = r0
                goto L8b
            Lc:
                e.w.b r2 = e.w.b.this
                int r3 = r2.f6048c
                r4 = 1
                if (r3 <= 0) goto L1a
                int r5 = r7.f6054f
                int r5 = r5 + r4
                r7.f6054f = r5
                if (r5 >= r3) goto L22
            L1a:
                java.lang.CharSequence r2 = r2.f6046a
                int r2 = r2.length()
                if (r0 <= r2) goto L32
            L22:
                int r0 = r7.f6051c
                e.t.c r1 = new e.t.c
                e.w.b r2 = e.w.b.this
                java.lang.CharSequence r2 = r2.f6046a
                int r2 = e.w.h.e(r2)
                r1.<init>(r0, r2)
                goto L55
            L32:
                e.w.b r0 = e.w.b.this
                e.s.b.p<java.lang.CharSequence, java.lang.Integer, e.e<java.lang.Integer, java.lang.Integer>> r2 = r0.f6049d
                java.lang.CharSequence r0 = r0.f6046a
                int r3 = r7.f6052d
                java.lang.Integer r3 = java.lang.Integer.valueOf(r3)
                java.lang.Object r0 = r2.c(r0, r3)
                e.e r0 = (e.e) r0
                if (r0 != 0) goto L5b
                int r0 = r7.f6051c
                e.t.c r1 = new e.t.c
                e.w.b r2 = e.w.b.this
                java.lang.CharSequence r2 = r2.f6046a
                int r2 = e.w.h.e(r2)
                r1.<init>(r0, r2)
            L55:
                r7.f6053e = r1
                r0 = -1
                r7.f6052d = r0
                goto L89
            L5b:
                A r2 = r0.f5944b
                java.lang.Number r2 = (java.lang.Number) r2
                int r2 = r2.intValue()
                B r0 = r0.f5945c
                java.lang.Number r0 = (java.lang.Number) r0
                int r0 = r0.intValue()
                int r3 = r7.f6051c
                r5 = -2147483648(0xffffffff80000000, float:-0.0)
                if (r2 > r5) goto L76
                e.t.c r3 = e.t.c.f6041f
                e.t.c r3 = e.t.c.f6040e
                goto L7e
            L76:
                e.t.c r5 = new e.t.c
                int r6 = r2 + (-1)
                r5.<init>(r3, r6)
                r3 = r5
            L7e:
                r7.f6053e = r3
                int r2 = r2 + r0
                r7.f6051c = r2
                if (r0 != 0) goto L86
                r1 = r4
            L86:
                int r2 = r2 + r1
                r7.f6052d = r2
            L89:
                r7.f6050b = r4
            L8b:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: e.w.b.a.a():void");
        }

        @Override // java.util.Iterator
        public boolean hasNext() {
            if (this.f6050b == -1) {
                a();
            }
            return this.f6050b == 1;
        }

        @Override // java.util.Iterator
        public e.t.c next() {
            if (this.f6050b == -1) {
                a();
            }
            if (this.f6050b == 0) {
                throw new NoSuchElementException();
            }
            e.t.c cVar = this.f6053e;
            Objects.requireNonNull(cVar, "null cannot be cast to non-null type kotlin.ranges.IntRange");
            this.f6053e = null;
            this.f6050b = -1;
            return cVar;
        }

        @Override // java.util.Iterator
        public void remove() {
            throw new UnsupportedOperationException("Operation is not supported for read-only collection");
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public b(CharSequence charSequence, int i2, int i3, p<? super CharSequence, ? super Integer, e.e<Integer, Integer>> pVar) {
        k.e(charSequence, "input");
        k.e(pVar, "getNextMatch");
        this.f6046a = charSequence;
        this.f6047b = i2;
        this.f6048c = i3;
        this.f6049d = pVar;
    }

    @Override // e.v.b
    public Iterator<e.t.c> iterator() {
        return new a();
    }
}
