package o;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import androidx.cardview.widget.CardView;
import com.google.android.gms.common.ConnectionResult;
import com.google.firebase.components.ComponentRegistrar;
import java.io.EOFException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Executors;
import org.json.JSONObject;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.a6, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0688a6 implements GR, Z8, InterfaceC2652un, InterfaceC2555tm, InterfaceC2439sb0, D70, InterfaceC3051yx, InterfaceC2956xx, Gb0 {
    public final /* synthetic */ int l;

    public /* synthetic */ C0688a6(int i) {
        this.l = i;
    }

    public static final float e(float f, float[] fArr, float[] fArr2) {
        float f2;
        float f3;
        float f4;
        float f5;
        float fAbs = Math.abs(f);
        float fSignum = Math.signum(f);
        int iBinarySearch = Arrays.binarySearch(fArr, fAbs);
        if (iBinarySearch >= 0) {
            return fSignum * fArr2[iBinarySearch];
        }
        int i = -(iBinarySearch + 1);
        int i2 = i - 1;
        if (i2 >= fArr.length - 1) {
            float f6 = fArr[fArr.length - 1];
            float f7 = fArr2[fArr.length - 1];
            if (f6 == 0.0f) {
                return 0.0f;
            }
            return (f7 / f6) * f;
        }
        if (i2 == -1) {
            float f8 = fArr[0];
            f4 = fArr2[0];
            f5 = f8;
            f3 = 0.0f;
            f2 = 0.0f;
        } else {
            float f9 = fArr[i2];
            float f10 = fArr[i];
            f2 = fArr2[i2];
            f3 = f9;
            f4 = fArr2[i];
            f5 = f10;
        }
        return (((f4 - f2) * Math.max(0.0f, Math.min(1.0f, f3 == f5 ? 0.0f : (fAbs - f3) / (f5 - f3)))) + f2) * fSignum;
    }

    public static String f(String str, int i, int i2, String str2, int i3) throws EOFException {
        int i4 = 0;
        int i5 = (i3 & 1) != 0 ? 0 : i;
        int length = (i3 & 2) != 0 ? str.length() : i2;
        boolean z = (i3 & 8) == 0;
        boolean z2 = (i3 & 16) == 0;
        boolean z3 = (i3 & 32) == 0;
        boolean z4 = (i3 & 64) == 0;
        int iCharCount = i5;
        while (iCharCount < length) {
            int iCodePointAt = str.codePointAt(iCharCount);
            int i6 = 32;
            int i7 = 43;
            if (iCodePointAt < 32 || iCodePointAt == 127 || ((iCodePointAt >= 128 && !z4) || Za0.Q(str2, (char) iCodePointAt) || ((iCodePointAt == 37 && (!z || (z2 && !k(iCharCount, str, length)))) || (iCodePointAt == 43 && z3)))) {
                C0732af c0732af = new C0732af();
                c0732af.U(i5, str, iCharCount);
                C0732af c0732af2 = null;
                while (iCharCount < length) {
                    int iCodePointAt2 = str.codePointAt(iCharCount);
                    if (!z || (iCodePointAt2 != 9 && iCodePointAt2 != 10 && iCodePointAt2 != 12 && iCodePointAt2 != 13)) {
                        if (iCodePointAt2 == i7 && z3) {
                            String str3 = z ? "+" : "%2B";
                            c0732af.U(i4, str3, str3.length());
                        } else {
                            if (iCodePointAt2 >= i6 && iCodePointAt2 != 127) {
                                if ((iCodePointAt2 < 128 || z4) && !Za0.Q(str2, (char) iCodePointAt2) && (iCodePointAt2 != 37 || (z && (!z2 || k(iCharCount, str, length))))) {
                                    c0732af.W(iCodePointAt2);
                                }
                            }
                            if (c0732af2 == null) {
                                c0732af2 = new C0732af();
                            }
                            c0732af2.W(iCodePointAt2);
                            while (!c0732af2.f()) {
                                byte b = c0732af2.readByte();
                                c0732af.G(37);
                                char[] cArr = ZF.j;
                                c0732af.G(cArr[((b & 255) >> 4) & 15]);
                                c0732af.G(cArr[b & 15]);
                            }
                        }
                    }
                    iCharCount += Character.charCount(iCodePointAt2);
                    i4 = 0;
                    i6 = 32;
                    i7 = 43;
                }
                return c0732af.u(c0732af.m, AbstractC2355rh.a);
            }
            iCharCount += Character.charCount(iCodePointAt);
        }
        return str.substring(i5, length);
    }

    public static C0688a6 h(Context context, int i) throws Resources.NotFoundException {
        AbstractC0249Jp.v("Cannot create a CalendarItemStyle with a styleResId of 0", i != 0);
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(i, XZ.m);
        Rect rect = new Rect(typedArrayObtainStyledAttributes.getDimensionPixelOffset(0, 0), typedArrayObtainStyledAttributes.getDimensionPixelOffset(2, 0), typedArrayObtainStyledAttributes.getDimensionPixelOffset(1, 0), typedArrayObtainStyledAttributes.getDimensionPixelOffset(3, 0));
        AbstractC2461sm0.q(context, typedArrayObtainStyledAttributes, 4);
        AbstractC2461sm0.q(context, typedArrayObtainStyledAttributes, 9);
        AbstractC2461sm0.q(context, typedArrayObtainStyledAttributes, 7);
        typedArrayObtainStyledAttributes.getDimensionPixelSize(8, 0);
        N70.a(context, typedArrayObtainStyledAttributes.getResourceId(5, 0), typedArrayObtainStyledAttributes.getResourceId(6, 0), new C1915n(0)).a();
        typedArrayObtainStyledAttributes.recycle();
        C0688a6 c0688a6 = new C0688a6(7);
        AbstractC0249Jp.w(rect.left);
        AbstractC0249Jp.w(rect.top);
        AbstractC0249Jp.w(rect.right);
        AbstractC0249Jp.w(rect.bottom);
        return c0688a6;
    }

    public static C2975y70 i(C2616uQ c2616uQ) {
        return new C2975y70(System.currentTimeMillis() + 3600000, new C2785w70(8), new C2690v70(true, false, false), 10.0d, 1.2d, 60);
    }

    public static boolean k(int i, String str, int i2) {
        int i3 = i + 2;
        return i3 < i2 && str.charAt(i) == '%' && AbstractC2264qi0.q(str.charAt(i + 1)) != -1 && AbstractC2264qi0.q(str.charAt(i3)) != -1;
    }

    public static String l(int i, int i2, int i3, String str) {
        int i4;
        if ((i3 & 1) != 0) {
            i = 0;
        }
        if ((i3 & 2) != 0) {
            i2 = str.length();
        }
        boolean z = (i3 & 4) == 0;
        int iCharCount = i;
        while (iCharCount < i2) {
            char cCharAt = str.charAt(iCharCount);
            if (cCharAt == '%' || (cCharAt == '+' && z)) {
                C0732af c0732af = new C0732af();
                c0732af.U(i, str, iCharCount);
                while (iCharCount < i2) {
                    int iCodePointAt = str.codePointAt(iCharCount);
                    if (iCodePointAt == 37 && (i4 = iCharCount + 2) < i2) {
                        int iQ = AbstractC2264qi0.q(str.charAt(iCharCount + 1));
                        int iQ2 = AbstractC2264qi0.q(str.charAt(i4));
                        if (iQ == -1 || iQ2 == -1) {
                            c0732af.W(iCodePointAt);
                            iCharCount += Character.charCount(iCodePointAt);
                        } else {
                            c0732af.G((iQ << 4) + iQ2);
                            iCharCount = Character.charCount(iCodePointAt) + i4;
                        }
                    } else if (iCodePointAt == 43 && z) {
                        c0732af.G(32);
                        iCharCount++;
                    } else {
                        c0732af.W(iCodePointAt);
                        iCharCount += Character.charCount(iCodePointAt);
                    }
                }
                return c0732af.u(c0732af.m, AbstractC2355rh.a);
            }
            iCharCount++;
        }
        return str.substring(i, i2);
    }

    public static ArrayList o(String str) {
        ArrayList arrayList = new ArrayList();
        int i = 0;
        while (i <= str.length()) {
            int iV = Za0.V(str, '&', i, 4);
            if (iV == -1) {
                iV = str.length();
            }
            int iV2 = Za0.V(str, '=', i, 4);
            if (iV2 == -1 || iV2 > iV) {
                arrayList.add(str.substring(i, iV));
                arrayList.add(null);
            } else {
                arrayList.add(str.substring(i, iV2));
                arrayList.add(str.substring(iV2 + 1, iV));
            }
            i = iV + 1;
        }
        return arrayList;
    }

    public static void p(List list, StringBuilder sb) {
        C0800bI c0800bIJ = AbstractC0940cn0.J(AbstractC0940cn0.K(0, list.size()), 2);
        int i = c0800bIJ.l;
        int i2 = c0800bIJ.m;
        int i3 = c0800bIJ.n;
        if ((i3 <= 0 || i > i2) && (i3 >= 0 || i2 > i)) {
            return;
        }
        while (true) {
            String str = (String) list.get(i);
            String str2 = (String) list.get(i + 1);
            if (i > 0) {
                sb.append('&');
            }
            sb.append(str);
            if (str2 != null) {
                sb.append('=');
                sb.append(str2);
            }
            if (i == i2) {
                return;
            } else {
                i += i3;
            }
        }
    }

    @Override // o.Gb0
    public Hb0 b(Fb0 fb0) {
        return new JC(fb0.a, fb0.b, fb0.c, fb0.d, fb0.e);
    }

    @Override // o.InterfaceC2555tm
    public long c(long j, long j2) {
        switch (this.l) {
            case ConnectionResult.LICENSE_CHECK_FAILED /* 11 */:
                float fMax = Math.max(Float.intBitsToFloat((int) (j2 >> 32)) / Float.intBitsToFloat((int) (j >> 32)), Float.intBitsToFloat((int) (j2 & 4294967295L)) / Float.intBitsToFloat((int) (j & 4294967295L)));
                long jFloatToRawIntBits = (Float.floatToRawIntBits(fMax) << 32) | (Float.floatToRawIntBits(fMax) & 4294967295L);
                int i = AbstractC2969y40.a;
                return jFloatToRawIntBits;
            default:
                if (Float.intBitsToFloat((int) (j >> 32)) <= Float.intBitsToFloat((int) (j2 >> 32)) && Float.intBitsToFloat((int) (j & 4294967295L)) <= Float.intBitsToFloat((int) (j2 & 4294967295L))) {
                    long jFloatToRawIntBits2 = (Float.floatToRawIntBits(1.0f) << 32) | (Float.floatToRawIntBits(1.0f) & 4294967295L);
                    int i2 = AbstractC2969y40.a;
                    return jFloatToRawIntBits2;
                }
                float fA = AbstractC1904ms0.a(j, j2);
                long jFloatToRawIntBits3 = (Float.floatToRawIntBits(fA) << 32) | (Float.floatToRawIntBits(fA) & 4294967295L);
                int i3 = AbstractC2969y40.a;
                return jFloatToRawIntBits3;
        }
    }

    @Override // o.D70
    public C2975y70 d(C2616uQ c2616uQ, JSONObject jSONObject) {
        return i(c2616uQ);
    }

    @Override // o.Z8
    public void g(InterfaceC2281qr interfaceC2281qr, int i, int[] iArr, EnumC1280gK enumC1280gK, int[] iArr2) {
        switch (this.l) {
            case 1:
                AbstractC0981d9.b(iArr, iArr2, false);
                break;
            default:
                if (enumC1280gK != EnumC1280gK.l) {
                    AbstractC0981d9.b(iArr, iArr2, true);
                    break;
                } else {
                    AbstractC0981d9.c(i, iArr, iArr2, false);
                    break;
                }
        }
    }

    @Override // o.CZ
    public Object get() {
        switch (this.l) {
            case ConnectionResult.SERVICE_UPDATING /* 18 */:
                return new ExecutorC1921n20(1, Executors.newSingleThreadExecutor());
            default:
                return C2643ui0.a;
        }
    }

    public List m(ComponentRegistrar componentRegistrar) {
        ArrayList arrayList = new ArrayList();
        for (C2549tj c2549tj : componentRegistrar.getComponents()) {
            String str = c2549tj.a;
            if (str != null) {
                c2549tj = new C2549tj(str, c2549tj.b, c2549tj.c, c2549tj.d, c2549tj.e, new C0346Nj(0, str, c2549tj), c2549tj.g);
            }
            arrayList.add(c2549tj);
        }
        return arrayList;
    }

    public void n(DH dh, float f) {
        C2113p30 c2113p30 = (C2113p30) ((Drawable) dh.l);
        CardView cardView = (CardView) dh.m;
        boolean useCompatPadding = cardView.getUseCompatPadding();
        boolean preventCornerOverlap = cardView.getPreventCornerOverlap();
        if (f != c2113p30.e || c2113p30.f != useCompatPadding || c2113p30.g != preventCornerOverlap) {
            c2113p30.e = f;
            c2113p30.f = useCompatPadding;
            c2113p30.g = preventCornerOverlap;
            c2113p30.b(null);
            c2113p30.invalidateSelf();
        }
        if (!cardView.getUseCompatPadding()) {
            dh.r(0, 0, 0, 0);
            return;
        }
        C2113p30 c2113p302 = (C2113p30) ((Drawable) dh.l);
        float f2 = c2113p302.e;
        float f3 = c2113p302.a;
        int iCeil = (int) Math.ceil(AbstractC2208q30.a(f2, f3, cardView.getPreventCornerOverlap()));
        int iCeil2 = (int) Math.ceil(AbstractC2208q30.b(f2, f3, cardView.getPreventCornerOverlap()));
        dh.r(iCeil, iCeil2, iCeil, iCeil2);
    }

    @Override // o.InterfaceC2439sb0
    public Pc0 then(Object obj) {
        return AbstractC0752ap.K(Boolean.TRUE);
    }

    public String toString() {
        switch (this.l) {
            case 1:
                return "AbsoluteArrangement#Left";
            case 2:
                return "Arrangement#End";
            case 10:
                return "CompositionErrorContext";
            case 26:
                return "JsonConfiguration(encodeDefaults=false, ignoreUnknownKeys=false, isLenient=false, allowStructuredMapKeys=false, prettyPrint=false, explicitNulls=true, prettyPrintIndent='    ', coerceInputValues=false, useArrayPolymorphism=false, classDiscriminator='type', allowSpecialFloatingPointValues=false, useAlternativeNames=true, namingStrategy=null, decodeEnumsCaseInsensitive=false, allowTrailingComma=false, allowComments=false, classDiscriminatorMode=POLYMORPHIC)";
            default:
                return super.toString();
        }
    }
}
