110 lines
2.8 KiB
TypeScript
110 lines
2.8 KiB
TypeScript
// Metro module 5104 (f5105).
|
|
import "../stores/GuildStore";
|
|
import UserStore from "../stores/UserStore";
|
|
import LRUCache from "../_bundle/LRUCache";
|
|
import Durations from "./Durations";
|
|
import { getName } from "./UserUtils";
|
|
import { intl, t } from "../intl/index.native";
|
|
function $mk75408($env) {
|
|
return () => {
|
|
const r2 = $env;
|
|
const r3 = $env.$parent;
|
|
let env25331 = {
|
|
$parent: r3
|
|
};
|
|
const r6 = [];
|
|
env25331[0] = r6;
|
|
const r7 = r2[0];
|
|
if (r7 == null) {
|
|
r6.push.apply(r6, [...r3[5].getGuildIds()]);
|
|
} else if (Array.isArray(r7)) {
|
|
r7.forEach((item) => {
|
|
const guild = env25331.$parent[5].getGuild(item);
|
|
if (guild != null) {
|
|
env25331[0].push(guild.id);
|
|
}
|
|
});
|
|
} else {
|
|
const guild = r3[5].getGuild(r7);
|
|
if (guild != null) {
|
|
r6.push(guild.id);
|
|
}
|
|
}
|
|
if (r6.length > 0) {
|
|
(0, r3[1])(r3[3][4]).requestMembers(r6, r2[1].toLocaleLowerCase(), r2[2]);
|
|
}
|
|
};
|
|
}
|
|
let c3069_7;
|
|
let env3069 = {};
|
|
export function getGuildNameSuggestion(a0) {
|
|
const name = getName(UserStore.getCurrentUser());
|
|
return name == null ? "" : name.length !== 0 ? intl.formatToPlainString(t.Y6Qfju, {
|
|
username: a0?.truncateUsername ? name.slice(0, 20) : name
|
|
}) : "";
|
|
}
|
|
c3069_7 = new LRUCache({
|
|
maxAge: 1 * Durations.Millis.MINUTE
|
|
});
|
|
const r35 = {
|
|
getGuildNameSuggestion,
|
|
requestMembers: function requestMembers(a0, a1) {
|
|
let r26;
|
|
let r7 = arguments[2];
|
|
if (r7 === void 0) {
|
|
r7 = 10;
|
|
}
|
|
const isArray = Array.isArray(a0);
|
|
const r17 = [];
|
|
let c14619_1 = r17;
|
|
if (isArray) {
|
|
a0.forEach((item) => {
|
|
const r12 = `${item == null ? "" : item}:${a1}`;
|
|
let r15 = c3069_7.get(r12);
|
|
if (r15 == null) {
|
|
c3069_7.set(r12, true);
|
|
r15 = void 0;
|
|
}
|
|
if (r15 == null) {
|
|
c14619_1.push(item);
|
|
}
|
|
});
|
|
r26 = false;
|
|
} else {
|
|
const r19 = `${a0 == null ? "" : a0}:${a1}`;
|
|
let r22 = c3069_7.get(r19);
|
|
if (r22 == null) {
|
|
c3069_7.set(r19, true);
|
|
r22 = void 0;
|
|
}
|
|
r26 = r22 == null ? true : false;
|
|
}
|
|
if (r17.length > 0 && isArray) {
|
|
let env14621;
|
|
const r41 = env14621 = {
|
|
$parent: env3069
|
|
};
|
|
env14621[0] = r17;
|
|
env14621[1] = a1;
|
|
env14621[2] = r7;
|
|
if (env3069[4] != null) {
|
|
clearTimeout(env3069[4]);
|
|
}
|
|
env3069[4] = setTimeout($mk75408(r41), 200);
|
|
} else if (r26) {
|
|
let env14620;
|
|
const r31 = env14620 = {
|
|
$parent: env3069
|
|
};
|
|
env14620[0] = a0;
|
|
env14620[1] = a1;
|
|
env14620[2] = r7;
|
|
if (env3069[4] != null) {
|
|
clearTimeout(env3069[4]);
|
|
}
|
|
env3069[4] = setTimeout($mk75408(r31), 200);
|
|
}
|
|
}
|
|
};
|
|
export default r35;
|