Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
195 lines
7.1 KiB
TypeScript
195 lines
7.1 KiB
TypeScript
// Module ID: 7363
|
|
// Function ID: 7364
|
|
// Name: VoiceChannelEffectsUtils
|
|
// Dependencies: [1371, 7362, 7364, 7365, 7366, 7367, 7368, 7369, 7370, 7371, 7372, 7373, 7374, 7375, 7376, 7377, 7378, 7379, 7380, 7381, 7382, 7383, 7384, 7385, 12, 1430, 1396, 4226, 4230, 1114, 2]
|
|
// Exports: getEffectAnnouncement, getEffectUrl, sampleAnimationId
|
|
|
|
// Module 7363 (VoiceChannelEffectsUtils)
|
|
import util from "util" /* 1114 */;
|
|
import AvatarUtilsDefault from "AvatarUtils" /* 1396 */;
|
|
import ImageLoaderUtils from "ImageLoaderUtils" /* 1430 */;
|
|
import UnicodeEmojisDefault from "UnicodeEmojis" /* 4226 */;
|
|
import _modDef7364 from "module_7364" /* 7364 */;
|
|
import _modDef7365 from "module_7365" /* 7365 */;
|
|
import _modDef7366 from "module_7366" /* 7366 */;
|
|
import _modDef7367 from "module_7367" /* 7367 */;
|
|
import _modDef7368 from "module_7368" /* 7368 */;
|
|
import _modDef7369 from "module_7369" /* 7369 */;
|
|
import _modDef7370 from "module_7370" /* 7370 */;
|
|
import _modDef7371 from "module_7371" /* 7371 */;
|
|
import _modDef7372 from "module_7372" /* 7372 */;
|
|
import _modDef7373 from "module_7373" /* 7373 */;
|
|
import _modDef7374 from "module_7374" /* 7374 */;
|
|
import _modDef7375 from "module_7375" /* 7375 */;
|
|
import _modDef7376 from "module_7376" /* 7376 */;
|
|
import _modDef7377 from "module_7377" /* 7377 */;
|
|
import _modDef7378 from "module_7378" /* 7378 */;
|
|
import _modDef7379 from "module_7379" /* 7379 */;
|
|
import _modDef7380 from "module_7380" /* 7380 */;
|
|
import _modDef7381 from "module_7381" /* 7381 */;
|
|
import _modDef7382 from "module_7382" /* 7382 */;
|
|
import _modDef7383 from "module_7383" /* 7383 */;
|
|
import _modDef7384 from "module_7384" /* 7384 */;
|
|
import _modDef7385 from "module_7385" /* 7385 */;
|
|
import UserStore from "UserStore" /* 1371 */;
|
|
import apply from "module_12" /* 12 */;
|
|
|
|
require = fn;
|
|
const VoiceChannelEffectsConstants = fn(7362);
|
|
({ EMOJI_SIZE: closure_4, VoiceChannelEffectAnimationType } = VoiceChannelEffectsConstants);
|
|
const items = [_modDef7364];
|
|
const items1 = [_modDef7365, _modDef7366, _modDef7367, _modDef7368, _modDef7369, _modDef7370, _modDef7371, _modDef7372, _modDef7373, _modDef7374, _modDef7375, _modDef7376, _modDef7377, _modDef7378, _modDef7379, _modDef7380, _modDef7381, _modDef7382, _modDef7383, _modDef7384, _modDef7385];
|
|
const AnimationTypeToAnimations = { [VoiceChannelEffectAnimationType.BASIC]: items, [VoiceChannelEffectAnimationType.PREMIUM]: items1 };
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/voice_channel_effects/VoiceChannelEffectsUtils.tsx");
|
|
|
|
export const CUSTOM_CALL_SOUND_ANIMATION_RANGE = { start: 10, end: 15 };
|
|
export { AnimationTypeToAnimations };
|
|
export const getResizedEmojiData = apply.memoize((src) => new Promise((arg0) => {
|
|
src = arg0;
|
|
const image = new globalThis.Image();
|
|
image.src = src;
|
|
image.crossOrigin = "Anonymous";
|
|
image.onload = () => {
|
|
const result = React4 * ImageLoaderUtils.getDevicePixelRatio();
|
|
if (image.width === result) {
|
|
if (tmp2.height === result) {
|
|
closure_0(closure_0);
|
|
}
|
|
}
|
|
const element = <canvas />;
|
|
element.width = result;
|
|
element.height = result;
|
|
const context = element.getContext("2d");
|
|
if (context != null) {
|
|
context.drawImage(tmp2, 0, 0);
|
|
}
|
|
closure_0(element.toDataURL("image/png"));
|
|
};
|
|
}));
|
|
export const sampleAnimationId = function sampleAnimationId(BASIC, CUSTOM_CALL_SOUND_ANIMATION_RANGE) {
|
|
if (null != CUSTOM_CALL_SOUND_ANIMATION_RANGE) {
|
|
if (BASIC === VoiceChannelEffectAnimationType.PREMIUM) {
|
|
const sum = CUSTOM_CALL_SOUND_ANIMATION_RANGE.end + 1;
|
|
const _Math = Math;
|
|
const _Math2 = Math;
|
|
return Math.floor(Math.random() * (CUSTOM_CALL_SOUND_ANIMATION_RANGE.start - sum) + sum);
|
|
}
|
|
}
|
|
return Math.floor(Math.random() * obj[BASIC].length);
|
|
};
|
|
export const getEffectUrl = function getEffectUrl(emoji) {
|
|
let tmp = arg1;
|
|
if (arg1 === undefined) {
|
|
tmp = React4;
|
|
}
|
|
if (null != emoji.id) {
|
|
const obj3 = { id: null, animated: null, size: null };
|
|
({ id: obj5.id, animated } = emoji);
|
|
if (animated == null) {
|
|
animated = false;
|
|
}
|
|
obj3.animated = animated;
|
|
obj3.size = tmp;
|
|
return AvatarUtilsDefault.getEmojiURL(obj3);
|
|
} else {
|
|
const result = UnicodeEmojisDefault.convertSurrogateToName(emoji.name, false);
|
|
const tmp2 = importDefault;
|
|
const byName = UnicodeEmojisDefault.getByName(result);
|
|
let str = "";
|
|
if (null != byName) {
|
|
str = tmp2(4230).getURL(byName.surrogates);
|
|
const tmp2Result = tmp2(4230);
|
|
}
|
|
return str;
|
|
}
|
|
};
|
|
export const getEffectAnnouncement = function getEffectAnnouncement(items) {
|
|
if (items.length < 1) {
|
|
return "";
|
|
} else {
|
|
let emojiName = "userId";
|
|
let yZYxzF = dependencyMap;
|
|
const mapped = apply(items).map((item) => {
|
|
let tmp = item[emojiName];
|
|
if (tmp == null) {
|
|
tmp = null;
|
|
}
|
|
return tmp;
|
|
});
|
|
const found = mapped.filter((item) => null != item);
|
|
const arr = apply(items);
|
|
let obj3 = found.uniq().value();
|
|
emojiName = "emojiName";
|
|
const iter = found.uniq();
|
|
const mapped1 = apply(items).map((item) => {
|
|
let tmp = item[emojiName];
|
|
if (tmp == null) {
|
|
tmp = null;
|
|
}
|
|
return tmp;
|
|
});
|
|
const found1 = mapped1.filter((item) => null != item);
|
|
const arr3 = apply(items);
|
|
const valueResult2 = found1.uniq().value();
|
|
if (valueResult2.length < 2) {
|
|
let str2;
|
|
if (valueResult2 != null) {
|
|
str2 = valueResult2[0];
|
|
}
|
|
if (str2 == null) {
|
|
str2 = "";
|
|
}
|
|
let joined = str2;
|
|
} else {
|
|
joined = valueResult2.join(", ");
|
|
}
|
|
if (obj3.length < 1) {
|
|
return "";
|
|
} else if (1 === obj3.length) {
|
|
const intl2 = util.intl;
|
|
yZYxzF = util.t.yZYxzF;
|
|
const user = UserStore.getUser(obj3[0]);
|
|
let username;
|
|
if (user != null) {
|
|
username = user.username;
|
|
}
|
|
obj3 = { firstUsername: username, emojiNames: joined };
|
|
let formatToPlainStringResult = intl2.formatToPlainString(yZYxzF, obj3);
|
|
} else if (2 === obj3.length) {
|
|
const intl = util.intl;
|
|
const user1 = UserStore.getUser(obj3[0]);
|
|
let username1;
|
|
if (user1 != null) {
|
|
username1 = user1.username;
|
|
}
|
|
const obj4 = { firstUsername: username1, secondUsername: null, emojiNames: null };
|
|
const user2 = UserStore.getUser(obj3[1]);
|
|
let username2;
|
|
if (user2 != null) {
|
|
username2 = user2.username;
|
|
}
|
|
obj4.secondUsername = username2;
|
|
obj4.emojiNames = joined;
|
|
formatToPlainStringResult = intl.formatToPlainString(util.t["8rmtbd"], obj4);
|
|
} else {
|
|
const intl3 = util.intl;
|
|
const user3 = UserStore.getUser(obj3[0]);
|
|
let username3;
|
|
if (user3 != null) {
|
|
username3 = user3.username;
|
|
}
|
|
const obj = { firstUsername: username3, secondUsername: null, count: null, emojiNames: null };
|
|
const user4 = UserStore.getUser(obj3[1]);
|
|
let username4;
|
|
if (user4 != null) {
|
|
username4 = user4.username;
|
|
}
|
|
obj.secondUsername = username4;
|
|
obj.count = obj3.length - 2;
|
|
obj.emojiNames = joined;
|
|
formatToPlainStringResult = intl3.formatToPlainString(util.t["/okjv0"], obj);
|
|
}
|
|
const iter2 = found1.uniq();
|
|
}
|
|
};
|