271 lines
7.0 KiB
JavaScript
271 lines
7.0 KiB
JavaScript
// Metro module 822 (f823).
|
|
import { DEBUG_BUILD } from "./Module823";
|
|
import { debug } from "./consoleSandbox";
|
|
import { isError, isEvent, isInstanceOf, isElement, isPrimitive } from "./isInstanceOf";
|
|
import { htmlTreeAsString } from "./Module828";
|
|
import { HermesBuiltin, $forInKeys } from "../_hermes/prelude";
|
|
function $mk67066($env) {
|
|
return (a0) => {
|
|
let env23844;
|
|
const r3 = $env;
|
|
const r5 = r3[2];
|
|
const r10 = r3[1];
|
|
const r7 = env23844 = {
|
|
$parent: $env.$parent
|
|
};
|
|
env23844[0] = a0;
|
|
env23844[1] = r10;
|
|
env23844[2] = void 0;
|
|
env23844[3] = void 0;
|
|
let r14 = a0;
|
|
if (a0 !== null) {
|
|
r14 = a0;
|
|
if (typeof a0 === "object") {
|
|
r14 = r10.get(a0);
|
|
if (r14 === void 0) {
|
|
if (Array.isArray(a0)) {
|
|
const r28 = [];
|
|
env23844[2] = r28;
|
|
r10.set(a0, r28);
|
|
a0.forEach($mk67066(r7));
|
|
r14 = r28;
|
|
} else {
|
|
const constructor = a0.constructor;
|
|
const r19 = constructor === Object || constructor === void 0;
|
|
r14 = a0;
|
|
if (r19) {
|
|
const r20 = {};
|
|
env23844[3] = r20;
|
|
r10.set(a0, r20);
|
|
Object.keys(a0).forEach($mk67067(r7));
|
|
r14 = r20;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
r5.push(r14);
|
|
};
|
|
}
|
|
function $mk67067($env) {
|
|
return (a0) => {
|
|
const r3 = $env;
|
|
const r9 = r3[0][a0];
|
|
if (r9 !== void 0) {
|
|
let env23845;
|
|
const r13 = r3[3];
|
|
const r10 = r3[1];
|
|
const r7 = env23845 = {
|
|
$parent: $env.$parent
|
|
};
|
|
env23845[0] = r9;
|
|
env23845[1] = r10;
|
|
let r15 = r9;
|
|
if (r9 !== null) {
|
|
r15 = r9;
|
|
if (typeof r15 === "object") {
|
|
r15 = r10.get(r9);
|
|
if (r15 === void 0) {
|
|
if (Array.isArray(r9)) {
|
|
const r29 = [];
|
|
env23845[2] = r29;
|
|
r10.set(r9, r29);
|
|
r9.forEach($mk67066(r7));
|
|
r15 = r29;
|
|
} else {
|
|
const constructor = r9.constructor;
|
|
const r20 = constructor === Object || constructor === void 0;
|
|
r15 = r9;
|
|
if (r20) {
|
|
const r21 = {};
|
|
env23845[3] = r21;
|
|
r10.set(r9, r21);
|
|
Object.keys(r9).forEach($mk67067(r7));
|
|
r15 = r21;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
r13[a0] = r15;
|
|
}
|
|
};
|
|
}
|
|
let markFunctionWrapped, convertToPlainObject, serializeEventTarget;
|
|
let env665 = {};
|
|
export function addNonEnumerableProperty(a0, a1, a2) {
|
|
try {
|
|
Object.defineProperty(a0, a1, {
|
|
value: a2,
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
} catch ($e) {
|
|
if (DEBUG_BUILD) {
|
|
debug.log(`Failed to add non-enumerable property "${a1}" to object`, a0);
|
|
}
|
|
}
|
|
}
|
|
markFunctionWrapped = function markFunctionWrapped(a0, a1) {
|
|
try {
|
|
const prototype = a1.prototype || {};
|
|
a1.prototype = prototype;
|
|
a0.prototype = prototype;
|
|
addNonEnumerableProperty(a0, "__sentry_original__", a1);
|
|
} catch ($e) {}
|
|
};
|
|
convertToPlainObject = function convertToPlainObject(a0) {
|
|
let r26, r32, r48, r52;
|
|
if (isError(a0)) {
|
|
L28: {
|
|
r48 = {
|
|
message: a0.message,
|
|
name: a0.name,
|
|
stack: a0.stack
|
|
};
|
|
if (typeof a0 === "object" && a0 !== null) {
|
|
const r53 = {};
|
|
r52 = r53;
|
|
const r56 = $forInKeys(a0);
|
|
let r57 = 0;
|
|
const length2 = r56.length;
|
|
if (r56 === void 0) {
|
|
break L28;
|
|
}
|
|
while (true) {
|
|
r52 = r53;
|
|
const r59 = r57 < length2 ? r56[r57++] : void 0;
|
|
if (r59 === void 0) {
|
|
break L28;
|
|
}
|
|
if (Object.prototype.hasOwnProperty.call(a0, r59)) {
|
|
r53[r59] = a0[r59];
|
|
}
|
|
}
|
|
}
|
|
r52 = {};
|
|
}
|
|
HermesBuiltin.copyDataProperties(r48, r52);
|
|
return r48;
|
|
}
|
|
if (isEvent(a0)) {
|
|
L13: {
|
|
r26 = {
|
|
type: a0.type,
|
|
target: serializeEventTarget(a0.target),
|
|
currentTarget: serializeEventTarget(a0.currentTarget)
|
|
};
|
|
if (typeof a0 === "object" && a0 !== null) {
|
|
const r13 = {};
|
|
r32 = r13;
|
|
const r12 = $forInKeys(a0);
|
|
let r0 = 0;
|
|
const length = r12.length;
|
|
if (r12 === void 0) {
|
|
break L13;
|
|
}
|
|
while (true) {
|
|
r32 = r13;
|
|
const r9 = r0 < length ? r12[r0++] : void 0;
|
|
if (r9 === void 0) {
|
|
break L13;
|
|
}
|
|
if (Object.prototype.hasOwnProperty.call(a0, r9)) {
|
|
r13[r9] = a0[r9];
|
|
}
|
|
}
|
|
}
|
|
r32 = {};
|
|
}
|
|
HermesBuiltin.copyDataProperties(r26, r32);
|
|
const CustomEvent2 = globalThis.CustomEvent;
|
|
if (typeof CustomEvent2 !== "undefined" ? isInstanceOf(a0, CustomEvent) : typeof CustomEvent2 !== "undefined") {
|
|
r26.detail = a0.detail;
|
|
}
|
|
return r26;
|
|
}
|
|
return a0;
|
|
};
|
|
serializeEventTarget = function serializeEventTarget(a0) {
|
|
let r14;
|
|
try {
|
|
r14 = isElement(a0) ? htmlTreeAsString(a0) : Object.prototype.toString.call(a0);
|
|
} catch ($e) {
|
|
return "<unknown>";
|
|
}
|
|
return r14;
|
|
};
|
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
value: "Module"
|
|
});
|
|
export { convertToPlainObject };
|
|
export function dropUndefinedKeys(a0) {
|
|
let env12495;
|
|
const map = new Map();
|
|
const r4 = env12495 = {
|
|
$parent: env665
|
|
};
|
|
env12495[0] = a0;
|
|
env12495[1] = map;
|
|
env12495[2] = void 0;
|
|
env12495[3] = void 0;
|
|
let r14 = a0;
|
|
if (a0 !== null) {
|
|
r14 = a0;
|
|
if (typeof a0 === "object") {
|
|
r14 = map.get(a0);
|
|
if (r14 === void 0) {
|
|
if (Array.isArray(a0)) {
|
|
const r29 = [];
|
|
env12495[2] = r29;
|
|
map.set(a0, r29);
|
|
a0.forEach($mk67066(r4));
|
|
r14 = r29;
|
|
} else {
|
|
const constructor = a0.constructor;
|
|
const r20 = constructor === Object || constructor === void 0;
|
|
r14 = a0;
|
|
if (r20) {
|
|
const r21 = {};
|
|
env12495[3] = r21;
|
|
map.set(a0, r21);
|
|
Object.keys(a0).forEach($mk67067(r4));
|
|
r14 = r21;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return r14;
|
|
}
|
|
export function extractExceptionKeysForMessage(a0) {
|
|
const r8 = Object.keys(convertToPlainObject(a0));
|
|
r8.sort();
|
|
return r8[0] ? r8.join(", ") : "[object has no keys]";
|
|
}
|
|
export function fill(a0, a1, a2) {
|
|
if (a1 in a0) {
|
|
const r5 = a0[a1];
|
|
if (typeof r5 === "function") {
|
|
const r8 = a2(r5);
|
|
if (typeof r8 === "function") {
|
|
markFunctionWrapped(r8, r5);
|
|
}
|
|
try {
|
|
a0[a1] = r8;
|
|
} catch ($e) {
|
|
if (DEBUG_BUILD) {
|
|
debug.log(`Failed to replace method "${a1}" in object`, a0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
export function getOriginalFunction(a0) {
|
|
return a0.__sentry_original__;
|
|
}
|
|
export { markFunctionWrapped };
|
|
export function objectify(a0) {
|
|
return a0 == null === true ? new String(a0) : (typeof a0 !== "symbol" ? typeof a0 === "bigint" : typeof a0 === "symbol") === true ? Object(a0) : isPrimitive(a0) === true ? new a0.constructor(a0) : a0;
|
|
}
|