package F7;

import java.io.EOFException;
import java.lang.reflect.Method;
import java.util.Objects;
import x7.C1731g;

/* JADX INFO: loaded from: classes.dex */
public final class I extends b0 {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Method f2614d;

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final String f2616f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final C0118b f2617g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final boolean f2618h;

    public I(Method method, int i, String str, boolean z8) {
        C0118b c0118b = C0118b.f2697r;
        this.f2614d = method;
        this.f2615e = i;
        Objects.requireNonNull(str, "name == null");
        this.f2616f = str;
        this.f2617g = c0118b;
        this.f2618h = z8;
    }

    /* JADX WARN: Removed duplicated region for block: B:53:0x00e6  */
    /* JADX WARN: Removed duplicated region for block: B:55:0x00e9  */
    @Override // F7.b0
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void a(P p3, Object obj) throws EOFException {
        String strO0;
        String strReplace;
        String str = this.f2616f;
        if (obj == null) {
            throw b0.o(this.f2614d, this.f2615e, I1.a.p("Path parameter \"", str, "\" value must not be null."), new Object[0]);
        }
        this.f2617g.getClass();
        String string = obj.toString();
        if (p3.f2633c == null) {
            throw new AssertionError();
        }
        int length = string.length();
        int iCharCount = 0;
        while (iCharCount < length) {
            int iCodePointAt = string.codePointAt(iCharCount);
            boolean z8 = this.f2618h;
            int i = 47;
            int i5 = -1;
            if (iCodePointAt < 32 || iCodePointAt >= 127 || " \"<>^`{}|\\?#".indexOf(iCodePointAt) != -1 || (!z8 && (iCodePointAt == 47 || iCodePointAt == 37))) {
                C1731g c1731g = new C1731g();
                c1731g.y0(0, iCharCount, string);
                C1731g c1731g2 = null;
                while (iCharCount < length) {
                    int iCodePointAt2 = string.codePointAt(iCharCount);
                    if (!z8 || (iCodePointAt2 != 9 && iCodePointAt2 != 10 && iCodePointAt2 != 12 && iCodePointAt2 != 13)) {
                        if (iCodePointAt2 < 32 || iCodePointAt2 >= 127 || " \"<>^`{}|\\?#".indexOf(iCodePointAt2) != i5 || (!z8 && (iCodePointAt2 == i || iCodePointAt2 == 37))) {
                            if (c1731g2 == null) {
                                c1731g2 = new C1731g();
                            }
                            c1731g2.A0(iCodePointAt2);
                            while (!c1731g2.u()) {
                                byte bQ = c1731g2.Q();
                                c1731g.u0(37);
                                char[] cArr = P.f2629l;
                                c1731g.u0(cArr[((bQ & 255) >> 4) & 15]);
                                c1731g.u0(cArr[bQ & 15]);
                            }
                        } else {
                            c1731g.A0(iCodePointAt2);
                        }
                    }
                    iCharCount += Character.charCount(iCodePointAt2);
                    i = 47;
                    i5 = -1;
                }
                strO0 = c1731g.o0();
                strReplace = p3.f2633c.replace("{" + str + "}", strO0);
                if (!P.f2630m.matcher(strReplace).matches()) {
                    throw new IllegalArgumentException("@Path parameters shouldn't perform path traversal ('.' or '..'): ".concat(string));
                }
                p3.f2633c = strReplace;
                return;
            }
            iCharCount += Character.charCount(iCodePointAt);
        }
        strO0 = string;
        strReplace = p3.f2633c.replace("{" + str + "}", strO0);
        if (!P.f2630m.matcher(strReplace).matches()) {
        }
    }
}
