837 lines
23 KiB
TypeScript
837 lines
23 KiB
TypeScript
// Metro module 4040 (f4041).
|
|
import { useLayoutEffect, useState } from "react";
|
|
import { ME } from "../../../Constants";
|
|
import { getRootNavigationRef } from "../RootNavigationRef.native";
|
|
import { v4 } from "../../../_bundle/Module514";
|
|
import { CommonActions } from "../../../_bundle/Module1481";
|
|
import { wrapRouteForRootNavigator, getInitialAuthState } from "../native/getInitialNavigationState";
|
|
import Module4047 from "../../../_bundle/Module4047";
|
|
import { dismissKeyboard } from "../../../utils/native/ChatInputUtils";
|
|
let c2317_8, coerceMainRoute, coerceChannelRoute, coerceTabsRoute, coerceGuildsRoute, isModalOpen, popModal;
|
|
const navigationToRootTabHelper = function navigationToRootTabHelper(a0, resetRoot) {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
|
|
if (resetRoot) {
|
|
const rootState = rootNavigationRef2.getRootState();
|
|
const r29 = rootState.routes.filter((route) => route.name === "modal");
|
|
const routes = [...wrapRouteForRootNavigator([{
|
|
name: "tabs",
|
|
key: `tabs-${v4()}`,
|
|
params: a0
|
|
}]), ...r29];
|
|
rootNavigationRef2.dispatch(CommonActions.reset({
|
|
...rootState,
|
|
routes,
|
|
index: routes.length - 1
|
|
}));
|
|
} else {
|
|
rootNavigationRef2.navigate("tabs", a0);
|
|
}
|
|
return void 0;
|
|
}
|
|
return false;
|
|
};
|
|
coerceMainRoute = function coerceMainRoute(a0) {
|
|
if (a0 != null && a0.name === "main") {
|
|
return a0;
|
|
}
|
|
};
|
|
coerceChannelRoute = function coerceChannelRoute(a0) {
|
|
if (a0 != null && a0.name === "channel") {
|
|
return a0;
|
|
}
|
|
};
|
|
coerceTabsRoute = function coerceTabsRoute(route) {
|
|
if (route != null && route.name === "tabs") {
|
|
return route;
|
|
}
|
|
};
|
|
coerceGuildsRoute = function coerceGuildsRoute(a0) {
|
|
L3: {
|
|
if (a0 != null) {
|
|
if (a0.name !== "guilds" && a0.name !== "guilds-root") {
|
|
break L3;
|
|
}
|
|
return a0;
|
|
}
|
|
}
|
|
};
|
|
isModalOpen = function isModalOpen(a0) {
|
|
let r28;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
|
|
const rootState = rootNavigationRef2.getRootState();
|
|
if (rootState == null) {
|
|
return false;
|
|
}
|
|
const r19 = rootState.routes[rootState.index];
|
|
const r20 = r19 != null ? r19.name === "modal" ? r19 : void 0 : void 0;
|
|
if (a0 == null) {
|
|
r28 = r20 != null;
|
|
} else if (typeof a0 === "string") {
|
|
r28 = r20?.key === a0;
|
|
} else {
|
|
const r22 = r20 == null;
|
|
let r23 = void 0;
|
|
if (!r22) {
|
|
const params = r20.params;
|
|
r23 = params == null ? void 0 : params.modal?.modal;
|
|
}
|
|
r28 = r23 === a0;
|
|
}
|
|
return r28;
|
|
}
|
|
return false;
|
|
};
|
|
c2317_8 = new Set(["friends", "sidebar", "message-requests", "modal"]);
|
|
export function navigateToChannel({ channelId, guildId, messageId, replaceChannelAndFixRoot = false, openChannel = false }) {
|
|
let r82;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
|
|
if (replaceChannelAndFixRoot !== false && !openChannel) {
|
|
return true;
|
|
}
|
|
const rootState = rootNavigationRef2.getRootState();
|
|
if (replaceChannelAndFixRoot) {
|
|
const r64 = coerceMainRoute(rootState.routes[0]);
|
|
if (r64 != null && r64.state != null) {
|
|
const r72 = coerceChannelRoute(r64.state.routes[r64.state.index]);
|
|
if (r72 != null) {
|
|
r82 = {
|
|
...r72,
|
|
params: {
|
|
channelId,
|
|
guildId,
|
|
messageId
|
|
}
|
|
};
|
|
} else {
|
|
let key = channelId;
|
|
if (key == null) {
|
|
key = `channel-${v4()}`;
|
|
}
|
|
r82 = {
|
|
name: "channel",
|
|
key,
|
|
params: {
|
|
channelId,
|
|
guildId,
|
|
messageId
|
|
}
|
|
};
|
|
}
|
|
let r87 = null;
|
|
for (const route of r64.state.routes) {
|
|
const r97 = coerceTabsRoute(route);
|
|
r87 = r97;
|
|
if (r97 == null) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
const state = r87?.state;
|
|
if (r87 != null && state != null) {
|
|
const state2 = {
|
|
...state,
|
|
routes: [...state.routes]
|
|
};
|
|
const r117 = {
|
|
...r87,
|
|
state: state2
|
|
};
|
|
if (state2.index !== 0) {
|
|
state2.index = 0;
|
|
}
|
|
const r122 = coerceGuildsRoute(state2.routes[0]);
|
|
if (!(r122 == null || r122.params?.guildId === guildId && r122.params?.channelId === channelId)) {
|
|
state2.routes[0] = {
|
|
...r122,
|
|
params: {
|
|
guildId,
|
|
channelId,
|
|
drawerOpen: false
|
|
}
|
|
};
|
|
}
|
|
r64.state = {
|
|
...r64.state,
|
|
routes: [r117, r82],
|
|
index: 1
|
|
};
|
|
rootNavigationRef2.dispatch(CommonActions.reset({
|
|
...rootState,
|
|
routes: [r64],
|
|
index: 0
|
|
}));
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
const r42 = coerceChannelRoute(rootNavigationRef2.getCurrentRoute());
|
|
rootNavigationRef2.dispatch(CommonActions.navigate({
|
|
name: "channel",
|
|
key: r42 != null && r42.params.channelId === channelId ? r42.key : `channel-${v4()}`,
|
|
params: {
|
|
channelId,
|
|
guildId,
|
|
messageId
|
|
}
|
|
}));
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
export function navigateToMemberVerification(a0, a1) {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
const r1 = rootNavigationRef2 == null || !rootNavigationRef2.isReady();
|
|
let r15 = !r1;
|
|
if (!r1) {
|
|
rootNavigationRef2.navigate({
|
|
name: "member-verification",
|
|
key: `member-verification-${v4()}`,
|
|
params: {
|
|
guildId: a0,
|
|
inviteCode: a1
|
|
}
|
|
});
|
|
r15 = true;
|
|
}
|
|
return r15;
|
|
}
|
|
export function navigateToRootTab(a0) {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
const { screen, resetRoot } = a0;
|
|
let forceNavigate = a0.forceNavigate;
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady() && screen != null) {
|
|
if (!forceNavigate) {
|
|
forceNavigate = rootNavigationRef2.getCurrentRoute()?.name !== screen;
|
|
}
|
|
if (screen === "guilds") {
|
|
const { guildId, channelId } = a0;
|
|
if (forceNavigate) {
|
|
navigationToRootTabHelper({
|
|
screen,
|
|
params: {
|
|
guildId,
|
|
channelId,
|
|
drawerOpen: a0.drawerOpen
|
|
}
|
|
}, resetRoot);
|
|
} else {
|
|
rootNavigationRef2.setParams({
|
|
guildId,
|
|
channelId,
|
|
drawerOpen: a0.drawerOpen
|
|
});
|
|
}
|
|
} else if (screen === "messages") {
|
|
if (forceNavigate) {
|
|
navigationToRootTabHelper({
|
|
screen: "guilds",
|
|
params: {
|
|
guildId: ME
|
|
}
|
|
}, resetRoot);
|
|
}
|
|
} else if (screen === "notifications") {
|
|
if (forceNavigate) {
|
|
rootNavigationRef2.navigate("tabs", {
|
|
screen: "notifications"
|
|
});
|
|
}
|
|
} else if (screen === "icymi" && forceNavigate) {
|
|
rootNavigationRef2.navigate("tabs", {
|
|
screen: "icymi"
|
|
});
|
|
const icymiScreen = a0.icymiScreen;
|
|
if (icymiScreen != null && icymiScreen !== "icymi-screen") {
|
|
rootNavigationRef2.dispatch(() => CommonActions.navigate("tabs", {
|
|
screen: "icymi",
|
|
params: {
|
|
screen: icymiScreen
|
|
}
|
|
}));
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
export function resetToAuthRoute() {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
const r1 = rootNavigationRef2 == null || !rootNavigationRef2.isReady();
|
|
let r12 = !r1;
|
|
if (!r1) {
|
|
rootNavigationRef2.dispatch(() => CommonActions.reset(getInitialAuthState()));
|
|
r12 = true;
|
|
}
|
|
return r12;
|
|
}
|
|
export function pushModal(a0) {
|
|
const { key: _key, ...params } = a0;
|
|
let key = a0.key;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
const r21 = Module4047.runningTTIAutomation();
|
|
const r22 = rootNavigationRef2 == null || !rootNavigationRef2.isReady() || r21;
|
|
let r0 = !r22;
|
|
if (!r22) {
|
|
dismissKeyboard();
|
|
if (key == null) {
|
|
key = `modal-${v4}`;
|
|
}
|
|
rootNavigationRef2.navigate({
|
|
name: "modal",
|
|
key,
|
|
params
|
|
});
|
|
r0 = true;
|
|
}
|
|
return r0;
|
|
}
|
|
popModal = function popModal(a0, a1) {
|
|
let r85;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
|
|
const rootState = rootNavigationRef2.getRootState();
|
|
const routes = rootState.routes;
|
|
let index = rootState.index;
|
|
let routes2 = routes;
|
|
if (index > -1) {
|
|
while (true) {
|
|
const r17 = routes[index];
|
|
const r3 = r17 != null;
|
|
const r19 = r3 ? r17.name === "modal" ? r17 : void 0 : void 0;
|
|
if (!(a0 != null && r19?.key === a0) && !(a0 == null && r19 != null)) {
|
|
index = index - 1;
|
|
routes2 = routes;
|
|
if (index > -1) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
let r33 = routes;
|
|
if (a1 != null) {
|
|
const routes3 = [...routes];
|
|
routes3[index] = {
|
|
...r19,
|
|
params: {
|
|
...r19.params,
|
|
modal: {
|
|
...r19.params.modal,
|
|
callbacks: {
|
|
...r19.params.modal.callbacks,
|
|
onExited: a1
|
|
}
|
|
}
|
|
}
|
|
};
|
|
rootNavigationRef2.dispatch(CommonActions.reset({
|
|
...rootState,
|
|
routes: routes3,
|
|
index: rootState.index
|
|
}));
|
|
r33 = routes3;
|
|
}
|
|
const r69 = [...r33];
|
|
r69.splice(index, 1);
|
|
routes2 = r69;
|
|
break;
|
|
}
|
|
}
|
|
if (routes2 === rootState.routes) {
|
|
const r5 = a1 != null;
|
|
r85 = false;
|
|
if (r5) {
|
|
Promise.resolve().then(() => a1());
|
|
r85 = false;
|
|
}
|
|
} else if (a1 == null) {
|
|
rootNavigationRef2.dispatch(CommonActions.reset({
|
|
...rootState,
|
|
routes: routes2,
|
|
index: Math.max(rootState.index - 1, 0)
|
|
}));
|
|
r85 = true;
|
|
} else {
|
|
Promise.resolve().then(() => popModal(a0));
|
|
r85 = true;
|
|
}
|
|
return r85;
|
|
}
|
|
if (a1 != null) {
|
|
Promise.resolve().then(() => a1());
|
|
}
|
|
return false;
|
|
};
|
|
export { popModal };
|
|
export function popModalsAboveKey(a0) {
|
|
let r54;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
|
|
const rootNavigationRef3 = getRootNavigationRef();
|
|
const r7 = rootNavigationRef3 != null;
|
|
let r28 = void 0;
|
|
if (r7) {
|
|
const isReady = rootNavigationRef3.isReady();
|
|
r28 = void 0;
|
|
if (isReady) {
|
|
const rootState = rootNavigationRef3.getRootState();
|
|
const r33 = rootState != null;
|
|
r28 = void 0;
|
|
if (r33) {
|
|
const r36 = rootState.routes[rootState.index];
|
|
r28 = (r36 != null ? r36.name === "modal" ? r36 : void 0 : void 0)?.key;
|
|
}
|
|
}
|
|
}
|
|
if (r28 === a0) {
|
|
return false;
|
|
}
|
|
const rootState2 = rootNavigationRef2.getRootState();
|
|
const routes = rootState2.routes;
|
|
const r46 = 0 < routes.length;
|
|
let r0 = 0;
|
|
let index = -1;
|
|
if (r46) {
|
|
do {
|
|
const r48 = routes[r0];
|
|
const r49 = r48 != null;
|
|
const r1 = r0;
|
|
const key = (r49 ? r48.name === "modal" ? r48 : void 0 : void 0)?.key;
|
|
index = r1;
|
|
if (key === a0) {
|
|
break;
|
|
}
|
|
const r52 = r1 + 1;
|
|
r54 = r52 < routes.length;
|
|
r0 = r52;
|
|
index = -1;
|
|
} while (r54);
|
|
}
|
|
if (index !== -1 && index !== routes.length - 1) {
|
|
rootNavigationRef2.dispatch(CommonActions.reset({
|
|
...rootState2,
|
|
routes: routes.slice(0, index + 1),
|
|
index
|
|
}));
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
export function popAllModals() {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
|
|
const rootState = rootNavigationRef2.getRootState();
|
|
const routes = rootState.routes;
|
|
const routes2 = [];
|
|
for (const item of routes) {
|
|
if (!c2317_8.has(item.name)) {
|
|
routes2.push(item);
|
|
}
|
|
}
|
|
let r45 = routes.length !== routes2.length;
|
|
if (r45) {
|
|
rootNavigationRef2.dispatch(CommonActions.reset({
|
|
...rootState,
|
|
routes: routes2,
|
|
index: routes2.length - 1
|
|
}));
|
|
r45 = true;
|
|
}
|
|
return r45;
|
|
}
|
|
return false;
|
|
}
|
|
export function getSelectedGuildFromRoute() {
|
|
let r40;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
const r13 = rootNavigationRef2 == null ? void 0 : rootNavigationRef2.getRootState();
|
|
if (r13 != null) {
|
|
const r17 = r13.routes[r13.index];
|
|
const r19 = r17 != null ? r17.name === "main" ? r17 : void 0 : void 0;
|
|
if (r19 != null) {
|
|
const state = r19.state;
|
|
if (state != null) {
|
|
const r24 = state.routes[state.index];
|
|
const r26 = r24 != null ? r24.name === "channel" ? r24 : void 0 : void 0;
|
|
if (r26 != null) {
|
|
return r26.params.guildId;
|
|
}
|
|
const r30 = state.routes[state.index];
|
|
const r32 = r30 != null ? r30.name === "tabs" ? r30 : void 0 : void 0;
|
|
if (r32 != null) {
|
|
const state2 = r32.state;
|
|
if (state2 != null) {
|
|
const routes = state2.routes;
|
|
let index = state2.index;
|
|
if (index == null) {
|
|
index = -1;
|
|
}
|
|
L24: {
|
|
const r38 = routes[index];
|
|
const r39 = r38 != null;
|
|
r40 = void 0;
|
|
if (r39) {
|
|
if (r38.name !== "guilds") {
|
|
const name = r38.name;
|
|
r40 = void 0;
|
|
if (name !== "guilds-root") {
|
|
break L24;
|
|
}
|
|
}
|
|
r40 = r38;
|
|
}
|
|
}
|
|
return r40 == null ? void 0 : r40.params?.guildId;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
export function getSelectedChannelFromRoute() {
|
|
let r18;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null) {
|
|
const r12 = rootNavigationRef2 == null ? void 0 : rootNavigationRef2.getCurrentRoute();
|
|
const r15 = r12 != null ? r12.name === "channel" ? r12 : void 0 : void 0;
|
|
if (r15 != null) {
|
|
return r15.params.channelId;
|
|
}
|
|
L12: {
|
|
const r17 = r12 != null;
|
|
r18 = void 0;
|
|
if (r17) {
|
|
if (r12.name !== "guilds") {
|
|
const name = r12.name;
|
|
r18 = void 0;
|
|
if (name !== "guilds-root") {
|
|
break L12;
|
|
}
|
|
}
|
|
r18 = r12;
|
|
}
|
|
}
|
|
return r18 != null ? r18.params?.channelId : void 0;
|
|
}
|
|
}
|
|
export function navigateToNewGroupDM(a0, a1) {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
let r13 = rootNavigationRef2 != null;
|
|
if (r13) {
|
|
rootNavigationRef2.navigate("friends", {
|
|
screen: "gdm",
|
|
params: {
|
|
channelId: a0,
|
|
locationPage: a1
|
|
}
|
|
});
|
|
r13 = true;
|
|
}
|
|
return r13;
|
|
}
|
|
export function navigateToCreateThread(a0, a1) {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
let r13 = rootNavigationRef2 != null;
|
|
if (r13) {
|
|
const r2 = rootNavigationRef2 == null;
|
|
r13 = true;
|
|
if (!r2) {
|
|
rootNavigationRef2.navigate({
|
|
name: "channel",
|
|
key: "new-thread",
|
|
params: {
|
|
guildId: a0,
|
|
channelId: a1,
|
|
showCreateThread: true
|
|
}
|
|
});
|
|
r13 = true;
|
|
}
|
|
}
|
|
return r13;
|
|
}
|
|
export function navigateToContextMenuCommands(a0) {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
let r11 = rootNavigationRef2 != null;
|
|
if (r11) {
|
|
rootNavigationRef2.navigate("context-menu-commands", {
|
|
screen: "root",
|
|
params: a0
|
|
});
|
|
r11 = true;
|
|
}
|
|
return r11;
|
|
}
|
|
export function popScreens(c13799_0) {
|
|
const rootNavigationRef = getRootNavigationRef();
|
|
let r12 = rootNavigationRef != null;
|
|
if (r12) {
|
|
rootNavigationRef.dispatch(() => {
|
|
let r15;
|
|
const rootState = rootNavigationRef.getRootState();
|
|
const routes = [...rootState.routes];
|
|
if (c13799_0 > 0) {
|
|
do {
|
|
routes.pop();
|
|
r15 = c13799_0 - 1;
|
|
c13799_0 = r15;
|
|
} while (r15 > 0);
|
|
}
|
|
return CommonActions.reset({
|
|
...rootState,
|
|
routes
|
|
});
|
|
});
|
|
r12 = true;
|
|
}
|
|
return r12;
|
|
}
|
|
export { coerceMainRoute };
|
|
export { coerceChannelRoute };
|
|
export function coerceSidebarRoute(a0) {
|
|
if (a0 != null && a0.name === "sidebar") {
|
|
return a0;
|
|
}
|
|
}
|
|
export { coerceTabsRoute };
|
|
export { coerceGuildsRoute };
|
|
export function coerceICYMIRoute(a0) {
|
|
if (a0 != null && a0.name === "icymi") {
|
|
return a0;
|
|
}
|
|
}
|
|
export function coerceModalRoute(a0) {
|
|
if (a0 != null && a0.name === "modal") {
|
|
return a0;
|
|
}
|
|
}
|
|
export { isModalOpen };
|
|
export function useIsModalOpen(a0) {
|
|
const [state, setState] = useState(() => isModalOpen(a0));
|
|
useLayoutEffect(() => {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null) {
|
|
return rootNavigationRef2.addListener("state", () => {
|
|
setState(isModalOpen(a0));
|
|
});
|
|
}
|
|
}, [a0]);
|
|
return state;
|
|
}
|
|
export function getOpenModalKey() {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
|
|
const rootState = rootNavigationRef2.getRootState();
|
|
if (rootState != null) {
|
|
const r18 = rootState.routes[rootState.index];
|
|
return (r18 != null ? r18.name === "modal" ? r18 : void 0 : void 0)?.key;
|
|
}
|
|
}
|
|
}
|
|
export function useOpenModalKey() {
|
|
const [state, setState2] = useState(() => {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
const r2 = rootNavigationRef2 != null;
|
|
let r12 = void 0;
|
|
if (r2) {
|
|
const isReady = rootNavigationRef2.isReady();
|
|
r12 = void 0;
|
|
if (isReady) {
|
|
const rootState = rootNavigationRef2.getRootState();
|
|
const r17 = rootState != null;
|
|
r12 = void 0;
|
|
if (r17) {
|
|
const r20 = rootState.routes[rootState.index];
|
|
r12 = (r20 != null ? r20.name === "modal" ? r20 : void 0 : void 0)?.key;
|
|
}
|
|
}
|
|
}
|
|
return r12;
|
|
});
|
|
useLayoutEffect(() => {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null) {
|
|
return rootNavigationRef2.addListener("state", () => {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
const r2 = rootNavigationRef2 != null;
|
|
let r14 = void 0;
|
|
if (r2) {
|
|
const isReady = rootNavigationRef2.isReady();
|
|
r14 = void 0;
|
|
if (isReady) {
|
|
const rootState = rootNavigationRef2.getRootState();
|
|
const r19 = rootState != null;
|
|
r14 = void 0;
|
|
if (r19) {
|
|
const r22 = rootState.routes[rootState.index];
|
|
r14 = (r22 != null ? r22.name === "modal" ? r22 : void 0 : void 0)?.key;
|
|
}
|
|
}
|
|
}
|
|
setState2(r14);
|
|
});
|
|
}
|
|
}, []);
|
|
return state;
|
|
}
|
|
export function getCurrentNavigationRouteName() {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
|
|
let r14 = rootNavigationRef2.getCurrentRoute()?.name;
|
|
if (r14 == null) {
|
|
r14 = void 0;
|
|
}
|
|
return r14;
|
|
}
|
|
}
|
|
export function useCurrentNavigationRouteName() {
|
|
const [state, setState3] = useState(() => {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
const r2 = rootNavigationRef2 != null;
|
|
let r10 = void 0;
|
|
if (r2) {
|
|
const isReady = rootNavigationRef2.isReady();
|
|
r10 = void 0;
|
|
if (isReady) {
|
|
let r16 = rootNavigationRef2.getCurrentRoute()?.name;
|
|
if (r16 == null) {
|
|
r16 = void 0;
|
|
}
|
|
r10 = r16;
|
|
}
|
|
}
|
|
return r10;
|
|
});
|
|
useLayoutEffect(() => {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null) {
|
|
return rootNavigationRef2.addListener("state", () => {
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
const r2 = rootNavigationRef2 != null;
|
|
let r12 = void 0;
|
|
if (r2) {
|
|
const isReady = rootNavigationRef2.isReady();
|
|
r12 = void 0;
|
|
if (isReady) {
|
|
let r18 = rootNavigationRef2.getCurrentRoute()?.name;
|
|
if (r18 == null) {
|
|
r18 = void 0;
|
|
}
|
|
r12 = r18;
|
|
}
|
|
}
|
|
setState3(r12);
|
|
});
|
|
}
|
|
}, []);
|
|
return state;
|
|
}
|
|
export function getCurrentRouteParents() {
|
|
let r31;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null && rootNavigationRef2.isReady()) {
|
|
const rootState = rootNavigationRef2.getRootState();
|
|
const r3 = rootState == null;
|
|
let r19 = void 0;
|
|
if (!r3) {
|
|
const routes = rootState.routes;
|
|
let index2 = rootState.index;
|
|
if (index2 == null) {
|
|
index2 = 0;
|
|
}
|
|
r19 = routes[index2].state;
|
|
}
|
|
const r22 = [];
|
|
let r23 = rootState;
|
|
let r24 = r23;
|
|
if (r19 != null) {
|
|
do {
|
|
r22.push(r23);
|
|
const routes2 = r23.routes;
|
|
let index3 = r23.index;
|
|
if (index3 == null) {
|
|
index3 = 0;
|
|
}
|
|
const state = routes2[index3].state;
|
|
const r30 = state == null;
|
|
r31 = void 0;
|
|
if (!r30) {
|
|
const routes3 = state.routes;
|
|
let index = state.index;
|
|
if (index == null) {
|
|
index = 0;
|
|
}
|
|
r31 = routes3[index].state;
|
|
}
|
|
r23 = state;
|
|
r24 = r23;
|
|
} while (r31 != null);
|
|
}
|
|
if (r24 != null) {
|
|
r22.push(r24);
|
|
}
|
|
return r22;
|
|
}
|
|
return [];
|
|
}
|
|
export function getTabsRouteIfActive(a0) {
|
|
const r9 = a0.routes[a0.index];
|
|
const r10 = r9 != null ? r9.name === "main" ? r9 : void 0 : void 0;
|
|
if (r10?.state != null) {
|
|
const routes = r10.state.routes;
|
|
let index = r10.state.index;
|
|
if (index == null) {
|
|
index = 0;
|
|
}
|
|
const r17 = routes[index];
|
|
return r17 != null ? r17.name === "tabs" ? r17 : void 0 : void 0;
|
|
}
|
|
}
|
|
export function getICYMIRouteIfActive(a0) {
|
|
const r4 = a0 == null ? void 0 : a0.routes[a0?.index];
|
|
const r9 = r4 != null ? r4.name === "main" ? r4 : void 0 : void 0;
|
|
if (r9?.state != null) {
|
|
const r16 = r9.state.routes[0];
|
|
const r18 = r16 != null ? r16.name === "tabs" ? r16 : void 0 : void 0;
|
|
if (r18?.state != null) {
|
|
const r27 = r18.state.routes[r18.state.index];
|
|
return r27 != null ? r27.name === "icymi" ? r27 : void 0 : void 0;
|
|
}
|
|
}
|
|
}
|
|
export function setHomeDrawerState(a0) {
|
|
let r16;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if (rootNavigationRef2 != null) {
|
|
const r13 = rootNavigationRef2 == null ? void 0 : rootNavigationRef2.getCurrentRoute();
|
|
let r15 = r13 != null;
|
|
if (r15) {
|
|
L8: {
|
|
const r3 = r13 != null;
|
|
r16 = void 0;
|
|
if (r3) {
|
|
if (r13.name !== "guilds") {
|
|
const name = r13.name;
|
|
r16 = void 0;
|
|
if (name !== "guilds-root") {
|
|
break L8;
|
|
}
|
|
}
|
|
r16 = r13;
|
|
}
|
|
}
|
|
r15 = r16 != null;
|
|
}
|
|
if (r15) {
|
|
rootNavigationRef2.setParams({
|
|
drawerOpen: a0
|
|
});
|
|
}
|
|
}
|
|
}
|