303 lines
16 KiB
TypeScript
303 lines
16 KiB
TypeScript
/* Metro module 1870; source: modules/libdiscore/libdiscoreExperiments.tsx; dependencies: [15, 17, 18, 6, 7, 1871, 3, 1873, 44, 2] */
|
|
import Logger from '../debug/Logger.tsx'; /* Metro dependency 3 */
|
|
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 * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as BridgedStoreModule from './stores/BridgedStore.tsx'; /* Metro dependency 1871 */
|
|
import * as ShimNativeModule from '../../external/discord_common/js/packages/libdiscore/js_shim/js/shim.native.tsx'; /* Metro dependency 1873 */
|
|
|
|
function _fun20200(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#20200, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:6, offset: 0x00ec208f, size: 649 bytes, params: 8, frame: 27
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = Logger;
|
|
value = new value('libdiscoreExperiments');
|
|
const Symbol = global.Symbol;
|
|
const env0_11 = Symbol('unknown');
|
|
value = _fun20205();
|
|
const value3 = _fun20211(value);
|
|
const value4 = _fun20216(value);
|
|
const value5 = _fun20222(value);
|
|
const value7 = new value4('2026-01-libdiscore-batch-store-refactor', 'batch-store-refactor');
|
|
const value10 = new value5('2025-09-libdiscore-telemetry');
|
|
const value13 = new value3('2025-11-defer-load-late-lazy-cache',
|
|
'Allow react to render before lazy cache is loaded');
|
|
const value15 = _fun20229(value);
|
|
const value17 = new value15('2026-01-android-rmle', 'Android Pull Mode Rendering', 4);
|
|
const value20 = new value15('2026-02-android-fresco-cache', 'Android Fresco Cache', 3);
|
|
const value23 = new value3('2026-02-android-chat-mosaic-shared-pool', 'Android Chat Mosaic Shared Pool');
|
|
const value26 = new value3('2026-03-mobile-hermes-occupancy-target', 'Android Hermes Occupancy Target');
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/libdiscore/libdiscoreExperiments.tsx');
|
|
exports.ALL_LIBDISCORE_EXPERIMENTS = [];
|
|
exports.LibdiscoreCachedExperiment = value;
|
|
exports.LibdiscoreWrapperSimpleExperiment = value3;
|
|
exports.LibdiscoreBatchStoreRefactorExperiment = value7;
|
|
exports.TelemetryExperiment = value10;
|
|
exports.DelayLoadLateLazyCacheHoldoutExperiment = value13;
|
|
exports.AndroidPullModeRenderingExperiment = value17;
|
|
exports.AndroidFrescoCacheExperiment = value20;
|
|
exports.AndroidChatMosaicSharedPoolExperiment = value23;
|
|
exports.AndroidHermesOccupancyTargetExperiment = value26;
|
|
exports.isExperimentSyncDisabled = isExperimentSyncDisabled;
|
|
exports.clearLibdiscoreExperimentCache = clearLibdiscoreExperimentCache;
|
|
function _callSuper_20201(a0, a1, a2) { // fn#20201, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:180, offset: 0x00ec2318, size: 100 bytes, params: 4, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = a2;
|
|
const value3 = Module00017(a1);
|
|
if (_isNativeReflectConstruct_20202()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value3, value || [], Module00017(a0).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value3.apply(a0, value);
|
|
r0 = value;
|
|
}
|
|
return PossibleConstructorReturn(a0, r0);
|
|
}
|
|
|
|
function _isNativeReflectConstruct_20202() { // fn#20202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:311, offset: 0x00ec237c, 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_20202_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun20205() { // fn#20205, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:576, offset: 0x00ec23da, size: 128 bytes, params: 1, frame: 15
|
|
return CreateClass(LibdiscoreCachedExperiment, [{key: 'getEnabledFeatureName', value: function() {
|
|
var value = this.getCachedConfig();
|
|
return value === undefined || value.treatmentId <= 0 ? null : '' + this.id + ':' + value.treatmentId;
|
|
}}, {key: 'getCachedConfig', value: value_20208}, {key: 'setExperiment', value: function(a0) {
|
|
this.inner = a0;
|
|
}}, {key: 'getCurrentConfig', value: value_20210}]);
|
|
function LibdiscoreCachedExperiment(a0) { // fn#20206, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:597, offset: 0x00ec245a, size: 68 bytes, params: 2, frame: 14
|
|
env1_6(this, LibdiscoreCachedExperiment);
|
|
this.id = a0;
|
|
this.inner = null;
|
|
this.cachedConfig = env1_11;
|
|
env1_10.push(this);
|
|
}
|
|
|
|
function value_20208() { // fn#20208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:910, offset: 0x00ec24ed, size: 120 bytes, params: 1, frame: 14
|
|
var moduleValue;
|
|
const cachedConfig = this.cachedConfig;
|
|
let value = environment.__proto__;
|
|
if (cachedConfig === env1_11) {
|
|
moduleValue = require(1873) /* metro dependency 1873: shimNative */;
|
|
if (moduleValue.isLibdiscoreInitialized()) {
|
|
value = require(1873) /* metro dependency 1873: shimNative */;
|
|
value = value.getExperimentCacher();
|
|
this.cachedConfig = value.getConfig(this.id);
|
|
} else {
|
|
this.cachedConfig = undefined;
|
|
}
|
|
}
|
|
return this.cachedConfig;
|
|
}
|
|
|
|
function value_20210() { // fn#20210, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:1183, offset: 0x00ec2575, size: 121 bytes, params: 1, frame: 14
|
|
let value = environment.__proto__;
|
|
value = importDefault(44) /* metro dependency 44 */;
|
|
let inner = this.inner;
|
|
value(inner != null, 'experiment must be set before calling getCurrentConfig');
|
|
value = 'getCurrentConfig' in this.inner;
|
|
inner = this.inner;
|
|
return value ? inner.getCurrentConfig({location: 'default'}) : inner.getConfig({location: 'default'});
|
|
}
|
|
|
|
}
|
|
|
|
function _fun20211(a0) { // fn#20211, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:1419, offset: 0x00ec25ee, size: 118 bytes, params: 2, frame: 16
|
|
const LibdiscoreWrapperSimpleExperiment2 = LibdiscoreWrapperSimpleExperiment;
|
|
Inherits(LibdiscoreWrapperSimpleExperiment2, a0);
|
|
return CreateClass(LibdiscoreWrapperSimpleExperiment2, [{key: 'getLabel', value: function() {
|
|
return this.label;
|
|
}}, {key: 'getTreatments', value: function() {
|
|
return [{treatmentId: 0}, {treatmentId: 1}];
|
|
}}, {key: 'getCachedEnabled', value: function() {
|
|
var value = this.getCachedConfig();
|
|
return value == null || value.treatmentId === -1 ? this.defaultValue : value.treatmentId === 1;
|
|
}}]);
|
|
function LibdiscoreWrapperSimpleExperiment(a0, a1) { // fn#20212, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:1431, offset: 0x00ec2664, size: 73 bytes, params: 3, frame: 17
|
|
let value = a2;
|
|
const r1 = value !== undefined ? value : false;
|
|
value = environment.__proto__;
|
|
env1_6(this, LibdiscoreWrapperSimpleExperiment);
|
|
value = _callSuper_20201(this, LibdiscoreWrapperSimpleExperiment, [a0]);
|
|
value.label = a1;
|
|
value.defaultValue = r1;
|
|
return value;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun20216(a0) { // fn#20216, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:1992, offset: 0x00ec2712, size: 141 bytes, params: 2, frame: 16
|
|
const LibdiscoreBridgedStoreExperiment2 = LibdiscoreBridgedStoreExperiment;
|
|
Inherits(LibdiscoreBridgedStoreExperiment2, a0);
|
|
return CreateClass(LibdiscoreBridgedStoreExperiment2, [{key: 'getCachedBridgedStoreMode', value: value_20218},
|
|
{key: 'getEnabledFeatureName', value: function() {
|
|
var value = this.getCachedBridgedStoreMode();
|
|
return value === 'typescript' ? null : 'BridgedStore[' + this.storeName + ',' + value + ']';
|
|
}}, {key: 'getLabel', value: function() {
|
|
return "libdiscore '" + this.storeName + "' Migration";
|
|
}}, {key: 'getTreatments', value: function() {
|
|
return [{treatmentId: 0}, {treatmentId: 1}, {treatmentId: 2}];
|
|
}}]);
|
|
function LibdiscoreBridgedStoreExperiment(a0, a1, a2) { // fn#20217, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:2004, offset: 0x00ec279f, size: 65 bytes, params: 4, frame: 16
|
|
let value = environment.__proto__;
|
|
env1_6(this, LibdiscoreBridgedStoreExperiment);
|
|
value = _callSuper_20201(this, LibdiscoreBridgedStoreExperiment, [a0, a2]);
|
|
value.storeName = a1;
|
|
return value;
|
|
}
|
|
|
|
function value_20218() { // fn#20218, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:2301, offset: 0x00ec27e0, size: 96 bytes, params: 1, frame: 13
|
|
const r3 = this.getCachedConfig()?.treatmentId ?? -1;
|
|
const r1 = r3 === 1 ? 'typescript-libdiscore-dual-read' : r3 === 2 ? 'libdiscore' : 'typescript';
|
|
value = environment.__proto__;
|
|
return ensureValidMode(r1);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun20222(a0) { // fn#20222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:2861, offset: 0x00ec28dc, size: 168 bytes, params: 2, frame: 16
|
|
const LibdiscoreTelemetryExperiment2 = LibdiscoreTelemetryExperiment;
|
|
Inherits(LibdiscoreTelemetryExperiment2, a0);
|
|
return CreateClass(LibdiscoreTelemetryExperiment2, [{key: 'getLabel', value: function() {
|
|
return 'libdiscore Telemetry';
|
|
}}, {key: 'getTreatments', value: function() {
|
|
return [{treatmentId: 0}, {treatmentId: 1}, {treatmentId: 2}, {treatmentId: 3}];
|
|
}}, {key: 'getMetricsSampleRate', value: function() {
|
|
var r2;
|
|
r2 = this.getCachedConfig()?.treatmentId;
|
|
if (r2 === 1) {
|
|
return 0.01;
|
|
}
|
|
if (r2 === 2) {
|
|
return 0.05;
|
|
}
|
|
if (r2 === 3) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}}, {key: 'didEmit', value: function() {
|
|
var emissionsCount = this.emissionsCount;
|
|
this.emissionsCount = typeof emissionsCount === 'bigint' ? emissionsCount + 1n : +emissionsCount + 1;
|
|
}}, {key: 'shouldCollectMetrics', value: function() {
|
|
var r2;
|
|
var r1;
|
|
var r0;
|
|
var value3;
|
|
var value4;
|
|
var value = this.getMetricsSampleRate();
|
|
var value2 = value !== 0;
|
|
if (value2) {
|
|
value3 = value === 1;
|
|
if (value3) {
|
|
r1 = value3;
|
|
} else {
|
|
value4 = this.emissionsCount >= this.MAX_EMISSIONS_PER_APP_LAUNCH;
|
|
if (value4) {
|
|
r2 = !value4;
|
|
} else {
|
|
value = global.Math.random() < value;
|
|
r2 = value;
|
|
}
|
|
r1 = r2;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}}]);
|
|
function LibdiscoreTelemetryExperiment(a0) { // fn#20223, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:2873, offset: 0x00ec2984, size: 77 bytes, params: 2, frame: 17
|
|
let value = copyRestArgs(0, undefined);
|
|
env1_6(this, LibdiscoreTelemetryExperiment);
|
|
const _callSuper_20201Binding = _callSuper_20201;
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, value);
|
|
value = _callSuper_20201Binding(this, LibdiscoreTelemetryExperiment, items2);
|
|
value.MAX_EMISSIONS_PER_APP_LAUNCH = 5;
|
|
value.emissionsCount = 0;
|
|
return value;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun20229(a0) { // fn#20229, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:3966, offset: 0x00ec2ad3, size: 93 bytes, params: 2, frame: 16
|
|
const LibdiscoreCustomTreatmentsExperiment2 = LibdiscoreCustomTreatmentsExperiment;
|
|
Inherits(LibdiscoreCustomTreatmentsExperiment2, a0);
|
|
return CreateClass(LibdiscoreCustomTreatmentsExperiment2, [{key: 'getLabel', value: function() {
|
|
return this.label;
|
|
}}, {key: 'getTreatments', value: function() {
|
|
var Array = global.Array;
|
|
return Array.from({length: this.treatmentCount}, _fun20233);
|
|
}}]);
|
|
function LibdiscoreCustomTreatmentsExperiment(a0, a1, a2) { // fn#20230, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:3978, offset: 0x00ec2b30, size: 67 bytes, params: 4, frame: 16
|
|
let value = environment.__proto__;
|
|
env1_6(this, LibdiscoreCustomTreatmentsExperiment);
|
|
value = _callSuper_20201(this, LibdiscoreCustomTreatmentsExperiment, [a0]);
|
|
value.label = a1;
|
|
value.treatmentCount = a2;
|
|
return value;
|
|
}
|
|
|
|
function value_20232() { // fn#20232, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:4349, offset: 0x00ec2b73, size: 43 bytes, params: 1, frame: 13
|
|
const Array = global.Array;
|
|
return Array.from({length: this.treatmentCount}, function(a0, a1) {
|
|
return {treatmentId: a1};
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
function isExperimentSyncDisabled() { // fn#20234, offset: 0x00ec2baa, size: 9 bytes, params: 1, frame: 1
|
|
return env0_12;
|
|
}
|
|
|
|
function clearLibdiscoreExperimentCache() { // fn#20235, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:5310, offset: 0x00ec2bb3, size: 104 bytes, params: 1, frame: 14
|
|
var value;
|
|
if (ShimNativeModule.isLibdiscoreInitialized()) {
|
|
env0_9.info('Clearing libdiscore experiment cache and disabling sync');
|
|
value = ShimNativeModule;
|
|
value = value.getExperimentCacher();
|
|
value.clearCache();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function _fun20233(a0, a1) { // fn#20233, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1997:4408, offset: 0x00ec2b9e, size: 12 bytes, params: 3, frame: 2
|
|
return {treatmentId: a1};
|
|
}
|
|
|
|
global.__d(_fun20200, 1870, [15, 17, 18, 6, 7, 1871, 3, 1873, 44,
|
|
2]) /* metro module 1870, dependencies: [15, 17, 18, 6, 7, 1871, 3, 1873, 44, 2] */;
|