2026-07-31 08:44:05 +00:00
// Module ID: 13812
// Function ID: 13813
2026-07-29 08:29:29 +00:00
// Name: isRateLimited
// Dependencies: [1386, 687, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-07-31 08:44:05 +00:00
// Module 13812 (isRateLimited)
2026-07-29 08:29:29 +00:00
import { Store } from "initialize" ;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
let closure_2 = { taken : null , error : "HermesInternal" , rateLimited : null } ;
let obj = { validations : null , currentUsernameInvalid : false , retryAfterTime : null , suggestions : null } ;
obj [ 0 ] = new require ( "priv" ) ( { max : 100 , maxAge : 60000 } ) ;
2026-07-31 08:44:05 +00:00
obj [ 3 ] = { migration : { suggestion : { username : "r" } , fetched : false , usernameSuggestionLoading : false } , registration : { suggestion : { username : "r" } , source : "ct" , fetched : "automat do gier" } } ;
2026-07-29 08:29:29 +00:00
class UniqueUsernamesStore extends Store {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = UniqueUsernamesStore . prototype ;
prototype [ "isRateLimited" ] = function isRateLimited() {
let tmp2 = null != obj . retryAfterTime ;
if ( tmp2 ) {
const _Date = Date ;
tmp2 = Date . now ( ) < tmp . retryAfterTime ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2 ;
} ;
prototype [ "validate" ] = function validate ( arg0 ) {
const self = this ;
const validations = obj . validations ;
const value = validations . get ( arg0 ) ;
if ( ! this . isRateLimited ( ) ) {
let tmp4 = value ;
} else {
tmp4 = closure_2 ;
}
return tmp4 ;
} ;
prototype [ "registrationUsernameSuggestion" ] = function registrationUsernameSuggestion() {
return obj . suggestions . registration . suggestion . username ;
} ;
prototype [ "usernameSuggestion" ] = function usernameSuggestion() {
return obj . suggestions . migration . suggestion . username ;
} ;
prototype [ "usernameSuggestionLoading" ] = function usernameSuggestionLoading() {
return obj . suggestions . migration . usernameSuggestionLoading ;
} ;
prototype [ "isCurrentUsernameInvalid" ] = function isCurrentUsernameInvalid() {
return obj . currentUsernameInvalid ;
} ;
prototype [ "wasRegistrationSuggestionFetched" ] = function wasRegistrationSuggestionFetched ( arg0 ) {
return obj . suggestions . registration . source === arg0 && obj . suggestions . registration . fetched ;
} ;
prototype [ "wasSuggestionsFetched" ] = function wasSuggestionsFetched() {
return obj . suggestions . migration . fetched ;
} ;
UniqueUsernamesStore . displayName = "UniqueUsernamesStore" ;
obj = {
2026-07-20 16:05:17 +00:00
UNIQUE_USERNAME_ATTEMPT_SUCCESS : function handleUniqueUsernameAttemptSuccess ( taken ) {
const validations = obj . validations ;
2026-07-23 10:11:24 +00:00
obj = { taken : taken.taken } ;
2026-07-20 16:05:17 +00:00
const result = validations . set ( taken . username , obj ) ;
} ,
UNIQUE_USERNAME_ATTEMPT_FAILURE : function handleUniqueUsernameAttemptFailure ( statusCode ) {
let error ;
let retryAfter ;
let username ;
( { username , error , retryAfter } = statusCode ) ;
if ( 429 === statusCode . statusCode ) {
let validations = obj . validations ;
2026-07-29 08:29:29 +00:00
obj = { taken : null , error : null , rateLimited : true } ;
obj [ 1 ] = error ;
let num = retryAfter ;
if ( retryAfter == null ) {
num = 7 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const result = validations . set ( username , obj , num * importDefault ( 687 ) . Millis . SECOND ) ;
let tmp = obj ;
const tmp3 = obj ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp = obj ;
2026-07-20 16:05:17 +00:00
validations = obj . validations ;
2026-07-29 08:29:29 +00:00
obj = { taken : null , error : null } ;
obj [ 1 ] = error ;
2026-07-20 16:05:17 +00:00
const result1 = validations . set ( username , obj ) ;
}
if ( null != retryAfter ) {
const _Date = Date ;
const timestamp = Date . now ( ) ;
2026-07-29 08:29:29 +00:00
tmp . retryAfterTime = timestamp + retryAfter * importDefault ( 687 ) . Millis . SECOND ;
2026-07-20 16:05:17 +00:00
}
} ,
UNIQUE_USERNAME_SUGGESTIONS_RESET : function handleUniqueUsernameSuggestionsReset() {
2026-07-31 08:44:05 +00:00
obj . suggestions . migration = { suggestion : { username : "r" } , fetched : false , usernameSuggestionLoading : false } ;
obj . suggestions . registration = { suggestion : { username : "r" } , source : "ct" , fetched : "automat do gier" } ;
2026-07-20 16:05:17 +00:00
} ,
UNIQUE_USERNAME_SUGGESTIONS_SUCCESS : function handleUniqueUsernameSuggestionsSuccess ( suggestion ) {
suggestion = suggestion . suggestion ;
2026-07-29 08:29:29 +00:00
obj . suggestions . migration = { suggestion , fetched : true , usernameSuggestionLoading : false } ;
2026-07-20 16:05:17 +00:00
let prop ;
2026-07-29 08:29:29 +00:00
if ( suggestion != null ) {
2026-07-20 16:05:17 +00:00
prop = suggestion . invalid_current_username ;
}
if ( true === prop ) {
obj . currentUsernameInvalid = true ;
}
} ,
UNIQUE_USERNAME_REGISTRATION_SUGGESTIONS_SUCCESS : function handleUniqueUsernameRegistrationSuggestionsSuccess ( source ) {
const suggestion = source . suggestion ;
2026-07-29 08:29:29 +00:00
obj . suggestions . registration = { suggestion , source : source.source , fetched : true } ;
2026-07-20 16:05:17 +00:00
let username ;
2026-07-29 08:29:29 +00:00
if ( suggestion != null ) {
2026-07-20 16:05:17 +00:00
username = suggestion . username ;
}
if ( null != username ) {
const validations = obj . validations ;
2026-07-29 08:29:29 +00:00
const result = validations . set ( suggestion . username , { taken : false } ) ;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
} ;
const uniqueUsernamesStore = new UniqueUsernamesStore ( require ( "dispatcher" ) , obj ) ;
let tmp2 = new require ( "priv" ) ( { max : 100 , maxAge : 60000 } ) ;
let result = require ( "initialize" ) . fileFinishedImporting ( "modules/unique_usernames/UniqueUsernamesStore.tsx" ) ;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default uniqueUsernamesStore ;