what-the-bank/sources/com/airbnb/deeplinkdispatch/UtilsKt.java

77 lines
2.9 KiB
Java

package com.airbnb.deeplinkdispatch;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import o.C14881gav;
import o.C14957gcv;
import o.InterfaceC14937gcb;
/* loaded from: classes.dex */
public final class UtilsKt {
public static final void validateConfigurablePathSegmentReplacements(List<? extends BaseRegistry> list, Map<byte[], byte[]> map) {
C14957gcv.e(list, "");
C14957gcv.e(map, "");
DeepLinkDispatch.getValidationExecutor();
ArrayList arrayList = new ArrayList();
Iterator<T> it = list.iterator();
while (it.hasNext()) {
C14881gav.d(arrayList, ((BaseRegistry) it.next()).getPathSegmentReplacementKeysInRegistry());
}
Set h = C14881gav.h(arrayList);
ArrayList arrayList2 = new ArrayList();
for (Object obj : h) {
byte[] bArr = (byte[]) obj;
Set<byte[]> keySet = map.keySet();
boolean z = false;
if (!(keySet instanceof Collection) || !keySet.isEmpty()) {
Iterator<T> it2 = keySet.iterator();
while (true) {
if (it2.hasNext()) {
if (Arrays.equals((byte[]) it2.next(), bArr)) {
z = true;
break;
}
} else {
break;
}
}
}
if (!z) {
arrayList2.add(obj);
}
}
String b = C14881gav.b(arrayList2, ",\n", null, null, 0, null, UtilsKt$validateConfigurablePathSegmentReplacements$1$missingKeys$2.INSTANCE, 30);
if (b.length() == 0) {
return;
}
StringBuilder sb = new StringBuilder("Keys not found in BaseDeepLinkDelegate's mapping of PathVariableReplacementValues. Missing keys are:\n");
sb.append(b);
sb.append(".\nKeys in mapping are:\n");
sb.append(C14881gav.b(map.keySet(), ",\n", null, null, 0, null, UtilsKt$validateConfigurablePathSegmentReplacements$1$1$1.INSTANCE, 30));
sb.append('.');
throw new IllegalArgumentException(sb.toString().toString());
}
public static final Bundle filter(Bundle bundle, InterfaceC14937gcb<? super String, Object, Boolean> interfaceC14937gcb) {
C14957gcv.e(bundle, "");
C14957gcv.e(interfaceC14937gcb, "");
Bundle bundle2 = new Bundle(bundle);
Set<String> keySet = bundle.keySet();
if (keySet != null) {
for (String str : keySet) {
C14957gcv.c((Object) str, "");
if (!interfaceC14937gcb.invoke(str, bundle.get(str)).booleanValue()) {
bundle2.remove(str);
}
}
}
return bundle2;
}
}