// Metro module 15937 (f15938).
import { useCallback, memo } from "react";
import EmbeddedActivitiesStore from "../../../activities/EmbeddedActivitiesStore";
import ChannelRTCStore from "../../../calls/ChannelRTCStore";
import ChannelCallLifecycleStore from "../../../video_calls/native/ChannelCallLifecycleStore";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../stores/ChannelStore";
import MediaEngineStore from "../../../../stores/MediaEngineStore";
import PermissionStore from "../../../../stores/PermissionStore";
import UserStore from "../../../../stores/UserStore";
import SortedVoiceStateStore from "../../../../stores/views/SortedVoiceStateStore";
import { AnalyticsSections, Permissions, RPC_APPLICATION_LOGGING_CATEGORY } from "../../../../Constants";
import { isStreamParticipant } from "../../../calls/CallConstants";
import { SECURE_FRAMES_CALL_VERIFICATION_BOTTOM_SHEET_KEY } from "../../../rtc/SecureFramesConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores, useStateFromStoresArray } from "../../../../_bundle/Module589";
import getChannelInfoSubtitle from "../utils/getChannelInfoSubtitle";
import useChannelName from "../../../channel/useChannelName";
import { useIsSecureFramesUIEnabled } from "../../../rtc/hooks/useIsSecureFramesUIEnabled";
import { useIsCallSecureFramesVerified } from "../../../rtc/hooks/useIsSecureFramesVerified";
import NativeView from "../../../core/native/NativeView";
import { Text } from "../../../../design/components/Text/native/Text";
import { ShieldLockIcon } from "../../../../design/components/Icon/native/redesign/generated/ShieldLockIcon";
import { intl, t } from "../../../../intl/index.native";
import { LockIcon } from "../../../../design/components/Icon/native/redesign/generated/LockIcon";
import { stringify } from "../../../debug/LogAggregator";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import { closeVoicePanelSettingsActionSheet } from "./VoicePanelSettingsActionCreators";
import { showShareActionSheet } from "../../../action_sheet/native/showShareActionSheet";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import { TableRowIcon } from "../../../../design/components/TableRow/native/TableRowIcon.native";
import { WrenchIcon } from "../../../../design/components/Icon/native/redesign/generated/WrenchIcon";
import Module7690 from "../../../../_bundle/Module7690";
import { TableRowArrow } from "../../../../design/components/TableRow/native/TableRowArrow.native";
import Dispatcher from "../../../../Dispatcher";
import { TableSwitchRow } from "../../../../design/components/TableRow/native/TableSwitchRow.native";
import { DeveloperMode } from "../../../user_settings/UserSettings";
import AudioActionCreators from "../../../../actions/AudioActionCreators";
import ChannelRTCActionCreators from "../../../../actions/ChannelRTCActionCreators";
import ChannelSettingsActionCreators from "../../../../actions/ChannelSettingsActionCreators";
import { showVoiceSettingsActionSheet } from "../../../video_calls/native/components/ChannelCallConnectingScreen";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import SecureFramesPlatformUtils_native from "../../../rtc/SecureFramesPlatformUtils.native";
import { useIsCallRTCConnectionEmpty, useIsStreamRTCConnectionEmpty } from "../../../rtc/hooks/useIsEmptyRTCConnection";
import useCanSetVoiceChannelStatus from "../../../calls/useCanSetVoiceChannelStatus";
import { useCanInviteMembers } from "../hooks/useCanInviteMembers";
import { useInviteMembersCallback } from "../hooks/useInviteMembersCallback";
import useShowChannelOptInNotice from "../../../opt_in_channels/useShowChannelOptInNotice";
import { VoicePanelFormSection, MemberRowItem } from "../shared/FormComponents";
import VoicePanelChannelOptInNotice from "../shared/VoicePanelChannelOptInNotice";
import { SettingsIcon } from "../../../../design/components/Icon/native/redesign/generated/SettingsIcon";
import Module15942 from "../../../../_bundle/Module15942";
import { HeadphonesSlashIcon } from "../../../../design/components/Icon/native/redesign/generated/HeadphonesSlashIcon";
import Module15943 from "../../../../_bundle/Module15943";
import { VideoIcon } from "../../../../design/components/Icon/native/redesign/generated/VideoIcon";
import Module10744 from "../../../../_bundle/Module10744";
import { GroupPlusIcon } from "../../../../design/components/Icon/native/redesign/generated/GroupPlusIcon";
import Module10223 from "../../../../_bundle/Module10223";
let useStyles, ShareActivityLogsButton, ActivityDebugToggle;
const VoicePanelSettingsOverviewHeader = function VoicePanelSettingsOverviewHeader(props) {
const { guildId, channelId } = props;
const styles = useStyles();
const stateFromStores5 = useStateFromStores([SortedVoiceStateStore], () => {
const voiceStatesForChannelAlt = SortedVoiceStateStore.getVoiceStatesForChannelAlt(channelId, guildId);
const r19 = voiceStatesForChannelAlt.slice(0, 2).map((item) => item.user);
return getChannelInfoSubtitle(guildId, channelId, r19, voiceStatesForChannelAlt.length - r19.length);
});
const channelName = useChannelName(useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId), [channelId]));
let r39 = useIsSecureFramesUIEnabled({
channelId
});
let r13 = useIsCallSecureFramesVerified({
channelId
});
const r57 = [{channelName}, ,];
if (r13) {
r13 = ;
}
r57[1] = r13;
const r71 = [{r57}, {stateFromStores5}, ,];
if (r39) {
r39 =
{intl.string(t["3BogKe"])}
;
}
r71[2] = r39;
return {r71};
};
ShareActivityLogsButton = function ShareActivityLogsButton() {
return {
const message = stringify([RPC_APPLICATION_LOGGING_CATEGORY]);
if (message === "") {
ToastActionCreators.open({
key: "EMBEDDED_ACTIVITIES_SHARE_EMPTY_LOGS_ERROR_MESSAGE",
content: intl.string(t["i+9VWy"])
});
} else {
closeVoicePanelSettingsActionSheet();
showShareActionSheet({
message
}, "Activity Logs");
}
}, [])} icon={} label={intl.string(t.iQzQs3)} trailing={} />;
};
ActivityDebugToggle = function ActivityDebugToggle() {
const stateFromStores5 = useStateFromStores([ChannelCallLifecycleStore], () => ChannelCallLifecycleStore.getShowActivitiesDebugOverlay());
const callback = useCallback((a0) => {
Dispatcher.dispatch({
type: "EMBEDDED_ACTIVITY_SET_DEBUG_OVERLAY_VISIBILITY",
visible: a0
});
}, []);
return } accessibilityHint={intl.string(t["qv5/SP"])} value={stateFromStores5} onValueChange={callback} label={intl.string(t["qv5/SP"])} />;
};
useStyles = createStyles({
headerContainer: {
alignItems: "center"
},
channelTitleWrapper: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
marginTop: 8
},
channelTitle: {
textAlign: "center"
},
channelSubtitle: {
marginTop: 4,
marginHorizontal: 16,
textAlign: "center"
},
secureFrames: {
flexDirection: "row",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.sm,
marginTop: 8,
padding: 4,
gap: 4
},
secureFramesIcon: {
marginStart: 4
}
});
const r73 = memo(function VoicePanelSettingsOverview(props) {
let stateFromStores2, stateFromStores3, stateFromStores4, isSecureFramesUIEnabled;
const { guildId: guildId2, channelId: channelId2 } = props;
stateFromStores2 = void 0;
stateFromStores3 = void 0;
stateFromStores4 = void 0;
isSecureFramesUIEnabled = void 0;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId2));
const setting = DeveloperMode.useSetting();
stateFromStores2 = useStateFromStores([SortedVoiceStateStore], () => SortedVoiceStateStore.getVoiceStatesForChannelAlt(channelId2, guildId2));
const stateFromStoresArray = useStateFromStoresArray([UserStore], () => {
if (stateFromStores != null && stateFromStores.isPrivate()) {
const set = new Set(stateFromStores2.map((item) => item.user.id));
const r30 = [];
for (const recipient of stateFromStores.recipients) {
const user = UserStore.getUser(recipient);
if (!(user == null || set.has(recipient))) {
r30.push(user);
}
}
return r30;
}
return [];
}, [stateFromStores, stateFromStores2]);
const stateFromStores6 = useStateFromStores([MediaEngineStore], () => MediaEngineStore.isSelfDeaf());
const callback5 = useCallback(() => {
AudioActionCreators.toggleSelfDeaf();
}, []);
stateFromStores3 = useStateFromStores([ChannelRTCStore], () => ChannelRTCStore.getVoiceParticipantsHidden(channelId2));
stateFromStores4 = useStateFromStores([ChannelRTCStore, AuthenticationStore], () => {
const selectedParticipant = ChannelRTCStore.getSelectedParticipant(channelId2);
return isStreamParticipant(selectedParticipant) ? selectedParticipant.stream.ownerId !== AuthenticationStore.getId() ? selectedParticipant.id : null : null;
});
const callback4 = useCallback(() => {
ChannelRTCActionCreators.toggleVoiceParticipantsHidden(channelId2, !stateFromStores3);
}, [channelId2, stateFromStores3]);
const callback6 = useCallback(() => {
closeVoicePanelSettingsActionSheet();
ChannelSettingsActionCreators.open(channelId2);
}, [channelId2]);
const callback2 = useCallback(() => {
closeVoicePanelSettingsActionSheet();
showVoiceSettingsActionSheet(guildId2);
}, [guildId2]);
const callback3 = useCallback(() => {
ActionSheetActionCreators.openLazy(import("../../../rtc/native/SecureFramesCallVerificationBottomSheet"), SECURE_FRAMES_CALL_VERIFICATION_BOTTOM_SHEET_KEY, {
channelId: channelId2
});
}, [channelId2]);
const callback = useCallback(() => {
if (stateFromStores4 != null) {
SecureFramesPlatformUtils_native.openSecureFramesStreamVerification(stateFromStores4, channelId2);
}
}, [channelId2, stateFromStores4]);
const isCallRTCConnectionEmpty = useIsCallRTCConnectionEmpty();
const isStreamRTCConnectionEmpty = useIsStreamRTCConnectionEmpty(stateFromStores4);
const stateFromStores7 = useStateFromStores([EmbeddedActivitiesStore], () => EmbeddedActivitiesStore.getCurrentEmbeddedActivity() != null, []);
const canSetVoiceChannelStatus = useCanSetVoiceChannelStatus(stateFromStores);
const stateFromStores5 = useStateFromStores([PermissionStore], () => PermissionStore.canWithPartialContext(Permissions.MANAGE_CHANNELS, {
channelId: channelId2
}), [channelId2]);
const canInviteMembers = useCanInviteMembers(channelId2);
const inviteMembersCallback = useInviteMembersCallback(channelId2);
const showChannelOptInNotice = useShowChannelOptInNotice(stateFromStores);
let r18 = useIsSecureFramesUIEnabled({
channelId: channelId2
});
isSecureFramesUIEnabled = r18;
const r135 = [, showChannelOptInNotice ?
: null, (stateFromStores5 ? stateFromStores5 : canSetVoiceChannelStatus) &&
{stateFromStores5 && } />}
, , , ,];
const r220 = [} label={intl.string(t.NiTd0e)} subLabel={intl.string(t["16SG+O"])} trailing={} />, } accessibilityHint={intl.string(t.wjcRFX)} value={stateFromStores6} onValueChange={callback5} label={intl.string(t.wjcRFX)} subLabel={intl.string(t.M3VN2U)} />, } accessibilityHint={intl.string(t.ZMTRyc)} value={stateFromStores3} onValueChange={callback4} label={intl.string(t.ZMTRyc)} subLabel={intl.string(t.MlpCFS)} />, (isSecureFramesUIEnabled ? stateFromStores4 == null : isSecureFramesUIEnabled) && !isCallRTCConnectionEmpty && } label={intl.string(t.cTQI5t)} subLabel={intl.string(t.Etxti2)} trailing={} />, ,];
if (isSecureFramesUIEnabled) {
r18 = stateFromStores4 != null;
}
if (r18) {
r18 = !isStreamRTCConnectionEmpty;
}
if (r18) {
r18 = } label={intl.string(t.QogHld)} subLabel={intl.string(t["j5+1ed"])} trailing={} />;
}
r220[4] = r18;
r135[3] = {r220};
r135[4] = (stateFromStores2.length > 0 || canInviteMembers) &&
{canInviteMembers ? } label={intl.string(t["f1+QIK"])} trailing={} /> : null}
{stateFromStores2.map((item) => {
let nick = item.nick;
if (nick == null) {
nick = void 0;
}
return ;
})}
{stateFromStoresArray.map((item) => )}
;
r135[5] = setting ?
{stateFromStores7 ? : null}
: null;
return <>{r135}>;
});
export default r73;
export { VoicePanelSettingsOverviewHeader };