/* Metro module 7010; source: modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx; dependencies: [57, 31, 7011, 3805, 1376, 482, 7012, 566, 1365, 7013, 4223, 694, 7017, 1962, 4080, 2] */ function _fun55507(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#55507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:6, offset: 0x013a8eea, size: 259 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(57) /* metro dependency 57 */; const env0_4 = importAll(31) /* metro dependency 31 */; const walletBalanceStore = importDefault(7011) /* metro dependency 7011: WalletBalanceStore */; const paymentSourceStore = importDefault(3805) /* metro dependency 3805: PaymentSourceStore */; const env0_7 = (require(1376) /* metro dependency 1376: DismissibleContentConstants */).ContentDismissActionType; const env0_8 = (require(482) /* metro dependency 482: Constants */).PaymentSourceTypes; const env0_10 = ({Idle: 'idle', Opening: 'opening', Opened: 'opened'}).Idle; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx'); exports.useGiftCardMobileConsumptionHalfsheet = useGiftCardMobileConsumptionHalfsheet; } function useGiftCardMobileConsumptionHalfsheet() { // fn#55508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:473, offset: 0x013a8fed, size: 505 bytes, params: 1, frame: 24 const giftCardsExperimentModule = require(7012) /* metro dependency 7012: GiftCardsExperiment */; const useGiftCardsExperimentConfig = giftCardsExperimentModule.useGiftCardsExperimentConfig; const enabled = Reflect.apply(useGiftCardsExperimentConfig, giftCardsExperimentModule, [{location: 'useGiftCardMobileConsumptionHalfsheet'}]).enabled; const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([PaymentSourceStore], _fun55509, [enabled]); const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([WalletBalanceStore], _fun55510, [value2]); let r5 = enabled && value2 != null && !(require(566) /* metro dependency 566: flux */).useStateFromStores([WalletBalanceStore], _fun55511, [value2]); r5 = r5 && value3 != null && value3.amount > 0; const binding = env0_4; const useMemo = binding.useMemo; let value = env0_3((require(7013) /* metro dependency 7013: useSelectedDismissibleContent */).useSelectedDismissibleContent(Reflect.apply(useMemo, binding, [_fun55512, [r5]]), undefined, true), 2); const property = value[0]; const property2 = value[1]; const env0_5 = binding.useRef(property2); binding.useEffect(_fun55513, [property2]); value = binding.useCallback(_fun55514, []); binding.useEffect(_fun55515, [enabled]); binding.useEffect(_fun55516, [value2]); binding.useEffect(_fun55517, [property, value]); binding.useEffect(_fun55521, [property]); } function _fun55509() { // fn#55509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:659, offset: 0x013a91e6, size: 105 bytes, params: 1, frame: 14 var r2; var Object; var values; var value2; var length; var value3; var property; var type; var TDS_WALLET; var value4; if (enabled) { Object = global.Object; values = Object.values; value = environment.__proto__; value2 = Reflect.apply(values, Object, [PaymentSourceStore.paymentSources]); length = value2.length; value3 = 0; if (value3 < length) { r2 = value3; loopExit3: while (true) { property = value2[r2]; type = property.type; TDS_WALLET = PaymentSourceTypes.TDS_WALLET; if (type === TDS_WALLET) { return property.id; } value4 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; length = value2.length; if (value4 < length) { r2 = value4; continue; } break loopExit3; } return null; } } return null; } function _fun55510() { // fn#55510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:845, offset: 0x013a924f, size: 42 bytes, params: 1, frame: 12 const value2 = null; return value2 != env0_1 ? WalletBalanceStore.getBalance(env0_1) : value2; } function _fun55511() { // fn#55511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:918, offset: 0x013a9279, size: 40 bytes, params: 1, frame: 12 return env0_1 != null && WalletBalanceStore.getIsFetching(env0_1); } function _fun55512() { // fn#55512, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1007, offset: 0x013a92a1, size: 66 bytes, params: 1, frame: 12 return env0_2 ? [(require(1365) /* metro dependency 1365: dismissible_content */).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET] : []; } function _fun55514(a0) { // fn#55514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1250, offset: 0x013a92f8, size: 24 bytes, params: 2, frame: 11 env0_5.current(a0); } function _fun55515() { // fn#55515, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1286, offset: 0x013a9310, size: 49 bytes, params: 1, frame: 11 var value; if (enabled) { value = environment.__proto__; value = require(4223) /* metro dependency 4223: BillingActionCreators */; value.fetchPaymentSources(); } } function _fun55516() { // fn#55516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1345, offset: 0x013a9341, size: 57 bytes, params: 1, frame: 12 var value2; if (env0_1 != null) { value2 = environment.__proto__; (require(4223) /* metro dependency 4223: BillingActionCreators */).fetchWalletInformation(env0_1); } } function _fun55517() { // fn#55517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1414, offset: 0x013a937a, size: 244 bytes, params: 1, frame: 21 var Opening; var value3; var defaultImport2; const binding = env0_3; const DismissibleContent = require(dependencyMap[8]).DismissibleContent; const GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET = DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET; if (binding === GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) { var Idle2 = env1_9.Idle; if (Idle === Idle2) { Opening = env1_9.Opening; importDefault(dependencyMap[11]).subscribe('SHOW_ACTION_SHEET', handleShow); value3 = require(dependencyMap[13])(dependencyMap[12], dependencyMap.paths); value3.catch(_fun55519); defaultImport2 = importDefault(dependencyMap[14]); defaultImport2.openLazy(value3, 'GiftCardMobileConsumptionActionSheet', {markAsDismissed: env0_6}, 'stack'); return _fun55520; } } } function _fun55521() { // fn#55521, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1879, offset: 0x013a9531, size: 104 bytes, params: 1, frame: 15 var environment; const binding = env0_3; const value = environment.__proto__; const DismissibleContent = (require(1365) /* metro dependency 1365: dismissible_content */).DismissibleContent; const GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET = DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET; if (binding === GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) { (importDefault(694) /* metro dependency 694: Dispatcher */).subscribe('HIDE_ACTION_SHEET', handleHide); return _fun55523; } } function handleShow(a0) { // fn#55518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1549, offset: 0x013a946e, size: 52 bytes, params: 2, frame: 3 var Opened; var value; if (!(env0_0 || a0.key !== 'GiftCardMobileConsumptionActionSheet')) { value = environment.__proto__.__proto__; Opened = env2_9.Opened; } } function _fun55519() { // fn#55519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1678, offset: 0x013a94a2, size: 55 bytes, params: 1, frame: 3 var r0; var Idle2; var value; const binding = env0_0; if (binding) { r0 = binding; } else { value = environment.__proto__.__proto__; value = Idle !== env2_9.Opening; r0 = value; } if (!r0) { value = environment.__proto__.__proto__; Idle2 = env2_9.Idle; } } function _fun55520() { // fn#55520, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1766, offset: 0x013a94d9, size: 88 bytes, params: 1, frame: 15 var Idle2; const defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */; defaultImport.unsubscribe('SHOW_ACTION_SHEET', handleShow); const Opening = env2_9.Opening; if (Idle === Opening) { Idle2 = env2_9.Idle; } } function handleHide({key}) { // fn#55522, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:1985, offset: 0x013a9599, size: 52 bytes, params: 2, frame: 11 var value; var binding; var current; if (key === 'GiftCardMobileConsumptionActionSheet') { value = environment.__proto__; binding = env1_5; current = binding.current; value = environment.__proto__.__proto__; Reflect.apply(current, binding, [ContentDismissActionType.USER_DISMISS]); } } function _fun55523() { // fn#55523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7188:2085, offset: 0x013a95cd, size: 50 bytes, params: 1, frame: 14 let value = environment.__proto__.__proto__; value = importDefault(694) /* metro dependency 694: Dispatcher */; value.unsubscribe('HIDE_ACTION_SHEET', handleHide); }