Files
2026-07-28 01:06:53 +03:00

153 lines
7.2 KiB
TypeScript

/* Metro module 4246; source: modules/links/LinkUtils.tsx; dependencies: [1379, 1867, 3784, 661, 1386, 4100, 2] */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
import RegexUtils from '../../utils/RegexUtils.tsx'; /* Metro dependency 4100 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as ChannelConstantsModule from '../channel/ChannelConstants.tsx'; /* Metro dependency 1386 */
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 canViewChannel2 = canViewChannel;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const ME = value.ME;
const env0_6 = value.Permissions;
const StaticChannelRoutes = (ChannelConstantsModule).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+)');
(FileImportTrackerModule).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 = canViewChannel2;
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 (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 object;
let value = null;
if (value == a0) {
return value;
}
const value3 = a0.match(env0_10);
if (value != value3) {
length = value3.length;
if (length > 2) {
object = {};
value = 1;
object.guildId = value3[value];
object.channelId = value3[2];
length = value3.length;
r3 = length !== 5 ? value : global.parseInt(value3[3], 10);
object.diceCount = r3;
length = value3.length;
value = 6;
r3 = length !== 5 ? value : global.parseInt(value3[4], 10);
object.diceSides = r3;
r1 = object;
} else {
r1 = value;
}
} else {
r1 = value;
}
return r1;
}
}
global.__d(_fun35276, 4246, [1379, 1867, 3784, 661, 1386, 4100,
2]) /* metro module 4246, dependencies: [1379, 1867, 3784, 661, 1386, 4100, 2] */;