// Metro module 1061 (f1062). import { msToSec, startStandaloneWebVitalSpan, supportsWebVital, listenForWebVitalReportEvents } from "./Module1059"; import { addLcpInstrumentationHandler } from "./triggerHandlers"; import { DEBUG_BUILD } from "./Module1035"; import { debug, browserPerformanceTimeOrigin, getCurrentScope, htmlTreeAsString, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE } from "./Module817"; const _sendStandaloneLcpSpan = function _sendStandaloneLcpSpan(value, a1, a2, a3) { if (DEBUG_BUILD) { debug.log(`Sending LCP span (${value})`); } const startTime = msToSec((browserPerformanceTimeOrigin() || 0) + (a1?.startTime || 0)); const transactionName = getCurrentScope().getScopeData().transactionName; const name = a1 ? htmlTreeAsString(a1.element) : "Largest contentful paint"; const attributes = {}; attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = "auto.http.browser.lcp"; attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = "ui.webvital.lcp"; attributes[SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME] = 0; attributes["sentry.pageload.span_id"] = a2; attributes["sentry.report_event"] = a3; if (a1) { if (a1.element) { attributes["lcp.element"] = htmlTreeAsString(a1.element); } if (a1.id) { attributes["lcp.id"] = a1.id; } if (a1.url) { attributes["lcp.url"] = a1.url; } if (a1.loadTime != null) { attributes["lcp.loadTime"] = a1.loadTime; } if (a1.renderTime != null) { attributes["lcp.renderTime"] = a1.renderTime; } if (a1.size != null) { attributes["lcp.size"] = a1.size; } } const r79 = startStandaloneWebVitalSpan({ name, transaction: transactionName, attributes, startTime }); if (r79) { const r81 = {}; r81[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT] = "millisecond"; r81[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE] = value; r79.addEvent("lcp", r81); r79.end(startTime); } }; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); export { _sendStandaloneLcpSpan }; export function trackLcpAsStandaloneSpan(a0) { let c12694_0, c12694_2; const value = 0; if (supportsWebVital("largest-contentful-paint")) { c12694_2 = addLcpInstrumentationHandler(({ metric }) => { const r8 = metric.entries[metric.entries.length - 1]; if (r8) { value = metric.value; c12694_0 = r8; } }, true); listenForWebVitalReportEvents(a0, (a0, a1) => { _sendStandaloneLcpSpan(value, c12694_0, a1, a0); c12694_2(); }); } }