This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,15 @@
// Metro module 4257 (f4258).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-07-autoclipping-default-override",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export { apexExperiment as AutoclippingDefaultOverrideExperiment };
+213
View File
@@ -0,0 +1,213 @@
// Metro module 6026 (f6027).
import ApplicationStreamingSettingsStore from "../../stores/ApplicationStreamingSettingsStore";
import ApplicationStreamingStore from "../../stores/ApplicationStreamingStore";
import StreamRTCConnectionStore from "../../stores/StreamRTCConnectionStore";
import ClipsStore from "./ClipsStore";
import { ClipSignalTypes } from "./ClipsTypes";
import { getClipsRuntime } from "./ClipsV3RuntimeExperiment";
import { encodeStreamKey } from "../go_live/utils/StreamKeyUtils";
import { parseEncoder, Encoders } from "../../lib/VideoQualityStats";
const getClipBaseProperties = function getClipBaseProperties(a0) {
let clip_type;
const decision = a0.decision;
const r6 = decision == null ? void 0 : decision.signal?.type;
L9: {
const MANUAL = ClipSignalTypes.MANUAL;
clip_type = "manual";
if (MANUAL !== r6) {
const DISTRIBUTED = ClipSignalTypes.DISTRIBUTED;
clip_type = "distributed";
if (DISTRIBUTED !== r6) {
if (ClipSignalTypes.LAUGHTER !== r6 && ClipSignalTypes.SHOUTING !== r6) {
const GAME_EVENT = ClipSignalTypes.GAME_EVENT;
clip_type = "unknown";
if (GAME_EVENT !== r6) {
break L9;
}
}
clip_type = "auto_ml";
}
}
}
return {
clip_type,
num_clip_participants: a0.users.length,
clip_session_id: a0.gameSessionId,
is_candidate: a0.isCandidate
};
};
export function getClipType({ decision }) {
const r4 = decision == null ? void 0 : decision.signal?.type;
if (ClipSignalTypes.MANUAL === r4) {
return "manual";
}
if (ClipSignalTypes.DISTRIBUTED === r4) {
return "distributed";
}
if (ClipSignalTypes.LAUGHTER !== r4 && ClipSignalTypes.SHOUTING !== r4 && ClipSignalTypes.GAME_EVENT !== r4) {
return "unknown";
}
return "auto_ml";
}
export { getClipBaseProperties };
export function getClipContextProperties(a0) {
return {
clip_runtime: getClipsRuntime(a0),
current_clip_session_id: ClipsStore.getCurrentClipsSession()?.id
};
}
export function getClipSignalTypes(a0) {
const r0 = [];
for (const item of a0.timeline) {
const type = item.signal.type;
if (ClipSignalTypes.MANUAL === type) {
r0.push("manual");
} else if (ClipSignalTypes.DISTRIBUTED === type) {
r0.push("distributed");
} else if (ClipSignalTypes.LAUGHTER === type) {
r0.push("laughter");
} else if (ClipSignalTypes.SHOUTING === type) {
r0.push("shouting");
} else if (ClipSignalTypes.GAME_EVENT === type) {
r0.push(`game_event:${item.signal.eventType}`);
}
}
return r0;
}
export function getPreSaveClipAnalytics(a0) {
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
const r6 = currentUserActiveStream != null ? StreamRTCConnectionStore.getRTCConnection(encodeStreamKey(currentUserActiveStream)) : null;
const r21 = {
...getClipBaseProperties(a0),
...{
clip_runtime: getClipsRuntime("getPreSaveClipAnalytics"),
current_clip_session_id: ClipsStore.getCurrentClipsSession()?.id
},
rtc_connection_id: r6 == null ? void 0 : r6.getRTCConnectionId(),
media_session_id: r6 == null ? void 0 : r6.getMediaSessionId(),
parent_media_session_id: r6?.parentMediaSessionId,
guild_id: a0.guildId,
channel_id: a0.channelId,
application_id: a0.applicationId,
application_name: a0.applicationName,
clip_uuid: a0.id,
clip_event_timeline_size: a0.timeline.length
};
return r21;
}
export function getPostSaveClipAnalytics(a0, a1) {
const map = new Map();
const framesEncodedByEncoder = a1.framesEncodedByEncoder;
for (const key in framesEncodedByEncoder) {
const r14 = a1.framesEncodedByEncoder[key];
const r26 = parseEncoder(key);
let r28 = map.get(r26);
if (r28 == null) {
r28 = 0;
}
map.set(r26, r28 + r14);
}
let frames_encoded_nvidia_cuda = map.get(Encoders.NVIDIA_CUDA);
if (frames_encoded_nvidia_cuda == null) {
frames_encoded_nvidia_cuda = 0;
}
let frames_encoded_nvidia_direct3d = map.get(Encoders.NVIDIA_DIRECT_3D);
if (frames_encoded_nvidia_direct3d == null) {
frames_encoded_nvidia_direct3d = 0;
}
let frames_encoded_openh264 = map.get(Encoders.OPENH264);
if (frames_encoded_openh264 == null) {
frames_encoded_openh264 = 0;
}
let frames_encoded_videotoolbox = map.get(Encoders.VIDEOTOOLBOX);
if (frames_encoded_videotoolbox == null) {
frames_encoded_videotoolbox = 0;
}
let frames_encoded_amd_direct3d = map.get(Encoders.AMD_DIRECT_3D);
if (frames_encoded_amd_direct3d == null) {
frames_encoded_amd_direct3d = 0;
}
let frames_encoded_amd_vaapi = map.get(Encoders.AMD_VAAPI);
if (frames_encoded_amd_vaapi == null) {
frames_encoded_amd_vaapi = 0;
}
let frames_encoded_intel = map.get(Encoders.INTEL);
if (frames_encoded_intel == null) {
frames_encoded_intel = 0;
}
let frames_encoded_intel_direct3d = map.get(Encoders.INTEL_DIRECT_3D);
if (frames_encoded_intel_direct3d == null) {
frames_encoded_intel_direct3d = 0;
}
let frames_encoded_wmf_direct3d_intel = map.get(Encoders.WMF_DIRECT_3D_INTEL);
if (frames_encoded_wmf_direct3d_intel == null) {
frames_encoded_wmf_direct3d_intel = 0;
}
let frames_encoded_wmf_direct3d_nvidia = map.get(Encoders.WMF_DIRECT_3D_NVIDIA);
if (frames_encoded_wmf_direct3d_nvidia == null) {
frames_encoded_wmf_direct3d_nvidia = 0;
}
let frames_encoded_wmf_direct3d_amd = map.get(Encoders.WMF_DIRECT_3D_AMD);
if (frames_encoded_wmf_direct3d_amd == null) {
frames_encoded_wmf_direct3d_amd = 0;
}
let r107 = map.get(Encoders.WMF_DIRECT_3D);
if (r107 == null) {
r107 = 0;
}
let r113 = map.get(Encoders.WMF_DIRECT_3D_INTEL);
if (r113 == null) {
r113 = 0;
}
const r114 = r107 + r113;
let r120 = map.get(Encoders.WMF_DIRECT_3D_NVIDIA);
if (r120 == null) {
r120 = 0;
}
const r121 = r114 + r120;
let r127 = map.get(Encoders.WMF_DIRECT_3D_AMD);
if (r127 == null) {
r127 = 0;
}
let frames_encoded_uncategorized = map.get(Encoders.UNCATEGORIZED);
if (frames_encoded_uncategorized == null) {
frames_encoded_uncategorized = 0;
}
let frames_encoded_unknown = map.get(Encoders.UNKNOWN);
if (frames_encoded_unknown == null) {
frames_encoded_unknown = 0;
}
return {
...a0,
frames_encoded_nvidia_cuda,
frames_encoded_nvidia_direct3d,
frames_encoded_openh264,
frames_encoded_videotoolbox,
frames_encoded_amd_direct3d,
frames_encoded_amd_vaapi,
frames_encoded_intel,
frames_encoded_intel_direct3d,
frames_encoded_wmf_direct3d_intel,
frames_encoded_wmf_direct3d_nvidia,
frames_encoded_wmf_direct3d_amd,
frames_encoded_wmf_direct3d: r121 + r127,
frames_encoded_uncategorized,
frames_encoded_unknown,
frames_submitted: a1.framesSubmitted,
frames_submitted_during_clip: a1.framesSubmittedDuringClip,
frames_encoded: a1.framesEncoded,
frames_encoded_during_clip: a1.framesEncodedDuringClip,
frames_dropped: a1.framesDropped,
frames_dropped_during_clip: a1.framesDroppedDuringClip,
clip_duration_setting: ClipsStore.getSettings().clipsLength,
clip_duration: a1.clipDuration,
clip_resolution_width: a1.clipResolutionWidth,
clip_resolution_height: a1.clipResolutionHeight,
min_fps: a1.minFps,
max_fps: a1.maxFps,
submitted_fps: a1.submittedFps,
target_fps: ApplicationStreamingSettingsStore.getState().fps,
audio_track_count: a1.audioTrackCount,
saved_at: a1.savedAt
};
}
+132
View File
@@ -0,0 +1,132 @@
// Metro module 2125 (f2126).
import { loadJsonAsset } from "../asset_json/native/AssetJsonUtils";
import * as _Module2126 from "../../_bundle/Module2126";
import * as _Module2127 from "../../_bundle/Module2127";
import * as _Module2128 from "../../_bundle/Module2128";
import * as _Module2129 from "../../_bundle/Module2129";
import * as _Module2130 from "../../_bundle/Module2130";
import * as _Module2131 from "../../_bundle/Module2131";
import * as _Module2132 from "../../_bundle/Module2132";
import * as _Module2133 from "../../_bundle/Module2133";
import * as _Module2134 from "../../_bundle/Module2134";
import * as _Module2135 from "../../_bundle/Module2135";
import * as _Module2136 from "../../_bundle/Module2136";
import * as _Module2137 from "../../_bundle/Module2137";
import * as _Module2138 from "../../_bundle/Module2138";
import * as _Module2139 from "../../_bundle/Module2139";
import * as _Module2140 from "../../_bundle/Module2140";
import * as _Module2141 from "../../_bundle/Module2141";
import * as _Module2142 from "../../_bundle/Module2142";
import * as _Module2143 from "../../_bundle/Module2143";
import * as _Module2144 from "../../_bundle/Module2144";
import * as _Module2145 from "../../_bundle/Module2145";
import * as _Module2146 from "../../_bundle/Module2146";
import * as _Module2147 from "../../_bundle/Module2147";
import * as _Module2148 from "../../_bundle/Module2148";
import * as _Module2149 from "../../_bundle/Module2149";
import * as _Module2150 from "../../_bundle/Module2150";
import * as _Module2151 from "../../_bundle/Module2151";
import * as _Module2152 from "../../_bundle/Module2152";
import * as _Module2153 from "../../_bundle/Module2153";
import * as _Module2154 from "../../_bundle/Module2154";
import * as _Module2155 from "../../_bundle/Module2155";
import * as _Module2156 from "../../_bundle/Module2156";
import { createLoader, makeMessagesProxy } from "../../_bundle/Module1274";
const loader = createLoader({
bg: () => loadJsonAsset(_Module2126).then((result) => ({
default: result
})),
cs: () => loadJsonAsset(_Module2127).then((result) => ({
default: result
})),
da: () => loadJsonAsset(_Module2128).then((result) => ({
default: result
})),
de: () => loadJsonAsset(_Module2129).then((result) => ({
default: result
})),
el: () => loadJsonAsset(_Module2130).then((result) => ({
default: result
})),
"en-GB": () => loadJsonAsset(_Module2131).then((result) => ({
default: result
})),
"es-419": () => loadJsonAsset(_Module2132).then((result) => ({
default: result
})),
"es-ES": () => loadJsonAsset(_Module2133).then((result) => ({
default: result
})),
fi: () => loadJsonAsset(_Module2134).then((result) => ({
default: result
})),
fr: () => loadJsonAsset(_Module2135).then((result) => ({
default: result
})),
hi: () => loadJsonAsset(_Module2136).then((result) => ({
default: result
})),
hr: () => loadJsonAsset(_Module2137).then((result) => ({
default: result
})),
hu: () => loadJsonAsset(_Module2138).then((result) => ({
default: result
})),
it: () => loadJsonAsset(_Module2139).then((result) => ({
default: result
})),
ja: () => loadJsonAsset(_Module2140).then((result) => ({
default: result
})),
ko: () => loadJsonAsset(_Module2141).then((result) => ({
default: result
})),
lt: () => loadJsonAsset(_Module2142).then((result) => ({
default: result
})),
nl: () => loadJsonAsset(_Module2143).then((result) => ({
default: result
})),
no: () => loadJsonAsset(_Module2144).then((result) => ({
default: result
})),
pl: () => loadJsonAsset(_Module2145).then((result) => ({
default: result
})),
"pt-BR": () => loadJsonAsset(_Module2146).then((result) => ({
default: result
})),
ro: () => loadJsonAsset(_Module2147).then((result) => ({
default: result
})),
ru: () => loadJsonAsset(_Module2148).then((result) => ({
default: result
})),
"sv-SE": () => loadJsonAsset(_Module2149).then((result) => ({
default: result
})),
th: () => loadJsonAsset(_Module2150).then((result) => ({
default: result
})),
tr: () => loadJsonAsset(_Module2151).then((result) => ({
default: result
})),
uk: () => loadJsonAsset(_Module2152).then((result) => ({
default: result
})),
vi: () => loadJsonAsset(_Module2153).then((result) => ({
default: result
})),
"zh-CN": () => loadJsonAsset(_Module2154).then((result) => ({
default: result
})),
"zh-TW": () => loadJsonAsset(_Module2155).then((result) => ({
default: result
})),
"en-US": () => loadJsonAsset(_Module2156).then((result) => ({
default: result
}))
}, "en-US");
const r51 = makeMessagesProxy(loader);
export default r51;
export { loader as messagesLoader };
+87
View File
@@ -0,0 +1,87 @@
// Metro module 4243 (f4244).
import Durations from "../../utils/Durations";
import Logger from "../debug/Logger";
const SECONDS_30 = 30 * Durations.Millis.SECOND;
const r16 = {
SECONDS_30
};
r16[SECONDS_30] = "SECONDS_30";
const MINUTE = Durations.Millis.MINUTE;
r16.MINUTES_1 = MINUTE;
r16[MINUTE] = "MINUTES_1";
const MINUTES_2 = 2 * Durations.Millis.MINUTE;
r16.MINUTES_2 = MINUTES_2;
r16[MINUTES_2] = "MINUTES_2";
const r15 = {
ALL: 0,
0: "ALL",
FRIENDS: 1,
1: "FRIENDS"
};
const r14 = {
DECOUPLED: "decoupled",
VIEWER: "viewer",
STREAMER: "streamer",
VOICE: "voice"
};
const r49 = {
Error: 0,
0: "Error",
Disabled: 1,
1: "Disabled",
Enabled: 2,
2: "Enabled"
};
const r7 = 6 * Durations.Millis.SECOND;
const logger = new Logger("Clips");
const r5 = 60 * Durations.Millis.SECOND;
const r70 = 14 * Durations.Millis.DAY;
const r71 = {
ALL: ":all",
APPLICATION: ":application",
VOICE: ":voice",
SOUNDBOARD: ":soundboard"
};
export { r16 as ClipsLengthSettings };
export { r15 as ClipsViewerConnectivitySettings };
export { r14 as ClipSaveTypes };
export { r49 as ClipsUserEducationType };
export const DEFAULT_SAVE_CLIP_KEYBIND = "alt+c";
export const DEFAULT_SAVE_SCREENSHOT_KEYBIND = "f12";
export { r7 as CLIPS_TOAST_DURATION };
export { logger as ClipsLogger };
export const CURRENT_CLIP_METADATA_VERSION = 6;
export const CLIPS_HARDWARE_CLASSIFICATION_VERSION = 2;
export const WINDOWS_HARDWARE_MINIMUM_GPU_REGEX = /(NVIDIA GeForce GTX (98|10|16).*|Radeon RX 5(500|600|).*|Radeon RX5.*)/;
export const WINDOWS_HARDWARE_AUTO_ENABLE_GPU_REGEX = /(NVIDIA GeForce (RTX (20|30|40|50).*))|(.*Radeon RX (57|58|59|6|7|9).*)/;
export const MIN_CLIP_DURATION_SECONDS = 0.1;
export const CLIP_NAME_MIN_CHAR_LENGTH = 0;
export const CLIP_NAME_MAX_CHAR_LENGTH = 200;
export const CLIPS_EDIT_MODAL_KEY = "clips-edit";
export const CLIPS_GALLERY_MODAL_KEY = "clips-gallery";
export const CLIPS_QOE_LOCATION = "clips_player";
export const CLIPS_THUMBNAIL_MAX_WIDTH = 640;
export const CLIPS_THUMBNAIL_MAX_HEIGHT = 360;
export const CLIPS_MAX_PARTICIPANTS = 100;
export const CLIPS_MAX_TIMELINE_EVENTS = 1000;
export const CLIPS_TIMELINE_BUFFER_MS = 500;
export const CLIP_NAME_TEMPLATE = (a0) => `Clip - ${new Date(a0).toLocaleString()}`;
export const MAX_SIMULTANEOUS_SAVE_CLIP_OPERATIONS = 15;
export { r5 as CLIPS_SAVE_TIMEOUT_WARN_MS };
export const CLIPS_RUNNING_GAME_CHANGE_CLIPS_INIT_DELAY = 30000;
export const SEEK_DENOMINATOR = 30;
export const SEEK_SHIFT_MODIFIER = 10;
export { r70 as CLIPS_EDUCATION_COOLDOWN };
export const CLIPS_EDUCATION_GAME_LAUNCH_THRESHOLD = 5;
export const CLIPS_EDUCATION_MAX_DISMISSALS_ENABLED = 5;
export const CLIPS_EDUCATION_MAX_DISMISSALS_DISABLED = 1;
export const DEFAULT_MAX_AUTO_CLIPS = 20;
export const MIN_MAX_AUTO_CLIPS = 1;
export const MAX_MAX_AUTO_CLIPS = 50;
export const MIN_CLIPS_BITRATE_PERCENT = 10;
export const MAX_CLIPS_BITRATE_PERCENT = 100;
export const DEFAULT_CLIPS_BITRATE_PERCENT = 75;
export const BYTES_PER_GB = 1073741824;
export const MAX_TRANSIENT_STORAGE_BYTES = 16106127360;
export const TRANSIENT_AUTOCLIP_DIRNAME = ".autoclip-cache";
export { r71 as ClipsTrackSuffixes };
+56
View File
@@ -0,0 +1,56 @@
// Metro module 4248 (f4249).
import MediaEngineStore from "../../stores/MediaEngineStore";
import UserStore from "../../stores/UserStore";
import { PremiumTypes } from "../premium/PremiumConstants";
import { createApexExperiment } from "../experiments/apex/index";
import isClientClipsCapable from "./isClientClipsCapable";
import { useStateFromStores } from "../../_bundle/Module589";
import PremiumUtils from "../../utils/PremiumUtils";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-03-clips-experiment",
defaultConfig: {
enableClips: false,
ignorePlatformRestriction: false
},
variations: {
1: {
enableClips: true,
ignorePlatformRestriction: false
},
2: {
enableClips: true,
ignorePlatformRestriction: true
}
}
});
export { apexExperiment as ClipsExperiment };
export function areClipsAvailable() {
if (isClientClipsCapable(MediaEngineStore)) {
let r20 = PremiumUtils.isPremiumAtLeast(UserStore.getCurrentUser()?.premiumType, PremiumTypes.TIER_2);
const enableClips = apexExperiment.getConfig({
location: "areClipsEnabled"
}).enableClips;
if (!r20) {
r20 = enableClips;
}
return r20;
}
return false;
}
export function useIsClipsAvailable() {
const isClientClipsCapable2 = isClientClipsCapable(MediaEngineStore);
const stateFromStores = useStateFromStores([UserStore], () => PremiumUtils.isPremiumAtLeast(UserStore.getCurrentUser()?.premiumType, PremiumTypes.TIER_2));
return (apexExperiment.getConfig({
location: "useEnableClips"
}).enableClips || stateFromStores) && isClientClipsCapable2;
}
export function isUserPremiumTypeForClipsEarlyAccess(a0) {
return PremiumUtils.isPremiumAtLeast(a0?.premiumType, PremiumTypes.TIER_2);
}
export function isScreenshotKeybindEnabled() {
return false;
}
export function useScreenshotKeybindEnabled() {
return false;
}
+264
View File
@@ -0,0 +1,264 @@
// Metro module 16643 (f16644).
import { getSystemAnalyticsInfo } from "../system_analytics/SystemAnalyticsStore.native";
import AuthenticationStore from "../../stores/AuthenticationStore";
import MediaEngineStore from "../../stores/MediaEngineStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import StreamRTCConnectionStore from "../../stores/StreamRTCConnectionStore";
import ClipsStore from "./ClipsStore";
import { CLIPS_HARDWARE_CLASSIFICATION_VERSION, WINDOWS_HARDWARE_AUTO_ENABLE_GPU_REGEX, WINDOWS_HARDWARE_MINIMUM_GPU_REGEX } from "./ClipsConstants";
import { RTCConnectionStates, AnalyticEvents } from "../../Constants";
import { StreamTypes } from "../go_live/Constants";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
import { areClipsAvailable } from "./ClipsExperiment";
import { MediaEngineContextTypes } from "../../_bundle/Module4286";
import { decodeStreamKey, encodeStreamKey } from "../go_live/utils/StreamKeyUtils";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { getClipsRuntime } from "./ClipsV3RuntimeExperiment";
import { ClipsAllowVoiceRecording } from "../user_settings/UserSettings";
import Dispatcher from "../../Dispatcher";
import isClientClipsCapable from "./isClientClipsCapable";
import DiscordNative from "../../lib/DiscordNative";
import { ClipsHardwareClassification } from "./ClipsTypes";
import { isWindows, isMac } from "../../utils/PlatformUtils";
import { isClipsEnabled } from "./isClipsEnabled";
let c11982_17;
let env11982 = {};
class ClipsManager extends AutomaticLifecycleManager {
actions = {
POST_CONNECTION_OPEN: () => this.handlePostConnectionOpen(),
RTC_CONNECTION_FLAGS: (a0) => this.handleRTCConnectionFlags(a0),
RTC_CONNECTION_USERS_MERGED: (a0) => this.handleRTCUsersUpdate(a0),
CLIPS_INIT_FAILURE: (a0) => this.handleClipsInitFailure(a0),
CLIPS_SETTINGS_UPDATE: (a0) => this.applyNativeClipsSettings(a0),
CLIPS_ALLOW_VOICE_RECORDING_UPDATE: () => this.handleClipsAllowVoiceRecordingUpdate(),
STREAM_START: () => this.applyNativeClipsSettings(),
STREAM_DELETE: (a0) => this.handleStreamEnded(a0),
STREAM_CLOSE: (a0) => this.handleStreamEnded(a0),
RUNNING_GAME_TOGGLE_DETECTION: (a0) => this.handleClipsInitOnToggleDetection(a0),
RUNNING_GAMES_CHANGE: (a0) => this.handleClipsInitOnGamesChange(a0),
CLIPS_RESTART: () => this.fireClipsInitEvent(true),
RTC_CONNECTION_VIDEO: (a0) => this.handleRTCConnectionVideo(a0),
RTC_CONNECTION_STATE: (a0) => this.handleRTCConnectionState(a0)
};
handleRTCConnectionState({ context, state, streamKey }) {
if (areClipsAvailable() && state === RTCConnectionStates.RTC_CONNECTED) {
const id = AuthenticationStore.getId();
if (MediaEngineContextTypes.DEFAULT === context) {
this.applyUserVoiceRecording(id);
this.applyUserSoundboardRecording(id);
} else if (MediaEngineContextTypes.STREAM === context) {
if (streamKey == null) {
return void 0;
}
if (decodeStreamKey(streamKey).ownerId !== id) {
return void 0;
}
const rTCConnection = StreamRTCConnectionStore.getRTCConnection(streamKey);
if (rTCConnection == null) {
return void 0;
}
this.applyStreamRecording(id, rTCConnection);
}
}
}
handleRTCUsersUpdate(a0) {
const userIds = a0.userIds;
if (a0.context === MediaEngineContextTypes.DEFAULT) {
userIds.forEach((userId) => {
this.applyUserVoiceRecording(userId);
this.applyUserSoundboardRecording(userId);
});
}
}
handleRTCConnectionFlags({ userId, channelId, guildId }) {
this.maybeShowClipsWarning(userId);
this.applyUserVoiceRecording(userId);
this.applyUserSoundboardRecording(userId);
const rTCConnection = StreamRTCConnectionStore.getRTCConnection(encodeStreamKey({
streamType: guildId != null ? StreamTypes.GUILD : StreamTypes.CALL,
ownerId: userId,
channelId,
guildId
}));
if (rTCConnection != null) {
this.applyStreamRecording(userId, rTCConnection);
}
}
handleClipsInitFailure(a0) {
AnalyticsUtils.track(AnalyticEvents.CLIPS_INIT_FAILURE, {
application_name: a0.applicationName,
error_message: a0.errMsg,
clip_runtime: getClipsRuntime("handleClipsInitFailure")
});
}
maybeShowClipsWarning(a0) {
const channelId = RTCConnectionStore.getChannelId();
if (channelId != null) {
if (!ClipsStore.getClipsWarningShown(channelId) && a0 !== AuthenticationStore.getId() && ClipsStore.isClipsEnabledForUser(a0) && ClipsAllowVoiceRecording.getSetting()) {
Dispatcher.dispatch({
type: "CLIPS_SHOW_CALL_WARNING",
channelId
});
this.showClipsToast();
}
}
}
handleClipsAllowVoiceRecordingUpdate() {
const userIds = RTCConnectionStore.getUserIds();
if (userIds != null) {
userIds.forEach((userId) => this.maybeShowClipsWarning(userId));
}
}
handlePostConnectionOpen() {
if (isClientClipsCapable(MediaEngineStore)) {
this.applyNativeClipsSettings();
if (areClipsAvailable()) {
this.loadClipsFromStorage();
if (!(ClipsStore.getHardwareClassification() != null && ClipsStore.getHardwareClassificationForDecoupled() != null && ClipsStore.getHardwareClassificationVersion() === CLIPS_HARDWARE_CLASSIFICATION_VERSION)) {
this.classifyHardwareAndTrack().then((result) => {
Dispatcher.dispatch({
type: "CLIPS_CLASSIFY_HARDWARE",
classification: result
});
});
}
}
}
}
loadClipsFromStorage() {}
handleRTCConnectionVideo({ userId, context, channelId, guildId }) {
if (context === MediaEngineContextTypes.STREAM && isClientClipsCapable(MediaEngineStore)) {
const rTCConnection = StreamRTCConnectionStore.getRTCConnection(encodeStreamKey({
streamType: guildId != null ? StreamTypes.GUILD : StreamTypes.CALL,
ownerId: userId,
channelId,
guildId
}));
if (rTCConnection != null) {
this.applyStreamRecording(userId, rTCConnection);
}
}
}
async classifyHardwareAndTrack() {
let r72, UNKNOWN;
let env23360 = {
$parent: env11982
};
env23360[0] = this;
let c28478_0, c28478_1, c28478_2;
let c28478_3 = 0;
const r13 = env23360;
try {
let env31087;
c28478_1 = r13;
const r31 = env31087 = {
$parent: r13
};
c28478_0 = r31;
env31087[0] = void 0;
env31087[1] = void 0;
env31087[2] = void 0;
c28478_3 = 1;
env31087[0] = await (async () => {
let r56;
let c31834_0, c31834_1;
L16: {
let env32079;
c31834_1 = env31087;
const r10 = env32079 = {};
c31834_0 = r10;
env32079[0] = void 0;
env32079[1] = void 0;
env32079[2] = void 0;
env32079[0] = await (0, getSystemAnalyticsInfo)();
if (env32079[0]?.gpus != null) {
const r46 = c31834_1;
env32079[1] = env32079[0].gpus.map((gpu) => gpu.brand).filter((item) => item != null && item !== "");
r56 = {
gpuModels: env32079[1],
classification: r46.$parent[0].classifyHardware(env32079[1])
};
break L16;
}
const systemInfo = await DiscordNative.processUtils.getSystemInfo();
const r86 = c31834_1;
env32079[2] = systemInfo.gpus.map((gpu) => gpu.model);
return {
gpuModels: env32079[2],
classification: r86.$parent[0].classifyHardware(env32079[2])
};
}
return r56;
})();
env31087[1] = env31087[0].gpuModels;
env31087[2] = env31087[0].classification;
AnalyticsUtils.track(AnalyticEvents.CLIPS_HARDWARE_CLASSIFICATION, {
classification: env31087[2],
version: CLIPS_HARDWARE_CLASSIFICATION_VERSION,
gpu_models: env31087[1],
clip_runtime: getClipsRuntime("classifyHardwareAndTrack")
});
r72 = env31087[2];
c28478_3 = 0;
} catch ($e) {
const r29 = $e;
let r8 = r29;
c28478_2 = r29;
if (c28478_3 !== 0) {
while (true) {
try {
c28478_3 = 0;
UNKNOWN = ClipsHardwareClassification.UNKNOWN;
} catch (r77) {
r8 = r77;
c28478_2 = r77;
if (c28478_3 === 0) {
break;
}
continue;
}
return UNKNOWN;
}
}
throw r8;
}
return r72;
}
classifyHardware(a0) {
if (isWindows()) {
const r33 = a0.some((item) => WINDOWS_HARDWARE_AUTO_ENABLE_GPU_REGEX.test(item));
const r36 = a0.some((item) => WINDOWS_HARDWARE_MINIMUM_GPU_REGEX.test(item));
return r33 ? ClipsHardwareClassification.MEETS_AUTO_ENABLE : r36 ? ClipsHardwareClassification.MEETS_MINIMUM : ClipsHardwareClassification.BELOW_MINIMUM;
}
return isMac() ? DiscordNative.app.getAppArch() === "arm64" ? ClipsHardwareClassification.MEETS_AUTO_ENABLE : ClipsHardwareClassification.MEETS_MINIMUM : ClipsHardwareClassification.UNKNOWN;
}
applyUserVoiceRecording(a0) {
if (isClientClipsCapable(MediaEngineStore)) {
const rTCConnection = RTCConnectionStore.getRTCConnection();
if (rTCConnection != null) {
if (a0 !== AuthenticationStore.getId()) {
rTCConnection.setClipRecordUser(a0, "audio", ClipsStore.isVoiceRecordingAllowedForUser(a0));
} else {
rTCConnection.setClipRecordUser(a0, "audio", isClipsEnabled());
}
}
}
}
applyUserSoundboardRecording(a0) {
if (isClientClipsCapable(MediaEngineStore)) {
const rTCConnection = RTCConnectionStore.getRTCConnection();
if (rTCConnection != null) {
rTCConnection.setClipRecordUser(a0, "soundboard", isClipsEnabled());
}
}
}
applyStreamRecording(a0, a1) {
if (isClientClipsCapable(MediaEngineStore) && AuthenticationStore.getId() === a0) {
const isClipsEnabled2 = isClipsEnabled();
a1.setClipRecordUser(a0, "audio", isClipsEnabled2);
a1.setClipRecordUser(a0, "video", isClipsEnabled2);
}
}
}
c11982_17 = ClipsManager;
export default ClipsManager;
@@ -0,0 +1,58 @@
// Metro module 4252 (f4253).
import ClipsStore from "./ClipsStore";
import { createApexExperiment } from "../experiments/apex/index";
import { useIsClipsEnabled } from "./isClipsEnabled";
import { useStateFromStores } from "../../_bundle/Module589";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-06-clips-settings-redesign",
defaultConfig: {
enableRedesign: false
},
variations: {
1: {
enableRedesign: true
}
}
});
export { apexExperiment as ClipsSettingsRedesignExperiment };
export function useIsClipsSettingsRedesignEnabled() {
return apexExperiment.useConfig({
location: "useIsClipsSettingsRedesignEnabled"
}).enableRedesign;
}
export function isClipsSettingsRedesignEnabled() {
return apexExperiment.getConfig({
location: "isClipsSettingsRedesignEnabled"
}).enableRedesign;
}
export function useDisabledWhenClippingOff() {
let enableRedesign = apexExperiment.useConfig({
location: "useIsClipsSettingsRedesignEnabled"
}).enableRedesign;
const isClipsEnabled2 = useIsClipsEnabled();
if (enableRedesign) {
enableRedesign = !isClipsEnabled2;
}
return enableRedesign;
}
export function useDisabledWhenAutoclippingOff() {
let enableRedesign = apexExperiment.useConfig({
location: "useIsClipsSettingsRedesignEnabled"
}).enableRedesign;
let enableRedesign2 = apexExperiment.useConfig({
location: "useIsClipsSettingsRedesignEnabled"
}).enableRedesign;
const isClipsEnabled2 = useIsClipsEnabled();
if (enableRedesign2) {
enableRedesign2 = !isClipsEnabled2;
}
const stateFromStores = useStateFromStores([ClipsStore], () => ClipsStore.getEnableAutoclipping());
if (!enableRedesign2) {
if (enableRedesign) {
enableRedesign = !stateFromStores;
}
enableRedesign2 = enableRedesign;
}
return enableRedesign2;
}
+762
View File
@@ -0,0 +1,762 @@
// Metro module 4242 (f4243).
import RunningGameStore_native from "../game_detection/RunningGameStore.native";
import AuthenticationStore from "../../stores/AuthenticationStore";
import * as _ClipsConstants from "./ClipsConstants";
import { CLIPS_HARDWARE_CLASSIFICATION_VERSION, ClipSaveTypes, ClipsLogger, ClipsUserEducationType, MAX_SIMULTANEOUS_SAVE_CLIP_OPERATIONS } from "./ClipsConstants";
import { VoiceFlags } from "../../Constants";
import * as _StreamSettingsConstants from "../go_live/StreamSettingsConstants";
import DiscordNative from "../../lib/DiscordNative";
import { pathJoin } from "../../utils/PathUtils";
import { ClipsSaveNoOpReason, ClipsHardwareClassification } from "./ClipsTypes";
import Module38 from "../../_bundle/Module38";
import { isClipsEnabled } from "./isClipsEnabled";
import { decodeStreamKey } from "../go_live/utils/StreamKeyUtils";
import { hasFlag } from "../../_bundle/Module1384";
import DistributedClipsExperiment from "./DistributedClipsExperiment";
import { AutoclippingDefaultOverrideExperiment } from "./AutoclippingDefaultOverrideExperiment";
import Module589 from "../../_bundle/Module589";
import * as _MediaEngineStore from "../../stores/MediaEngineStore";
import Dispatcher from "../../Dispatcher";
let c2469_12, c2469_13, c2469_14, c2469_15, c2469_16, c2469_17, c2469_18, channelId, c2469_20, c2469_21, c2469_22, c2469_23, errMsg, c2469_25, enabled, c2469_27, clipsSettings, c2469_29, trackSharedRemoteClipId, c2469_32;
let _migrateDefaultStorage = function _migrateDefaultStorage() {
const r8 = async () => {
let c24993_2;
let c24993_3 = 0;
let c29301_0, c29301_1, c29301_2;
let r10 = "Failed to resolve videos path for default storage migration";
L16: {
L15: {
try {
c29301_0 = void 0;
c29301_1 = void 0;
if (c2469_29.clipsSettings.storageLocation !== c2469_12) {
break L16;
}
if (DiscordNative == null) {
break L16;
}
if (DiscordNative.app != null) {
c24993_3 = 1;
const path = await DiscordNative.app.getPath("videos");
r10 = "Failed to resolve videos path for default storage migration";
c29301_1 = path;
c29301_0 = pathJoin(c29301_1, c2469_13);
c24993_3 = 0;
c2469_29.clipsSettings.storageLocation = c29301_0;
c2469_32.emitChange();
break L15;
}
break L16;
} catch ($e) {
const r30 = $e;
let r7 = r30;
c24993_2 = r30;
if (c24993_3 !== 0) {
while (true) {
try {
const r94 = c24993_2;
c24993_3 = 0;
c29301_2 = r94;
ClipsLogger.error(r10, c29301_2);
const path2 = await DiscordNative.app.getPath("documents");
r10 = "Failed to resolve videos path for default storage migration";
c29301_0 = path2;
c2469_29.clipsSettings.storageLocation = c29301_0;
c2469_32.emitChange();
break L15;
} catch (r90) {
r7 = r90;
c24993_2 = r90;
if (c24993_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
return void 0;
}
};
_migrateDefaultStorage = r8;
return r8.apply(this, arguments);
};
trackSharedRemoteClipId = function trackSharedRemoteClipId(channelId2, attachments, a2) {
if (!DistributedClipsExperiment.getConfig({
location: "trackSharedRemoteClipId"
}).enableDistributedClips) {
return false;
}
if (a2 !== AuthenticationStore.getId()) {
return false;
}
let r37 = false;
for (const item of attachments) {
if (item.clip_remote_id != null) {
const r46 = c2469_27.get(channelId2);
let r47 = r46;
if (r46 == null) {
const set = new Set();
r47 = set;
c2469_27.set(channelId2, set);
}
r47.add(item.clip_remote_id);
r37 = true;
}
}
return r37;
};
const { ClipsLengthSettings, ClipsViewerConnectivitySettings, DEFAULT_MAX_AUTO_CLIPS, DEFAULT_CLIPS_BITRATE_PERCENT } = _ClipsConstants;
const { ApplicationStreamFPS, ApplicationStreamResolutions } = _StreamSettingsConstants;
c2469_12 = "default";
c2469_13 = "Discord Clips";
c2469_14 = {};
c2469_15 = {};
c2469_16 = {};
c2469_17 = [];
c2469_18 = 0;
channelId = null;
c2469_20 = null;
c2469_21 = null;
c2469_22 = {};
c2469_23 = {};
errMsg = null;
c2469_25 = new Set();
enabled = false;
c2469_27 = new Map();
clipsSettings = {
clipsEnabled: false,
storageLocation: "default",
clipsQuality: {
resolution: ApplicationStreamResolutions.RESOLUTION_1080,
frameRate: ApplicationStreamFPS.FPS_30,
bitratePercent: DEFAULT_CLIPS_BITRATE_PERCENT
},
clipsLength: ClipsLengthSettings.SECONDS_30,
remindersEnabled: true,
decoupledClipsEnabled: false,
viewerClipsEnabled: true,
viewerConnectivity: ClipsViewerConnectivitySettings.ALL,
maxAutoClips: DEFAULT_MAX_AUTO_CLIPS,
clipSignals: {
enableDistributedSignals: true,
enableGameSignals: true
},
debugTooltipsEnabled: false,
enableAutoclipping: void 0,
showPovClipsInGallery: false
};
c2469_29 = {
clipsSettings,
hardwareClassification: null,
hardwareClassificationForDecoupled: null,
hardwareClassificationVersion: 0,
newClipIds: [],
hasClips: false,
hasTakenDecoupledClip: false,
clipsEducationState: {
dismissedAt: null,
numberOfGamesLaunchedSinceDismissal: 0,
numberOfTimesDismissed: 0
}
};
class ClipsStoreClass extends Module589.DeviceSettingsStore {
static displayName = "ClipsStore";
static persistKey = "ClipsStore";
static migrations = [(a0) => ({
clipsSettings: a0 == null ? clipsSettings : a0,
newClipsCount: 0
}), (a0) => ({
...a0,
clipsSettings: {
...clipsSettings,
...a0.clipsSettings
}
}), (a0) => {
let newClipIds = a0.newClipIds;
if (newClipIds == null) {
newClipIds = [];
}
return {
...a0,
newClipIds
};
}, (a0) => {
let hardwareClassification = a0.hardwareClassification;
if (hardwareClassification == null) {
hardwareClassification = null;
}
let hardwareClassificationVersion = a0.hardwareClassificationVersion;
if (hardwareClassificationVersion == null) {
hardwareClassificationVersion = 0;
}
return {
...a0,
hardwareClassification,
hardwareClassificationVersion
};
}, (a0) => {
let hasClips2 = a0.hasClips;
if (hasClips2 == null) {
hasClips2 = false;
}
return {
...a0,
hasClips: hasClips2
};
}, (a0) => ({
...a0,
clipsSettings: {
...a0.clipsSettings,
decoupledClipsEnabled: clipsSettings.decoupledClipsEnabled
}
}), (a0) => {
let hardwareClassificationForDecoupled = a0.hardwareClassificationForDecoupled;
if (hardwareClassificationForDecoupled == null) {
hardwareClassificationForDecoupled = null;
}
return {
...a0,
hardwareClassificationForDecoupled
};
}, (a0) => {
const r4 = _MediaEngineStore.default == null ? void 0 : _MediaEngineStore.default.getHardwareEncoding();
return {
...a0,
clipsSettings: {
...a0.clipsSettings,
clipsEnabled: !!r4 && a0.clipsSettings.clipsEnabled,
decoupledClipsEnabled: !!r4 && a0.clipsSettings.decoupledClipsEnabled
}
};
}, (a0) => {
let newClipIds = a0.newClipIds;
if (newClipIds == null) {
newClipIds = [];
}
return {
...a0,
newClipIds,
newClipIDs: void 0
};
}, (a0) => ({
...a0,
clipsSettings: {
...a0.clipsSettings,
clipsQuality: typeof a0.clipsSettings.clipsQuality !== "number" && a0.clipsSettings.clipsQuality != null ? a0.clipsSettings.clipsQuality : clipsSettings.clipsQuality
}
}), (a0) => {
let remindersEnabled = a0.clipsSettings.remindersEnabled;
if (remindersEnabled == null) {
remindersEnabled = clipsSettings.remindersEnabled;
}
return {
...a0,
clipsSettings: {
...a0.clipsSettings,
remindersEnabled
}
};
}, (a0) => ({
...a0,
hasTakenDecoupledClip: false,
clipsEducationState: {
dismissedAt: null,
numberOfGamesLaunchedSinceDismissal: 0,
numberOfTimesDismissed: 0
}
}), (a0) => {
let maxAutoClips = a0.clipsSettings.maxAutoClips;
if (maxAutoClips == null) {
maxAutoClips = clipsSettings.maxAutoClips;
}
let clipSignals = a0.clipsSettings.clipSignals;
if (clipSignals == null) {
clipSignals = clipsSettings.clipSignals;
}
return {
...a0,
clipsSettings: {
...a0.clipsSettings,
maxAutoClips,
clipSignals
}
};
}, (a0) => ({
...a0,
clipsSettings: {
...a0.clipsSettings
}
}), (a0) => {
let enableAutoclipping = a0.clipsSettings.enableAutoclipping;
if (enableAutoclipping == null) {
enableAutoclipping = clipsSettings.enableAutoclipping;
}
return {
...a0,
clipsSettings: {
...a0.clipsSettings,
enableAutoclipping
}
};
}, (a0) => {
let showPovClipsInGallery = a0.clipsSettings.showPovClipsInGallery;
if (showPovClipsInGallery == null) {
showPovClipsInGallery = clipsSettings.showPovClipsInGallery;
}
return {
...a0,
clipsSettings: {
...a0.clipsSettings,
showPovClipsInGallery
}
};
}, (a0) => {
let bitratePercent = a0.clipsSettings.clipsQuality.bitratePercent;
if (bitratePercent == null) {
bitratePercent = clipsSettings.clipsQuality.bitratePercent;
}
return {
...a0,
clipsSettings: {
...a0.clipsSettings,
clipsQuality: {
...a0.clipsSettings.clipsQuality,
bitratePercent
}
}
};
}];
initialize(a0) {
if (a0 != null) {
c2469_29 = a0;
}
(function migrateDefaultStorage() {
return _migrateDefaultStorage.apply(this, arguments);
})();
this.waitFor(RunningGameStore_native);
}
getClips() {
return c2469_14;
}
getClipById(a0) {
return c2469_14[a0];
}
getClipByRemoteId(a0) {
const r4 = c2469_16[a0];
if (r4 != null) {
return c2469_14[r4];
}
}
getClipCandidates() {
return c2469_17;
}
getClipCandidateById(a0) {
return c2469_15[a0];
}
getUserAgnosticState() {
return c2469_29;
}
getSettings() {
return c2469_29.clipsSettings;
}
getEnableAutoclipping() {
let enableAutoclipping = c2469_29.clipsSettings.enableAutoclipping;
if (enableAutoclipping == null) {
enableAutoclipping = AutoclippingDefaultOverrideExperiment.getConfig({
location: "getAutoclippingDefault"
}).enabled;
}
return enableAutoclipping;
}
hasUserSetAutoclippingSettings() {
return c2469_29.clipsSettings.enableAutoclipping != null;
}
getLastClipsSession() {
return c2469_20;
}
getCurrentClipsSession() {
return c2469_21;
}
getHistoricalClipsSessionById(a0) {
return c2469_22[a0];
}
devSetLastClipsSession(a0) {
c2469_20 = a0;
this.emitChange();
}
getClipsWarningShown(a0) {
return channelId === a0;
}
getHardwareClassification() {
return c2469_29.hardwareClassification;
}
getHardwareClassificationForDecoupled() {
return c2469_29.hardwareClassificationForDecoupled;
}
getHardwareClassificationVersion() {
return c2469_29.hardwareClassificationVersion;
}
getIsAtMaxSaveClipOperations() {
return c2469_18 >= MAX_SIMULTANEOUS_SAVE_CLIP_OPERATIONS;
}
getLastClipsError() {
return errMsg;
}
isClipsEnabledForUser(a0) {
let r6 = c2469_23[a0]?.clipsEnabled;
if (r6 == null) {
r6 = false;
}
return r6;
}
isVoiceRecordingAllowedForUser(a0) {
let r6 = c2469_23[a0]?.allowVoiceRecording;
if (r6 == null) {
r6 = false;
}
return r6;
}
isViewerClippingAllowedForUser(a0) {
let r6 = c2469_23[a0]?.allowAnyViewerClips;
if (r6 == null) {
r6 = false;
}
return r6;
}
hasClips() {
return c2469_29.hasClips;
}
hasTakenDecoupledClip() {
return c2469_29.hasTakenDecoupledClip;
}
canShowReminders() {
return c2469_29.clipsSettings.remindersEnabled;
}
getNewClipIds() {
return c2469_29.newClipIds;
}
isClipExporting(a0) {
return c2469_25.has(a0);
}
getExportingClipIds() {
return c2469_25;
}
isAutoStashEnabled() {
return enabled;
}
wasClipSharedInChannel(a0, a1) {
const r5 = c2469_27.get(a1);
let r7 = r5 == null ? void 0 : r5.has(a0);
if (r7 == null) {
r7 = false;
}
return r7;
}
}
c2469_32 = new ClipsStoreClass(Dispatcher, {
CLIPS_SETTINGS_UPDATE: function handleSettingsUpdate(a0) {
c2469_29 = {
...c2469_29,
clipsSettings: {
...c2469_29.clipsSettings,
...a0.settings
}
};
},
CLIPS_SAVE_CLIP: function handleSaveClip({ clip: clip2 }) {
c2469_18 = Math.max(c2469_18 - 1, 0);
if (clip2.isCandidate) {
c2469_17 = [clip2, ...c2469_17];
c2469_15[clip2.id] = clip2;
}
if (c2469_21 != null) {
c2469_21 = {
...c2469_21,
manualClipsSaved: c2469_21.manualClipsSaved + (clip2.clipMethod === "manual" ? 1 : 0),
candidateClipsSaved: c2469_21.candidateClipsSaved + (clip2.isCandidate ? 1 : 0)
};
}
if (!clip2.isCandidate) {
let r44 = c2469_20?.newClipIds;
if (r44 == null) {
r44 = [];
}
c2469_20 = {
applicationName: clip2.applicationName,
ended: false,
...c2469_20,
newClipIds: [...r44, clip2.id]
};
let newClipIds = c2469_29.newClipIds;
if (newClipIds == null) {
newClipIds = [];
}
c2469_29 = {
...c2469_29,
newClipIds: [...newClipIds, clip2.id]
};
c2469_14[clip2.id] = clip2;
if (clip2.remoteClipId != null) {
c2469_16[clip2.remoteClipId] = clip2.id;
}
c2469_29.hasClips = true;
}
},
CLIPS_PROMOTE_CLIP_CANDIDATE: function handlePromoteClipCandidate({ clip }) {
let r12 = c2469_20?.newClipIds;
if (r12 == null) {
r12 = [];
}
c2469_20 = {
applicationName: clip.applicationName,
...c2469_20,
ended: true,
newClipIds: [...r12, clip.id]
};
Module38(c2469_21 != null && c2469_21.id === clip.gameSessionId, "Promoting clip candidates that do not match current autoclip session");
c2469_21 = {
...c2469_21,
candidateClipsPromoted: c2469_21.candidateClipsPromoted + 1
};
let newClipIds = c2469_29.newClipIds;
if (newClipIds == null) {
newClipIds = [];
}
c2469_29 = {
...c2469_29,
newClipIds: [...newClipIds, clip.id]
};
c2469_17 = c2469_17.filter((item) => item.id !== clip.id);
delete c2469_15[clip.id];
c2469_14[clip.id] = clip;
c2469_29.hasClips = true;
},
CLIPS_SAVE_CLIP_START: function handleSaveClipStart({ clipType }) {
c2469_18 = c2469_18 + 1;
c2469_29.hasTakenDecoupledClip = c2469_29.hasTakenDecoupledClip || clipType === ClipSaveTypes.DECOUPLED;
},
CLIPS_SAVE_CLIP_ERROR: function handleSaveClipError() {
c2469_18 = Math.max(c2469_18 - 1, 0);
},
CLIPS_SAVE_CLIP_NO_OP: function handleSaveClipNoOp({ reason }) {
if (!(reason !== ClipsSaveNoOpReason.BUFFER_WARMING_UP && reason !== ClipsSaveNoOpReason.BRIDGE_SHUTDOWN)) {
c2469_18 = Math.max(c2469_18 - 1, 0);
}
},
STREAM_START: function handleStreamStart({ sourceName, pid }) {
if (isClipsEnabled()) {
let applicationName = sourceName;
if (pid != null) {
let r18 = RunningGameStore_native.getGameForPID(pid)?.name;
if (r18 == null) {
r18 = sourceName;
}
applicationName = r18;
}
if (applicationName != null && applicationName !== "") {
c2469_20 = {
applicationName,
newClipIds: [],
ended: false
};
return void 0;
}
return false;
}
return false;
},
STREAM_STOP: function handleStreamStop({ streamKey }) {
let r2 = c2469_20 != null;
if (r2) {
let r21 = decodeStreamKey(streamKey).ownerId === AuthenticationStore.getId();
if (r21) {
c2469_20 = c2469_20.newClipIds.length !== 0 ? {
...c2469_20,
ended: true
} : null;
r21 = void 0;
}
r2 = r21;
}
return r2;
},
CLIPS_CLEAR_LAST_CLIPS_SESSION: function handleClearLastClipsSession() {
if (c2469_20 == null) {
return false;
}
c2469_20 = null;
},
CLIPS_SESSION_START: function handleClipsSessionStart({ sessionId, gameId }) {
if (c2469_21 != null) {
c2469_22[c2469_21.id] = c2469_21;
}
c2469_21 = {
id: sessionId,
gameId,
manualClipsSaved: 0,
candidateClipsSaved: 0,
candidateClipsPromoted: 0
};
},
CLIPS_SESSION_STOP: function handleClipsSessionStop() {
if (c2469_21 == null) {
return false;
}
c2469_22[c2469_21.id] = c2469_21;
c2469_21 = null;
},
CLIPS_CLEAR_NEW_CLIP_IDS: function clearNewClipIds() {
c2469_29.newClipIds = [];
},
CLIPS_REMOVE_SINGLE_NEW_CLIP_ID: function removeSingleNewClipId({ clipId }) {
c2469_29.newClipIds = c2469_29.newClipIds.filter((newClipId) => newClipId !== clipId);
},
CLIPS_LOAD_DIRECTORY_SUCCESS: function handleClipsDirectoryLoaded(a0) {
c2469_14 = {};
c2469_17 = [];
for (const clip2 of a0.clips) {
const r26 = clip2;
if (clip2.isCandidate) {
c2469_15[r26.id] = r26;
c2469_17.push(r26);
} else {
const r8 = c2469_14;
r8[r26.id] = r26;
if (r26.remoteClipId != null) {
c2469_16[r26.remoteClipId] = r26.id;
}
}
}
c2469_29.hasClips = Object.keys(c2469_14).length > 0;
},
CLIPS_DELETE_CLIP: function handleClipsDelete(a0) {
const r10 = c2469_14[a0.id];
c2469_17 = c2469_17.filter((item) => a0.id !== item.id);
delete c2469_15[a0.id];
delete c2469_14[a0.id];
if (r10?.remoteClipId != null) {
delete c2469_16[r10.remoteClipId];
}
c2469_29.hasClips = Object.keys(c2469_14).length > 0;
},
CLIPS_UPDATE_METADATA: function handleClipMetadataUpdate({ clip: clip2 }) {
if (clip2.isCandidate) {
c2469_15[clip2.id] = clip2;
} else {
c2469_14[clip2.id] = clip2;
if (clip2.remoteClipId != null) {
c2469_16[clip2.remoteClipId] = clip2.id;
}
}
},
RTC_CONNECTION_FLAGS: function handleRTCConnectionFlagsUpdate(a0) {
c2469_23[a0.userId] = {
clipsEnabled: hasFlag(a0.flags, VoiceFlags.CLIPS_ENABLED),
allowVoiceRecording: hasFlag(a0.flags, VoiceFlags.ALLOW_VOICE_RECORDING),
allowAnyViewerClips: hasFlag(a0.flags, VoiceFlags.ALLOW_ANY_VIEWER_CLIPS)
};
},
CLIPS_SHOW_CALL_WARNING: function handleShowCallWarning(a0) {
channelId = a0.channelId;
},
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelect(a0) {
if (a0.channelId !== channelId) {
channelId = null;
}
},
CLIPS_CLASSIFY_HARDWARE: function handleClassifyHardware({ classification }) {
const hardwareClassification = c2469_29.hardwareClassification;
c2469_29.hardwareClassificationVersion = CLIPS_HARDWARE_CLASSIFICATION_VERSION;
c2469_29.hardwareClassification = classification;
if (c2469_29.hardwareClassification === ClipsHardwareClassification.MEETS_AUTO_ENABLE && hardwareClassification !== ClipsHardwareClassification.MEETS_AUTO_ENABLE) {
c2469_29.clipsSettings.clipsEnabled = true;
}
const hardwareClassificationForDecoupled = c2469_29.hardwareClassificationForDecoupled;
c2469_29.hardwareClassificationForDecoupled = classification;
if (c2469_29.hardwareClassificationForDecoupled === ClipsHardwareClassification.MEETS_AUTO_ENABLE && hardwareClassificationForDecoupled !== ClipsHardwareClassification.MEETS_AUTO_ENABLE && c2469_29.clipsSettings.clipsEnabled) {
c2469_29.clipsSettings.decoupledClipsEnabled = true;
}
},
CLIPS_INIT: function handleClipsInit({ applicationName }) {
errMsg = null;
if (isClipsEnabled()) {
c2469_20 = {
applicationName,
newClipIds: [],
ended: false
};
return void 0;
}
return false;
},
CLIPS_INIT_FAILURE: function handleClipsInitFailure(a0) {
errMsg = a0.errMsg;
},
CLIPS_DISMISS_EDUCATION: function handleDismissClipsEducation(a0) {
L5: {
const educationType = a0.educationType;
if (ClipsUserEducationType.Error === educationType) {
errMsg = null;
} else {
if (ClipsUserEducationType.Disabled !== educationType && ClipsUserEducationType.Enabled !== educationType) {
break L5;
}
c2469_29.clipsEducationState.dismissedAt = Date.now();
c2469_29.clipsEducationState.numberOfGamesLaunchedSinceDismissal = 0;
const clipsEducationState = c2469_29.clipsEducationState;
clipsEducationState.numberOfTimesDismissed = clipsEducationState.numberOfTimesDismissed + 1;
}
}
},
RUNNING_GAMES_CHANGE: function handleRunningGamesChange(a0) {
if (a0.added.length > 0) {
const clipsEducationState = c2469_29.clipsEducationState;
clipsEducationState.numberOfGamesLaunchedSinceDismissal = clipsEducationState.numberOfGamesLaunchedSinceDismissal + 1;
}
},
CLIPS_SET_EXPORTING: function handleSetExporting({ clipIds }) {
const r8 = Set;
if (clipIds == null) {
clipIds = [];
}
c2469_25 = new r8(clipIds);
},
CLIPS_SET_AUTO_STASH_ENABLED: function handleSetAutoStashEnabled(a0) {
enabled = a0.enabled;
},
MESSAGE_CREATE: function handleMessageCreate(a0) {
const channelId2 = a0.channelId;
let attachments = a0.message.attachments;
if (attachments == null) {
attachments = [];
}
return trackSharedRemoteClipId(channelId2, attachments, a0.message.author?.id);
},
LOAD_MESSAGES_SUCCESS: function handleLoadMessagesSuccess(a0) {
let r0 = false;
for (const message of a0.messages) {
let r33 = r0;
if (!r33) {
const channelId2 = a0.channelId;
let attachments = message.attachments;
if (attachments == null) {
attachments = [];
}
r33 = trackSharedRemoteClipId(channelId2, attachments, message.author?.id);
}
r0 = r33;
}
return r0;
},
LOGOUT: function reset() {
c2469_27.clear();
c2469_20 = null;
channelId = null;
c2469_23 = {};
}
});
export default c2469_32;
export const DEFAULT_STORAGE_SENTINEL = "default";
export const DEFAULT_STORAGE_DIRECTORY = "Discord Clips";
+83
View File
@@ -0,0 +1,83 @@
// Metro module 4246 (f4247).
const r9 = {
MANUAL: "manual",
DISTRIBUTED: "distributed",
SHOUTING: "shouting",
LAUGHTER: "laughter",
GAME_EVENT: "game_event",
SPEAKING: "speaking",
SOUNDBOARD: "soundboard"
};
const r8 = {
UNKNOWN: "unknown",
BELOW_MINIMUM: "below_minimum",
MEETS_MINIMUM: "meets_minimum",
MEETS_AUTO_ENABLE: "meets_auto_enable"
};
const r7 = {
MAX_CONCURRENT_SAVES: "max_concurrent_saves",
NO_ELIGIBLE_SOURCE: "no_eligible_source",
MODULE_NOT_LOADED: "module_not_loaded",
BUFFER_WARMING_UP: "buffer_warming_up",
BRIDGE_SHUTDOWN: "bridge_shutdown",
RECORDING_NOT_READY: "recording_not_ready"
};
const r32 = {
ANGER: "anger",
CALM: "calm",
DISGUST: "disgust",
FEAR: "fear",
HAPPY: "happy",
NEUTRAL: "neutral",
SAD: "sad",
SURPRISED: "surprised"
};
let c2490_0 = {
ORIGINAL: "original",
PORTRAIT_9_16: "9:16",
LANDSCAPE_16_9: "16:9"
};
const r45 = {
CLIP: "clip",
SCREENSHOT: "screenshot",
VOICE_CLIP: "voice_clip"
};
const r49 = {
UNCLASSIFIED: "unclassified",
KILL: "kill",
MULTIKILL: "multikill",
DEATH: "death",
ASSIST: "assist",
ITEM: "item",
VICTORY: "victory",
DEFEAT: "defeat",
LEVEL_UP: "level_up",
TREASURE: "treasure",
OBJECTIVE_KILL: "objective_kill"
};
export { r9 as ClipSignalTypes };
export { r8 as ClipsHardwareClassification };
export { r7 as ClipsSaveNoOpReason };
export { r32 as Emotion };
export { c2490_0 as ClipCropPreset };
export function getClipCropAspectRatio(a0) {
if (c2490_0.PORTRAIT_9_16 === a0) {
return 0.5625;
}
if (c2490_0.LANDSCAPE_16_9 === a0) {
return 1.7777777777777777;
}
return null;
}
export function getClipCropBounds(a0) {
if (a0?.bounds != null) {
return a0.bounds;
}
const preset = a0?.preset;
const aspectRatio = c2490_0.PORTRAIT_9_16 !== preset ? c2490_0.LANDSCAPE_16_9 === preset ? 1.7777777777777777 : null : 0.5625;
return aspectRatio != null ? {
aspectRatio
} : null;
}
export { r45 as ClipType };
export { r49 as GameEventType };
@@ -0,0 +1,62 @@
// Metro module 4726 (f4727).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-04-clips-v3-runtime",
defaultConfig: {
enableClipsV3: false,
enableClipsV3ML: false
},
variations: {
1: {
enableClipsV3: true,
enableClipsV3ML: false
},
2: {
enableClipsV3: true,
enableClipsV3ML: true
}
}
});
let c2884_1 = null;
export { apexExperiment as ClipsV3RuntimeExperiment };
export function isClipsV3Enabled(a0) {
return apexExperiment.getConfig({
location: a0
}).enableClipsV3;
}
export function useIsClipsV3Enabled(a0) {
return apexExperiment.useConfig({
location: a0
}).enableClipsV3;
}
export function setActiveClipsRuntime(a0) {
c2884_1 = a0;
}
export function getClipsRuntime(a0) {
return c2884_1 != null ? c2884_1 : apexExperiment.getConfig({
location: a0
}).enableClipsV3 ? "v3" : "v1";
}
export function isClipsV3MLEnabled(a0) {
const config = apexExperiment.getConfig({
location: a0
});
let enableClipsV3 = config.enableClipsV3;
const enableClipsV3ML = config.enableClipsV3ML;
if (enableClipsV3) {
enableClipsV3 = enableClipsV3ML;
}
return enableClipsV3;
}
export function useIsClipsV3MLEnabled(a0) {
const config = apexExperiment.useConfig({
location: a0
});
let enableClipsV3 = config.enableClipsV3;
const enableClipsV3ML = config.enableClipsV3ML;
if (enableClipsV3) {
enableClipsV3 = enableClipsV3ML;
}
return enableClipsV3;
}
@@ -0,0 +1,15 @@
// Metro module 4256 (f4257).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-05-distributed-clips",
defaultConfig: {
enableDistributedClips: false
},
variations: {
1: {
enableDistributedClips: true
}
}
});
export default apexExperiment;
@@ -0,0 +1,20 @@
// Metro module 4725 (f4726).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-07-clips-game-events-on-player",
defaultConfig: {
enableGameEventsOnPlayer: false
},
variations: {
1: {
enableGameEventsOnPlayer: true
}
}
});
export default apexExperiment;
export function isGameEventsOnPlayerEnabled(a0) {
return apexExperiment.getConfig({
location: a0
}).enableGameEventsOnPlayer;
}
+164
View File
@@ -0,0 +1,164 @@
// Metro module 4724 (f4725).
import _slicedToArray from "../../_bundle/_slicedToArray";
import { CLIPS_MAX_PARTICIPANTS, CLIPS_MAX_TIMELINE_EVENTS } from "./ClipsConstants";
import { AnalyticEvents } from "../../Constants";
import { SpeakingFlags } from "../../_bundle/Module4250";
import * as _GameEventsOnPlayerExperiment from "./GameEventsOnPlayerExperiment";
import { ClipSignalTypes, GameEventType } from "./ClipsTypes";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { getClipsRuntime } from "./ClipsV3RuntimeExperiment";
let c2882_8 = {
UNKNOWN: 0,
0: "UNKNOWN",
KILL: 1,
1: "KILL",
MULTIKILL: 2,
2: "MULTIKILL",
DEATH: 3,
3: "DEATH"
};
export function getClipCreatedAt(a0) {
return new Date(a0).toISOString();
}
export function getClipParticipantIds(a0) {
return a0.slice(0, CLIPS_MAX_PARTICIPANTS);
}
export { c2882_8 as ServerClipGameEventType };
export function getClipEventsTimeline(a0) {
let isGameEventsOnPlayerEnabled;
let r2 = a0.timeline?.length;
if (r2 == null) {
r2 = 0;
}
if (r2 !== 0) {
if (a0.decision?.timestamp != null) {
let editMetadata = a0.editMetadata;
if (editMetadata == null) {
editMetadata = {
start: 0,
end: a0.length / 1000
};
}
const r52 = a0.decision.timestamp - a0.length;
const r15 = r52 + 1000 * editMetadata.start;
const r14 = r52 + 1000 * editMetadata.end;
isGameEventsOnPlayerEnabled = _GameEventsOnPlayerExperiment.isGameEventsOnPlayerEnabled("getClipEventsTimeline");
const r70 = a0.timeline.filter((item) => {
let r12 = a0.editMetadata?.voiceAudio !== false && item.signal.type === ClipSignalTypes.SPEAKING;
if (!r12) {
let r19 = isGameEventsOnPlayerEnabled;
if (isGameEventsOnPlayerEnabled) {
r19 = item.signal.type === ClipSignalTypes.GAME_EVENT;
}
r12 = r19;
}
return r12;
}).sort((a, b) => a.timestamp - b.timestamp);
if (r70.length !== 0) {
const map = new Map();
const r11 = [];
const map2 = new Map();
for (const item of r70) {
L18: {
if (item.signal.type !== ClipSignalTypes.SPEAKING) {
continue;
}
if (item.timestamp >= r15) {
break L18;
}
map.set(item.signal.userId, (item.signal.speakingFlags & SpeakingFlags.VOICE) === SpeakingFlags.VOICE);
continue;
}
break;
}
for (const item2 of map) {
const r118 = _slicedToArray(item2, 2);
const user_id = r118[0];
if (r118[1]) {
r11.push({
timestamp_ms: 0,
speaking: {
user_id,
speaking_flags: SpeakingFlags.VOICE
}
});
}
}
for (const item3 of r70) {
if (item3.signal.type === ClipSignalTypes.SPEAKING) {
if (item3.timestamp < r15) {
continue;
}
if (item3.timestamp > r14) {
break;
}
const r216 = (item3.signal.speakingFlags & SpeakingFlags.VOICE) === SpeakingFlags.VOICE;
let r220 = map.get(item3.signal.userId);
if (r220 == null) {
r220 = false;
}
if (r220 === r216) {
continue;
}
map.set(item3.signal.userId, r216);
r11.push({
timestamp_ms: Math.round(item3.timestamp - r15),
speaking: {
user_id: item3.signal.userId,
speaking_flags: item3.signal.speakingFlags
}
});
continue;
}
if (item3.signal.type !== ClipSignalTypes.GAME_EVENT) {
continue;
}
if (item3.timestamp < r15) {
continue;
}
if (!(item3.timestamp > r14)) {
let type = void 0;
const eventType = item3.signal.eventType;
if (GameEventType.KILL === eventType) {
type = c2882_8.KILL;
} else if (GameEventType.MULTIKILL === eventType) {
type = c2882_8.MULTIKILL;
}
if (type == null) {
continue;
}
const r183 = Math.round(item3.timestamp - r15);
const r186 = map2.get(r183);
if (r186 != null) {
if (type !== c2882_8.MULTIKILL) {
continue;
}
r11[r186].game = {
type
};
continue;
}
map2.set(r183, r11.length);
r11.push({
timestamp_ms: r183,
game: {
type
}
});
continue;
}
break;
}
const r245 = r11.slice(0, CLIPS_MAX_TIMELINE_EVENTS);
if (r245.length !== r11.length) {
AnalyticsUtils.track(AnalyticEvents.CLIP_TIMELINE_TRIMMED, {
clip_uuid: a0.id,
clip_event_timeline_size: r11.length,
clip_runtime: getClipsRuntime("getClipEventsTimeline")
});
}
return r245.length > 0 ? r245 : void 0;
}
}
}
}
+9
View File
@@ -0,0 +1,9 @@
// Metro module 4249 (f4250).
import { Features } from "../../_bundle/Module4250";
import { ClipsExperiment } from "./ClipsExperiment";
import { isDesktop } from "../../utils/PlatformUtils";
export default function isClientClipsCapable(a0) {
return ClipsExperiment.getConfig({
location: "isClipsClientCapable"
}).ignorePlatformRestriction || isDesktop() && a0.getMediaEngine().supports(Features.CLIPS);
};
+81
View File
@@ -0,0 +1,81 @@
// Metro module 4247 (f4248).
import ClipsStore from "./ClipsStore";
import { areClipsAvailable, useIsClipsAvailable } from "./ClipsExperiment";
import * as _ClipsSettingsRedesignExperiment from "./ClipsSettingsRedesignExperiment";
import { useIsClipsSettingsRedesignEnabled } from "./ClipsSettingsRedesignExperiment";
import { useStateFromStores } from "../../_bundle/Module589";
import * as _PlatformUtils from "../../utils/PlatformUtils";
let $mk74016 = function() {
return () => ClipsStore.getState().clipsSettings.clipsEnabled;
}, $mk74017 = function() {
return () => ClipsStore.getState().clipsSettings.decoupledClipsEnabled;
};
export function isClipsEnabled() {
let r7 = areClipsAvailable();
const clipsEnabled = ClipsStore.getState().clipsSettings.clipsEnabled;
if (r7) {
r7 = clipsEnabled;
}
if (r7) {
const isClipsSettingsRedesignEnabled = _ClipsSettingsRedesignExperiment.isClipsSettingsRedesignEnabled();
r7 = isClipsSettingsRedesignEnabled ? ClipsStore.getState().clipsSettings.decoupledClipsEnabled : !isClipsSettingsRedesignEnabled;
}
return r7;
}
export function useIsClipsEnabled() {
let r11 = useIsClipsAvailable();
const stateFromStores = useStateFromStores([ClipsStore], $mk74016());
const isClipsSettingsRedesignEnabled = useIsClipsSettingsRedesignEnabled();
const stateFromStores2 = useStateFromStores([ClipsStore], $mk74017());
if (r11) {
r11 = stateFromStores;
}
if (r11) {
r11 = isClipsSettingsRedesignEnabled ? stateFromStores2 : !isClipsSettingsRedesignEnabled;
}
return r11;
}
export function isDecoupledClipsEnabled() {
let r8 = areClipsAvailable();
const clipsEnabled = ClipsStore.getState().clipsSettings.clipsEnabled;
if (r8) {
r8 = clipsEnabled;
}
if (r8) {
const isClipsSettingsRedesignEnabled = _ClipsSettingsRedesignExperiment.isClipsSettingsRedesignEnabled();
r8 = isClipsSettingsRedesignEnabled ? ClipsStore.getState().clipsSettings.decoupledClipsEnabled : !isClipsSettingsRedesignEnabled;
}
const isWindows = _PlatformUtils.isWindows();
if (_ClipsSettingsRedesignExperiment.isClipsSettingsRedesignEnabled()) {
if (r8) {
r8 = isWindows;
}
return r8;
}
const decoupledClipsEnabled = ClipsStore.getState().clipsSettings.decoupledClipsEnabled;
return (r8 ? isWindows : r8) && decoupledClipsEnabled;
}
export function useIsDecoupledClipsEnabled() {
let r40;
let r13 = useIsClipsAvailable();
const stateFromStores = useStateFromStores([ClipsStore], $mk74016());
const isClipsSettingsRedesignEnabled = useIsClipsSettingsRedesignEnabled();
const stateFromStores2 = useStateFromStores([ClipsStore], $mk74017());
if (r13) {
r13 = stateFromStores;
}
if (r13) {
r13 = isClipsSettingsRedesignEnabled ? stateFromStores2 : !isClipsSettingsRedesignEnabled;
}
const isWindows = _PlatformUtils.isWindows();
const stateFromStores3 = useStateFromStores([ClipsStore], () => ClipsStore.getState().clipsSettings.decoupledClipsEnabled);
if (useIsClipsSettingsRedesignEnabled()) {
if (r13) {
r13 = isWindows;
}
r40 = r13;
} else {
r40 = (r13 ? isWindows : r13) && stateFromStores3;
}
return r40;
}
+21
View File
@@ -0,0 +1,21 @@
// Metro module 16642 (f16643).
import { CLIPS_TOAST_DURATION } from "../ClipsConstants";
import ClipsManager2 from "../ClipsManager";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { intl, t } from "../../../intl/index.native";
class ClipsManager extends ClipsManager2 {
showClipsToast() {
ToastActionCreators.open({
key: "CLIPS_IN_CALL_WARNING",
content: intl.string(t["d+41qJ"]),
toastDurationMs: CLIPS_TOAST_DURATION
});
}
applyNativeClipsSettings() {}
handleClipsInitOnToggleDetection() {}
handleClipsInitOnGamesChange() {}
fireClipsInitEvent() {}
handleStreamEnded() {}
}
const clipsManager = new ClipsManager();
export default clipsManager;