/* Metro module 7337; source: unknown; dependencies: [5, 27, 7338, 7339, 7344, 7345, 7346, 7347, 7348] */ function _fun59054(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#59054, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:6, offset: 0x016e032c, size: 445 bytes, params: 8, frame: 19 let env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const value = require(27) /* metro dependency 27 */; const NativeModules = value.NativeModules; value.Platform; NativeModules.RNIapIos; NativeModules.RNIapIosSk2; const env0_4 = NativeModules.RNIapModule; const env0_5 = NativeModules.RNIapAmazonModule; const ProductType = (require(7338) /* metro dependency 7338 */).ProductType; const env0_6 = ProductType.subs; const env0_7 = ProductType.inapp; const addSubscriptionPlatform = function(a0, a1) { var env0_0 = a1; return a0.map(_fun59056); }; exports.IapAndroid = importAll(7346) /* metro dependency 7346 */; exports.IapAmazon = importAll(7345) /* metro dependency 7345 */; exports.IapIos = importAll(7347) /* metro dependency 7347 */; exports.IapIosSk2 = importAll(7348) /* metro dependency 7348 */; exports.isIosStorekit2 = (require(7339) /* metro dependency 7339 */).isIosStorekit2; exports.setup = setup_59057; exports.initConnection = initConnection; exports.endConnection = endConnection; exports.flushFailedPurchasesCachedAsPendingAndroid = flushFailedPurchasesCachedAsPendingAndroid; exports.getProducts = getProducts; exports.getSubscriptions = getSubscriptions; exports.getPurchaseHistory = getPurchaseHistory; exports.getAvailablePurchases = getAvailablePurchases; exports.requestPurchase = requestPurchase; exports.requestSubscription = requestSubscription; exports.finishTransaction = function({purchase, isConsumable, developerPayloadAndroid}) { var env0_0 = developerPayloadAndroid(_fun59088); return _fun59090(); }; exports.deepLinkToSubscriptions = deepLinkToSubscriptions; exports.getStorefront = getStorefront; } function addSubscriptionPlatform(a0, a1) { // fn#59055, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:267, offset: 0x016e04e9, size: 29 bytes, params: 3, frame: 11 const env0_0 = a1; return a0.map(function(a0) { var Object = global.Object; return Object.assign({}, a0, {platform: require}); }); } function setup_59057() { // fn#59057, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:501, offset: 0x016e052f, size: 182 bytes, params: 1, frame: 13 const storekitMode = (arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}).storekitMode; const value = 'STOREKIT1_MODE'; const r2 = storekitMode === undefined ? value : storekitMode; if (value === r2) { (require(7339) /* metro dependency 7339 */).storekit1Mode(); } else if (r2 === 'STOREKIT2_MODE') { (require(7339) /* metro dependency 7339 */).storekit2Mode(); } else if (r2 === 'STOREKIT_HYBRID_MODE') { (require(7339) /* metro dependency 7339 */).storekitHybridMode(); } } function initConnection() { // fn#59058, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:812, offset: 0x016e05e5, size: 47 bytes, params: 1, frame: 11 let value = require(7339) /* metro dependency 7339 */; value = value.getNativeModule(); return value.initConnection(); } function endConnection() { // fn#59059, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:905, offset: 0x016e0614, size: 47 bytes, params: 1, frame: 11 let value = require(7339) /* metro dependency 7339 */; value = value.getNativeModule(); return value.endConnection(); } function flushFailedPurchasesCachedAsPendingAndroid() { // fn#59060, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:1025, offset: 0x016e0643, size: 49 bytes, params: 1, frame: 11 let value = require(7339) /* metro dependency 7339 */; value = value.getAndroidModule(); return value.flushFailedPurchasesCachedAsPending(); } function getProducts({skus}) { // fn#59061, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:1166, offset: 0x016e0674, size: 90 bytes, params: 2, frame: 13 var r0; if (skus == null) { r0 = global.Promise.reject('"skus" is required'); } else if (skus.length) { var env0_0 = env0_3(_fun59063); r0 = getProductsAndroid(); } else { r0 = global.Promise.reject('"skus" is required'); } return r0; } function getSubscriptions({skus}) { // fn#59065, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:1579, offset: 0x016e0766, size: 90 bytes, params: 2, frame: 13 var r0; if (skus == null) { r0 = global.Promise.reject('"skus" is required'); } else if (skus.length) { var env0_0 = env0_3(_fun59067); r0 = getSubscriptionsAndroid(); } else { r0 = global.Promise.reject('"skus" is required'); } return r0; } function getPurchaseHistory() { // fn#59069, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:2254, offset: 0x016e0904, size: 81 bytes, params: 1, frame: 14 const r2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; r2.alsoPublishToEventListener; r2.automaticallyFinishRestoredTransactions; r2.onlyIncludeActiveItems; const env0_0 = env0_3(_fun59071); return getPurchaseHistoryAndroid(); } function getAvailablePurchases() { // fn#59073, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:2731, offset: 0x016e09dd, size: 81 bytes, params: 1, frame: 14 const r2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; r2.alsoPublishToEventListener; r2.automaticallyFinishRestoredTransactions; r2.onlyIncludeActiveItems; const env0_0 = env0_3(_fun59075); return getAvailablePurchasesAndroid(); } function requestPurchase(a0) { // fn#59077, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:3203, offset: 0x016e0ab6, size: 43 bytes, params: 2, frame: 12 const env0_0 = a0; const env0_1 = env0_3(_fun59079); return requestPurchaseAndroid(); } function requestSubscription(a0) { // fn#59081, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:3736, offset: 0x016e0c0f, size: 43 bytes, params: 2, frame: 12 const env0_0 = a0; const env0_1 = env0_3(_fun59083); return requestSubscriptionAndroid(); } function finishTransaction({purchase, isConsumable, developerPayloadAndroid}) { // fn#59087, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:4596, offset: 0x016e0dfe, size: 69 bytes, params: 2, frame: 12 const env0_0 = developerPayloadAndroid(_fun59089); return finishTransactionAndroid(); } function deepLinkToSubscriptions({sku, isAmazonDevice}) { // fn#59091, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:5275, offset: 0x016e0fc1, size: 69 bytes, params: 2, frame: 13 const env0_2 = isAmazonDevice === undefined || isAmazonDevice; const env0_0 = env0_3(_fun59093); return deepLinkToSubscriptionsAndroid(); } function getStorefront() { // fn#59095, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:5738, offset: 0x016e10d9, size: 36 bytes, params: 1, frame: 12 const env0_0 = env0_3(_fun59097); return getStorefrontAndroid(); } function* _fun59063() { // fn#59063, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:1236, offset: 0x016e06d7, size: 143 bytes, params: 1, frame: 17 if (false) { return undefined; } value = environment.__proto__.__proto__; let binding = env2_0; const androidModule = binding(env2_2[3]).getAndroidModule(); const getItemsByType = androidModule.getItemsByType; yield Reflect.apply(getItemsByType, androidModule, [env2_7, importAll]); const value6 = undefined; if (false) { return value6; } const map = value6.map; binding = env2_0; const binding2 = env2_2; return binding(binding2[3]).fillProductsWithAdditionalData(Reflect.apply(map, value6, [binding(binding2[4]).singleProductAndroidMap])); } function* _fun59067() { // fn#59067, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:1654, offset: 0x016e07c9, size: 315 bytes, params: 1, frame: 19 var value11; var value12; if (false) { return undefined; } value = environment.__proto__.__proto__; let binding = env2_0; const binding2 = env2_2; const androidModuleType = binding(binding2[3]).getAndroidModuleType(); const androidModule = binding(binding2[3]).getAndroidModule(); const getItemsByType = androidModule.getItemsByType; yield Reflect.apply(getItemsByType, androidModule, [env2_6, importAll]); const value8 = undefined; if (false) { return value8; } if (androidModuleType === 'android') { return env2_8(value8, env2_0(env2_2[2]).SubscriptionPlatform.android); } if (androidModuleType === 'amazon') { binding = env2_0; value11 = binding(env2_2[3]); yield value11.fillProductsWithAdditionalData(value8); value12 = undefined; if (false) { return value12; } binding = env2_8; return binding(value12, env2_0(env2_2[2]).SubscriptionPlatform.amazon); } const Error = global.Error; value = 'getSubscriptions received unknown platform ' + androidModuleType + '. Verify the logic in getAndroidModuleType'; const value10 = Object.create(Error.prototype, {constructor: {value: Error}}); const error = new Error(value); throw error instanceof Object ? error : value10; } function* _fun59071() { // fn#59071, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:2458, offset: 0x016e095e, size: 127 bytes, params: 1, frame: 14 var binding; if (false) { return undefined; } value = environment.__proto__.__proto__; if (env2_5) { binding = env2_5; yield binding.getAvailableItems(); return undefined; } binding = env2_4; let getPurchaseHistoryByType = binding.getPurchaseHistoryByType; yield Reflect.apply(getPurchaseHistoryByType, binding, [env2_7]); const value3 = undefined; if (false) { return value3; } binding = env2_4; getPurchaseHistoryByType = binding.getPurchaseHistoryByType; yield Reflect.apply(getPurchaseHistoryByType, binding, [env2_6]); value = undefined; if (false) { return value; } return value3.concat(value); } function* _fun59075() { // fn#59075, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:2938, offset: 0x016e0a37, size: 127 bytes, params: 1, frame: 14 var binding; if (false) { return undefined; } value = environment.__proto__.__proto__; if (env2_5) { binding = env2_5; yield binding.getAvailableItems(); return undefined; } binding = env2_4; let getAvailableItemsByType = binding.getAvailableItemsByType; yield Reflect.apply(getAvailableItemsByType, binding, [env2_7]); const value3 = undefined; if (false) { return value3; } binding = env2_4; getAvailableItemsByType = binding.getAvailableItemsByType; yield Reflect.apply(getAvailableItemsByType, binding, [env2_6]); value = undefined; if (false) { return value; } return value3.concat(value); } function* _fun59079() { // fn#59079, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:3243, offset: 0x016e0aea, size: 293 bytes, params: 1, frame: 29 var skus; var obfuscatedAccountIdAndroid; var obfuscatedProfileIdAndroid; var isOfferPersonalized; if (false) { return undefined; } value = environment.__proto__.__proto__; let binding = env2_0; if (binding(env2_2[3]).isAmazon) { if ('sku' in require) { return env2_5.buyItemByType(require.sku, ''); } throw new global.Error('sku is required for Amazon purchase'); } if ('skus' in require) { skus = require.skus; if (skus.length) { skus = require.skus; obfuscatedAccountIdAndroid = require.obfuscatedAccountIdAndroid; obfuscatedProfileIdAndroid = require.obfuscatedProfileIdAndroid; isOfferPersonalized = require.isOfferPersonalized; binding = env2_4; return binding.buyItemByType(env2_7, skus, undefined, -1, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, [], isOfferPersonalized != null && isOfferPersonalized); } throw new global.Error('skus is required for Android purchase'); } const Error = global.Error; throw new Error('skus is required for Android purchase'); } function* _fun59083() { // fn#59083, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:3780, offset: 0x016e0c43, size: 419 bytes, params: 1, frame: 34 var environment; var r12; var subscriptionOffers; var purchaseTokenAndroid; var replacementModeAndroid; var obfuscatedAccountIdAndroid; var obfuscatedProfileIdAndroid; var isOfferPersonalized; if (false) { return undefined; } value = environment.__proto__.__proto__; let binding = env2_0; const value3 = undefined; if (binding(env2_2[3]).isAmazon) { if ('sku' in require) { return env2_5.buyItemByType(require.sku, 'prorationModeAmazon' in require && require.prorationModeAmazon ? require.prorationModeAmazon : ''); } throw new global.Error('sku is required for Amazon subscriptions'); } if ('subscriptionOffers' in require) { subscriptionOffers = require.subscriptionOffers; if (subscriptionOffers.length === 0) { throw new global.Error('subscriptionOffers are required for Google Play subscriptions'); } subscriptionOffers = require.subscriptionOffers; purchaseTokenAndroid = require.purchaseTokenAndroid; replacementModeAndroid = require.replacementModeAndroid; r12 = value3 === replacementModeAndroid ? -1 : replacementModeAndroid; obfuscatedAccountIdAndroid = require.obfuscatedAccountIdAndroid; obfuscatedProfileIdAndroid = require.obfuscatedProfileIdAndroid; isOfferPersonalized = require.isOfferPersonalized; binding = env2_4; return binding.buyItemByType(env2_6, subscriptionOffers == null ? value3 : subscriptionOffers.map(function(a0) { return a0.sku; }), purchaseTokenAndroid, r12, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, subscriptionOffers == null ? value3 : subscriptionOffers.map(_fun59085), isOfferPersonalized != null && isOfferPersonalized); } const Error = global.Error; throw new Error('subscriptionOffers are required for Google Play subscriptions'); } function* _fun59089() { // fn#59089, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:4702, offset: 0x016e0e4c, size: 373 bytes, params: 1, frame: 17 var r2; var r1; var Promise; var reject; var error; var purchaseStateAndroid; var value3; var value4; var androidModule; var value7; var androidModule2; if (false) { return undefined; } value = environment.__proto__; if (importAll == null) { Promise = global.Promise; reject = Promise.reject; error = new global.Error('purchase is not suitable to be purchased'); error = Reflect.apply(reject, Promise, [error]); r1 = error; } else if (importAll.purchaseToken) { if (dependencyMap) { value7 = environment.__proto__.__proto__; androidModule2 = env2_0(env2_2[3]).getAndroidModule(); r2 = androidModule2.consumeProduct(importAll.purchaseToken, env1_3); } else if (importAll.userIdAmazon) { value4 = environment.__proto__.__proto__; androidModule = env2_0(env2_2[3]).getAndroidModule(); r2 = androidModule.acknowledgePurchase(importAll.purchaseToken, env1_3); } else if (importAll.isAcknowledgedAndroid) { Promise = global.Promise; reject = Promise.reject; error = new global.Error('purchase is not suitable to be purchased'); error = Reflect.apply(reject, Promise, [error]); r2 = error; } else { purchaseStateAndroid = importAll.purchaseStateAndroid; value3 = environment.__proto__.__proto__; if (purchaseStateAndroid === env2_0(env2_2[2]).PurchaseStateAndroid.PURCHASED) { value4 = environment.__proto__.__proto__; androidModule = env2_0(env2_2[3]).getAndroidModule(); r2 = androidModule.acknowledgePurchase(importAll.purchaseToken, env1_3); } else { Promise = global.Promise; reject = Promise.reject; error = new global.Error('purchase is not suitable to be purchased'); error = Reflect.apply(reject, Promise, [error]); r2 = error; } } r1 = r2; } else { Promise = global.Promise; reject = Promise.reject; error = new global.Error('purchase is not suitable to be purchased'); error = Reflect.apply(reject, Promise, [error]); r1 = error; } return r1; } function* _fun59093() { // fn#59093, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:5372, offset: 0x016e100f, size: 202 bytes, params: 1, frame: 17 var value3; var Promise; var deepLinkToSubscriptionsAmazon; var value4; if (true) { value = environment.__proto__.__proto__; if (env2_0(env2_2[3]).isAmazon) { value = env2_1(env2_2[5]); deepLinkToSubscriptionsAmazon = value.deepLinkToSubscriptionsAmazon; value4 = environment.__proto__; Reflect.apply(deepLinkToSubscriptionsAmazon, value, [{isAmazonDevice: dependencyMap}]); } else { value3 = environment.__proto__; if (importAll) { env2_1(env2_2[6]).deepLinkToSubscriptionsAndroid({sku: importAll}); } else { Promise = global.Promise; Promise.reject(new global.Error('Sku is required to locate subscription in Android Store')); } } } } function* _fun59097() { // fn#59097, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:5775, offset: 0x016e1106, size: 57 bytes, params: 1, frame: 11 if (false) { return undefined; } value = environment.__proto__.__proto__; const binding = env2_4; const getStorefront = binding.getStorefront; yield Reflect.apply(getStorefront, binding, []); value = undefined; if (false) { return value; } return {countryCode: value, currency: null}; } function _fun59085(a0) { // fn#59085, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7515:4423, offset: 0x016e0df1, size: 13 bytes, params: 2, frame: 1 return a0.offerToken; }