decord/source/modules/unique_usernames/UniqueUsernamesUtils.tsx

75 lines
3.6 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 13795
// Function ID: 13796
2026-07-20 16:05:17 +00:00
// Name: formatUsernameLiveCheckValidation
2026-07-29 08:29:29 +00:00
// Dependencies: [4389, 13790, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: formatUsernameLiveCheckValidation
2026-07-29 08:29:29 +00:00
// Module 13795 (formatUsernameLiveCheckValidation)
2026-07-23 10:11:24 +00:00
const result = require("getSystemLocale").fileFinishedImporting("modules/unique_usernames/UniqueUsernamesUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const formatUsernameLiveCheckValidation = function formatUsernameLiveCheckValidation(arg0) {
const match = require(4389) /* t */.match(arg0);
const str = require(4389) /* t */;
let obj = { error: null };
const P = require(4389) /* t */.P;
obj[0] = P.not(require(4389) /* t */.P.nullish);
2026-07-20 16:05:17 +00:00
const withResult = match.with({ rateLimited: true }, () => {
2026-07-29 08:29:29 +00:00
const obj = { type: callback(13790).NameValidationState.RATE_LIMIT, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
});
const withResult1 = match.with({ rateLimited: true }, () => {
2026-07-29 08:29:29 +00:00
const obj = { type: callback(13790).NameValidationState.RATE_LIMIT, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-29 08:29:29 +00:00
}).with(obj, (error) => ({ type: callback(13790).NameValidationState.ERROR, message: error.error }));
2026-07-20 16:05:17 +00:00
const withResult2 = match.with({ rateLimited: true }, () => {
2026-07-29 08:29:29 +00:00
const obj = { type: callback(13790).NameValidationState.RATE_LIMIT, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-29 08:29:29 +00:00
}).with(obj, (error) => ({ type: callback(13790).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: callback(13790).NameValidationState.AVAILABLE, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
});
2026-07-29 08:29:29 +00:00
obj = { error: require(4389) /* t */.P.nullish };
2026-07-20 16:05:17 +00:00
const withResult3 = match.with({ rateLimited: true }, () => {
2026-07-29 08:29:29 +00:00
const obj = { type: callback(13790).NameValidationState.RATE_LIMIT, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-29 08:29:29 +00:00
}).with(obj, (error) => ({ type: callback(13790).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: callback(13790).NameValidationState.AVAILABLE, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
}).with({ taken: true }, () => {
2026-07-29 08:29:29 +00:00
const obj = { type: callback(13790).NameValidationState.ERROR, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.mCrAUb);
2026-07-20 16:05:17 +00:00
return obj;
});
return match.with({ rateLimited: true }, () => {
2026-07-29 08:29:29 +00:00
const obj = { type: callback(13790).NameValidationState.RATE_LIMIT, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-29 08:29:29 +00:00
}).with(obj, (error) => ({ type: callback(13790).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: callback(13790).NameValidationState.AVAILABLE, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
}).with({ taken: true }, () => {
2026-07-29 08:29:29 +00:00
const obj = { type: callback(13790).NameValidationState.ERROR, message: null };
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.mCrAUb);
2026-07-20 16:05:17 +00:00
return obj;
2026-07-29 08:29:29 +00:00
}).with(obj, () => ({ type: callback(13790).NameValidationState.INTERNAL_ERROR, message: "" })).otherwise(() => {
2026-07-20 16:05:17 +00:00
});
};