// Module ID: 14766 // Function ID: 14767 // Name: UniqueUsernamesUtils // Dependencies: [4792, 14761, 1114, 2] // Exports: formatUsernameLiveCheckValidation // Module 14766 (UniqueUsernamesUtils) import util from "util" /* 1114 */; import _mod4792 from "module_4792" /* 4792 */; import UniqueUsernamesTypes from "UniqueUsernamesTypes" /* 14761 */; import size from "module_2" /* 2 */; const result = size.fileFinishedImporting("modules/unique_usernames/UniqueUsernamesUtils.tsx"); export const formatUsernameLiveCheckValidation = function formatUsernameLiveCheckValidation(arg0) { const match = _mod4792.match(arg0); let obj = { error: null }; const P = _mod4792.P; obj.error = P.not(_mod4792.P.nullish); const withResult = match.with({ rateLimited: true }, () => { const obj = { type: UniqueUsernamesTypes.NameValidationState.RATE_LIMIT, message: null }; const intl = util.intl; obj.message = intl.string(util.t.T15lqn); return obj; }); const withResult1 = match.with({ rateLimited: true }, () => { const obj = { type: UniqueUsernamesTypes.NameValidationState.RATE_LIMIT, message: null }; const intl = util.intl; obj.message = intl.string(util.t.T15lqn); return obj; }).with(obj, (error) => ({ type: UniqueUsernamesTypes.NameValidationState.ERROR, message: error.error })); const withResult2 = match.with({ rateLimited: true }, () => { const obj = { type: UniqueUsernamesTypes.NameValidationState.RATE_LIMIT, message: null }; const intl = util.intl; obj.message = intl.string(util.t.T15lqn); return obj; }).with(obj, (error) => ({ type: UniqueUsernamesTypes.NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => { const obj = { type: UniqueUsernamesTypes.NameValidationState.AVAILABLE, message: null }; const intl = util.intl; obj.message = intl.string(util.t.PgfBSx); return obj; }); const withResult3 = match.with({ rateLimited: true }, () => { const obj = { type: UniqueUsernamesTypes.NameValidationState.RATE_LIMIT, message: null }; const intl = util.intl; obj.message = intl.string(util.t.T15lqn); return obj; }).with(obj, (error) => ({ type: UniqueUsernamesTypes.NameValidationState.ERROR, message: error.error })).with({ taken: false }, () => { const obj = { type: UniqueUsernamesTypes.NameValidationState.AVAILABLE, message: null }; const intl = util.intl; obj.message = intl.string(util.t.PgfBSx); return obj; }).with({ taken: true }, () => { const obj = { type: UniqueUsernamesTypes.NameValidationState.ERROR, message: null }; const intl = util.intl; obj.message = intl.string(util.t.mCrAUb); return obj; }); const obj2 = { error: _mod4792.P.nullish }; return withResult3.with({ error: _mod4792.P.nullish }, () => ({ type: UniqueUsernamesTypes.NameValidationState.INTERNAL_ERROR, message: "" })).otherwise(() => { }); };