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

411 lines
19 KiB
TypeScript

/* Metro module 5242; source: modules/game_relationships/GameRelationshipStore.tsx; dependencies: [6, 7, 15, 17, 18, 3793, 661, 3780, 566, 694, 2] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as SecondaryIndexMapModule from '../../external/discord_common/js/packages/secondary-index-map/SecondaryIndexMap.tsx'; /* Metro dependency 3780 */
function _fun46622(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#46622, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:6, offset: 0x011ac006, size: 472 bytes, params: 8, frame: 21
const _arrayLikeToArray_46628 = 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 Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_0 = ClassCallCheck;
const env0_1 = CreateClass;
const env0_2 = PossibleConstructorReturn;
const GAME_RELATIONSHIP_KEY = function(a0, a1) {
return '' + a1 + '-' + a0;
};
const GameRelationshipIndexes_BY_APPLICATION_ID = function(a0) {
return 'application-id-' + a0;
};
const GameRelationshipIndexes_BY_USER_ID = function(a0) {
return 'user-id-' + a0;
};
const GameRelationshipIndexes_BY_RELATIONSHIP_TYPE = function(a0) {
return 'relationship-type-' + a0;
};
const SecondaryIndexMap = (SecondaryIndexMapModule).SecondaryIndexMap;
let secondaryIndexMap = new SecondaryIndexMap(function(a0) {
var items = [];
items.push(GameRelationshipIndexes_BY_APPLICATION_ID(a0.applicationId));
items.push(GameRelationshipIndexes_BY_USER_ID(a0.id));
items.push(GameRelationshipIndexes_BY_RELATIONSHIP_TYPE(a0.type));
return items;
}, function({since}) {
return '' + since;
});
const Store = (Flux).Store;
_fun46639(Store).displayName = 'GameRelationshipStore';
secondaryIndexMap = new secondaryIndexMap(importDefault(694) /* metro dependency 694: Dispatcher */,
{CONNECTION_OPEN: CONNECTION_OPEN_46655, GAME_RELATIONSHIP_ADD: function(a0) {
upsert(a0.gameRelationship);
recountRelationshipTypes();
}, GAME_RELATIONSHIP_REMOVE: function(a0) {
var remove_46632Binding = remove_46632;
var userId = a0.userId;
remove_46632Binding(userId, a0.applicationId);
recountRelationshipTypes();
}, APPLICATIONS_FETCH_SUCCESS: APPLICATIONS_FETCH_SUCCESS_46659});
(FileImportTrackerModule).fileFinishedImporting('modules/game_relationships/GameRelationshipStore.tsx');
exports.default = secondaryIndexMap;
function _isNativeReflectConstruct_46623() { // fn#46623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:189, offset: 0x011ac1de, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_46623_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_46626(a0, a1) { // fn#46626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:382, offset: 0x011ac23c, 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 _fun46627;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_46628(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_46628(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_46628(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun46627;
}
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 _fun46627() { // fn#46627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:953, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function recountRelationshipTypes() { // fn#46629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:1832, offset: 0x011ac3ae, size: 75 bytes, params: 1, frame: 13
env0_11.values().forEach(_fun46630);
function _fun46630({type, id}) { // fn#46630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:1904, offset: 0x011ac3f9, size: 160 bytes, params: 2, frame: 12
const FRIEND = RelationshipTypes.FRIEND;
if (type === FRIEND) {
env0_2 += 1;
} else {
var PENDING_OUTGOING = RelationshipTypes.PENDING_OUTGOING;
if (type === PENDING_OUTGOING) {
env0_1 += 1;
return undefined;
}
var PENDING_INCOMING = RelationshipTypes.PENDING_INCOMING;
if (type !== PENDING_INCOMING) {
return undefined;
}
var relationshipStoreBinding = RelationshipStore;
if (relationshipStoreBinding.isSpam(id)) {
return undefined;
}
relationshipStoreBinding = RelationshipStore;
if (relationshipStoreBinding.isIgnored(id)) {
return undefined;
}
env0_0 += 1;
}
}
}
function upsert(a0) { // fn#46631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:2070, offset: 0x011ac499, size: 45 bytes, params: 2, frame: 16
const binding = env0_11;
binding.set(GAME_RELATIONSHIP_KEY(a0.id, a0.applicationId), a0);
}
function remove_46632(a0, a1) { // fn#46632, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:2142, offset: 0x011ac4c6, size: 37 bytes, params: 3, frame: 15
env0_11.delete(GAME_RELATIONSHIP_KEY(a0, a1));
}
function _fun46639(a0) { // fn#46639, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:2206, offset: 0x011ac5dd, size: 327 bytes, params: 2, frame: 16
const GameRelationshipStore2 = GameRelationshipStore;
Inherits(GameRelationshipStore2, a0);
return env0_1(GameRelationshipStore2, [{key: 'initialize', value: function() {
this.waitFor(RelationshipStore);
}}, {key: 'getPendingIncomingCount', value: value_46642}, {key: 'getPendingOutgoingCount', value: value_46643},
{key: 'getGameFriendCount', value: value_46644}, {key: 'getGameFriendsForApplication', value: value_46645},
{key: 'getGameRelationshipsForUser', value: value_46647}, {key: 'getGameRelationshipsForUserByType',
value: function(a0, a1) {
var env0_0 = a1;
return this.getGameRelationshipsForUser(a0).filter(_fun46649);
}}, {key: 'getGameFriendsForUser', value: function(a0) {
return this.getGameRelationshipsForUserByType(a0, RelationshipTypes.FRIEND);
}}, {key: 'getGameRelationshipCount', value: value_46651}, {key: 'getGameRelationships', value: value_46652},
{key: 'getGameRelationshipsByType', value: value_46653}, {key: 'getGameRelationshipsVersion',
value: value_46654}]);
function GameRelationshipStore() { // fn#46640, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:2218, offset: 0x00f81779, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_0(this, GameRelationshipStore);
const value3 = env1_3(GameRelationshipStore);
return env1_2(this, _isNativeReflectConstruct_46623() ? global.Reflect.construct(value3, arguments,
env1_3(this).constructor) : value3.apply(this, arguments));
}
function value_46642() { // fn#46642, offset: 0x00e2f9de, size: 9 bytes, params: 1, frame: 1
return env1_12;
}
function value_46643() { // fn#46643, offset: 0x00e2f9d5, size: 9 bytes, params: 1, frame: 1
return env1_13;
}
function value_46644() { // fn#46644, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
return env1_14;
}
function value_46645(a0) { // fn#46645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:2784, offset: 0x011ac724, size: 53 bytes, params: 2, frame: 14
var environment;
let value = environment.__proto__;
const binding = env1_11;
const values = binding.values;
value = GameRelationshipIndexes_BY_APPLICATION_ID(a0);
value = Reflect.apply(values, binding, [value, true]);
return value.filter(function({type}) {
return type === RelationshipTypes.FRIEND;
});
}
function value_46647(a0) { // fn#46647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:2935, offset: 0x011ac774, size: 36 bytes, params: 2, frame: 14
const value = environment.__proto__;
const binding = env1_11;
return binding.values(GameRelationshipIndexes_BY_USER_ID(a0), true);
}
function value_46648(a0, a1) { // fn#46648, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:3054, offset: 0x011ac798, size: 43 bytes, params: 3, frame: 12
const env0_0 = a1;
return this.getGameRelationshipsForUser(a0).filter(function({type}) {
return type === require;
});
function _fun46649({type}) { // fn#46649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:3119, offset: 0x0108b18c, size: 21 bytes, params: 2, frame: 2
return type === require;
}
}
function value_46651() { // fn#46651, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:3282, offset: 0x011ac7e4, size: 18 bytes, params: 1, frame: 9
return env1_11.size();
}
function value_46652() { // fn#46652, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
return env1_11;
}
function value_46653(a0) { // fn#46653, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:3407, offset: 0x011ac7f6, size: 36 bytes, params: 2, frame: 14
const value = environment.__proto__;
const binding = env1_11;
return binding.values(GameRelationshipIndexes_BY_RELATIONSHIP_TYPE(a0), true);
}
function value_46654() { // fn#46654, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:3530, offset: 0x011ac81a, size: 15 bytes, params: 1, frame: 1
return env1_11.version;
}
}
function CONNECTION_OPEN_46655({gameRelationships}) { // fn#46655, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:3653, offset: 0x011ac829, size: 55 bytes, params: 2, frame: 12
env0_11.clear();
gameRelationships.forEach(function(a0) {
upsert({id: a0.id, applicationId: a0.application_id, type: a0.type, since: a0.since,
dmAccessType: a0.dm_access_type});
});
recountRelationshipTypes();
}
function APPLICATIONS_FETCH_SUCCESS_46659({unknownApplicationIds}) { // fn#46659, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5420:4183, offset: 0x011ac8ee, size: 213 bytes, params: 2, frame: 21
var r4;
var r6;
var r2;
var _createForOfIteratorHelperLoose_46626Binding;
var value2;
var value3;
var done;
var value4;
var binding;
var values;
var value5;
var value6;
var value7;
var type;
var PENDING_INCOMING;
var value8;
var PENDING_OUTGOING;
var value9;
var remove_46632Binding;
var id;
var value10;
var value11;
if (unknownApplicationIds != null) {
value2 = _createForOfIteratorHelperLoose_46626(unknownApplicationIds);
value3 = value2();
done = value3.done;
if (!done) {
r4 = value3;
while (true) {
value4 = r4.value;
_createForOfIteratorHelperLoose_46626Binding = _createForOfIteratorHelperLoose_46626;
binding = env0_11;
values = binding.values;
value5 = _createForOfIteratorHelperLoose_46626Binding(Reflect.apply(values, binding,
[GameRelationshipIndexes_BY_APPLICATION_ID(value4)]));
value6 = value5();
done = value6.done;
if (!done) {
r6 = value6;
while (true) {
value7 = r6.value;
type = value7.type;
PENDING_INCOMING = RelationshipTypes.PENDING_INCOMING;
value8 = type !== PENDING_INCOMING;
if (value8) {
type = value7.type;
PENDING_OUTGOING = RelationshipTypes.PENDING_OUTGOING;
value9 = type !== PENDING_OUTGOING;
r2 = value9;
} else {
r2 = value8;
}
if (r2) {
continue;
}
remove_46632Binding = remove_46632;
id = value7.id;
remove_46632Binding(id, value4);
value10 = value5();
done = value10.done;
if (done) {
break;
}
r6 = value10;
continue;
}
}
value11 = value2();
done = value11.done;
if (done) {
break;
}
r4 = value11;
continue;
}
}
recountRelationshipTypes();
}
}
}
global.__d(_fun46622, 5242, [6, 7, 15, 17, 18, 3793, 661, 3780, 566, 694,
2]) /* metro module 5242, dependencies: [6, 7, 15, 17, 18, 3793, 661, 3780, 566, 694, 2] */;