// Metro module 15926 (f15927). import * as Module19 from "react"; import { useContext, useLayoutEffect, useState, useCallback, useMemo } from "react"; import { StyleSheet, Platform } from "react-native"; import ChannelRTCStore from "../../../calls/ChannelRTCStore"; import ExperimentStore from "../../../experiments/ExperimentStore"; import StageMusicStore from "../../../stage_channels/StageMusicStore"; import AuthenticationStore from "../../../../stores/AuthenticationStore"; import ChannelStore from "../../../../stores/ChannelStore"; import MediaEngineStore from "../../../../stores/MediaEngineStore"; import RelationshipStore from "../../../../stores/RelationshipStore"; import SpeakingStore from "../../../../stores/SpeakingStore"; import UserStore from "../../../../stores/UserStore"; import { DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE, MODE_CHANGE_PHYSICS, UI_SHOW_HIDE_PHYSICS, VoicePanelModes } from "../../VoicePanelConstants"; import { EDGE_GUTTER } from "../card/VoicePanelCardConstants"; import { VoicePanelControlsModes } from "../controls/VoicePanelControlsConstants"; import { ParticipantTypes } from "../../../calls/CallConstants"; import { ThemeTypes } from "../../../../_bundle/Module505"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import Module712 from "../../../../_bundle/Module712"; import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport"; import { useDerivedValue, useAnimatedProps, useAnimatedStyle, useSharedValue, useAnimatedReaction } from "../../../reanimated/ReanimatedRexport"; import * as _spring from "../../../../design/animation/reanimated/spring/spring"; import ReanimatedNativeView from "../../../core/native/ReanimatedNativeView"; import VisualEffectViewAnimated from "../../../visual_effect_view/native/VisualEffectViewAnimated"; import NativeView from "../../../core/native/NativeView"; import VoicePanelStateContext from "../VoicePanelStateContext"; import useMyCurrentStageChannelRole from "../../../stage_channels/useMyCurrentStageChannelRole"; import { useStateFromStores } from "../../../../_bundle/Module589"; import { useShowStageMusicMuteButton } from "../../../stage_channels/StageMusicManager"; import VoicePanelIconButton from "../shared/VoicePanelIconButton"; import { intl, t } from "../../../../intl/index.native"; import Module10708 from "../../../../_bundle/Module10708"; import Module9075 from "../../../../_bundle/Module9075"; import { updateStageMusicMuted } from "../../../stage_channels/StageMusicActionCreators"; import { useIsScreenReaderEnabled } from "../../../a11y/native/useIsScreenReaderEnabled.native"; import useIsConnectedToVoiceChannel from "../hooks/useIsConnectedToVoiceChannel"; import MobileGoLiveEntrypointExperiment, { MobileGoLiveEntrypointTreatment } from "../../../go_live/MobileGoLiveEntrypointExperiment"; import { computeChannelName } from "../../../channel/useChannelName"; import { useToken } from "../../../../design/tokens/native/useToken"; import calculateVoicePanelHeaderSpecs from "./calculateVoicePanelHeaderSpecs"; import * as _timing from "../../../../design/animation/reanimated/timing/timing"; import { useCanInviteMembers } from "../hooks/useCanInviteMembers"; import { useInviteMembersCallback } from "../hooks/useInviteMembersCallback"; import useVoicePanelNavArrowPressed from "../hooks/useVoicePanelNavArrowPressed"; import { useNavigatorBackPressHandler } from "../../../../design/components/Navigator/native/useNavigatorBackPressHandler.native"; import useStableParticipant, { isStableUserParticipant, stableParticipantHasVideo } from "../utils/useStableParticipant"; import AudioActionCreators from "../../../../actions/AudioActionCreators"; import { useIsSecureFramesUIEnabled } from "../../../rtc/hooks/useIsSecureFramesUIEnabled"; import { useIsUserSecureFramesVerified, useIsStreamSecureFramesVerified } from "../../../rtc/hooks/useIsSecureFramesVerified"; import { ThemeContextProvider } from "../../../../_bundle/Module3901"; import ThemedHeaderBackgroundGradient from "../../../main_tabs_v2/native/panels/ThemedHeaderBackgroundGradient"; import VoicePanelHeaderUserState from "./VoicePanelHeaderUserState"; import Module8393 from "../../../../_bundle/Module8393"; import VoicePanelTitleButton from "../shared/VoicePanelTitleButton"; import { ShieldLockIcon } from "../../../../design/components/Icon/native/redesign/generated/ShieldLockIcon"; import { ChannelTypes } from "../../../../_bundle/Module692"; import VoicePanelHeaderSpeaker from "./VoicePanelHeaderSpeaker"; import Module10223 from "../../../../_bundle/Module10223"; import Module15954 from "../../../../_bundle/Module15954"; import VoicePanelHeaderChatButton from "./VoicePanelHeaderChatButton"; let OPACITY_TIMING, useStyles, c11409_27, HEADER_CHANGE_PHYSICS, __initData, __initData2, __initData3, Component, __initData4, __initData5, Component2, __initData6, __initData7, __initData8, __initData9, __initData10, __initData11, __initData12; const MusicMuteButton = function MusicMuteButton(props) { const channelId2 = props.channelId; const speaker = useMyCurrentStageChannelRole(channelId2)?.speaker; const stateFromStores = useStateFromStores([StageMusicStore], () => StageMusicStore.isMuted()); return useShowStageMusicMuteButton(channelId2) ? speaker ? updateStageMusicMuted(!stateFromStores)} /> : null : null; }; Platform; OPACITY_TIMING = { duration: 300 }; useStyles = createStyles({ headerWrapper: { zIndex: 1, position: "absolute", top: 0, left: 0, width: "100%", paddingBottom: EDGE_GUTTER, overflow: "hidden" }, blurStyles: { ...StyleSheet.absoluteFillObject, opacity: 0.7 }, leftWrapper: { position: "relative", justifyContent: "flex-start", flexDirection: "row", alignItems: "center", flexShrink: 1, gap: 12 }, rightWrapper: { flexDirection: "row", alignItems: "center", gap: 12, paddingLeft: 12 }, headerOuter: { flexDirection: "row", alignItems: "center" }, headerInner: { flexDirection: "row", alignItems: "center", flexShrink: 1, flexGrow: 1 }, headerContentWrapper: { position: "relative" }, stroke: { height: StyleSheet.hairlineWidth, opacity: 0.2 }, strokeAlt: { height: StyleSheet.hairlineWidth, opacity: 0.8 }, strokeContainer: { position: "absolute", left: 0, right: 0, bottom: 0, height: StyleSheet.hairlineWidth }, focusedSpeakingDotWrapper: { width: 12, height: 12, borderRadius: Module712.radii.round, padding: 2 }, focusedSpeakingDot: { width: 8, height: 8, borderRadius: Module712.radii.round }, shieldIconMargin: { marginLeft: -8 } }); c11409_27 = { DOWN: 0, 0: "DOWN", LEFT: 1, 1: "LEFT" }; HEADER_CHANGE_PHYSICS = { ...MODE_CHANGE_PHYSICS, overshootClamping: true }; __initData = { code: "function VoicePanelHeaderTsx1(){const{isHeaderHidden,focused,scrollPosition}=this.__closure;return!isHeaderHidden.get()&&(focused.get()!=null||scrollPosition.get()>0);}" }; __initData2 = { code: "function VoicePanelHeaderTsx2(){const{withSpring,showHeaderBlur}=this.__closure;return{blurAmount:withSpring(showHeaderBlur.get()?0.3:0)};}" }; __initData3 = { code: "function VoicePanelHeaderTsx3(){const{withSpring,showHeaderBlur,HEADER_CHANGE_PHYSICS}=this.__closure;return{opacity:withSpring(showHeaderBlur.get()?1:0,HEADER_CHANGE_PHYSICS)};}" }; Component = Module19.memo(function({ isHeaderHidden, scrollPosition, focused }) { let derivedValue; derivedValue = void 0; const styles = useStyles(); const l = function l() { const r7 = isHeaderHidden.get(); return r7 ? !r7 : focused.get() != null || scrollPosition.get() > 0; }; l.__closure = { isHeaderHidden, focused, scrollPosition }; l.__workletHash = 8127245112238; l.__initData = __initData; derivedValue = useDerivedValue(l); const c = () => ({ blurAmount: _spring.withSpring(derivedValue.get() ? 0.3 : 0) }); c.__closure = { withSpring: _spring.withSpring, showHeaderBlur: derivedValue }; c.__workletHash = 10074943135400; c.__initData = __initData2; const animatedProps = useAnimatedProps(c); const r34 = () => ({ opacity: _spring.withSpring(derivedValue.get() ? 1 : 0, HEADER_CHANGE_PHYSICS) }); r34.__closure = { withSpring: _spring.withSpring, showHeaderBlur: derivedValue, HEADER_CHANGE_PHYSICS }; r34.__workletHash = 2825977044105; r34.__initData = __initData3; return ; }); __initData4 = { code: "function VoicePanelHeaderTsx4(){const{focused,controlsSpecs,VoicePanelControlsModes,speaking}=this.__closure;return focused.get()!=null&&controlsSpecs.get().mode!==VoicePanelControlsModes.HIDDEN&&speaking.get();}" }; __initData5 = { code: "function VoicePanelHeaderTsx5(){const{showSpeakingIndicator}=this.__closure;return{opacity:showSpeakingIndicator.get()?1:0};}" }; Component2 = Module19.memo(function() { let derivedValue2; const id = AuthenticationStore.getId(); const context = useContext(VoicePanelStateContext); const { focused: focused2, controlsSpecs } = context; const sharedValue = useSharedValue(SpeakingStore.isSpeaking(id)); useLayoutEffect(() => { const handleChange2 = function handleChange() { sharedValue.set(SpeakingStore.isSpeaking(id)); }; sharedValue.set(SpeakingStore.isSpeaking(id)); SpeakingStore.addReactChangeListener(handleChange2); return () => { SpeakingStore.removeReactChangeListener(handleChange2); }; }, [id, sharedValue]); const styles = useStyles(); const r33 = () => focused2.get() != null && controlsSpecs.get().mode !== VoicePanelControlsModes.HIDDEN && sharedValue.get(); r33.__closure = { focused: focused2, controlsSpecs, VoicePanelControlsModes, speaking: sharedValue }; r33.__workletHash = 5466722752449; r33.__initData = __initData4; derivedValue2 = useDerivedValue(r33); const _ = () => ({ opacity: derivedValue2.get() ? 1 : 0 }); _.__closure = { showSpeakingIndicator: derivedValue2 }; _.__workletHash = 16177124708898; _.__initData = __initData5; return ; }); __initData6 = { code: "function VoicePanelHeaderTsx6(){const{focused}=this.__closure;var _focused$get;return(_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id;}" }; __initData7 = { code: "function VoicePanelHeaderTsx7(manualId,previousManualId){const{runOnJS,handleFocusChange}=this.__closure;if(manualId!==previousManualId){runOnJS(handleFocusChange)(manualId);}}" }; __initData8 = { code: "function VoicePanelHeaderTsx8(){const{calculateVoicePanelHeaderSpecs,safeArea,edgeGutter,mode,VoicePanelModes,gestureState,connected,EDGE_GUTTER}=this.__closure;const specs=calculateVoicePanelHeaderSpecs(safeArea.get(),edgeGutter);if(mode.get()===VoicePanelModes.PIP||gestureState.get().active&&!gestureState.get().requiresPop&&connected.get()||mode.get()===VoicePanelModes.DISMISSED&&connected.get()){return-(specs.height+EDGE_GUTTER);}return 0;}" }; __initData9 = { code: "function VoicePanelHeaderTsx9(){const{calculateVoicePanelHeaderSpecs,safeArea,edgeGutter,mode,VoicePanelModes,connected,EDGE_GUTTER,withTiming,OPACITY_TIMING,withSpring,yOffset,wrapperOffset,DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE,UI_SHOW_HIDE_PHYSICS}=this.__closure;const specs=calculateVoicePanelHeaderSpecs(safeArea.get(),edgeGutter);const pipMode=mode.get()===VoicePanelModes.PIP;const height=!connected.get()?specs.height-specs.paddingTop+EDGE_GUTTER:specs.height;const paddingTop=!connected.get()?EDGE_GUTTER:specs.paddingTop;return{...specs,paddingTop:paddingTop,borderTopLeftRadius:!connected.get()?24:0,borderTopRightRadius:!connected.get()?24:0,height:height,opacity:withTiming(pipMode||mode.get()===VoicePanelModes.DISMISSED?0:1,OPACITY_TIMING),transform:[{translateY:withSpring(yOffset.get(),!connected.get()&&wrapperOffset.get().gestureActive?DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE:UI_SHOW_HIDE_PHYSICS)}]};}" }; __initData10 = { code: "function VoicePanelHeaderTsx10(){const{controlsSpecs,VoicePanelControlsModes,isScreenReaderEnabled}=this.__closure;return controlsSpecs.get().mode===VoicePanelControlsModes.HIDDEN&&!isScreenReaderEnabled;}" }; __initData11 = { code: "function VoicePanelHeaderTsx11(){const{calculateVoicePanelHeaderSpecs,safeArea,edgeGutter,withTiming,isHeaderHidden,OPACITY_TIMING,withSpring,MODE_CHANGE_PHYSICS}=this.__closure;const{height:height}=calculateVoicePanelHeaderSpecs(safeArea.get(),edgeGutter);return{opacity:withTiming(isHeaderHidden.get()?0:1,OPACITY_TIMING),transform:[{translateY:withSpring(isHeaderHidden.get()?-height:0,MODE_CHANGE_PHYSICS)}]};}" }; __initData12 = { code: "function VoicePanelHeaderTsx12(){const{isHeaderHidden}=this.__closure;return{pointerEvents:isHeaderHidden.get()?'none':'box-none',importantForAccessibility:isHeaderHidden.get()?'no-hide-descendants':'auto',accessibilityElementsHidden:isHeaderHidden.get()};}" }; const r127 = Module19.memo(function VoicePanelHeader(props) { let setState, setState2, callback, token, derivedValue3, derivedValue4, LEFT, c22614_16; const { wrapperOffset, gestureState, layout } = props; setState = void 0; setState2 = void 0; callback = void 0; token = void 0; derivedValue3 = void 0; derivedValue4 = void 0; LEFT = void 0; c22614_16 = void 0; const styles = useStyles(); const context = useContext(VoicePanelStateContext); const { guildId, channelId, channelType, focused: focused3, controlsSpecs: controlsSpecs2, mode, safeArea, connected, scrollPosition: scrollPosition2 } = context; const isScreenReaderEnabled = useIsScreenReaderEnabled(); const isConnectedToVoiceChannel = useIsConnectedToVoiceChannel(channelId); const treatment = MobileGoLiveEntrypointExperiment.useConfig({ location: "VoicePanelHeader" }).treatment; const stateFromStores2 = useStateFromStores([UserStore, RelationshipStore, ChannelStore, ExperimentStore], () => { const channel = ChannelStore.getChannel(channelId); let r11 = channel != null ? computeChannelName(channel, UserStore, RelationshipStore) : void 0; if (r11 == null) { r11 = intl.string(t.zLZPmk); } return r11; }, [channelId]); let state; [state, setState] = useState(void 0); let state2; [state2, setState2] = useState(null); callback = useCallback((a0) => { const r0 = a0 == null; let r3 = null; if (!r0) { const participant = ChannelRTCStore.getParticipant(channelId, a0); r3 = participant == null ? null : participant.type; } setState2(r3); setState(a0); }, [channelId]); const I = () => focused3.get()?.id; I.__closure = { focused: focused3 }; I.__workletHash = 7943480174143; I.__initData = __initData6; const f = function f(a0, a1) { if (a0 !== a1) { _ReanimatedRexport.runOnJS(callback)(a0); } }; f.__closure = { runOnJS: _ReanimatedRexport.runOnJS, handleFocusChange: callback }; f.__workletHash = 13084116412140; f.__initData = __initData7; useAnimatedReaction(I, f); token = useToken(Module712.modules.mobile.VOICE_PANEL_GUTTER); const he = function he() { let r14, r31; L7: { L6: { r14 = calculateVoicePanelHeaderSpecs(safeArea.get(), token); if (mode.get() !== VoicePanelModes.PIP) { if (gestureState.get().active && !gestureState.get().requiresPop && connected.get()) { break L6; } const r29 = mode.get(); const DISMISSED = VoicePanelModes.DISMISSED; r31 = 0; if (r29 !== DISMISSED) { break L7; } const r34 = connected.get(); r31 = 0; if (!r34) { break L7; } } } r31 = -(r14.height + EDGE_GUTTER); } return r31; }; he.__closure = { calculateVoicePanelHeaderSpecs, safeArea, edgeGutter: token, mode, VoicePanelModes, gestureState, connected, EDGE_GUTTER }; he.__workletHash = 13290333964417; he.__initData = __initData8; derivedValue3 = useDerivedValue(he); const _e = function _e() { const r12 = calculateVoicePanelHeaderSpecs(safeArea.get(), token); const r15 = mode.get(); const PIP = VoicePanelModes.PIP; const r25 = connected.get(); const height = r12.height; const height2 = r25 ? height : height - r12.paddingTop + EDGE_GUTTER; const paddingTop = connected.get() ? r12.paddingTop : EDGE_GUTTER; const r36 = connected.get(); let borderTopRightRadius = 24; const borderTopLeftRadius = r36 ? 0 : 24; if (connected.get()) { borderTopRightRadius = 0; } return { ...r12, paddingTop, borderTopLeftRadius, borderTopRightRadius, height: height2, opacity: _timing.withTiming(r15 !== PIP ? mode.get() === VoicePanelModes.DISMISSED ? 0 : 1 : 0, OPACITY_TIMING), transform: [{ translateY: _spring.withSpring(derivedValue3.get(), !connected.get() && wrapperOffset.get().gestureActive ? DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE : UI_SHOW_HIDE_PHYSICS) }] }; }; _e.__closure = { calculateVoicePanelHeaderSpecs, safeArea, edgeGutter: token, mode, VoicePanelModes, connected, EDGE_GUTTER, withTiming: _timing.withTiming, OPACITY_TIMING, withSpring: _spring.withSpring, yOffset: derivedValue3, wrapperOffset, DRAWER_SPRING_PHYSICS_GESTURE_ACTIVE, UI_SHOW_HIDE_PHYSICS }; _e.__workletHash = 11065699618122; _e.__initData = __initData9; const animatedStyle = useAnimatedStyle(_e); const pe = function pe() { return controlsSpecs2.get().mode === VoicePanelControlsModes.HIDDEN && !isScreenReaderEnabled; }; pe.__closure = { controlsSpecs: controlsSpecs2, VoicePanelControlsModes, isScreenReaderEnabled }; pe.__workletHash = 16725581527938; pe.__initData = __initData10; derivedValue4 = useDerivedValue(pe); const Se = function Se() { const height = calculateVoicePanelHeaderSpecs(safeArea.get(), token).height; return { opacity: _timing.withTiming(derivedValue4.get() ? 0 : 1, OPACITY_TIMING), transform: [{ translateY: _spring.withSpring(derivedValue4.get() ? -height : 0, MODE_CHANGE_PHYSICS) }] }; }; Se.__closure = { calculateVoicePanelHeaderSpecs, safeArea, edgeGutter: token, withTiming: _timing.withTiming, isHeaderHidden: derivedValue4, OPACITY_TIMING, withSpring: _spring.withSpring, MODE_CHANGE_PHYSICS }; Se.__workletHash = 13148362186846; Se.__initData = __initData11; const animatedStyle2 = useAnimatedStyle(Se); const fe = () => ({ pointerEvents: derivedValue4.get() ? "none" : "box-none", importantForAccessibility: derivedValue4.get() ? "no-hide-descendants" : "auto", accessibilityElementsHidden: derivedValue4.get() }); fe.__closure = { isHeaderHidden: derivedValue4 }; fe.__workletHash = 4740985143159; fe.__initData = __initData12; const animatedProps = useAnimatedProps(fe); let r164 = useCanInviteMembers(channelId); const inviteMembersCallback = useInviteMembersCallback(channelId); const voicePanelNavArrowPressed = useVoicePanelNavArrowPressed(); useNavigatorBackPressHandler(voicePanelNavArrowPressed); LEFT = state2 != null ? c11409_27.LEFT : c11409_27.DOWN; const accessibilityLabel = LEFT === c11409_27.LEFT ? intl.string(t["9M6OdC"]) : isConnectedToVoiceChannel ? intl.string(t.RLCTQG) : intl.string(t["5lPjGj"]); const stableParticipant = useStableParticipant(AuthenticationStore.getId(), channelId, guildId); c22614_16 = stableParticipant; const stateFromStores3 = useStateFromStores([MediaEngineStore], () => { let r49; if (c22614_16 != null && isStableUserParticipant(c22614_16) && stableParticipantHasVideo(c22614_16)) { const videoDevices = MediaEngineStore.getVideoDevices(); const r10 = Object.keys(videoDevices); if (!(r10.length < 2)) { const videoDeviceId = MediaEngineStore.getVideoDeviceId(); const facing = videoDevices[videoDeviceId]?.facing; const r32 = r10.find((item) => item !== videoDeviceId); const r34 = r32 != null ? videoDevices[r32]?.facing : void 0; L22: { if (facing != null && r34 != null) { if (facing === "back" && r34 === "front") { r49 = intl.string(t["/R1SBx"]); break L22; } if (facing === "front" && r34 === "back") { r49 = intl.string(t["7YZ/Si"]); break L22; } r49 = intl.string(t["t9eQ/g"]); } else { r49 = intl.string(t["t9eQ/g"]); } } return r49; } } }, [stableParticipant]); const callback2 = useCallback(() => { const videoDeviceId2 = MediaEngineStore.getVideoDeviceId(); const r14 = Object.keys(MediaEngineStore.getVideoDevices()).find((item) => item !== videoDeviceId2); if (r14 != null) { AudioActionCreators.setVideoDevice(r14); } }, []); const memo = useMemo(() => ({ transform: [{ rotateZ: LEFT === c11409_27.LEFT ? "90deg" : "0deg" }] }), [LEFT]); const isSecureFramesUIEnabled = useIsSecureFramesUIEnabled({ channelId }); const isUserSecureFramesVerified = useIsUserSecureFramesVerified({ userId: state2 === ParticipantTypes.USER ? state ?? null : null, channelId }); let r38 = useIsStreamSecureFramesVerified({ streamKey: state2 === ParticipantTypes.STREAM ? state ?? null : null, channelId }); if (ParticipantTypes.STREAM !== state2) { r38 = ParticipantTypes.USER === state2 ? isUserSecureFramesVerified : false; } const theme = isConnectedToVoiceChannel ? ThemeTypes.MIDNIGHT : void 0; const r257 = [, isConnectedToVoiceChannel && , ,]; const r275 = [state2 === ParticipantTypes.USER ? : null, ,]; const r312 = [ {isSecureFramesUIEnabled ? r38 ? : null : null} , ,]; const r320 = [, channelType === ChannelTypes.GUILD_STAGE_VOICE && , , , , ,]; if (r164) { r164 = ; } r320[3] = r164; r320[4] = stateFromStores3 != null ? : null; r320[5] = treatment === MobileGoLiveEntrypointTreatment.SCREENSHARE_REPLACES_CHAT && ; r312[1] = {r320}; r275[1] = {r312}; r257[2] = {r275}; return {r257} ; }); export default r127;