// Metro module 13570 (f13571). import ApplicationStore from "../../../../applications/ApplicationStore"; import { ApplicationFlags, ComponentActions, RPCErrors } from "../../../../../Constants"; import RPCError from "../../../RPCError"; import { hasApplicationFlag } from "../../../../applications/utils/ApplicationFlagUtils"; import { ComponentDispatch } from "../../../../../utils/ComponentDispatchUtils"; import AuthCommandsFactory from "../../../server/commands/AuthCommandsFactory"; const r23 = AuthCommandsFactory(({ clientId, authorizations, scopes, parsedPermissions, responseType, redirectUri, codeChallenge, codeChallengeMethod, state, guildId, channelId, prompt, disableGuildSelect, disclosures, integrationType }) => new Promise((c27515_0, c27515_1) => { let r12 = (integrationType != null ? authorizations == null ? void 0 : authorizations.get(integrationType) : void 0)?.application; if (r12 == null) { r12 = ApplicationStore.getApplication(clientId); } let scopes2 = scopes; if (scopes == null) { scopes2 = []; } ComponentDispatch.dispatch(ComponentActions.SHOW_OAUTH2_MODAL, { clientId, scopes: scopes2, responseType, redirectUri, codeChallenge, codeChallengeMethod, state, guildId, channelId, permissions: parsedPermissions, prompt, disableGuildSelect: typeof disableGuildSelect !== "boolean" ? disableGuildSelect === "true" : disableGuildSelect, showLogout: false, callback: function callback(a0) { if (a0.location != null) { c27515_0(a0.location); } else { c27515_1(new RPCError({ errorCode: RPCErrors.OAUTH2_ERROR }, "User cancelled authorization")); } }, isEmbeddedFlow: hasApplicationFlag(r12, ApplicationFlags.EMBEDDED), disclosures, integrationType }); }), function onAuthorizeValidationPassed() {}); export default r23;