package h.c0;

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

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

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

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

    /* JADX INFO: compiled from: Strings.kt */
    public static final class a implements Iterator<h.z.h>, h.x.d.z.a {
        private int b = -1;

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

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

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        private h.z.h f957g;

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

        a() {
            int iF = h.z.n.f(e.this.b, 0, e.this.a.length());
            this.f955e = iF;
            this.f956f = iF;
        }

        /* 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.f956f
                r1 = 0
                if (r0 >= 0) goto Lc
                r6.b = r1
                r0 = 0
                r6.f957g = r0
                goto L9e
            Lc:
                h.c0.e r0 = h.c0.e.this
                int r0 = h.c0.e.d(r0)
                r2 = -1
                r3 = 1
                if (r0 <= 0) goto L23
                int r0 = r6.f958h
                int r0 = r0 + r3
                r6.f958h = r0
                h.c0.e r4 = h.c0.e.this
                int r4 = h.c0.e.d(r4)
                if (r0 >= r4) goto L31
            L23:
                int r0 = r6.f956f
                h.c0.e r4 = h.c0.e.this
                java.lang.CharSequence r4 = h.c0.e.c(r4)
                int r4 = r4.length()
                if (r0 <= r4) goto L47
            L31:
                h.z.h r0 = new h.z.h
                int r1 = r6.f955e
                h.c0.e r4 = h.c0.e.this
                java.lang.CharSequence r4 = h.c0.e.c(r4)
                int r4 = h.c0.q.J(r4)
                r0.<init>(r1, r4)
                r6.f957g = r0
                r6.f956f = r2
                goto L9c
            L47:
                h.c0.e r0 = h.c0.e.this
                h.x.c.p r0 = h.c0.e.b(r0)
                h.c0.e r4 = h.c0.e.this
                java.lang.CharSequence r4 = h.c0.e.c(r4)
                int r5 = r6.f956f
                java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
                java.lang.Object r0 = r0.a(r4, r5)
                h.k r0 = (h.k) r0
                if (r0 != 0) goto L77
                h.z.h r0 = new h.z.h
                int r1 = r6.f955e
                h.c0.e r4 = h.c0.e.this
                java.lang.CharSequence r4 = h.c0.e.c(r4)
                int r4 = h.c0.q.J(r4)
                r0.<init>(r1, r4)
                r6.f957g = r0
                r6.f956f = 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.f955e
                h.z.h r4 = h.z.l.i(r4, r2)
                r6.f957g = r4
                int r2 = r2 + r0
                r6.f955e = r2
                if (r0 != 0) goto L99
                r1 = 1
            L99:
                int r2 = r2 + r1
                r6.f956f = r2
            L9c:
                r6.b = r3
            L9e:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: h.c0.e.a.a():void");
        }

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

        @Override // java.util.Iterator
        public boolean hasNext() {
            if (this.b == -1) {
                a();
            }
            return this.b == 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, h.x.c.p<? super CharSequence, ? super Integer, h.k<Integer, Integer>> pVar) {
        h.x.d.k.d(charSequence, "input");
        h.x.d.k.d(pVar, "getNextMatch");
        this.a = charSequence;
        this.b = i2;
        this.f953c = i3;
        this.f954d = pVar;
    }

    @Override // h.b0.d
    public Iterator<h.z.h> iterator() {
        return new a();
    }
}
