/* Metro module 6819; source: modules/guild/native/GuildIcon.tsx; dependencies: [57, 31, 6820, 1422, 661, 33, 4501, 697, 1861, 6619, 5475, 6821, 290, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import UseRefValue from '../../../hooks/useRefValue.tsx'; /* Metro dependency 6619 */
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 GuildRecordModule from '../../../records/GuildRecord.tsx'; /* Metro dependency 1422 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as ExpressionSourceRecordModule from '../../emojis/records/ExpressionSourceRecord.tsx'; /* Metro dependency 6820 */
function _fun53594(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#53594, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6997:6, offset: 0x01350ad5, size: 1285 bytes, params: 8, frame: 37
const env0_0 = require;
const closure = function(a0) {
return {width: a0, height: a0, borderRadius: a0 / 3};
};
const coerceStableAsset = function(a0) {
var value = a0;
return global.Array.isArray(value) ? value[0]?.uri : value != null ? typeof value === 'number' ? value : value.uri : undefined;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
const Fonts = (ConstantsModule).Fonts;
object = {XXXSMALL: 'XXXSMALL', XXSMALL_12: 'XXSMALL_12', XXSMALL: 'XXSMALL', XSMALL_20: 'XSMALL_20',
XSMALL: 'XSMALL', SMALL: 'SMALL', SMALL_32: 'SMALL_32', SMALL_36: 'SMALL_36', NORMAL: 'NORMAL', LARGE: 'LARGE',
XLARGE: 'XLARGE', XXLARGE: 'XXLARGE'};
const object2 = {};
let XXXSMALL = object.XXXSMALL;
object2[XXXSMALL] = [6, 4, 4, 4, 2, 1];
let XXSMALL_12 = object.XXSMALL_12;
object2[XXSMALL_12] = [8, 6, 6, 4, 4, 2];
let XXSMALL = object.XXSMALL;
object2[XXSMALL] = [10, 8, 8, 6, 6, 4];
let XSMALL_20 = object.XSMALL_20;
object2[XSMALL_20] = [12, 10, 10, 8, 8, 6];
let XSMALL = object.XSMALL;
object2[XSMALL] = [16, 16, 16, 14, 14, 12];
let SMALL = object.SMALL;
object2[SMALL] = [16, 16, 16, 14, 14, 12];
let SMALL_32 = object.SMALL_32;
object2[SMALL_32] = [16, 16, 16, 14, 14, 12];
let SMALL_36 = object.SMALL_36;
object2[SMALL_36] = [16, 16, 16, 14, 14, 12];
let NORMAL = object.NORMAL;
object2[NORMAL] = [16, 16, 16, 14, 14, 12];
let LARGE = object.LARGE;
object2[LARGE] = [16, 16, 16, 14, 14, 12];
let XLARGE = object.XLARGE;
object2[XLARGE] = [16, 16, 16, 14, 14, 12];
let XXLARGE = object.XXLARGE;
object2[XXLARGE] = [16, 16, 16, 14, 14, 12];
const object3 = {};
XXXSMALL = object.XXXSMALL;
object3[XXXSMALL] = 10;
XXSMALL_12 = object.XXSMALL_12;
object3[XXSMALL_12] = 12;
XXSMALL = object.XXSMALL;
object3[XXSMALL] = 16;
XSMALL_20 = object.XSMALL_20;
object3[XSMALL_20] = 20;
XSMALL = object.XSMALL;
object3[XSMALL] = 24;
SMALL = object.SMALL;
object3[SMALL] = 30;
SMALL_32 = object.SMALL_32;
object3[SMALL_32] = 32;
SMALL_36 = object.SMALL_36;
object3[SMALL_36] = 36;
NORMAL = object.NORMAL;
object3[NORMAL] = 40;
LARGE = object.LARGE;
object3[LARGE] = 48;
XLARGE = object.XLARGE;
object3[XLARGE] = 64;
XXLARGE = object.XXLARGE;
object3[XXLARGE] = 80;
const createStyles = CreateStylesModule.createStyles;
const object4 = {guildIcon: {'justifyContent': 'center', 'alignItems': 'center', 'overflow': 'hidden'}};
XXXSMALL = object.XXXSMALL;
object4[XXXSMALL] = closure(10);
XXSMALL_12 = object.XXSMALL_12;
object4[XXSMALL_12] = closure(12);
XXSMALL = object.XXSMALL;
object4[XXSMALL] = closure(16);
XSMALL_20 = object.XSMALL_20;
object4[XSMALL_20] = closure(20);
XSMALL = object.XSMALL;
object4[XSMALL] = closure(24);
SMALL = object.SMALL;
object4[SMALL] = closure(30);
SMALL_32 = object.SMALL_32;
object4[SMALL_32] = closure(32);
SMALL_36 = object.SMALL_36;
object4[SMALL_36] = closure(36);
NORMAL = object.NORMAL;
object4[NORMAL] = closure(40);
LARGE = object.LARGE;
object4[LARGE] = closure(48);
XLARGE = object.XLARGE;
object4[XLARGE] = closure(64);
XXLARGE = object.XXLARGE;
object4[XXLARGE] = closure(80);
const BACKGROUND_BRAND = (Native).colors.BACKGROUND_BRAND;
object4['guildTextContainer'] = {backgroundColor: BACKGROUND_BRAND};
const MOBILE_GUILDBAR_ICON_BACKGROUND_DEFAULT = (Native).colors.MOBILE_GUILDBAR_ICON_BACKGROUND_DEFAULT;
object4['guildTextContainerInactive'] = {backgroundColor: MOBILE_GUILDBAR_ICON_BACKGROUND_DEFAULT};
const BACKGROUND_BASE_LOW = (Native).colors.BACKGROUND_BASE_LOW;
object4['guildTextContainerInactiveNested'] = {backgroundColor: BACKGROUND_BASE_LOW};
const INTERACTIVE_TEXT_DEFAULT = (Native).colors.INTERACTIVE_TEXT_DEFAULT;
let PRIMARY_SEMIBOLD = Fonts.PRIMARY_SEMIBOLD;
object4['guildText'] = {color: INTERACTIVE_TEXT_DEFAULT, fontFamily: PRIMARY_SEMIBOLD};
const object9 = {};
PRIMARY_SEMIBOLD = Fonts.PRIMARY_SEMIBOLD;
object9.fontFamily = PRIMARY_SEMIBOLD;
const WHITE = (Native).colors.WHITE;
object9.color = WHITE;
object4['guildTextActive'] = object9;
object4['guildTextContainerInactiveAlt'] = {backgroundColor: 'transparent'};
const env0_12 = Reflect.apply(createStyles, CreateStylesModule, [object4]);
value = value.memo(GuildIconInner);
(FileImportTrackerModule).fileFinishedImporting('modules/guild/native/GuildIcon.tsx');
exports.default = value;
exports.GuildIconSizes = object;
exports.ImageSizes = object3;
function getGuildIconSource_53596(a0, a1, a2, a3) { // fn#53596, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6997:2074, offset: 0x01350ff4, size: 109 bytes, params: 5, frame: 18
const value = null;
return value == a0 ? value != a3 ? {uri: a3} : value : value != a0.icon ? a0 instanceof ExpressionSourceGuildRecord ? a0.getIconSource(env0_11[a1],
a2) : getGuildIconSource(a0, env0_11[a1], a2) : value != a3 ? {uri: a3} : value;
}
function GuildIconInner({guild, icon, animate, loadingStyle, size = env0_9.NORMAL, selected, TABS_altDefaultBackground, nested, textStyle, preloadAnimation, value = '', style}) { // fn#53598, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6997:2356, offset: 0x013510b5, size: 928 bytes, params: 2, frame: 39
var r3;
var r13;
var r0;
let value = undefined;
icon = icon === value ? null : icon;
animate = !(animate === value) && animate;
const size2 = size;
const selected2 = selected;
TABS_altDefaultBackground = !(TABS_altDefaultBackground === value) && TABS_altDefaultBackground;
nested = !(nested === value) && nested;
const styles = useStyles();
const guildIconSource_53596 = getGuildIconSource_53596(guild, size, animate, icon);
let binding = selected2;
const value11 = binding.useRef(guildIconSource_53596);
let useState = binding.useState;
const value12 = Reflect.apply(useState, binding, [{}]);
const binding2 = size2;
const env0_10 = binding2(value12, 2)[1];
useState = binding.useState;
const value14 = binding2(Reflect.apply(useState, binding, [false]), 2);
let property = value14[0];
const env0_11 = value14[1];
const env0_12 = binding.useRef(true);
const value15 = (UseRefValue)(value11);
const coerceStableAssetBinding = coerceStableAsset;
const value16 = coerceStableAssetBinding(value15);
const value17 = coerceStableAssetBinding(guildIconSource_53596);
const value18 = value16 !== value17;
const r12 = value18 ? preloadAnimation && value17 === 'string' : !value18;
const value21 = !r12;
binding = selected2;
binding.useEffect(function() {
return _fun53600;
}, []);
binding.useEffect(_fun53601, [value21, animate, value18, guild, icon, preloadAnimation, size]);
const r15 = r12 ? value15 : guildIconSource_53596;
const value22 = r15 == null;
const r17 = value22 || property ? value : loadingStyle ?? value;
const r16 = value22 ? selected !== false ? value : nested ? styles.guildTextContainerInactiveNested : TABS_altDefaultBackground ? styles.guildTextContainerInactiveAlt : styles.guildTextContainerInactive : value;
value = guild != null ? getGuildAcronym(guild) : (require(1861) /* metro dependency 1861: StringUtils */).getAcronym(value);
if (value22) {
property = env0_10[size];
r3 = value === value ? value : property[value.length];
property = property[property.length - 1];
r13 = r3 ?? property;
} else {
r13 = value;
}
const {handleLoaded, wrapperStyle, textComponentStyle} = selected2.useMemo(_fun53604, [style, size, styles, r17,
r16, r13, selected, textStyle, value22]);
if (value22) {
r0 = ((Component) => {((NativeText) => {value})((require(290) /* metro dependency 290 */).NativeText)})(importDefault(6821) /* metro dependency 6821: NativeView */);
} else {
value = ((Component) => )(importDefault(5475) /* metro dependency 5475: FastImage */);
r0 = value;
}
return r0;
function _fun53599() { // fn#53599, offset: 0x01351455, size: 9 bytes, params: 1, frame: 1
return _fun53600;
function _fun53600() { // fn#53600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6997:2798, offset: 0x0135145e, size: 19 bytes, params: 1, frame: 2
env1_12.current = false;
}
}
function _fun53601() { // fn#53601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6997:2835, offset: 0x01351471, size: 148 bytes, params: 1, frame: 20
var environment;
let value = environment.__proto__;
const guildIconSource_53596 = getGuildIconSource_53596(guild, Module00057, animate, icon);
const value4 = coerceStableAsset(guildIconSource_53596);
if (env0_14) {
if (env0_13) {
env0_9.current = guildIconSource_53596;
}
} else if (env0_13) {
if (preloadAnimation) {
if (typeof value4 !== 'string') {
if (env0_13) {
env0_9.current = guildIconSource_53596;
}
} else {
value = importDefault(5475) /* metro dependency 5475: FastImage */;
value = value.preload(value4);
value.then(function() {
global.setTimeout(_fun53603, 0);
});
}
} else if (env0_13) {
env0_9.current = guildIconSource_53596;
}
} else if (env0_13) {
env0_9.current = guildIconSource_53596;
}
function _fun53602() { // fn#53602, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6997:2952, offset: 0x01351505, size: 27 bytes, params: 1, frame: 13
global.setTimeout(_fun53603, 0);
function _fun53603() { // fn#53603, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6997:2969, offset: 0x01351520, size: 49 bytes, params: 1, frame: 11
var binding;
var value2;
if (env2_12.current) {
binding = env2_9;
value2 = environment.__proto__;
binding.current = env1_0;
binding = env2_10;
binding({});
}
}
}
}
function _fun53604() { // fn#53604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6997:3405, offset: 0x01351551, size: 226 bytes, params: 1, frame: 14
const items2 = [styles.guildIcon];
items2[1] = styles[Module00057];
items2[2] = style;
if (env0_16 != null) {
items2.push(env0_16);
}
if (env0_15) {
items2.unshift(styles.guildTextContainer);
}
if (env0_17 != null) {
items2.push(env0_17);
}
return {handleLoaded: handleLoaded, wrapperStyle: items2,
textComponentStyle: env0_15 ? [selected === false ? styles.guildText : styles.guildTextActive,
{fontSize: env0_18}, textStyle] : undefined};
function handleLoaded() { // fn#53605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6997:3531, offset: 0x01351633, size: 18 bytes, params: 1, frame: 11
return env1_11(true);
}
}
}
}
global.__d(_fun53594, 6819, [57, 31, 6820, 1422, 661, 33, 4501, 697, 1861, 6619, 5475, 6821, 290,
2]) /* metro module 6819, dependencies: [57, 31, 6820, 1422, 661, 33, 4501, 697, 1861, 6619, 5475, 6821, 290, 2] */;