/* Metro module 14415; source: modules/guilds_bar/native/GuildsBarGuild.tsx; dependencies: [31, 3785, 1422, 4646, 5214, 1867, 3969, 4896, 14384, 14385, 661, 33, 4017, 4501, 697, 1357, 3860, 14395, 4013, 566, 6819, 14416, 14417, 4647, 1244, 683, 6914, 14410, 4559, 14386, 8812, 14425, 14426, 4577, 14428, 5475, 14433, 2] */ import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */ import MobileVisualRefreshExperiment from '../../themes/experiments/MobileVisualRefreshExperiment.tsx'; /* Metro dependency 1357 */ import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */ import LurkingStore from '../../lurker_mode/LurkingStore.tsx'; /* Metro dependency 3785 */ import SelectedGuildStore from '../../../stores/SelectedGuildStore.tsx'; /* Metro dependency 3969 */ import GuildAvailabilityStore from '../../../stores/GuildAvailabilityStore.tsx'; /* Metro dependency 4646 */ import SortedGuildStore from '../../../stores/SortedGuildStore.tsx'; /* Metro dependency 4896 */ import GuildReadStateStore from '../../../stores/GuildReadStateStore.tsx'; /* Metro dependency 5214 */ import TransitionGuildsBarToGuildOrOpenSelectedChannel from './utils/transitionGuildsBarToGuildOrOpenSelectedChannel.tsx'; /* Metro dependency 14410 */ import IsGuildsBarGuildDataEqual from './utils/isGuildsBarGuildDataEqual.tsx'; /* Metro dependency 14416 */ import UseGuildsBarBadges from './hooks/useGuildsBarBadges.tsx'; /* Metro dependency 14417 */ import UsePreloadedGuildAsset from './hooks/usePreloadedGuildAsset.tsx'; /* Metro dependency 14425 */ 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 JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */ import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */ import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as GuildRecordModule from '../../../records/GuildRecord.tsx'; /* Metro dependency 1422 */ import * as UseTokenModule from '../../../design/tokens/native/useToken.tsx'; /* Metro dependency 3860 */ import * as HomeDrawerExperimentModule from '../../home_drawer/native/HomeDrawerExperiment.tsx'; /* Metro dependency 4013 */ import * as ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */ import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */ import * as ContextMenuStateNativeModule from '../../../design/components/ContextMenu/native/ContextMenuState.native.tsx'; /* Metro dependency 8812 */ import * as GuildsBarDnDStoreModule from './GuildsBarDnDStore.tsx'; /* Metro dependency 14384 */ import * as GuildsBarConstantsModule from './GuildsBarConstants.tsx'; /* Metro dependency 14385 */ import * as GuildsBarAnimatedItemWrapperModule from './GuildsBarAnimatedItemWrapper.tsx'; /* Metro dependency 14395 */ function _fun109099(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109099, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:6, offset: 0x0233d3d3, size: 575 bytes, params: 8, frame: 23 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ReactModule; object = {}; object.pan = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(-1); object.itemMeasurements = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable([]); object.activeIndex = (require(4017) /* metro dependency 4017: ReanimatedRexport */).makeMutable(-1); const createStyles = CreateStylesModule.createStyles; const object2 = {}; let GUILD_BAR_ITEM_SIZE = (importDefault(697) /* metro dependency 697: native */).modules.mobile.GUILD_BAR_ITEM_SIZE; object2.width = GUILD_BAR_ITEM_SIZE; GUILD_BAR_ITEM_SIZE = (importDefault(697) /* metro dependency 697: native */).modules.mobile.GUILD_BAR_ITEM_SIZE; object2.height = GUILD_BAR_ITEM_SIZE; const env0_19 = Reflect.apply(createStyles, CreateStylesModule, [{guildIcon: object2}]); object = {code: "function GuildsBarGuildTsx1(values){const{dragDropInProgress,sharedId,guildId,isDragTarget,withSpring,TRANSITION_PHYSICS}=this.__closure;var _guildId;const shouldAnimate=dragDropInProgress.get()&&sharedId.get()===guildId&&!isDragTarget;sharedId.set((_guildId=guildId)!==null&&_guildId!==void 0?_guildId:null);return{animations:{originY:shouldAnimate?withSpring(values.targetOriginY,TRANSITION_PHYSICS,'animate-always'):values.targetOriginY,height:shouldAnimate?withSpring(values.targetHeight,TRANSITION_PHYSICS,'animate-always'):values.targetHeight},initialValues:{originY:values.currentOriginY,height:values.currentHeight}};}"}; value = value.memo(GuildsBarGuild); (FileImportTrackerModule).fileFinishedImporting('modules/guilds_bar/native/GuildsBarGuild.tsx'); exports.default = value; function GuildsBarGuild({guildId, isDragPreview}) { // fn#109100, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:1246, offset: 0x0233d612, size: 1324 bytes, params: 2, frame: 45 isDragPreview = !(isDragPreview === undefined) && isDragPreview; const value4 = (MobileVisualRefreshExperiment)('GuildsBarGuild'); const styles = useStyles(); const useToken = UseTokenModule.useToken; const GUILD_BAR_ITEM_SIZE = (Native).modules.mobile.GUILD_BAR_ITEM_SIZE; const value5 = Reflect.apply(useToken, UseTokenModule, [GUILD_BAR_ITEM_SIZE]); const value6 = (GuildsBarAnimatedItemWrapperModule).useGuildsBarAnimatedWrapperStyles({'disableSelectedColor': true, 'disableBGColor': true}); const MobileHomeDrawerExperiment = (HomeDrawerExperimentModule).MobileHomeDrawerExperiment; const useConfig = MobileHomeDrawerExperiment.useConfig; const enableHome = Reflect.apply(useConfig, MobileHomeDrawerExperiment, [{location: 'guilds'}]).enableHome; const value7 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([SelectedGuildStore, GuildAvailabilityStore, GuildReadStateStore, LurkingStore], _fun109101, [guildId]); const selected = value7.selected; const isUnavailable = value7.isUnavailable; const isUnavailable2 = isUnavailable; const mentionCount = value7.mentionCount; const unread = value7.unread; const isMentionLowImportance = value7.isMentionLowImportance; const isLurking = value7.isLurking; const {asset, icon, guildName} = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], _fun109102, [guildId, value5, selected], IsGuildsBarGuildDataEqual); const {badgeTopRight, badgeBottomRight, cutouts, mediaState} = (UseGuildsBarBadges)(guildId, mentionCount, isMentionLowImportance); const binding = isUnavailable2; const value10 = binding.useMemo(_fun109103, [guildId, value5, isLurking, isUnavailable]); const value11 = binding.useMemo(_fun109109, [guildName, mentionCount, unread, mediaState]); const value12 = (UsePreloadedGuildAsset)(guildId, icon, asset); const {isDragTarget, dragState, overState, itemSize, dragDropInProgress} = useItemDragState(guildId, isDragPreview); const {accessibilityActions, onAccessibilityAction} = binding.useMemo(_fun109111, [guildId, (require(566) /* metro dependency 566: flux */).useStateFromStores([SortedGuildStore], function() { return SortedGuildStore.getGuildsTree().version; })]); const value15 = (ReanimatedRexportModule).useSharedValue(guildId); const useCallback = binding.useCallback; const GuildsBarGuildF2 = GuildsBarGuildF; object = {dragDropInProgress: dragDropInProgress, sharedId: value15, guildId: guildId, isDragTarget: isDragTarget}; object.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring; object.TRANSITION_PHYSICS = TRANSITION_PHYSICS; GuildsBarGuildF2.__closure = object; GuildsBarGuildF2.__workletHash = 14096669603718; GuildsBarGuildF2.__initData = env0_20; return ((Component) => {badgeTopRight}{badgeBottomRight}} expandedChildren={((Component) => )(importDefault(14428) /* metro dependency 14428: HomeDrawerGuildRow */)}>{isUnavailable ? ((Component) => )(importDefault(5475) /* metro dependency 5475: FastImage */) : value12 != null ? ((Component) => )(importDefault(5475) /* metro dependency 5475: FastImage */) : ((Component) => )(importDefault(6819) /* metro dependency 6819: GuildIcon */)})(importDefault(14395) /* metro dependency 14395: GuildsBarAnimatedItemWrapper */); function _fun109101() { // fn#109101, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:1625, offset: 0x0233db3e, size: 129 bytes, params: 1, frame: 13 const object = {}; const guildId2 = SelectedGuildStore.getGuildId(); const guildIdBinding = guildId; object.selected = guildId2 === guildIdBinding; object.isUnavailable = GuildAvailabilityStore.isUnavailable(guildIdBinding); const guildReadStateStoreBinding = GuildReadStateStore; object.unread = guildReadStateStoreBinding.hasUnread(guildIdBinding); object.mentionCount = guildReadStateStoreBinding.getMentionCount(guildIdBinding); object.isMentionLowImportance = guildReadStateStoreBinding.getIsMentionLowImportance(guildIdBinding); object.isLurking = LurkingStore.isLurking(guildIdBinding); return object; } function _fun109102() { // fn#109102, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:1970, offset: 0x0233dbbf, size: 173 bytes, params: 1, frame: 20 const value = environment.__proto__; const guild = GuildStore.getGuild(guildId); const value4 = undefined; let r1 = guild != null ? getGuildIconURL(guild, env0_1, selected) : value4; const object = {}; object.guildName = guild == null ? value4 : guild.name; object.icon = r1; r1 = r1 != null && guild != null ? getGuildIconSource(guild, (require(6819) /* metro dependency 6819: GuildIcon */).ImageSizes[(require(6819) /* metro dependency 6819: GuildIcon */).GuildIconSizes.LARGE], selected) : value4; object.asset = r1; return object; } function _fun109103() { // fn#109103, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:2306, offset: 0x0233dc6c, size: 41 bytes, params: 1, frame: 4 return {onPress: onPress_109104, onLongPress: isLurking ? _fun109106 : undefined}; function onPress_109104() { // fn#109104, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:2320, offset: 0x0233dc95, size: 364 bytes, params: 1, frame: 19 var environment; var defaultImport; var object; var moduleValue; var defaultImport2; var show; const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; const value = environment.__proto__.__proto__; const guildStoreBinding = GuildStore; const getGuild = guildStoreBinding.getGuild; if (Reflect.apply(getGuild, guildStoreBinding, [guildId]) == null) { defaultImport2 = importDefault(4647) /* metro dependency 4647: AlertActionCreators */; show = defaultImport2.show; object = {}; object.title = intl.string(t.R0RpRX); object.body = intl.string(t.m9gRVN); return Reflect.apply(show, defaultImport2, [object]); } if (isUnavailable) { defaultImport2 = importDefault(4647) /* metro dependency 4647: AlertActionCreators */; show = defaultImport2.show; object = {}; object.title = intl.string(t.R0RpRX); object.body = intl.string(t.m9gRVN); return Reflect.apply(show, defaultImport2, [object]); } const index = SortedGuildStore.getGuildFolders().findIndex(function({guildIds}) { return guildIds.includes(guildId); }); if (index > -1) { defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; defaultImport.track(AnalyticEvents.GUILD_CLICKED, {guild_id: guildId, index: index}); } if (isLurking) { moduleValue = require(6914) /* metro dependency 6914: LurkerPreviewAnalytics */; moduleValue.trackGuildIconClicked(guildId); } (TransitionGuildsBarToGuildOrOpenSelectedChannel)(guildId); } function _fun109106(a0) { // fn#109106, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:2654, offset: 0x0233de1d, size: 362 bytes, params: 2, frame: 20 var environment; var moduleValue; var defaultImport; var sortedGuildStoreBinding; var value4; var pageY; var binding; const value = environment.__proto__.__proto__; const guild = GuildStore.getGuild(guildId); if (guild != null) { moduleValue = require(4559) /* metro dependency 4559: useIsScreenReaderEnabledNative */; if (!moduleValue.getIsScreenReaderEnabled()) { defaultImport = importDefault(14386) /* metro dependency 14386: getGuildsBarGuildMenuItems */; guildIdBinding = guildId; sortedGuildStoreBinding = SortedGuildStore; value4 = defaultImport(guildIdBinding, sortedGuildStoreBinding.getGuildsTree().version); if (value4.length !== 0) { pageY = a0.nativeEvent.pageY; binding = env2_18; binding.activeIndex.set(-1); (require(8812) /* metro dependency 8812: ContextMenuStateNative */).showContextMenu({key: guildId, title: guild.name, items: value4, x: 12 + env1_1 + 12, y: pageY - env1_1 / 2, positionX: 'left', positionY: 'below', width: env1_1, height: env1_1, state: binding, dividerIndexes: [], keyboardShouldPersistTaps: 'never', requestClose: requestClose_109107, onClose: function() { }}); } } } function requestClose_109107(a0) { // fn#109107, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:3020, offset: 0x0233df87, size: 117 bytes, params: 2, frame: 12 var value; var binding; var activeIndex; var property; if (!a0) { binding = env0_0; value = environment.__proto__.__proto__.__proto__; activeIndex = env3_18.activeIndex; property = binding[activeIndex.get()]; if (property != null) { property.action(); } } value = environment.__proto__.__proto__.__proto__; env3_18.activeIndex.set(-1); (ContextMenuStateNativeModule).hideContextMenu(); } } } function _fun109109() { // fn#109109, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:3193, offset: 0x0233dffc, size: 850 bytes, params: 1, frame: 20 var r0; const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; var push; var value8; var value9; var value10; var value11; var value12; var value; const r5 = mentionCount == null ? unread === true ? intl.formatToPlainString(t.lzqe42, {guildName: guildName}) : intl.formatToPlainString(t['/uzRss'], {guildName: guildName, mentions: mentionCount}) : mentionCount > 0 ? intl.formatToPlainString(t['/uzRss'], {guildName: guildName, mentions: mentionCount}) : unread === true ? intl.formatToPlainString(t.lzqe42, {guildName: guildName}) : intl.formatToPlainString(t['/uzRss'], {guildName: guildName, mentions: mentionCount}); const items2 = []; if (mediaState.activeEvent) { push = items2.push; value8 = environment.__proto__; Reflect.apply(push, items2, [intl.string(t.dHvJ2p)]); } if (mediaState.liveStage) { push = items2.push; value9 = environment.__proto__; Reflect.apply(push, items2, [intl.string(t.OO7ndG)]); } if (mediaState.screenshare) { push = items2.push; value10 = environment.__proto__; Reflect.apply(push, items2, [intl.string(t.wsHMZ7)]); } if (mediaState.video) { push = items2.push; value11 = environment.__proto__; Reflect.apply(push, items2, [intl.string(t.BrLCS0)]); } if (mediaState.audio) { push = items2.push; value12 = environment.__proto__; Reflect.apply(push, items2, [intl.string(t.jPBhKy)]); } if (mediaState.activity) { push = items2.push; value = environment.__proto__; Reflect.apply(push, items2, [intl.string(t.Y3Gii5)]); } if (items2.length > 0) { value = items2.join(' '); value = '' + r5 + ', ' + value; r0 = value; } else { r0 = r5; } return r0; } function _fun109111() { // fn#109111, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:4075, offset: 0x0233e367, size: 162 bytes, params: 1, frame: 18 var environment; let value = environment.__proto__; value = importDefault(dependencyMap[29]); const guildIdBinding = guildId; value = value(guildIdBinding, version); const value3 = importDefault(dependencyMap[32])(guildIdBinding, version); value = value.map(function(a0) { return {name: a0.label, label: a0.label, action: a0.action}; }); const items2 = []; value = arraySpread(items2, value, 0, dependencyMap); arraySpread(items2, value3.map(function(a0) { return {name: a0.name, label: a0.label, action: a0.action}; }), value, dependencyMap); const object = {}; object.accessibilityActions = items2.map(function({name, label}) { return {name: name, label: label}; }); object.onAccessibilityAction = onAccessibilityAction_109115; return object; function onAccessibilityAction_109115(a0) { // fn#109115, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:4321, offset: 0x0233e466, size: 68 bytes, params: 2, frame: 12 const env0_0 = a0; const value = env0_0.find(_fun109116); if (!(value == null || value.action == null)) { value.action(); } function _fun109116({name}) { // fn#109116, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:4369, offset: 0x0233e4aa, size: 33 bytes, params: 2, frame: 2 return name === env0_0.nativeEvent.actionName; } } } function GuildsBarGuildF(a0) { // fn#109117, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14612:4555, owner: GuildsBarGuild.f, offset: 0x0233e4cb, size: 260 bytes, params: 2, frame: 20 var r4; var moduleValue; var moduleValue2; var value; let r3 = dragDropInProgress.get() && GuildsBarDnDStoreModule.useItemDragState.get() === guildId && !isDragTarget; const set = GuildsBarDnDStoreModule.useItemDragState.set; const guildIdBinding = guildId; const value6 = null; Reflect.apply(set, GuildsBarDnDStoreModule.useItemDragState, [value6 != guildIdBinding ? guildId : value6]); const object2 = {}; if (r3) { value = environment.__proto__; moduleValue = require(4577) /* metro dependency 4577: spring */; value = moduleValue.withSpring(a0.targetOriginY, TRANSITION_PHYSICS, 'animate-always'); r4 = value; } else { r4 = a0.targetOriginY; } object2.originY = r4; if (r3) { value = environment.__proto__; moduleValue2 = require(4577) /* metro dependency 4577: spring */; value = moduleValue2.withSpring(a0.targetHeight, TRANSITION_PHYSICS, 'animate-always'); r3 = value; } else { r3 = a0.targetHeight; } object2.height = r3; return {animations: object2, initialValues: {originY: a0.currentOriginY, height: a0.currentHeight}}; } } } global.__d(_fun109099, 14415, [31, 3785, 1422, 4646, 5214, 1867, 3969, 4896, 14384, 14385, 661, 33, 4017, 4501, 697, 1357, 3860, 14395, 4013, 566, 6819, 14416, 14417, 4647, 1244, 683, 6914, 14410, 4559, 14386, 8812, 14425, 14426, 4577, 14428, 5475, 14433, 2]) /* metro module 14415, dependencies: [31, 3785, 1422, 4646, 5214, 1867, 3969, 4896, 14384, 14385, 661, 33, 4017, 4501, 697, 1357, 3860, 14395, 4013, 566, 6819, 14416, 14417, 4647, 1244, 683, 6914, 14410, 4559, 14386, 8812, 14425, 14426, 4577, 14428, 5475, 14433, 2] */;