2026-07-20 16:05:17 +00:00
// Module ID: 1075
2026-07-21 22:01:30 +00:00
// Function ID: 12350
2026-07-20 16:05:17 +00:00
// Name: browserProfilingIntegration
// Dependencies: []
// Module 1075 (browserProfilingIntegration)
Object . defineProperty ( exports , Symbol . toStringTag , { value : "Module" } ) ;
const _module = require ( dependencyMap [ 3 ] ) ;
export const browserProfilingIntegration = _module . defineIntegration ( function _browserProfilingIntegration ( ) {
return {
name : "BrowserProfiling" ,
setup ( getOptions ) {
const options = getOptions . getOptions ( ) ;
const uIProfiler = new uIProfiler ( closure _1 [ 0 ] ) . UIProfiler ( ) ;
const obj2 = uIProfiler ( closure _1 [ 1 ] ) ;
if ( ! tmp2 ) {
options . profileLifecycle = "manual" ;
}
const tmp2 = uIProfiler ( closure _1 [ 1 ] ) . hasLegacyProfiling ( options ) || options . profileLifecycle ;
if ( obj3 . hasLegacyProfiling ( options ) ) {
if ( ! options . profilesSampleRate ) {
if ( uIProfiler ( closure _1 [ 2 ] ) . DEBUG _BUILD ) {
const debug = uIProfiler ( closure _1 [ 3 ] ) . debug ;
debug . log ( "[Profiling] Profiling disabled, no profiling options found." ) ;
}
}
}
const obj3 = uIProfiler ( closure _1 [ 1 ] ) ;
const activeSpan = uIProfiler ( closure _1 [ 3 ] ) . getActiveSpan ( ) ;
let rootSpan = activeSpan ;
if ( activeSpan ) {
rootSpan = uIProfiler ( closure _1 [ 3 ] ) . getRootSpan ( activeSpan ) ;
const obj5 = uIProfiler ( closure _1 [ 3 ] ) ;
}
const obj4 = uIProfiler ( closure _1 [ 3 ] ) ;
let DEBUG _BUILD = uIProfiler ( closure _1 [ 1 ] ) . hasLegacyProfiling ( options ) && undefined !== options . profileSessionSampleRate ;
if ( DEBUG _BUILD ) {
DEBUG _BUILD = uIProfiler ( closure _1 [ 2 ] ) . DEBUG _BUILD ;
}
if ( DEBUG _BUILD ) {
const debug2 = uIProfiler ( closure _1 [ 3 ] ) . debug ;
debug2 . warn ( "[Profiling] Both legacy profiling (`profilesSampleRate`) and UI profiling settings are defined. `profileSessionSampleRate` has no effect when legacy profiling is enabled." ) ;
}
const obj6 = uIProfiler ( closure _1 [ 1 ] ) ;
if ( obj7 . hasLegacyProfiling ( options ) ) {
let result = rootSpan ;
if ( rootSpan ) {
result = uIProfiler ( closure _1 [ 1 ] ) . isAutomatedPageLoadSpan ( rootSpan ) ;
const obj8 = uIProfiler ( closure _1 [ 1 ] ) ;
}
if ( result ) {
result = uIProfiler ( closure _1 [ 1 ] ) . shouldProfileSpanLegacy ( rootSpan ) ;
const obj9 = uIProfiler ( closure _1 [ 1 ] ) ;
}
if ( result ) {
uIProfiler ( closure _1 [ 5 ] ) . startProfileForSpan ( rootSpan ) ;
const obj10 = uIProfiler ( closure _1 [ 5 ] ) ;
}
getOptions . on ( "spanStart" , ( rootSpan ) => {
let result = rootSpan === uIProfiler ( closure _1 [ 3 ] ) . getRootSpan ( rootSpan ) ;
if ( result ) {
result = uIProfiler ( closure _1 [ 1 ] ) . shouldProfileSpanLegacy ( rootSpan ) ;
const obj2 = uIProfiler ( closure _1 [ 1 ] ) ;
}
if ( result ) {
uIProfiler ( closure _1 [ 5 ] ) . startProfileForSpan ( rootSpan ) ;
const obj3 = uIProfiler ( closure _1 [ 5 ] ) ;
}
} ) ;
getOptions . on ( "beforeEnvelope" , ( arg0 ) => {
if ( obj . getActiveProfilesCount ( ) ) {
const result = uIProfiler ( closure _1 [ 1 ] ) . findProfiledTransactionsFromEnvelope ( arg0 ) ;
if ( result . length ) {
const items = [ ] ;
const iter = result [ Symbol . iterator ] ( ) ;
const nextResult = iter . next ( ) ;
while ( iter !== undefined ) {
let tmp61 = nextResult ;
let contexts ;
if ( null != nextResult ) {
let tmp8 = nextResult ;
contexts = tmp61 . contexts ;
}
let tmp10 = contexts ;
let profile _id ;
if ( null != contexts ) {
let tmp12 = contexts ;
let profile = tmp10 . profile ;
if ( null != profile ) {
let tmp14 = profile ;
profile _id = tmp13 . profile _id ;
}
}
let tmp15 = profile _id ;
let tmp16 = contexts ;
if ( null != tmp10 ) {
let tmp17 = contexts ;
let profile2 = tmp10 . profile ;
if ( null != profile2 ) {
let tmp19 = profile2 ;
let start _timestamp = tmp18 . start _timestamp ;
}
}
let tmp21 = profile _id ;
if ( "string" === typeof tmp15 ) {
let tmp27 = profile _id ;
if ( tmp15 ) {
let tmp33 = contexts ;
let tmp34 = null != tmp10 ;
let profile3 = tmp34 ;
if ( tmp34 ) {
let tmp35 = contexts ;
profile3 = tmp10 . profile ;
}
if ( profile3 ) {
let tmp36 = contexts ;
delete r22 . profile ;
}
let tmp37 = uIProfiler ;
let tmp38 = closure _1 ;
let obj3 = uIProfiler ( closure _1 [ 1 ] ) ;
let tmp39 = profile _id ;
let result1 = obj3 . takeProfileFromGlobalCache ( tmp15 ) ;
let tmp42 = uIProfiler ;
let tmp43 = closure _1 ;
if ( result1 ) {
let tmp42Result = tmp42 ( tmp43 [ 1 ] ) ;
let tmp48 = profile _id ;
let tmp49 = start _timestamp ;
let tmp50 = result1 ;
let tmp51 = nextResult ;
let tmp52 = tmp42Result ;
let profilingEvent = tmp42Result . createProfilingEvent ( tmp15 , tmp20 , tmp41 , tmp61 ) ;
if ( profilingEvent ) {
let tmp55 = items ;
let tmp56 = profilingEvent ;
let arr = items . push ( tmp54 ) ;
}
} else if ( tmp42 ( tmp43 [ 2 ] ) . DEBUG _BUILD ) {
let tmp44 = uIProfiler ;
let tmp45 = closure _1 ;
let debug3 = uIProfiler ( closure _1 [ 3 ] ) . debug ;
let tmp46 = profile _id ;
let _HermesInternal = HermesInternal ;
let logResult = debug3 . log ( "[Profiling] Could not retrieve profile for span: " + tmp15 ) ;
}
} else {
let tmp28 = uIProfiler ;
let tmp29 = closure _1 ;
if ( uIProfiler ( closure _1 [ 2 ] ) . DEBUG _BUILD ) {
let tmp30 = uIProfiler ;
let tmp31 = closure _1 ;
let debug2 = uIProfiler ( closure _1 [ 3 ] ) . debug ;
let logResult1 = debug2 . log ( "[Profiling] cannot find profile for a span without a profile context" ) ;
}
}
} else {
let tmp22 = uIProfiler ;
let tmp23 = closure _1 ;
if ( uIProfiler ( closure _1 [ 2 ] ) . DEBUG _BUILD ) {
let tmp24 = uIProfiler ;
let tmp25 = closure _1 ;
let debug = uIProfiler ( closure _1 [ 3 ] ) . debug ;
let logResult2 = debug . log ( "[Profiling] cannot find profile for a span without a profile context" ) ;
}
}
// continue
}
const result2 = uIProfiler ( closure _1 [ 1 ] ) . addProfilesToEnvelope ( arg0 , items ) ;
const obj5 = uIProfiler ( closure _1 [ 1 ] ) ;
}
const obj2 = uIProfiler ( closure _1 [ 1 ] ) ;
}
} ) ;
} else {
const profileLifecycle = options . profileLifecycle ;
getOptions . on ( "startUIProfiler" , ( ) => uIProfiler . start ( ) ) ;
getOptions . on ( "stopUIProfiler" , ( ) => uIProfiler . stop ( ) ) ;
if ( "manual" === profileLifecycle ) {
uIProfiler . initialize ( getOptions ) ;
} else if ( "trace" === profileLifecycle ) {
if ( obj11 . hasSpansEnabled ( options ) ) {
uIProfiler . initialize ( getOptions ) ;
if ( rootSpan ) {
uIProfiler . notifyRootSpanActive ( rootSpan ) ;
}
const WINDOW = uIProfiler ( closure _1 [ 4 ] ) . WINDOW ;
const timerId = WINDOW . setTimeout ( ( ) => {
const activeSpan = uIProfiler ( closure _1 [ 3 ] ) . getActiveSpan ( ) ;
let rootSpan = activeSpan ;
if ( activeSpan ) {
rootSpan = uIProfiler ( closure _1 [ 3 ] ) . getRootSpan ( activeSpan ) ;
const obj2 = uIProfiler ( closure _1 [ 3 ] ) ;
}
if ( rootSpan ) {
uIProfiler . notifyRootSpanActive ( rootSpan ) ;
}
} , 0 ) ;
} else if ( uIProfiler ( closure _1 [ 2 ] ) . DEBUG _BUILD ) {
const debug3 = uIProfiler ( closure _1 [ 3 ] ) . debug ;
debug3 . warn ( "[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing." ) ;
}
const obj11 = uIProfiler ( closure _1 [ 3 ] ) ;
}
}
} ,
processEvent ( contexts ) {
return callback ( closure _1 [ 1 ] ) . attachProfiledThreadToEvent ( contexts ) ;
}
} ;
} ) ;