/* Metro module 13175; source: modules/settings/native/renderer/SettingRendererUtils.tsx; dependencies: [9693, 661, 7508, 7004, 6996, 477, 1848, 13176, 44, 13177, 14147, 22, 2] */ import Module00044 from '../../../../by-id/module-00044.js'; /* Metro dependency 44 */ import UserSettingsModalActionCreators from '../../../../actions/UserSettingsModalActionCreators.tsx'; /* Metro dependency 7508 */ import SettingTreeManager from './SettingTreeManager.tsx'; /* Metro dependency 14147 */ import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as Module00022Module from '../../../../by-id/module-00022.js'; /* Metro dependency 22 */ import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */ import * as UseKeyboardIsOpenModule from '../../../keyboard/native/useKeyboardIsOpen.tsx'; /* Metro dependency 6996 */ import * as UserSettingsUtilsModule from '../../../../utils/UserSettingsUtils.tsx'; /* Metro dependency 7004 */ import * as SettingRendererConstantsModule from './SettingRendererConstants.tsx'; /* Metro dependency 9693 */ import * as SettingHookHarnessModule from './SettingHookHarness.tsx'; /* Metro dependency 13176 */ import * as SettingsRendererConfigModule from '../../../user_settings/core/native/SettingsRendererConfig.tsx'; /* Metro dependency 13177 */ function _fun100556(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#100556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:6, offset: 0x021ecc49, size: 285 bytes, params: 8, frame: 19 let env0_0 = require; const getSettingTitle2 = getSettingTitle; const getSearchResultIconComponent = function(a0) { var property = require(dependencyMap[9]).SETTING_RENDERER_CONFIG; property = property[a0]; var type = property.type; if (NodeType.RADIO === type) { return null; } if (NodeType.VOLUME_SLIDER === type) { return null; } if (NodeType.SLIDER === type) { return null; } return property.IconComponent; }; const isSupportedSearchResultSettingData = function(a0) { return SUPPORTED_SEARCH_RESULT_NO_PARENT_RENDERER_TYPES.has(a0.type); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = SettingRendererConstantsModule.ListItemType; (FileImportTrackerModule).fileFinishedImporting('modules/settings/native/renderer/SettingRendererUtils.tsx'); exports.onRouteSettingOnPress = function({navigation, screen, preNavigationAction}) { var closure = _fun100561; var value = undefined; if ((preNavigationAction == null ? value : preNavigationAction(closure)) !== false) { closure(); } return value; }; exports.getSettingTitle = getSettingTitle2; exports.getSettingSearchableTitles = getSettingSearchableTitles; exports.getSettingScreens = getSettingScreens; exports.toSettingListItems = function(a0, a1) { var env0_0 = a1; a0.sections.forEach(_fun100569); return []; }; exports.getSettingListSearchResultItems = getSettingListSearchResultItems; exports.getScoredSettingListSearchResultItems = getScoredSettingListSearchResultItems; exports.getInitialScrollIndex = function(a0, a1) { var env0_0 = a0; var lastIndex = a1.findLastIndex(_fun100584); if (lastIndex !== 1) { return global.Math.max(0, lastIndex); } }; function getSettingTitle(a0) { // fn#100557, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:216, offset: 0x021ecd66, size: 100 bytes, params: 2, frame: 17 const cachedSettingTitle = (SettingHookHarnessModule).getCachedSettingTitle(a0); (Module00044)(cachedSettingTitle != null, 'Setting ' + a0 + ' is missing a title.'); return cachedSettingTitle; } function onRouteSettingOnPress({navigation, screen, preNavigationAction}) { // fn#100560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:718, offset: 0x021ece45, size: 68 bytes, params: 2, frame: 13 const goToScreen2 = goToScreen; if (preNavigationAction?.(goToScreen2) !== false) { goToScreen2(); } function goToScreen() { // fn#100561, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:811, owner: onRouteSettingOnPress.goToScreen, offset: 0x021ece89, size: 146 bytes, params: 1, frame: 16 var environment; var moduleValue2; const goToScreenOnPress2 = goToScreenOnPress; const value = environment.__proto__; const getKeyboardIsOpen = UseKeyboardIsOpenModule.getKeyboardIsOpen; if (Reflect.apply(getKeyboardIsOpen, UseKeyboardIsOpenModule, [])) { moduleValue2 = require(477) /* metro dependency 477: PlatformUtils */; if (moduleValue2.isIOS()) { (require(1848) /* metro dependency 1848: KeyboardManagerUtils */).dismissGlobalKeyboard(); global.setTimeout(function() { goToScreenOnPress(); }, 100); } else { goToScreenOnPress2(); } } else { goToScreenOnPress2(); } function goToScreenOnPress() { // fn#100562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:816, owner: onRouteSettingOnPress.goToScreen.onPress, offset: 0x021ecf1b, size: 133 bytes, params: 1, frame: 16 const defaultImport = UserSettingsModalActionCreators; const setSection = defaultImport.setSection; const screenBinding = screen; Reflect.apply(setSection, defaultImport, [screenBinding.route]); const trackUserSettingsPaneViewed = UserSettingsUtilsModule.trackUserSettingsPaneViewed; const USER_SETTINGS = AnalyticsPages.USER_SETTINGS; Reflect.apply(trackUserSettingsPaneViewed, UserSettingsUtilsModule, [{destinationPane: screenBinding.route, source: {page: USER_SETTINGS}}]); const navigationBinding = navigation; navigationBinding.navigate(screenBinding.route); } } } function getSettingSearchableTitles() { // fn#100564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:1213, offset: 0x021ecfa0, size: 79 bytes, params: 1, frame: 14 const Object = global.Object; const entries = Object.entries; const SETTING_RENDERER_CONFIG = (SettingsRendererConfigModule).SETTING_RENDERER_CONFIG; Reflect.apply(entries, Object, [SETTING_RENDERER_CONFIG]).forEach(_fun100565); return []; function _fun100565(a0) { // fn#100565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:1328, offset: 0x021ecfef, size: 189 bytes, params: 2, frame: 19 var r1; var r2; var r3; var item3; var value3; var value4; var cachedSettingTitle; var binding; var push; var items3; var items2; const iterator = a0[Symbol.iterator](); const iterator2 = iterator.next; let item2 = Reflect.apply(iterator2, iterator, []); let item = item2.value; item2 = item2.done ? undefined : iterator; const value = undefined; const value2 = item2 === value; const r7 = value2 ? value : item; if (value2) { r1 = value; r2 = item2; r3 = value2; } else { item3 = Reflect.apply(iterator2, item2, []); item = item3.value; item3 = item3.done ? undefined : item2; value3 = item3 === value; if (value3) { r1 = value; r2 = item3; r3 = value3; } else { r1 = item; r2 = item3; r3 = value3; } } if (!r3) { r2.return(); } if (!r1.unsearchable) { value4 = environment.__proto__; cachedSettingTitle = (require(13176) /* metro dependency 13176: SettingHookHarness */).getCachedSettingTitle(r7); if (cachedSettingTitle != null) { binding = env0_0; push = binding.push; items3 = [r7]; items2 = [cachedSettingTitle]; arraySpread(items2, (require(13176) /* metro dependency 13176: SettingHookHarness */).getCachedSettingSearchTerms(r7), 1, 7); items3[1] = items2; Reflect.apply(push, binding, [items3]); } } return value; } } function getSettingScreens() { // fn#100566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:1495, offset: 0x021ed0ac, size: 109 bytes, params: 1, frame: 15 const Set = global.Set; const set = new Set(); const Object = global.Object; const entries = Object.entries; const SETTING_RENDERER_CONFIG = (SettingsRendererConfigModule).SETTING_RENDERER_CONFIG; Reflect.apply(entries, Object, [SETTING_RENDERER_CONFIG]).forEach(_fun100567); return []; function _fun100567(a0) { // fn#100567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:1607, offset: 0x021ed119, size: 177 bytes, params: 2, frame: 16 var r1; var r2; var r3; var item3; var value3; var binding; var has; var screen; var push; var add; const iterator = a0[Symbol.iterator](); const iterator2 = iterator.next; let item2 = Reflect.apply(iterator2, iterator, []); let item = item2.value; item2 = item2.done ? undefined : iterator; const value = undefined; const value2 = item2 === value; const r6 = value2 ? value : item; if (value2) { r1 = value; r2 = item2; r3 = value2; } else { item3 = Reflect.apply(iterator2, item2, []); item = item3.value; item3 = item3.done ? undefined : item2; value3 = item3 === value; if (value3) { r1 = value; r2 = item3; r3 = value3; } else { r1 = item; r2 = item3; r3 = value3; } } if (!r3) { r2.return(); } const type = r1.type; const ROUTE = NodeType.ROUTE; if (type === ROUTE) { binding = env0_1; has = binding.has; screen = r1.screen; if (!Reflect.apply(has, binding, [screen.route])) { binding = env0_0; push = binding.push; screen = r1.screen; Reflect.apply(push, binding, [[r6, screen]]); binding = env0_1; add = binding.add; screen = r1.screen; Reflect.apply(add, binding, [screen.route]); } } return value; } } function toSettingListItems({sections}, a1) { // fn#100568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:1732, offset: 0x021ed1ca, size: 45 bytes, params: 3, frame: 12 const env0_0 = a1; sections.forEach(_fun100569); return []; function _fun100569(a0) { // fn#100569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:1801, offset: 0x021ed1f7, size: 161 bytes, params: 2, frame: 17 var environment; var binding; var push; var value3; const value = a0.settings.filter(_fun100570); if (value.length !== 0) { binding = env0_1; push = binding.push; value3 = environment.__proto__; Reflect.apply(push, binding, [{type: ListItemType.SECTION_HEADER, label: a0.label}]); value.forEach(_fun100571); if (a0.subLabel != null) { env0_1.push({type: ListItemType.SECTION_FOOTER, label: a0.subLabel}); } } function _fun100570(a0) { // fn#100570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:1830, offset: 0x021ed298, size: 52 bytes, params: 2, frame: 13 let value = environment.__proto__.__proto__; value = importDefault(14147) /* metro dependency 14147: SettingTreeManager */; return !value.isBlocked(a0, require); } function _fun100571(a0, a1) { // fn#100571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:1933, offset: 0x021ed2cc, size: 123 bytes, params: 3, frame: 16 const binding = env1_1; const push = binding.push; const object = {}; const SECTION_ROW = ListItemType.SECTION_ROW; object.type = SECTION_ROW; object.setting = a0; const SETTING_RENDERER_CONFIG = (SettingsRendererConfigModule).SETTING_RENDERER_CONFIG; object.settingData = SETTING_RENDERER_CONFIG[a0]; object.start = a1 === 0; object.end = a1 === env0_0.length - 1; Reflect.apply(push, binding, [object]); } } } function getSettingListSearchResultItems(a0) { // fn#100572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:2169, offset: 0x021ed347, size: 137 bytes, params: 2, frame: 14 a0.forEach(_fun100573); let value = Module00022Module; value = value.sortBy([], function(a0) { return a0.category; }); const Set = global.Set; const set = new Set(); value.forEach(_fun100575); return []; function _fun100573(a0) { // fn#100573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:2233, offset: 0x021ed3d0, size: 182 bytes, params: 2, frame: 16 var binding; var nearestRouteAncestorDataOrSelf; let value = environment.__proto__; const SETTING_RENDERER_CONFIG = (SettingsRendererConfigModule).SETTING_RENDERER_CONFIG; const property = SETTING_RENDERER_CONFIG[a0]; if (property.parent != null) { value = importDefault(14147) /* metro dependency 14147: SettingTreeManager */; value = value.getHighestLevelAncestor(a0); nearestRouteAncestorDataOrSelf = (importDefault(14147) /* metro dependency 14147: SettingTreeManager */).getNearestRouteAncestorDataOrSelf(a0); binding = env0_0; binding.push({category: value, setting: a0, data: nearestRouteAncestorDataOrSelf}); } else if (isSupportedSearchResultSettingData(property)) { binding = env0_0; binding.push({category: a0, setting: a0, data: property}); return undefined; } } function _fun100575({category, setting, data}, a1) { // fn#100575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:2601, offset: 0x021ed490, size: 184 bytes, params: 3, frame: 21 const value = environment.__proto__; const settingTitle = getSettingTitle(setting); const breadcrumbs = (SettingTreeManager).getBreadcrumbs(setting); let binding = env0_3; const value6 = binding.has(category); binding.add(category); binding = env0_2; const push = binding.push; const object = {}; const SETTING_SEARCH_RESULT = ListItemType.SETTING_SEARCH_RESULT; object.type = SETTING_SEARCH_RESULT; object.settingData = data; object.title = settingTitle; object.IconComponent = value6 ? undefined : getSearchResultIconComponent(category); object.breadcrumbs = breadcrumbs; object.setting = setting; object.index = a1; object.total = env0_1.length; Reflect.apply(push, binding, [object]); } } function getScoredSettingListSearchResultItems(a0, a1, a2) { // fn#100576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:2922, offset: 0x021ed548, size: 266 bytes, params: 4, frame: 17 var r1; var value; var push; var SECTION_ROW_PLACEHOLDER; var value3; const items2 = []; if (a1) { value = 0; if (value < a2) { r1 = value; reducibleLoop3: while (true) { push = items2.push; SECTION_ROW_PLACEHOLDER = ListItemType.SECTION_ROW_PLACEHOLDER; Reflect.apply(push, items2, [{type: SECTION_ROW_PLACEHOLDER, start: value === r1, end: r1 === a2 - 1}]); value3 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1; if (value3 < a2) { r1 = value3; continue reducibleLoop3; } break reducibleLoop3; } } } else { var Map = global.Map; var map = new Map(); Map = global.Map; map = new Map(); a0.forEach(_fun100577); var Array = global.Array; map = Array.from(map.entries()); map = map.sort(function(a0, [, property]) { return property - a0[1]; }); map = map.map(function(a0) { var iterator = a0[Symbol.iterator](); var item2 = iterator.next(); var item = item2.value; item2 = item2.done ? undefined : iterator; var value = undefined; var value2 = item2 === value; var r0 = value2 ? value : item; if (!value2) { item2.return(); } return r0; }); map.forEach(_fun100580); } return items2; function _fun100577({setting, score}) { // fn#100577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:3124, offset: 0x021ed652, size: 266 bytes, params: 2, frame: 20 var binding; let value = environment.__proto__; const SETTING_RENDERER_CONFIG = (SettingsRendererConfigModule).SETTING_RENDERER_CONFIG; const property = SETTING_RENDERER_CONFIG[setting]; if (property.parent != null || isSupportedSearchResultSettingData(property)) { binding = env0_3; env0_3 = typeof binding === 'bigint' ? binding + 1n : +binding + 1; } value = importDefault(14147) /* metro dependency 14147: SettingTreeManager */; value = value.getHighestLevelAncestor(setting); const r6 = value !== setting ? score : score + 0.05; const r10 = env0_2.get(value) ?? 0; binding = env0_2; const set = binding.set; const Math = global.Math; Reflect.apply(set, binding, [value, Math.max(r10, r6)]); const r3 = env0_1.get(value) ?? []; r3.push({setting: setting, score: r6}); env0_1.set(value, r3); } function _fun100580(a0) { // fn#100580, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:3526, offset: 0x021ed773, size: 71 bytes, params: 2, frame: 12 const env0_0 = a0; let value = env0_1.get(a0); if (value != null) { value = value.sort(_fun100581); value.forEach(_fun100582); } function _fun100581(a0, a1) { // fn#100581, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:3562, offset: 0x021ed7ba, size: 67 bytes, params: 3, frame: 6 return a0.setting === env0_0 ? -1 : a1.setting === env0_0 ? 1 : a1.score - a0.score; } function _fun100582({setting}, a1) { // fn#100582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:3629, offset: 0x021ed7fd, size: 269 bytes, params: 3, frame: 18 var r4; var r6; var highestLevelAncestor; var object; var binding; let value = environment.__proto__.__proto__; const SETTING_RENDERER_CONFIG = (SettingsRendererConfigModule).SETTING_RENDERER_CONFIG; const property = SETTING_RENDERER_CONFIG[setting]; if (property.parent != null) { highestLevelAncestor = (importDefault(14147) /* metro dependency 14147: SettingTreeManager */).getHighestLevelAncestor(setting); r4 = (importDefault(14147) /* metro dependency 14147: SettingTreeManager */).getNearestRouteAncestorDataOrSelf(setting); r6 = highestLevelAncestor; object = {}; object.type = ListItemType.SETTING_SEARCH_RESULT; object.settingData = r4; object.title = getSettingTitle(setting); r4 = a1 !== 0 ? undefined : getSearchResultIconComponent(r6); object.IconComponent = r4; value = importDefault(14147) /* metro dependency 14147: SettingTreeManager */; object.breadcrumbs = value.getBreadcrumbs(setting); object.setting = setting; value = environment.__proto__; object.index = env1_4; object.total = env1_3; binding = env1_4; env1_4 = typeof binding === 'bigint' ? binding + 1n : +binding + 1; binding = env1_0; binding.push(object); } else if (isSupportedSearchResultSettingData(property)) { r4 = property; r6 = setting; object = {}; object.type = ListItemType.SETTING_SEARCH_RESULT; object.settingData = r4; object.title = getSettingTitle(setting); r4 = a1 !== 0 ? undefined : getSearchResultIconComponent(r6); object.IconComponent = r4; value = importDefault(14147) /* metro dependency 14147: SettingTreeManager */; object.breadcrumbs = value.getBreadcrumbs(setting); object.setting = setting; value = environment.__proto__; object.index = env1_4; object.total = env1_3; binding = env1_4; env1_4 = typeof binding === 'bigint' ? binding + 1n : +binding + 1; binding = env1_0; binding.push(object); return undefined; } } } } function getInitialScrollIndex(a0, a1) { // fn#100583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:4108, offset: 0x021ed90a, size: 64 bytes, params: 3, frame: 13 const env0_0 = a0; const lastIndex = a1.findLastIndex(_fun100584); if (lastIndex !== 1) { return global.Math.max(0, lastIndex); } function _fun100584(a0) { // fn#100584, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13365:4167, offset: 0x021ed94a, size: 47 bytes, params: 2, frame: 3 const type = a0.type; const value = environment.__proto__; const SECTION_ROW = ListItemType.SECTION_ROW; return type === SECTION_ROW && a0.setting === env0_0; } } } global.__d(_fun100556, 13175, [9693, 661, 7508, 7004, 6996, 477, 1848, 13176, 44, 13177, 14147, 22, 2]) /* metro module 13175, dependencies: [9693, 661, 7508, 7004, 6996, 477, 1848, 13176, 44, 13177, 14147, 22, 2] */;