decord/source/modules/game_profile/hooks/useOpenExternalUrlFromGameProfile.tsx

263 lines
8 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 9136
// Function ID: 9137
2026-07-20 16:05:17 +00:00
// Name: _getDeepLinkUrl
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 5, 19, 7283, 9137, 4087, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 9136 (_getDeepLinkUrl)
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "asyncGeneratorStep" /* 5 */;
import closure_5 from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function _getDeepLinkUrl() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback2((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c3 = 0;
c4 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
if (c4 === 2) {
c4 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c4 = 2;
if (0 === c3) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
dependencyMap = tmp5;
2026-07-29 08:29:29 +00:00
let callback = tmp2;
callback = undefined;
dependencyMap = undefined;
if ("store.steampowered.com" === lib.hostname) {
c3 = 1;
c4 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = closure_1_1(closure_1_2[3]).isProtocolRegistered(closure_1_6);
2026-07-29 08:29:29 +00:00
return obj1;
}
}
} else {
if (1 === tmp5) {
if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
const obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else if (arg1) {
const match = lib.pathname.match(closure_7);
let tmp21;
if (match != null) {
tmp21 = match[1];
}
callback = tmp21;
if (null != callback) {
const _HermesInternal = HermesInternal;
c4 = 3;
const obj3 = { value: null, done: true };
obj3[0] = "" + closure_6 + "://store/" + callback;
return obj3;
}
const str2 = lib.pathname;
}
} else if (arg0 === 1) {
c4 = 3;
throw arg1;
} else if (arg0 === 2) {
c4 = 3;
let obj4 = { value: null, done: true };
obj4[0] = arg1;
return obj4;
} else if (arg1) {
const match1 = lib.pathname.match(closure_8);
let tmp12;
if (match1 != null) {
tmp12 = match1[1];
}
dependencyMap = tmp12;
if (null != dependencyMap) {
const _decodeURIComponent = decodeURIComponent;
c4 = 3;
obj = { value: null, done: true };
2026-08-24 06:08:38 +00:00
obj[0] = lib(9137).buildXboxGamePassStoreDeepLinkUrl(decodeURIComponent(dependencyMap));
2026-07-29 08:29:29 +00:00
return obj;
}
const str = lib.pathname;
}
c4 = 3;
return { value: null, done: true };
}
2026-08-24 06:08:38 +00:00
if (lib.hostname === lib(9137).XBOX_GAME_PASS_STORE_HOSTNAME) {
obj4 = callback(7283);
2026-07-29 08:29:29 +00:00
c3 = 2;
c4 = 1;
const obj5 = { value: null, done: false };
2026-08-24 06:08:38 +00:00
obj5[0] = obj4.isProtocolRegistered(lib(9137).XBOX_GAME_PASS_PROTOCOL);
2026-07-29 08:29:29 +00:00
return obj5;
}
} catch (tmp37) {
c4 = tmp;
throw tmp37;
}
}
})();
});
2026-08-24 06:08:38 +00:00
closure_9 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const steam = "steam";
const re7 = /^\/app\/(\d+)(?:\/)?/;
const re8 = /^\/games\/store\/title\/([^/]+)/;
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/game_profile/hooks/useOpenExternalUrlFromGameProfile.tsx");
2026-07-20 16:05:17 +00:00
export default function useOpenExternalUrlFromGameProfile(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const tmp = callback(React.useState(false), 2);
const first = tmp[0];
2026-08-24 06:08:38 +00:00
closure_2 = tmp[1];
2026-07-29 08:29:29 +00:00
closure_0 = undefined;
closure_0 = callback2((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c4 = 0;
c5 = 0;
c3 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
if (c5 === 2) {
c5 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
c2 = tmp3;
2026-07-29 08:29:29 +00:00
let uRL = tmp7;
uRL = undefined;
c2 = undefined;
if (null != callback) {
2026-08-24 06:08:38 +00:00
c3 = 1;
2026-07-29 08:29:29 +00:00
const _URL = URL;
uRL = new URL(callback);
c3 = 0;
c4 = 2;
c5 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
2026-07-29 08:29:29 +00:00
obj1[0] = (function getDeepLinkUrl(uRL) {
const self = this;
const apply = closure_9.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
})(uRL);
return obj1;
}
}
} else if (1 === tmp7) {
c3 = 0;
c5 = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c2 = arg1;
let tmp9 = null != c2;
if (tmp9) {
2026-08-24 06:08:38 +00:00
tmp9 = closure_1_1;
2026-07-29 08:29:29 +00:00
}
if (tmp9) {
c2 = null;
}
const searchParams = uRL.searchParams;
const result = searchParams.set("utm_source", "discord");
callback = uRL.toString();
if (null != callback) {
callback(callback);
2026-08-24 06:08:38 +00:00
} else if (null == closure_1_2) {
2026-07-29 08:29:29 +00:00
first(table[5])(callback);
}
2026-08-24 06:08:38 +00:00
(function openDeepLink(closure_1_2, closure_1_22) {
closure_0 = closure_1_22;
uRL = setTimeout(() => callback(true), 5000);
2026-07-29 08:29:29 +00:00
const listener = window.addEventListener("blur", () => clearTimeout(closure_1), { once: true });
2026-08-24 06:08:38 +00:00
uRL(_null[5])(closure_1_2);
})(closure_1_2, closure_1_2);
2026-07-29 08:29:29 +00:00
}
c5 = 3;
} catch (tmp40) {
if (tmp4 === c3) {
c5 = tmp2;
throw tmp40;
} else {
c4 = tmp;
}
}
}
})();
});
2026-07-20 16:05:17 +00:00
const items = [arg0, first];
2026-07-29 08:29:29 +00:00
return React.useCallback(function() {
const self = this;
const apply = closure_0.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}, items);
2026-07-20 16:05:17 +00:00
};