package com.ss.android.ugc.aweme.search.router;

import android.content.Intent;
import android.os.Bundle;
import com.bytedance.covode.number.Covode;
import com.bytedance.router.interceptor.IInterceptor;

public final class SearchInterceptor implements IInterceptor {
    static {
        Covode.recordClassIndex(104616);
    }

    public static Bundle LIZ(Intent intent) {
        try {
            return intent.getExtras();
        } catch (Exception unused) {
            return null;
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:20:0x0048, code lost:
        if (r4 != null) goto L_0x002f;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:22:0x004c, code lost:
        if (r4 != null) goto L_0x000d;
     */
    /* JADX WARNING: Removed duplicated region for block: B:10:0x0023  */
    /* JADX WARNING: Removed duplicated region for block: B:25:? A[ORIG_RETURN, RETURN, SYNTHETIC] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final boolean matchInterceptRules(com.bytedance.router.RouteIntent r4) {
        /*
            r3 = this;
            r2 = 0
            if (r4 == 0) goto L_0x004b
            android.net.Uri r0 = r4.getUri()
            if (r0 == 0) goto L_0x004b
            java.lang.String r1 = r0.getHost()
        L_0x000d:
            android.net.Uri r0 = r4.getUri()
            if (r0 == 0) goto L_0x004f
            java.lang.String r0 = r0.getPath()
        L_0x0017:
            java.lang.String r1 = kotlin.h.b.n.LIZ(r1, r0)
            java.lang.String r0 = "search"
            boolean r0 = android.text.TextUtils.equals(r1, r0)
            if (r0 != 0) goto L_0x0045
            if (r4 == 0) goto L_0x0047
            android.net.Uri r0 = r4.getUri()
            if (r0 == 0) goto L_0x0047
            java.lang.String r1 = r0.getHost()
        L_0x002f:
            android.net.Uri r0 = r4.getUri()
            if (r0 == 0) goto L_0x0039
            java.lang.String r2 = r0.getPath()
        L_0x0039:
            java.lang.String r1 = kotlin.h.b.n.LIZ(r1, r2)
            java.lang.String r0 = "search/"
            boolean r0 = android.text.TextUtils.equals(r1, r0)
            if (r0 == 0) goto L_0x0051
        L_0x0045:
            r0 = 1
            return r0
        L_0x0047:
            r1 = r2
            if (r4 == 0) goto L_0x0039
            goto L_0x002f
        L_0x004b:
            r1 = r2
            if (r4 == 0) goto L_0x004f
            goto L_0x000d
        L_0x004f:
            r0 = r2
            goto L_0x0017
        L_0x0051:
            r0 = 0
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.search.router.SearchInterceptor.matchInterceptRules(com.bytedance.router.RouteIntent):boolean");
    }

    public static Object LIZ(Bundle bundle, String str) {
        try {
            return bundle.get(str);
        } catch (Exception | OutOfMemoryError unused) {
            return null;
        }
    }

    /*  JADX ERROR: JadxRuntimeException in pass: CodeShrinkVisitor
        jadx.core.utils.exceptions.JadxRuntimeException: Don't wrap MOVE or CONST insns: 0x0009: MOVE  (r6v0 android.content.Context) = (r12v0 android.content.Context)
        	at jadx.core.dex.instructions.args.InsnArg.wrapArg(InsnArg.java:164)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.assignInline(CodeShrinkVisitor.java:133)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.checkInline(CodeShrinkVisitor.java:118)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.shrinkBlock(CodeShrinkVisitor.java:65)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.shrinkMethod(CodeShrinkVisitor.java:43)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.visit(CodeShrinkVisitor.java:35)
        */
    public final boolean onInterceptRoute(android.content.Context r12, com.bytedance.router.RouteIntent r13) {
        /*
            r11 = this;
            r1 = 0
            if (r13 == 0) goto L_0x00b7
            android.net.Uri r0 = r13.getUri()
            if (r0 == 0) goto L_0x00b7
            r6 = r12
            if (r6 == 0) goto L_0x00b7
            if (r13 == 0) goto L_0x0057
            android.net.Uri r2 = r13.getUri()
        L_0x0012:
            android.content.Intent r0 = r13.getExtra()
            if (r0 == 0) goto L_0x0055
            android.os.Bundle r5 = LIZ(r0)
        L_0x001c:
            android.content.Intent r0 = r13.getExtra()
            if (r0 == 0) goto L_0x002c
            android.os.Bundle r0 = LIZ(r0)
            if (r0 == 0) goto L_0x002c
            java.util.Set r1 = r0.keySet()
        L_0x002c:
            java.lang.String r4 = ""
            if (r5 == 0) goto L_0x005d
            if (r1 == 0) goto L_0x005d
            android.net.Uri$Builder r3 = r2.buildUpon()
            java.util.Iterator r2 = r1.iterator()
        L_0x003a:
            boolean r0 = r2.hasNext()
            if (r0 == 0) goto L_0x0059
            java.lang.Object r1 = r2.next()
            java.lang.String r1 = (java.lang.String) r1
            java.lang.Object r0 = LIZ(r5, r1)
            if (r0 != 0) goto L_0x004d
            r0 = r4
        L_0x004d:
            java.lang.String r0 = java.lang.String.valueOf(r0)
            r3.appendQueryParameter(r1, r0)
            goto L_0x003a
        L_0x0055:
            r5 = r1
            goto L_0x001c
        L_0x0057:
            r2 = r1
            goto L_0x0012
        L_0x0059:
            android.net.Uri r2 = r3.build()
        L_0x005d:
            X.SV3 r1 = X.SV3.LIZ
            kotlin.h.b.n.LIZIZ(r2, r4)
            android.os.Bundle r9 = r13.getAnimationBundle()
            X.M12.LIZ(r6, r2)
            X.SXX r0 = X.SXX.LIZIZ
            r0.LIZ()
            X.F5W r0 = X.SV5.Companion
            X.SV4 r0 = r0.newBuilder()
            X.SXD r10 = r1.LIZ((android.net.Uri) r2, (X.SV4) r0)
            X.SV5 r8 = r0.LIZ()
            X.SV0 r7 = new X.SV0
            r7.<init>()
            r1.LIZ((android.net.Uri) r2, (X.SV0) r7)
            r7.setSearchEnterParam(r8)
            X.SXX r0 = X.SXX.LIZIZ
            r0.LIZ()
            X.MH0 r0 = X.MH0.LIZ
            boolean r0 = r0.LIZ()
            if (r0 == 0) goto L_0x00b0
            com.ss.android.ugc.aweme.launcher.service.launcher.ILauncherTaskApi r0 = com.ss.android.ugc.aweme.impl.LauncherTaskApiImpl.LJII()
            r0.LIZIZ()
            android.os.Bundle r2 = new android.os.Bundle
            r2.<init>()
            java.lang.String r0 = "search_enter_param"
            r2.putSerializable(r0, r7)
            X.Sqg r0 = X.C4486SqA.LIZJ
            X.SqA r1 = r0.LIZ()
            java.lang.Class<com.ss.android.ugc.aweme.discover.ui.intermediate.IntermediatePreload> r0 = com.ss.android.ugc.aweme.discover.ui.intermediate.IntermediatePreload.class
            r1.LIZ(r2, r0)
        L_0x00b0:
            X.SUt r5 = X.C3347SUt.LIZIZ
            r5.LIZ((android.content.Context) r6, (X.SV0) r7, (X.SV5) r8, (android.os.Bundle) r9, (X.SXD) r10)
            r0 = 1
            return r0
        L_0x00b7:
            r0 = 0
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.search.router.SearchInterceptor.onInterceptRoute(android.content.Context, com.bytedance.router.RouteIntent):boolean");
    }
}
