2026-07-29 08:29:29 +00:00
// Module ID: 531
// Function ID: 532
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelper
2026-07-29 08:29:29 +00:00
// Dependencies: [532, 533, 579, 580, 581, 582, 583]
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
// Module 531 (_createForOfIteratorHelper)
2026-07-23 10:11:24 +00:00
import _createForOfIteratorHelper from "_createForOfIteratorHelper" ;
import _createForOfIteratorHelper from "_createForOfIteratorHelper" ;
2026-07-20 16:05:17 +00:00
let length ;
2026-07-29 08:29:29 +00:00
let require ;
2026-07-20 16:05:17 +00:00
let _exports = exports ;
2026-07-23 10:11:24 +00:00
function _createForOfIteratorHelper ( iterable ) {
let closure _0 = iterable ;
2026-08-04 21:03:28 +00:00
iterable = typeof Symbol !== "undefined" ;
if ( typeof Symbol !== "undefined" ) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol ;
2026-07-23 10:11:24 +00:00
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( ! iterable ) {
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let arr = iterable ;
if ( iterable ) {
let c4 = true ;
let c5 = false ;
2026-07-29 08:29:29 +00:00
let obj = { s : null , n : null , e : null , f : null } ;
obj [ 0 ] = function s ( ) {
const call = closure _1 . call ;
closure _1 = typeof call === "unknown" ? closure _1 ( ) : call ( closure _0 ) ;
} ;
obj [ 1 ] = function n ( ) {
const iter = arr . next ( ) ;
const done = iter . done ;
return iter ;
} ;
obj [ 2 ] = function e ( arg0 ) {
let c5 = true ;
let closure _3 = arg0 ;
} ;
obj [ 3 ] = function f ( ) {
try {
let tmp = c4 ;
if ( ! c4 ) {
tmp = null == arr . return ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( ! tmp ) {
arr . return ( ) ;
}
if ( c5 ) {
throw closure _3 ;
}
} catch ( tmp8 ) {
if ( c5 ) {
throw closure _3 ;
} else {
throw tmp8 ;
}
}
2026-07-20 16:05:17 +00:00
} ;
return obj ;
} else {
const _Array = Array ;
2026-07-23 10:11:24 +00:00
if ( ! Array . isArray ( iterable ) ) {
arr = undefined ;
if ( iterable ) {
2026-08-04 21:03:28 +00:00
if ( typeof iterable === "string" ) {
2026-07-29 08:29:29 +00:00
const _Array4 = Array ;
let array = new Array ( length2 ) ;
class F {
constructor ( ) {
return ;
}
}
let num5 = 0 ;
arr = array ;
if ( 0 < iterable . length ) {
do {
array [ num5 ] = iterable [ num5 ] ;
num5 = num5 + 1 ;
arr = array ;
} while ( num5 < length2 ) ;
}
2026-07-20 16:05:17 +00:00
} else {
const _Object = Object ;
2026-07-29 08:29:29 +00:00
let call = toString . call ;
typeof call === "unknown" ? toString ( ) : call ( iterable ) ;
2026-07-20 16:05:17 +00:00
class F {
constructor ( ) {
return ;
}
}
2026-07-29 08:29:29 +00:00
let name = tmp3 ;
if ( tmp4 ) {
2026-07-23 10:11:24 +00:00
name = iterable . constructor . name ;
2026-07-20 16:05:17 +00:00
}
if ( "Map" !== name ) {
if ( "Set" !== name ) {
if ( "Arguments" === name ) {
2026-07-29 08:29:29 +00:00
const _Array2 = Array ;
array = new Array ( length ) ;
class F {
constructor ( ) {
return ;
}
}
let num3 = 0 ;
arr = array ;
if ( 0 < iterable . length ) {
do {
array [ num3 ] = iterable [ num3 ] ;
num3 = num3 + 1 ;
arr = array ;
} while ( num3 < length ) ;
}
2026-07-20 16:05:17 +00:00
} else {
obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ ;
}
}
}
2026-07-29 08:29:29 +00:00
const _Array3 = Array ;
2026-07-23 10:11:24 +00:00
arr = Array . from ( iterable ) ;
2026-07-29 08:29:29 +00:00
tmp4 = "Object" === tmp3 && iterable . constructor ;
2026-07-20 16:05:17 +00:00
}
}
if ( ! arr ) {
const _TypeError = TypeError ;
const typeError = new TypeError ( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
class F {
constructor ( ) {
return ;
}
}
}
}
2026-07-23 10:11:24 +00:00
if ( arr ) {
closure _0 = arr ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c2 = 0 ;
2026-07-20 16:05:17 +00:00
class F {
constructor ( ) {
return ;
}
}
2026-07-29 08:29:29 +00:00
obj = { s : null , n : null , e : null , f : null } ;
obj [ 0 ] = F ;
obj [ 1 ] = function n ( ) {
if ( closure _2 >= length . length ) {
let obj = { done : true } ;
} else {
obj = { done : false , value : null } ;
closure _2 = tmp3 + 1 ;
obj [ 1 ] = tmp [ + closure _2 ] ;
}
return obj ;
2026-07-20 16:05:17 +00:00
} ;
2026-07-29 08:29:29 +00:00
obj [ 2 ] = function e ( arg0 ) {
throw arg0 ;
} ;
obj [ 3 ] = F ;
2026-07-20 16:05:17 +00:00
return obj ;
}
}
function noop ( ) {
}
2026-07-29 08:29:29 +00:00
function pushEncodedKeyValuePair ( items , key10006 , value ) {
2026-07-20 16:05:17 +00:00
let done ;
2026-07-23 10:11:24 +00:00
if ( undefined !== value ) {
2026-07-29 08:29:29 +00:00
if ( null !== value ) {
2026-07-20 16:05:17 +00:00
const _Array = Array ;
2026-07-29 08:29:29 +00:00
if ( Array . isArray ( value ) ) {
const obj3 = _createForOfIteratorHelper ( value ) ;
try {
obj3 . s ( ) ;
const iter = obj3 . n ( ) ;
let iter2 = iter ;
if ( ! iter . done ) {
do {
let tmp15 = pushEncodedKeyValuePair ;
let tmp16 = iter2 ;
let tmp17 = pushEncodedKeyValuePair ( items , key10006 , iter2 . value ) ;
let iter3 = obj3 . n ( ) ;
iter2 = iter3 ;
done = iter3 . done ;
} while ( ! done ) ;
}
obj3 . f ( ) ;
obj3 . e ( _ _exception ) ;
} catch ( tmp20 ) {
obj . f ( ) ;
throw tmp20 ;
2026-07-20 16:05:17 +00:00
}
} else {
2026-07-29 08:29:29 +00:00
if ( obj2 . isObject ( value ) ) {
for ( const key10033 in arg2 ) {
let tmp26 = require ;
let tmp27 = dependencyMap ;
let tmp25 = key10033 ;
let obj4 = require ( 532 ) /* _createForOfIteratorHelper */ ;
if ( ! obj4 . hasOwn ( arg2 , key10033 ) ) {
2026-07-20 16:05:17 +00:00
continue ;
} else {
2026-07-29 08:29:29 +00:00
let tmp9 = pushEncodedKeyValuePair ;
2026-07-20 16:05:17 +00:00
let _HermesInternal = HermesInternal ;
let str5 = "" ;
2026-07-29 08:29:29 +00:00
let tmp10 = arg1 ;
2026-07-20 16:05:17 +00:00
let str6 = "[" ;
2026-07-29 08:29:29 +00:00
let tmp11 = key10033 ;
2026-07-20 16:05:17 +00:00
let str7 = "]" ;
2026-07-29 08:29:29 +00:00
let tmp12 = pushEncodedKeyValuePair ( arg0 , "" + arg1 + "[" + tmp25 + "]" , arg2 [ key10033 ] ) ;
2026-07-23 10:11:24 +00:00
continue ;
2026-07-20 16:05:17 +00:00
}
continue ;
}
} else {
const _encodeURI2 = encodeURI ;
const _encodeURIComponent = encodeURIComponent ;
2026-07-29 08:29:29 +00:00
const text = ` ${ encodeURI ( key10006 ) } = ` ;
items . push ( ` ${ encodeURI ( key10006 ) } = ` + encodeURIComponent ( value ) ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj2 = require ( 532 ) /* _createForOfIteratorHelper */ ;
2026-07-20 16:05:17 +00:00
}
} else {
const _encodeURI = encodeURI ;
2026-07-29 08:29:29 +00:00
items . push ( encodeURI ( key10006 ) ) ;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
function isJSON ( arg0 ) {
return /[/+]json($|[^-\w])/i . test ( arg0 ) ;
2026-07-20 16:05:17 +00:00
}
class Response {
constructor ( arg0 ) {
self = this ;
this . req = global ;
this . xhr = this . req . xhr ;
if ( "HEAD" === this . req . method ) {
responseText = null ;
self . text = responseText ;
self . statusText = self . req . xhr . statusText ;
num = self . xhr . status ;
num2 = 1223 ;
if ( 1223 === num ) {
num = 204 ;
}
_setStatusPropertiesResult = self . _setStatusProperties ( num ) ;
xhr = self . xhr ;
str3 = xhr . getAllResponseHeaders ( ) ;
parts = str3 . split ( /\r?\n/ ) ;
obj = { } ;
length = parts . length ;
num3 = 0 ;
num4 = 1 ;
str4 = ":" ;
num5 = - 1 ;
for ( let num6 = 0 ; num6 < length ; num6 = num6 + 1 ) {
arr2 = parts [ num6 ] ;
index = arr2 . indexOf ( ":" ) ;
2026-07-29 08:29:29 +00:00
tmp4 = num6 ;
2026-07-20 16:05:17 +00:00
if ( - 1 !== index ) {
2026-07-23 10:11:24 +00:00
str5 = require ( "_createForOfIteratorHelper" ) ;
2026-07-29 08:29:29 +00:00
tmp6 = trim ;
2026-07-20 16:05:17 +00:00
formatted = str5 . toLowerCase ( ) ;
2026-07-29 08:29:29 +00:00
str6 = arr2 . slice ( index + 1 ) ;
2026-08-04 21:03:28 +00:00
if ( typeof trim !== "function" ) {
2026-07-29 08:29:29 +00:00
str8 = "Trying to call a non-function" ;
throwTypeErrorResult = HermesBuiltin . throwTypeError ( ) ;
}
obj [ formatted ] = str6 . trim ( ) ;
2026-07-20 16:05:17 +00:00
}
}
self . headers = obj ;
( { headers : self . header , xhr : xhr2 } = self ) ;
2026-07-29 08:29:29 +00:00
str7 = "content-type" ;
2026-07-23 10:11:24 +00:00
self . header [ "content-type" ] = xhr2 . getResponseHeader ( "content-type" ) ;
2026-07-20 16:05:17 +00:00
_setHeaderPropertiesResult = self . _setHeaderProperties ( self . header ) ;
2026-07-29 08:29:29 +00:00
tmp8 = null ;
2026-07-20 16:05:17 +00:00
if ( null === self . text ) {
if ( global . _responseType ) {
self . body = self . xhr . response ;
}
return ;
}
2026-07-29 08:29:29 +00:00
tmp9 = null ;
2026-07-20 16:05:17 +00:00
if ( "HEAD" === self . req . method ) {
self . body = null ;
} else {
if ( self . text ) {
response = self . text ;
} else {
response = self . xhr . response ;
}
_parseBodyResult = self . _parseBody ( response ) ;
}
} else {
str = "" ;
if ( "" !== self . xhr . responseType ) {
str2 = "text" ;
}
}
responseText = self . xhr . responseText ;
return ;
}
_parseBody ( arg0 ) {
self = this ;
2026-07-29 08:29:29 +00:00
application _json = closure _6 . parse [ this . type ] ;
2026-07-20 16:05:17 +00:00
if ( this . req . _parser ) {
req = self . req ;
_parserResult = req . _parser ( self , global ) ;
} else {
2026-07-29 08:29:29 +00:00
isMatch = ! application _json ;
if ( ! application _json ) {
obj = /[/+]json($|[^-\w])/i ;
isMatch = obj . test ( self . type ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( isMatch ) {
application _json = tmp . parse [ "application/json" ] ;
2026-07-20 16:05:17 +00:00
}
_parserResult = null ;
if ( application _json ) {
_parserResult = null ;
if ( global ) {
num = 0 ;
if ( global . length > 0 ) {
_parserResult = application _json ( global ) ;
} else {
2026-07-29 08:29:29 +00:00
tmp4 = globalThis ;
2026-07-20 16:05:17 +00:00
_Object = Object ;
_parserResult = null ;
}
}
}
}
return _parserResult ;
}
toError ( ) {
( { method , url } = this . req ) ;
error = new Error ( "cannot " + method + " " + url + " (" + this . status + ")" ) ;
error . status = this . status ;
error . method = method ;
error . url = url ;
return error ;
}
}
2026-08-04 21:03:28 +00:00
if ( typeof window !== "undefined" ) {
2026-07-29 08:29:29 +00:00
const _window = window ;
let self = window ;
} else {
const _self = self ;
2026-08-04 21:03:28 +00:00
if ( typeof self === "undefined" ) {
2026-07-29 08:29:29 +00:00
let _console = console ;
console . warn ( "Using browser-only version of superagent in non-browser environment" ) ;
self = undefined ;
} else {
const _self2 = self ;
}
}
function parseString ( str ) {
const obj = { } ;
const parts = str . split ( "&" ) ;
for ( let num = 0 ; num < length ; num = num + 1 ) {
let arr2 = parts [ num ] ;
let index = arr2 . indexOf ( "=" ) ;
let tmp2 = num ;
if ( - 1 === index ) {
let _decodeURIComponent3 = decodeURIComponent ;
obj [ decodeURIComponent ( arr2 ) ] = "" ;
} else {
let _decodeURIComponent = decodeURIComponent ;
let _decodeURIComponent2 = decodeURIComponent ;
let decodeURIComponentResult = decodeURIComponent ( arr2 . slice ( 0 , index ) ) ;
obj [ decodeURIComponentResult ] = decodeURIComponent ( arr2 . slice ( index + 1 ) ) ;
}
}
return obj ;
}
2026-07-20 16:05:17 +00:00
class Request {
constructor ( arg0 , arg1 ) {
self = this ;
2026-07-23 10:11:24 +00:00
self = this ;
2026-07-29 08:29:29 +00:00
tmp = this . _query || [ ] ;
self . _query = tmp ;
2026-07-20 16:05:17 +00:00
self . method = global ;
self . url = require ;
self . header = { } ;
self . _header = { } ;
onResult = self . on ( "end" , ( ) => {
2026-07-29 08:29:29 +00:00
try {
let obj = self ;
obj = Object . create ( outer1 _10 . prototype ) ;
outer1 _10 ( self ) ;
obj . emit ( "response" , obj ) ;
try {
if ( ! obj . _isResponseOK ( tmp8 ) ) {
let str2 = tmp8 . statusText ;
if ( ! str2 ) {
str2 = tmp8 . text ;
}
if ( ! str2 ) {
str2 = "Unsuccessful HTTP response" ;
}
const error = new Error ( str2 ) ;
}
if ( error ) {
error . original = null ;
error . response = tmp8 ;
let status = error . status ;
if ( ! status ) {
status = tmp8 . status ;
}
error . status = status ;
obj . callback ( error , obj ) ;
} else {
obj . callback ( null , tmp8 ) ;
}
} catch ( error ) {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
} catch ( tmp29 ) {
const _Error = Error ;
const error1 = new Error ( "Parser is unable to parse the response" ) ;
error1 . parse = true ;
error1 . original = tmp29 ;
if ( self . xhr ) {
if ( tmp2 === obj2 . xhr . responseType ) {
let response = obj2 . xhr . responseText ;
} else {
response = obj2 . xhr . response ;
}
error1 . rawResponse = response ;
status = null ;
if ( obj2 . xhr . status ) {
status = obj2 . xhr . status ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
error1 . status = status ;
error1 . statusCode = error1 . status ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
error1 . rawResponse = tmp ;
error1 . status = tmp ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return self . callback ( error1 ) ;
2026-07-20 16:05:17 +00:00
}
} ) ;
return ;
}
type ( arg0 ) {
self = this ;
2026-07-29 08:29:29 +00:00
tmp = closure _6 . types [ global ] ;
2026-07-20 16:05:17 +00:00
if ( ! tmp ) {
tmp = global ;
}
result = this . set ( "Content-Type" , tmp ) ;
return self ;
}
accept ( arg0 ) {
self = this ;
2026-07-29 08:29:29 +00:00
tmp = closure _6 . types [ global ] ;
2026-07-20 16:05:17 +00:00
if ( ! tmp ) {
tmp = global ;
}
result = this . set ( "Accept" , tmp ) ;
return self ;
}
auth ( arg0 , arg1 , arg2 ) {
str = require ;
if ( 1 === arguments . length ) {
str = "" ;
}
2026-08-04 21:03:28 +00:00
tmp = typeof str === "object" ;
if ( typeof str === "object" ) {
2026-07-29 08:29:29 +00:00
tmp5 = null ;
tmp = null !== str ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp2 = importDefault ;
2026-07-20 16:05:17 +00:00
str2 = str ;
2026-07-29 08:29:29 +00:00
if ( tmp ) {
2026-07-20 16:05:17 +00:00
str2 = "" ;
2026-07-29 08:29:29 +00:00
tmp2 = str ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( ! tmp2 ) {
tmp3 = globalThis ;
2026-07-20 16:05:17 +00:00
_btoa = btoa ;
str3 = "auto" ;
2026-08-04 21:03:28 +00:00
if ( typeof btoa === "function" ) {
2026-07-20 16:05:17 +00:00
str3 = "basic" ;
}
2026-07-29 08:29:29 +00:00
obj = { type : null } ;
obj [ 0 ] = str3 ;
tmp2 = obj ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = tmp2 . encoder || ( ( arg0 ) => {
2026-08-04 21:03:28 +00:00
if ( typeof btoa === "function" ) {
2026-07-20 16:05:17 +00:00
const _btoa = btoa ;
return btoa ( arg0 ) ;
} else {
const _Error = Error ;
const error = new Error ( "Cannot use basic auth, btoa is not a function" ) ;
throw error ;
}
2026-07-23 10:11:24 +00:00
} ) ;
2026-07-29 08:29:29 +00:00
return this . _auth ( global , str2 , tmp2 , tmp4 ) ;
2026-07-20 16:05:17 +00:00
}
query ( arg0 ) {
tmp = global ;
2026-08-04 21:03:28 +00:00
if ( typeof global !== "string" ) {
2026-07-29 08:29:29 +00:00
tmp7 = closure _0 ;
tmp8 = closure _2 ;
obj = require ( "_createForOfIteratorHelper" ) ;
joined = global ;
if ( obj . isObject ( global ) ) {
items = [ ] ;
tmp2 = global ;
num = 0 ;
for ( const key10006 in arg0 ) {
tmp9 = key10006 ;
tmp10 = closure _0 ;
tmp11 = closure _2 ;
obj2 = require ( "_createForOfIteratorHelper" ) ;
if ( ! obj2 . hasOwn ( arg0 , key10006 ) ) {
continue ;
} else {
tmp3 = pushEncodedKeyValuePair ;
tmp4 = pushEncodedKeyValuePair ( items , key10006 , arg0 [ key10006 ] ) ;
continue ;
}
continue ;
}
str = "&" ;
joined = items . join ( "&" ) ;
}
tmp = joined ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
self = this ;
2026-07-20 16:05:17 +00:00
if ( tmp ) {
_query = self . _query ;
arr = _query . push ( tmp ) ;
}
return self ;
}
attach ( arg0 , arg1 , arg2 ) {
self = this ;
if ( require ) {
if ( self . _data ) {
tmp3 = globalThis ;
_Error = Error ;
tmp4 = new . target ;
str = "superagent can't mix .send() and .attach()" ;
tmp5 = new . target ;
error = new Error ( "superagent can't mix .send() and .attach()" ) ;
tmp7 = error ;
throw error ;
} else {
2026-07-29 08:29:29 +00:00
name = importDefault ;
2026-07-20 16:05:17 +00:00
_getFormDataResult = self . _getFormData ( ) ;
2026-07-29 08:29:29 +00:00
if ( ! importDefault ) {
2026-07-20 16:05:17 +00:00
name = require . name ;
}
tmp = global ;
appendResult = _getFormDataResult . append ( global , require , name ) ;
}
}
return self ;
}
_getFormData ( ) {
self = this ;
if ( ! this . _formData ) {
tmp = self ;
tmp2 = new . target ;
tmp3 = new . target ;
2026-07-29 08:29:29 +00:00
formData = new self . FormData ( ) ;
tmp5 = formData ;
self . _formData = formData ;
2026-07-20 16:05:17 +00:00
}
return self . _formData ;
}
callback ( arg0 , arg1 ) {
self = this ;
if ( this . _shouldRetry ( global , require ) ) {
return self . _retry ( ) ;
} else {
clearTimeoutResult = self . clearTimeout ( ) ;
if ( global ) {
if ( self . _maxRetries ) {
num = 1 ;
global . retries = self . _retries - 1 ;
}
str = "error" ;
emitResult = self . emit ( "error" , global ) ;
}
_callbackResult = self . _callback ( global , require ) ;
return ;
}
}
crossDomainError ( ) {
error = new Error ( "Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc." ) ;
error . crossDomain = true ;
( { status : tmp . status , method : tmp . method , url : tmp . url } = this ) ;
callbackResult = this . callback ( error ) ;
return ;
}
agent ( ) {
warnResult = console . warn ( "This is not supported in browser version of superagent" ) ;
return this ;
}
write ( ) {
error = new Error ( "Streaming is not supported in browser version of superagent" ) ;
throw error ;
}
_isHost ( arg0 ) {
tmp = global ;
if ( global ) {
2026-08-04 21:03:28 +00:00
tmp = typeof global === "object" ;
2026-07-20 16:05:17 +00:00
}
if ( tmp ) {
tmp2 = globalThis ;
_Array = Array ;
tmp = ! Array . isArray ( global ) ;
}
2026-07-29 08:29:29 +00:00
if ( ! tmp ) {
return tmp ;
} else {
2026-07-20 16:05:17 +00:00
tmp3 = globalThis ;
_Object = Object ;
2026-07-29 08:29:29 +00:00
str = Object . prototype . toString ;
call = str . call ;
tmp4 = typeof call === "unknown" ? str ( ) : call ( global ) ;
str = "[object Object]" ;
tmp5 = "[object Object]" !== tmp4 ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return ;
2026-07-20 16:05:17 +00:00
}
end ( arg0 ) {
self = this ;
if ( this . _endCalled ) {
2026-07-29 08:29:29 +00:00
tmp = globalThis ;
2026-07-20 16:05:17 +00:00
_console = console ;
str = "Warning: .end() was called twice. This is not supported in superagent" ;
warnResult = console . warn ( "Warning: .end() was called twice. This is not supported in superagent" ) ;
}
2026-07-29 08:29:29 +00:00
tmp3 = global ;
2026-07-20 16:05:17 +00:00
self . _endCalled = true ;
2026-07-29 08:29:29 +00:00
if ( ! global ) {
tmp3 = noop ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
self . _callback = tmp3 ;
2026-07-20 16:05:17 +00:00
_finalizeQueryStringResult = self . _finalizeQueryString ( ) ;
_endResult = self . _end ( ) ;
return ;
}
_setUploadTimeout ( ) {
self = this ;
2026-07-23 10:11:24 +00:00
self = this ;
2026-07-20 16:05:17 +00:00
tmp = this . _uploadTimeout && ! self . _uploadTimeoutTimer ;
if ( tmp ) {
tmp2 = globalThis ;
_setTimeout = setTimeout ;
self . _uploadTimeoutTimer = setTimeout ( ( ) => {
self . _timeoutError ( "Upload timeout of " , self . _uploadTimeout , "ETIMEDOUT" ) ;
} , self . _uploadTimeout ) ;
}
return ;
}
_end ( ) {
self = this ;
if ( this . _aborted ) {
2026-07-29 08:29:29 +00:00
tmp24 = globalThis ;
2026-07-20 16:05:17 +00:00
_Error = Error ;
2026-07-29 08:29:29 +00:00
tmp25 = new . target ;
str9 = "The request has been aborted even before .end() was called" ;
tmp26 = new . target ;
2026-07-20 16:05:17 +00:00
error = new Error ( "The request has been aborted even before .end() was called" ) ;
2026-07-29 08:29:29 +00:00
tmp28 = error ;
2026-07-20 16:05:17 +00:00
return self . callback ( error ) ;
} else {
2026-07-29 08:29:29 +00:00
tmp = closure _6 ;
self . xhr = closure _6 . getXHR ( ) ;
2026-07-20 16:05:17 +00:00
xhr = self . xhr ;
tmp2 = self . _formData || self . _data ;
_setTimeoutsResult = self . _setTimeouts ( ) ;
str = "readystatechange" ;
2026-07-29 08:29:29 +00:00
listener = xhr . addEventListener ( "readystatechange" , ( ) => {
2026-07-20 16:05:17 +00:00
const readyState = xhr . readyState ;
let _responseTimeoutTimer = readyState >= 2 ;
if ( _responseTimeoutTimer ) {
_responseTimeoutTimer = self . _responseTimeoutTimer ;
}
if ( _responseTimeoutTimer ) {
const _clearTimeout = clearTimeout ;
clearTimeout ( self . _responseTimeoutTimer ) ;
}
if ( 4 === readyState ) {
2026-07-29 08:29:29 +00:00
try {
if ( xhr . status ) {
obj . emit ( "end" ) ;
2026-07-20 16:05:17 +00:00
} else if ( ! obj . timedout ) {
2026-07-29 08:29:29 +00:00
if ( ! obj . _aborted ) {
return obj . crossDomainError ( ) ;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
} catch ( err ) {
2026-07-20 16:05:17 +00:00
}
}
} ) ;
2026-07-29 08:29:29 +00:00
num = "progress" ;
2026-07-20 16:05:17 +00:00
if ( self . hasListeners ( "progress" ) ) {
2026-07-29 08:29:29 +00:00
try {
handleProgress = function handleProgress ( direction , total ) {
if ( total . total > 0 ) {
total . percent = total . loaded / total . total * 100 ;
if ( 100 === total . percent ) {
const _clearTimeout = clearTimeout ;
clearTimeout ( self . _uploadTimeoutTimer ) ;
}
}
total . direction = direction ;
self . emit ( "progress" , total ) ;
} ;
str2 = "download" ;
tmp5 = null ;
listener1 = xhr . addEventListener ( ` progress ` , handleProgress . bind ( null , "download" ) ) ;
if ( ! xhr . upload ) {
} else {
upload = xhr . upload ;
str3 = "upload" ;
listener2 = upload . addEventListener ( ` progress ` , handleProgress . bind ( null , "upload" ) ) ;
}
} catch ( err ) {
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if ( xhr . upload ) {
_setUploadTimeoutResult = self . _setUploadTimeout ( ) ;
}
try {
if ( ! self . username ) {
2026-07-20 16:05:17 +00:00
} else {
if ( self . password ) {
flag2 = true ;
2026-07-29 08:29:29 +00:00
tmp10 = xhr ;
openResult = xhr . open ( self . method , self . url , true , self . username , self . password ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( ! self . _withCredentials ) {
} else {
2026-07-20 16:05:17 +00:00
flag3 = true ;
2026-07-29 08:29:29 +00:00
xhr . withCredentials = true ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
result = tmp2 ;
if ( self . _formData ) {
} else {
str4 = "GET" ;
result = tmp2 ;
if ( "GET" === self . method ) {
} else {
str10 = "HEAD" ;
result = tmp2 ;
if ( "HEAD" === self . method ) {
} else {
result = tmp2 ;
2026-08-04 21:03:28 +00:00
if ( typeof tmp2 === "string" ) {
2026-07-29 08:29:29 +00:00
} else {
result = tmp2 ;
if ( self . _isHost ( tmp2 ) ) {
} else {
str5 = self . _header [ "content-type" ] ;
application _json = self . _serializer ;
if ( application _json ) {
} else {
str6 = "" ;
if ( ! str5 ) {
} else {
str7 = ";" ;
str6 = str5 . split ( ";" ) [ 0 ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
application _json = tmp . serialize [ str6 ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp13 = ! application _json ;
if ( application _json ) {
} else {
tmp14 = isJSON ;
num = 0 ;
tmp13 = isJSON ( str5 ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( ! tmp13 ) {
} else {
application _json = tmp . serialize [ "application/json" ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
result = tmp2 ;
if ( ! application _json ) {
} else {
result = application _json ( tmp2 ) ;
2026-07-20 16:05:17 +00:00
}
}
}
}
}
}
2026-07-29 08:29:29 +00:00
tmp15 = null ;
for ( const key10069 in self . header ) {
tmp29 = key10069 ;
hasOwnResult = null !== self . header [ key10069 ] ;
if ( ! hasOwnResult ) {
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp16 = self ;
tmp17 = closure _2 ;
2026-07-23 10:11:24 +00:00
obj2 = require ( "_createForOfIteratorHelper" ) ;
2026-07-29 08:29:29 +00:00
hasOwnResult = obj2 . hasOwn ( self . header , key10069 ) ;
2026-07-20 16:05:17 +00:00
}
if ( ! hasOwnResult ) {
continue ;
} else {
2026-07-29 08:29:29 +00:00
setRequestHeaderResult = xhr . setRequestHeader ( key10069 , self . header [ key10069 ] ) ;
2026-07-23 10:11:24 +00:00
continue ;
2026-07-20 16:05:17 +00:00
}
continue ;
}
2026-07-29 08:29:29 +00:00
if ( ! self . _responseType ) {
} else {
xhr . responseType = self . _responseType ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
str8 = "request" ;
2026-07-20 16:05:17 +00:00
emitResult = self . emit ( "request" , self ) ;
2026-07-29 08:29:29 +00:00
tmp21 = null ;
if ( undefined === result ) {
} else {
tmp21 = result ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
sendResult = xhr . send ( tmp21 ) ;
2026-07-20 16:05:17 +00:00
return ;
}
2026-07-29 08:29:29 +00:00
num = xhr . open ;
2026-07-20 16:05:17 +00:00
flag = true ;
2026-07-29 08:29:29 +00:00
numResult = num ( self . method , self . url , true ) ;
} catch ( tmp23 ) {
return obj . callback ( tmp23 ) ;
2026-07-20 16:05:17 +00:00
}
}
return ;
}
}
_exports = module . exports ;
_exports . Request = Request ;
_exports . getXHR = ( ) => {
if ( self . XMLHttpRequest ) {
2026-07-29 08:29:29 +00:00
const xMLHttpRequest = new self . XMLHttpRequest ( ) ;
return xMLHttpRequest ;
2026-07-20 16:05:17 +00:00
} else {
const _Error = Error ;
const error = new Error ( "Browser-only version of superagent could not find XHR" ) ;
throw error ;
}
} ;
2026-07-29 08:29:29 +00:00
function trim ( arg0 ) {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
_exports . serializeObject = function serialize ( obj ) {
if ( obj . isObject ( obj ) ) {
const items = [ ] ;
for ( const key10012 in arg0 ) {
let tmp4 = key10012 ;
let tmp5 = require ;
let tmp6 = dependencyMap ;
let obj2 = require ( 532 ) /* _createForOfIteratorHelper */ ;
if ( ! obj2 . hasOwn ( arg0 , key10012 ) ) {
continue ;
} else {
let tmp2 = pushEncodedKeyValuePair ;
let tmp3 = pushEncodedKeyValuePair ( items , key10012 , arg0 [ key10012 ] ) ;
continue ;
}
continue ;
}
return items . join ( "&" ) ;
} else {
return obj ;
}
obj = require ( 532 ) /* _createForOfIteratorHelper */ ;
} ;
2026-07-20 16:05:17 +00:00
_exports . parseString = parseString ;
2026-07-23 10:11:24 +00:00
_exports . types = { html : "text/html" , json : "application/json" , xml : "text/xml" , urlencoded : "application/x-www-form-urlencoded" , form : "application/x-www-form-urlencoded" , "form-data" : "application/x-www-form-urlencoded" } ;
2026-07-29 08:29:29 +00:00
let obj = { "application/x-www-form-urlencoded" : require ( "module_533" ) . stringify , "application/json" : require ( "defaultOptions" ) } ;
2026-07-20 16:05:17 +00:00
_exports . serialize = obj ;
2026-07-23 10:11:24 +00:00
obj = { "application/x-www-form-urlencoded" : parseString , "application/json" : JSON . parse } ;
2026-07-20 16:05:17 +00:00
_exports . parse = obj ;
2026-07-23 10:11:24 +00:00
_createForOfIteratorHelper . mixin ( Response . prototype , require ( "ResponseBase" ) . prototype ) ;
2026-07-20 16:05:17 +00:00
_exports . Response = Response ;
2026-07-23 10:11:24 +00:00
require ( "Emitter" ) ( Request . prototype ) ;
_createForOfIteratorHelper . mixin ( Request . prototype , require ( "RequestBase" ) . prototype ) ;
2026-07-20 16:05:17 +00:00
Request . prototype . ca = Request . prototype . agent ;
Request . prototype . buffer = Request . prototype . ca ;
Request . prototype . pipe = Request . prototype . write ;
2026-07-29 08:29:29 +00:00
_exports . agent = ( ) => new require ( 583 ) /* _createForOfIteratorHelper */ ( ) ;
2026-07-23 10:11:24 +00:00
let items = [ "GET" , "POST" , "OPTIONS" , "PATCH" , "PUT" , "DELETE" ] ;
2026-07-29 08:29:29 +00:00
let num = 0 ;
let num2 = 0 ;
2026-07-20 16:05:17 +00:00
if ( 0 < items . length ) {
do {
2026-07-29 08:29:29 +00:00
let str2 = items [ num2 ] ;
require = str2 ;
require ( "_createForOfIteratorHelper" ) . prototype [ str2 . toLowerCase ( ) ] = function ( arg0 , arg1 ) {
const request = new outer1 _6 . Request ( closure _0 , arg0 ) ;
this . _setDefaults ( request ) ;
if ( arg1 ) {
request . end ( arg1 ) ;
}
return request ;
} ;
num2 = num + 1 ;
num = num2 ;
2026-07-20 16:05:17 +00:00
length = items . length ;
2026-07-29 08:29:29 +00:00
} while ( num2 < length ) ;
2026-07-20 16:05:17 +00:00
}
2026-08-04 21:03:28 +00:00
function del ( arg0 , fn ) {
2026-07-20 16:05:17 +00:00
let tmp = arg2 ;
2026-07-29 08:29:29 +00:00
const obj = _exports ( "DELETE" , arg0 ) ;
2026-08-04 21:03:28 +00:00
let tmp2 = fn ;
if ( typeof fn === "function" ) {
2026-07-20 16:05:17 +00:00
tmp2 = null ;
2026-08-04 21:03:28 +00:00
tmp = fn ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( tmp2 ) {
obj . send ( tmp2 ) ;
}
if ( tmp ) {
obj . end ( tmp ) ;
}
return obj ;
}
require ( "_createForOfIteratorHelper" ) . prototype . del = require ( "_createForOfIteratorHelper" ) . prototype . delete ;
2026-08-04 21:03:28 +00:00
_exports . get = ( arg0 , fn ) => {
2026-07-29 08:29:29 +00:00
let tmp = arg2 ;
const obj = _exports ( "GET" , arg0 ) ;
2026-08-04 21:03:28 +00:00
let tmp2 = fn ;
if ( typeof fn === "function" ) {
2026-07-29 08:29:29 +00:00
tmp2 = null ;
2026-08-04 21:03:28 +00:00
tmp = fn ;
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
if ( tmp2 ) {
const query = obj . query ( tmp2 ) ;
}
if ( tmp ) {
obj . end ( tmp ) ;
}
return obj ;
} ;
2026-08-04 21:03:28 +00:00
_exports . head = ( arg0 , fn ) => {
2026-07-20 16:05:17 +00:00
let tmp = arg2 ;
const obj = _exports ( "HEAD" , arg0 ) ;
2026-08-04 21:03:28 +00:00
let tmp2 = fn ;
if ( typeof fn === "function" ) {
2026-07-20 16:05:17 +00:00
tmp2 = null ;
2026-08-04 21:03:28 +00:00
tmp = fn ;
2026-07-20 16:05:17 +00:00
}
if ( tmp2 ) {
const query = obj . query ( tmp2 ) ;
}
if ( tmp ) {
obj . end ( tmp ) ;
}
return obj ;
} ;
2026-08-04 21:03:28 +00:00
_exports . options = ( arg0 , fn ) => {
2026-07-20 16:05:17 +00:00
let tmp = arg2 ;
const obj = _exports ( "OPTIONS" , arg0 ) ;
2026-08-04 21:03:28 +00:00
let tmp2 = fn ;
if ( typeof fn === "function" ) {
2026-07-20 16:05:17 +00:00
tmp2 = null ;
2026-08-04 21:03:28 +00:00
tmp = fn ;
2026-07-20 16:05:17 +00:00
}
if ( tmp2 ) {
obj . send ( tmp2 ) ;
}
if ( tmp ) {
obj . end ( tmp ) ;
}
return obj ;
} ;
_exports . del = del ;
_exports . delete = del ;
2026-08-04 21:03:28 +00:00
_exports . patch = ( arg0 , fn ) => {
2026-07-20 16:05:17 +00:00
let tmp = arg2 ;
const obj = _exports ( "PATCH" , arg0 ) ;
2026-08-04 21:03:28 +00:00
let tmp2 = fn ;
if ( typeof fn === "function" ) {
2026-07-20 16:05:17 +00:00
tmp2 = null ;
2026-08-04 21:03:28 +00:00
tmp = fn ;
2026-07-20 16:05:17 +00:00
}
if ( tmp2 ) {
obj . send ( tmp2 ) ;
}
if ( tmp ) {
obj . end ( tmp ) ;
}
return obj ;
} ;
2026-08-04 21:03:28 +00:00
_exports . post = ( arg0 , fn ) => {
2026-07-20 16:05:17 +00:00
let tmp = arg2 ;
const obj = _exports ( "POST" , arg0 ) ;
2026-08-04 21:03:28 +00:00
let tmp2 = fn ;
if ( typeof fn === "function" ) {
2026-07-20 16:05:17 +00:00
tmp2 = null ;
2026-08-04 21:03:28 +00:00
tmp = fn ;
2026-07-20 16:05:17 +00:00
}
if ( tmp2 ) {
obj . send ( tmp2 ) ;
}
if ( tmp ) {
obj . end ( tmp ) ;
}
return obj ;
} ;
2026-08-04 21:03:28 +00:00
_exports . put = ( arg0 , fn ) => {
2026-07-20 16:05:17 +00:00
let tmp = arg2 ;
const obj = _exports ( "PUT" , arg0 ) ;
2026-08-04 21:03:28 +00:00
let tmp2 = fn ;
if ( typeof fn === "function" ) {
2026-07-20 16:05:17 +00:00
tmp2 = null ;
2026-08-04 21:03:28 +00:00
tmp = fn ;
2026-07-20 16:05:17 +00:00
}
if ( tmp2 ) {
obj . send ( tmp2 ) ;
}
if ( tmp ) {
obj . end ( tmp ) ;
}
return obj ;
} ;
2026-08-04 21:03:28 +00:00
export default ( arg0 , fn ) => {
if ( typeof fn === "function" ) {
2026-07-29 08:29:29 +00:00
const request = new _exports . Request ( "GET" , arg0 ) ;
2026-08-04 21:03:28 +00:00
let endResult = request . end ( fn ) ;
2026-07-20 16:05:17 +00:00
} else if ( 1 === arguments . length ) {
2026-07-29 08:29:29 +00:00
endResult = new _exports . Request ( "GET" , arg0 ) ;
2026-07-20 16:05:17 +00:00
} else {
2026-08-04 21:03:28 +00:00
endResult = new _exports . Request ( arg0 , fn ) ;
2026-07-20 16:05:17 +00:00
}
return endResult ;
} ;