2026-07-29 08:29:29 +00:00
// Module ID: 1102
// Function ID: 1103
// Name: startProfileForSpan
// Dependencies: [5, 1101, 817, 1072, 1028]
// Exports: startProfileForSpan
// Module 1102 (startProfileForSpan)
import asyncGeneratorStep from "asyncGeneratorStep" ;
Object . defineProperty ( exports , Symbol . toStringTag , { value : "Module" } ) ;
export const startProfileForSpan = function startProfileForSpan ( rootSpan ) {
const _require = rootSpan ;
function onProfileHandler ( ) {
const self = this ;
const apply = _onProfileHandler . apply ;
if ( typeof apply === "unknown" ) {
let applyArgumentsResult = HermesBuiltin . applyArguments ( self ) ;
} else {
applyArgumentsResult = apply ( self , arguments ) ;
}
return applyArgumentsResult ;
}
function _onProfileHandler ( ) {
const self = this ;
const tmp = uuid4Result ( function * ( ) {
if ( v0 === 2 ) {
v0 = 3 ;
HermesBuiltin . throwTypeError ( ) ;
} else if ( tmp3 === 3 ) {
if ( arg0 === 1 ) {
throw arg1 ;
} else if ( arg0 === 2 ) {
let obj = { value : null , done : true } ;
obj [ 0 ] = arg1 ;
return obj ;
} else {
2026-08-08 06:10:11 +00:00
return { value : "HermesInternal" , done : null } ;
2026-07-29 08:29:29 +00:00
}
} else {
try {
v0 = 2 ;
if ( arg0 === 1 ) {
v0 = 3 ;
throw arg1 ;
} else if ( arg0 === 2 ) {
v0 = 3 ;
obj = { value : null , done : true } ;
obj [ 0 ] = arg1 ;
return obj ;
} else {
if ( v0 ) {
obj = outer1 _1 ;
if ( outer1 _1 ) {
if ( outer1 _3 ) {
if ( v0 ( outer1 _1 [ 3 ] ) . DEBUG _BUILD ) {
let debug = tmp5 ( tmp6 [ 2 ] ) . debug ;
debug . log ( "[Profiling] profile for:" , tmp5 ( tmp6 [ 2 ] ) . spanToJSON ( tmp14 ) . description , "already exists, returning early" ) ;
const tmp5Result = tmp5 ( tmp6 [ 2 ] ) ;
}
} else {
const stopResult = obj . stop ( ) ;
v0 = 3 ;
const obj1 = { value : null , done : true } ;
obj1 [ 0 ] = obj . stop ( ) . then ( ( arg0 ) => {
if ( c4 ) {
const WINDOW = v3 ( outer1 _1 [ 4 ] ) . WINDOW ;
WINDOW . clearTimeout ( c4 ) ;
c4 = undefined ;
}
if ( v3 ( outer1 _1 [ 3 ] ) . DEBUG _BUILD ) {
const debug = v3 ( outer1 _1 [ 2 ] ) . debug ;
const _HermesInternal = HermesInternal ;
debug . log ( "[Profiling] stopped profiling of span: " + v3 ( outer1 _1 [ 2 ] ) . spanToJSON ( v3 ) . description ) ;
const obj = v3 ( outer1 _1 [ 2 ] ) ;
}
if ( arg0 ) {
let closure _3 = arg0 ;
const result = v3 ( outer1 _1 [ 1 ] ) . addProfileToGlobalCache ( closure _2 , arg0 ) ;
const obj3 = v3 ( outer1 _1 [ 1 ] ) ;
} else if ( v3 ( outer1 _1 [ 3 ] ) . DEBUG _BUILD ) {
const debug2 = v3 ( outer1 _1 [ 2 ] ) . debug ;
const _HermesInternal2 = HermesInternal ;
debug2 . log ( "[Profiling] profiler returned null profile for: " + v3 ( outer1 _1 [ 2 ] ) . spanToJSON ( v3 ) . description , "this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started" ) ;
const obj2 = v3 ( outer1 _1 [ 2 ] ) ;
}
} ) . catch ( ( arg0 ) => {
if ( v3 ( table [ 3 ] ) . DEBUG _BUILD ) {
const debug = v3 ( table [ 2 ] ) . debug ;
debug . log ( "[Profiling] error while stopping profiler:" , arg0 ) ;
}
} ) ;
return obj1 ;
}
}
}
v0 = 3 ;
2026-08-08 06:10:11 +00:00
return { value : "HermesInternal" , done : null } ;
2026-07-29 08:29:29 +00:00
}
} catch ( tmp8 ) {
v0 = tmp ;
throw tmp8 ;
}
}
} ) ;
const apply = tmp . apply ;
if ( typeof apply === "unknown" ) {
let applyArgumentsResult = HermesBuiltin . applyArguments ( self ) ;
} else {
applyArgumentsResult = apply ( self , arguments ) ;
}
return applyArgumentsResult ;
}
let obj = _require ( 1101 ) ;
if ( obj . isAutomatedPageLoadSpan ( rootSpan ) ) {
let tmpResult = tmp ( 817 ) ;
let result = 1000 * tmpResult . timestampInSeconds ( ) ;
}
tmpResult = tmp ( 1101 ) ;
const startJSSelfProfileResult = tmpResult . startJSSelfProfile ( ) ;
const dependencyMap = startJSSelfProfileResult ;
if ( startJSSelfProfileResult ) {
if ( tmp ( 1072 ) . DEBUG _BUILD ) {
let debug = tmp ( 817 ) . debug ;
let _HermesInternal = HermesInternal ;
debug . log ( "[Profiling] started profiling span: " + tmp ( 817 ) . spanToJSON ( rootSpan ) . description ) ;
const tmpResult1 = tmp ( 817 ) ;
}
const uuid4Result = tmp ( 817 ) . uuid4 ( ) ;
const asyncGeneratorStep = uuid4Result ;
let c3 = null ;
const tmpResult2 = tmp ( 817 ) ;
const currentScope = tmp ( 817 ) . getCurrentScope ( ) ;
obj = { profile _id : null , start _timestamp : null } ;
obj [ 0 ] = uuid4Result ;
obj [ 1 ] = result ;
currentScope . setContext ( "profile" , obj ) ;
let WINDOW = tmp ( 1028 ) . WINDOW ;
const timeout = WINDOW . setTimeout ( ( ) => {
if ( callback ( startJSSelfProfileResult [ 3 ] ) . DEBUG _BUILD ) {
const debug = tmp ( tmp2 [ 2 ] ) . debug ;
debug . log ( "[Profiling] max profile duration elapsed, stopping profiling for:" , tmp ( tmp2 [ 2 ] ) . spanToJSON ( callback ) . description ) ;
const tmpResult = tmp ( tmp2 [ 2 ] ) ;
}
onProfileHandler ( ) ;
} , tmp ( 1101 ) . MAX _PROFILE _DURATION _MS ) ;
const end = rootSpan . end ;
let closure _5 = end . bind ( rootSpan ) ;
rootSpan . end = function profilingWrappedSpanEnd ( ) {
if ( closure _0 ) {
onProfileHandler ( ) . then ( ( ) => {
callback ( ) ;
} , ( ) => {
callback ( ) ;
} ) ;
let tmp3 = tmp ;
const promise = onProfileHandler ( ) ;
} else {
tmp3 = callback2 ( ) ;
}
return tmp3 ;
} ;
const tmpResult3 = tmp ( 817 ) ;
}
} ;