2026-07-20 16:05:17 +00:00
// Module ID: 1075
2026-07-24 07:16:23 +00:00
// Function ID: 12352
2026-07-20 16:05:17 +00:00
// Name: browserProfilingIntegration
2026-07-23 10:11:24 +00:00
// Dependencies: [1076, 1077, 1048, 794, 1004, 1078]
2026-07-20 16:05:17 +00:00
// Module 1075 (browserProfilingIntegration)
2026-07-23 10:11:24 +00:00
import registerSpanErrorInstrumentation from "registerSpanErrorInstrumentation" ;
2026-07-20 16:05:17 +00:00
Object . defineProperty ( exports , Symbol . toStringTag , { value : "Module" } ) ;
2026-07-23 10:11:24 +00:00
export const browserProfilingIntegration = registerSpanErrorInstrumentation . defineIntegration ( function _browserProfilingIntegration ( ) {
2026-07-20 16:05:17 +00:00
return {
name : "BrowserProfiling" ,
setup ( getOptions ) {
const options = getOptions . getOptions ( ) ;
2026-07-23 10:11:24 +00:00
const uIProfiler = new outer1 _0 ( outer1 _1 [ 0 ] ) . UIProfiler ( ) ;
let obj2 = outer1 _0 ( outer1 _1 [ 1 ] ) ;
2026-07-20 16:05:17 +00:00
if ( ! tmp2 ) {
options . profileLifecycle = "manual" ;
}
2026-07-23 10:11:24 +00:00
tmp2 = outer1 _0 ( outer1 _1 [ 1 ] ) . hasLegacyProfiling ( options ) || options . profileLifecycle ;
2026-07-20 16:05:17 +00:00
if ( obj3 . hasLegacyProfiling ( options ) ) {
if ( ! options . profilesSampleRate ) {
2026-07-23 10:11:24 +00:00
if ( outer1 _0 ( outer1 _1 [ 2 ] ) . DEBUG _BUILD ) {
let debug = outer1 _0 ( outer1 _1 [ 3 ] ) . debug ;
2026-07-20 16:05:17 +00:00
debug . log ( "[Profiling] Profiling disabled, no profiling options found." ) ;
}
}
}
2026-07-23 10:11:24 +00:00
obj3 = outer1 _0 ( outer1 _1 [ 1 ] ) ;
let activeSpan = outer1 _0 ( outer1 _1 [ 3 ] ) . getActiveSpan ( ) ;
2026-07-20 16:05:17 +00:00
let rootSpan = activeSpan ;
if ( activeSpan ) {
2026-07-23 10:11:24 +00:00
rootSpan = outer1 _0 ( outer1 _1 [ 3 ] ) . getRootSpan ( activeSpan ) ;
let obj5 = outer1 _0 ( outer1 _1 [ 3 ] ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const obj4 = outer1 _0 ( outer1 _1 [ 3 ] ) ;
let DEBUG _BUILD = outer1 _0 ( outer1 _1 [ 1 ] ) . hasLegacyProfiling ( options ) && undefined !== options . profileSessionSampleRate ;
2026-07-20 16:05:17 +00:00
if ( DEBUG _BUILD ) {
2026-07-23 10:11:24 +00:00
DEBUG _BUILD = outer1 _0 ( outer1 _1 [ 2 ] ) . DEBUG _BUILD ;
2026-07-20 16:05:17 +00:00
}
if ( DEBUG _BUILD ) {
2026-07-23 10:11:24 +00:00
let debug2 = outer1 _0 ( outer1 _1 [ 3 ] ) . debug ;
2026-07-20 16:05:17 +00:00
debug2 . warn ( "[Profiling] Both legacy profiling (`profilesSampleRate`) and UI profiling settings are defined. `profileSessionSampleRate` has no effect when legacy profiling is enabled." ) ;
}
2026-07-23 10:11:24 +00:00
const obj6 = outer1 _0 ( outer1 _1 [ 1 ] ) ;
2026-07-20 16:05:17 +00:00
if ( obj7 . hasLegacyProfiling ( options ) ) {
let result = rootSpan ;
if ( rootSpan ) {
2026-07-23 10:11:24 +00:00
result = outer1 _0 ( outer1 _1 [ 1 ] ) . isAutomatedPageLoadSpan ( rootSpan ) ;
const obj8 = outer1 _0 ( outer1 _1 [ 1 ] ) ;
2026-07-20 16:05:17 +00:00
}
if ( result ) {
2026-07-23 10:11:24 +00:00
result = outer1 _0 ( outer1 _1 [ 1 ] ) . shouldProfileSpanLegacy ( rootSpan ) ;
const obj9 = outer1 _0 ( outer1 _1 [ 1 ] ) ;
2026-07-20 16:05:17 +00:00
}
if ( result ) {
2026-07-23 10:11:24 +00:00
outer1 _0 ( outer1 _1 [ 5 ] ) . startProfileForSpan ( rootSpan ) ;
const obj10 = outer1 _0 ( outer1 _1 [ 5 ] ) ;
2026-07-20 16:05:17 +00:00
}
getOptions . on ( "spanStart" , ( rootSpan ) => {
2026-07-23 10:11:24 +00:00
let result = rootSpan === outer2 _0 ( outer2 _1 [ 3 ] ) . getRootSpan ( rootSpan ) ;
2026-07-20 16:05:17 +00:00
if ( result ) {
2026-07-23 10:11:24 +00:00
result = outer2 _0 ( outer2 _1 [ 1 ] ) . shouldProfileSpanLegacy ( rootSpan ) ;
const obj2 = outer2 _0 ( outer2 _1 [ 1 ] ) ;
2026-07-20 16:05:17 +00:00
}
if ( result ) {
2026-07-23 10:11:24 +00:00
outer2 _0 ( outer2 _1 [ 5 ] ) . startProfileForSpan ( rootSpan ) ;
const obj3 = outer2 _0 ( outer2 _1 [ 5 ] ) ;
2026-07-20 16:05:17 +00:00
}
} ) ;
getOptions . on ( "beforeEnvelope" , ( arg0 ) => {
if ( obj . getActiveProfilesCount ( ) ) {
2026-07-23 10:11:24 +00:00
const result = outer2 _0 ( outer2 _1 [ 1 ] ) . findProfiledTransactionsFromEnvelope ( arg0 ) ;
2026-07-20 16:05:17 +00:00
if ( result . length ) {
const items = [ ] ;
const iter = result [ Symbol . iterator ] ( ) ;
const nextResult = iter . next ( ) ;
while ( iter !== undefined ) {
2026-07-23 10:11:24 +00:00
let tmp62 = nextResult ;
2026-07-20 16:05:17 +00:00
let contexts ;
if ( null != nextResult ) {
2026-07-23 10:11:24 +00:00
let tmp9 = nextResult ;
contexts = tmp62 . contexts ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let tmp11 = contexts ;
2026-07-20 16:05:17 +00:00
let profile _id ;
if ( null != contexts ) {
2026-07-23 10:11:24 +00:00
let tmp13 = contexts ;
let profile = tmp11 . profile ;
2026-07-20 16:05:17 +00:00
if ( null != profile ) {
2026-07-23 10:11:24 +00:00
let tmp15 = profile ;
profile _id = tmp14 . profile _id ;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
let tmp16 = profile _id ;
let tmp17 = contexts ;
if ( null != tmp11 ) {
let tmp18 = contexts ;
let profile2 = tmp11 . profile ;
2026-07-20 16:05:17 +00:00
if ( null != profile2 ) {
2026-07-23 10:11:24 +00:00
let tmp20 = profile2 ;
let start _timestamp = tmp19 . start _timestamp ;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
let tmp22 = profile _id ;
if ( "string" === typeof tmp16 ) {
let tmp28 = profile _id ;
if ( tmp16 ) {
let tmp34 = contexts ;
let tmp35 = null != tmp11 ;
let profile3 = tmp35 ;
if ( tmp35 ) {
let tmp36 = contexts ;
profile3 = tmp11 . profile ;
2026-07-20 16:05:17 +00:00
}
if ( profile3 ) {
2026-07-23 10:11:24 +00:00
let tmp37 = contexts ;
delete tmp . profile ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let tmp38 = outer2 _0 ;
let tmp39 = outer2 _1 ;
let obj3 = outer2 _0 ( outer2 _1 [ 1 ] ) ;
let tmp40 = profile _id ;
let result1 = obj3 . takeProfileFromGlobalCache ( tmp16 ) ;
let tmp43 = outer2 _0 ;
let tmp44 = outer2 _1 ;
2026-07-20 16:05:17 +00:00
if ( result1 ) {
2026-07-23 10:11:24 +00:00
let tmp43Result = tmp43 ( tmp44 [ 1 ] ) ;
let tmp49 = profile _id ;
let tmp50 = start _timestamp ;
let tmp51 = result1 ;
let tmp52 = nextResult ;
let tmp53 = tmp43Result ;
let profilingEvent = tmp43Result . createProfilingEvent ( tmp16 , tmp21 , tmp42 , tmp62 ) ;
2026-07-20 16:05:17 +00:00
if ( profilingEvent ) {
2026-07-23 10:11:24 +00:00
let tmp56 = items ;
let tmp57 = profilingEvent ;
let arr = items . push ( tmp55 ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
} else if ( tmp43 ( tmp44 [ 2 ] ) . DEBUG _BUILD ) {
let tmp45 = outer2 _0 ;
let tmp46 = outer2 _1 ;
let debug3 = outer2 _0 ( outer2 _1 [ 3 ] ) . debug ;
let tmp47 = profile _id ;
2026-07-20 16:05:17 +00:00
let _HermesInternal = HermesInternal ;
2026-07-23 10:11:24 +00:00
let logResult = debug3 . log ( "[Profiling] Could not retrieve profile for span: " + tmp16 ) ;
2026-07-20 16:05:17 +00:00
}
} else {
2026-07-23 10:11:24 +00:00
let tmp29 = outer2 _0 ;
let tmp30 = outer2 _1 ;
if ( outer2 _0 ( outer2 _1 [ 2 ] ) . DEBUG _BUILD ) {
let tmp31 = outer2 _0 ;
let tmp32 = outer2 _1 ;
let debug2 = outer2 _0 ( outer2 _1 [ 3 ] ) . debug ;
2026-07-20 16:05:17 +00:00
let logResult1 = debug2 . log ( "[Profiling] cannot find profile for a span without a profile context" ) ;
}
}
} else {
2026-07-23 10:11:24 +00:00
let tmp23 = outer2 _0 ;
let tmp24 = outer2 _1 ;
if ( outer2 _0 ( outer2 _1 [ 2 ] ) . DEBUG _BUILD ) {
let tmp25 = outer2 _0 ;
let tmp26 = outer2 _1 ;
let debug = outer2 _0 ( outer2 _1 [ 3 ] ) . debug ;
2026-07-20 16:05:17 +00:00
let logResult2 = debug . log ( "[Profiling] cannot find profile for a span without a profile context" ) ;
}
}
2026-07-23 10:11:24 +00:00
continue ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const result2 = outer2 _0 ( outer2 _1 [ 1 ] ) . addProfilesToEnvelope ( arg0 , items ) ;
const obj5 = outer2 _0 ( outer2 _1 [ 1 ] ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const obj2 = outer2 _0 ( outer2 _1 [ 1 ] ) ;
2026-07-20 16:05:17 +00:00
}
} ) ;
} 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 ) ;
}
2026-07-23 10:11:24 +00:00
const WINDOW = outer1 _0 ( outer1 _1 [ 4 ] ) . WINDOW ;
2026-07-20 16:05:17 +00:00
const timerId = WINDOW . setTimeout ( ( ) => {
2026-07-23 10:11:24 +00:00
const activeSpan = outer2 _0 ( outer2 _1 [ 3 ] ) . getActiveSpan ( ) ;
2026-07-20 16:05:17 +00:00
let rootSpan = activeSpan ;
if ( activeSpan ) {
2026-07-23 10:11:24 +00:00
rootSpan = outer2 _0 ( outer2 _1 [ 3 ] ) . getRootSpan ( activeSpan ) ;
const obj2 = outer2 _0 ( outer2 _1 [ 3 ] ) ;
2026-07-20 16:05:17 +00:00
}
if ( rootSpan ) {
uIProfiler . notifyRootSpanActive ( rootSpan ) ;
}
} , 0 ) ;
2026-07-23 10:11:24 +00:00
} else if ( outer1 _0 ( outer1 _1 [ 2 ] ) . DEBUG _BUILD ) {
let debug3 = outer1 _0 ( outer1 _1 [ 3 ] ) . debug ;
2026-07-20 16:05:17 +00:00
debug3 . warn ( "[Profiling] `profileLifecycle` is 'trace' but tracing is disabled. Set a `tracesSampleRate` or `tracesSampler` to enable span tracing." ) ;
}
2026-07-23 10:11:24 +00:00
obj11 = outer1 _0 ( outer1 _1 [ 3 ] ) ;
2026-07-20 16:05:17 +00:00
}
}
} ,
processEvent ( contexts ) {
2026-07-23 10:11:24 +00:00
return outer1 _0 ( outer1 _1 [ 1 ] ) . attachProfiledThreadToEvent ( contexts ) ;
2026-07-20 16:05:17 +00:00
}
} ;
} ) ;