// Metro module 6445 (f6446). import { isInstanceOf } from "./isInstanceOf_6375"; import { truncate } from "./Module6377"; const aggregateExceptionsFromError = function aggregateExceptionsFromError(a0, a1, a2, originalException, a4, values, a6, a7) { const exception_id = a7; if (values.length >= a2 + 1) { return values; } let c15738_6 = [...values]; if (isInstanceOf(originalException[a4], Error)) { a6.mechanism = a6.mechanism || { type: "generic", handled: true }; a6.mechanism = { ...a6.mechanism, ...a6.type === "AggregateError" && { is_exception_group: true }, exception_id: a7 }; const r46 = a0(a1, originalException[a4]); const length = c15738_6.length; r46.mechanism = r46.mechanism || { type: "generic", handled: true }; r46.mechanism = { ...r46.mechanism, type: "chained", source: a4, exception_id: length, parent_id: a7 }; c15738_6 = aggregateExceptionsFromError(a0, a1, a2, originalException[a4], a4, [r46, ...c15738_6], r46, length); } if (Array.isArray(originalException.errors)) { originalException.errors.forEach((error, index) => { if (isInstanceOf(error, Error)) { a6.mechanism = a6.mechanism || { type: "generic", handled: true }; a6.mechanism = { ...a6.mechanism, ...a6.type === "AggregateError" && { is_exception_group: true }, exception_id }; const r37 = a0(a1, error); const length = c15738_6.length; const source = `errors[${index}]`; r37.mechanism = r37.mechanism || { type: "generic", handled: true }; r37.mechanism = { ...r37.mechanism, type: "chained", source, exception_id: length, parent_id: exception_id }; c15738_6 = aggregateExceptionsFromError(a0, a1, a2, error, a4, [r37, ...c15738_6], r37, length); } }); } return c15738_6; }; export function applyAggregateErrorsToEvent(a0, a1, r6 = 250) { const r4 = arguments[5]; if (r4.exception && r4.exception.values) { const r7 = arguments[6]; if (r7 && isInstanceOf(r7.originalException, Error)) { const r13 = r4.exception.values.length > 0 ? r4.exception.values[r4.exception.values.length - 1] : void 0; if (r13) { const r17 = arguments[3]; const r19 = arguments[4]; const exception = r4.exception; const r43 = aggregateExceptionsFromError(a0, a1, r19, r7.originalException, r17, r4.exception.values, r13, 0); let c15739_0 = r6; exception.values = r43.map((item) => { if (item.value) { item.value = truncate(item.value, c15739_0); } return item; }); } } } }