187 lines
7.3 KiB
React
187 lines
7.3 KiB
React
/* Metro module 1543; source: unknown; dependencies: [31, 1506, 1544] */
|
|
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});
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
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(importDefault(1506) /* metro dependency 1506 */);
|
|
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]);
|
|
(importDefault(1544) /* metro dependency 1544 */)({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);
|
|
}
|
|
|