Files
discord-decomp/sources/by-id/module-01543.js
T
2026-07-28 01:06:53 +03:00

191 lines
8.8 KiB
JavaScript

/* Metro module 1543; source: unknown; dependencies: [31, 1506, 1544] */
import Module01506 from './module-01506.js'; /* Metro dependency 1506 */
import ShouldPreventRemove from './module-01544-shouldPreventRemove.js'; /* Metro dependency 1544 */
import * as ReactModule from './module-00031-React.js'; /* Metro dependency 31 */
function _fun17415(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#17415, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1670:6, offset: 0x00e6c4d7, size: 91 bytes, params: 8, frame: 17
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.default = useOnAction;
function useOnAction({router, getState, setState, key, actionListeners, beforeRemoveListeners, routerConfigOptions, emitter}) { // fn#17416, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1670:117, offset: 0x00e6c532, size: 321 bytes, params: 2, frame: 27
const binding = key;
let value = binding.useContext(Module01506);
const onAction = value.onAction;
const onRouteFocus = value.onRouteFocus;
const addListener = value.addListener;
const onDispatchAction = value.onDispatchAction;
const env0_12 = binding.useRef(routerConfigOptions);
binding.useEffect(_fun17417);
value = binding.useCallback(_fun17418, [actionListeners, beforeRemoveListeners, emitter, getState, key, onAction,
onDispatchAction, onRouteFocus, router, setState]);
(ShouldPreventRemove)({getState: getState, emitter: emitter,
beforeRemoveListeners: beforeRemoveListeners});
binding.useEffect(_fun17419, [addListener, value]);
return value;
function _fun17417() { // fn#17417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1670:391, offset: 0x00e6c673, size: 21 bytes, params: 1, frame: 2
env0_12.current = routerConfigOptions;
}
function _fun17418(a0) { // fn#17418, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1670:438, offset: 0x00e6c688, size: 428 bytes, params: 2, frame: 23
var r5;
var r3;
var r6;
var r1;
var Set;
var prototype;
var value;
var set;
var key5;
var length;
var value4;
var value5;
var value6;
var moduleValue;
var shouldActionChangeFocus;
var shouldActionChangeFocus2;
var value7;
reducibleJoin4: while (true) {
reducibleJoin2: while (true) {
if (arguments.length > 1) {
if (arguments[1] !== undefined) {
value = arguments[1];
r5 = value;
break reducibleJoin4;
}
break reducibleJoin2;
}
break reducibleJoin2;
}
Set = global.Set;
prototype = Set.prototype;
value = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value = set instanceof Object ? set : value;
r5 = value;
break reducibleJoin4;
}
const state = getState();
if (!r5.has(state.key)) {
r5.add(state.key);
var target = a0.target;
if (typeof target === 'string') {
target = a0.target;
reducibleJoin7: while (true) {
if (target !== state.key) {
if (onAction !== undefined) {
reducibleJoin12: while (true) {
if (onAction(a0, r5)) {
return true;
}
break reducibleJoin12;
}
}
length = actionListeners.length;
value4 = length - 1;
if (value4 >= 0) {
r6 = value4;
reducibleLoop13: while (true) {
if ((0, actionListeners[r6])(a0, r5)) {
return true;
}
value5 = typeof r6 === 'bigint' ? r6 - 1n : +r6 - 1;
if (!(value5 >= 0)) {
return false;
}
r6 = value5;
continue reducibleLoop13;
}
}
return false;
}
break reducibleJoin7;
}
}
var stateForAction = router.getStateForAction(state, a0, env0_12.current);
reducibleJoin9: while (true) {
if (stateForAction !== null) {
r3 = stateForAction;
break reducibleJoin9;
}
target = a0.target;
key5 = state.key;
if (target !== key5) {
r3 = stateForAction;
break reducibleJoin9;
}
r3 = state;
break reducibleJoin9;
}
if (r3 !== null) {
onDispatchAction(a0, state === r3);
if (state !== r3) {
value6 = environment.__proto__;
moduleValue = require(1544) /* metro dependency 1544 */;
if (moduleValue.shouldPreventRemove(emitter, beforeRemoveListeners, state.routes, r3.routes, a0)) {
return true;
}
setState(r3);
}
reducibleJoin26: while (true) {
if (onRouteFocus === undefined) {
break reducibleJoin26;
}
routerBinding = router;
shouldActionChangeFocus = routerBinding.shouldActionChangeFocus;
shouldActionChangeFocus2 = Reflect.apply(shouldActionChangeFocus, routerBinding, [a0]);
reducibleJoin24: while (true) {
if (shouldActionChangeFocus2) {
value7 = key !== undefined;
r1 = value7;
break reducibleJoin24;
}
r1 = shouldActionChangeFocus2;
break reducibleJoin24;
}
if (r1) {
onRouteFocus(key);
break reducibleJoin26;
}
break reducibleJoin26;
}
return true;
}
if (onAction !== undefined) {
reducibleJoin12: while (true) {
if (onAction(a0, r5)) {
return true;
}
break reducibleJoin12;
}
}
length = actionListeners.length;
value4 = length - 1;
if (value4 >= 0) {
r6 = value4;
reducibleLoop13: while (true) {
if ((0, actionListeners[r6])(a0, r5)) {
return true;
}
value5 = typeof r6 === 'bigint' ? r6 - 1n : +r6 - 1;
if (!(value5 >= 0)) {
return false;
}
r6 = value5;
continue reducibleLoop13;
}
}
}
return false;
}
function _fun17419() { // fn#17419, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1670:1059, offset: 0x00e6c834, size: 40 bytes, params: 1, frame: 14
return addListener?.('action', env0_13);
}
}
}
global.__d(_fun17415, 1543, [31, 1506, 1544]) /* metro module 1543, dependencies: [31, 1506, 1544] */;