// Metro module 1129 (f1130). import { isExpoGo, notMobileOs } from "./Module1002"; import { debug } from "./Module817"; import { NATIVE } from "./Module1001"; import { isHardCrash } from "./Module1013"; import { hasHooks } from "./Module1130"; import { enrichXhrBreadcrumbsForMobileReplay } from "./Module1131"; function $mk117634($env) { return function(a0) { a0($env[0]); }; } let name, options, mobileReplayIntegrationNoop; let c937_2 = (this ? this.__awaiter : this) || function(c12822_0, c12822_1, a2, c12822_3) { let r2 = a2; let Promise2 = a2; if (!a2) { Promise2 = Promise; r2 = Promise2; } return new r2(function(a0, c24227_1) { let rejected2, step2; let c24227_0 = a0; const fulfilled2 = function fulfilled(a0) { try { step2(c12822_3.next(a0)); } catch ($e) { c24227_1($e); } }; rejected2 = function rejected(a0) { try { step2(c12822_3.throw(a0)); } catch ($e) { c24227_1($e); } }; step2 = function step(a0) { if (a0.done) { c24227_0(a0.value); } else { let env28830; let value2 = a0.value; const r10 = env28830 = {}; env28830[0] = value2; if (!(value2 instanceof Promise2)) { value2 = new Promise2($mk117634(r10)); } value2.then(fulfilled2, rejected2); } }; const r16 = c12822_3.apply(c12822_0, c12822_1 || []); c12822_3 = r16; const r18 = r16.next(); const { done, value: value2 } = r18; if (done) { a0(value2); } else { let env24228; const r21 = env24228 = {}; env24228[0] = value2; (value2 instanceof Promise2 ? value2 : new Promise2($mk117634(r21))).then(fulfilled2, rejected2); } }); }; name = "MobileReplay"; options = { maskAllText: true, maskAllImages: true, maskAllVectors: true, enableExperimentalViewRenderer: false, enableViewRendererV2: true, enableFastViewRendering: false, screenshotStrategy: "pixelCopy" }; mobileReplayIntegrationNoop = () => {}; export const MOBILE_REPLAY_INTEGRATION_NAME = "MobileReplay"; export const mobileReplayIntegration = function(r3 = options) { let currentReplayId; let c12823_0 = r3; currentReplayId = void 0; const updateCachedReplayId2 = function updateCachedReplayId(a0) { currentReplayId = a0; }; if (isExpoGo()) { debug.warn(`[Sentry] ${name} is not supported in Expo Go. Use EAS Build or \`expo prebuild\` to enable it.`); } if (notMobileOs()) { debug.warn(`[Sentry] ${name} is not supported on this platform.`); } if (!isExpoGo() && !notMobileOs()) { const options2 = { ...options, ...r3 }; if (r3.enableViewRendererV2 === void 0 && r3.enableExperimentalViewRenderer !== void 0) { options2.enableViewRendererV2 = r3.enableExperimentalViewRenderer; } currentReplayId = null; return { name, setup: function setup(a0) { if (hasHooks(a0)) { currentReplayId = NATIVE.getCurrentReplayId(); a0.on("createDsc", (a0) => { if (!a0.replay_id) { let replay_id = currentReplayId; if (replay_id === null) { const currentReplayId2 = NATIVE.getCurrentReplayId(); replay_id = currentReplayId2; if (currentReplayId2) { currentReplayId = currentReplayId2; replay_id = currentReplayId2; } } if (replay_id) { a0.replay_id = replay_id; } } }); a0.on("processMetric", (a0) => { let replay_id = currentReplayId; if (replay_id === null) { const currentReplayId2 = NATIVE.getCurrentReplayId(); replay_id = currentReplayId2; if (currentReplayId2) { currentReplayId = currentReplayId2; replay_id = currentReplayId2; } } if (replay_id) { a0.attributes = a0.attributes || {}; a0.attributes.replay_id = replay_id; } }); a0.on("beforeAddBreadcrumb", enrichXhrBreadcrumbsForMobileReplay); } }, processEvent: async function processEvent(value, c24229_1) { let r202; let c28831_2; let c28831_3 = 0; let c31216_0, c31216_1, c31216_2; const r19 = " not sent; beforeErrorSampling conditions not met for event "; let r14 = " beforeErrorSampling callback threw an error, proceeding with replay capture"; L30: { L25: { L17: { try { c31216_0 = void 0; c31216_1 = void 0; const exception = value.exception; if (!(exception !== null ? exception !== void 0 ? exception.values : void 0 : void 0)) { break L30; } if (value.exception.values.length > 0) { if (c12823_0.beforeErrorSampling) { c28831_3 = 1; if (c12823_0.beforeErrorSampling(value, c24229_1) === false) { debug.log(`[Sentry] ${name}${r19}${value.event_id}.`); c28831_3 = 0; break L17; } c28831_3 = 0; } const r98 = await NATIVE.captureReplay(isHardCrash(value)); r14 = " beforeErrorSampling callback threw an error, proceeding with replay capture"; c31216_0 = r98; if (c31216_0) { (0, updateCachedReplayId2)(c31216_0); debug.log(`[Sentry] ${name} Captured recording replay ${c31216_0} for event ${value.event_id}.`); value.contexts = value.contexts || {}; value.contexts.replay = { ...value.contexts.replay, replay_id: c31216_0 }; } else { c31216_1 = NATIVE.getCurrentReplayId(); if (c31216_1) { (0, updateCachedReplayId2)(c31216_1); debug.log(`[Sentry] ${name} assign already recording replay ${c31216_1} for event ${value.event_id}.`); value.contexts = value.contexts || {}; value.contexts.replay = { ...value.contexts.replay, replay_id: c31216_1 }; } else { (0, updateCachedReplayId2)(null); debug.log(`[Sentry] ${name} not sampled for event ${value.event_id}.`); } } r202 = value; break L25; } break L30; } catch ($e) { const r48 = $e; let r8 = r48; c28831_2 = r48; if (c28831_3 !== 0) { while (true) { try { const r240 = c28831_2; c28831_3 = 0; c31216_2 = r240; debug.error(`[Sentry] ${name}${r14}`, c31216_2); const r276 = await NATIVE.captureReplay(isHardCrash(value)); r14 = " beforeErrorSampling callback threw an error, proceeding with replay capture"; c31216_0 = r276; if (c31216_0) { (0, updateCachedReplayId2)(c31216_0); debug.log(`[Sentry] ${name} Captured recording replay ${c31216_0} for event ${value.event_id}.`); value.contexts = value.contexts || {}; value.contexts.replay = { ...value.contexts.replay, replay_id: c31216_0 }; } else { c31216_1 = NATIVE.getCurrentReplayId(); if (c31216_1) { (0, updateCachedReplayId2)(c31216_1); debug.log(`[Sentry] ${name} assign already recording replay ${c31216_1} for event ${value.event_id}.`); value.contexts = value.contexts || {}; value.contexts.replay = { ...value.contexts.replay, replay_id: c31216_1 }; } else { (0, updateCachedReplayId2)(null); debug.log(`[Sentry] ${name} not sampled for event ${value.event_id}.`); } } r202 = value; break L25; } catch (r236) { r8 = r236; c28831_2 = r236; if (c28831_3 === 0) { break; } } } } throw r8; } } return value; } return r202; } return value; }, options: options2, getReplayId: function getReplayId() { let r1 = currentReplayId; if (r1 === null) { const currentReplayId2 = NATIVE.getCurrentReplayId(); r1 = currentReplayId2; if (currentReplayId2) { currentReplayId = currentReplayId2; r1 = currentReplayId2; } } return r1; } }; } return { name, options, getReplayId: () => null }; };