package ng;

import com.adobe.marketing.mobile.Analytics;
import com.adobe.marketing.mobile.MobileCore;
import java.util.List;
import kotlin.jvm.internal.t;
import kotlin.text.z;

/* loaded from: classes4.dex */
public final class j {

    /* renamed from: a, reason: collision with root package name */
    public static final j f30008a = new j();

    private j() {
    }

    public static /* synthetic */ String b(j jVar, String str, String str2, int i10, Object obj) {
        if ((i10 & 1) != 0) {
            str = MobileCore.g();
            t.f(str, "MobileCore.extensionVersion()");
        }
        if ((i10 & 2) != 0) {
            str2 = Analytics.b();
            t.f(str2, "Analytics.extensionVersion()");
        }
        return jVar.a(str, str2);
    }

    private final String c(String str) {
        List I0;
        String str2;
        String str3;
        String str4;
        I0 = z.I0(str, new String[]{"."}, false, 0, 6, null);
        Object[] array = I0.toArray(new String[0]);
        t.e(array, "null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
        String[] strArr = (String[]) array;
        if (strArr.length != 3) {
            return "000000";
        }
        if (strArr[0].length() == 1) {
            str2 = "0" + strArr[0];
        } else {
            str2 = strArr[0];
        }
        if (strArr[1].length() == 1) {
            str3 = "0" + strArr[1];
        } else {
            str3 = strArr[1];
        }
        if (strArr[2].length() == 1) {
            str4 = "0" + strArr[2];
        } else {
            str4 = strArr[2];
        }
        return str2 + str3 + str4;
    }

    private final String d(String str, String str2) {
        List I0;
        String str3;
        I0 = z.I0(str, new String[]{"-"}, false, 0, 6, null);
        Object[] array = I0.toArray(new String[0]);
        t.e(array, "null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
        String[] strArr = (String[]) array;
        if (strArr.length == 2) {
            str = strArr[0];
            str3 = strArr[1];
        } else {
            str3 = "N";
        }
        String c10 = c(str);
        return "AND" + str3 + c(str2) + c10;
    }

    public final String a(String coreExtensionVersion, String analyticsExtensionVersion) {
        t.g(coreExtensionVersion, "coreExtensionVersion");
        t.g(analyticsExtensionVersion, "analyticsExtensionVersion");
        String d10 = d(coreExtensionVersion, analyticsExtensionVersion);
        return !ch.j.a(d10) ? d10 : "unknown";
    }
}
