decord/beta/source/modules/design/PlaygroundAccessExperiment.tsx
2026-10-12 16:32:48 +00:00

136 lines
4.1 KiB
TypeScript

// Module ID: 11572
// Function ID: 11573
// Name: PlaygroundAccessExperiment
// Dependencies: [1390, 1453, 558, 576, 504, 2]
// Exports: getHasPlaygroundAccess, getPlaygroundAccessExperiment
// Module 11572 (PlaygroundAccessExperiment)
import react from "react" /* 576 */;
import UserStore from "UserStore" /* 1390 */;
import ApexExperiment from "ApexExperiment" /* 1453 */;
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
let obj2;
let tmp;
const get_initialized = tmp(504);
let obj = { name: "2026-02-mana-playground-access", kind: "user", defaultConfig: { enabled: false }, variations: obj2 };
obj2 = { 1: null };
obj2[1] = { enabled: true };
const apexExperiment = ApexExperiment.createApexExperiment(obj);
let ReactCompilerGating = ReactCompilerGating_mod;
const tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? (function usePlaygroundAccessExperiment(location) {
let tmp2;
const obj = react;
const cResult = obj.c(2);
if (cResult[0] !== location) {
const obj2 = { location };
cResult[0] = location;
cResult[1] = obj2;
tmp2 = obj2;
} else {
tmp2 = cResult[1];
}
return apexExperiment.useConfig(tmp2).enabled;
}) : (function usePlaygroundAccessExperiment(location) {
const obj = { location };
return apexExperiment.useConfig(obj).enabled;
});
let closure_4 = tmp3;
ReactCompilerGating = ReactCompilerGating_mod;
let tmp4 = ReactCompilerGating.isReactCompilerEnabled() ? (function useHasPlaygroundAccess(arg0) {
let currentUser;
let tmp4;
let tmp5;
let tmp7;
const obj = react;
const cResult = obj.c(4);
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [UserStore];
const fn = function o() {
return currentUser.getCurrentUser();
};
cResult[0] = items;
cResult[1] = fn;
tmp4 = items;
tmp5 = fn;
} else {
[tmp4, tmp5] = cResult;
}
const tmpResult = get_initialized;
const stateFromStores = tmpResult.useStateFromStores(tmp4, tmp5);
if (cResult[2] !== stateFromStores) {
let isStaffResult;
if (stateFromStores != null) {
isStaffResult = stateFromStores.isStaff();
}
let tmp10 = true === isStaffResult;
if (!tmp10) {
let isStaffPersonalResult;
if (stateFromStores != null) {
isStaffPersonalResult = stateFromStores.isStaffPersonal();
}
tmp10 = true === isStaffPersonalResult;
}
cResult[2] = stateFromStores;
cResult[3] = tmp10;
tmp7 = tmp10;
} else {
tmp7 = cResult[3];
}
if (!tmp7) {
tmp7 = closure_4(arg0);
}
return tmp7;
}) : (function useHasPlaygroundAccess(arg0) {
let currentUser;
const items = [UserStore];
const obj = get_initialized;
const stateFromStores = obj.useStateFromStores(items, () => currentUser.getCurrentUser());
let isStaffResult;
if (stateFromStores != null) {
isStaffResult = stateFromStores.isStaff();
}
let tmp2 = true === isStaffResult;
if (!tmp2) {
let isStaffPersonalResult;
if (stateFromStores != null) {
isStaffPersonalResult = stateFromStores.isStaffPersonal();
}
tmp2 = true === isStaffPersonalResult;
}
if (!tmp2) {
tmp2 = closure_4(arg0);
}
return tmp2;
});
function getPlaygroundAccessExperiment(location) {
const obj = { location };
return apexExperiment.getConfig(obj).enabled;
}
const result = size.fileFinishedImporting("modules/design/PlaygroundAccessExperiment.tsx");
export default apexExperiment;
export const usePlaygroundAccessExperiment = tmp3;
export { getPlaygroundAccessExperiment };
export const useHasPlaygroundAccess = tmp4;
export const getHasPlaygroundAccess = function getHasPlaygroundAccess(quickswitcher_action) {
const currentUser = UserStore.getCurrentUser();
let isStaffResult;
if (currentUser != null) {
isStaffResult = currentUser.isStaff();
}
let enabled = true === isStaffResult;
if (!enabled) {
let isStaffPersonalResult;
if (currentUser != null) {
isStaffPersonalResult = currentUser.isStaffPersonal();
}
enabled = true === isStaffPersonalResult;
}
if (!enabled) {
const obj = { location: quickswitcher_action };
enabled = apexExperiment.getConfig(obj).enabled;
}
return enabled;
};