1111 lines
51 KiB
TypeScript
1111 lines
51 KiB
TypeScript
// Metro module 15958 (f15959).
|
|
import * as Module19 from "react";
|
|
import { useCallback, useContext, useState, useLayoutEffect, useEffect, useMemo } from "react";
|
|
import { StyleSheet } from "react-native";
|
|
import ApplicationStreamingStore from "../../../../stores/ApplicationStreamingStore";
|
|
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
|
|
import SpeakingStore from "../../../../stores/SpeakingStore";
|
|
import { MODE_CHANGE_PHYSICS, SPEAKING_PHYSICS, VoicePanelCTACard, VoicePanelCardItemType, VoicePanelModes } from "../../VoicePanelConstants";
|
|
import { VoicePanelControlsModes } from "../controls/VoicePanelControlsConstants";
|
|
import { VoicePanelPIPModes } from "../pip/VoicePanelPIPConstants";
|
|
import { EDGE_GUTTER } from "./VoicePanelCardConstants";
|
|
import { ApplicationStreamStates, EMPTY_STRING_SNOWFLAKE_ID } from "../../../../Constants";
|
|
import { ParticipantTypes } from "../../../calls/CallConstants";
|
|
import { SCALE_PHYSICS } from "../../../panels/morphable/native/MorphablePanelConstants";
|
|
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
|
|
import ReanimatedRexport, { useAnimatedStyle, useDerivedValue, useSharedValue, useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
|
|
import { Text } from "../../../../design/components/Text/native/Text";
|
|
import { AVATAR_SIZE_MAP, AvatarSizes, Avatar } from "../../../../design/void/native";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import { stopStream, watchStream } from "../../../../actions/StreamActionCreators";
|
|
import { encodeStreamKey } from "../../../go_live/utils/StreamKeyUtils";
|
|
import NativeView from "../../../core/native/NativeView";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import { Button } from "../../../../design/components/Button/native/Button.native";
|
|
import VoicePanelStateContext from "../VoicePanelStateContext";
|
|
import { useStateFromStoresObject, useStateFromStores } from "../../../../_bundle/Module589";
|
|
import useVideoStreamError from "../../../errors/hooks/useVideoStreamError";
|
|
import { MediaEngineContextTypes } from "../../../../_bundle/Module4286";
|
|
import { VoicePanelStreamPreview } from "../shared/VoicePanelStreamPreview";
|
|
import VideoEmptyState, { VideoEmptyTypes } from "../../../../components_native/calls/stream/VideoEmptyState";
|
|
import { StreamTextOverlay } from "../../../video_calls/native/components/StreamTile";
|
|
import VoicePanelVideoRenderer from "./VoicePanelVideoRenderer";
|
|
import { VideoSpinnerContext } from "../../../../lib/VideoSpinnerTimer";
|
|
import { useDominantColorFromImage, getCachedSourceFromURI } from "./DominantColorUtils";
|
|
import MobileVisualRefreshExperiment from "../../../themes/experiments/MobileVisualRefreshExperiment";
|
|
import useDisplayProfile from "../../../user_profile/hooks/useDisplayProfile";
|
|
import { useVideoTileGradientColors } from "../../../calls/native/useVideoTileGradientColors";
|
|
import maybeFetchUserProfile from "../../../user_profile/maybeFetchUserProfile";
|
|
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
|
|
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
|
|
import ReanimatedNativeView from "../../../core/native/ReanimatedNativeView";
|
|
import Module4611 from "../../../../_bundle/Module4611";
|
|
import FastImage from "../../../../components_native/common/FastImage";
|
|
import { useToken } from "../../../../design/tokens/native/useToken";
|
|
import computeCardBorderRadius from "../utils/computeCardBorderRadius";
|
|
import roundToNearestPixel from "../utils/roundToNearestPixel";
|
|
import * as _cheapWorkletShallowEqual from "../../../reanimated/native/cheapWorkletShallowEqual";
|
|
import * as _TransitionGroup from "../../../../design/components/TransitionGroup/TransitionGroup";
|
|
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
|
|
import { usePIPState } from "../pip/VoicePanelPIPStateContext";
|
|
import * as _useStableParticipant from "../utils/useStableParticipant";
|
|
import useStableParticipant, { isStableParticipantWithUser, isStableActivityParticipant, isStableUserParticipant } from "../utils/useStableParticipant";
|
|
import * as _VoicePanelPIPUtils from "../pip/VoicePanelPIPUtils";
|
|
import calculateContentCenterOffset from "../utils/calculateContentCenterOffset";
|
|
import useTapGestures from "../hooks/useTapGestures";
|
|
import showUserProfileActionSheet from "../../../user_profile/native/showUserProfileActionSheet";
|
|
import { GestureDetector } from "../../../../_bundle/Module5273";
|
|
import useCameraEncodeError from "../../../errors/hooks/useCameraEncodeError";
|
|
import { useCardLayoutCoordsSubscription } from "./VoicePanelCardLayoutManager";
|
|
import getRandomNumberInRange from "../utils/getRandomNumberInRange";
|
|
import VoicePanelNoVideoParticipantsCard from "./VoicePanelNoVideoParticipantsCard";
|
|
import VoicePanelCTACardCallerDisconnected from "./VoicePanelCTACardCallerDisconnected";
|
|
import UserVideoFailed from "../../../video_calls/native/components/UserVideoFailed";
|
|
import VoicePanelAnimatedActivityCard from "./VoicePanelAnimatedActivityCard";
|
|
import VoicePanelCardFloatingControls from "./VoicePanelCardFloatingControls";
|
|
let AnimatedComponent, CARD_SCALE_PHYSICS, OPACITY_TIMING, ZINDEX_TIMING, CONNECTING_OPACITY, useStyles, __initData, __initData2, __initData3, Component, __initData4, __initData5, AnimatedUserCardInner, __initData6, __initData7, __initData8, SpeakingIndicator, Component2, __initData9, __initData10, __initData11, __initData12, c11434_47, layoutTransitionFunction, __initData13, __initData14, __initData15, __initData16, __initData17, __initData18, AnimatedWrapper, __initData19, __initData20;
|
|
const SelfStreamCard = function SelfStreamCard(props) {
|
|
const { sharedCoords, stream, isFocused } = props;
|
|
const styles = useStyles();
|
|
const callback3 = useCallback(() => {
|
|
if (stream != null) {
|
|
stopStream(encodeStreamKey(stream));
|
|
}
|
|
}, [stream]);
|
|
const l = function l() {
|
|
return {
|
|
textAlign: "center",
|
|
paddingHorizontal: 16,
|
|
paddingVertical: isFocused ? 0 : 16,
|
|
width: isFocused ? "auto" : sharedCoords.get().width
|
|
};
|
|
};
|
|
l.__closure = {
|
|
isFocused,
|
|
sharedCoords
|
|
};
|
|
l.__workletHash = 4561576173627;
|
|
l.__initData = __initData;
|
|
return <NativeView style={styles.nonUserRoundedCard}>
|
|
{isFocused ? <NativeView style={styles.blackBackground} /> : isFocused}
|
|
<AnimatedComponent style={useAnimatedStyle(l)} variant={isFocused ? "text-lg/semibold" : "text-sm/semibold"} color="text-overlay-light">
|
|
{intl.string(t.gMOwov)}
|
|
</AnimatedComponent>
|
|
{isFocused ? <>
|
|
<Text style={styles.selfStreamFocusedSubtitle} variant="text-sm/medium" color="text-overlay-light">
|
|
{intl.string(t.dKeLGt)}
|
|
</Text>
|
|
<Button size="lg" variant="primary-overlay" onPress={callback3} text={intl.string(t.CpkXwZ)} />
|
|
</> : null}
|
|
</NativeView>;
|
|
};
|
|
SpeakingIndicator = function SpeakingIndicator(props) {
|
|
const { id, isSelf, speaking, layout } = props;
|
|
const context = useContext(VoicePanelStateContext);
|
|
const { mode, focused } = context;
|
|
const styles = useStyles();
|
|
const token = useToken(Module712.modules.mobile.VOICE_TILE_BORDER_RADIUS);
|
|
const u = function u() {
|
|
const r2 = mode.get() !== VoicePanelModes.PIP && focused.get()?.id === id;
|
|
const opacity = r2 ? 0 : 1;
|
|
return {
|
|
opacity,
|
|
borderRadius: _spring.withSpring(r2 ? 0 : computeCardBorderRadius({
|
|
id,
|
|
mode: mode.get(),
|
|
focused: focused.get()?.id,
|
|
isSelf,
|
|
defaultBorderRadius: token
|
|
}), SPEAKING_PHYSICS, r2 ? "animate-never" : "animate-always")
|
|
};
|
|
};
|
|
u.__closure = {
|
|
mode,
|
|
VoicePanelModes,
|
|
focused,
|
|
id,
|
|
withSpring: _spring.withSpring,
|
|
computeCardBorderRadius,
|
|
isSelf,
|
|
defaultBorderRadius: token,
|
|
SPEAKING_PHYSICS
|
|
};
|
|
u.__workletHash = 5111620492405;
|
|
u.__initData = __initData6;
|
|
const animatedStyle = useAnimatedStyle(u);
|
|
const c = function c() {
|
|
const r2 = mode.get() === VoicePanelModes.PIP || focused.get()?.id === id;
|
|
const r7 = r2 ? 0 : computeCardBorderRadius({
|
|
id,
|
|
mode: mode.get(),
|
|
focused: focused.get()?.id,
|
|
isSelf,
|
|
defaultBorderRadius: token
|
|
});
|
|
let r39 = "animate-always";
|
|
const r42 = {
|
|
borderRadius: _spring.withSpring(r7, SPEAKING_PHYSICS, r2 ? "animate-never" : "animate-always"),
|
|
borderWidth: null
|
|
};
|
|
const r46 = r2 ? 0 : speaking.get() ? roundToNearestPixel(5) : 0;
|
|
if (r2) {
|
|
r39 = "animate-never";
|
|
}
|
|
r42.borderWidth = _spring.withSpring(r46, SPEAKING_PHYSICS, r39);
|
|
return r42;
|
|
};
|
|
c.__closure = {
|
|
mode,
|
|
VoicePanelModes,
|
|
focused,
|
|
id,
|
|
withSpring: _spring.withSpring,
|
|
computeCardBorderRadius,
|
|
isSelf,
|
|
defaultBorderRadius: token,
|
|
SPEAKING_PHYSICS,
|
|
speaking,
|
|
roundToNearestPixel,
|
|
SPEAKING_BORDER_SIZE: 3,
|
|
SPEAKING_INSET: 2
|
|
};
|
|
c.__workletHash = 13144186988728;
|
|
c.__initData = __initData7;
|
|
const animatedStyle2 = useAnimatedStyle(c);
|
|
const h = function h() {
|
|
const r3 = mode.get() === VoicePanelModes.PIP || focused.get()?.id === id;
|
|
const r12 = r3 ? 0 : computeCardBorderRadius({
|
|
id,
|
|
mode: mode.get(),
|
|
focused: focused.get()?.id,
|
|
isSelf,
|
|
defaultBorderRadius: token
|
|
});
|
|
let r40 = "animate-always";
|
|
const r43 = {
|
|
borderRadius: _spring.withSpring(r12, SPEAKING_PHYSICS, r3 ? "animate-never" : "animate-always"),
|
|
borderWidth: null
|
|
};
|
|
const r0 = r3 ? 0 : speaking.get() ? 3 : 0;
|
|
if (r3) {
|
|
r40 = "animate-never";
|
|
}
|
|
r43.borderWidth = _spring.withSpring(r0, SPEAKING_PHYSICS, r40);
|
|
return r43;
|
|
};
|
|
h.__closure = {
|
|
mode,
|
|
VoicePanelModes,
|
|
focused,
|
|
id,
|
|
withSpring: _spring.withSpring,
|
|
computeCardBorderRadius,
|
|
isSelf,
|
|
defaultBorderRadius: token,
|
|
SPEAKING_PHYSICS,
|
|
speaking,
|
|
SPEAKING_BORDER_SIZE: 3
|
|
};
|
|
h.__workletHash = 2850608131549;
|
|
h.__initData = __initData8;
|
|
return <ReanimatedNativeView style={[styles.speakingIndicatorWrapper, animatedStyle]} layout={layout} pointerEvents="none">
|
|
<ReanimatedNativeView style={[styles.speakingIndicatorUnderlay, animatedStyle2]} layout={layout} />
|
|
<ReanimatedNativeView style={[styles.speakingIndicatorGreenBar, useAnimatedStyle(h)]} layout={layout} />
|
|
</ReanimatedNativeView>;
|
|
};
|
|
AnimatedWrapper = function AnimatedWrapper(props) {
|
|
let r195, animatedStyle, isPIP, onDoubleTap;
|
|
let derivedValue, derivedValue2, derivedValue3, sharedValue, c22648_31, token2;
|
|
const { children, cleanUp, coords, id: id2, isRTCConnected, isScrollVisible, layoutPhysics, transitionState: transitionState2, sharedVisible } = props;
|
|
derivedValue = void 0;
|
|
derivedValue2 = void 0;
|
|
derivedValue3 = void 0;
|
|
sharedValue = void 0;
|
|
c22648_31 = void 0;
|
|
token2 = void 0;
|
|
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
|
|
const styles = useStyles();
|
|
const context = useContext(VoicePanelStateContext);
|
|
const { channelId, connected, contentDimensions, controlsSpecs, focused: focused2, guildId: guildId2, hideControls, mode: mode2 } = context;
|
|
context.mountedCards;
|
|
const { pipAvoidanceSpecs, safeArea, ScrollPosition, setFocused, showControls, windowDimensions, wrapperDimensions, wrapperOffset, panelCardStillInPIP } = context;
|
|
const pIPState = usePIPState();
|
|
const stableParticipant = useStableParticipant(id2, channelId, guildId2);
|
|
const r69 = isStableParticipantWithUser(stableParticipant) ? stableParticipant : c11434_47;
|
|
let id4, c22649_1, transitionState, cleanUp2, mode3, focused3, isScrollVisible2, sharedVisible2, sharedValue2, setState, callback2;
|
|
const isSelf2 = r69.isSelf;
|
|
const id3 = r69.user.id;
|
|
const y = function y() {
|
|
return id2 === pIPState.id && mode2.get() === VoicePanelModes.PIP;
|
|
};
|
|
y.__closure = {
|
|
id: id2,
|
|
pipState: pIPState,
|
|
mode: mode2,
|
|
VoicePanelModes
|
|
};
|
|
y.__workletHash = 4773864088866;
|
|
y.__initData = __initData13;
|
|
derivedValue = useDerivedValue(y);
|
|
const r80 = () => focused2.get()?.id !== id2 ? mode2.get() === VoicePanelModes.PIP ? ScrollPosition.get() : 0 : ScrollPosition.get();
|
|
r80.__closure = {
|
|
focused: focused2,
|
|
id: id2,
|
|
mode: mode2,
|
|
VoicePanelModes,
|
|
ScrollPosition
|
|
};
|
|
r80.__workletHash = 8770947887509;
|
|
r80.__initData = __initData14;
|
|
derivedValue2 = useDerivedValue(r80);
|
|
const C = function C() {
|
|
return connected.get() ? Math.max(EDGE_GUTTER, safeArea.get().left, (windowDimensions.get().width - contentDimensions.get().width) / 2) : wrapperDimensions.get().drawerWidth / 2;
|
|
};
|
|
C.__closure = {
|
|
connected,
|
|
EDGE_GUTTER,
|
|
safeArea,
|
|
windowDimensions,
|
|
contentDimensions,
|
|
wrapperDimensions
|
|
};
|
|
C.__workletHash = 15078431132990;
|
|
C.__initData = __initData15;
|
|
derivedValue3 = useDerivedValue(C);
|
|
id4 = id2;
|
|
c22649_1 = stableParticipant;
|
|
transitionState = transitionState2;
|
|
cleanUp2 = cleanUp;
|
|
mode3 = mode2;
|
|
focused3 = focused2;
|
|
isScrollVisible2 = isScrollVisible;
|
|
sharedVisible2 = sharedVisible;
|
|
sharedValue2 = void 0;
|
|
setState = void 0;
|
|
callback2 = void 0;
|
|
sharedValue2 = useSharedValue(transitionState);
|
|
let gesturesEnabled;
|
|
[gesturesEnabled, setState] = useState(true);
|
|
const type = stableParticipant?.type;
|
|
L8: {
|
|
callback2 = useCallback((a0) => {
|
|
if (c22649_1?.type === ParticipantTypes.ACTIVITY) {
|
|
setState(!(a0 === id4));
|
|
}
|
|
}, [type, id2]);
|
|
const w = () => focused3.get()?.id;
|
|
w.__closure = {
|
|
focused: focused2
|
|
};
|
|
w.__workletHash = 12145773243163;
|
|
w.__initData = __initData9;
|
|
const _ = function _(a0, a1) {
|
|
if (a0 !== a1) {
|
|
_ReanimatedRexport.runOnJS(callback2)(a0);
|
|
}
|
|
};
|
|
_.__closure = {
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
handleFocusedParticipantChange: callback2
|
|
};
|
|
_.__workletHash = 9304160478829;
|
|
_.__initData = __initData10;
|
|
useAnimatedReaction(w, _);
|
|
const r125 = () => ({
|
|
mode: mode3.get(),
|
|
focused: focused3.get(),
|
|
transitionState: sharedValue2.get()
|
|
});
|
|
r125.__closure = {
|
|
mode: mode2,
|
|
focused: focused2,
|
|
sharedTransitionState: sharedValue2
|
|
};
|
|
r125.__workletHash = 13570020810295;
|
|
r125.__initData = __initData11;
|
|
const r129 = function P(a0, a1) {
|
|
const r13 = a1 == null ? void 0 : a1;
|
|
L23: {
|
|
if (!_cheapWorkletShallowEqual.cheapWorkletShallowEqual(a0, r13)) {
|
|
const { mode: mode5, focused: focused5, transitionState: transitionState2 } = a0;
|
|
const PIP = VoicePanelModes.PIP;
|
|
const id8 = focused5?.id;
|
|
if (a1 == null && transitionState2 !== _TransitionGroup.TransitionStates.YEETED) {
|
|
sharedVisible2.set(1);
|
|
break L23;
|
|
}
|
|
if (transitionState2 === _TransitionGroup.TransitionStates.YEETED) {
|
|
if (sharedVisible2.get() === 1 && isScrollVisible2.get()) {
|
|
sharedVisible2.set(0);
|
|
break L23;
|
|
}
|
|
_ReanimatedRexport.runOnJS(cleanUp2)();
|
|
} else if (a1?.transitionState === _TransitionGroup.TransitionStates.YEETED) {
|
|
sharedVisible2.set(1);
|
|
} else if (mode5 !== PIP) {
|
|
if (id8 == null) {
|
|
sharedVisible2.set(1);
|
|
} else if (id8 !== id4) {
|
|
sharedVisible2.set(0);
|
|
} else {
|
|
sharedVisible2.set(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
r129.__closure = {
|
|
cheapWorkletShallowEqual: _cheapWorkletShallowEqual.cheapWorkletShallowEqual,
|
|
VoicePanelModes,
|
|
TransitionStates: _TransitionGroup.TransitionStates,
|
|
sharedVisible,
|
|
isScrollVisible,
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
cleanUp,
|
|
id: id2
|
|
};
|
|
r129.__workletHash = 17099686269568;
|
|
r129.__initData = __initData12;
|
|
useAnimatedReaction(r125, r129);
|
|
useLayoutEffect(() => {
|
|
sharedValue2.set(transitionState);
|
|
});
|
|
sharedValue = sharedValue2;
|
|
isPIP = pIPState.mode === VoicePanelPIPModes.IN_APP;
|
|
c22648_31 = isPIP;
|
|
token2 = useToken(Module712.modules.mobile.VOICE_TILE_BORDER_RADIUS);
|
|
const b = function b() {
|
|
let r22, r63, r64, height3, width3;
|
|
const r10 = coords.get();
|
|
const { zIndex, width, height, x: r14, y: r15 } = r10;
|
|
const r7 = focused2.get()?.id === id2;
|
|
if (c22648_31) {
|
|
const { width: width2, height: height2 } = pIPState;
|
|
const height4 = pIPState.showSecondaryPIP ? pIPState.containerHeight : pIPState.height;
|
|
const clampedPIPPosition = _VoicePanelPIPUtils.getClampedPIPPosition({
|
|
pipX: wrapperDimensions.get().pipX,
|
|
pipY: wrapperDimensions.get().pipY,
|
|
width: width2,
|
|
height: height4,
|
|
windowDimensions: windowDimensions.get(),
|
|
safeArea: safeArea.get(),
|
|
bottomAvoidanceRegion: pipAvoidanceSpecs.get().bottom,
|
|
topAvoidanceRegion: pipAvoidanceSpecs.get().top
|
|
});
|
|
r64 = clampedPIPPosition.x;
|
|
r63 = derivedValue2.get() + clampedPIPPosition.y;
|
|
height3 = height2;
|
|
width3 = width2;
|
|
r22 = zIndex;
|
|
} else if (focused2.get() != null) {
|
|
r63 = r15;
|
|
r64 = r14;
|
|
height3 = height;
|
|
width3 = width;
|
|
r22 = 0;
|
|
if (r7) {
|
|
width3 = windowDimensions.get().width;
|
|
height3 = windowDimensions.get().height;
|
|
r63 = derivedValue2.get();
|
|
r22 = 1;
|
|
r64 = 0;
|
|
}
|
|
} else {
|
|
const r20 = r14 + derivedValue3.get();
|
|
const r55 = r15 + calculateContentCenterOffset({
|
|
contentHeight: contentDimensions.get().height,
|
|
windowHeight: windowDimensions.get().height,
|
|
safeArea: safeArea.get()
|
|
});
|
|
const r24 = sharedValue.get();
|
|
const YEETED = _TransitionGroup.TransitionStates.YEETED;
|
|
r63 = r55;
|
|
r64 = r20;
|
|
height3 = height;
|
|
width3 = width;
|
|
r22 = zIndex;
|
|
if (r24 === YEETED) {
|
|
r63 = r55 + height / 4;
|
|
r64 = r20;
|
|
height3 = height;
|
|
width3 = width;
|
|
r22 = zIndex;
|
|
}
|
|
}
|
|
if (derivedValue.get()) {
|
|
r22 = 9001;
|
|
}
|
|
const r130 = computeCardBorderRadius({
|
|
id: id2,
|
|
mode: mode2.get(),
|
|
focused: focused2.get()?.id,
|
|
isSelf: isSelf2,
|
|
defaultBorderRadius: token2
|
|
});
|
|
const r138 = sharedVisible.get() === 0 ? focused2.get()?.id === id2 ? r7 ? 1 : isRTCConnected ? 1 : CONNECTING_OPACITY : 0 : r7 ? 1 : isRTCConnected ? 1 : CONNECTING_OPACITY;
|
|
const gestureActive = wrapperOffset.get().gestureActive;
|
|
const r151 = sharedVisible.get() !== 1 ? focused2.get()?.id === id2 ? 1 : 0.8 : 1;
|
|
const r168 = {
|
|
zIndex: _ReanimatedRexport.withDelay(derivedValue.get() ? 0 : 100, _timing.withTiming(r22, ZINDEX_TIMING)),
|
|
opacity: null,
|
|
width: null,
|
|
height: null,
|
|
transform: null,
|
|
borderRadius: null
|
|
};
|
|
const r178 = isScrollVisible.get() ? "animate-always" : "animate-never";
|
|
const r179 = function I(a0) {
|
|
if ((a0 ? sharedVisible.get() === 0 : a0) && sharedValue.get() === _TransitionGroup.TransitionStates.YEETED) {
|
|
_ReanimatedRexport.runOnJS(cleanUp)();
|
|
}
|
|
};
|
|
r179.__closure = {
|
|
sharedVisible,
|
|
sharedTransitionState: sharedValue,
|
|
TransitionStates: _TransitionGroup.TransitionStates,
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
cleanUp
|
|
};
|
|
r179.__workletHash = 6571273005437;
|
|
r179.__initData = __initData17;
|
|
r168.opacity = _timing.withTiming(r138, OPACITY_TIMING, r178, r179);
|
|
r168.width = width3;
|
|
r168.height = height3;
|
|
r168.transform = [{
|
|
translateX: gestureActive ? r64 : _spring.withSpring(r64, layoutPhysics, "animate-always")
|
|
}, {
|
|
translateY: gestureActive ? r63 : _spring.withSpring(r63, layoutPhysics, "animate-always")
|
|
}, {
|
|
scale: _spring.withSpring(r151, CARD_SCALE_PHYSICS)
|
|
}];
|
|
r168.borderRadius = _spring.withSpring(r130, SCALE_PHYSICS);
|
|
return r168;
|
|
};
|
|
b.__closure = {
|
|
coords,
|
|
focused: focused2,
|
|
id: id2,
|
|
isPIP,
|
|
pipState: pIPState,
|
|
getClampedPIPPosition: _VoicePanelPIPUtils.getClampedPIPPosition,
|
|
wrapperDimensions,
|
|
windowDimensions,
|
|
safeArea,
|
|
pipAvoidanceSpecs,
|
|
derivedScrollValue: derivedValue2,
|
|
xOffset: derivedValue3,
|
|
calculateContentCenterOffset,
|
|
contentDimensions,
|
|
sharedTransitionState: sharedValue2,
|
|
TransitionStates: _TransitionGroup.TransitionStates,
|
|
zIndexOverride: derivedValue,
|
|
computeCardBorderRadius,
|
|
mode: mode2,
|
|
isSelf: isSelf2,
|
|
defaultBorderRadius: token2,
|
|
sharedVisible,
|
|
isRTCConnected,
|
|
CONNECTING_OPACITY,
|
|
wrapperOffset,
|
|
withDelay: _ReanimatedRexport.withDelay,
|
|
withTiming: _timing.withTiming,
|
|
ZINDEX_TIMING,
|
|
OPACITY_TIMING,
|
|
isScrollVisible,
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
cleanUp,
|
|
withSpring: _spring.withSpring,
|
|
layoutPhysics,
|
|
CARD_SCALE_PHYSICS,
|
|
SCALE_PHYSICS
|
|
};
|
|
b.__workletHash = 9934021851336;
|
|
b.__initData = __initData16;
|
|
animatedStyle = useAnimatedStyle(b);
|
|
r195 = {
|
|
gesturesEnabled,
|
|
onSingleTap: () => {
|
|
if (controlsSpecs.get().mode === VoicePanelControlsModes.HIDDEN) {
|
|
showControls({
|
|
debounce: true
|
|
});
|
|
} else {
|
|
hideControls({
|
|
debounce: true
|
|
});
|
|
}
|
|
},
|
|
onDoubleTap: null,
|
|
onLongPress: null
|
|
};
|
|
if (!isStableActivityParticipant(stableParticipant)) {
|
|
onDoubleTap = void 0;
|
|
if (!isSelf2) {
|
|
break L8;
|
|
}
|
|
const isStableStreamParticipant = _useStableParticipant.isStableStreamParticipant(stableParticipant);
|
|
onDoubleTap = void 0;
|
|
if (!isStableStreamParticipant) {
|
|
break L8;
|
|
}
|
|
}
|
|
onDoubleTap = () => {
|
|
if (focused2.get()?.id !== id2) {
|
|
setFocused(id2);
|
|
} else {
|
|
setFocused(null);
|
|
}
|
|
};
|
|
}
|
|
r195.onDoubleTap = onDoubleTap;
|
|
r195.onLongPress = id3 != null ? () => showUserProfileActionSheet({
|
|
userId: id3,
|
|
channelId,
|
|
isVoiceContext: true,
|
|
sourceAnalyticsLocations: analyticsLocations
|
|
}) : void 0;
|
|
const tapGestures = useTapGestures(r195);
|
|
useLayoutEffect(() => {
|
|
panelCardStillInPIP.set(c22648_31);
|
|
}, [isPIP, panelCardStillInPIP]);
|
|
const be = function be(a0) {
|
|
const initialValues = {
|
|
originX: a0.currentOriginX,
|
|
originY: a0.currentOriginY,
|
|
width: a0.currentWidth,
|
|
height: a0.currentHeight
|
|
};
|
|
return {
|
|
animations: {
|
|
originX: _spring.withSpring(a0.targetOriginX, layoutPhysics, "animate-always"),
|
|
originY: _spring.withSpring(a0.targetOriginY, layoutPhysics, "animate-always"),
|
|
width: _spring.withSpring(a0.targetWidth, layoutPhysics, "animate-always"),
|
|
height: _spring.withSpring(a0.targetHeight, layoutPhysics, "animate-always")
|
|
},
|
|
initialValues,
|
|
callback: () => {
|
|
const r3 = wrapperOffset.get();
|
|
if (!(r3.gestureActive || r3.y === 0)) {
|
|
wrapperOffset.set({
|
|
gestureActive: false,
|
|
x: 0,
|
|
y: 0
|
|
});
|
|
}
|
|
}
|
|
};
|
|
};
|
|
be.__closure = {
|
|
withSpring: _spring.withSpring,
|
|
layoutPhysics,
|
|
wrapperOffset
|
|
};
|
|
be.__workletHash = 2693592883668;
|
|
be.__initData = __initData18;
|
|
return <GestureDetector gesture={tapGestures}>
|
|
<ReanimatedNativeView style={[styles.positionWrapper, animatedStyle]} layout={useCallback(be, [layoutPhysics, wrapperOffset])}>{children}</ReanimatedNativeView>
|
|
</GestureDetector>;
|
|
};
|
|
AnimatedComponent = ReanimatedRexport.createAnimatedComponent(Text);
|
|
const width = AVATAR_SIZE_MAP[AvatarSizes.XXLARGE];
|
|
CARD_SCALE_PHYSICS = {
|
|
...SCALE_PHYSICS,
|
|
stiffness: 150
|
|
};
|
|
OPACITY_TIMING = {
|
|
duration: 200
|
|
};
|
|
ZINDEX_TIMING = {
|
|
duration: 0
|
|
};
|
|
CONNECTING_OPACITY = 0.75;
|
|
useStyles = createStyles({
|
|
positionWrapper: {
|
|
position: "absolute",
|
|
top: 0,
|
|
left: 0,
|
|
overflow: "hidden",
|
|
backgroundColor: Module712.colors.BLACK
|
|
},
|
|
userRoundedCard: {
|
|
position: "absolute",
|
|
top: -4,
|
|
left: -4,
|
|
bottom: -4,
|
|
right: -4,
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
backgroundColor: Module712.unsafe_rawColors.PRIMARY_800
|
|
},
|
|
nonUserRoundedCard: {
|
|
position: "absolute",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
width: "100%",
|
|
height: "100%",
|
|
backgroundColor: Module712.colors.VOICE_VIDEO_VIDEO_TILE_BACKGROUND
|
|
},
|
|
blackBackground: {
|
|
...StyleSheet.absoluteFillObject,
|
|
backgroundColor: "black"
|
|
},
|
|
selfStreamFocusedSubtitle: {
|
|
textAlign: "center",
|
|
marginTop: 4,
|
|
marginBottom: 40
|
|
},
|
|
avatarImageMaskStyles: {
|
|
position: "relative",
|
|
borderRadius: Module712.radii.round,
|
|
overflow: "hidden"
|
|
},
|
|
avatarPlaceholder: {
|
|
width,
|
|
height: width,
|
|
borderRadius: Module712.radii.round,
|
|
backgroundColor: "rgba(0,0,0,0.3)"
|
|
},
|
|
image: {
|
|
maxWidth: 80,
|
|
maxHeight: 80
|
|
},
|
|
speakingIndicatorWrapper: {
|
|
...StyleSheet.absoluteFillObject,
|
|
overflow: "hidden"
|
|
},
|
|
speakingIndicatorUnderlay: {
|
|
...StyleSheet.absoluteFillObject,
|
|
borderColor: Module712.colors.BLACK
|
|
},
|
|
speakingIndicatorGreenBar: {
|
|
...StyleSheet.absoluteFillObject,
|
|
borderColor: Module712.unsafe_rawColors.GREEN_360
|
|
}
|
|
});
|
|
__initData = {
|
|
code: "function VoicePanelCardTsx1(){const{isFocused,sharedCoords}=this.__closure;return{textAlign:'center',paddingHorizontal:16,paddingVertical:isFocused?0:16,width:isFocused?'auto':sharedCoords.get().width};}"
|
|
};
|
|
__initData2 = {
|
|
code: "function VoicePanelCardTsx2(){const{focused,id}=this.__closure;var _focused$get;return((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id;}"
|
|
};
|
|
__initData3 = {
|
|
code: "function VoicePanelCardTsx3(isFocused,lastIsFocused){const{runOnJS,setIsFocused}=this.__closure;if(isFocused!==lastIsFocused){runOnJS(setIsFocused)(isFocused);}}"
|
|
};
|
|
Component = Module19.memo(function(a0) {
|
|
let stream2, setState2;
|
|
const { id: id5, userId } = a0;
|
|
let streamId = a0.streamId;
|
|
const { streamGuildId, userNick, isSelf: isSelf3, sharedCoords: sharedCoords2, isScrollVisible: isScrollVisible3, layout } = a0;
|
|
stream2 = void 0;
|
|
setState2 = void 0;
|
|
const context = useContext(VoicePanelStateContext);
|
|
const { focused: focused4, mode: mode5, setFocused: setFocused2 } = context;
|
|
const stateFromStoresObject = useStateFromStoresObject([ApplicationStreamingStore], () => ({
|
|
stream: ApplicationStreamingStore.getStreamForUser(userId, streamGuildId),
|
|
activeStream: ApplicationStreamingStore.getActiveStreamForUser(userId, streamGuildId)
|
|
}), [userId, streamGuildId]);
|
|
stream2 = stateFromStoresObject.stream;
|
|
const activeStream = stateFromStoresObject.activeStream;
|
|
const callback3 = useCallback(() => {
|
|
if (stream2 != null) {
|
|
watchStream(stream2, {
|
|
forceMultiple: true
|
|
});
|
|
setFocused2(encodeStreamKey(stream2));
|
|
}
|
|
}, [stream2, setFocused2]);
|
|
let isFocused2;
|
|
[isFocused2, setState2] = useState(false);
|
|
const r52 = () => focused4.get()?.id === id5;
|
|
r52.__closure = {
|
|
focused: focused4,
|
|
id: id5
|
|
};
|
|
r52.__workletHash = 13061544667904;
|
|
r52.__initData = __initData2;
|
|
const r55 = function P(a0, a1) {
|
|
if (a0 !== a1) {
|
|
_ReanimatedRexport.runOnJS(setState2)(a0);
|
|
}
|
|
};
|
|
r55.__closure = {
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
setIsFocused: setState2
|
|
};
|
|
r55.__workletHash = 8824446489251;
|
|
r55.__initData = __initData3;
|
|
useAnimatedReaction(r52, r55);
|
|
const videoStreamError = useVideoStreamError(MediaEngineContextTypes.STREAM, userId);
|
|
if (isSelf3) {
|
|
return <SelfStreamCard sharedCoords={sharedCoords2} stream={stream2} isFocused={isFocused2} />;
|
|
}
|
|
if (activeStream == null) {
|
|
return <VoicePanelStreamPreview mode={mode5} stream={stream2} onPress={callback3} disabled={false} layout={layout} />;
|
|
}
|
|
if (videoStreamError == null && activeStream.state !== ApplicationStreamStates.FAILED) {
|
|
if (activeStream.state === ApplicationStreamStates.ENDED) {
|
|
return <VideoEmptyState stream={activeStream} removeSplashImage={!isFocused2} type={VideoEmptyTypes.STREAM_ENDED} style={StyleSheet.absoluteFill} />;
|
|
}
|
|
const r80 = activeStream.state === ApplicationStreamStates.RECONNECTING ? <StreamTextOverlay title={intl.string(t["pdFFK+"])} /> : activeStream.state === ApplicationStreamStates.PAUSED ? <StreamTextOverlay title={intl.string(t["5q17w5"])} subtext={intl.formatToPlainString(t.meVVlb, {
|
|
username: userNick
|
|
})} /> : null;
|
|
if (streamId == null) {
|
|
streamId = null;
|
|
}
|
|
return <>
|
|
<VoicePanelVideoRenderer layout={layout} id={id5} streamId={streamId} userId={userId} streamKey={encodeStreamKey(activeStream)} isScrollVisible={isScrollVisible3} videoSpinnerContext={VideoSpinnerContext.REMOTE_STREAM} sharedCoords={sharedCoords2} isCamera={false} paused={activeStream.state === ApplicationStreamStates.PAUSED} />
|
|
{r80}
|
|
</>;
|
|
}
|
|
return <VideoEmptyState avError={videoStreamError} stream={activeStream} removeSplashImage={!isFocused2} type={VideoEmptyTypes.STREAM_FAILED} style={StyleSheet.absoluteFill} />;
|
|
});
|
|
__initData4 = {
|
|
code: "function VoicePanelCardTsx4(){const{withTiming,isRinging,CONNECTING_OPACITY,backgroundColor}=this.__closure;return{opacity:withTiming(isRinging?CONNECTING_OPACITY:1,{duration:100},'animate-always'),backgroundColor:backgroundColor};}"
|
|
};
|
|
__initData5 = {
|
|
code: "function VoicePanelCardTsx5(){const{withSpring,mode,VoicePanelModes,layoutPhysics}=this.__closure;return{transform:[{scale:withSpring(mode.get()===VoicePanelModes.PIP?64/80:1,layoutPhysics)}]};}"
|
|
};
|
|
AnimatedUserCardInner = Module19.memo(function AnimatedUserCardInner(props) {
|
|
let r119;
|
|
const { isRinging, layout, avatarURI, avatarDecoration, layoutPhysics: layoutPhysics2 } = props;
|
|
let userId2 = props.userId;
|
|
let guildId2 = props.guildId;
|
|
const styles = useStyles();
|
|
const mode4 = useContext(VoicePanelStateContext).mode;
|
|
const dominantColorFromImage = useDominantColorFromImage(avatarURI);
|
|
const r23 = MobileVisualRefreshExperiment("VoicePanelCard-native");
|
|
let c22651_4 = r23;
|
|
if (userId2 == null) {
|
|
userId2 = EMPTY_STRING_SNOWFLAKE_ID;
|
|
}
|
|
const EMPTY_STRING_SNOWFLAKE_ID2 = userId2;
|
|
if (guildId2 == null) {
|
|
guildId2 = void 0;
|
|
}
|
|
const guildId = guildId2;
|
|
const displayProfile = useDisplayProfile(EMPTY_STRING_SNOWFLAKE_ID2, guildId);
|
|
const r3 = displayProfile == null;
|
|
let r40 = void 0;
|
|
if (!r3) {
|
|
const themeColors = displayProfile.themeColors;
|
|
r40 = themeColors == null ? void 0 : themeColors[0];
|
|
}
|
|
if (r40 == null) {
|
|
r40 = null;
|
|
}
|
|
const r42 = displayProfile == null;
|
|
let r25 = void 0;
|
|
if (!r42) {
|
|
const themeColors2 = displayProfile.themeColors;
|
|
r25 = themeColors2 == null ? void 0 : themeColors2[1];
|
|
}
|
|
if (r25 == null) {
|
|
r25 = null;
|
|
}
|
|
const r26 = r23 && r40 != null && r25 != null;
|
|
const videoTileGradientColors = useVideoTileGradientColors(r26 ? r40 : null, r26 ? r25 : null);
|
|
useEffect(() => {
|
|
if (EMPTY_STRING_SNOWFLAKE_ID2 !== EMPTY_STRING_SNOWFLAKE_ID && c22651_4) {
|
|
maybeFetchUserProfile(EMPTY_STRING_SNOWFLAKE_ID2, void 0, {
|
|
guildId,
|
|
dispatchWait: true
|
|
});
|
|
}
|
|
}, [r23, EMPTY_STRING_SNOWFLAKE_ID2, guildId]);
|
|
const R = () => ({
|
|
opacity: _timing.withTiming(isRinging ? CONNECTING_OPACITY : 1, {
|
|
duration: 100
|
|
}, "animate-always"),
|
|
backgroundColor: dominantColorFromImage
|
|
});
|
|
R.__closure = {
|
|
withTiming: _timing.withTiming,
|
|
isRinging,
|
|
CONNECTING_OPACITY,
|
|
backgroundColor: dominantColorFromImage
|
|
};
|
|
R.__workletHash = 6200022645373;
|
|
R.__initData = __initData4;
|
|
const animatedStyle = useAnimatedStyle(R);
|
|
const O = () => ({
|
|
transform: [{
|
|
scale: _spring.withSpring(mode4.get() === VoicePanelModes.PIP ? 0.8 : 1, layoutPhysics2)
|
|
}]
|
|
});
|
|
O.__closure = {
|
|
withSpring: _spring.withSpring,
|
|
mode: mode4,
|
|
VoicePanelModes,
|
|
layoutPhysics: layoutPhysics2
|
|
};
|
|
O.__workletHash = 5040632730576;
|
|
O.__initData = __initData5;
|
|
const animatedStyle2 = useAnimatedStyle(O);
|
|
const source = avatarURI != null ? getCachedSourceFromURI(avatarURI) : void 0;
|
|
const r98 = [videoTileGradientColors != null ? <Module4611 colors={videoTileGradientColors} start={{
|
|
x: 0,
|
|
y: 0
|
|
}} end={{
|
|
x: 0,
|
|
y: 1
|
|
}} style={StyleSheet.absoluteFill} pointerEvents="none" /> : null, ,];
|
|
if (source == null) {
|
|
r119 = <NativeView style={styles.avatarPlaceholder} />;
|
|
} else {
|
|
const r99 = avatarDecoration != null;
|
|
r119 = <ReanimatedNativeView style={[r99 ? void 0 : styles.avatarImageMaskStyles, animatedStyle2]} layout={layout}>
|
|
{r99 ? <Avatar source={source} size={AvatarSizes.XXLARGE} avatarDecoration={avatarDecoration} /> : <FastImage source={source} resizeMode="stretch" width={80} height={80} style={styles.image} />}
|
|
</ReanimatedNativeView>;
|
|
}
|
|
r98[1] = r119;
|
|
return <ReanimatedNativeView style={[styles.userRoundedCard, animatedStyle]} layout={layout}>{r98}</ReanimatedNativeView>;
|
|
});
|
|
__initData6 = {
|
|
code: "function VoicePanelCardTsx6(){const{mode,VoicePanelModes,focused,id,withSpring,computeCardBorderRadius,isSelf,defaultBorderRadius,SPEAKING_PHYSICS}=this.__closure;var _focused$get,_focused$get2;const disable=mode.get()!==VoicePanelModes.PIP&&((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id;return{opacity:disable?0:1,borderRadius:withSpring(disable?0:computeCardBorderRadius({id:id,mode:mode.get(),focused:(_focused$get2=focused.get())===null||_focused$get2===void 0?void 0:_focused$get2.id,isSelf:isSelf,defaultBorderRadius:defaultBorderRadius}),SPEAKING_PHYSICS,!disable?'animate-always':'animate-never')};}"
|
|
};
|
|
__initData7 = {
|
|
code: "function VoicePanelCardTsx7(){const{mode,VoicePanelModes,focused,id,withSpring,computeCardBorderRadius,isSelf,defaultBorderRadius,SPEAKING_PHYSICS,speaking,roundToNearestPixel,SPEAKING_BORDER_SIZE,SPEAKING_INSET}=this.__closure;var _focused$get,_focused$get2;const disable=mode.get()===VoicePanelModes.PIP||((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id;return{borderRadius:withSpring(!disable?computeCardBorderRadius({id:id,mode:mode.get(),focused:(_focused$get2=focused.get())===null||_focused$get2===void 0?void 0:_focused$get2.id,isSelf:isSelf,defaultBorderRadius:defaultBorderRadius}):0,SPEAKING_PHYSICS,!disable?'animate-always':'animate-never'),borderWidth:withSpring(!disable&&speaking.get()?roundToNearestPixel(SPEAKING_BORDER_SIZE+SPEAKING_INSET):0,SPEAKING_PHYSICS,!disable?'animate-always':'animate-never')};}"
|
|
};
|
|
__initData8 = {
|
|
code: "function VoicePanelCardTsx8(){const{mode,VoicePanelModes,focused,id,withSpring,computeCardBorderRadius,isSelf,defaultBorderRadius,SPEAKING_PHYSICS,speaking,SPEAKING_BORDER_SIZE}=this.__closure;var _focused$get,_focused$get2;const disable=mode.get()===VoicePanelModes.PIP||((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id;return{borderRadius:withSpring(!disable?computeCardBorderRadius({id:id,mode:mode.get(),focused:(_focused$get2=focused.get())===null||_focused$get2===void 0?void 0:_focused$get2.id,isSelf:isSelf,defaultBorderRadius:defaultBorderRadius}):0,SPEAKING_PHYSICS,!disable?'animate-always':'animate-never'),borderWidth:withSpring(!disable&&speaking.get()?SPEAKING_BORDER_SIZE:0,SPEAKING_PHYSICS,!disable?'animate-always':'animate-never')};}"
|
|
};
|
|
Component2 = Module19.memo(function(a0) {
|
|
let id6;
|
|
const [state, setState3] = useState(() => SpeakingStore.isSpeaking(a0.id));
|
|
id6 = a0.id;
|
|
useEffect(() => {
|
|
if (!state) {
|
|
SpeakingStore.addConditionalChangeListener(() => {
|
|
const isSpeaking = SpeakingStore.isSpeaking(id6);
|
|
let r0 = !isSpeaking;
|
|
if (isSpeaking) {
|
|
setState3(true);
|
|
r0 = false;
|
|
}
|
|
return r0;
|
|
}, false);
|
|
}
|
|
}, [state, id6]);
|
|
return state ? <SpeakingIndicator {...a0} /> : null;
|
|
});
|
|
__initData9 = {
|
|
code: "function VoicePanelCardTsx9(){const{focused}=this.__closure;var _focused$get;return(_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id;}"
|
|
};
|
|
__initData10 = {
|
|
code: "function VoicePanelCardTsx10(focusedId,previous){const{runOnJS,handleFocusedParticipantChange}=this.__closure;if(focusedId===previous)return;runOnJS(handleFocusedParticipantChange)(focusedId);}"
|
|
};
|
|
__initData11 = {
|
|
code: "function VoicePanelCardTsx11(){const{mode,focused,sharedTransitionState}=this.__closure;return{mode:mode.get(),focused:focused.get(),transitionState:sharedTransitionState.get()};}"
|
|
};
|
|
__initData12 = {
|
|
code: "function VoicePanelCardTsx12(props,previous){const{cheapWorkletShallowEqual,VoicePanelModes,TransitionStates,sharedVisible,isScrollVisible,runOnJS,cleanUp,id}=this.__closure;if(cheapWorkletShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const{mode:mode,focused:focused,transitionState:transitionState}=props;const isPIPMode=mode===VoicePanelModes.PIP;const manuallyFocusedId=focused===null||focused===void 0?void 0:focused.id;if(previous==null&&transitionState!==TransitionStates.YEETED){sharedVisible.set(1);}else if(transitionState===TransitionStates.YEETED){if(sharedVisible.get()===1&&isScrollVisible.get()){sharedVisible.set(0);}else{runOnJS(cleanUp)();}}else if((previous===null||previous===void 0?void 0:previous.transitionState)===TransitionStates.YEETED){sharedVisible.set(1);}else if(!isPIPMode){if(manuallyFocusedId==null){sharedVisible.set(1);}else{if(manuallyFocusedId!==id){sharedVisible.set(0);}else{sharedVisible.set(1);}}}}"
|
|
};
|
|
c11434_47 = {
|
|
isSelf: false,
|
|
hasVideo: false,
|
|
user: {
|
|
id: void 0
|
|
}
|
|
};
|
|
const layoutTransitionFunction2 = function layoutTransitionFunction(a0, a1, r2 = false) {
|
|
const targetOriginX = a0.targetOriginX;
|
|
let r9 = "animate-always";
|
|
const animations = {
|
|
originX: _spring.withSpring(targetOriginX, a1, r2 ? "animate-never" : "animate-always"),
|
|
originY: _spring.withSpring(a0.targetOriginY, a1, r2 ? "animate-never" : "animate-always"),
|
|
width: _spring.withSpring(a0.targetWidth, a1, r2 ? "animate-never" : "animate-always"),
|
|
height: null
|
|
};
|
|
const targetHeight = a0.targetHeight;
|
|
if (r2) {
|
|
r9 = "animate-never";
|
|
}
|
|
animations.height = _spring.withSpring(targetHeight, a1, r9);
|
|
return {
|
|
animations,
|
|
initialValues: {
|
|
originX: a0.currentOriginX,
|
|
originY: a0.currentOriginY,
|
|
width: a0.currentWidth,
|
|
height: a0.currentHeight
|
|
}
|
|
};
|
|
};
|
|
layoutTransitionFunction2.__closure = {
|
|
withSpring: _spring.withSpring
|
|
};
|
|
layoutTransitionFunction2.__workletHash = 4871152530917;
|
|
layoutTransitionFunction2.__initData = {
|
|
code: "function layoutTransitionFunction_VoicePanelCardTsx13(values,physics,disableAnimation=false){const{withSpring}=this.__closure;return{animations:{originX:withSpring(values.targetOriginX,physics,!disableAnimation?'animate-always':'animate-never'),originY:withSpring(values.targetOriginY,physics,!disableAnimation?'animate-always':'animate-never'),width:withSpring(values.targetWidth,physics,!disableAnimation?'animate-always':'animate-never'),height:withSpring(values.targetHeight,physics,!disableAnimation?'animate-always':'animate-never')},initialValues:{originX:values.currentOriginX,originY:values.currentOriginY,width:values.currentWidth,height:values.currentHeight}};}"
|
|
};
|
|
layoutTransitionFunction = layoutTransitionFunction2;
|
|
__initData13 = {
|
|
code: "function VoicePanelCardTsx14(){const{id,pipState,mode,VoicePanelModes}=this.__closure;if(id===pipState.id&&mode.get()===VoicePanelModes.PIP){return true;}return false;}"
|
|
};
|
|
__initData14 = {
|
|
code: "function VoicePanelCardTsx15(){const{focused,id,mode,VoicePanelModes,ScrollPosition}=this.__closure;var _focused$get;return((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id||mode.get()===VoicePanelModes.PIP?ScrollPosition.get():0;}"
|
|
};
|
|
__initData15 = {
|
|
code: "function VoicePanelCardTsx16(){const{connected,EDGE_GUTTER,safeArea,windowDimensions,contentDimensions,wrapperDimensions}=this.__closure;return connected.get()?Math.max(EDGE_GUTTER,safeArea.get().left,(windowDimensions.get().width-contentDimensions.get().width)/2):wrapperDimensions.get().drawerWidth/2;}"
|
|
};
|
|
__initData16 = {
|
|
code: "function VoicePanelCardTsx17(){const{coords,focused,id,isPIP,pipState,getClampedPIPPosition,wrapperDimensions,windowDimensions,safeArea,pipAvoidanceSpecs,derivedScrollValue,xOffset,calculateContentCenterOffset,contentDimensions,sharedTransitionState,TransitionStates,zIndexOverride,computeCardBorderRadius,mode,isSelf,defaultBorderRadius,sharedVisible,isRTCConnected,CONNECTING_OPACITY,wrapperOffset,withDelay,withTiming,ZINDEX_TIMING,OPACITY_TIMING,isScrollVisible,runOnJS,cleanUp,withSpring,layoutPhysics,CARD_SCALE_PHYSICS,SCALE_PHYSICS}=this.__closure;var _focused$get,_focused$get2,_focused$get3,_focused$get4;let{zIndex:zIndex,width:width,height:height,x:x,y:y}=coords.get();const isFocused=((_focused$get=focused.get())===null||_focused$get===void 0?void 0:_focused$get.id)===id;if(isPIP){width=pipState.width;height=pipState.height;const pipHeight=!pipState.showSecondaryPIP?pipState.height:pipState.containerHeight;const pipPosition=getClampedPIPPosition({pipX:wrapperDimensions.get().pipX,pipY:wrapperDimensions.get().pipY,width:width,height:pipHeight,windowDimensions:windowDimensions.get(),safeArea:safeArea.get(),bottomAvoidanceRegion:pipAvoidanceSpecs.get().bottom,topAvoidanceRegion:pipAvoidanceSpecs.get().top});x=pipPosition.x;y=derivedScrollValue.get()+pipPosition.y;}else if(focused.get()!=null){if(isFocused){zIndex=1;width=windowDimensions.get().width;height=windowDimensions.get().height;x=0;y=derivedScrollValue.get();}else{zIndex=0;}}else{x+=xOffset.get();y+=calculateContentCenterOffset({contentHeight:contentDimensions.get().height,windowHeight:windowDimensions.get().height,safeArea:safeArea.get()});if(sharedTransitionState.get()===TransitionStates.YEETED){y+=height/4;}}if(zIndexOverride.get()){zIndex=9001;}const borderRadius=computeCardBorderRadius({id:id,mode:mode.get(),focused:(_focused$get2=focused.get())===null||_focused$get2===void 0?void 0:_focused$get2.id,isSelf:isSelf,defaultBorderRadius:defaultBorderRadius});const opacity=sharedVisible.get()===0&&((_focused$get3=focused.get())===null||_focused$get3===void 0?void 0:_focused$get3.id)!==id?0:!isFocused&&!isRTCConnected?CONNECTING_OPACITY:1;const gestureActive=wrapperOffset.get().gestureActive;const scaleTarget=sharedVisible.get()===1||((_focused$get4=focused.get())===null||_focused$get4===void 0?void 0:_focused$get4.id)===id?1:0.8;return{zIndex:withDelay(zIndexOverride.get()?0:100,withTiming(zIndex,ZINDEX_TIMING)),opacity:withTiming(opacity,OPACITY_TIMING,isScrollVisible.get()?'animate-always':'animate-never',function(finished){if(finished&&sharedVisible.get()===0&&sharedTransitionState.get()===TransitionStates.YEETED){runOnJS(cleanUp)();}}),width:width,height:height,transform:[{translateX:gestureActive?x:withSpring(x,layoutPhysics,'animate-always')},{translateY:gestureActive?y:withSpring(y,layoutPhysics,'animate-always')},{scale:withSpring(scaleTarget,CARD_SCALE_PHYSICS)}],borderRadius:withSpring(borderRadius,SCALE_PHYSICS)};}"
|
|
};
|
|
__initData17 = {
|
|
code: "function VoicePanelCardTsx18(finished){const{sharedVisible,sharedTransitionState,TransitionStates,runOnJS,cleanUp}=this.__closure;if(finished&&sharedVisible.get()===0&&sharedTransitionState.get()===TransitionStates.YEETED){runOnJS(cleanUp)();}}"
|
|
};
|
|
__initData18 = {
|
|
code: "function VoicePanelCardTsx19(values){const{withSpring,layoutPhysics,wrapperOffset}=this.__closure;const initialValues={originX:values.currentOriginX,originY:values.currentOriginY,width:values.currentWidth,height:values.currentHeight};return{animations:{originX:withSpring(values.targetOriginX,layoutPhysics,'animate-always'),originY:withSpring(values.targetOriginY,layoutPhysics,'animate-always'),width:withSpring(values.targetWidth,layoutPhysics,'animate-always'),height:withSpring(values.targetHeight,layoutPhysics,'animate-always')},initialValues:initialValues,callback:function(){const _wrapperOffset=wrapperOffset.get();if(!_wrapperOffset.gestureActive&&_wrapperOffset.y!==0){wrapperOffset.set({gestureActive:false,x:0,y:0});}}};}"
|
|
};
|
|
__initData19 = {
|
|
code: "function VoicePanelCardTsx20(){const{EDGE_GUTTER,coords,ScrollPosition,windowDimensions}=this.__closure;const yPos=EDGE_GUTTER+coords.get().y;return yPos>ScrollPosition.get()-coords.get().height&&yPos<ScrollPosition.get()+windowDimensions.get().height;}"
|
|
};
|
|
__initData20 = {
|
|
code: "function layoutTransition_VoicePanelCardTsx21(values,disableAnimation=false){const{layoutTransitionFunction,physics}=this.__closure;return layoutTransitionFunction(values,physics,disableAnimation);}"
|
|
};
|
|
const r182 = Module19.memo(function VoicePanelCard(props) {
|
|
let r129, r152, r162, derivedValue4, layoutTransition2, physics;
|
|
let sharedValue3, cardLayoutCoordsSubscription;
|
|
const { item, transitionState: transitionState2, cleanUp: cleanUp3 } = props;
|
|
sharedValue3 = void 0;
|
|
cardLayoutCoordsSubscription = void 0;
|
|
const id8 = item.id;
|
|
const context = useContext(VoicePanelStateContext);
|
|
const { channelId: channelId2, focused: focused5, guildId: guildId2 } = context;
|
|
let isCall = context.isCall;
|
|
const { layoutManager, mountedCards, ScrollPosition: scrollPosition2, windowDimensions: windowDimensions2 } = context;
|
|
const stableParticipant = useStableParticipant(id8, channelId2, guildId2);
|
|
const r48 = isStableParticipantWithUser(stableParticipant) ? stableParticipant : c11434_47;
|
|
const isSelf3 = r48.isSelf;
|
|
const id7 = r48.user.id;
|
|
const stateFromStores = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.isConnected());
|
|
const isRinging2 = isStableUserParticipant(stableParticipant) && stableParticipant.ringing;
|
|
const r58 = stableParticipant != null ? "user" in stableParticipant ? stableParticipant.user.id : "" : "";
|
|
const videoStreamError = useVideoStreamError(stableParticipant?.type === ParticipantTypes.STREAM ? MediaEngineContextTypes.STREAM : MediaEngineContextTypes.DEFAULT, r58);
|
|
const cameraEncodeError = useCameraEncodeError(r58);
|
|
const sharedValue4 = useSharedValue(transitionState2 !== _TransitionGroup.TransitionStates.MOUNTED ? mountedCards.has(id8) ? 1 : 0 : 1);
|
|
const r90 = id7 != null && SpeakingStore.isSpeaking(id7);
|
|
L50: {
|
|
sharedValue3 = useSharedValue(r90);
|
|
useLayoutEffect(() => {
|
|
const handleChange2 = function handleChange() {
|
|
sharedValue3.set(id7 != null && SpeakingStore.isSpeaking(id7));
|
|
};
|
|
sharedValue3.set(id7 != null && SpeakingStore.isSpeaking(id7));
|
|
SpeakingStore.addReactChangeListener(handleChange2);
|
|
return () => {
|
|
SpeakingStore.removeReactChangeListener(handleChange2);
|
|
};
|
|
}, [id7, sharedValue3]);
|
|
cardLayoutCoordsSubscription = useCardLayoutCoordsSubscription(id8, layoutManager);
|
|
const U = function U() {
|
|
const r11 = EDGE_GUTTER + cardLayoutCoordsSubscription.get().y;
|
|
return r11 > scrollPosition2.get() - cardLayoutCoordsSubscription.get().height && r11 < scrollPosition2.get() + windowDimensions2.get().height;
|
|
};
|
|
U.__closure = {
|
|
EDGE_GUTTER,
|
|
coords: cardLayoutCoordsSubscription,
|
|
ScrollPosition: scrollPosition2,
|
|
windowDimensions: windowDimensions2
|
|
};
|
|
U.__workletHash = 16772493240559;
|
|
U.__initData = __initData19;
|
|
derivedValue4 = useDerivedValue(U);
|
|
const memo = useMemo(() => {
|
|
const physics = {
|
|
mass: MODE_CHANGE_PHYSICS.mass,
|
|
damping: getRandomNumberInRange(MODE_CHANGE_PHYSICS.damping - 2, MODE_CHANGE_PHYSICS.damping + 2),
|
|
stiffness: getRandomNumberInRange(MODE_CHANGE_PHYSICS.stiffness - 20, MODE_CHANGE_PHYSICS.stiffness + 20)
|
|
};
|
|
let c28191_0 = physics;
|
|
const layoutTransition = function layoutTransition(a0, r5 = false) {
|
|
return layoutTransitionFunction(a0, c28191_0, r5);
|
|
};
|
|
layoutTransition.__closure = {
|
|
layoutTransitionFunction,
|
|
physics
|
|
};
|
|
layoutTransition.__workletHash = 12472306522220;
|
|
layoutTransition.__initData = __initData20;
|
|
return {
|
|
physics,
|
|
layoutTransition
|
|
};
|
|
}, []);
|
|
physics = memo.physics;
|
|
layoutTransition2 = memo.layoutTransition;
|
|
if (item.type === VoicePanelCardItemType.CTA) {
|
|
const id10 = item.id;
|
|
if (VoicePanelCTACard.NO_VIDEO_PARTICIPANTS === id10) {
|
|
r129 = <VoicePanelNoVideoParticipantsCard />;
|
|
break L50;
|
|
}
|
|
if (VoicePanelCTACard.CALLER_DISCONNECTED === id10) {
|
|
r129 = <VoicePanelCTACardCallerDisconnected />;
|
|
break L50;
|
|
}
|
|
} else if (stableParticipant != null) {
|
|
item.type;
|
|
const type = stableParticipant.type;
|
|
if (ParticipantTypes.USER === type) {
|
|
const id9 = stableParticipant.id;
|
|
let streamId = stableParticipant.streamId;
|
|
const { user, hasVideo, canRenderVideo } = stableParticipant;
|
|
if (hasVideo && (stateFromStores && canRenderVideo)) {
|
|
if (videoStreamError != null && cameraEncodeError == null) {
|
|
r162 = <UserVideoFailed avError={videoStreamError} removeSplashImage={focused5.get()?.id !== id9} userId={user.id} style={StyleSheet.absoluteFill} />;
|
|
} else {
|
|
if (streamId == null) {
|
|
streamId = null;
|
|
}
|
|
const videoSpinnerContext = isSelf3 ? VideoSpinnerContext.SELF_VIDEO : VideoSpinnerContext.REMOTE_VIDEO;
|
|
if (isCall) {
|
|
isCall = !isSelf3;
|
|
}
|
|
r162 = <VoicePanelVideoRenderer id={id9} userId={user.id} streamId={streamId} isScrollVisible={derivedValue4} videoSpinnerContext={videoSpinnerContext} sharedCoords={cardLayoutCoordsSubscription} isCamera focusOnReady={isCall} layout={layoutTransition2} />;
|
|
}
|
|
r152 = r162;
|
|
} else {
|
|
const props2 = {
|
|
isRinging: isRinging2,
|
|
avatarURI: user.getAvatarURL(guildId2, 80, false),
|
|
avatarDecoration: null,
|
|
layout: null,
|
|
layoutPhysics: null,
|
|
userId: null,
|
|
guildId: null
|
|
};
|
|
let userAvatarDecoration = stableParticipant.userAvatarDecoration;
|
|
if (userAvatarDecoration == null) {
|
|
userAvatarDecoration = void 0;
|
|
}
|
|
props2.avatarDecoration = userAvatarDecoration;
|
|
props2.layout = layoutTransition2;
|
|
props2.layoutPhysics = physics;
|
|
props2.userId = user.id;
|
|
props2.guildId = guildId2;
|
|
r152 = <AnimatedUserCardInner {...props2} />;
|
|
}
|
|
r129 = r152;
|
|
break L50;
|
|
}
|
|
if (ParticipantTypes.STREAM === type) {
|
|
r129 = <Component userId={stableParticipant.user.id} id={stableParticipant.id} streamGuildId={stableParticipant.streamGuildId} streamId={stableParticipant.streamId} userNick={stableParticipant.userNick} isSelf={isSelf3} sharedCoords={cardLayoutCoordsSubscription} isScrollVisible={derivedValue4} layout={layoutTransition2} />;
|
|
break L50;
|
|
}
|
|
if (ParticipantTypes.ACTIVITY === type) {
|
|
r129 = <VoicePanelAnimatedActivityCard key={stableParticipant.id} sharedVisible={sharedValue4} applicationId={stableParticipant.applicationId} layout={layoutTransition2} />;
|
|
break L50;
|
|
}
|
|
}
|
|
r129 = <AnimatedUserCardInner isRinging={isRinging2} avatarURI={void 0} avatarDecoration={void 0} layout={layoutTransition2} layoutPhysics={physics} />;
|
|
}
|
|
return <AnimatedWrapper cleanUp={cleanUp3} coords={cardLayoutCoordsSubscription} id={id8} isRTCConnected={stateFromStores} isScrollVisible={derivedValue4} layoutPhysics={physics} transitionState={transitionState2} sharedVisible={sharedValue4}>
|
|
{r129}
|
|
{stableParticipant != null && <VoicePanelCardFloatingControls isRinging={isRinging2} participant={stableParticipant} label={isStableParticipantWithUser(stableParticipant) ? stableParticipant.userNick : void 0} layout={layoutTransition2} speaking={sharedValue3} />}
|
|
{isStableParticipantWithUser(stableParticipant) && <Component2 speaking={sharedValue3} id={id8} isSelf={isSelf3} layout={layoutTransition2} />}
|
|
</AnimatedWrapper>;
|
|
});
|
|
export default r182;
|