/* Metro module 7608; source: modules/collectibles/hooks/useHandleUseNow.tsx; dependencies: [5, 57, 31, 1904, 1244, 7609, 7610, 7613, 7620, 2] */ import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */ import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as CollectiblesItemTypeModule from '../../../external/discord_common/js/shared/shared-constants/CollectiblesItemType.tsx'; /* Metro dependency 1904 */ import * as UseShopProductItemsModule from './useShopProductItems.tsx'; /* Metro dependency 7609 */ function _fun60952(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#60952, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7786:6, offset: 0x0171610f, size: 165 bytes, params: 8, frame: 19 const env0_0 = require; const _arrayLikeToArray_60955 = function(a0, a1) { var r0; var r1; var r2; var value3; var length; var value5; var value = undefined; var value2 = value == null; reducibleJoin2: while (true) { if (value2) { r0 = value2; break reducibleJoin2; } value3 = value > a0.length; r0 = value3; break reducibleJoin2; } reducibleJoin4: while (true) { if (r0) { length = a0.length; r1 = length; break reducibleJoin4; } r1 = value; break reducibleJoin4; } value = (0, global.Array)(r1); var value4 = 0; if (value4 < r1) { r2 = value4; reducibleLoop5: while (true) { value[r2] = a0[r2]; value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; if (value5 < r1) { r2 = value5; continue reducibleLoop5; } break reducibleLoop5; } } return value; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/collectibles/hooks/useHandleUseNow.tsx'); exports.useHandleUseNow = useHandleUseNow_60956; function _createForOfIteratorHelperLoose_60953(a0, a1) { // fn#60953, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7786:131, offset: 0x017161b4, size: 370 bytes, params: 3, frame: 20 var r6; var r9; var r5; var value3; var regexp; const env0_0 = a0; const Symbol = global.Symbol; let value = typeof Symbol !== 'undefined'; let r1 = value && a0[global.Symbol.iterator]; r1 = !r1 ? a0['@@iterator'] : r1; if (r1) { value = r1.call(a0); return value.next.bind(value); } const Array = global.Array; if (Array.isArray(a0)) { if (r1) { } return _fun60954; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_60955(a0, value); r5 = value; } else { value3 = ({}).toString.call(a0).slice(8, -1); r6 = value3 === 'Object' && a0.constructor; r9 = r6 ? a0.constructor.name : value3; if (r9 === 'Map') { r6 = global.Array.from(a0); } else if (r9 === 'Set') { r6 = global.Array.from(a0); } else if (r9 === 'Arguments') { value = _arrayLikeToArray_60955(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_60955(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun60954; } const TypeError = global.TypeError; throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); function _fun60954() { // fn#60954, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7786:702, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5 return env0_1 >= env0_0.length ? {done: true} : {done: false, value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]}; } } function useHandleUseNow_60956({product, onSuccess, onError}) { // fn#60956, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7786:1141, offset: 0x01716326, size: 726 bytes, params: 2, frame: 27 var r8; const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; const onError2 = onError; const [property, env0_3] = env0_3Binding(ReactModule.useState(false), 2); const {firstAvatarDecoration, firstProfileEffect, firstNameplate, firstProfileFrame} = (UseShopProductItemsModule).useShopProductItems(product); const type = product.type; const CollectiblesItemType = (CollectiblesItemTypeModule).CollectiblesItemType; const AVATAR_DECORATION = CollectiblesItemType.AVATAR_DECORATION; if (AVATAR_DECORATION === type) { r8 = intl.string(t.zOA4ax); } else if (CollectiblesItemType.NAMEPLATE === type) { r8 = intl.string(t.gOzMvx); } else if (CollectiblesItemType.PROFILE_FRAME === type) { r8 = intl.string(t.lOF4zR); } else if (CollectiblesItemType.PROFILE_EFFECT === type) { r8 = intl.string(t.SWm2ai); } else { CollectiblesItemType.BUNDLE; r8 = intl.string(t.tf1ZZ4); } const value10 = ReactModule.useMemo(_fun60957, [product]); object = {}; object.handleUseNow = ReactModule.useCallback(onError2(_fun60959), [value10, firstAvatarDecoration, firstProfileEffect, firstNameplate, firstProfileFrame, onSuccess, r8, onError]); object.isApplying = property; object.canUseNow = value10; return object; function _fun60957() { // fn#60957, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7786:1870, offset: 0x017165fc, size: 171 bytes, params: 1, frame: 18 var r2; var r0; var set; var value5; var done; var value6; var has; var value7; var value8; var add; var value9; const productBinding = product; let type = productBinding.type; let value = environment.__proto__; const CollectiblesItemType = (CollectiblesItemTypeModule).CollectiblesItemType; const BUNDLE = CollectiblesItemType.BUNDLE; const value2 = true; if (type !== BUNDLE) { r0 = value2; } else { set = new global.Set(); value = _createForOfIteratorHelperLoose_60953(productBinding.items); value5 = value(); done = value5.done; if (done) { r0 = value2; } else { r2 = value5; while (true) { value6 = r2.value; has = set.has; type = value6.type; value7 = Reflect.apply(has, set, [type]); value8 = false; if (value7) { r0 = value8; break; } add = set.add; type = value6.type; Reflect.apply(add, set, [type]); value9 = value(); done = value9.done; if (done) { r0 = value2; break; } r2 = value9; continue; } } } return r0; } function* _fun60959() { // fn#60959, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7786:2127, offset: 0x017166b0, size: 402 bytes, params: 1, frame: 20 var _createForOfIteratorHelperLoose_609532; var r10; var value; var value2; var value3; var object; var binding; var value4; var _createForOfIteratorHelperLoose_60953Binding; var value5; var value6; var value7; var binding2; var property; var value8; var getProfileChangesForUpdateRequest; var object2; var value9; var value10; var value11; var binding3; var value12; var saveProfileChanges; var value13; var value14; var value15; var _arrayLikeToArray_60955Binding; var value16; var Object; var keys; var value17; var length; var value18; var value19; var binding4; var value20; var saveProfileAndAccountChanges; var value21; var value22; var value23; var value24; var error; var value25; exceptionLanding81: while (true) { value = undefined; value2 = false; if (value2) { return value; } value = undefined; value3 = environment.__proto__; if (env1_8) { env1_3(true); object = {}; reducibleJoin4: while (true) { reduciblePort79: while (true) { exceptionLanding73: while (true) { try { try { binding = env1_4; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } break reducibleJoin4; } try { binding = env1_2; } catch (error) { break exceptionLanding81; } try { value25 = binding == null; } catch (error) { break exceptionLanding81; } reducibleJoin79: while (true) { if (value25) { break reducibleJoin79; } try { binding = env1_2; } catch (error) { break exceptionLanding81; } try { binding(error); } catch (error) { break exceptionLanding81; } break reducibleJoin79; } break reduciblePort79; } env1_3(false); return value; } try { try { value4 = binding == null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin9: while (true) { if (value4) { break reducibleJoin9; } try { try { binding = env1_4; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { object.avatarDecoration = binding; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } break reducibleJoin9; } try { try { _createForOfIteratorHelperLoose_60953Binding = _createForOfIteratorHelperLoose_60953; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value5 = _createForOfIteratorHelperLoose_60953Binding != null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin80: while (true) { reducibleJoin41: while (true) { if (value5) { value7 = environment.__proto__.__proto__; try { try { binding = env2_0; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding2 = env2_1; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { property = binding2[6]; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value8 = binding(property); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { getProfileChangesForUpdateRequest = value8.getProfileChangesForUpdateRequest; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { object2 = {}; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { _createForOfIteratorHelperLoose_60953Binding = _createForOfIteratorHelperLoose_60953; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value9 = _createForOfIteratorHelperLoose_60953Binding != null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin25: while (true) { if (value9) { try { try { _createForOfIteratorHelperLoose_60953Binding = _createForOfIteratorHelperLoose_60953; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } _createForOfIteratorHelperLoose_609532 = _createForOfIteratorHelperLoose_60953Binding; break reducibleJoin25; } _createForOfIteratorHelperLoose_609532 = value; break reducibleJoin25; } try { try { object2.pendingProfileEffect = _createForOfIteratorHelperLoose_609532; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding = env1_7; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value10 = binding != null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin30: while (true) { if (value10) { try { try { binding = env1_7; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } r10 = binding; break reducibleJoin30; } r10 = value; break reducibleJoin30; } try { try { object2.pendingProfileFrame = r10; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value11 = Reflect.apply(getProfileChangesForUpdateRequest, value8, [object2]); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding = env2_0; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding3 = env2_1; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { property = binding3[7]; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value12 = binding(property); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { saveProfileChanges = value12.saveProfileChanges; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value13 = Reflect.apply(saveProfileChanges, value12, [value11]); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } yield value13; try { try { value14 = undefined; value15 = false; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } break reducibleJoin41; } try { try { binding = env1_7; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value6 = binding == null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } if (!value6) { value7 = environment.__proto__.__proto__; try { try { binding = env2_0; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding2 = env2_1; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { property = binding2[6]; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value8 = binding(property); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { getProfileChangesForUpdateRequest = value8.getProfileChangesForUpdateRequest; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { object2 = {}; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { _createForOfIteratorHelperLoose_60953Binding = _createForOfIteratorHelperLoose_60953; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value9 = _createForOfIteratorHelperLoose_60953Binding != null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin25: while (true) { if (value9) { try { try { _createForOfIteratorHelperLoose_60953Binding = _createForOfIteratorHelperLoose_60953; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } _createForOfIteratorHelperLoose_609532 = _createForOfIteratorHelperLoose_60953Binding; break reducibleJoin25; } _createForOfIteratorHelperLoose_609532 = value; break reducibleJoin25; } try { try { object2.pendingProfileEffect = _createForOfIteratorHelperLoose_609532; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding = env1_7; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value10 = binding != null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin30: while (true) { if (value10) { try { try { binding = env1_7; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } r10 = binding; break reducibleJoin30; } r10 = value; break reducibleJoin30; } try { try { object2.pendingProfileFrame = r10; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value11 = Reflect.apply(getProfileChangesForUpdateRequest, value8, [object2]); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding = env2_0; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding3 = env2_1; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { property = binding3[7]; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value12 = binding(property); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { saveProfileChanges = value12.saveProfileChanges; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value13 = Reflect.apply(saveProfileChanges, value12, [value11]); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } yield value13; try { try { value14 = undefined; value15 = false; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } break reducibleJoin41; } try { try { _arrayLikeToArray_60955Binding = _arrayLikeToArray_60955; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value16 = _arrayLikeToArray_60955Binding == null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin47: while (true) { if (value16) { break reducibleJoin47; } try { try { _arrayLikeToArray_60955Binding = _arrayLikeToArray_60955; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { object.nameplate = _arrayLikeToArray_60955Binding; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } break reducibleJoin47; } try { try { Object = global.Object; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { keys = Object.keys; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value17 = Reflect.apply(keys, Object, [object]); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { length = value17.length; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value18 = length > 0; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } if (value18) { value19 = environment.__proto__.__proto__; try { try { binding = env2_0; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding4 = env2_1; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { property = binding4[8]; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value20 = binding(property); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { saveProfileAndAccountChanges = value20.saveProfileAndAccountChanges; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value21 = Reflect.apply(saveProfileAndAccountChanges, value20, [object]); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } yield value21; try { try { value22 = undefined; value23 = false; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin66: while (true) { if (value23) { env1_3(false); return value22; } break reducibleJoin66; } } try { try { } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value24 = dependencyMap == null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin70: while (true) { if (value24) { break reducibleJoin70; } try { try { } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { dependencyMap(); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } break reducibleJoin70; } env1_3(false); break reducibleJoin80; } if (value15) { env1_3(false); return value14; } try { try { _arrayLikeToArray_60955Binding = _arrayLikeToArray_60955; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value16 = _arrayLikeToArray_60955Binding == null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin47: while (true) { if (value16) { break reducibleJoin47; } try { try { _arrayLikeToArray_60955Binding = _arrayLikeToArray_60955; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { object.nameplate = _arrayLikeToArray_60955Binding; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } break reducibleJoin47; } try { try { Object = global.Object; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { keys = Object.keys; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value17 = Reflect.apply(keys, Object, [object]); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { length = value17.length; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value18 = length > 0; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } if (value18) { value19 = environment.__proto__.__proto__; try { try { binding = env2_0; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { binding4 = env2_1; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { property = binding4[8]; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value20 = binding(property); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { saveProfileAndAccountChanges = value20.saveProfileAndAccountChanges; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value21 = Reflect.apply(saveProfileAndAccountChanges, value20, [object]); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } yield value21; try { try { value22 = undefined; value23 = false; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin66: while (true) { if (value23) { env1_3(false); return value22; } break reducibleJoin66; } } try { try { } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { value24 = dependencyMap == null; } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } reducibleJoin70: while (true) { if (value24) { break reducibleJoin70; } try { try { } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } try { try { dependencyMap(); } catch (error) { break exceptionLanding73; } } catch (error) { break exceptionLanding81; } break reducibleJoin70; } env1_3(false); break reducibleJoin80; } } return value; } env1_3(false); throw error; } } } global.__d(_fun60952, 7608, [5, 57, 31, 1904, 1244, 7609, 7610, 7613, 7620, 2]) /* metro module 7608, dependencies: [5, 57, 31, 1904, 1244, 7609, 7610, 7613, 7620, 2] */;