420 lines
21 KiB
TypeScript
420 lines
21 KiB
TypeScript
/* Metro module 4141; source: utils/StoreUtils.tsx; dependencies: [5, 1226, 3804, 3805, 3808, 661, 4142, 4140, 4221, 1457, 4223, 507, 477, 1244, 2] */
|
|
import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import AuthenticationStore from '../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
|
|
import BillingInfoStore from '../stores/billing/BillingInfoStore.tsx'; /* Metro dependency 3804 */
|
|
import PaymentSourceStore from '../stores/billing/PaymentSourceStore.tsx'; /* Metro dependency 3805 */
|
|
import SubscriptionStore from '../stores/billing/SubscriptionStore.tsx'; /* Metro dependency 3808 */
|
|
import Module04142 from '../by-id/module-04142.js'; /* Metro dependency 4142 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as PlatformUtilsModule from './PlatformUtils.tsx'; /* Metro dependency 477 */
|
|
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as IndexNativeModule from '../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
|
|
function _fun34359(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#34359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:6, offset: 0x010541d4, size: 374 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ConstantsModule;
|
|
const env0_7 = value.Endpoints;
|
|
const env0_8 = value.OperatingSystems;
|
|
(Module04142).shim();
|
|
let r3 = !(require(4140) /* metro dependency 4140: PlatformUtils */).isMobile && !(require(4140) /* metro dependency 4140: PlatformUtils */).isTablet;
|
|
if (r3) {
|
|
value = require(4221) /* metro dependency 4221: BrowserUtils */;
|
|
value = value.getChromeVersion();
|
|
value = value !== -1;
|
|
r3 = value;
|
|
}
|
|
(FileImportTrackerModule).fileFinishedImporting('utils/StoreUtils.tsx');
|
|
exports.SUPPORTS_WEBP = r3;
|
|
exports.getAssetURL = getAssetURL;
|
|
exports.httpGetWithCountryCodeQuery = function() {
|
|
return _httpGetWithCountryCodeQuery.apply(this, arguments);
|
|
};
|
|
exports.nativePlatformTypeToSKUOperatingSystem = nativePlatformTypeToSKUOperatingSystem;
|
|
exports.skuOperatingSystemToText = skuOperatingSystemToText;
|
|
exports.getPrimarySKUForApplication = function(a0, a1, a2) {
|
|
var r0;
|
|
var value = a1.getApplication(a0);
|
|
var value2 = null;
|
|
if (value2 == value) {
|
|
r0 = value2;
|
|
} else if (value2 == value.primarySkuId) {
|
|
r0 = value2;
|
|
} else {
|
|
value = a2.get(value.primarySkuId);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
function _httpGetWithCountryCodeQuery() { // fn#34360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:282, offset: 0x0105434a, size: 48 bytes, params: 1, frame: 14
|
|
return Module00005(_fun34362).apply(this, arguments);
|
|
async function _fun34362(a0) { // fn#34362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:361, offset: 0x0105438c, size: 628 bytes, params: 2, frame: 21
|
|
var r11;
|
|
var id;
|
|
var r5;
|
|
var object;
|
|
var push;
|
|
var value11;
|
|
var Promise;
|
|
var race;
|
|
var items2;
|
|
var Promise3;
|
|
var value13;
|
|
var promise;
|
|
var defaultBillingCountryCode;
|
|
var defaultPaymentSource;
|
|
var value18;
|
|
var premiumTypeSubscription;
|
|
var ipCountryCode;
|
|
var value22;
|
|
var query;
|
|
var object3;
|
|
let value = a0;
|
|
let value2 = a1;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
const value5 = undefined;
|
|
let r4 = !(value2 !== value5) || value2;
|
|
await value5;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
let binding = env2_3;
|
|
if (r4) {
|
|
if (binding.isAuthenticated()) {
|
|
object = [];
|
|
if (!env2_5.hasFetchedPaymentSources) {
|
|
object.push(env2_4.paymentSourcesFetchRequest ?? env2_0(env2_1[10]).fetchPaymentSources());
|
|
}
|
|
if (!env2_4.ipCountryCodeLoaded) {
|
|
push = object.push;
|
|
value11 = env2_0(env2_1[10]);
|
|
Reflect.apply(push, object, [value11.fetchIpCountryCode()]);
|
|
}
|
|
object.push((() => {
|
|
var Promise = global.Promise;
|
|
var value = _fun34364();
|
|
var value2 = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
value = new Promise(value);
|
|
return value instanceof Object ? value : value2;
|
|
})());
|
|
Promise = global.Promise;
|
|
race = Promise.race;
|
|
items2 = [global.Promise.allSettled(object)];
|
|
Promise3 = global.Promise;
|
|
value13 = Object.create(Promise3.prototype, {constructor: {value: Promise3}});
|
|
promise = new Promise3(function(a0) {
|
|
return (0, global.setTimeout)(a0, 10000);
|
|
});
|
|
items2[1] = promise instanceof Object ? promise : value13;
|
|
await Reflect.apply(race, Promise, [items2]);
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
r11 = object;
|
|
binding = env2_5;
|
|
defaultBillingCountryCode = binding.getDefaultBillingCountryCode();
|
|
defaultPaymentSource = env2_5.defaultPaymentSource;
|
|
value18 = null;
|
|
id = value18 == defaultPaymentSource ? value5 : defaultPaymentSource.id;
|
|
r4 = value18 != id ? id : value18;
|
|
binding = env2_6;
|
|
premiumTypeSubscription = binding.getPremiumTypeSubscription();
|
|
r4 = value18 != premiumTypeSubscription && value18 != premiumTypeSubscription.paymentSourceId ? premiumTypeSubscription.paymentSourceId : r4;
|
|
if (value18 !== defaultBillingCountryCode) {
|
|
r5 = defaultBillingCountryCode;
|
|
} else {
|
|
ipCountryCode = env2_4.ipCountryCode;
|
|
value22 = value18 != ipCountryCode;
|
|
r5 = value22 ? ipCountryCode : value18;
|
|
r11 = value22;
|
|
}
|
|
object = {};
|
|
if (value18 != r5) {
|
|
object.country_code = r5;
|
|
}
|
|
if (value18 != r4) {
|
|
object.payment_source_id = r4;
|
|
}
|
|
if (value18 != r5) {
|
|
r4 = typeof value !== 'string' ? value : {'url': null, 'oldFormErrors': true, 'rejectWithError': false,
|
|
url: value};
|
|
query = r4.query;
|
|
if (typeof query === 'string') {
|
|
throw new global.Error('string query not supported');
|
|
}
|
|
object3 = {};
|
|
copyDataProperties(object3, object, r11);
|
|
query = r4.query;
|
|
copyDataProperties(object3, query, r11);
|
|
r4.query = object3;
|
|
return env2_0(env2_1[11]).HTTP.get(r4);
|
|
}
|
|
if (value18 == r4) {
|
|
return env2_0(env2_1[11]).HTTP.get(value);
|
|
}
|
|
r4 = typeof value !== 'string' ? value : {'url': null, 'oldFormErrors': true, 'rejectWithError': false,
|
|
url: value};
|
|
query = r4.query;
|
|
if (typeof query === 'string') {
|
|
throw new global.Error('string query not supported');
|
|
}
|
|
object3 = {};
|
|
copyDataProperties(object3, object, r11);
|
|
query = r4.query;
|
|
copyDataProperties(object3, query, r11);
|
|
r4.query = object3;
|
|
r5 = r4;
|
|
binding = env2_0;
|
|
return binding(env2_1[11]).HTTP.get(r5);
|
|
}
|
|
binding = env2_5;
|
|
defaultBillingCountryCode = binding.getDefaultBillingCountryCode();
|
|
defaultPaymentSource = env2_5.defaultPaymentSource;
|
|
value18 = null;
|
|
id = value18 == defaultPaymentSource ? value5 : defaultPaymentSource.id;
|
|
r4 = value18 != id ? id : value18;
|
|
binding = env2_6;
|
|
premiumTypeSubscription = binding.getPremiumTypeSubscription();
|
|
r4 = value18 != premiumTypeSubscription && value18 != premiumTypeSubscription.paymentSourceId ? premiumTypeSubscription.paymentSourceId : r4;
|
|
if (value18 !== defaultBillingCountryCode) {
|
|
r5 = defaultBillingCountryCode;
|
|
} else {
|
|
ipCountryCode = env2_4.ipCountryCode;
|
|
value22 = value18 != ipCountryCode;
|
|
r5 = value22 ? ipCountryCode : value18;
|
|
r11 = value22;
|
|
}
|
|
object = {};
|
|
if (value18 != r5) {
|
|
object.country_code = r5;
|
|
}
|
|
if (value18 != r4) {
|
|
object.payment_source_id = r4;
|
|
}
|
|
if (value18 != r5) {
|
|
r4 = typeof value !== 'string' ? value : {'url': null, 'oldFormErrors': true, 'rejectWithError': false,
|
|
url: value};
|
|
query = r4.query;
|
|
if (typeof query === 'string') {
|
|
throw new global.Error('string query not supported');
|
|
}
|
|
object3 = {};
|
|
copyDataProperties(object3, object, r11);
|
|
query = r4.query;
|
|
copyDataProperties(object3, query, r11);
|
|
r4.query = object3;
|
|
return env2_0(env2_1[11]).HTTP.get(r4);
|
|
}
|
|
if (value18 == r4) {
|
|
return env2_0(env2_1[11]).HTTP.get(value);
|
|
}
|
|
r4 = typeof value !== 'string' ? value : {'url': null, 'oldFormErrors': true, 'rejectWithError': false,
|
|
url: value};
|
|
query = r4.query;
|
|
if (typeof query === 'string') {
|
|
throw new global.Error('string query not supported');
|
|
}
|
|
object3 = {};
|
|
copyDataProperties(object3, object, r11);
|
|
query = r4.query;
|
|
copyDataProperties(object3, query, r11);
|
|
r4.query = object3;
|
|
r5 = r4;
|
|
binding = env2_0;
|
|
return binding(env2_1[11]).HTTP.get(r5);
|
|
}
|
|
defaultBillingCountryCode = env2_5.getDefaultBillingCountryCode();
|
|
defaultPaymentSource = env2_5.defaultPaymentSource;
|
|
value18 = null;
|
|
id = value18 == defaultPaymentSource ? value5 : defaultPaymentSource.id;
|
|
r4 = value18 != id ? id : value18;
|
|
premiumTypeSubscription = env2_6.getPremiumTypeSubscription();
|
|
r4 = value18 != premiumTypeSubscription && value18 != premiumTypeSubscription.paymentSourceId ? premiumTypeSubscription.paymentSourceId : r4;
|
|
if (value18 !== defaultBillingCountryCode) {
|
|
r5 = defaultBillingCountryCode;
|
|
} else {
|
|
ipCountryCode = env2_4.ipCountryCode;
|
|
value22 = value18 != ipCountryCode;
|
|
r5 = value22 ? ipCountryCode : value18;
|
|
r11 = value22;
|
|
}
|
|
object = {};
|
|
if (value18 != r5) {
|
|
object.country_code = r5;
|
|
}
|
|
if (value18 != r4) {
|
|
object.payment_source_id = r4;
|
|
}
|
|
if (value18 != r5) {
|
|
r4 = typeof value !== 'string' ? value : {'url': null, 'oldFormErrors': true, 'rejectWithError': false,
|
|
url: value};
|
|
query = r4.query;
|
|
if (typeof query === 'string') {
|
|
throw new global.Error('string query not supported');
|
|
}
|
|
object3 = {};
|
|
copyDataProperties(object3, object, r11);
|
|
query = r4.query;
|
|
copyDataProperties(object3, query, r11);
|
|
r4.query = object3;
|
|
return env2_0(env2_1[11]).HTTP.get(r4);
|
|
}
|
|
if (value18 == r4) {
|
|
return env2_0(env2_1[11]).HTTP.get(value);
|
|
}
|
|
r4 = typeof value !== 'string' ? value : {'url': null, 'oldFormErrors': true, 'rejectWithError': false, url: value};
|
|
if (typeof r4.query === 'string') {
|
|
throw new global.Error('string query not supported');
|
|
}
|
|
object3 = {};
|
|
copyDataProperties(object3, object, r11);
|
|
copyDataProperties(object3, r4.query, r11);
|
|
r4.query = object3;
|
|
r5 = r4;
|
|
const HTTP = env2_0(env2_1[11]).HTTP;
|
|
return HTTP.get(r5);
|
|
function waitForSubscriptionsToBeFetched() { // fn#34363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:608, offset: 0x01054600, size: 43 bytes, params: 1, frame: 11
|
|
const Promise = global.Promise;
|
|
const value = _fun34364();
|
|
const value2 = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
const promise = new Promise(value);
|
|
return promise instanceof Object ? promise : value2;
|
|
function _fun34364() { // fn#34364, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:670, offset: 0x0105462b, size: 32 bytes, params: 1, frame: 12
|
|
const env0_0 = env4_2(_fun34365);
|
|
return _fun34369;
|
|
function* _fun34365(a0) { // fn#34365, offset: 0x0105464b, size: 18 bytes, params: 2, frame: 2
|
|
return _fun34366;
|
|
function* _fun34366(a0) { // fn#34366, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:690, offset: 0x0105465d, size: 131 bytes, params: 2, frame: 14
|
|
var environment;
|
|
if (true) {
|
|
var env0_0 = a0;
|
|
var wait_343672 = wait_34367;
|
|
value = environment.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__;
|
|
var binding = env6_6;
|
|
if (!binding.hasFetchedSubscriptions()) {
|
|
if (env6_4.isSubscriptionFetching) {
|
|
wait_343672();
|
|
return undefined;
|
|
}
|
|
value = env6_0(env6_1[10]);
|
|
yield value.fetchSubscriptions();
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
}
|
|
a0();
|
|
}
|
|
function wait_34367() { // fn#34367, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:772, offset: 0x010546e0, size: 58 bytes, params: 1, frame: 13
|
|
if (env7_4.isSubscriptionFetching) {
|
|
global.setTimeout(wait_34367, 50);
|
|
} else {
|
|
env0_0();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function wait() { // fn#34368, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:772, offset: 0x0105471a, size: 58 bytes, params: 1, frame: 13
|
|
if (env6_4.isSubscriptionFetching) {
|
|
global.setTimeout(wait, 50);
|
|
} else {
|
|
env6_2();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function _fun34369() { // fn#34369, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:899, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
|
|
return env0_0.apply(this, arguments);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function getAssetURL(a0, a1, a2, a3) { // fn#34371, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:1701, offset: 0x0105476f, size: 374 bytes, params: 5, frame: 31
|
|
var r0;
|
|
var API_ENDPOINT;
|
|
var getBestMediaProxySize;
|
|
var moduleValue;
|
|
let value = a1;
|
|
const value2 = a3;
|
|
const GLOBAL_ENV = global.window.GLOBAL_ENV;
|
|
const CDN_HOST = GLOBAL_ENV.CDN_HOST;
|
|
let r13 = value2 ?? ((value.mimeType || value.mime_type) === 'video/quicktime' || (value.mimeType || value.mime_type) === 'video/mp4' ? 'mp4' : (value.mimeType || value.mime_type) === 'image/gif' ? 'gif' : 'webp');
|
|
let r2 = r13 !== 'webp' || env0_9;
|
|
r13 = !r2 ? 'png' : r13;
|
|
const r11 = typeof value === 'string' ? value : value.id;
|
|
if (CDN_HOST != null) {
|
|
r2 = '' + 'https:' + '//' + CDN_HOST + '/app-assets/' + a0 + '/store/' + r11 + '.' + r13;
|
|
} else {
|
|
API_ENDPOINT = global.window.GLOBAL_ENV.API_ENDPOINT;
|
|
value = Endpoints.STORE_ASSET(a0, r11, r13);
|
|
value = '' + 'https:' + API_ENDPOINT + value;
|
|
r2 = value;
|
|
}
|
|
if (a2 == null) {
|
|
r0 = r2;
|
|
} else {
|
|
value = require(1457) /* metro dependency 1457: ImageLoaderUtils */;
|
|
getBestMediaProxySize = value.getBestMediaProxySize;
|
|
moduleValue = require(1457) /* metro dependency 1457: ImageLoaderUtils */;
|
|
value = Reflect.apply(getBestMediaProxySize, value, [a2 * moduleValue.getDevicePixelRatio()]);
|
|
value = r2 + ('?size=' + value);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function nativePlatformTypeToSKUOperatingSystem(a0) { // fn#34373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:2394, offset: 0x010548e5, size: 150 bytes, params: 2, frame: 14
|
|
const PlatformTypes = (PlatformUtilsModule).PlatformTypes;
|
|
const WINDOWS = PlatformTypes.WINDOWS;
|
|
if (WINDOWS === a0) {
|
|
return OperatingSystems.WINDOWS;
|
|
}
|
|
const OSX = PlatformTypes.OSX;
|
|
if (OSX === a0) {
|
|
return OperatingSystems.MACOS;
|
|
}
|
|
const LINUX = PlatformTypes.LINUX;
|
|
if (LINUX === a0) {
|
|
return OperatingSystems.LINUX;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function skuOperatingSystemToText(a0) { // fn#34374, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4312:2653, offset: 0x0105497b, size: 289 bytes, params: 2, frame: 15
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
const WINDOWS = OperatingSystems.WINDOWS;
|
|
if (WINDOWS === a0) {
|
|
return intl.string(t['0/xHFO']);
|
|
}
|
|
const MACOS = OperatingSystems.MACOS;
|
|
if (MACOS === a0) {
|
|
return intl.string(t.E4u4n5);
|
|
}
|
|
const LINUX = OperatingSystems.LINUX;
|
|
if (LINUX === a0) {
|
|
return intl.string(t.tcawo3);
|
|
}
|
|
const Error = global.Error;
|
|
const value = 'Unknown operating system value: ' + a0;
|
|
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
|
|
const error = new Error();
|
|
throw error instanceof Object ? error : value2;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun34359, 4141, [5, 1226, 3804, 3805, 3808, 661, 4142, 4140, 4221, 1457, 4223, 507, 477, 1244,
|
|
2]) /* metro module 4141, dependencies: [5, 1226, 3804, 3805, 3808, 661, 4142, 4140, 4221, 1457, 4223, 507, 477, 1244, 2] */;
|