// Metro module 4173 (f4174). import InviteStore from "../../stores/InviteStore"; import { PRIMARY_DOMAIN } from "../../Constants"; import { CollectibleShopTab } from "../collectibles/CollectiblesShopConstants"; import RegexUtils from "../../utils/RegexUtils"; import { parse } from "../../_bundle/Url_1469"; import { CodedLinkType } from "./CodedLink"; import * as _MarkupUtils from "../markup/MarkupUtils"; import { walkAst } from "../../_bundle/collectAst"; import { isBuildOverrideLink, isManualBuildOverrideLink } from "../build_overrides/BuildOverrideUtils"; import { isExperimentEmbedURL } from "../experiments/ExperimentEmbedUtils"; import { generateInviteKeyFromUrlParams } from "../instant_invite/InviteCodeUtils"; import { isEmbeddedApplicationInvite } from "../instant_invite/InviteTypeUtils"; import { parseOAuth2AuthorizeProps } from "../oauth2/Authorize"; import { OAuth2Scopes } from "../../_bundle/Module8174"; import { makeStorefrontSKUCodedLink } from "../application_storefront/storefrontMessageEmbedCodedLink"; import * as _keysSorter from "../../_bundle/keysSorter"; function $mk73651() { return (a0, a1, a2, a3) => a2 == null ? `${a1}http://${a3}` : a0; } function $mk73652($env) { return (a0) => { const type = a0.type; const r5 = $env.$parent; if (type === (0, r5[0])(r5[1][8]).AST_KEY.LINK && typeof a0.target === "string" && a0.target.length > 0) { $env[0].push(a0.target); } }; } let r16, r17, r89, r105, r122, r136, r148; let parseURLSafely, c2402_4, c2402_5, c2402_6, c2402_7, c2402_8, c2402_9, c2402_10, c2402_11, c2402_12, c2402_13, c2402_14, c2402_15, c2402_16, c2402_17, c2402_18, c2402_19, c2402_20, c2402_21, c2402_22, c2402_23, c2402_24, c2402_25, c2402_26, c2402_27; let $mk73653 = function() { return function coerceLinksToCodedLinks(a0) { if (a0 != null && a0.length !== 0) { let c24946_0 = new Set(); const r24 = []; let c24946_1 = r24; const _loop = function _loop(a0) { const r4 = getPathsFromURL(a0); const { url, inviteHostRemainingPath, templateHostRemainingPath, primaryHostRemainingPath } = r4; if (url != null && url.pathname != null) { if (isBuildOverrideLink(a0)) { const BUILD_OVERRIDE = CodedLinkType.BUILD_OVERRIDE; if (!c24946_0.has(a0)) { c24946_0.add(a0); c24946_1.push({ type: BUILD_OVERRIDE, code: a0, url: a0 }); } } if (isManualBuildOverrideLink(a0)) { const MANUAL_BUILD_OVERRIDE = CodedLinkType.MANUAL_BUILD_OVERRIDE; if (!c24946_0.has(a0)) { c24946_0.add(a0); c24946_1.push({ type: MANUAL_BUILD_OVERRIDE, code: a0, url: a0 }); } } if (isExperimentEmbedURL(a0)) { const EXPERIMENT = CodedLinkType.EXPERIMENT; if (!c24946_0.has(a0)) { c24946_0.add(a0); c24946_1.push({ type: EXPERIMENT, code: a0, url: a0 }); } } const r69 = inviteHostRemainingPath == null ? void 0 : inviteHostRemainingPath.match(c2402_4); L24: { if (r69 != null) { if (url.protocol !== "https:" && url.protocol !== "http:") { break L24; } const code = generateInviteKeyFromUrlParams(inviteHostRemainingPath.substring(1), url.search); const invite = InviteStore.getInvite(code); if (invite != null && isEmbeddedApplicationInvite(invite)) { const EMBEDDED_ACTIVITY_INVITE = CodedLinkType.EMBEDDED_ACTIVITY_INVITE; if (c24946_0.has(code)) { break L24; } c24946_0.add(code); c24946_1.push({ type: EMBEDDED_ACTIVITY_INVITE, code, url: a0 }); break L24; } if (a0.includes("\\")) { return 0; } const INVITE = CodedLinkType.INVITE; if (!c24946_0.has(code)) { c24946_0.add(code); c24946_1.push({ type: INVITE, code, url: a0 }); } } } if ((templateHostRemainingPath == null ? void 0 : templateHostRemainingPath.match(c2402_4)) != null) { const TEMPLATE = CodedLinkType.TEMPLATE; const code2 = templateHostRemainingPath.substring(1); if (!c24946_0.has(code2)) { c24946_0.add(code2); c24946_1.push({ type: TEMPLATE, code: code2, url: a0 }); } } const r141 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_6); if (r141 != null) { const type = r141[1].toUpperCase(); if (type === CodedLinkType.INVITE) { if (a0.includes("\\")) { return 0; } const code4 = generateInviteKeyFromUrlParams(r141[2], url.search); const INVITE2 = CodedLinkType.INVITE; if (!c24946_0.has(code4)) { c24946_0.add(code4); c24946_1.push({ type: INVITE2, code: code4, url: a0 }); } } else { const code3 = r141[2]; if (!c24946_0.has(code3)) { c24946_0.add(code3); c24946_1.push({ type, code: code3, url: a0 }); } } } if ((primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_5)) != null) { const CHANNEL_LINK = CodedLinkType.CHANNEL_LINK; const code5 = primaryHostRemainingPath.replace("/channels/", ""); if (!c24946_0.has(code5)) { c24946_0.add(code5); c24946_1.push({ type: CHANNEL_LINK, code: code5, url: a0 }); } } const pathname = url.pathname; const r205 = pathname == null; let r206 = null; if (!r205) { const r209 = pathname.match(c2402_7); r206 = r209 != null ? r209.length >= 4 ? { guildId: r209[1], guildEventId: r209[2], recurrenceId: r209[4] } : null : null; } if (r206 != null) { const EVENT = CodedLinkType.EVENT; const { guildId, guildEventId } = r206; const concat = HermesInternal.concat; let r227 = ""; const r228 = concat.call("", guildId, "-", guildEventId); if (r206.recurrenceId != null) { r227 = `-${r206.recurrenceId}`; } const code6 = r228 + r227; if (!c24946_0.has(code6)) { c24946_0.add(code6); c24946_1.push({ type: EVENT, code: code6, url: a0 }); } } if ((primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_17)) != null && url.query != null) { const r253 = parseOAuth2AuthorizeProps(url.query); const clientId = r253.clientId; let r255 = clientId == null || clientId === ""; if (!r255) { const scopes = r253.scopes; r255 = scopes == null ? void 0 : scopes.some((scope) => scope !== OAuth2Scopes.APPLICATIONS_COMMANDS); } if (!r255) { const APP_OAUTH2_LINK = CodedLinkType.APP_OAUTH2_LINK; if (!c24946_0.has(clientId)) { c24946_0.add(clientId); c24946_1.push({ type: APP_OAUTH2_LINK, code: clientId, url: a0 }); } } } const r276 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_8); if (r276 != null) { const code7 = r276[2]; const APP_DIRECTORY_PROFILE = CodedLinkType.APP_DIRECTORY_PROFILE; if (!c24946_0.has(code7)) { c24946_0.add(code7); c24946_1.push({ type: APP_DIRECTORY_PROFILE, code: code7, url: a0 }); } } const r294 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_9); if (r294 != null) { const code8 = r294[2]; const r298 = r294[3]; if (r298 != null) { const code9 = makeStorefrontSKUCodedLink(code8, r298); const APP_DIRECTORY_STOREFRONT_SKU = CodedLinkType.APP_DIRECTORY_STOREFRONT_SKU; if (!c24946_0.has(code9)) { c24946_0.add(code9); c24946_1.push({ type: APP_DIRECTORY_STOREFRONT_SKU, code: code9, url: a0 }); } } else { const APP_DIRECTORY_STOREFRONT = CodedLinkType.APP_DIRECTORY_STOREFRONT; if (!c24946_0.has(code8)) { c24946_0.add(code8); c24946_1.push({ type: APP_DIRECTORY_STOREFRONT, code: code8, url: a0 }); } } } const r330 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_10); if (r330 != null) { const code10 = r330[1]; const ACTIVITY_BOOKMARK = CodedLinkType.ACTIVITY_BOOKMARK; if (!c24946_0.has(code10)) { c24946_0.add(code10); c24946_1.push({ type: ACTIVITY_BOOKMARK, code: code10, url: a0 }); } } const r348 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_11); if (r348 != null) { const GUILD_PRODUCT = CodedLinkType.GUILD_PRODUCT; const code11 = `${r348[1]}-${r348[2]}`; if (!c24946_0.has(code11)) { c24946_0.add(code11); c24946_1.push({ type: GUILD_PRODUCT, code: code11, url: a0 }); } } const r373 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_13); if (r373 != null) { const SERVER_SHOP = CodedLinkType.SERVER_SHOP; const code12 = r373[1]; if (!c24946_0.has(code12)) { c24946_0.add(code12); c24946_1.push({ type: SERVER_SHOP, code: code12, url: a0 }); } } const r391 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_12); if (r391 != null) { const SOCIAL_LAYER_STOREFRONT = CodedLinkType.SOCIAL_LAYER_STOREFRONT; const r398 = r391[3]; let r399 = r391[1]; if (r399 == null) { r399 = r391[2]; } const code13 = `${r398}-${r399}`; if (!c24946_0.has(code13)) { c24946_0.add(code13); c24946_1.push({ type: SOCIAL_LAYER_STOREFRONT, code: code13, url: a0 }); } } const primaryHostRemainingPath2 = getPathsFromURL(a0).primaryHostRemainingPath; const r418 = primaryHostRemainingPath2 == null ? void 0 : primaryHostRemainingPath2.match(c2402_14); let code14 = r418 == null ? void 0 : r418[1]; if (code14 == null) { code14 = null; } if (code14 != null) { const QUESTS_EMBED = CodedLinkType.QUESTS_EMBED; if (!c24946_0.has(code14)) { c24946_0.add(code14); c24946_1.push({ type: QUESTS_EMBED, code: code14, url: a0 }); } } const r437 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_16); if (r437 != null) { const GAME_PROFILE = CodedLinkType.GAME_PROFILE; const code15 = r437[1]; if (!c24946_0.has(code15)) { c24946_0.add(code15); c24946_1.push({ type: GAME_PROFILE, code: code15, url: a0 }); } } const r455 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_15); if (r455 != null) { const GAME_SERVER_SHARE = CodedLinkType.GAME_SERVER_SHARE; const code16 = r455[1]; if (!c24946_0.has(code16)) { c24946_0.add(code16); c24946_1.push({ type: GAME_SERVER_SHARE, code: code16, url: a0 }); } } L147: { if (primaryHostRemainingPath === "/shop") { const r475 = url.query != null ? _keysSorter.parse(url.query) : null; let r481 = r475?.tab; if (r481 === CollectibleShopTab.GAME_SHOPS && r475?.applicationId != null && r475?.skuId != null) { const { applicationId, skuId } = r475; if (!(typeof applicationId === "string" ? typeof skuId === "string" : typeof applicationId === "string")) { break L147; } const SOCIAL_LAYER_STOREFRONT_APP = CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP; const code18 = `${skuId}-${applicationId}`; if (c24946_0.has(code18)) { break L147; } c24946_0.add(code18); c24946_1.push({ type: SOCIAL_LAYER_STOREFRONT_APP, code: code18, url: a0 }); break L147; } const hash = url.hash; const r490 = hash == null ? void 0 : hash.match(c2402_18); const COLLECTIBLES_SHOP = CodedLinkType.COLLECTIBLES_SHOP; if (r481 == null) { r481 = ""; } let r498 = r490 == null ? void 0 : r490[1]; if (r498 == null) { r498 = ""; } const code17 = `${r481}-${r498}`; if (!c24946_0.has(code17)) { c24946_0.add(code17); c24946_1.push({ type: COLLECTIBLES_SHOP, code: code17, url: a0 }); } } } return void 0; } return 0; }; for (const item of a0) { _loop(item); } return r24; } return []; }; }; let env2402 = {}; export function getPathsFromURL(a0) { let r14; const url = parseURLSafely(a0); if (url != null && url.pathname != null) { const host = url.host; const r9 = host == null ? void 0 : host.replace(/^www[.]/i, ""); const host3 = c2402_20.host; let inviteHostRemainingPath = null; if (r9 === host3) { let pathname = url.pathname; if (pathname == null) { pathname = ""; } let pathPrefix = c2402_20.pathPrefix; if (pathPrefix == null) { pathPrefix = ""; } const r21 = pathname.startsWith(pathPrefix); inviteHostRemainingPath = null; if (r21) { const r24 = pathname.substring(pathPrefix.length); inviteHostRemainingPath = r24 !== "" ? r24 : null; } } const host4 = url.host; const r30 = host4 == null ? void 0 : host4.replace(/^www[.]/i, ""); const host5 = c2402_21.host; let templateHostRemainingPath = null; if (r30 === host5) { let pathname2 = url.pathname; if (pathname2 == null) { pathname2 = ""; } let pathPrefix2 = c2402_21.pathPrefix; if (pathPrefix2 == null) { pathPrefix2 = ""; } const r39 = pathname2.startsWith(pathPrefix2); templateHostRemainingPath = null; if (r39) { const r42 = pathname2.substring(pathPrefix2.length); templateHostRemainingPath = r42 !== "" ? r42 : null; } } const host6 = url.host; const r48 = host6 == null ? void 0 : host6.replace(/^www[.]/i, ""); const host7 = c2402_22.host; let primaryHostRemainingPath = null; if (r48 === host7) { let pathname3 = url.pathname; if (pathname3 == null) { pathname3 = ""; } let pathPrefix3 = c2402_22.pathPrefix; if (pathPrefix3 == null) { pathPrefix3 = ""; } const r57 = pathname3.startsWith(pathPrefix3); primaryHostRemainingPath = null; if (r57) { const r60 = pathname3.substring(pathPrefix3.length); primaryHostRemainingPath = r60 !== "" ? r60 : null; } } if (primaryHostRemainingPath == null) { const host2 = url.host; const r65 = host2 == null ? void 0 : host2.replace(/^www[.]/i, ""); const host8 = c2402_23.host; let r70 = null; if (r65 === host8) { let pathname4 = url.pathname; if (pathname4 == null) { pathname4 = ""; } let pathPrefix4 = c2402_23.pathPrefix; if (pathPrefix4 == null) { pathPrefix4 = ""; } const r74 = pathname4.startsWith(pathPrefix4); r70 = null; if (r74) { const r77 = pathname4.substring(pathPrefix4.length); r70 = r77 !== "" ? r77 : null; } } primaryHostRemainingPath = r70; } if (primaryHostRemainingPath == null) { const host9 = url.host; const r83 = host9 == null ? void 0 : host9.replace(/^www[.]/i, ""); const host10 = c2402_24.host; let r88 = null; if (r83 === host10) { let pathname5 = url.pathname; if (pathname5 == null) { pathname5 = ""; } let pathPrefix5 = c2402_24.pathPrefix; if (pathPrefix5 == null) { pathPrefix5 = ""; } const r92 = pathname5.startsWith(pathPrefix5); r88 = null; if (r92) { const r95 = pathname5.substring(pathPrefix5.length); r88 = r95 !== "" ? r95 : null; } } primaryHostRemainingPath = r88; } if (primaryHostRemainingPath == null) { const host11 = url.host; const r101 = host11 == null ? void 0 : host11.replace(/^www[.]/i, ""); const host12 = c2402_25.host; let r106 = null; if (r101 === host12) { let pathname6 = url.pathname; if (pathname6 == null) { pathname6 = ""; } let pathPrefix6 = c2402_25.pathPrefix; if (pathPrefix6 == null) { pathPrefix6 = ""; } const r110 = pathname6.startsWith(pathPrefix6); r106 = null; if (r110) { const r113 = pathname6.substring(pathPrefix6.length); r106 = r113 !== "" ? r113 : null; } } primaryHostRemainingPath = r106; } if (primaryHostRemainingPath == null) { const host13 = url.host; const r119 = host13 == null ? void 0 : host13.replace(/^www[.]/i, ""); const host14 = c2402_26.host; let r124 = null; if (r119 === host14) { let pathname7 = url.pathname; if (pathname7 == null) { pathname7 = ""; } let pathPrefix7 = c2402_26.pathPrefix; if (pathPrefix7 == null) { pathPrefix7 = ""; } const r128 = pathname7.startsWith(pathPrefix7); r124 = null; if (r128) { const r131 = pathname7.substring(pathPrefix7.length); r124 = r131 !== "" ? r131 : null; } } primaryHostRemainingPath = r124; } r14 = { url, inviteHostRemainingPath, templateHostRemainingPath, primaryHostRemainingPath }; } else { r14 = { url: null, inviteHostRemainingPath: null, templateHostRemainingPath: null, primaryHostRemainingPath: null }; } return r14; } parseURLSafely = function parseURLSafely(a0) { let r8; try { r8 = parse(a0); } catch ($e) { return null; } return r8; }; c2402_4 = /^\/([a-zA-Z0-9-]+)$/; c2402_5 = /^\/channels\/([0-9]+|@me)\/([0-9]+)$/; c2402_6 = /^\/(invite|template)\/([a-zA-Z0-9-]+)\/?\.?$/; c2402_7 = new RegExp("^/events/(\\d+)(?:/)(\\d+)?((?:/)(\\d+))?"); c2402_8 = /^\/(application-directory|discovery\/applications)\/([0-9-]+)\/?((about|images|privacy)\/?)?$/; c2402_9 = /^\/(application-directory|discovery\/applications)\/([0-9-]+)\/store\/?([0-9-]+)?\/?$/; c2402_10 = /^\/activities\/([0-9-]+)\/?$/; c2402_11 = /^\/channels\/([0-9]+)\/shop\/([0-9]+)$/; c2402_12 = /^(?:\/game-shop\/([0-9]+)|\/channels\/([0-9]+)\/game-shop\/(?:[0-9]+))\/([0-9]+)(?:\/([^\/]+))?$/; c2402_13 = /^\/channels\/([0-9]+)\/shop$/; c2402_14 = /^\/quests\/([0-9-]+)\/?$/; c2402_15 = /^\/game-servers\/share\/([A-Za-z0-9_-]+)$/; c2402_16 = /^\/games\/([0-9]+)(?:\/[A-Za-z0-9-]*)?\/?$/; c2402_17 = /^\/oauth2\/authorize/; c2402_18 = /^#itemSkuId=([0-9]+)$/; c2402_19 = /dev:\/\/[\w-.~:\/?#\[\]@!$&'()*+,;=%]+/i; const INVITE_HOST = window.GLOBAL_ENV.INVITE_HOST; if (INVITE_HOST == null) { r16 = { host: null, pathPrefix: null }; } else if (INVITE_HOST.indexOf("/") >= 0) { const r61 = parse(INVITE_HOST, void 0, true); r16 = { host: r61.host, pathPrefix: r61.pathname }; } else { r16 = { host: INVITE_HOST, pathPrefix: null }; } c2402_20 = r16; const GUILD_TEMPLATE_HOST = window.GLOBAL_ENV.GUILD_TEMPLATE_HOST; if (GUILD_TEMPLATE_HOST == null) { r17 = { host: null, pathPrefix: null }; } else if (GUILD_TEMPLATE_HOST.indexOf("/") >= 0) { const r76 = parse(GUILD_TEMPLATE_HOST, void 0, true); r17 = { host: r76.host, pathPrefix: r76.pathname }; } else { r17 = { host: GUILD_TEMPLATE_HOST, pathPrefix: null }; } c2402_21 = r17; let WEBAPP_ENDPOINT = window.GLOBAL_ENV.WEBAPP_ENDPOINT; if (WEBAPP_ENDPOINT == null) { WEBAPP_ENDPOINT = `//canary.${PRIMARY_DOMAIN}`; } if (WEBAPP_ENDPOINT == null) { r89 = { host: null, pathPrefix: null }; } else if (WEBAPP_ENDPOINT.indexOf("/") >= 0) { const r94 = parse(WEBAPP_ENDPOINT, void 0, true); r89 = { host: r94.host, pathPrefix: r94.pathname }; } else { r89 = { host: WEBAPP_ENDPOINT, pathPrefix: null }; } c2402_22 = r89; const host6 = `//canary.${PRIMARY_DOMAIN}`; if (host6 == null) { r105 = { host: null, pathPrefix: null }; } else if (host6.indexOf("/") >= 0) { const r110 = parse(host6, void 0, true); r105 = { host: r110.host, pathPrefix: r110.pathname }; } else { r105 = { host: host6, pathPrefix: null }; } c2402_23 = r105; const host7 = `//ptb.${PRIMARY_DOMAIN}`; if (host7 == null) { r122 = { host: null, pathPrefix: null }; } else if (host7.indexOf("/") >= 0) { const r127 = parse(host7, void 0, true); r122 = { host: r127.host, pathPrefix: r127.pathname }; } else { r122 = { host: host7, pathPrefix: null }; } c2402_24 = r122; if ("discordapp.com".indexOf("/") >= 0) { const r141 = parse("discordapp.com", void 0, true); r136 = { host: r141.host, pathPrefix: r141.pathname }; } else { r136 = { host: "discordapp.com", pathPrefix: null }; } c2402_25 = r136; if ("discord.com".indexOf("/") >= 0) { const r153 = parse("discord.com", void 0, true); r148 = { host: r153.host, pathPrefix: r153.pathname }; } else { r148 = { host: "discord.com", pathPrefix: null }; } c2402_26 = r148; let host = r16.host; if (host == null) { host = ""; } const r162 = [RegexUtils.escape(host), , , , ,]; let host2 = r17.host; if (host2 == null) { host2 = ""; } r162[1] = RegexUtils.escape(host2); let host3 = r89.host; if (host3 == null) { host3 = ""; } r162[2] = RegexUtils.escape(host3); let host4 = r136.host; if (host4 == null) { host4 = ""; } r162[3] = RegexUtils.escape(host4); let host5 = r148.host; if (host5 == null) { host5 = ""; } const findCodedLinks = function findCodedLinks(a0) { if (a0 == null) { return []; } let env13875; const r7 = env13875 = { $parent: env2402 }; const r13 = a0.replace(c2402_27, $mk73651()); const r19 = _MarkupUtils.default.parseToAST(r13, true, { allowLinks: true }); const r20 = []; env13875[0] = r20; walkAst(r19, $mk73652(r7)); let r28 = r13.match(c2402_19); if (r28 == null) { r28 = []; } const r30 = $mk73653(); const r31 = r20.concat(r28); env13875[0] = r31; return r30(r31).slice(0, 10); }; export function parseQuestsEmbedCode(a0) { const primaryHostRemainingPath = getPathsFromURL(a0).primaryHostRemainingPath; const r8 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_14); let r12 = r8 == null ? void 0 : r8[1]; if (r12 == null) { r12 = null; } return r12; } r162[4] = RegexUtils.escape(host5); c2402_27 = new RegExp(`((https?://[^ ]*)|^|\\s)(${r162.filter(Boolean).join("|")})`, "g"); export default findCodedLinks; export { c2402_19 as DEVLINK_REGEX }; export function remainingPathFromDiscordHostMatch(a0) { const host = a0.host; const r8 = host == null ? void 0 : host.replace(/^www[.]/i, ""); const host3 = c2402_22.host; let r13 = null; if (r8 === host3) { let pathname = a0.pathname; if (pathname == null) { pathname = ""; } let pathPrefix = c2402_22.pathPrefix; if (pathPrefix == null) { pathPrefix = ""; } const r17 = pathname.startsWith(pathPrefix); r13 = null; if (r17) { const r20 = pathname.substring(pathPrefix.length); r13 = r20 !== "" ? r20 : null; } } if (r13 == null) { const host2 = a0.host; const r25 = host2 == null ? void 0 : host2.replace(/^www[.]/i, ""); const host4 = c2402_23.host; let r30 = null; if (r25 === host4) { let pathname2 = a0.pathname; if (pathname2 == null) { pathname2 = ""; } let pathPrefix2 = c2402_23.pathPrefix; if (pathPrefix2 == null) { pathPrefix2 = ""; } const r34 = pathname2.startsWith(pathPrefix2); r30 = null; if (r34) { const r37 = pathname2.substring(pathPrefix2.length); r30 = r37 !== "" ? r37 : null; } } r13 = r30; } if (r13 == null) { const host5 = a0.host; const r43 = host5 == null ? void 0 : host5.replace(/^www[.]/i, ""); const host6 = c2402_24.host; let r48 = null; if (r43 === host6) { let pathname3 = a0.pathname; if (pathname3 == null) { pathname3 = ""; } let pathPrefix3 = c2402_24.pathPrefix; if (pathPrefix3 == null) { pathPrefix3 = ""; } const r52 = pathname3.startsWith(pathPrefix3); r48 = null; if (r52) { const r55 = pathname3.substring(pathPrefix3.length); r48 = r55 !== "" ? r55 : null; } } r13 = r48; } if (r13 == null) { const host7 = a0.host; const r61 = host7 == null ? void 0 : host7.replace(/^www[.]/i, ""); const host8 = c2402_25.host; let r66 = null; if (r61 === host8) { let pathname4 = a0.pathname; if (pathname4 == null) { pathname4 = ""; } let pathPrefix4 = c2402_25.pathPrefix; if (pathPrefix4 == null) { pathPrefix4 = ""; } const r70 = pathname4.startsWith(pathPrefix4); r66 = null; if (r70) { const r73 = pathname4.substring(pathPrefix4.length); r66 = r73 !== "" ? r73 : null; } } r13 = r66; } if (r13 == null) { const host9 = a0.host; const r7 = host9 == null ? void 0 : host9.replace(/^www[.]/i, ""); const host10 = c2402_26.host; let r83 = null; if (r7 === host10) { let pathname5 = a0.pathname; if (pathname5 == null) { pathname5 = ""; } let pathPrefix5 = c2402_26.pathPrefix; if (pathPrefix5 == null) { pathPrefix5 = ""; } const r87 = pathname5.startsWith(pathPrefix5); r83 = null; if (r87) { const r90 = pathname5.substring(pathPrefix5.length); r83 = r90 !== "" ? r90 : null; } } r13 = r83; } return r13; } export function isSuspiciousCodedLink(a0) { if (a0.includes("\\")) { const r15 = parseURLSafely(a0); let c13876_0 = r15; if (r15 == null) { return false; } const host = r15.host; if ((host == null ? void 0 : host.replace(/^www[.]/i, "")) === c2402_20.host) { return true; } if ([c2402_22, c2402_23, c2402_24, c2402_25, c2402_26].some((item) => { const host = c13876_0.host; return (host == null ? void 0 : host.replace(/^www[.]/i, "")) === item.host; })) { const pathname = r15.pathname; let r30 = pathname == null ? void 0 : pathname.toUpperCase().includes(CodedLinkType.INVITE); if (r30 == null) { r30 = false; } return r30; } } return false; } export function parseGameServerShareCode(a0) { const primaryHostRemainingPath = getPathsFromURL(a0).primaryHostRemainingPath; const r8 = primaryHostRemainingPath == null ? void 0 : primaryHostRemainingPath.match(c2402_15); let r12 = r8 == null ? void 0 : r8[1]; if (r12 == null) { r12 = null; } return r12; } export { parseURLSafely }; export function findCodedLink(a0) { let r34; if (a0 == null) { r34 = []; } else { let env13877; const r7 = env13877 = { $parent: env2402 }; const r13 = a0.replace(c2402_27, $mk73651()); const r19 = _MarkupUtils.default.parseToAST(r13, true, { allowLinks: true }); const r20 = []; env13877[0] = r20; walkAst(r19, $mk73652(r7)); let r28 = r13.match(c2402_19); if (r28 == null) { r28 = []; } const r30 = $mk73653(); const r31 = r20.concat(r28); env13877[0] = r31; r34 = r30(r31).slice(0, 10); } return r34[0]; }