283 lines
11 KiB
TypeScript
283 lines
11 KiB
TypeScript
/* Metro module 8327; source: modules/premium/gifting/shared/FriendAnniversaryUtils.tsx; dependencies: [3381, 2] */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as Module03381Module from '../../../../by-id/module-03381.js'; /* Metro dependency 3381 */
|
|
|
|
function _fun66336(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66336, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8512:6, offset: 0x01bf72a9, size: 166 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_66339 = 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});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/premium/gifting/shared/FriendAnniversaryUtils.tsx');
|
|
exports.FRIEND_ANNIVERSARY_ELIGIBILITY_WINDOW_DAYS = 7;
|
|
exports.isFriendAnniversary = isFriendAnniversary;
|
|
exports.yearsSince = yearsSince;
|
|
exports.categorizeFriendAnniversariesByAffinity = categorizeFriendAnniversariesByAffinity;
|
|
exports.pruneTimestampMap = function(a0, a1, a2) {
|
|
var r3;
|
|
var propertyName;
|
|
var propertyName2;
|
|
var property;
|
|
var object = {};
|
|
for (propertyName in a0) {
|
|
property = a0[propertyName];
|
|
if (!(a1 - property <= a2)) {
|
|
r3 = propertyName2;
|
|
continue;
|
|
}
|
|
object[propertyName] = property;
|
|
r3 = propertyName2;
|
|
}
|
|
return object;
|
|
};
|
|
function _createForOfIteratorHelperLoose_66337(a0, a1) { // fn#66337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8512:46, offset: 0x01bf734f, size: 372 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 _fun66338;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_66339(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_66339(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_66339(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun66338;
|
|
}
|
|
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 _fun66338() { // fn#66338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8512:617, 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 isFriendAnniversary(a0) { // fn#66340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8512:1169, offset: 0x01bf74c3, size: 224 bytes, params: 2, frame: 24
|
|
var r1;
|
|
var property;
|
|
var moduleValue;
|
|
var setYear;
|
|
var value5;
|
|
var moduleValue2;
|
|
var isSameDay;
|
|
var Math;
|
|
var abs;
|
|
var moduleValue3;
|
|
var differenceInDays;
|
|
var value6;
|
|
const Date = global.Date;
|
|
const date = new Date();
|
|
const fullYear = date.getFullYear();
|
|
const items2 = [-1];
|
|
const value3 = 0;
|
|
items2[1] = value3;
|
|
items2[2] = 1;
|
|
let length = items2.length;
|
|
if (value3 < length) {
|
|
r1 = value3;
|
|
reducibleLoop1: while (true) {
|
|
property = items2[r1];
|
|
moduleValue = require(dependencyMap[value3]);
|
|
setYear = moduleValue.setYear;
|
|
value5 = Reflect.apply(setYear, moduleValue, [a0, fullYear + property]);
|
|
moduleValue2 = require(dependencyMap[value3]);
|
|
isSameDay = moduleValue2.isSameDay;
|
|
if (!Reflect.apply(isSameDay, moduleValue2, [value5, a0])) {
|
|
Math = global.Math;
|
|
abs = Math.abs;
|
|
moduleValue3 = require(dependencyMap[value3]);
|
|
differenceInDays = moduleValue3.differenceInDays;
|
|
reducibleJoin4: while (true) {
|
|
if (Reflect.apply(abs, Math, [Reflect.apply(differenceInDays, moduleValue3, [date,
|
|
value5])]) <= 7) {
|
|
return true;
|
|
}
|
|
break reducibleJoin4;
|
|
}
|
|
}
|
|
value6 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
|
|
length = items2.length;
|
|
if (!(value6 < length)) {
|
|
return false;
|
|
}
|
|
r1 = value6;
|
|
continue reducibleLoop1;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function yearsSince(a0) { // fn#66341, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8512:1412, offset: 0x01bf75a3, size: 92 bytes, params: 2, frame: 15
|
|
const Math = global.Math;
|
|
const round = Math.round;
|
|
var value;
|
|
const differenceInMonths = (Module03381Module).differenceInMonths;
|
|
const Date = global.Date;
|
|
const value2 = Object.create(Date.prototype, {constructor: {value: Date}});
|
|
const date = new Date();
|
|
value = Reflect.apply(differenceInMonths, value, [date instanceof Object ? date : value2, a0]);
|
|
return Reflect.apply(round, Math, [value / 12]);
|
|
}
|
|
|
|
function categorizeFriendAnniversariesByAffinity(a0, a1, a2) { // fn#66342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8512:1541, offset: 0x01bf75ff, size: 295 bytes, params: 4, frame: 25
|
|
var r6;
|
|
var r5;
|
|
var value5;
|
|
var value6;
|
|
var done;
|
|
var value7;
|
|
var value8;
|
|
var value9;
|
|
var value10;
|
|
var value11;
|
|
var value12;
|
|
var value13;
|
|
var Math;
|
|
let Set = global.Set;
|
|
let set = new Set();
|
|
Set = global.Set;
|
|
set = new Set();
|
|
if (a2) {
|
|
Math = global.Math;
|
|
a0.slice(0, Math.ceil(a0.length / 2)).forEach(_fun66343);
|
|
a0.forEach(_fun66344);
|
|
} else {
|
|
value5 = _createForOfIteratorHelperLoose_66337(a0);
|
|
value6 = value5();
|
|
done = value6.done;
|
|
if (!done) {
|
|
r6 = value6;
|
|
while (true) {
|
|
value7 = r6.value;
|
|
value8 = a1(value7);
|
|
value9 = value8 != null;
|
|
if (value9) {
|
|
value10 = value8 > 0.7;
|
|
r5 = value10;
|
|
} else {
|
|
r5 = value9;
|
|
}
|
|
if (!r5) {
|
|
continue;
|
|
}
|
|
set.add(value7);
|
|
value11 = value8 != null;
|
|
if (!value11) {
|
|
r5 = value11;
|
|
continue;
|
|
}
|
|
value12 = value8 > 0.5;
|
|
r5 = value12;
|
|
if (!r5) {
|
|
continue;
|
|
}
|
|
set.add(value7);
|
|
value13 = value5();
|
|
done = value13.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r6 = value13;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
return {highestAffinity: set, highAffinity: set};
|
|
function _fun66343(a0) { // fn#66343, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8512:1677, offset: 0x00c38a0f, size: 24 bytes, params: 2, frame: 11
|
|
env0_0.add(a0);
|
|
}
|
|
|
|
function _fun66344(a0) { // fn#66344, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8512:1704, offset: 0x01bf7726, size: 24 bytes, params: 2, frame: 11
|
|
env0_1.add(a0);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun66336, 8327, [3381, 2]) /* metro module 8327, dependencies: [3381, 2] */;
|