430 lines
18 KiB
TypeScript
430 lines
18 KiB
TypeScript
/* Metro module 4652; source: modules/clips/clipPayloadUtils.tsx; dependencies: [57, 4281, 661, 4291, 4653, 4284, 683, 4654, 2] */
|
|
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ClipsConstantsModule from './ClipsConstants.tsx'; /* Metro dependency 4281 */
|
|
import * as ConstantsModule2 from '../../external/discord_common/js/packages/media-engine/Constants.tsx'; /* Metro dependency 4291 */
|
|
import * as ClipsTimelineExperimentModule from './ClipsTimelineExperiment.tsx'; /* Metro dependency 4653 */
|
|
|
|
function _fun40159(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#40159, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4830:6, offset: 0x010f7d45, size: 232 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_40162 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/clips/clipPayloadUtils.tsx');
|
|
exports.getClipCreatedAt = function(a0) {
|
|
var Date = global.Date;
|
|
return new Date(a0).toISOString();
|
|
};
|
|
exports.getClipParticipantIds = function(a0) {
|
|
return a0.slice(0, CLIPS_MAX_PARTICIPANTS);
|
|
};
|
|
exports.getClipEventsTimeline = getClipEventsTimeline;
|
|
function _createForOfIteratorHelperLoose_40160(a0, a1) { // fn#40160, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4830:229, offset: 0x010f7e2d, size: 370 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun40161;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_40162(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_40162(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_40162(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun40161;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
function _fun40161() { // fn#40161, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4830:800, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
|
|
return env0_1 >= env0_0.length ? {done: true} : {done: false,
|
|
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
|
|
}
|
|
|
|
}
|
|
|
|
function getClipEventsTimeline(a0) { // fn#40165, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4830:1396, offset: 0x010f7fe3, size: 979 bytes, params: 2, frame: 32
|
|
var environment;
|
|
var length;
|
|
var r2;
|
|
var timestamp;
|
|
var voiceAudio;
|
|
var r4;
|
|
var r5;
|
|
var r17;
|
|
var r0;
|
|
var timeline;
|
|
var value3;
|
|
var decision;
|
|
var editMetadata;
|
|
var value4;
|
|
var start;
|
|
var value5;
|
|
var end;
|
|
var value6;
|
|
var filter;
|
|
var value7;
|
|
var sort;
|
|
var value8;
|
|
var Map;
|
|
var prototype;
|
|
var value9;
|
|
var map;
|
|
var value10;
|
|
var value11;
|
|
var value12;
|
|
var done;
|
|
var value13;
|
|
var signal;
|
|
var speakingFlags;
|
|
var VOICE;
|
|
var value14;
|
|
var set;
|
|
var userId;
|
|
var value15;
|
|
var value16;
|
|
var value17;
|
|
var value18;
|
|
var value19;
|
|
var property;
|
|
var push;
|
|
var value20;
|
|
var value21;
|
|
var value22;
|
|
var value23;
|
|
var value24;
|
|
var value25;
|
|
var get;
|
|
var value26;
|
|
var value27;
|
|
var Math;
|
|
var round;
|
|
var value28;
|
|
var slice;
|
|
var value29;
|
|
var length2;
|
|
var defaultImport;
|
|
var track;
|
|
var CLIP_TIMELINE_TRIMMED;
|
|
var object3;
|
|
var id;
|
|
var getClipsRuntime;
|
|
let value = environment;
|
|
const value2 = undefined;
|
|
const ClipsTimelineExperiment = (ClipsTimelineExperimentModule).ClipsTimelineExperiment;
|
|
const getConfig = ClipsTimelineExperiment.getConfig;
|
|
let object = {location: 'getClipEventsTimeline'};
|
|
if (Reflect.apply(getConfig, ClipsTimelineExperiment, [object]).enableTimelineUpload) {
|
|
timeline = a0.timeline;
|
|
reducibleJoin3: while (true) {
|
|
if (timeline == null) {
|
|
length = value2;
|
|
break reducibleJoin3;
|
|
}
|
|
length = timeline.length;
|
|
break reducibleJoin3;
|
|
}
|
|
value3 = 0;
|
|
r2 = length ?? value3;
|
|
reducibleJoin14: while (true) {
|
|
if (value3 === r2) {
|
|
break reducibleJoin14;
|
|
}
|
|
decision = a0.decision;
|
|
reducibleJoin7: while (true) {
|
|
if (decision == null) {
|
|
timestamp = value2;
|
|
break reducibleJoin7;
|
|
}
|
|
timestamp = decision.timestamp;
|
|
break reducibleJoin7;
|
|
}
|
|
if (timestamp == null) {
|
|
break reducibleJoin14;
|
|
}
|
|
editMetadata = a0.editMetadata;
|
|
reducibleJoin10: while (true) {
|
|
if (editMetadata == null) {
|
|
voiceAudio = value2;
|
|
break reducibleJoin10;
|
|
}
|
|
voiceAudio = editMetadata.voiceAudio;
|
|
break reducibleJoin10;
|
|
}
|
|
if (voiceAudio === false) {
|
|
break reducibleJoin14;
|
|
}
|
|
editMetadata = a0.editMetadata;
|
|
reducibleJoin13: while (true) {
|
|
if (editMetadata != null) {
|
|
r2 = editMetadata;
|
|
break reducibleJoin13;
|
|
}
|
|
length = a0.length;
|
|
r2 = {start: value3, end: length / 1000};
|
|
break reducibleJoin13;
|
|
}
|
|
decision = a0.decision;
|
|
timestamp = decision.timestamp;
|
|
length = a0.length;
|
|
value4 = timestamp - length;
|
|
start = r2.start;
|
|
value5 = value4 + 1000 * start;
|
|
end = r2.end;
|
|
value6 = value4 + 1000 * end;
|
|
timeline = a0.timeline;
|
|
filter = timeline.filter;
|
|
value7 = Reflect.apply(filter, timeline, [function(a0) {
|
|
return a0.signal.type === require(dependencyMap[5]).ClipSignalTypes.SPEAKING;
|
|
}]);
|
|
sort = value7.sort;
|
|
value8 = Reflect.apply(sort, value7, [_fun40167]);
|
|
length = value8.length;
|
|
if (value3 !== length) {
|
|
Map = global.Map;
|
|
prototype = Map.prototype;
|
|
value9 = Object.create(prototype, {constructor: {value: Map}});
|
|
map = new Map();
|
|
value10 = map instanceof Object ? map : value9;
|
|
object = [];
|
|
value11 = _createForOfIteratorHelperLoose_40160(value8);
|
|
value12 = value11();
|
|
done = value12.done;
|
|
if (!done) {
|
|
r4 = value12;
|
|
reducibleLoop16: while (true) {
|
|
value13 = r4.value;
|
|
timestamp = value13.timestamp;
|
|
if (timestamp >= value5) {
|
|
break reducibleLoop16;
|
|
}
|
|
signal = value13.signal;
|
|
speakingFlags = signal.speakingFlags;
|
|
VOICE = SpeakingFlags.VOICE;
|
|
value14 = speakingFlags & VOICE;
|
|
VOICE = SpeakingFlags.VOICE;
|
|
set = value10.set;
|
|
signal = value13.signal;
|
|
userId = signal.userId;
|
|
Reflect.apply(set, value10, [userId, value14 === VOICE]);
|
|
value15 = value11();
|
|
done = value15.done;
|
|
if (done) {
|
|
break reducibleLoop16;
|
|
}
|
|
r4 = value15;
|
|
continue reducibleLoop16;
|
|
}
|
|
}
|
|
value16 = _createForOfIteratorHelperLoose_40160(value10);
|
|
value17 = value16();
|
|
done = value17.done;
|
|
if (!done) {
|
|
r4 = value17;
|
|
reducibleLoop19: while (true) {
|
|
value18 = r4.value;
|
|
value19 = Module00057(value18, 2);
|
|
property = value19[value3];
|
|
reducibleJoin21: while (true) {
|
|
if (value19[1]) {
|
|
push = object.push;
|
|
VOICE = SpeakingFlags.VOICE;
|
|
Reflect.apply(push, object, [{timestamp_ms: value3, speaking: {user_id: property,
|
|
speaking_flags: VOICE}}]);
|
|
break reducibleJoin21;
|
|
}
|
|
break reducibleJoin21;
|
|
}
|
|
value20 = value16();
|
|
done = value20.done;
|
|
if (done) {
|
|
break reducibleLoop19;
|
|
}
|
|
r4 = value20;
|
|
continue reducibleLoop19;
|
|
}
|
|
}
|
|
value21 = _createForOfIteratorHelperLoose_40160(value8);
|
|
value22 = value21();
|
|
done = value22.done;
|
|
if (!done) {
|
|
r5 = value22;
|
|
reducibleLoop23: while (true) {
|
|
value23 = r5.value;
|
|
timestamp = value23.timestamp;
|
|
if (!(timestamp < value5)) {
|
|
timestamp = value23.timestamp;
|
|
reducibleJoin28: while (true) {
|
|
reducibleJoin32: while (true) {
|
|
if (timestamp > value6) {
|
|
break reducibleLoop23;
|
|
}
|
|
signal = value23.signal;
|
|
speakingFlags = signal.speakingFlags;
|
|
VOICE = SpeakingFlags.VOICE;
|
|
value24 = speakingFlags & VOICE;
|
|
VOICE = SpeakingFlags.VOICE;
|
|
value25 = value24 === VOICE;
|
|
get = value10.get;
|
|
signal = value23.signal;
|
|
userId = signal.userId;
|
|
value26 = Reflect.apply(get, value10, [userId]);
|
|
value27 = value26 != null;
|
|
r17 = value27 && value26;
|
|
if (r17 === value25) {
|
|
break reducibleJoin28;
|
|
}
|
|
set = value10.set;
|
|
signal = value23.signal;
|
|
userId = signal.userId;
|
|
Reflect.apply(set, value10, [userId, value25]);
|
|
push = object.push;
|
|
Math = global.Math;
|
|
round = Math.round;
|
|
timestamp = value23.timestamp;
|
|
signal = value23.signal;
|
|
userId = signal.userId;
|
|
signal = value23.signal;
|
|
speakingFlags = signal.speakingFlags;
|
|
Reflect.apply(push, object, [{timestamp_ms: Reflect.apply(round, Math,
|
|
[timestamp - value5]),
|
|
speaking: {user_id: userId, speaking_flags: speakingFlags}}]);
|
|
break reducibleJoin28;
|
|
}
|
|
return r0;
|
|
}
|
|
}
|
|
value28 = value21();
|
|
done = value28.done;
|
|
if (done) {
|
|
break reducibleLoop23;
|
|
}
|
|
r5 = value28;
|
|
continue reducibleLoop23;
|
|
}
|
|
}
|
|
slice = object.slice;
|
|
value29 = Reflect.apply(slice, object, [value3, CLIPS_MAX_TIMELINE_EVENTS]);
|
|
length = value29.length;
|
|
length2 = object.length;
|
|
reducibleJoin31: while (true) {
|
|
if (length === length2) {
|
|
break reducibleJoin31;
|
|
}
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
CLIP_TIMELINE_TRIMMED = AnalyticEvents.CLIP_TIMELINE_TRIMMED;
|
|
object3 = {};
|
|
id = a0.id;
|
|
object3.clip_uuid = id;
|
|
length = object.length;
|
|
object3.clip_event_timeline_size = length;
|
|
value = require(4654) /* metro dependency 4654: ClipsV3RuntimeExperiment */;
|
|
getClipsRuntime = value.getClipsRuntime;
|
|
object3.clip_runtime = Reflect.apply(getClipsRuntime, value, ['getClipEventsTimeline']);
|
|
Reflect.apply(track, defaultImport, [CLIP_TIMELINE_TRIMMED, object3]);
|
|
break reducibleJoin31;
|
|
}
|
|
length = value29.length;
|
|
r0 = length > value3 ? value29 : value2;
|
|
return r0;
|
|
}
|
|
break reducibleJoin14;
|
|
}
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun40167({timestamp}, {timestamp}) { // fn#40167, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4830:1912, offset: 0x010f83ef, size: 24 bytes, params: 3, frame: 2
|
|
return timestamp - timestamp;
|
|
}
|
|
|
|
global.__d(_fun40159, 4652, [57, 4281, 661, 4291, 4653, 4284, 683, 4654,
|
|
2]) /* metro module 4652, dependencies: [57, 4281, 661, 4291, 4653, 4284, 683, 4654, 2] */;
|