Initial commit
This commit is contained in:
commit
af3b49f756
16065 files changed
+2938410
No files matched your search
@@ -0,0 +1,435 @@
|
||||
/* Metro module 4641; source: utils/EmbedUtils.tsx; dependencies: [661, 4642, 21, 1391, 22, 3738, 673, 4627, 2] */
|
||||
function _fun39903(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#39903, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:6, offset: 0x010ef3cc, size: 474 bytes, params: 8, frame: 19
|
||||
var RegExp;
|
||||
let env0_0 = require;
|
||||
const validateSize = function({width, height}) {
|
||||
return width > 0 && height > 0;
|
||||
};
|
||||
const appendQueryParams = function(a0, a1) {
|
||||
var env0_0 = a1;
|
||||
var value2 = new global.URL(a0);
|
||||
var env0_1 = value2;
|
||||
global.Object.keys(a1).forEach(_fun39907);
|
||||
return value2.toString();
|
||||
};
|
||||
const Object = global.Object;
|
||||
Object.defineProperty(exports, '__esModule', {value: true});
|
||||
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
||||
const env0_3 = constantsModule.MessageEmbedMediaFlags;
|
||||
const env0_4 = constantsModule.MessageEmbedTypes;
|
||||
const env0_5 = constantsModule.Permissions;
|
||||
const env0_6 = (require(4642) /* metro dependency 4642: EmbedConstants */).EMBED_TYPES_WITH_PARSEABLE_FIELDS;
|
||||
const env0_7 = RegExp('sketchfab', 'i');
|
||||
const env0_8 = RegExp('^https:\\/\\/sketchfab\\.com', 'i');
|
||||
const env0_9 = RegExp('youtube|steam|imgur|vimeo|sketchfab|soundcloud|streamable|twitch|vid\\.me|twitter', 'i');
|
||||
const env0_10 = RegExp('^https?:\\/\\/(?:canary\\.|ptb\\.|www\\.)?discord(?:app)?\\.com\\/channels\\/([0-9]+)\\/shop$',
|
||||
'');
|
||||
const env0_11 = RegExp('^https?:\\/\\/(?:canary\\.|ptb\\.|www\\.)?discord(?:app)?\\.com\\/channels\\/([0-9]+)\\/shop\\/([0-9]+)$',
|
||||
'');
|
||||
RegExp = global.RegExp;
|
||||
const regExp = new RegExp('^https://(?:(?:canary\\.|ptb\\.)?discord(?:app)?.com|staging\\.discord\\.co)/shop');
|
||||
const env0_13 = RegExp('^https?:\\/\\/(?:canary\\.|ptb\\.|www\\.)?discord(?:app)?\\.com\\/channels\\/([0-9]+)\\/game-shop\\/([0-9]+)\\/([0-9]+)',
|
||||
'');
|
||||
const env0_14 = RegExp('^https?:\\/\\/(?:canary\\.|ptb\\.|www\\.)?discord(?:app)?\\.com\\/game-shop\\/([0-9]+)\\/([0-9]+)',
|
||||
'');
|
||||
const env0_15 = RegExp('^https?:\\/\\/(?:canary\\.|ptb\\.|www\\.)?discord(?:app)?\\.com\\/shop\\?(?=.*tab=game-shops)(?=.*applicationId=[0-9]+)(?=.*skuId=[0-9]+)',
|
||||
'');
|
||||
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/EmbedUtils.tsx');
|
||||
exports.sanitizeEmbed = sanitizeEmbed;
|
||||
exports.mergeEmbedsOnURL = function(a0) {
|
||||
var Map = global.Map;
|
||||
var env0_0 = new Map();
|
||||
a0.forEach(_fun39911);
|
||||
return [];
|
||||
};
|
||||
exports.getEffectiveVideoProvider = function(a0, a1) {
|
||||
var property;
|
||||
var prototype;
|
||||
var value;
|
||||
var value2;
|
||||
var error;
|
||||
if (a0 !== 'YouTube') {
|
||||
reducibleJoin20: while (true) {
|
||||
if (a0 !== 'TikTok') {
|
||||
reduciblePort19: while (true) {
|
||||
exceptionLanding18: while (true) {
|
||||
if (a1 == null) {
|
||||
break reduciblePort19;
|
||||
}
|
||||
try {
|
||||
property = global.URL;
|
||||
} catch (error) {
|
||||
break exceptionLanding18;
|
||||
}
|
||||
try {
|
||||
prototype = property.prototype;
|
||||
} catch (error) {
|
||||
break exceptionLanding18;
|
||||
}
|
||||
try {
|
||||
} catch (error) {
|
||||
break exceptionLanding18;
|
||||
}
|
||||
try {
|
||||
value2 = new property(a1);
|
||||
} catch (error) {
|
||||
break exceptionLanding18;
|
||||
}
|
||||
try {
|
||||
value = value2 instanceof Object ? value2 : value;
|
||||
} catch (error) {
|
||||
break exceptionLanding18;
|
||||
}
|
||||
try {
|
||||
property = value.hostname;
|
||||
} catch (error) {
|
||||
break exceptionLanding18;
|
||||
}
|
||||
try {
|
||||
value = property === 'www.youtube.com';
|
||||
} catch (error) {
|
||||
break exceptionLanding18;
|
||||
}
|
||||
if (value) {
|
||||
return 'YouTube';
|
||||
}
|
||||
try {
|
||||
value = property === 'www.tiktok.com';
|
||||
} catch (error) {
|
||||
break exceptionLanding18;
|
||||
}
|
||||
if (value) {
|
||||
return 'TikTok';
|
||||
}
|
||||
break reduciblePort19;
|
||||
}
|
||||
break reduciblePort19;
|
||||
}
|
||||
return a0;
|
||||
}
|
||||
break reducibleJoin20;
|
||||
}
|
||||
}
|
||||
return a0;
|
||||
};
|
||||
exports.isEmbedInline = isEmbedInline;
|
||||
exports.isServerShopArticleEmbed = isServerShopArticleEmbed;
|
||||
exports.isCollectiblesShopArticleEmbed = isCollectiblesShopArticleEmbed;
|
||||
exports.isSocialLayerStorefrontArticleEmbed = isSocialLayerStorefrontArticleEmbed;
|
||||
exports.getMaxEmbedMediaSize = function(a0, a1, a2) {
|
||||
return a1 == null ? a0.provider?.name === 'TikTok' ? {'maxMediaWidth': 400,
|
||||
'maxMediaHeight': 450} : {'maxMediaWidth': 400, 'maxMediaHeight': 300} : a2 != null ? {maxMediaWidth: a1,
|
||||
maxMediaHeight: a2} : a0.provider?.name === 'TikTok' ? {'maxMediaWidth': 400,
|
||||
'maxMediaHeight': 450} : {'maxMediaWidth': 400, 'maxMediaHeight': 300};
|
||||
};
|
||||
exports.canEmbedLinks = canEmbedLinks;
|
||||
exports.shouldStripEmbeds = function(a0) {
|
||||
return a0.content !== '' || a0.messageSnapshots.some(_fun39920);
|
||||
};
|
||||
}
|
||||
|
||||
function sanitizeMedia({url, proxy_url, width, height, placeholder, placeholder_version, description, flags, content_type}) { // fn#39905, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:1031, offset: 0x010ef5c2, size: 186 bytes, params: 2, frame: 20
|
||||
const object2 = {url: url, proxyURL: proxy_url, width: width, height: height, placeholder: placeholder,
|
||||
placeholderVersion: placeholder_version, description: description};
|
||||
const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */;
|
||||
const hasFlag = flagUtilsModule.hasFlag;
|
||||
const r7 = flags ?? 0;
|
||||
const IS_ANIMATED = MessageEmbedMediaFlags.IS_ANIMATED;
|
||||
object2.srcIsAnimated = Reflect.apply(hasFlag, flagUtilsModule, [r7, IS_ANIMATED]);
|
||||
object2.flags = flags ?? 0;
|
||||
object2.contentType = content_type ?? undefined;
|
||||
return object2;
|
||||
}
|
||||
|
||||
function appendQueryParams(a0, a1) { // fn#39906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:1360, offset: 0x010ef67c, size: 86 bytes, params: 3, frame: 14
|
||||
const env0_0 = a1;
|
||||
const URL = global.URL;
|
||||
const uRL = new URL(a0);
|
||||
const Object = global.Object;
|
||||
Object.keys(a1).forEach(_fun39907);
|
||||
return uRL.toString();
|
||||
}
|
||||
|
||||
function sanitizeEmbed(a0, a1, a2) { // fn#39908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:1557, offset: 0x010ef6f9, size: 1205 bytes, params: 4, frame: 23
|
||||
var r4;
|
||||
var r10;
|
||||
var r8;
|
||||
var r7;
|
||||
var r6;
|
||||
var object6;
|
||||
var object7;
|
||||
var object8;
|
||||
var defaultImport2;
|
||||
var Date;
|
||||
var value7;
|
||||
var date;
|
||||
var moduleValue;
|
||||
var object9;
|
||||
var appendQueryParamsBinding;
|
||||
var binding;
|
||||
var value20;
|
||||
var regexp;
|
||||
const object10 = {};
|
||||
var value;
|
||||
const value2 = undefined;
|
||||
object10.id = (importDefault(22) /* metro dependency 22 */).uniqueId('embed_');
|
||||
object10.url = a2.url;
|
||||
let type = a2.type;
|
||||
object10.type = type;
|
||||
object10.rawTitle = a2.title;
|
||||
object10.rawDescription = a2.description;
|
||||
object10.referenceId = a2.reference_id;
|
||||
object10.flags = a2.flags;
|
||||
object10.contentScanVersion = a2.content_scan_version;
|
||||
let footer = a2.footer;
|
||||
if (footer != null) {
|
||||
object6 = {};
|
||||
footer = a2.footer;
|
||||
object6.text = footer.text;
|
||||
footer = a2.footer;
|
||||
object6.iconURL = footer.icon_url;
|
||||
footer = a2.footer;
|
||||
object6.iconProxyURL = footer.proxy_icon_url;
|
||||
object10.footer = object6;
|
||||
}
|
||||
let author = a2.author;
|
||||
if (author != null && a2.author.name != null) {
|
||||
object7 = {};
|
||||
author = a2.author;
|
||||
object7.name = author.name;
|
||||
author = a2.author;
|
||||
object7.url = author.url;
|
||||
author = a2.author;
|
||||
object7.iconURL = author.icon_url;
|
||||
author = a2.author;
|
||||
object7.iconProxyURL = author.proxy_icon_url;
|
||||
object10.author = object7;
|
||||
}
|
||||
let provider = a2.provider;
|
||||
if (provider != null && a2.provider.name != null) {
|
||||
object8 = {};
|
||||
provider = a2.provider;
|
||||
object8.name = provider.name;
|
||||
provider = a2.provider;
|
||||
object8.url = provider.url;
|
||||
object10.provider = object8;
|
||||
}
|
||||
let timestamp = a2.timestamp;
|
||||
if (timestamp != null) {
|
||||
defaultImport2 = importDefault(3738) /* metro dependency 3738 */;
|
||||
Date = global.Date;
|
||||
timestamp = a2.timestamp;
|
||||
value7 = Object.create(Date.prototype, {constructor: {value: Date}});
|
||||
date = new Date(timestamp);
|
||||
object10.timestamp = defaultImport2(date instanceof Object ? date : value7);
|
||||
}
|
||||
if (a2.color != null) {
|
||||
moduleValue = require(673) /* metro dependency 673: ColorUtils */;
|
||||
object10.color = moduleValue.int2hsl(a2.color, false);
|
||||
}
|
||||
let thumbnail = a2.thumbnail;
|
||||
if (thumbnail != null) {
|
||||
if (validateSize(a2.thumbnail)) {
|
||||
type = object10.type;
|
||||
if (MessageEmbedTypes.ARTICLE === type) {
|
||||
object10.image = sanitizeMedia(a2.thumbnail);
|
||||
} else if (MessageEmbedTypes.IMAGE === type) {
|
||||
object10.image = sanitizeMedia(a2.thumbnail);
|
||||
} else {
|
||||
object10.thumbnail = sanitizeMedia(a2.thumbnail);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (a2.image != null && validateSize(a2.image)) {
|
||||
object10.image = sanitizeMedia(a2.image);
|
||||
}
|
||||
let video = a2.video;
|
||||
if (video != null) {
|
||||
thumbnail = object10.thumbnail;
|
||||
r4 = thumbnail == null && a2.video.proxy_url != null;
|
||||
r4 = r4 && validateSize(a2.video);
|
||||
if (r4) {
|
||||
object9 = {};
|
||||
video = a2.video;
|
||||
object9.width = video.width;
|
||||
video = a2.video;
|
||||
object9.height = video.height;
|
||||
appendQueryParamsBinding = appendQueryParams;
|
||||
video = a2.video;
|
||||
object9.url = appendQueryParamsBinding(video.proxy_url, {format: 'webp'});
|
||||
object10.thumbnail = object9;
|
||||
}
|
||||
thumbnail = object10.thumbnail;
|
||||
r4 = thumbnail != null && validateSize(a2.video);
|
||||
if (r4) {
|
||||
provider = a2.provider;
|
||||
video = a2.video;
|
||||
if (provider == null) {
|
||||
binding = env0_8;
|
||||
if (binding.test(video.url)) {
|
||||
r6 = false;
|
||||
} else {
|
||||
value20 = video.proxy_url != null;
|
||||
if (value20) {
|
||||
r10 = value20;
|
||||
} else {
|
||||
regexp = RegExp('^https:', 'i');
|
||||
r10 = regexp.test(video.url);
|
||||
}
|
||||
r8 = a1 != null && (importDefault(21) /* metro dependency 21: SnowflakeUtils */).extractTimestamp(a1) < 1492472454139;
|
||||
if (r8) {
|
||||
r8 = r10 && provider != null;
|
||||
r8 = r8 && env0_9.test(provider.name);
|
||||
r7 = r8;
|
||||
} else {
|
||||
r7 = r10;
|
||||
}
|
||||
r6 = r7;
|
||||
}
|
||||
} else {
|
||||
binding = env0_7;
|
||||
if (binding.test(provider.name)) {
|
||||
r6 = false;
|
||||
} else {
|
||||
binding = env0_8;
|
||||
if (binding.test(video.url)) {
|
||||
r6 = false;
|
||||
} else {
|
||||
value20 = video.proxy_url != null;
|
||||
if (value20) {
|
||||
r10 = value20;
|
||||
} else {
|
||||
regexp = RegExp('^https:', 'i');
|
||||
r10 = regexp.test(video.url);
|
||||
}
|
||||
r8 = a1 != null && (importDefault(21) /* metro dependency 21: SnowflakeUtils */).extractTimestamp(a1) < 1492472454139;
|
||||
if (r8) {
|
||||
r8 = r10 && provider != null;
|
||||
r8 = r8 && env0_9.test(provider.name);
|
||||
r7 = r8;
|
||||
} else {
|
||||
r7 = r10;
|
||||
}
|
||||
r6 = r7;
|
||||
}
|
||||
}
|
||||
}
|
||||
r4 = r6;
|
||||
}
|
||||
if (r4) {
|
||||
object10.video = sanitizeMedia(a2.video);
|
||||
}
|
||||
}
|
||||
if (EMBED_TYPES_WITH_PARSEABLE_FIELDS.has(object10.type)) {
|
||||
object10.fields = (a2.fields ?? []).map(function({name, value, inline}) {
|
||||
return {rawName: name, rawValue: value, inline: inline};
|
||||
});
|
||||
} else {
|
||||
object10.fields = [];
|
||||
}
|
||||
if (a2.components != null) {
|
||||
value = require(4627) /* metro dependency 4627: InteractionComponentUtils */;
|
||||
value = value.transformComponents(a2.components);
|
||||
object10.components = value.length > 0 ? value : value2;
|
||||
}
|
||||
return object10;
|
||||
}
|
||||
|
||||
function mergeEmbedsOnURL(a0) { // fn#39910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:3299, offset: 0x010efbd4, size: 62 bytes, params: 2, frame: 12
|
||||
const Map = global.Map;
|
||||
const map = new Map();
|
||||
a0.forEach(_fun39911);
|
||||
return [];
|
||||
}
|
||||
|
||||
function isEmbedInline({image, video, type, author, rawTitle}) { // fn#39913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:3846, offset: 0x010efd3b, size: 104 bytes, params: 2, frame: 8
|
||||
var r2;
|
||||
var r1;
|
||||
var value2;
|
||||
let r0 = image != null || video != null;
|
||||
if (r0) {
|
||||
value2 = type === MessageEmbedTypes.GIFV;
|
||||
if (value2) {
|
||||
r1 = value2;
|
||||
} else {
|
||||
r2 = type !== MessageEmbedTypes.RICH && author == null;
|
||||
r2 = r2 && rawTitle == null;
|
||||
r1 = r2;
|
||||
}
|
||||
r0 = r1;
|
||||
}
|
||||
return r0;
|
||||
}
|
||||
|
||||
function isServerShopArticleEmbed(a0) { // fn#39914, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:4012, offset: 0x010efda3, size: 88 bytes, params: 2, frame: 14
|
||||
const type = a0.type;
|
||||
const ARTICLE = MessageEmbedTypes.ARTICLE;
|
||||
return type === ARTICLE && a0.url != null && (env0_11.test(a0.url) || env0_10.test(a0.url));
|
||||
}
|
||||
|
||||
function isCollectiblesShopArticleEmbed(a0) { // fn#39915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:4154, offset: 0x010efdfb, size: 63 bytes, params: 2, frame: 13
|
||||
const type = a0.type;
|
||||
const ARTICLE = MessageEmbedTypes.ARTICLE;
|
||||
return type === ARTICLE && a0.url != null && env0_12.test(a0.url);
|
||||
}
|
||||
|
||||
function isSocialLayerStorefrontArticleEmbed(a0) { // fn#39916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:4290, offset: 0x010efe3a, size: 110 bytes, params: 2, frame: 15
|
||||
var r1;
|
||||
var binding;
|
||||
const type = a0.type;
|
||||
const ARTICLE = MessageEmbedTypes.ARTICLE;
|
||||
let r0 = type === ARTICLE && a0.url != null;
|
||||
if (r0) {
|
||||
binding = env0_14;
|
||||
r1 = binding.test(a0.url) || env0_13.test(a0.url);
|
||||
r1 = !r1 ? env0_15.test(a0.url) : r1;
|
||||
r0 = r1;
|
||||
}
|
||||
return r0;
|
||||
}
|
||||
|
||||
function canEmbedLinks(a0, a1) { // fn#39918, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:4693, offset: 0x010eff0a, size: 61 bytes, params: 3, frame: 13
|
||||
return a0.isPrivate() ? !a0.isManaged() : a1.can(Permissions.EMBED_LINKS, a0);
|
||||
}
|
||||
|
||||
function shouldStripEmbeds(a0) { // fn#39919, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:4801, offset: 0x010eff47, size: 45 bytes, params: 2, frame: 12
|
||||
return a0.content !== '' || a0.messageSnapshots.some(function(a0) {
|
||||
return a0.message.content !== '' || a0.message.attachments.length > 0;
|
||||
});
|
||||
}
|
||||
|
||||
function _fun39907(a0) { // fn#39907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:1440, offset: 0x010ef6d2, size: 39 bytes, params: 2, frame: 13
|
||||
env0_1.searchParams.set(a0, require[a0]);
|
||||
}
|
||||
|
||||
function _fun39911(a0) { // fn#39911, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4819:3365, offset: 0x010efc12, size: 185 bytes, params: 2, frame: 15
|
||||
var binding;
|
||||
var value2;
|
||||
var images;
|
||||
if (a0.url != null) {
|
||||
binding = env0_0;
|
||||
value2 = binding.get(a0.url);
|
||||
if (value2 == null) {
|
||||
binding = env0_1;
|
||||
binding.push(a0);
|
||||
binding = env0_0;
|
||||
binding.set(a0.url, a0);
|
||||
return undefined;
|
||||
}
|
||||
if (a0.image != null) {
|
||||
images = value2.images;
|
||||
if (images == null) {
|
||||
value2.images = [];
|
||||
if (value2.image != null) {
|
||||
images = value2.images;
|
||||
images.push(value2.image);
|
||||
}
|
||||
}
|
||||
images = value2.images;
|
||||
images.push(a0.image);
|
||||
}
|
||||
} else {
|
||||
env0_1.push(a0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user