Files
discord-decomp/sources/modules/links/LinkUtils.tsx
T
2026-07-27 16:20:00 +03:00

146 lines
6.4 KiB
TypeScript

/* Metro module 4246; source: modules/links/LinkUtils.tsx; dependencies: [1379, 1867, 3784, 661, 1386, 4100, 2] */
function _fun35276(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#35276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4418:6, offset: 0x0106d5e0, size: 687 bytes, params: 8, frame: 25
const closure = canViewChannel;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
let value = require(661) /* metro dependency 661: Constants */;
const ME = value.ME;
const env0_6 = value.Permissions;
const StaticChannelRoutes = (require(1386) /* metro dependency 1386: ChannelConstants */).StaticChannelRoutes;
const Array = global.Array;
value = Array.from(StaticChannelRoutes);
value = value.map(_fun35278);
value = value.join('|');
let RegExp = global.RegExp;
let regExp = new RegExp('^/channels/(\\d+|' + ME + ')(?:/)?(\\d+|' + value + ')?');
RegExp = global.RegExp;
value = '^/channels/(\\d+|' + ME + ')(?:/)(\\d+|' + value + ')(?:/)(\\d+)';
regExp = new RegExp(value);
RegExp = global.RegExp;
regExp = new RegExp('^/channels/(\\d+)(?:/)(\\d+)(?:/threads/)(\\d+)(?:/)(\\d+)');
RegExp = global.RegExp;
regExp = '^/channels/(\\d+|' + ME + ')(?:/)(\\d+)/roll-dice(?:/(\\d+)d(\\d+))?$';
regExp = new RegExp(regExp);
RegExp = global.RegExp;
regExp = new RegExp('^/guild-stages/(\\d+)(?:/)?(\\d+)?');
RegExp = global.RegExp;
regExp = new RegExp('^/events/(\\d+)(?:/)(\\d+)?((?:/)(\\d+))?');
RegExp = global.RegExp;
regExp = '^https://(?:(?:canary\\.|ptb\\.)?discord(?:app)?.com|staging\\.discord\\.co)/channels/(\\d+|' + ME + ')(?:/(\\d+|[a-zA-Z-]+))?(?:/(\\d+|[a-zA-Z-]+))?';
regExp = new RegExp(regExp);
RegExp = global.RegExp;
regExp = new RegExp('^https://(?:(?:canary\\.|ptb\\.)?discord(?:app)?.com|staging\\.discord\\.co)/channels/(\\d+)(?:/)(\\d+)(?:/threads/)(\\d+)(?:/)(\\d+)');
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/links/LinkUtils.tsx');
exports.CHANNEL_OR_MESSAGES_URL_RE = regExp;
exports.MEDIA_POST_URL_RE = regExp;
exports.tryParseChannelPath = tryParseChannelPath;
exports.tryParseEventDetailsPath = tryParseEventDetailsPath;
exports.canViewChannel = closure;
exports.isAccessibleChannelPath = isAccessibleChannelPath;
exports.tryParseDiceRollLink = tryParseDiceRollLink;
}
function canViewChannel(a0) { // fn#35277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4418:940, offset: 0x0106d88f, size: 53 bytes, params: 2, frame: 14
const isPrivate = a0.isPrivate();
return isPrivate ? !!isPrivate : PermissionStore.can(Permissions.VIEW_CHANNEL, a0);
}
function _fun35278(a0) { // fn#35278, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4418:210, offset: 0x0106d8c4, size: 41 bytes, params: 2, frame: 11
return (importDefault(4100) /* metro dependency 4100: RegexUtils */).escape(a0);
}
function tryParseChannelPath(a0) { // fn#35279, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4418:1150, offset: 0x0106d8ed, size: 250 bytes, params: 2, frame: 18
var r1;
var property;
let value = null;
if (value == a0) {
return value;
}
const value3 = a0.match(env0_8);
if (value != value3) {
if (value3.length > 3) {
return {guildId: value3[1], channelId: value3[2], messageId: value3[3]};
}
}
const value4 = a0.match(env0_9);
if (value != value4) {
if (value4.length > 4) {
return {guildId: value4[1], channelId: value4[2], threadId: value4[3], messageId: value4[4]};
}
}
const value5 = a0.match(env0_7);
if (value == value5) {
a0.match(env0_11);
r1 = value;
} else if (value5.length > 1) {
property = value5[2];
value = undefined;
r1 = {guildId: value5[1], channelId: value != property ? property : value};
} else {
a0.match(env0_11);
r1 = value;
}
return r1;
}
function tryParseEventDetailsPath(a0) { // fn#35280, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4418:1542, offset: 0x0106d9e7, size: 94 bytes, params: 2, frame: 13
const value = null;
if (value == a0) {
return value;
}
const value3 = a0.match(env0_12);
return value != value3 && value3.length > 1 ? {guildId: value3[1], guildEventId: value3[2],
recurrenceId: value3[4]} : value;
}
function isAccessibleChannelPath({guildId, channelId}) { // fn#35281, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4418:1761, offset: 0x0106da45, size: 91 bytes, params: 2, frame: 13
if (GuildStore.getGuild(guildId) == null) {
if (guildId !== ME) {
return false;
}
}
if (channelId == null) {
return true;
}
const channel = ChannelStore.getChannel(channelId);
return channel != null && canViewChannel(channel);
}
function tryParseDiceRollLink(a0) { // fn#35282, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4418:1958, offset: 0x0106daa0, size: 173 bytes, params: 2, frame: 19
var r3;
var r1;
var length;
var object2;
let value = null;
if (value == a0) {
return value;
}
const value3 = a0.match(env0_10);
if (value != value3) {
length = value3.length;
if (length > 2) {
object2 = {};
value = 1;
object2.guildId = value3[value];
object2.channelId = value3[2];
length = value3.length;
r3 = length !== 5 ? value : global.parseInt(value3[3], 10);
object2.diceCount = r3;
length = value3.length;
value = 6;
r3 = length !== 5 ? value : global.parseInt(value3[4], 10);
object2.diceSides = r3;
r1 = object2;
} else {
r1 = value;
}
} else {
r1 = value;
}
return r1;
}