Files
discord-decomp/_bundle/callGuardDEV.js
T
2026-11-01 12:12:55 +02:00

240 lines
9.2 KiB
JavaScript

// Metro module 1608 (f1609).
import * as _Module1609 from "./Module1609";
import { isJest, isChromeDebugger, isWeb } from "./Module1609";
import * as _Module1610 from "./Module1610";
import { registerLoggerConfig, DEFAULT_LOGGER_CONFIG } from "./Module1610";
import * as _runWorkletOnJS from "./runWorkletOnJS";
import { executeOnUIRuntimeSync, runOnUIImmediately } from "./runWorkletOnJS";
import * as _Module1617 from "./Module1617";
import { registerReanimatedError } from "./Module1617";
import { mockedRequestAnimationFrame } from "./Module1621";
function $mk102350($env) {
return function e(a0) {
_runWorkletOnJS.runOnJS(_Module1610.logToLogBoxAndConsole)(a0);
};
}
function $mk102351($env) {
return (a0) => {
_runWorkletOnJS.runOnJS(_Module1617.reportFatalErrorOnJS)({
message: a0.message,
stack: a0.stack
});
};
}
function $mk102353($env) {
return (c28913_0) => {
const r4 = $env;
const r3 = r4[1];
r4[1] = [];
r3.forEach((item) => item(c28913_0));
const r9 = $env.$parent;
(0, r9[1])(r9[2][2]).callMicrotasks();
};
}
function $mk102354($env) {
return (a0) => {
const r2 = $env;
r2[1].push(a0);
if (!r2[2]) {
r2[2] = true;
(0, r2[0])($mk113823(r2));
}
return -1;
};
}
function $mk113823($env) {
return (a0) => {
$env[2] = false;
const r5 = $env.$parent[0];
r5.__frameTimestamp = a0;
r5.__flushAnimationFrame(a0);
r5.__frameTimestamp = void 0;
};
}
let callGuardDEV, setupCallGuard, c1276_9, setupConsole, setupRequestAnimationFrame, c1276_12;
let env1276;
const r3 = env1276 = {};
const c1276_3 = isJest();
const shouldBeUseWeb = _Module1609.shouldBeUseWeb();
const c1276_4 = shouldBeUseWeb;
const c1276_5 = isChromeDebugger();
const __initData = {
code: "function pnpm_initializersTs2(data){const{runOnJS,logToLogBoxAndConsole}=this.__closure;runOnJS(logToLogBoxAndConsole)(data);}"
};
const c1276_6 = __initData;
const overrideLogFunctionImplementation = function overrideLogFunctionImplementation() {
const r10 = $mk102350(env1276);
r10.__closure = {
runOnJS: _runWorkletOnJS.runOnJS,
logToLogBoxAndConsole: _Module1610.logToLogBoxAndConsole
};
r10.__workletHash = 10834450741065;
r10.__initData = c1276_6;
_Module1610.replaceLoggerImplementation(r10);
};
overrideLogFunctionImplementation.__closure = {
replaceLoggerImplementation: _Module1610.replaceLoggerImplementation,
runOnJS: _runWorkletOnJS.runOnJS,
logToLogBoxAndConsole: _Module1610.logToLogBoxAndConsole
};
overrideLogFunctionImplementation.__workletHash = 17079079828449;
overrideLogFunctionImplementation.__initData = {
code: "function overrideLogFunctionImplementation_Pnpm_initializersTs1(){const{replaceLoggerImplementation,runOnJS,logToLogBoxAndConsole}=this.__closure;replaceLoggerImplementation(function(data){'worklet';runOnJS(logToLogBoxAndConsole)(data);});}"
};
registerLoggerConfig(DEFAULT_LOGGER_CONFIG);
const r51 = $mk102350(r3);
r51.__closure = {
runOnJS: _runWorkletOnJS.runOnJS,
logToLogBoxAndConsole: _Module1610.logToLogBoxAndConsole
};
r51.__workletHash = 10834450741065;
r51.__initData = __initData;
_Module1610.replaceLoggerImplementation(r51);
if (shouldBeUseWeb) {
global._WORKLET = false;
global._log = console.log;
global._getAnimationTimestamp = () => performance.now();
} else {
executeOnUIRuntimeSync(registerReanimatedError)();
executeOnUIRuntimeSync(registerLoggerConfig)(DEFAULT_LOGGER_CONFIG);
executeOnUIRuntimeSync(overrideLogFunctionImplementation)();
}
const callGuardDEV2 = function callGuardDEV(a0, ...args) {
let r11;
try {
r11 = a0.apply(void 0, [...args]);
} catch (r12) {
if (global.__ErrorUtils) {
global.__ErrorUtils.reportFatalError(r12);
return void 0;
}
throw r12;
}
return r11;
};
callGuardDEV2.__closure = {};
callGuardDEV2.__workletHash = 4198243943606;
callGuardDEV2.__initData = {
code: "function callGuardDEV_Pnpm_initializersTs3(fn,...args){try{return fn(...args);}catch(e){if(global.__ErrorUtils){global.__ErrorUtils.reportFatalError(e);}else{throw e;}}}"
};
callGuardDEV = callGuardDEV2;
const setupCallGuard2 = function setupCallGuard() {
const r3 = env1276;
global.__callGuardDEV = callGuardDEV;
global.__ErrorUtils = {
reportFatalError: $mk102351(r3)
};
};
setupCallGuard2.__closure = {
callGuardDEV: callGuardDEV2,
runOnJS: _runWorkletOnJS.runOnJS,
reportFatalErrorOnJS: _Module1617.reportFatalErrorOnJS
};
setupCallGuard2.__workletHash = 14948004486848;
setupCallGuard2.__initData = {
code: "function setupCallGuard_Pnpm_initializersTs4(){const{callGuardDEV,runOnJS,reportFatalErrorOnJS}=this.__closure;global.__callGuardDEV=callGuardDEV;global.__ErrorUtils={reportFatalError:function(error){runOnJS(reportFatalErrorOnJS)({message:error.message,stack:error.stack});}};}"
};
setupCallGuard = setupCallGuard2;
c1276_9 = Object.fromEntries(Object.entries(console).map((item) => {
let [r25, c24473_0] = item;
const methodWrapper = function methodWrapper() {
return c24473_0.apply(void 0, [...Array.prototype.slice.call(arguments, 0)]);
};
if (c24473_0.name) {
Object.defineProperty(methodWrapper, "name", {
value: c24473_0.name,
writable: false
});
}
return [r25, methodWrapper];
}));
const setupConsole2 = function setupConsole() {
if (!c1276_5) {
global.console = {
assert: _runWorkletOnJS.runOnJS(c1276_9.assert),
debug: _runWorkletOnJS.runOnJS(c1276_9.debug),
log: _runWorkletOnJS.runOnJS(c1276_9.log),
warn: _runWorkletOnJS.runOnJS(c1276_9.warn),
error: _runWorkletOnJS.runOnJS(c1276_9.error),
info: _runWorkletOnJS.runOnJS(c1276_9.info)
};
}
};
setupConsole2.__closure = {
IS_CHROME_DEBUGGER: c1276_5,
runOnJS: _runWorkletOnJS.runOnJS,
capturableConsole: c1276_9
};
setupConsole2.__workletHash = 1380126086828;
setupConsole2.__initData = {
code: "function setupConsole_Pnpm_initializersTs5(){const{IS_CHROME_DEBUGGER,runOnJS,capturableConsole}=this.__closure;if(!IS_CHROME_DEBUGGER){global.console={assert:runOnJS(capturableConsole.assert),debug:runOnJS(capturableConsole.debug),log:runOnJS(capturableConsole.log),warn:runOnJS(capturableConsole.warn),error:runOnJS(capturableConsole.error),info:runOnJS(capturableConsole.info)};}}"
};
setupConsole = setupConsole2;
const setupRequestAnimationFrame2 = function setupRequestAnimationFrame() {
let env24474;
const r1 = env24474 = {
$parent: env1276
};
env24474[0] = global.requestAnimationFrame;
env24474[1] = [];
env24474[2] = false;
global.__flushAnimationFrame = $mk102353(r1);
global.requestAnimationFrame = $mk102354(r1);
};
setupRequestAnimationFrame2.__closure = {
callMicrotasks: _runWorkletOnJS.callMicrotasks
};
setupRequestAnimationFrame2.__workletHash = 14722266205784;
setupRequestAnimationFrame2.__initData = {
code: "function setupRequestAnimationFrame_Pnpm_initializersTs6(){const{callMicrotasks}=this.__closure;const nativeRequestAnimationFrame=global.requestAnimationFrame;let animationFrameCallbacks=[];let flushRequested=false;global.__flushAnimationFrame=function(frameTimestamp){const currentCallbacks=animationFrameCallbacks;animationFrameCallbacks=[];currentCallbacks.forEach(function(f){return f(frameTimestamp);});callMicrotasks();};global.requestAnimationFrame=function(callback){animationFrameCallbacks.push(callback);if(!flushRequested){flushRequested=true;nativeRequestAnimationFrame(function(timestamp){flushRequested=false;global.__frameTimestamp=timestamp;global.__flushAnimationFrame(timestamp);global.__frameTimestamp=undefined;});}return-1;};}"
};
setupRequestAnimationFrame = setupRequestAnimationFrame2;
c1276_12 = {
code: "function pnpm_initializersTs7(){const{setupCallGuard,setupConsole,SHOULD_BE_USE_WEB,setupMicrotasks,setupRequestAnimationFrame}=this.__closure;setupCallGuard();setupConsole();if(!SHOULD_BE_USE_WEB){setupMicrotasks();setupRequestAnimationFrame();}global.lastUpdateFrameTimeByTag={};global.lastUpdateByTag={};}"
};
export { callGuardDEV2 as callGuardDEV };
export { setupCallGuard2 as setupCallGuard };
export { setupConsole2 as setupConsole };
export function initializeUIRuntime(a0) {
if (!isWeb()) {
if (!a0) {
throw new Error("[Reanimated] Reanimated is trying to initialize the UI runtime without a valid ReanimatedModule");
}
if (c1276_3) {
globalThis.globalThis.requestAnimationFrame = mockedRequestAnimationFrame;
}
const r28 = function() {
const r2 = env1276;
global.__callGuardDEV = callGuardDEV;
global.__ErrorUtils = {
reportFatalError: $mk102351(r2)
};
setupConsole();
if (!c1276_4) {
_runWorkletOnJS.setupMicrotasks();
let env24475;
const r21 = env24475 = {
$parent: env1276
};
env24475[0] = global.requestAnimationFrame;
env24475[1] = [];
env24475[2] = false;
global.__flushAnimationFrame = $mk102353(r21);
global.requestAnimationFrame = $mk102354(r21);
}
global.lastUpdateFrameTimeByTag = {};
global.lastUpdateByTag = {};
};
r28.__closure = {
setupCallGuard,
setupConsole,
SHOULD_BE_USE_WEB: c1276_4,
setupMicrotasks: _runWorkletOnJS.setupMicrotasks,
setupRequestAnimationFrame
};
r28.__workletHash = 2162023783290;
r28.__initData = c1276_12;
runOnUIImmediately(r28)();
}
}