528 lines
18 KiB
TypeScript
528 lines
18 KiB
TypeScript
// Metro module 13253 (f13254).
|
|
import { AnalyticEvents } from "../../../../Constants";
|
|
import ProcessUtils_native from "../../../../utils/ProcessUtils.native";
|
|
import { Opcode } from "../../../gateway/GatewaySocketOpcode";
|
|
import { RTCSocketOpcode } from "../../../../lib/RTCControlSocket";
|
|
let c9195_4, c9195_5;
|
|
let c9195_3 = {
|
|
Gateway: "gateway",
|
|
RtcControl: "rtc_control",
|
|
RemoteAuth: "remote_auth",
|
|
Spotify: "spotify",
|
|
Rpc: "rpc",
|
|
GameServerPing: "game_server_ping"
|
|
};
|
|
const r22 = {};
|
|
r22[AnalyticEvents.DEVICE_EVENT] = (a0) => {
|
|
const data = a0.data;
|
|
const r1 = data == null;
|
|
let r2 = null;
|
|
if (!r1) {
|
|
const length = Object.keys(data).length;
|
|
r2 = null;
|
|
if (length !== 0) {
|
|
const action = data.action;
|
|
let action2 = typeof action === "string" ? action : null;
|
|
if (action2 == null) {
|
|
const message = a0.message;
|
|
action2 = typeof message === "string" ? message : null;
|
|
}
|
|
const message2 = a0.message;
|
|
let description2 = typeof message2 === "string" ? message2 : null;
|
|
if (description2 == null) {
|
|
const description = data.description;
|
|
description2 = typeof description === "string" ? description : null;
|
|
}
|
|
const r25 = Object.entries(data).filter((item) => {
|
|
const [, r2] = item;
|
|
return r2 != null;
|
|
});
|
|
r2 = {
|
|
action: action2,
|
|
description: description2,
|
|
metadata: r25.length !== 0 ? r25.map((item) => {
|
|
const [r7, r24] = item;
|
|
return `${r7}=${r24}`;
|
|
}).join(", ") : null
|
|
};
|
|
}
|
|
}
|
|
return r2;
|
|
};
|
|
r22[AnalyticEvents.REACT_SOFT_EXCEPTION] = ({ data }) => {
|
|
const r0 = data == null;
|
|
let r7 = null;
|
|
if (!r0) {
|
|
const error_message = data.error_message;
|
|
let error_message2 = typeof error_message === "string" ? error_message : null;
|
|
if (error_message2 == null) {
|
|
const message = data.message;
|
|
error_message2 = typeof message === "string" ? message : null;
|
|
}
|
|
if (error_message2 == null) {
|
|
error_message2 = void 0;
|
|
}
|
|
const component = data.component;
|
|
const component2 = typeof component === "string" ? component : null;
|
|
const stacktrace = data.stacktrace;
|
|
r7 = {
|
|
error_message: error_message2,
|
|
component: component2,
|
|
stacktrace: typeof stacktrace === "string" ? stacktrace : null
|
|
};
|
|
}
|
|
return r7;
|
|
};
|
|
r22[AnalyticEvents.NETWORK_CAPABILITIES_CHANGED] = ({ data }) => {
|
|
const r0 = data == null;
|
|
let r9 = null;
|
|
if (!r0) {
|
|
const action = data.action;
|
|
const action2 = typeof action === "string" ? action : null;
|
|
const network_type = data.network_type;
|
|
const network_type2 = typeof network_type === "string" ? network_type : null;
|
|
const upload_bandwidth = data.upload_bandwidth;
|
|
const upload_bandwidth2 = typeof upload_bandwidth === "number" ? Number.isFinite(upload_bandwidth) ? upload_bandwidth : null : null;
|
|
const download_bandwidth = data.download_bandwidth;
|
|
r9 = {
|
|
action: action2,
|
|
network_type: network_type2,
|
|
upload_bandwidth: upload_bandwidth2,
|
|
download_bandwidth: typeof download_bandwidth === "number" ? Number.isFinite(download_bandwidth) ? download_bandwidth : null : null,
|
|
vpn_active: typeof data.vpn_active === "boolean" ? data.vpn_active : null
|
|
};
|
|
}
|
|
return r9;
|
|
};
|
|
r22[AnalyticEvents.FOREGROUND_SERVICE] = (a0) => {
|
|
const data = a0.data;
|
|
const r0 = data == null;
|
|
let r1 = null;
|
|
if (!r0) {
|
|
const service_name = data.service_name;
|
|
const service_name2 = typeof service_name === "string" ? service_name : null;
|
|
const action = data.action;
|
|
const action2 = typeof action === "string" ? action : null;
|
|
const detail = data.detail;
|
|
let detail2 = typeof detail === "string" ? detail : null;
|
|
if (detail2 == null) {
|
|
const message = a0.message;
|
|
detail2 = typeof message === "string" ? message : null;
|
|
}
|
|
const fgs_operation = data.fgs_operation;
|
|
const fgs_operation2 = typeof fgs_operation === "string" ? fgs_operation : null;
|
|
const fgs_configuration_type = data.fgs_configuration_type;
|
|
const fgs_configuration_type2 = typeof fgs_configuration_type === "string" ? fgs_configuration_type : null;
|
|
const guard_allowed = typeof data.guard_allowed === "boolean" ? data.guard_allowed : null;
|
|
const fgs_guard_reason = data.fgs_guard_reason;
|
|
r1 = {
|
|
service_name: service_name2,
|
|
action: action2,
|
|
detail: detail2,
|
|
fgs_operation: fgs_operation2,
|
|
fgs_configuration_type: fgs_configuration_type2,
|
|
guard_allowed,
|
|
fgs_guard_reason: typeof fgs_guard_reason === "string" ? fgs_guard_reason : null
|
|
};
|
|
}
|
|
return r1;
|
|
};
|
|
r22[AnalyticEvents.APP_LIFECYCLE] = (a0) => {
|
|
const data = a0.data;
|
|
const r0 = data == null;
|
|
let r1 = null;
|
|
if (!r0) {
|
|
const state = data.state;
|
|
let state2 = typeof state === "string" ? state : null;
|
|
if (state2 == null) {
|
|
const message = a0.message;
|
|
state2 = typeof message === "string" ? message : null;
|
|
}
|
|
const previous_state = data.previous_state;
|
|
const previous_state2 = typeof previous_state === "string" ? previous_state : null;
|
|
const details = data.details;
|
|
r1 = {
|
|
state: state2,
|
|
previous_state: previous_state2,
|
|
details: typeof details === "string" ? details : null
|
|
};
|
|
}
|
|
return r1;
|
|
};
|
|
r22[AnalyticEvents.UI_LIFECYCLE] = ({ data }) => {
|
|
const r0 = data == null;
|
|
let r8 = null;
|
|
if (!r0) {
|
|
const activity_name = data.activity_name;
|
|
let activity_name2 = typeof activity_name === "string" ? activity_name : null;
|
|
if (activity_name2 == null) {
|
|
const screen = data.screen;
|
|
activity_name2 = typeof screen === "string" ? screen : null;
|
|
}
|
|
const stage = data.stage;
|
|
let stage2 = typeof stage === "string" ? stage : null;
|
|
if (stage2 == null) {
|
|
const state = data.state;
|
|
stage2 = typeof state === "string" ? state : null;
|
|
}
|
|
const extra = data.extra;
|
|
let extra2 = typeof extra === "string" ? extra : null;
|
|
if (extra2 == null) {
|
|
const details = data.details;
|
|
extra2 = typeof details === "string" ? details : null;
|
|
}
|
|
if (extra2 == null) {
|
|
const detail = data.detail;
|
|
extra2 = typeof detail === "string" ? detail : null;
|
|
}
|
|
r8 = {
|
|
activity_name: activity_name2,
|
|
stage: stage2,
|
|
extra: extra2
|
|
};
|
|
}
|
|
return r8;
|
|
};
|
|
c9195_4 = r22;
|
|
const r35 = {};
|
|
r35[AnalyticEvents.TOUCH_EVENT] = ({ data }) => {
|
|
const r1 = data == null;
|
|
let r10 = null;
|
|
if (!r1) {
|
|
const touch_action_type = data.touch_action_type;
|
|
const touch_action_type2 = typeof touch_action_type === "string" ? touch_action_type : null;
|
|
let hermes_instrumented_stats_summary = ProcessUtils_native.getCurrentHermesInstrumentedStatsSummary();
|
|
if (hermes_instrumented_stats_summary == null) {
|
|
hermes_instrumented_stats_summary = null;
|
|
}
|
|
const client_timestamp_ms = data.client_timestamp_ms;
|
|
const client_timestamp_ms2 = typeof client_timestamp_ms === "number" ? Number.isFinite(client_timestamp_ms) ? client_timestamp_ms : null : null;
|
|
const screen_x = data.screen_x;
|
|
const screen_x2 = typeof screen_x === "number" ? Number.isFinite(screen_x) ? screen_x : null : null;
|
|
const screen_y = data.screen_y;
|
|
const screen_y2 = typeof screen_y === "number" ? Number.isFinite(screen_y) ? screen_y : null : null;
|
|
const view_x = data.view_x;
|
|
const view_x2 = typeof view_x === "number" ? Number.isFinite(view_x) ? view_x : null : null;
|
|
const view_y = data.view_y;
|
|
const view_y2 = typeof view_y === "number" ? Number.isFinite(view_y) ? view_y : null : null;
|
|
const total_memory_mb = data.total_memory_mb;
|
|
const total_memory_mb2 = typeof total_memory_mb === "number" ? Number.isFinite(total_memory_mb) ? total_memory_mb : null : null;
|
|
const memory_breakdown = data.memory_breakdown;
|
|
const memory_breakdown2 = typeof memory_breakdown === "string" ? memory_breakdown : null;
|
|
const view_hierarchy = data.view_hierarchy;
|
|
const view_hierarchy2 = typeof view_hierarchy === "string" ? view_hierarchy : null;
|
|
const gesture = data.gesture;
|
|
const gesture2 = typeof gesture === "string" ? gesture : null;
|
|
const window_name = data.window_name;
|
|
const window_name2 = typeof window_name === "string" ? window_name : null;
|
|
const hit_test_duration_us = data.hit_test_duration_us;
|
|
const hit_test_duration_us2 = typeof hit_test_duration_us === "number" ? Number.isFinite(hit_test_duration_us) ? hit_test_duration_us : null : null;
|
|
const distance = data.distance;
|
|
const distance2 = typeof distance === "number" ? Number.isFinite(distance) ? distance : null : null;
|
|
const duration_ms = data.duration_ms;
|
|
const duration_ms2 = typeof duration_ms === "number" ? Number.isFinite(duration_ms) ? duration_ms : null : null;
|
|
const velocity = data.velocity;
|
|
const velocity2 = typeof velocity === "number" ? Number.isFinite(velocity) ? velocity : null : null;
|
|
const scale_factor = data.scale_factor;
|
|
r10 = {
|
|
touch_action_type: touch_action_type2,
|
|
client_timestamp_ms: client_timestamp_ms2,
|
|
screen_x: screen_x2,
|
|
screen_y: screen_y2,
|
|
view_x: view_x2,
|
|
view_y: view_y2,
|
|
total_memory_mb: total_memory_mb2,
|
|
memory_breakdown: memory_breakdown2,
|
|
hermes_instrumented_stats_summary,
|
|
view_hierarchy: view_hierarchy2,
|
|
gesture: gesture2,
|
|
window_name: window_name2,
|
|
hit_test_duration_us: hit_test_duration_us2,
|
|
distance: distance2,
|
|
duration_ms: duration_ms2,
|
|
velocity: velocity2,
|
|
scale_factor: typeof scale_factor === "number" ? Number.isFinite(scale_factor) ? scale_factor : null : null
|
|
};
|
|
}
|
|
return r10;
|
|
};
|
|
r35[AnalyticEvents.HTTP_REQUEST] = ({ data }) => {
|
|
const r0 = data == null;
|
|
let r10 = null;
|
|
if (!r0) {
|
|
const url = data.url;
|
|
let url2 = typeof url === "string" ? url : null;
|
|
if (url2 == null) {
|
|
const uri = data.uri;
|
|
url2 = typeof uri === "string" ? uri : null;
|
|
}
|
|
if (url2 == null) {
|
|
const request_url = data.request_url;
|
|
url2 = typeof request_url === "string" ? request_url : null;
|
|
}
|
|
const method = data.method;
|
|
let method2 = typeof method === "string" ? method : null;
|
|
if (method2 == null) {
|
|
const http_method = data.http_method;
|
|
method2 = typeof http_method === "string" ? http_method : null;
|
|
}
|
|
const r17 = url2 == null;
|
|
let r18 = null;
|
|
if (!r17) {
|
|
const status_code = data.status_code;
|
|
const status_code2 = typeof status_code === "number" ? Number.isFinite(status_code) ? status_code : null : null;
|
|
const duration_ms = data.duration_ms;
|
|
const duration_ms2 = typeof duration_ms === "number" ? Number.isFinite(duration_ms) ? duration_ms : null : null;
|
|
const source = data.source;
|
|
r18 = {
|
|
url: url2,
|
|
method: method2,
|
|
status_code: status_code2,
|
|
duration_ms: duration_ms2,
|
|
source: typeof source === "string" ? source : null
|
|
};
|
|
}
|
|
r10 = r18;
|
|
}
|
|
return r10;
|
|
};
|
|
r35[AnalyticEvents.WEBSOCKET_MESSAGE_RECEIVED] = ({ data }) => {
|
|
let r56, r67, r78, r105, r127, r154, r190, r198, Gateway;
|
|
if (data == null) {
|
|
r198 = {
|
|
message_identity: "unknown",
|
|
socket_kind: void 0
|
|
};
|
|
} else {
|
|
const url = data.url;
|
|
const r15 = typeof url === "string" ? url : null;
|
|
const socket_kind = data.socket_kind;
|
|
let socket_kind2 = typeof socket_kind === "string" ? socket_kind : null;
|
|
if (socket_kind2 == null) {
|
|
const r1 = r15 == null;
|
|
let r17 = null;
|
|
if (!r1) {
|
|
L29: {
|
|
const r10 = r15.toLowerCase();
|
|
if (r10.includes("gateway")) {
|
|
Gateway = c9195_3.Gateway;
|
|
} else if (r10.includes("discord.media")) {
|
|
Gateway = c9195_3.RtcControl;
|
|
} else if (r10.includes("remote-auth")) {
|
|
Gateway = c9195_3.RemoteAuth;
|
|
} else if (r10.includes("spotify")) {
|
|
Gateway = c9195_3.Spotify;
|
|
} else if (r10.includes("rtc")) {
|
|
Gateway = c9195_3.RtcControl;
|
|
} else {
|
|
if (!r10.includes("127.0.0.1") && !r10.includes("localhost")) {
|
|
const r40 = r10.includes("game");
|
|
Gateway = null;
|
|
if (!r40) {
|
|
break L29;
|
|
}
|
|
const r43 = r10.includes("ping");
|
|
Gateway = null;
|
|
if (!r43) {
|
|
break L29;
|
|
}
|
|
Gateway = c9195_3.GameServerPing;
|
|
break L29;
|
|
}
|
|
Gateway = c9195_3.Rpc;
|
|
}
|
|
}
|
|
r17 = Gateway;
|
|
}
|
|
socket_kind2 = r17;
|
|
}
|
|
if (socket_kind2 == null) {
|
|
L39: {
|
|
if (data.cmd == null && data.evt == null) {
|
|
if (data.t == null) {
|
|
const r55 = data.s != null;
|
|
r56 = null;
|
|
if (!r55) {
|
|
break L39;
|
|
}
|
|
}
|
|
r56 = c9195_3.Gateway;
|
|
} else {
|
|
r56 = c9195_3.Rpc;
|
|
}
|
|
}
|
|
socket_kind2 = r56;
|
|
}
|
|
const message_identity = data.message_identity;
|
|
let message_identity2 = typeof message_identity === "string" ? message_identity : null;
|
|
if (message_identity2 == null) {
|
|
let r61 = data.t;
|
|
if (r61 == null) {
|
|
r61 = data.type;
|
|
}
|
|
if (r61 == null) {
|
|
r61 = data.evt;
|
|
}
|
|
const r12 = typeof r61 === "string" ? r61 : null;
|
|
if (socket_kind2 === c9195_3.Gateway) {
|
|
L89: {
|
|
const op3 = data.op;
|
|
if (typeof op3 === "number") {
|
|
const isFinite4 = Number.isFinite(op3);
|
|
r127 = op3;
|
|
if (isFinite4) {
|
|
break L89;
|
|
}
|
|
}
|
|
r127 = null;
|
|
if (typeof op3 === "string") {
|
|
const r129 = op3.trim();
|
|
r127 = null;
|
|
if (r129 !== "") {
|
|
const r134 = Number(op3);
|
|
r127 = Number.isFinite(r134) ? r134 : null;
|
|
}
|
|
}
|
|
}
|
|
const r139 = r127 == null;
|
|
let r140 = null;
|
|
if (!r139) {
|
|
const r147 = Opcode[r127];
|
|
r140 = typeof r147 === "string" ? r147 : null;
|
|
}
|
|
if (r140 != null) {
|
|
r67 = r140 === "DISPATCH" ? r12 != null ? `${r140}/${r12}` : r140 : r140;
|
|
} else {
|
|
L101: {
|
|
const op4 = data.op;
|
|
if (typeof op4 === "number") {
|
|
const isFinite5 = Number.isFinite(op4);
|
|
r154 = op4;
|
|
if (isFinite5) {
|
|
break L101;
|
|
}
|
|
}
|
|
r154 = null;
|
|
if (typeof op4 === "string") {
|
|
const r156 = op4.trim();
|
|
r154 = null;
|
|
if (r156 !== "") {
|
|
const r161 = Number(op4);
|
|
r154 = Number.isFinite(r161) ? r161 : null;
|
|
}
|
|
}
|
|
}
|
|
r67 = r154 != null ? r12 != null ? `${r154}/${r12}` : String(r154) : r12;
|
|
}
|
|
} else if (socket_kind2 === c9195_3.RtcControl) {
|
|
L67: {
|
|
const op = data.op;
|
|
if (typeof op === "number") {
|
|
const isFinite2 = Number.isFinite(op);
|
|
r78 = op;
|
|
if (isFinite2) {
|
|
break L67;
|
|
}
|
|
}
|
|
r78 = null;
|
|
if (typeof op === "string") {
|
|
const r80 = op.trim();
|
|
r78 = null;
|
|
if (r80 !== "") {
|
|
const r85 = Number(op);
|
|
r78 = Number.isFinite(r85) ? r85 : null;
|
|
}
|
|
}
|
|
}
|
|
const r90 = r78 == null;
|
|
let r91 = null;
|
|
if (!r90) {
|
|
const r98 = RTCSocketOpcode[r78];
|
|
r91 = typeof r98 === "string" ? r98 : null;
|
|
}
|
|
r67 = r91;
|
|
if (r67 == null) {
|
|
L79: {
|
|
const op2 = data.op;
|
|
if (typeof op2 === "number") {
|
|
const isFinite3 = Number.isFinite(op2);
|
|
r105 = op2;
|
|
if (isFinite3) {
|
|
break L79;
|
|
}
|
|
}
|
|
r105 = null;
|
|
if (typeof op2 === "string") {
|
|
const r107 = op2.trim();
|
|
r105 = null;
|
|
if (r107 !== "") {
|
|
const r112 = Number(op2);
|
|
r105 = Number.isFinite(r112) ? r112 : null;
|
|
}
|
|
}
|
|
}
|
|
r67 = r105 != null ? String(r105) : null;
|
|
}
|
|
} else {
|
|
const cmd = data.cmd;
|
|
const r14 = typeof cmd === "string" ? cmd : null;
|
|
const evt = data.evt;
|
|
const r13 = typeof evt === "string" ? evt : null;
|
|
r67 = r14 != null ? r13 != null ? `${r14}/${r13}` : r14 : r12;
|
|
}
|
|
message_identity2 = r67;
|
|
}
|
|
if (message_identity2 == null) {
|
|
const category = data.category;
|
|
const r184 = typeof category === "string" ? category : null;
|
|
const type = data.type;
|
|
const r186 = typeof type === "string" ? type : null;
|
|
const name = data.name;
|
|
const r188 = typeof name === "string" ? name : null;
|
|
L123: {
|
|
if (r184 == null && r186 == null) {
|
|
const r189 = r188 == null;
|
|
r190 = null;
|
|
if (r189) {
|
|
break L123;
|
|
}
|
|
}
|
|
r190 = [r184, r186, r188].filter((item) => item != null).join("/");
|
|
}
|
|
message_identity2 = r190;
|
|
}
|
|
if (message_identity2 == null) {
|
|
message_identity2 = r15;
|
|
}
|
|
if (message_identity2 == null) {
|
|
message_identity2 = "unknown";
|
|
}
|
|
r198 = {
|
|
message_identity: message_identity2,
|
|
socket_kind: socket_kind2
|
|
};
|
|
}
|
|
return r198;
|
|
};
|
|
c9195_5 = r35;
|
|
export function buildZoomedInAnalyticsEvent(a0) {
|
|
const r0 = a0.key in c9195_4;
|
|
const key2 = a0.key;
|
|
if (r0) {
|
|
const props2 = c9195_4[key2](a0);
|
|
return props2 != null ? {
|
|
key: key2,
|
|
props: props2
|
|
} : null;
|
|
}
|
|
if (key2 in c9195_5) {
|
|
const key = a0.key;
|
|
const props = c9195_5[key](a0);
|
|
return props == null ? null : {
|
|
key,
|
|
props
|
|
};
|
|
}
|
|
return null;
|
|
}
|