Initial commit
This commit is contained in:
commit
af3b49f756
16065 files changed
+2938410
No files matched your search
@@ -0,0 +1,357 @@
|
||||
/* Metro module 4393; source: lib/Frecency.tsx; dependencies: [6, 7, 22, 3738, 2] */
|
||||
function _fun37159(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#37159, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:6, offset: 0x0109d4e2, size: 150 bytes, params: 8, frame: 18
|
||||
const Object = global.Object;
|
||||
Object.defineProperty(exports, '__esModule', {value: true});
|
||||
const env0_2 = importDefault(6) /* metro dependency 6 */;
|
||||
const env0_3 = importDefault(7) /* metro dependency 7 */;
|
||||
const DEFAULT_FRECENCY = function(a0, a1, a2) {
|
||||
var Math = global.Math;
|
||||
return Math.ceil(a0 * (a1 / a2.numOfRecentUses));
|
||||
};
|
||||
const DEFAULT_WEIGHT = function(a0) {
|
||||
return a0 <= 3 ? 100 : a0 <= 15 ? 70 : a0 <= 30 ? 50 : a0 <= 45 ? 30 : a0 <= 80 ? 10 : 1;
|
||||
};
|
||||
const value = _fun37162();
|
||||
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/Frecency.tsx');
|
||||
exports.default = value;
|
||||
}
|
||||
|
||||
function _fun37162() { // fn#37162, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:277, offset: 0x0109d5ed, size: 250 bytes, params: 1, frame: 15
|
||||
return env0_3(Frecency, [{key: 'overwriteHistory', value: function(a0, a1) {
|
||||
var value = a0;
|
||||
var env0_0 = this;
|
||||
var defaultImport = importDefault(dependencyMap[2]);
|
||||
this.usageHistory = defaultImport.mapValues(value ?? ({}), _fun37165);
|
||||
if (a1 != null) {
|
||||
a1.forEach(_fun37166);
|
||||
}
|
||||
this.markDirty();
|
||||
}}, {key: 'markDirty', value: function() {
|
||||
this.dirty = true;
|
||||
var version = this.version;
|
||||
this.version = typeof version === 'bigint' ? version + 1n : +version + 1;
|
||||
}}, {key: 'isDirty', value: function() {
|
||||
return this.dirty;
|
||||
}}, {key: 'track', value: value_37169}, {key: 'getEntry', value: function(a0) {
|
||||
var r0;
|
||||
var value = null;
|
||||
if (value == a0) {
|
||||
r0 = value;
|
||||
} else {
|
||||
if (this.dirty) {
|
||||
this.compute();
|
||||
}
|
||||
r0 = global.Object.prototype.hasOwnProperty.call(this.usageHistory, a0) ? this.usageHistory[a0] : undefined;
|
||||
}
|
||||
return r0;
|
||||
}}, {key: 'getScore', value: function(a0) {
|
||||
var value = this.getEntry(a0);
|
||||
var value2 = null;
|
||||
return value2 != value ? value.score : value2;
|
||||
}}, {key: 'getFrecency', value: function(a0) {
|
||||
var value = this.getEntry(a0);
|
||||
var value2 = null;
|
||||
return value2 != value ? value.frecency : value2;
|
||||
}}, {key: 'compute', value: value_37173}, {key: 'frequently', get: function() {
|
||||
if (this.dirty) {
|
||||
this.compute();
|
||||
}
|
||||
return this._frequently;
|
||||
}, set: function(a0) {
|
||||
this._frequently = a0;
|
||||
}}]);
|
||||
}
|
||||
|
||||
function Frecency({computeBonus, computeWeight = DEFAULT_WEIGHT, computeFrecency, calculateMaxTotalUse, lookupKey, afterCompute, numFrequentlyItems, maxSamples}) { // fn#37163, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:298, offset: 0x0109d6e7, size: 202 bytes, params: 2, frame: 21
|
||||
const r7 = computeFrecency !== undefined ? computeFrecency : DEFAULT_FRECENCY;
|
||||
calculateMaxTotalUse = !(calculateMaxTotalUse === undefined) && calculateMaxTotalUse;
|
||||
numFrequentlyItems = numFrequentlyItems === undefined ? 32 : numFrequentlyItems;
|
||||
maxSamples = maxSamples === undefined ? 10 : maxSamples;
|
||||
const value = environment.__proto__;
|
||||
env1_2(this, Frecency);
|
||||
this.computeBonus = computeBonus;
|
||||
this.computeWeight = computeWeight;
|
||||
this.computeFrecency = r7;
|
||||
this.calculateMaxTotalUse = calculateMaxTotalUse;
|
||||
this.afterCompute = afterCompute;
|
||||
this.lookupKey = lookupKey;
|
||||
this.usageHistory = {};
|
||||
this.frequently = [];
|
||||
this.maxSamples = maxSamples;
|
||||
this.numFrequentlyItems = numFrequentlyItems;
|
||||
this.dirty = false;
|
||||
this.version = 0;
|
||||
}
|
||||
|
||||
function value_37164(a0, a1) { // fn#37164, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:785, offset: 0x0109d7b1, size: 102 bytes, params: 3, frame: 18
|
||||
const value = a0;
|
||||
const defaultImport = importDefault(22) /* metro dependency 22 */;
|
||||
this.usageHistory = defaultImport.mapValues(value ?? ({}), function(a0) {
|
||||
var r2;
|
||||
var object = {};
|
||||
copyDataProperties(object, a0, r2);
|
||||
object['frecency'] = -1;
|
||||
return object;
|
||||
});
|
||||
if (a1 != null) {
|
||||
a1.forEach(_fun37166);
|
||||
}
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
function value_37169(a0) { // fn#37169, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:1104, offset: 0x0109d886, size: 357 bytes, params: 2, frame: 21
|
||||
var r1;
|
||||
var r10;
|
||||
var r8;
|
||||
var r6;
|
||||
var r3;
|
||||
var object2;
|
||||
var Object;
|
||||
var hasOwn;
|
||||
var usageHistory;
|
||||
var property;
|
||||
var totalUses;
|
||||
var recentUses;
|
||||
var push;
|
||||
var sort;
|
||||
var Date;
|
||||
var now;
|
||||
var length;
|
||||
var maxSamples;
|
||||
var shift;
|
||||
var markDirty;
|
||||
let value = a1;
|
||||
const value2 = undefined;
|
||||
reducibleJoin2: while (true) {
|
||||
if (value !== value2) {
|
||||
r1 = value;
|
||||
break reducibleJoin2;
|
||||
}
|
||||
r1 = {};
|
||||
break reducibleJoin2;
|
||||
}
|
||||
const timestamp = r1.timestamp;
|
||||
const usesSinceLastTrack = r1.usesSinceLastTrack;
|
||||
reducibleJoin17: while (true) {
|
||||
if (a0 == null) {
|
||||
break reducibleJoin17;
|
||||
}
|
||||
Object = global.Object;
|
||||
hasOwn = Object.hasOwn;
|
||||
usageHistory = this.usageHistory;
|
||||
reducibleJoin5: while (true) {
|
||||
if (Reflect.apply(hasOwn, Object, [usageHistory, a0])) {
|
||||
usageHistory = this.usageHistory;
|
||||
property = usageHistory[a0];
|
||||
r10 = property;
|
||||
break reducibleJoin5;
|
||||
}
|
||||
r10 = value2;
|
||||
break reducibleJoin5;
|
||||
}
|
||||
if (r10 == null) {
|
||||
object2 = {};
|
||||
value = 1;
|
||||
r8 = usesSinceLastTrack ?? value;
|
||||
object2.totalUses = r8;
|
||||
reducibleJoin15: while (true) {
|
||||
if (timestamp != null) {
|
||||
r6 = timestamp;
|
||||
break reducibleJoin15;
|
||||
}
|
||||
Date = global.Date;
|
||||
now = Date.now;
|
||||
value = Reflect.apply(now, Date, []);
|
||||
r6 = value;
|
||||
break reducibleJoin15;
|
||||
}
|
||||
object2.recentUses = [r6];
|
||||
object2.frecency = -1;
|
||||
object2.score = 0;
|
||||
r3 = object2;
|
||||
} else {
|
||||
r10.frecency = -1;
|
||||
totalUses = r10.totalUses;
|
||||
value = 1;
|
||||
r1 = usesSinceLastTrack ?? value;
|
||||
r10.totalUses = totalUses + r1;
|
||||
if (timestamp == null) {
|
||||
recentUses = r10.recentUses;
|
||||
push = recentUses.push;
|
||||
Date = global.Date;
|
||||
now = Date.now;
|
||||
Reflect.apply(push, recentUses, [Reflect.apply(now, Date, [])]);
|
||||
} else {
|
||||
recentUses = r10.recentUses;
|
||||
push = recentUses.push;
|
||||
Reflect.apply(push, recentUses, [timestamp]);
|
||||
recentUses = r10.recentUses;
|
||||
sort = recentUses.sort;
|
||||
Reflect.apply(sort, recentUses, []);
|
||||
}
|
||||
recentUses = r10.recentUses;
|
||||
length = recentUses.length;
|
||||
maxSamples = this.maxSamples;
|
||||
if (length > maxSamples) {
|
||||
reducibleLoop11: while (true) {
|
||||
recentUses = r10.recentUses;
|
||||
shift = recentUses.shift;
|
||||
Reflect.apply(shift, recentUses, []);
|
||||
recentUses = r10.recentUses;
|
||||
length = recentUses.length;
|
||||
maxSamples = this.maxSamples;
|
||||
if (length > maxSamples) {
|
||||
continue reducibleLoop11;
|
||||
}
|
||||
r3 = r10;
|
||||
break reducibleLoop11;
|
||||
}
|
||||
} else {
|
||||
r3 = r10;
|
||||
}
|
||||
}
|
||||
usageHistory = this.usageHistory;
|
||||
usageHistory[a0] = r3;
|
||||
markDirty = this.markDirty;
|
||||
Reflect.apply(markDirty, this, []);
|
||||
break reducibleJoin17;
|
||||
}
|
||||
return value2;
|
||||
}
|
||||
|
||||
function value_37173() { // fn#37173, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:1928, offset: 0x0109da89, size: 307 bytes, params: 1, frame: 19
|
||||
var environment;
|
||||
var defaultImport;
|
||||
var maxBy;
|
||||
var Object;
|
||||
var value4;
|
||||
let value = environment.__proto__;
|
||||
const env0_1 = (importDefault(3738) /* metro dependency 3738 */)();
|
||||
if (this.calculateMaxTotalUse) {
|
||||
defaultImport = importDefault(22) /* metro dependency 22 */;
|
||||
maxBy = defaultImport.maxBy;
|
||||
Object = global.Object;
|
||||
value4 = Reflect.apply(maxBy, defaultImport, [Object.values(this.usageHistory), function(a0) {
|
||||
return a0.totalUses;
|
||||
}]);
|
||||
}
|
||||
value = importDefault(22) /* metro dependency 22 */;
|
||||
value.forEach(this.usageHistory, _fun37175);
|
||||
value = importDefault(22) /* metro dependency 22 */;
|
||||
value = value(this.usageHistory);
|
||||
value = value.map(_fun37177);
|
||||
value = value.filter(function(a0) {
|
||||
return a0 !== null;
|
||||
});
|
||||
value = value.sortBy(function(a0) {
|
||||
var r0;
|
||||
var r1;
|
||||
var r2;
|
||||
var item3;
|
||||
var value3;
|
||||
var iterator = a0[Symbol.iterator]();
|
||||
var iterator2 = iterator.next;
|
||||
var item2 = Reflect.apply(iterator2, iterator, []);
|
||||
var item = item2.value;
|
||||
item2 = item2.done ? undefined : iterator;
|
||||
var value = undefined;
|
||||
var value2 = item2 === value;
|
||||
if (value2) {
|
||||
r0 = value;
|
||||
r1 = item2;
|
||||
r2 = value2;
|
||||
} else {
|
||||
item3 = Reflect.apply(iterator2, item2, []);
|
||||
item = item3.value;
|
||||
item3 = item3.done ? undefined : item2;
|
||||
value3 = item3 === value;
|
||||
if (value3) {
|
||||
r0 = value;
|
||||
r1 = item3;
|
||||
r2 = value3;
|
||||
} else {
|
||||
r0 = item;
|
||||
r1 = item3;
|
||||
r2 = value3;
|
||||
}
|
||||
}
|
||||
if (!r2) {
|
||||
r1.return();
|
||||
}
|
||||
return -r0;
|
||||
});
|
||||
value = value.map(function(a0) {
|
||||
var iterator = a0[Symbol.iterator]();
|
||||
var item2 = iterator.next();
|
||||
var item = item2.value;
|
||||
item2 = item2.done ? undefined : iterator;
|
||||
var value = undefined;
|
||||
var value2 = item2 === value;
|
||||
var r0 = value2 ? value : item;
|
||||
if (!value2) {
|
||||
item2.return();
|
||||
}
|
||||
return r0;
|
||||
});
|
||||
value = value.take(this.numFrequentlyItems);
|
||||
this.frequently = value.value();
|
||||
this.dirty = false;
|
||||
this.afterCompute(this.usageHistory, this._frequently);
|
||||
}
|
||||
|
||||
function _fun37166({key, timestamp}) { // fn#37166, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:896, offset: 0x0109d834, size: 41 bytes, params: 2, frame: 14
|
||||
const binding = env0_0;
|
||||
return binding.track(key, {timestamp: timestamp});
|
||||
}
|
||||
|
||||
function _fun37175(a0, a1) { // fn#37175, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:2091, offset: 0x0109dbc7, size: 251 bytes, params: 3, frame: 21
|
||||
var environment;
|
||||
var binding;
|
||||
var value2;
|
||||
var value3;
|
||||
const env0_0 = a0;
|
||||
const totalUses2 = a0.totalUses;
|
||||
const recentUses = a0.recentUses;
|
||||
if (a0.frecency === -1) {
|
||||
binding = env0_0;
|
||||
var env0_1 = binding.computeBonus(a1) / 100;
|
||||
a0.score = 0;
|
||||
value2 = environment.__proto__.__proto__;
|
||||
value3 = undefined;
|
||||
(importDefault(22) /* metro dependency 22 */).forEach(recentUses, _fun37176);
|
||||
if (a0.score > 0) {
|
||||
if (a0.recentUses.length > 0) {
|
||||
binding = env0_0;
|
||||
a0.frecency = binding.computeFrecency(totalUses2, a0.score, {numOfRecentUses: recentUses.length,
|
||||
maxTotalUse: env0_2 == null ? value3 : env0_2.totalUses});
|
||||
}
|
||||
env0_0.usageHistory[a1] = a0;
|
||||
} else {
|
||||
delete env0_0.usageHistory[a1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _fun37177(a0, a1) { // fn#37177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:2571, offset: 0x0109dd3f, size: 56 bytes, params: 3, frame: 11
|
||||
const value = env0_0.lookupKey(a1);
|
||||
const value2 = null;
|
||||
return value2 == value ? value2 : [value, a0.frecency];
|
||||
}
|
||||
|
||||
function _fun37176(a0, a1) { // fn#37176, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4565:2213, offset: 0x0109dcc2, size: 125 bytes, params: 3, frame: 16
|
||||
let value = environment.__proto__;
|
||||
if (a1 >= env1_0.maxSamples) {
|
||||
return false;
|
||||
}
|
||||
let binding = env1_0;
|
||||
const computeWeight = binding.computeWeight;
|
||||
const binding2 = env1_1;
|
||||
const diff = binding2.diff;
|
||||
value = environment.__proto__.__proto__.__proto__;
|
||||
value = importDefault(3738) /* metro dependency 3738 */;
|
||||
value = value(a0);
|
||||
value = Reflect.apply(computeWeight, binding, [Reflect.apply(diff, binding2, [value, 'days'])]);
|
||||
binding = env0_0;
|
||||
binding.score = binding.score + env0_1 * value;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user