package com.bytedance.android.live.liveinteract.multiguestv3.internal;

import X.2Fb;
import X.2J8;
import X.2K3;
import X.2Mj;
import X.2O1;
import X.2O2;
import X.2Pr;
import X.6iy;
import X.7Vd;
import X.7Ve;
import X.7Vf;
import X.7Vg;
import X.7Vh;
import X.7Vi;
import X.7Vj;
import X.7Vk;
import X.7Vl;
import X.7Vm;
import X.7Vn;
import X.7Vo;
import X.8dp;
import X.AnonymousClass1X0;
import X.AnonymousClass1X1;
import X.C11100cm;
import X.C20260rY;
import X.C20620s8;
import X.C20630s9;
import X.C20640sA;
import X.C20650sB;
import X.C20660sC;
import X.C20670sD;
import X.C20680sE;
import X.C20690sF;
import X.C20700sG;
import X.C20710sH;
import X.C20720sI;
import X.C20730sJ;
import X.C20740sK;
import X.C20750sL;
import X.C20760sM;
import X.C20770sN;
import X.C20780sO;
import X.C20790sP;
import X.C20800sQ;
import X.C20810sR;
import X.C20820sS;
import X.C20830sT;
import X.C20840sU;
import X.C33641Vi;
import X.C34071Wz;
import X.C41491kh;
import X.Glh;
import X.H7d;
import X.IOW;
import X.K0R;
import X.LeY;
import X.Lel;
import X.Ls0;
import X.Ls2;
import X.LsD;
import X.M12;
import X.MLi;
import X.MMF;
import X.MOo;
import X.MOw;
import X.MOx;
import X.MVA;
import X.TC2;
import X.TCR;
import X.TCS;
import X.TCa;
import X.TCh;
import X.TCm;
import X.TD3;
import X.TD4;
import X.TD5;
import X.TD6;
import X.TDA;
import X.TDe;
import X.TDz;
import X.TE5;
import X.TEK;
import X.TFh;
import X.TFi;
import X.TFj;
import X.TFk;
import X.TFl;
import X.TFm;
import X.TFn;
import X.TFo;
import X.TFq;
import X.TFr;
import X.TH0;
import X.THt;
import X.THu;
import X.TI4;
import X.TI5;
import X.TIB;
import X.TIX;
import X.TIZ;
import X.TIo;
import X.TIv;
import X.TIx;
import android.content.Context;
import android.util.ArrayMap;
import com.bytedance.android.livesdk.comp.api.linkcore.api.ILinkMicService;
import com.bytedance.android.livesdk.livesetting.linkmic.LiveAnchorOneVnSetting;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.android.livesdkapi.depend.model.live.StreamUrl;
import com.bytedance.covode.number.Covode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import kotlin.h.b.n;

public class MultiGuestV3InternalServiceImpl implements IMultiGuestV3InternalService {
    public boolean isAttached;
    public Map<Class<?>, List<LsD<THu, C20660sC<TFn>, 2Pr>>> mCreateMeChannelMessageHandlers;
    public TIo mLinkMicManager;
    public Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> mLinkMicMessageHandlers;
    public ILinkMicService mLinkMicService;
    public THu mLinkMicSession;
    public TIB mLiveConfig;
    public Room mRoom;

    static {
        Covode.recordClassIndex(8365);
    }

    public void addLinkMicEventListener(THt tHt) {
        M12.LIZ(tHt);
    }

    public void addTimeoutListener(TH0 th0) {
        M12.LIZ(th0);
    }

    public int getCurrentMicPositionStrategy() {
        return 0;
    }

    public boolean isAudioMute(String str) {
        M12.LIZ(str);
        return false;
    }

    public boolean isVideoMute(String str) {
        M12.LIZ(str);
        return false;
    }

    public void multiCancel(2Fb r1, TIZ<7Vd> tiz) {
        M12.LIZ(r1);
    }

    public void onContainerOffsetYDidUpdate(float f) {
    }

    public void onInit() {
    }

    public void onLocalLinkedListDidChange(List<TEK> list, List<TEK> list2) {
        M12.LIZ(list, list2);
    }

    public void onLocalLinkedListWillChange(List<TEK> list, List<TEK> list2) {
        M12.LIZ(list, list2);
    }

    public void onSeiBattleIdUpdated(long j) {
    }

    public String onTriggerSei() {
        return null;
    }

    public void removeLinkMicEventListener(THt tHt) {
        M12.LIZ(tHt);
    }

    public void removeTimeoutListener(TH0 th0) {
        M12.LIZ(th0);
    }

    public void setCurrentMicPositionStrategy(int i) {
    }

    public void updateUserList() {
    }

    public String channelId() {
        return getSession().channelId();
    }

    public TCm dslManager() {
        return getSession().dslManager();
    }

    public Set<Long> getHasInvitedUidSet() {
        return getSession().getHasInvitedUidSet();
    }

    public int getLinkMicState() {
        return getSession().getLinkMicState();
    }

    public Map<String, String> getSceneLayoutIdMap() {
        return getSession().getSceneLayoutIdMap();
    }

    public boolean isRtcEngineOn() {
        return getSession().isRtcEngineOn();
    }

    public TCS layoutManager() {
        return getSession().layoutManager();
    }

    public TIv rtcManager() {
        return getSession().rtcManager();
    }

    public int scene() {
        return getSession().scene();
    }

    public TDe selfLinkInfo() {
        return getSession().selfLinkInfo();
    }

    public void unsubscribeAll() {
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        map.clear();
    }

    public TCR userManager() {
        return getSession().userManager();
    }

    private final THu getSession() {
        if (this.mLinkMicSession == null) {
            TIo tIo = this.mLinkMicManager;
            if (tIo == null) {
                n.LIZ("");
            }
            this.mLinkMicSession = tIo.LIZ(4, (String) null);
        }
        THu tHu = this.mLinkMicSession;
        if (tHu == null) {
            n.LIZIZ();
        }
        return tHu;
    }

    public void detach() {
        if (this.isAttached) {
            TIo tIo = this.mLinkMicManager;
            if (tIo == null) {
                n.LIZ("");
            }
            tIo.LIZ();
            this.isAttached = false;
        }
    }

    public void dispose() {
        getSession().removeLinkMicEventListener(this);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        map.clear();
        getSession().dispose();
    }

    public void release() {
        unsubscribeAll();
        THu tHu = this.mLinkMicSession;
        if (tHu != null) {
            tHu.removeLinkMicEventListener(this);
        }
        THu tHu2 = this.mLinkMicSession;
        if (tHu2 != null) {
            tHu2.dispose();
        }
        this.mLinkMicSession = null;
    }

    public void onStartJoinRtcChannel() {
        C20710sH r4 = new C20710sH(getSession());
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r4.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public <T> void unsubscribeCreateChannelMsg() {
        Map<Class<?>, List<LsD<THu, C20660sC<TFn>, 2Pr>>> map = this.mCreateMeChannelMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        if (map.containsKey(TFn.class)) {
            Map<Class<?>, List<LsD<THu, C20660sC<TFn>, 2Pr>>> map2 = this.mCreateMeChannelMessageHandlers;
            if (map2 == null) {
                n.LIZ("");
            }
            List list = map2.get(TFn.class);
            if (list != null) {
                list.clear();
            }
        }
    }

    public void onLayoutWindowUpdate(TCa tCa) {
        M12.LIZ(tCa);
        C20620s8.LIZ(tCa);
    }

    public void onNeedJoinChannel(TFq tFq) {
        M12.LIZ(tFq);
        C20620s8.LIZ(tFq);
    }

    public void onPreLayoutSwitch(TCa tCa) {
        M12.LIZ(tCa);
        C20620s8.LIZIZ(tCa);
    }

    public void onReceivedSei(String str) {
        M12.LIZ(str);
        C20620s8.LIZIZ(str);
    }

    public void hookJoinChannel(Ls2<Boolean> ls2) {
        M12.LIZ(ls2);
        getSession().hookJoinChannel(ls2);
    }

    public void sendSeiToSDK(String str) {
        TIo tIo = this.mLinkMicManager;
        if (tIo == null) {
            n.LIZ("");
        }
        tIo.LIZ(str);
    }

    public void updateLayoutParam(String str) {
        M12.LIZ(str);
        getSession().updateLayoutParam(str);
    }

    public void onStartPushStream(THu tHu) {
        M12.LIZ(tHu);
        C20790sP r4 = new C20790sP(tHu);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(C20790sP.class);
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public void onTurnOffEngine(String str) {
        M12.LIZ(str);
        C20800sQ r4 = new C20800sQ(str);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(C20800sQ.class);
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public void updateLiveConfig(TIB tib) {
        M12.LIZ(tib);
        TIB tib2 = this.mLiveConfig;
        if (tib2 == null) {
            n.LIZ("");
        }
        if (!n.LIZ(tib, tib2)) {
            this.mLiveConfig = tib;
            getSession().rtcManager().LIZ(tib);
        }
    }

    private final void subscribeCreateChannel(LsD<? super THu, ? super C20660sC<TFn>, 2Pr> lsD) {
        Map<Class<?>, List<LsD<THu, C20660sC<TFn>, 2Pr>>> map = this.mCreateMeChannelMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        if (!map.containsKey(TFn.class)) {
            Map<Class<?>, List<LsD<THu, C20660sC<TFn>, 2Pr>>> map2 = this.mCreateMeChannelMessageHandlers;
            if (map2 == null) {
                n.LIZ("");
            }
            map2.put(TFn.class, new ArrayList());
        }
        if (Ls0.LIZ(lsD, 2) && lsD != null) {
            Map<Class<?>, List<LsD<THu, C20660sC<TFn>, 2Pr>>> map3 = this.mCreateMeChannelMessageHandlers;
            if (map3 == null) {
                n.LIZ("");
            }
            List list = map3.get(TFn.class);
            if (list != null) {
                list.add(lsD);
            }
        }
    }

    public final void initLinkMicSession(Context context) {
        boolean z;
        String str;
        getSession().addLinkMicEventListener(this);
        getSession().layoutManager().LIZ(this);
        Room room = this.mRoom;
        if (room == null) {
            n.LIZ("");
        }
        long ownerUserId = room.getOwnerUserId();
        Glh LIZIZ = H7d.LIZ().LIZIZ();
        n.LIZIZ(LIZIZ, "");
        if (ownerUserId == LIZIZ.LIZJ()) {
            z = true;
        } else {
            z = false;
        }
        TIX tix = new TIX();
        Room room2 = this.mRoom;
        if (room2 == null) {
            n.LIZ("");
        }
        StreamUrl streamUrl = room2.getStreamUrl();
        if (streamUrl != null) {
            str = streamUrl.LIZ();
        } else {
            str = null;
        }
        tix.LIZ = str;
        tix.LIZIZ = null;
        this.mLiveConfig = new TIB(z, tix.LIZ(), new AnonymousClass1X1(), false, (Ls2) null, 56);
        TIv rtcManager = getSession().rtcManager();
        TIB tib = this.mLiveConfig;
        if (tib == null) {
            n.LIZ("");
        }
        rtcManager.LIZ(tib);
    }

    public void apply(MVA mva, TIZ<7Vl> tiz) {
        M12.LIZ(mva);
        getSession().apply(mva, tiz);
    }

    public void cancelApply(MOw mOw, TIZ<7Vm> tiz) {
        M12.LIZ(mOw);
        getSession().cancelApply(mOw, tiz);
    }

    public void cancelInvite(MOx mOx, TIZ<7Vn> tiz) {
        M12.LIZ(mOx);
        getSession().cancelInvite(mOx, tiz);
    }

    public void changeMaxPosition(2Mj r2, TIZ<7Vg> tiz) {
        M12.LIZ(r2);
        getSession().changeMaxPosition(r2, tiz);
    }

    public void createChannel(2O1 r3, TIZ<7Vo> tiz) {
        M12.LIZ(r3);
        getSession().createChannel(r3, new C34071Wz(tiz));
    }

    public void destroyChannel(TIx tIx, TIZ<7Vh> tiz) {
        M12.LIZ(tIx);
        getSession().destroyChannel(tIx, tiz);
    }

    public void invite(TI4 ti4, TIZ<7Vj> tiz) {
        M12.LIZ(ti4);
        getSession().invite(ti4, tiz);
    }

    public void joinChannel(2J8 r2, TIZ<7Ve> tiz) {
        M12.LIZ(r2);
        getSession().joinChannel(r2, tiz);
    }

    public void kickOut(MLi mLi, TIZ<7Vf> tiz) {
        M12.LIZ(mLi);
        getSession().kickOut(mLi, tiz);
    }

    public void leaveChannel(MOo mOo, TIZ<7Vk> tiz) {
        M12.LIZ(mOo);
        getSession().leaveChannel(mOo, tiz);
    }

    public void permitApply(TI5 ti5, TIZ<TD5> tiz) {
        M12.LIZ(ti5);
        getSession().permitApply(ti5, tiz);
    }

    public void joinDirect(2O2 r3, TIZ<7Vi> tiz) {
        M12.LIZ(r3);
        Object LIZ = C41491kh.LIZ.LIZ("MULTI_GUEST_DATA_HOLDER");
        if (!(LIZ instanceof C33641Vi)) {
            LIZ = null;
        }
        C33641Vi r1 = (C33641Vi) LIZ;
        if (r1 != null) {
            r1.LJJIJLIJ = "join_direct";
        }
        getSession().joinDirect(r3, tiz);
    }

    public void onApplyMessageReceived(THu tHu, TFk tFk) {
        M12.LIZ(tHu, tFk);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tFk.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tFk));
            }
        }
    }

    public void onCancelApplyMessageReceived(THu tHu, TFl tFl) {
        M12.LIZ(tHu, tFl);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tFl.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tFl));
            }
        }
    }

    public void onCancelInviteMessageReceived(THu tHu, TFm tFm) {
        M12.LIZ(tHu, tFm);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tFm.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tFm));
            }
        }
    }

    public void onDestroyChannelMessageReceived(THu tHu, TFo tFo) {
        M12.LIZ(tHu, tFo);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tFo.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tFo));
            }
        }
        release();
    }

    public void onFirstRemoteAudio(THu tHu, TEK tek) {
        M12.LIZ(tHu, tek);
        C20630s9 r3 = new C20630s9(tek);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r3.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void onFirstRemoteVideoFrame(THu tHu, TEK tek) {
        M12.LIZ(tHu, tek);
        C20640sA r3 = new C20640sA(tek);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r3.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void onFirstRemoteVideoFrameRender(THu tHu, TEK tek) {
        M12.LIZ(tHu, tek);
        C20650sB r3 = new C20650sB(tek);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r3.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void onInviteMessageReceived(THu tHu, TD3 td3) {
        M12.LIZ(tHu, td3);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(td3.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(td3));
            }
        }
    }

    public void onJoinChannelMessageReceived(THu tHu, TFh tFh) {
        M12.LIZ(tHu, tFh);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tFh.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tFh));
            }
        }
    }

    public void onJoinDirectMessageReceived(THu tHu, TFi tFi) {
        M12.LIZ(tHu, tFi);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tFi.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tFi));
            }
        }
    }

    public void onKickOutMessageReceived(THu tHu, TDA tda) {
        M12.LIZ(tHu, tda);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tda.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tda));
            }
        }
    }

    public void onLeaveMessageReceived(THu tHu, TFj tFj) {
        M12.LIZ(tHu, tFj);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tFj.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tFj));
            }
        }
    }

    public void onLinkMicStateChanged(THu tHu, int i) {
        M12.LIZ(tHu);
        C20680sE r3 = new C20680sE(i);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r3.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void onReplyInviteMessageReceived(THu tHu, TFr tFr) {
        M12.LIZ(tHu, tFr);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tFr.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tFr));
            }
        }
    }

    public void onRoomMsgSentResult(long j, int i) {
        C20750sL r4 = new C20750sL(j, i);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(C20750sL.class);
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public void onRtcError(THu tHu, TE5 te5) {
        M12.LIZ(tHu, te5);
        C20730sJ r4 = new C20730sJ(te5);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(C20730sJ.class);
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public void onRtcInit(THu tHu, TIB tib) {
        M12.LIZ(tHu);
        C20690sF r3 = new C20690sF(tib);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r3.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void onRtcStartResult(THu tHu, IOW iow) {
        M12.LIZ(tHu, iow);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(iow.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(iow));
            }
        }
    }

    public void onSendRtcRoomMessage(THu tHu, String str) {
        M12.LIZ(tHu, str);
        C20780sO r4 = new C20780sO(str);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(C20780sO.class);
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public void onUserLeft(String str, long j) {
        M12.LIZ(str);
        C20820sS r4 = new C20820sS(str, j);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(C20820sS.class);
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public void replyInvite(K0R k0r, TIZ<TD6> tiz) {
        M12.LIZ(k0r);
        if (k0r.LIZJ == 1) {
            Object LIZ = C41491kh.LIZ.LIZ("MULTI_GUEST_DATA_HOLDER");
            if (!(LIZ instanceof C33641Vi)) {
                LIZ = null;
            }
            C33641Vi r1 = (C33641Vi) LIZ;
            if (r1 != null) {
                r1.LJJIJLIJ = "invite";
            }
        }
        getSession().replyInvite(k0r, tiz);
    }

    public <T> IMultiGuestV3InternalService unsubscribe(Class<T> cls, LsD<? super THu, ? super C20660sC<T>, 2Pr> lsD) {
        M12.LIZ(cls, lsD);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List list = map.get(cls);
        if (list != null) {
            Objects.requireNonNull(list, "null cannot be cast to non-null type kotlin.collections.MutableCollection<T>");
            Ls0.LIZIZ(list).remove(lsD);
        }
        return this;
    }

    public void onCreateChannelMessageReceived(THu tHu, TFn tFn) {
        M12.LIZ(tHu, tFn);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(tFn.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(tFn));
            }
        }
        Map<Class<?>, List<LsD<THu, C20660sC<TFn>, 2Pr>>> map2 = this.mCreateMeChannelMessageHandlers;
        if (map2 == null) {
            n.LIZ("");
        }
        List<LsD> list2 = map2.get(tFn.getClass());
        if (list2 != null) {
            for (LsD invoke2 : list2) {
                invoke2.invoke(tHu, new C20660sC(tFn));
            }
        }
    }

    public void onLayoutSwitch(TCa tCa, int i) {
        M12.LIZ(tCa);
        C20670sD r4 = new C20670sD(tCa, i);
        Object LIZ = C41491kh.LIZ.LIZ("MULTI_GUEST_DATA_HOLDER");
        if (!(LIZ instanceof C33641Vi)) {
            LIZ = null;
        }
        C33641Vi r2 = (C33641Vi) LIZ;
        if (r2 != null) {
            C20260rY LIZ2 = C20260rY.LIZJ.LIZ();
            M12.LIZ(tCa);
            r2.LIZIZ(LIZ2.LIZ(LIZ2.LIZ(tCa)));
        }
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r4.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public void onPermitApplyMessageReceived(THu tHu, TD4 td4) {
        M12.LIZ(tHu, td4);
        if (td4.LIZIZ == 1) {
            Object LIZ = C41491kh.LIZ.LIZ("MULTI_GUEST_DATA_HOLDER");
            if (!(LIZ instanceof C33641Vi)) {
                LIZ = null;
            }
            C33641Vi r1 = (C33641Vi) LIZ;
            if (r1 != null) {
                r1.LJJIJLIJ = "apply";
            }
        }
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(td4.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(td4));
            }
        }
    }

    public <T> IMultiGuestV3InternalService subscribe(Class<T> cls, LsD<? super THu, ? super C20660sC<T>, 2Pr> lsD) {
        M12.LIZ(cls, lsD);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        if (!map.containsKey(cls)) {
            Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map2 = this.mLinkMicMessageHandlers;
            if (map2 == null) {
                n.LIZ("");
            }
            map2.put(cls, new ArrayList());
        }
        if (Ls0.LIZ(lsD, 2) && lsD != null) {
            Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map3 = this.mLinkMicMessageHandlers;
            if (map3 == null) {
                n.LIZ("");
            }
            List list = map3.get(cls);
            if (list != null) {
                list.add(lsD);
            }
        }
        if (n.LIZ(cls, TFn.class) && Ls0.LIZ(lsD, 2) && lsD != null) {
            subscribeCreateChannel(lsD);
        }
        return this;
    }

    public void onAudioMute(long j, String str, boolean z) {
        M12.LIZ(str);
        C20620s8.LIZ(str);
    }

    public void onVideoMute(long j, String str, boolean z) {
        M12.LIZ(str);
        C20620s8.LIZJ(str);
    }

    public void onRemoteMute(boolean z, String str, boolean z2) {
        M12.LIZ(str);
        C20700sG r4 = new C20700sG(z, str, z2);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(C20700sG.class);
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public void onRoomMsgReceived(THu tHu, String str, String str2) {
        M12.LIZ(tHu, str, str2);
        C20740sK r3 = new C20740sK(str, str2);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(C20740sK.class);
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void onRtcEndResult(THu tHu, boolean z, TE5 te5) {
        M12.LIZ(tHu);
        C20720sI r3 = new C20720sI(z, te5);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r3.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void onUserJoined(THu tHu, TEK tek, TDz tDz) {
        M12.LIZ(tHu, tek);
        String str = tek.LIZLLL;
        if (str == null) {
            str = "";
        }
        C20810sR r3 = new C20810sR(str);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r3.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void onUserMsgReceived(THu tHu, String str, String str2) {
        M12.LIZ(tHu, str, str2);
        C20770sN r3 = new C20770sN(str, str2);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(C20770sN.class);
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void init(Room room, String str, Context context) {
        M12.LIZ(room);
        if (context != null) {
            this.mRoom = room;
            this.mLinkMicMessageHandlers = new HashMap();
            this.mCreateMeChannelMessageHandlers = new ArrayMap();
            ILinkMicService LIZ = C11100cm.LIZ(ILinkMicService.class);
            n.LIZIZ(LIZ, "");
            ILinkMicService iLinkMicService = LIZ;
            this.mLinkMicService = iLinkMicService;
            if (iLinkMicService == null) {
                n.LIZ("");
            }
            8dp builder = iLinkMicService.builder();
            if (builder != null) {
                builder.LIZ(room);
                builder.LIZ(LiveAnchorOneVnSetting.INSTANCE.getValue());
                TIo LIZ2 = builder.LIZ(context);
                this.mLinkMicManager = LIZ2;
                this.isAttached = true;
                if (LIZ2 == null) {
                    n.LIZ("");
                }
                this.mLinkMicSession = LIZ2.LIZ(4, str);
                initLinkMicSession(context);
                TIo tIo = this.mLinkMicManager;
                if (tIo == null) {
                    n.LIZ("");
                }
                tIo.LIZ(new AnonymousClass1X0(this, context));
            }
        }
    }

    public void onTalkStateUpdated(String[] strArr, boolean[] zArr, int[] iArr) {
        List list;
        List list2;
        List list3 = null;
        if (strArr != null) {
            list = LeY.LJIIJ(strArr);
        } else {
            list = null;
        }
        if (zArr != null) {
            M12.LIZ(zArr);
            int length = zArr.length;
            if (length == 0) {
                list2 = Lel.INSTANCE;
            } else if (length != 1) {
                list2 = LeY.LIZ(zArr);
            } else {
                list2 = 6iy.LIZ(Boolean.valueOf(zArr[0]));
            }
        } else {
            list2 = null;
        }
        if (iArr != null) {
            list3 = LeY.LIZLLL(iArr);
        }
        C20760sM r4 = new C20760sM(list, list2, list3);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list4 = map.get(r4.getClass());
        if (list4 != null) {
            for (LsD invoke : list4) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }

    public void onUserListChanged(THu tHu, List<TEK> list, List<TEK> list2, List<TEK> list3, String str) {
        M12.LIZ(tHu, list, list2, list3);
        C20830sT r3 = new C20830sT(list, list2, list3);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list4 = map.get(r3.getClass());
        if (list4 != null) {
            for (LsD invoke : list4) {
                invoke.invoke(tHu, new C20660sC(r3));
            }
        }
    }

    public void onWindowStateChanged(TCh tCh, TC2 tc2, TC2 tc22, MMF mmf, 2K3 r10) {
        M12.LIZ(tCh, tc2, tc22, mmf);
        C20840sU r4 = new C20840sU(tCh, tc2, tc22, mmf);
        Map<Class<?>, List<LsD<THu, C20660sC<?>, 2Pr>>> map = this.mLinkMicMessageHandlers;
        if (map == null) {
            n.LIZ("");
        }
        List<LsD> list = map.get(r4.getClass());
        if (list != null) {
            for (LsD invoke : list) {
                invoke.invoke(getSession(), new C20660sC(r4));
            }
        }
    }
}
