decord/source/modules/unique_usernames/UniqueUsernamesUtils.tsx

78 lines
3.5 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 14189
// Function ID: 14190
2026-07-20 16:05:17 +00:00
// Name: formatUsernameLiveCheckValidation
2026-08-24 06:08:38 +00:00
// Dependencies: [4490, 14184, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: formatUsernameLiveCheckValidation
2026-08-24 06:08:38 +00:00
// Module 14189 (formatUsernameLiveCheckValidation)
import set from "set" /* 2 */;
import t from "t" /* 4490 */;
const result = set.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) {
2026-08-24 06:08:38 +00:00
const match = t.match(arg0);
const str = t;
2026-07-29 08:29:29 +00:00
let obj = { error: null };
2026-08-24 06:08:38 +00:00
const P = t.P;
obj[0] = P.not(t.P.nullish);
2026-07-20 16:05:17 +00:00
const withResult = match.with({ rateLimited: true }, () => {
2026-08-24 06:08:38 +00:00
const obj = { type: callback(14184).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
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-08-24 06:08:38 +00:00
const obj = { type: callback(14184).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-24 06:08:38 +00:00
}).with(obj, (error) => ({ type: callback(14184).NameValidationState.ERROR, message: error.error }));
2026-07-20 16:05:17 +00:00
const withResult2 = match.with({ rateLimited: true }, () => {
2026-08-24 06:08:38 +00:00
const obj = { type: callback(14184).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-24 06:08:38 +00:00
}).with(obj, (error) => ({ type: callback(14184).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: callback(14184).NameValidationState.AVAILABLE, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.PgfBSx);
2026-07-20 16:05:17 +00:00
return obj;
});
2026-08-24 06:08:38 +00:00
obj = { error: t.P.nullish };
2026-07-20 16:05:17 +00:00
const withResult3 = match.with({ rateLimited: true }, () => {
2026-08-24 06:08:38 +00:00
const obj = { type: callback(14184).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-24 06:08:38 +00:00
}).with(obj, (error) => ({ type: callback(14184).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: callback(14184).NameValidationState.AVAILABLE, message: null };
2026-07-29 08:29:29 +00:00
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-08-24 06:08:38 +00:00
const obj = { type: callback(14184).NameValidationState.ERROR, message: null };
2026-07-29 08:29:29 +00:00
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-08-24 06:08:38 +00:00
const obj = { type: callback(14184).NameValidationState.RATE_LIMIT, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.T15lqn);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-24 06:08:38 +00:00
}).with(obj, (error) => ({ type: callback(14184).NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => {
const obj = { type: callback(14184).NameValidationState.AVAILABLE, message: null };
2026-07-29 08:29:29 +00:00
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-08-24 06:08:38 +00:00
const obj = { type: callback(14184).NameValidationState.ERROR, message: null };
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
obj[1] = intl.string(callback(1236).t.mCrAUb);
2026-07-20 16:05:17 +00:00
return obj;
2026-08-24 06:08:38 +00:00
}).with(obj, () => ({ type: callback(14184).NameValidationState.INTERNAL_ERROR, message: "" })).otherwise(() => {
2026-07-20 16:05:17 +00:00
});
};