package f.e0;

import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: compiled from: Strings.kt */
/* JADX INFO: loaded from: classes.dex */
final class e implements f.d0.b<f.b0.h> {
    private final CharSequence a;

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final f.z.c.p<CharSequence, Integer, f.k<Integer, Integer>> f3926d;

    /* JADX INFO: compiled from: Strings.kt */
    public static final class a implements Iterator<f.b0.h>, f.z.d.z.a {

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

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

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        private int f3929g;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        private f.b0.h f3930h;

        /* JADX INFO: renamed from: i, reason: collision with root package name */
        private int f3931i;

        a() {
            int iE = f.b0.n.e(e.this.f3924b, 0, e.this.a.length());
            this.f3928f = iE;
            this.f3929g = iE;
        }

        /* JADX WARN: Removed duplicated region for block: B:9:0x0023  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
            To view partially-correct add '--show-bad-code' argument
        */
        private final void a() {
            /*
                r6 = this;
                int r0 = r6.f3929g
                r1 = 0
                if (r0 >= 0) goto Lc
                r6.f3927b = r1
                r0 = 0
                r6.f3930h = r0
                goto L9e
            Lc:
                f.e0.e r0 = f.e0.e.this
                int r0 = f.e0.e.c(r0)
                r2 = -1
                r3 = 1
                if (r0 <= 0) goto L23
                int r0 = r6.f3931i
                int r0 = r0 + r3
                r6.f3931i = r0
                f.e0.e r4 = f.e0.e.this
                int r4 = f.e0.e.c(r4)
                if (r0 >= r4) goto L31
            L23:
                int r0 = r6.f3929g
                f.e0.e r4 = f.e0.e.this
                java.lang.CharSequence r4 = f.e0.e.b(r4)
                int r4 = r4.length()
                if (r0 <= r4) goto L47
            L31:
                f.b0.h r0 = new f.b0.h
                int r1 = r6.f3928f
                f.e0.e r4 = f.e0.e.this
                java.lang.CharSequence r4 = f.e0.e.b(r4)
                int r4 = f.e0.t.p(r4)
                r0.<init>(r1, r4)
                r6.f3930h = r0
                r6.f3929g = r2
                goto L9c
            L47:
                f.e0.e r0 = f.e0.e.this
                f.z.c.p r0 = f.e0.e.a(r0)
                f.e0.e r4 = f.e0.e.this
                java.lang.CharSequence r4 = f.e0.e.b(r4)
                int r5 = r6.f3929g
                java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
                java.lang.Object r0 = r0.invoke(r4, r5)
                f.k r0 = (f.k) r0
                if (r0 != 0) goto L77
                f.b0.h r0 = new f.b0.h
                int r1 = r6.f3928f
                f.e0.e r4 = f.e0.e.this
                java.lang.CharSequence r4 = f.e0.e.b(r4)
                int r4 = f.e0.t.p(r4)
                r0.<init>(r1, r4)
                r6.f3930h = r0
                r6.f3929g = r2
                goto L9c
            L77:
                java.lang.Object r2 = r0.a()
                java.lang.Number r2 = (java.lang.Number) r2
                int r2 = r2.intValue()
                java.lang.Object r0 = r0.b()
                java.lang.Number r0 = (java.lang.Number) r0
                int r0 = r0.intValue()
                int r4 = r6.f3928f
                f.b0.h r4 = f.b0.l.g(r4, r2)
                r6.f3930h = r4
                int r2 = r2 + r0
                r6.f3928f = r2
                if (r0 != 0) goto L99
                r1 = r3
            L99:
                int r2 = r2 + r1
                r6.f3929g = r2
            L9c:
                r6.f3927b = r3
            L9e:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: f.e0.e.a.a():void");
        }

        @Override // java.util.Iterator
        /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
        public f.b0.h next() {
            if (this.f3927b == -1) {
                a();
            }
            if (this.f3927b == 0) {
                throw new NoSuchElementException();
            }
            f.b0.h hVar = this.f3930h;
            if (hVar == null) {
                throw new NullPointerException("null cannot be cast to non-null type kotlin.ranges.IntRange");
            }
            this.f3930h = null;
            this.f3927b = -1;
            return hVar;
        }

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

        @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 e(CharSequence charSequence, int i2, int i3, f.z.c.p<? super CharSequence, ? super Integer, f.k<Integer, Integer>> pVar) {
        f.z.d.k.e(charSequence, "input");
        f.z.d.k.e(pVar, "getNextMatch");
        this.a = charSequence;
        this.f3924b = i2;
        this.f3925c = i3;
        this.f3926d = pVar;
    }

    @Override // f.d0.b
    public Iterator<f.b0.h> iterator() {
        return new a();
    }
}
