decord/source/modules/routing/router_utils.tsx

171 lines
6 KiB
TypeScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 1198
2026-07-25 08:10:48 +00:00
// Function ID: 13763
2026-07-20 16:05:17 +00:00
// Name: shouldNavigate
2026-07-23 10:11:24 +00:00
// Dependencies: [653, 3, 1199, 1207, 1210, 2]
2026-07-20 16:05:17 +00:00
// Exports: back, currentRouteHasBackNavigation, forward, getFingerprintLocation, getHistory, getLastRouteChangeSource, getLastRouteChangeSourceLocationStack, hasNavigated, isValidFingerprintRoute, replaceWith, transitionToGuild
// Module 1198 (shouldNavigate)
2026-07-23 10:11:24 +00:00
import ME from "ME";
import importDefaultResult from "reportDevtoolsEvent";
import _extends from "_extends";
let closure_5;
let closure_6;
let closure_7;
2026-07-20 16:05:17 +00:00
function shouldNavigate() {
2026-07-23 10:11:24 +00:00
const ComponentDispatch = require(1207) /* reportDevtoolsEvent */.ComponentDispatch;
2026-07-20 16:05:17 +00:00
return !ComponentDispatch.hasSubscribers(constants2.MODAL_CLOSE);
}
function maybeExternallyNavigate(ME, assign) {
2026-07-23 10:11:24 +00:00
let closure_0 = ME;
2026-07-20 16:05:17 +00:00
let tmp = "string" !== typeof ME;
if (!tmp) {
2026-07-23 10:11:24 +00:00
tmp = !items.some((arg0) => ME.startsWith(arg0));
2026-07-20 16:05:17 +00:00
}
let flag = !tmp;
if (!tmp) {
const _HermesInternal = HermesInternal;
importDefaultResult.log("" + assign + " - route to external path " + ME);
const _window = window;
const _Event = Event;
const event = new Event("beforeunload");
window.dispatchEvent(event);
const _window2 = window;
const _location = window.location;
_location[assign](ME);
flag = true;
}
return flag;
}
2026-07-27 11:26:19 +00:00
function transitionTo(ME, source) {
if (!maybeExternallyNavigate(ME, "assign")) {
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-07-27 11:26:19 +00:00
importDefaultResult.log("transitionTo - Transitioning to " + ME);
2026-07-20 16:05:17 +00:00
source = undefined;
if (null != source) {
source = source.source;
}
let sourceLocationStack;
if (null != source) {
sourceLocationStack = source.sourceLocationStack;
}
if (null == source) {
2026-07-27 11:26:19 +00:00
_extends.push(ME);
2026-07-20 16:05:17 +00:00
} else {
const _URL = URL;
const _window = window;
const _HermesInternal2 = HermesInternal;
2026-07-27 11:26:19 +00:00
const uRL = new URL(ME, "https:" + window.GLOBAL_ENV.WEBAPP_ENDPOINT);
2026-07-20 16:05:17 +00:00
const obj = {};
({ pathname: obj.pathname, search: obj.search, hash: obj.hash } = uRL);
const merged = Object.assign(source);
2026-07-23 10:11:24 +00:00
_extends.push(obj);
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-23 10:11:24 +00:00
({ Routes: closure_5, PageAnalyticsLocations: closure_6, ComponentActions: closure_7 } = ME);
2026-07-20 16:05:17 +00:00
importDefaultResult = new importDefaultResult("Routing/Utils");
2026-07-23 10:11:24 +00:00
const items = [ME.RelativeMarketingURLs.DEVELOPER_PORTAL];
_extends = _extends.createMemoryHistory();
let closure_10 = _extends.listen((arg0, arg1) => {
2026-07-20 16:05:17 +00:00
if ("REPLACE" !== arg1) {
callback();
}
});
2026-07-23 10:11:24 +00:00
const result = require("_extends").fileFinishedImporting("modules/routing/router_utils.tsx");
2026-07-20 16:05:17 +00:00
export { shouldNavigate };
export { transitionTo };
export const transitionToGuild = function transitionToGuild(guildId, channelId, messageId, source) {
importDefaultResult.log("transitionToGuild - Transitioning to " + JSON.stringify({ guildId, channelId, messageId }));
transitionTo(closure_5.CHANNEL(guildId, channelId, messageId), source);
};
export const currentRouteHasBackNavigation = function currentRouteHasBackNavigation() {
let hasItem = null != closure_3;
if (hasItem) {
2026-07-23 10:11:24 +00:00
const ChannelBackNavigationSources = require(1210) /* set */.ChannelBackNavigationSources;
2026-07-20 16:05:17 +00:00
hasItem = ChannelBackNavigationSources.has(closure_3);
}
return hasItem;
};
export const replaceWith = function replaceWith(ME, state) {
if (!maybeExternallyNavigate(ME, "replace")) {
const _HermesInternal = HermesInternal;
importDefaultResult.log("Replacing route with " + ME);
if ("string" === typeof ME) {
2026-07-23 10:11:24 +00:00
const replaced = _extends.replace(ME, state);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
const replaced1 = _extends.replace(ME);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let closure_3 = arg2;
2026-07-20 16:05:17 +00:00
}
};
export function getHistory() {
2026-07-23 10:11:24 +00:00
return _extends;
2026-07-20 16:05:17 +00:00
}
export function getLastRouteChangeSource() {
return closure_3;
}
export function getLastRouteChangeSourceLocationStack() {
return closure_4;
}
export const isValidFingerprintRoute = function isValidFingerprintRoute(arg0) {
return true;
};
export const getFingerprintLocation = function getFingerprintLocation(arg0) {
let ACCOUNT_REVERT = arg0;
if (null == arg0) {
2026-07-23 10:11:24 +00:00
const pathname = _extends.location.pathname;
2026-07-20 16:05:17 +00:00
let str = "";
if (null != pathname) {
str = pathname;
}
ACCOUNT_REVERT = str;
}
if (ACCOUNT_REVERT.startsWith(closure_5.LOGIN)) {
ACCOUNT_REVERT = constants.LOGIN;
} else if (ACCOUNT_REVERT.startsWith(closure_5.REGISTER)) {
ACCOUNT_REVERT = constants.REGISTER;
} else if (ACCOUNT_REVERT.startsWith(closure_5.INVITE(""))) {
ACCOUNT_REVERT = constants.INVITE;
} else if (ACCOUNT_REVERT.startsWith(closure_5.VERIFY)) {
ACCOUNT_REVERT = constants.VERIFY;
} else if (ACCOUNT_REVERT.startsWith(closure_5.DISABLE_EMAIL_NOTIFICATIONS)) {
ACCOUNT_REVERT = constants.DISABLE_EMAIL_NOTIFICATIONS;
} else if (ACCOUNT_REVERT.startsWith(closure_5.DISABLE_SERVER_HIGHLIGHT_NOTIFICATIONS)) {
ACCOUNT_REVERT = constants.DISABLE_SERVER_HIGHLIGHT_NOTIFICATIONS;
} else if (ACCOUNT_REVERT.startsWith(closure_5.REJECT_IP)) {
ACCOUNT_REVERT = constants.REJECT_IP;
} else if (ACCOUNT_REVERT.startsWith(closure_5.REJECT_MFA)) {
ACCOUNT_REVERT = constants.REJECT_MFA;
} else if (ACCOUNT_REVERT.startsWith(closure_5.AUTHORIZE_IP)) {
ACCOUNT_REVERT = constants.AUTHORIZE_IP;
} else if (ACCOUNT_REVERT.startsWith(closure_5.AUTHORIZE_PAYMENT)) {
ACCOUNT_REVERT = constants.AUTHORIZE_PAYMENT;
} else if (ACCOUNT_REVERT.startsWith(closure_5.RESET)) {
ACCOUNT_REVERT = constants.RESET;
} else if (ACCOUNT_REVERT.startsWith(closure_5.REPORT)) {
ACCOUNT_REVERT = constants.REPORT;
} else if (ACCOUNT_REVERT.startsWith(closure_5.REPORT_SECOND_LOOK)) {
ACCOUNT_REVERT = constants.REPORT_SECOND_LOOK;
} else if (ACCOUNT_REVERT.startsWith(closure_5.ACCOUNT_REVERT(""))) {
ACCOUNT_REVERT = constants.ACCOUNT_REVERT;
}
return ACCOUNT_REVERT;
};
export function hasNavigated() {
return false;
}
export const back = function back() {
if (shouldNavigate()) {
2026-07-23 10:11:24 +00:00
let c3 = null;
_extends.goBack();
2026-07-20 16:05:17 +00:00
}
};
export const forward = function forward() {
if (shouldNavigate()) {
2026-07-23 10:11:24 +00:00
let c3 = null;
_extends.goForward();
2026-07-20 16:05:17 +00:00
}
};