package sc;

import android.app.Activity;
import android.app.ActivityManager;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ClipboardManager;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.DhcpInfo;
import android.net.LinkProperties;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.autofill.AutofillManager;
import androidx.media3.common.MimeTypes;
import dd.a0;
import dd.b0;
import dd.d0;
import dd.e;
import dd.j0;
import dd.k;
import dd.l0;
import dd.m;
import dd.n0;
import dd.o0;
import dd.p0;
import dd.u;
import dd.v;
import dd.x;
import dd.z;
import ed.q;
import ed.s;
import ed.t;
import io.flutter.embedding.engine.systemchannels.PlatformChannel$ClipboardContentFormat;
import io.flutter.embedding.engine.systemchannels.PlatformChannel$DeviceOrientation;
import io.flutter.embedding.engine.systemchannels.PlatformChannel$HapticFeedbackType;
import io.flutter.embedding.engine.systemchannels.PlatformChannel$SoundType;
import io.flutter.embedding.engine.systemchannels.PlatformChannel$SystemUiMode;
import io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$PlatformViewCreationRequest$RequestedDisplayMode;
import io.flutter.plugin.platform.d;
import io.flutter.plugin.platform.h;
import io.flutter.plugin.platform.r;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlin.text.i;
import nb.g;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
import wc.c;
import xyz.stream.download.config.InnerConstant;
import xyz.stream.utils.e0;
import xyz.stream.utils.f0;

/* JADX INFO: loaded from: classes.dex */
public final class a implements s {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f32746a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final Object f32747b;

    public /* synthetic */ a(Object obj, int i10) {
        this.f32746a = i10;
        this.f32747b = obj;
    }

    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    private void a(q qVar, a0 a0Var) {
        String hostAddress;
        String strL;
        Inet4Address dhcpServerAddress;
        g.i(qVar, "call");
        String str = qVar.f25842a;
        if (str != null) {
            int iHashCode = str.hashCode();
            String hostAddress2 = null;
            Object obj = this.f32747b;
            switch (iHashCode) {
                case -1560837844:
                    if (str.equals("wifiBroadcast")) {
                        try {
                            List<InterfaceAddress> interfaceAddresses = NetworkInterface.getByInetAddress(InetAddress.getByName(((e0) obj).q())).getInterfaceAddresses();
                            g.h(interfaceAddresses, "getInterfaceAddresses(...)");
                            for (InterfaceAddress interfaceAddress : interfaceAddresses) {
                                if (!interfaceAddress.getAddress().isLoopbackAddress() && interfaceAddress.getBroadcast() != null) {
                                    hostAddress2 = interfaceAddress.getBroadcast().getHostAddress();
                                }
                                break;
                            }
                        } catch (Exception unused) {
                        }
                        a0Var.success(hostAddress2);
                        return;
                    }
                    break;
                case -1340798144:
                    if (str.equals("wifiName")) {
                        WifiInfo connectionInfo = ((WifiManager) ((e0) obj).f36128b).getConnectionInfo();
                        g.h(connectionInfo, "getConnectionInfo(...)");
                        a0Var.success(connectionInfo.getSSID());
                        return;
                    }
                    break;
                case -989025832:
                    if (str.equals("wifiIPv6Address")) {
                        e0 e0Var = (e0) obj;
                        e0Var.getClass();
                        try {
                            Iterator<InterfaceAddress> it = NetworkInterface.getByInetAddress(InetAddress.getByName(e0Var.q())).getInterfaceAddresses().iterator();
                            while (true) {
                                if (it.hasNext()) {
                                    InetAddress address = it.next().getAddress();
                                    if (!address.isLoopbackAddress() && (address instanceof Inet6Address) && (hostAddress = ((Inet6Address) address).getHostAddress()) != null) {
                                        hostAddress2 = ((String[]) i.B0(hostAddress, new String[]{"%"}).toArray(new String[0]))[0];
                                        break;
                                    }
                                }
                            }
                        } catch (SocketException unused2) {
                        }
                        a0Var.success(hostAddress2);
                        return;
                    }
                    break;
                case 183655511:
                    if (str.equals("wifiSubmask")) {
                        try {
                            InetAddress byName = InetAddress.getByName(((e0) obj).q());
                            g.f(byName);
                            strL = e0.l(byName);
                            break;
                        } catch (Exception unused3) {
                            strL = "";
                        }
                        a0Var.success(strL);
                        return;
                    }
                    break;
                case 1373405384:
                    if (str.equals("wifiBSSID")) {
                        WifiInfo connectionInfo2 = ((WifiManager) ((e0) obj).f36128b).getConnectionInfo();
                        g.h(connectionInfo2, "getConnectionInfo(...)");
                        a0Var.success(connectionInfo2.getBSSID());
                        return;
                    }
                    break;
                case 1674251141:
                    if (str.equals("wifiGatewayAddress")) {
                        e0 e0Var2 = (e0) obj;
                        if (Build.VERSION.SDK_INT >= 31) {
                            ConnectivityManager connectivityManager = (ConnectivityManager) e0Var2.f36129c;
                            LinkProperties linkProperties = connectivityManager != null ? connectivityManager.getLinkProperties(connectivityManager.getActiveNetwork()) : null;
                            if (linkProperties != null && (dhcpServerAddress = linkProperties.getDhcpServerAddress()) != null) {
                                hostAddress2 = dhcpServerAddress.getHostAddress();
                            }
                        } else {
                            DhcpInfo dhcpInfo = ((WifiManager) e0Var2.f36128b).getDhcpInfo();
                            Integer numValueOf = dhcpInfo != null ? Integer.valueOf(dhcpInfo.gateway) : null;
                            if (numValueOf != null) {
                                hostAddress2 = e0.i(numValueOf.intValue());
                            }
                        }
                        a0Var.success(hostAddress2);
                        return;
                    }
                    break;
                case 1756715352:
                    if (str.equals("wifiIPAddress")) {
                        a0Var.success(((e0) obj).q());
                        return;
                    }
                    break;
            }
        }
        a0Var.notImplemented();
    }

    private void b() {
        ((e) this.f32747b).getClass();
    }

    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    /* JADX WARN: Removed duplicated region for block: B:147:0x0316  */
    /* JADX WARN: Removed duplicated region for block: B:56:0x00d4  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private void c(q qVar, a0 a0Var) {
        byte b10;
        PlatformChannel$ClipboardContentFormat platformChannel$ClipboardContentFormatA;
        ClipDescription primaryClipDescription;
        Object obj = this.f32747b;
        if (((dd.q) obj).platformMessageHandler == null) {
            return;
        }
        String str = qVar.f25842a;
        try {
            int i10 = 2;
            boolean zHasMimeType = false;
            switch (str.hashCode()) {
                case -1501580720:
                    b10 = str.equals("SystemNavigator.setFrameworkHandlesBack") ? (byte) 9 : (byte) -1;
                    break;
                case -931781241:
                    if (str.equals("Share.invoke")) {
                        b10 = 14;
                        break;
                    }
                    break;
                case -766342101:
                    if (str.equals("SystemNavigator.pop")) {
                        b10 = 10;
                        break;
                    }
                    break;
                case -720677196:
                    if (str.equals("Clipboard.setData")) {
                        b10 = 12;
                        break;
                    }
                    break;
                case -577225884:
                    if (str.equals("SystemChrome.setSystemUIChangeListener")) {
                        b10 = 6;
                        break;
                    }
                    break;
                case -548468504:
                    if (str.equals("SystemChrome.setApplicationSwitcherDescription")) {
                        b10 = 3;
                        break;
                    }
                    break;
                case -247230243:
                    if (str.equals("HapticFeedback.vibrate")) {
                        b10 = 1;
                        break;
                    }
                    break;
                case -215273374:
                    if (str.equals("SystemSound.play")) {
                        b10 = 0;
                        break;
                    }
                    break;
                case 241845679:
                    if (str.equals("SystemChrome.restoreSystemUIOverlays")) {
                        b10 = 7;
                        break;
                    }
                    break;
                case 875995648:
                    if (str.equals("Clipboard.hasStrings")) {
                        b10 = 13;
                        break;
                    }
                    break;
                case 1128339786:
                    if (str.equals("SystemChrome.setEnabledSystemUIMode")) {
                        b10 = 5;
                        break;
                    }
                    break;
                case 1390477857:
                    if (str.equals("SystemChrome.setSystemUIOverlayStyle")) {
                        b10 = 8;
                        break;
                    }
                    break;
                case 1514180520:
                    if (str.equals("Clipboard.getData")) {
                        b10 = 11;
                        break;
                    }
                    break;
                case 1674312266:
                    if (str.equals("SystemChrome.setEnabledSystemUIOverlays")) {
                        b10 = 4;
                        break;
                    }
                    break;
                case 2119655719:
                    if (str.equals("SystemChrome.setPreferredOrientations")) {
                        b10 = 2;
                        break;
                    }
                    break;
                default:
                    break;
            }
            Object obj2 = qVar.f25843b;
            switch (b10) {
                case 0:
                    try {
                        PlatformChannel$SoundType platformChannel$SoundTypeA = PlatformChannel$SoundType.a((String) obj2);
                        d dVar = (d) ((dd.q) obj).platformMessageHandler;
                        PlatformChannel$SoundType platformChannel$SoundType = PlatformChannel$SoundType.CLICK;
                        h hVar = dVar.f28208a;
                        if (platformChannel$SoundTypeA == platformChannel$SoundType) {
                            hVar.f28216a.getWindow().getDecorView().playSoundEffect(0);
                        } else {
                            hVar.getClass();
                        }
                        a0Var.success(null);
                        return;
                    } catch (NoSuchFieldException e10) {
                        a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e10.getMessage(), null);
                        return;
                    }
                case 1:
                    try {
                        ((d) ((dd.q) obj).platformMessageHandler).c(PlatformChannel$HapticFeedbackType.fromValue((String) obj2));
                        a0Var.success(null);
                        return;
                    } catch (NoSuchFieldException e11) {
                        a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e11.getMessage(), null);
                        return;
                    }
                case 2:
                    try {
                        JSONArray jSONArray = (JSONArray) obj2;
                        ((dd.q) obj).getClass();
                        int i11 = 0;
                        int i12 = 0;
                        for (int i13 = 0; i13 < jSONArray.length(); i13++) {
                            int iOrdinal = PlatformChannel$DeviceOrientation.a(jSONArray.getString(i13)).ordinal();
                            if (iOrdinal == 0) {
                                i11 |= 1;
                            } else if (iOrdinal == 1) {
                                i11 |= 4;
                            } else if (iOrdinal == 2) {
                                i11 |= 2;
                            } else if (iOrdinal == 3) {
                                i11 |= 8;
                            }
                            if (i12 == 0) {
                                i12 = i11;
                            }
                        }
                        if (i11 != 0) {
                            switch (i11) {
                                case 2:
                                    i10 = 0;
                                    break;
                                case 3:
                                case 6:
                                case 7:
                                case 9:
                                case 12:
                                case 13:
                                case 14:
                                    if (i12 != 2) {
                                        if (i12 != 4) {
                                            i10 = i12 != 8 ? 1 : 8;
                                        }
                                        i10 = 9;
                                    }
                                    i10 = 0;
                                    break;
                                case 4:
                                    i10 = 9;
                                    break;
                                case 5:
                                    i10 = 12;
                                    break;
                                case 8:
                                    break;
                                case 10:
                                    i10 = 11;
                                    break;
                                case 11:
                                    break;
                                case 15:
                                    i10 = 13;
                                    break;
                                default:
                                    break;
                            }
                        } else {
                            i10 = -1;
                        }
                        ((d) ((dd.q) obj).platformMessageHandler).f28208a.f28216a.setRequestedOrientation(i10);
                        a0Var.success(null);
                        return;
                    } catch (NoSuchFieldException | JSONException e12) {
                        a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e12.getMessage(), null);
                        return;
                    }
                case 3:
                    try {
                        JSONObject jSONObject = (JSONObject) obj2;
                        ((dd.q) obj).getClass();
                        int i14 = jSONObject.getInt("primaryColor");
                        if (i14 != 0) {
                            i14 |= -16777216;
                        }
                        String string = jSONObject.getString("label");
                        d dVar2 = (d) ((dd.q) obj).platformMessageHandler;
                        int i15 = Build.VERSION.SDK_INT;
                        Activity activity = dVar2.f28208a.f28216a;
                        if (i15 < 28) {
                            activity.setTaskDescription(new ActivityManager.TaskDescription(string, (Bitmap) null, i14));
                        } else {
                            activity.setTaskDescription(com.bytedance.sdk.component.adexpress.dynamic.dynamicview.a.b(string, i14));
                        }
                        a0Var.success(null);
                        return;
                    } catch (JSONException e13) {
                        a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e13.getMessage(), null);
                        return;
                    }
                case 4:
                    try {
                        ((d) ((dd.q) obj).platformMessageHandler).a(dd.q.b((dd.q) obj, (JSONArray) obj2));
                        a0Var.success(null);
                        return;
                    } catch (NoSuchFieldException | JSONException e14) {
                        a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e14.getMessage(), null);
                        return;
                    }
                case 5:
                    try {
                        ((dd.q) obj).getClass();
                        int iOrdinal2 = PlatformChannel$SystemUiMode.a((String) obj2).ordinal();
                        ((d) ((dd.q) obj).platformMessageHandler).b(iOrdinal2 != 0 ? iOrdinal2 != 1 ? iOrdinal2 != 2 ? PlatformChannel$SystemUiMode.EDGE_TO_EDGE : PlatformChannel$SystemUiMode.IMMERSIVE_STICKY : PlatformChannel$SystemUiMode.IMMERSIVE : PlatformChannel$SystemUiMode.LEAN_BACK);
                        a0Var.success(null);
                        return;
                    } catch (NoSuchFieldException | JSONException e15) {
                        a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e15.getMessage(), null);
                        return;
                    }
                case 6:
                    h hVar2 = ((d) ((dd.q) obj).platformMessageHandler).f28208a;
                    View decorView = hVar2.f28216a.getWindow().getDecorView();
                    decorView.setOnSystemUiVisibilityChangeListener(new io.flutter.plugin.platform.e(hVar2, decorView));
                    a0Var.success(null);
                    return;
                case 7:
                    ((d) ((dd.q) obj).platformMessageHandler).f28208a.d();
                    a0Var.success(null);
                    return;
                case 8:
                    try {
                        ((d) ((dd.q) obj).platformMessageHandler).f28208a.c(dd.q.c((dd.q) obj, (JSONObject) obj2));
                        a0Var.success(null);
                        return;
                    } catch (NoSuchFieldException | JSONException e16) {
                        a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e16.getMessage(), null);
                        return;
                    }
                case 9:
                    h.a(((d) ((dd.q) obj).platformMessageHandler).f28208a, ((Boolean) obj2).booleanValue());
                    a0Var.success(null);
                    return;
                case 10:
                    h.b(((d) ((dd.q) obj).platformMessageHandler).f28208a);
                    a0Var.success(null);
                    return;
                case 11:
                    String str2 = (String) obj2;
                    if (str2 != null) {
                        try {
                            platformChannel$ClipboardContentFormatA = PlatformChannel$ClipboardContentFormat.a(str2);
                        } catch (NoSuchFieldException unused) {
                            a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, "No such clipboard content format: ".concat(str2), null);
                            platformChannel$ClipboardContentFormatA = null;
                        }
                        break;
                    } else {
                        platformChannel$ClipboardContentFormatA = null;
                    }
                    CharSequence clipboardData = ((d) ((dd.q) obj).platformMessageHandler).getClipboardData(platformChannel$ClipboardContentFormatA);
                    if (clipboardData == null) {
                        a0Var.success(null);
                        return;
                    }
                    JSONObject jSONObject2 = new JSONObject();
                    jSONObject2.put(MimeTypes.BASE_TYPE_TEXT, clipboardData);
                    a0Var.success(jSONObject2);
                    return;
                case 12:
                    ((ClipboardManager) ((d) ((dd.q) obj).platformMessageHandler).f28208a.f28216a.getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("text label?", ((JSONObject) obj2).getString(MimeTypes.BASE_TYPE_TEXT)));
                    a0Var.success(null);
                    return;
                case 13:
                    ClipboardManager clipboardManager = (ClipboardManager) ((d) ((dd.q) obj).platformMessageHandler).f28208a.f28216a.getSystemService("clipboard");
                    if (clipboardManager.hasPrimaryClip() && (primaryClipDescription = clipboardManager.getPrimaryClipDescription()) != null) {
                        zHasMimeType = primaryClipDescription.hasMimeType("text/*");
                    }
                    JSONObject jSONObject3 = new JSONObject();
                    jSONObject3.put("value", zHasMimeType);
                    a0Var.success(jSONObject3);
                    return;
                case 14:
                    h hVar3 = ((d) ((dd.q) obj).platformMessageHandler).f28208a;
                    hVar3.getClass();
                    Intent intent = new Intent();
                    intent.setAction("android.intent.action.SEND");
                    intent.setType("text/plain");
                    intent.putExtra("android.intent.extra.TEXT", (String) obj2);
                    hVar3.f28216a.startActivity(Intent.createChooser(intent, null));
                    a0Var.success(null);
                    return;
                default:
                    a0Var.notImplemented();
                    return;
            }
        } catch (JSONException e17) {
            a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, "JSON error: " + e17.getMessage(), null);
        }
        a0Var.error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, "JSON error: " + e17.getMessage(), null);
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:120:0x02a7  */
    /* JADX WARN: Removed duplicated region for block: B:199:0x042a  */
    /* JADX WARN: Removed duplicated region for block: B:9:0x0032  */
    @Override // ed.s
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void onMethodCall(q qVar, t tVar) {
        byte b10;
        Bundle bundle;
        int i10 = this.f32746a;
        byte b11 = 3;
        char c6 = 0;
        z = false;
        boolean z10 = false;
        c6 = 0;
        Object obj = this.f32747b;
        switch (i10) {
            case 0:
                a(qVar, (a0) tVar);
                return;
            case 1:
                ((a0) tVar).success(null);
                return;
            case 2:
                b();
                return;
            case 3:
                if (((k) obj).localizationMessageHandler == null) {
                    return;
                }
                String str = qVar.f25842a;
                str.getClass();
                if (!str.equals("Localization.getStringResource")) {
                    ((a0) tVar).notImplemented();
                    return;
                }
                JSONObject jSONObject = (JSONObject) qVar.arguments();
                try {
                    ((a0) tVar).success(((fd.a) ((k) obj).localizationMessageHandler).getStringResource(jSONObject.getString("key"), jSONObject.has("locale") ? jSONObject.getString("locale") : null));
                    return;
                } catch (JSONException e10) {
                    ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e10.getMessage(), null);
                    return;
                }
            case 4:
                if (((m) obj).mouseCursorMethodHandler == null) {
                    return;
                }
                String str2 = qVar.f25842a;
                try {
                    if (str2.hashCode() == -1307105544 && str2.equals("activateSystemCursor")) {
                        String str3 = (String) ((HashMap) qVar.f25843b).get("kind");
                        try {
                            Object obj2 = ((xyz.stream.api.a0) ((m) obj).mouseCursorMethodHandler).f35758b;
                            ((io.flutter.plugin.mouse.b) obj2).f28178a.setPointerIcon(io.flutter.plugin.mouse.b.a((io.flutter.plugin.mouse.b) obj2, str3));
                            ((a0) tVar).success(Boolean.TRUE);
                        } catch (Exception e11) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, "Error when setting cursors: " + e11.getMessage(), null);
                        }
                    }
                    return;
                } catch (Exception e12) {
                    ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, "Unhandled error: " + e12.getMessage(), null);
                    return;
                }
            case 5:
                ((a0) tVar).success(null);
                return;
            case 6:
                c(qVar, (a0) tVar);
                return;
            case 7:
                if (((x) obj).f25175b == null) {
                    return;
                }
                String str4 = qVar.f25842a;
                str4.getClass();
                switch (str4) {
                    case "create":
                        Map map = (Map) qVar.arguments();
                        Object[] objArr = map.containsKey("hybrid") && ((Boolean) map.get("hybrid")).booleanValue();
                        ByteBuffer byteBufferWrap = map.containsKey("params") ? ByteBuffer.wrap((byte[]) map.get("params")) : null;
                        try {
                            if (objArr == true) {
                                dd.t tVar2 = new dd.t(((Integer) map.get(InnerConstant.Db.f36069id)).intValue(), (String) map.get("viewType"), 0.0d, 0.0d, 0.0d, 0.0d, ((Integer) map.get("direction")).intValue(), PlatformViewsChannel$PlatformViewCreationRequest$RequestedDisplayMode.f28090c, byteBufferWrap);
                                f0 f0Var = (f0) ((x) obj).f25175b;
                                ((r) f0Var.f36136b).getClass();
                                r.n(19);
                                r.c((r) f0Var.f36136b, tVar2);
                                ((r) f0Var.f36136b).j(tVar2, false);
                                ((r) f0Var.f36136b).getClass();
                                r.n(19);
                                ((a0) tVar).success(null);
                                return;
                            }
                            if (map.containsKey("hybridFallback") && ((Boolean) map.get("hybridFallback")).booleanValue()) {
                                c6 = 1;
                            }
                            long jG = ((f0) ((x) obj).f25175b).g(new dd.t(((Integer) map.get(InnerConstant.Db.f36069id)).intValue(), (String) map.get("viewType"), map.containsKey("top") ? ((Double) map.get("top")).doubleValue() : 0.0d, map.containsKey("left") ? ((Double) map.get("left")).doubleValue() : 0.0d, ((Double) map.get("width")).doubleValue(), ((Double) map.get("height")).doubleValue(), ((Integer) map.get("direction")).intValue(), c6 != 0 ? PlatformViewsChannel$PlatformViewCreationRequest$RequestedDisplayMode.f28089b : PlatformViewsChannel$PlatformViewCreationRequest$RequestedDisplayMode.f28088a, byteBufferWrap));
                            if (jG != -2) {
                                ((a0) tVar).success(Long.valueOf(jG));
                                return;
                            } else {
                                if (c6 == 0) {
                                    throw new AssertionError("Platform view attempted to fall back to hybrid mode when not requested.");
                                }
                                ((a0) tVar).success(null);
                                return;
                            }
                        } catch (IllegalStateException e13) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, c.getStackTraceString(e13), null);
                            return;
                        }
                    case "offset":
                        Map map2 = (Map) qVar.arguments();
                        try {
                            ((f0) ((x) obj).f25175b).s(((Integer) map2.get(InnerConstant.Db.f36069id)).intValue(), ((Double) map2.get("top")).doubleValue(), ((Double) map2.get("left")).doubleValue());
                            ((a0) tVar).success(null);
                            return;
                        } catch (IllegalStateException e14) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, c.getStackTraceString(e14), null);
                            return;
                        }
                    case "resize":
                        Map map3 = (Map) qVar.arguments();
                        try {
                            ((f0) ((x) obj).f25175b).z(new u(((Integer) map3.get(InnerConstant.Db.f36069id)).intValue(), ((Double) map3.get("width")).doubleValue(), ((Double) map3.get("height")).doubleValue()), new com.baseflow.permissionhandler.a(9, (a0) tVar));
                            return;
                        } catch (IllegalStateException e15) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, c.getStackTraceString(e15), null);
                            return;
                        }
                    case "clearFocus":
                        try {
                            ((f0) ((x) obj).f25175b).d(((Integer) qVar.arguments()).intValue());
                            ((a0) tVar).success(null);
                            return;
                        } catch (IllegalStateException e16) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, c.getStackTraceString(e16), null);
                            return;
                        }
                    case "synchronizeToNativeViewHierarchy":
                        try {
                            ((r) ((f0) ((x) obj).f25175b).f36136b).f28246o = ((Boolean) qVar.arguments()).booleanValue();
                            ((a0) tVar).success(null);
                            return;
                        } catch (IllegalStateException e17) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, c.getStackTraceString(e17), null);
                            return;
                        }
                    case "touch":
                        List list = (List) qVar.arguments();
                        try {
                            ((f0) ((x) obj).f25175b).t(new v(((Integer) list.get(0)).intValue(), (Number) list.get(1), (Number) list.get(2), ((Integer) list.get(3)).intValue(), ((Integer) list.get(4)).intValue(), list.get(5), list.get(6), ((Integer) list.get(7)).intValue(), ((Integer) list.get(8)).intValue(), (float) ((Double) list.get(9)).doubleValue(), (float) ((Double) list.get(10)).doubleValue(), ((Integer) list.get(11)).intValue(), ((Integer) list.get(12)).intValue(), ((Integer) list.get(13)).intValue(), ((Integer) list.get(14)).intValue(), ((Number) list.get(15)).longValue()));
                            ((a0) tVar).success(null);
                            return;
                        } catch (IllegalStateException e18) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, c.getStackTraceString(e18), null);
                            return;
                        }
                    case "setDirection":
                        Map map4 = (Map) qVar.arguments();
                        try {
                            ((f0) ((x) obj).f25175b).D(((Integer) map4.get(InnerConstant.Db.f36069id)).intValue(), ((Integer) map4.get("direction")).intValue());
                            ((a0) tVar).success(null);
                            return;
                        } catch (IllegalStateException e19) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, c.getStackTraceString(e19), null);
                            return;
                        }
                    case "dispose":
                        try {
                            ((f0) ((x) obj).f25175b).h(((Integer) ((Map) qVar.arguments()).get(InnerConstant.Db.f36069id)).intValue());
                            ((a0) tVar).success(null);
                            return;
                        } catch (IllegalStateException e20) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, c.getStackTraceString(e20), null);
                            return;
                        }
                    default:
                        ((a0) tVar).notImplemented();
                        return;
                }
            case 8:
                if (((z) obj).f25177b == null) {
                    return;
                }
                String str5 = qVar.f25842a;
                Object obj3 = qVar.f25843b;
                str5.getClass();
                if (str5.equals("ProcessText.processTextAction")) {
                    try {
                        ArrayList arrayList = (ArrayList) obj3;
                        ((gd.a) ((z) obj).f25177b).a((String) arrayList.get(0), (String) arrayList.get(1), ((Boolean) arrayList.get(2)).booleanValue(), (a0) tVar);
                        return;
                    } catch (IllegalStateException e21) {
                        ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e21.getMessage(), null);
                        return;
                    }
                }
                if (!str5.equals("ProcessText.queryTextActions")) {
                    ((a0) tVar).notImplemented();
                    return;
                }
                try {
                    ((a0) tVar).success(((gd.a) ((z) obj).f25177b).b());
                    return;
                } catch (IllegalStateException e22) {
                    ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e22.getMessage(), null);
                    return;
                }
            case 9:
                String str6 = qVar.f25842a;
                str6.getClass();
                if (!str6.equals("get")) {
                    if (!str6.equals("put")) {
                        ((a0) tVar).notImplemented();
                        return;
                    } else {
                        ((b0) obj).f25098b = (byte[]) qVar.f25843b;
                        ((a0) tVar).success(null);
                        return;
                    }
                }
                b0 b0Var = (b0) obj;
                b0Var.f25102f = true;
                if (b0Var.f25101e || !b0Var.f25097a) {
                    ((a0) tVar).success(b0.a(b0Var.f25098b));
                    return;
                } else {
                    b0Var.f25100d = tVar;
                    return;
                }
            case 10:
                d0 d0Var = (d0) obj;
                if (d0Var.f25106a == null) {
                    return;
                }
                String str7 = qVar.f25842a;
                str7.getClass();
                int iHashCode = str7.hashCode();
                if (iHashCode != -705821951) {
                    if (iHashCode != 1759284829) {
                        b10 = (iHashCode == 2119738044 && str7.equals("Scribe.isStylusHandwritingAvailable")) ? (byte) 2 : (byte) -1;
                    } else if (str7.equals("Scribe.startStylusHandwriting")) {
                        b10 = 1;
                    }
                } else if (str7.equals("Scribe.isFeatureAvailable")) {
                    b10 = 0;
                }
                if (b10 == 0) {
                    try {
                        io.flutter.plugin.editing.h hVar = (io.flutter.plugin.editing.h) d0Var.f25106a;
                        if (Build.VERSION.SDK_INT < 34) {
                            hVar.getClass();
                        } else if (hVar.f28149a.isStylusHandwritingAvailable()) {
                            z10 = true;
                        }
                        ((a0) tVar).success(Boolean.valueOf(z10));
                        return;
                    } catch (IllegalStateException e23) {
                        ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e23.getMessage(), null);
                        return;
                    }
                }
                if (b10 == 1) {
                    if (Build.VERSION.SDK_INT < 33) {
                        ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, "Requires API level 33 or higher.", null);
                        return;
                    }
                    try {
                        io.flutter.plugin.editing.h hVar2 = (io.flutter.plugin.editing.h) d0Var.f25106a;
                        hVar2.f28149a.startStylusHandwriting(hVar2.f28150b);
                        ((a0) tVar).success(null);
                        return;
                    } catch (IllegalStateException e24) {
                        ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e24.getMessage(), null);
                        return;
                    }
                }
                if (b10 != 2) {
                    ((a0) tVar).notImplemented();
                    return;
                }
                if (Build.VERSION.SDK_INT < 34) {
                    ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, "Requires API level 34 or higher.", null);
                    return;
                }
                try {
                    ((a0) tVar).success(Boolean.valueOf(((io.flutter.plugin.editing.h) d0Var.f25106a).f28149a.isStylusHandwritingAvailable()));
                    return;
                } catch (IllegalStateException e25) {
                    ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e25.getMessage(), null);
                    return;
                }
            case 11:
                if (((j0) obj).f25121a == null) {
                    return;
                }
                String str8 = qVar.f25842a;
                Object obj4 = qVar.f25843b;
                str8.getClass();
                if (!str8.equals("SpellCheck.initiateSpellCheck")) {
                    ((a0) tVar).notImplemented();
                    return;
                }
                try {
                    ArrayList arrayList2 = (ArrayList) obj4;
                    ((io.flutter.plugin.editing.i) ((j0) obj).f25121a).a((a0) tVar, (String) arrayList2.get(0), (String) arrayList2.get(1));
                    return;
                } catch (IllegalStateException e26) {
                    ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e26.getMessage(), null);
                    return;
                }
            default:
                p0 p0Var = (p0) obj;
                if (p0Var.textInputMethodHandler == null) {
                    return;
                }
                String str9 = qVar.f25842a;
                str9.getClass();
                switch (str9.hashCode()) {
                    case -1779068172:
                        b11 = str9.equals("TextInput.setPlatformViewClient") ? (byte) 0 : (byte) -1;
                        break;
                    case -1015421462:
                        if (str9.equals("TextInput.setEditingState")) {
                            b11 = 1;
                            break;
                        }
                        break;
                    case -37561188:
                        if (str9.equals("TextInput.setClient")) {
                            b11 = 2;
                            break;
                        }
                        break;
                    case 270476819:
                        if (!str9.equals("TextInput.hide")) {
                        }
                        break;
                    case 270803918:
                        if (str9.equals("TextInput.show")) {
                            b11 = 4;
                            break;
                        }
                        break;
                    case 649192816:
                        if (str9.equals("TextInput.sendAppPrivateCommand")) {
                            b11 = 5;
                            break;
                        }
                        break;
                    case 1204752139:
                        if (str9.equals("TextInput.setEditableSizeAndTransform")) {
                            b11 = 6;
                            break;
                        }
                        break;
                    case 1727570905:
                        if (str9.equals("TextInput.finishAutofillContext")) {
                            b11 = 7;
                            break;
                        }
                        break;
                    case 1904427655:
                        if (str9.equals("TextInput.clearClient")) {
                            b11 = 8;
                            break;
                        }
                        break;
                    case 2113369584:
                        if (str9.equals("TextInput.requestAutofill")) {
                            b11 = 9;
                            break;
                        }
                        break;
                }
                Object obj5 = qVar.f25843b;
                switch (b11) {
                    case 0:
                        try {
                            JSONObject jSONObject2 = (JSONObject) obj5;
                            io.flutter.plugin.editing.m.c((io.flutter.plugin.editing.m) ((io.flutter.plugin.editing.k) ((p0) obj).textInputMethodHandler).f28163a, jSONObject2.getInt("platformViewId"), jSONObject2.optBoolean("usesVirtualDisplay", false));
                            ((a0) tVar).success(null);
                            return;
                        } catch (JSONException e27) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e27.getMessage(), null);
                            return;
                        }
                    case 1:
                        try {
                            ((io.flutter.plugin.editing.k) ((p0) obj).textInputMethodHandler).e(n0.a((JSONObject) obj5));
                            ((a0) tVar).success(null);
                            return;
                        } catch (JSONException e28) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e28.getMessage(), null);
                            return;
                        }
                    case 2:
                        try {
                            JSONArray jSONArray = (JSONArray) obj5;
                            ((io.flutter.plugin.editing.m) ((io.flutter.plugin.editing.k) ((p0) obj).textInputMethodHandler).f28163a).m(jSONArray.getInt(0), l0.a(jSONArray.getJSONObject(1)));
                            ((a0) tVar).success(null);
                            return;
                        } catch (NoSuchFieldException | JSONException e29) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e29.getMessage(), null);
                            return;
                        }
                    case 3:
                        ((io.flutter.plugin.editing.k) p0Var.textInputMethodHandler).a();
                        ((a0) tVar).success(null);
                        return;
                    case 4:
                        io.flutter.plugin.editing.m mVar = (io.flutter.plugin.editing.m) ((io.flutter.plugin.editing.k) p0Var.textInputMethodHandler).f28163a;
                        mVar.n(mVar.f28166a);
                        ((a0) tVar).success(null);
                        return;
                    case 5:
                        try {
                            JSONObject jSONObject3 = (JSONObject) obj5;
                            String string = jSONObject3.getString("action");
                            String string2 = jSONObject3.getString("data");
                            if (string2 == null || string2.isEmpty()) {
                                bundle = null;
                            } else {
                                bundle = new Bundle();
                                bundle.putString("data", string2);
                            }
                            io.flutter.plugin.editing.m mVar2 = (io.flutter.plugin.editing.m) ((io.flutter.plugin.editing.k) ((p0) obj).textInputMethodHandler).f28163a;
                            mVar2.f28167b.sendAppPrivateCommand(mVar2.f28166a, string, bundle);
                            ((a0) tVar).success(null);
                            return;
                        } catch (JSONException e30) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e30.getMessage(), null);
                            return;
                        }
                    case 6:
                        try {
                            JSONObject jSONObject4 = (JSONObject) obj5;
                            double d10 = jSONObject4.getDouble("width");
                            double d11 = jSONObject4.getDouble("height");
                            JSONArray jSONArray2 = jSONObject4.getJSONArray("transform");
                            double[] dArr = new double[16];
                            for (int i11 = 0; i11 < 16; i11++) {
                                dArr[i11] = jSONArray2.getDouble(i11);
                            }
                            io.flutter.plugin.editing.m.d((io.flutter.plugin.editing.m) ((io.flutter.plugin.editing.k) ((p0) obj).textInputMethodHandler).f28163a, d10, d11, dArr);
                            ((a0) tVar).success(null);
                            return;
                        } catch (JSONException e31) {
                            ((a0) tVar).error(IjkMediaPlayer.OnNativeInvokeListener.ARG_ERROR, e31.getMessage(), null);
                            return;
                        }
                    case 7:
                        o0 o0Var = p0Var.textInputMethodHandler;
                        boolean zBooleanValue = ((Boolean) obj5).booleanValue();
                        io.flutter.plugin.editing.k kVar = (io.flutter.plugin.editing.k) o0Var;
                        if (Build.VERSION.SDK_INT >= 26) {
                            AutofillManager autofillManager = ((io.flutter.plugin.editing.m) kVar.f28163a).f28168c;
                            if (autofillManager != null) {
                                if (zBooleanValue) {
                                    autofillManager.commit();
                                } else {
                                    autofillManager.cancel();
                                }
                            }
                        } else {
                            kVar.getClass();
                        }
                        ((a0) tVar).success(null);
                        return;
                    case 8:
                        ((io.flutter.plugin.editing.m) ((io.flutter.plugin.editing.k) p0Var.textInputMethodHandler).f28163a).g();
                        ((a0) tVar).success(null);
                        return;
                    case 9:
                        io.flutter.plugin.editing.m.b((io.flutter.plugin.editing.m) ((io.flutter.plugin.editing.k) p0Var.textInputMethodHandler).f28163a);
                        ((a0) tVar).success(null);
                        return;
                    default:
                        ((a0) tVar).notImplemented();
                        return;
                }
        }
    }

    public a(e0 e0Var) {
        this.f32746a = 0;
        this.f32747b = e0Var;
    }
}
