288 lines
9.3 KiB
TypeScript
288 lines
9.3 KiB
TypeScript
/* Metro module 1940; source: utils/GuildRoleUtils.tsx; dependencies: [21, 673, 1941, 1942, 2] */
|
|
function _fun21555(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#21555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2067:6, offset: 0x00ef377c, size: 185 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_21558 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const closure = compareGuildRoles;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/GuildRoleUtils.tsx');
|
|
exports.sortGuildRoleRecords = function(a0) {
|
|
a0.sort(compareGuildRoles);
|
|
return a0;
|
|
};
|
|
exports.compareGuildRoles = closure;
|
|
exports.doesRoleSortHigher = doesRoleSortHigher;
|
|
exports.sortInviteRoles = sortInviteRoles;
|
|
exports.inviteRoleToDisplayData = inviteRoleToDisplayData;
|
|
exports.filterRoleDeletes = filterRoleDeletes;
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_21556(a0, a1) { // fn#21556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2067:46, offset: 0x00ef3835, size: 370 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun21557;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_21558(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_21558(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_21558(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun21557;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
}
|
|
|
|
function compareGuildRoles(a0, a1) { // fn#21559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2067:956, offset: 0x00ef39a7, size: 179 bytes, params: 3, frame: 17
|
|
var r1;
|
|
var r0;
|
|
var value;
|
|
const guildId = a0.guildId;
|
|
let id = a0.id;
|
|
if (id === guildId) {
|
|
id = a1.id;
|
|
value = 1;
|
|
if (id !== guildId) {
|
|
r1 = value;
|
|
} else {
|
|
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
value = value.compare(a0.id, a1.id);
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
id = a1.id;
|
|
value = -1;
|
|
if (id === guildId) {
|
|
r0 = value;
|
|
} else {
|
|
if (a0.position !== a1.position) {
|
|
r1 = a1.position - a0.position;
|
|
} else {
|
|
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
value = value.compare(a0.id, a1.id);
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function doesRoleSortHigher(a0, a1) { // fn#21561, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2067:1406, offset: 0x00ef3a71, size: 29 bytes, params: 3, frame: 13
|
|
return compareGuildRoles(a0, a1) < 0;
|
|
}
|
|
|
|
function sortInviteRoles(a0, a1) { // fn#21562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2067:1491, offset: 0x00ef3a8e, size: 84 bytes, params: 3, frame: 15
|
|
var r0;
|
|
var value;
|
|
if (a0.position !== a1.position) {
|
|
r0 = a1.position - a0.position;
|
|
} else {
|
|
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
value = value.compare(a0.id, a1.id);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function inviteRoleToDisplayData(a0, a1) { // fn#21563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2067:1629, offset: 0x00ef3ae2, size: 197 bytes, params: 3, frame: 15
|
|
var r3;
|
|
var moduleValue;
|
|
var moduleValue2;
|
|
const object2 = {};
|
|
object2.id = a1.id;
|
|
object2.name = a1.name;
|
|
object2.guildId = a0;
|
|
const color = a1.color;
|
|
const value = null;
|
|
if (color === 0) {
|
|
r3 = value;
|
|
} else {
|
|
moduleValue = require(673) /* metro dependency 673: ColorUtils */;
|
|
r3 = moduleValue.int2hex(a1.color);
|
|
}
|
|
object2.colorString = r3;
|
|
if (value != a1.colors) {
|
|
moduleValue2 = require(1941) /* metro dependency 1941: EnhancedRoleColorUtils */;
|
|
r3 = moduleValue2.extractColorStringsFromServerColors(a1.colors);
|
|
} else {
|
|
r3 = value;
|
|
}
|
|
object2.colorStrings = r3;
|
|
const icon = a1.icon;
|
|
object2.icon = value != icon ? icon : value;
|
|
const unicode_emoji = a1.unicode_emoji;
|
|
object2.unicodeEmoji = value != unicode_emoji ? unicode_emoji : value;
|
|
return object2;
|
|
}
|
|
|
|
function filterRoleDeletes(a0, a1) { // fn#21564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2067:1953, offset: 0x00ef3ba7, size: 208 bytes, params: 3, frame: 21
|
|
var r3;
|
|
var r4;
|
|
var value3;
|
|
var done;
|
|
var value4;
|
|
var value5;
|
|
var value8;
|
|
var id;
|
|
var moduleValue;
|
|
var fromServer;
|
|
var value9;
|
|
let value = a2;
|
|
const value2 = a3;
|
|
reducibleJoin2: while (true) {
|
|
if (value !== undefined) {
|
|
r3 = value;
|
|
break reducibleJoin2;
|
|
}
|
|
r3 = [];
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (value2 !== undefined) {
|
|
r4 = value2;
|
|
break reducibleJoin4;
|
|
}
|
|
r4 = [];
|
|
break reducibleJoin4;
|
|
}
|
|
if (r4.length + r3.length === 0) {
|
|
return a1;
|
|
}
|
|
const object2 = {};
|
|
copyDataProperties(object2, a1, undefined);
|
|
reducibleJoin8: while (true) {
|
|
if (r4 == null) {
|
|
break reducibleJoin8;
|
|
}
|
|
value = environment;
|
|
value = _createForOfIteratorHelperLoose_21556(r4);
|
|
value3 = value();
|
|
done = value3.done;
|
|
if (done) {
|
|
break reducibleJoin8;
|
|
}
|
|
r4 = value3;
|
|
reducibleLoop7: while (true) {
|
|
value4 = r4.value;
|
|
delete object2[value4];
|
|
value5 = value();
|
|
done = value5.done;
|
|
if (done) {
|
|
break reducibleJoin8;
|
|
}
|
|
r4 = value5;
|
|
continue reducibleLoop7;
|
|
}
|
|
}
|
|
const value6 = _createForOfIteratorHelperLoose_21556(r3);
|
|
const value7 = value6();
|
|
done = value7.done;
|
|
if (!done) {
|
|
r3 = value7;
|
|
reducibleLoop9: while (true) {
|
|
value8 = r3.value;
|
|
id = value8.id;
|
|
moduleValue = importAll(1942) /* metro dependency 1942: GuildRoleRecordUtils */;
|
|
fromServer = moduleValue.fromServer;
|
|
object2[id] = Reflect.apply(fromServer, moduleValue, [a0, value8]);
|
|
value9 = value6();
|
|
done = value9.done;
|
|
if (done) {
|
|
break reducibleLoop9;
|
|
}
|
|
r3 = value9;
|
|
continue reducibleLoop9;
|
|
}
|
|
}
|
|
return object2;
|
|
}
|
|
|