/* Metro module 14689; source: modules/premium/powerups/native/GuildPowerupsProgressBar.tsx; dependencies: [31, 27, 14690, 1867, 33, 697, 4017, 4589, 4501, 632, 14691, 14692, 4504, 14599, 6789, 1244, 2256, 8554, 4573, 6818, 2] */
import Native from '../../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import GuildStore from '../../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import ReanimatedRexport from '../../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import LinearGradient from '../../../../by-id/module-04589-LinearGradient.js'; /* Metro dependency 4589 */
import AnalyticsLocation from '../../../app_analytics/AnalyticsLocation.tsx'; /* Metro dependency 6789 */
import GuildBoostingProgressBarPersistedStore from '../../../guild_boosting/GuildBoostingProgressBarPersistedStore.tsx'; /* Metro dependency 14690 */
import UseTotalPossibleBoostCount from '../hooks/useTotalPossibleBoostCount.tsx'; /* Metro dependency 14691 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
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 ReanimatedRexportModule from '../../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import * as CreateStylesModule from '../../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TimingModule from '../../../../design/animation/reanimated/timing/timing.tsx'; /* Metro dependency 4504 */
import * as TextModule from '../../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ChevronSmallRightIconModule from '../../../../design/components/Icon/native/redesign/generated/ChevronSmallRightIcon.tsx'; /* Metro dependency 6818 */
import * as NativeModule from '../../../../design/components/experimental/native.tsx'; /* Metro dependency 8554 */
function _fun110832(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#110832, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14886:6, offset: 0x02388c3a, size: 636 bytes, params: 8, frame: 26
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const StyleSheet = value.StyleSheet;
const env0_4 = value.View;
value = require(33) /* metro dependency 33 */;
const env0_7 = value.jsx;
const env0_8 = value.jsxs;
let PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
value = 2 * PX_4;
const env0_9 = ['rgba(255, 115, 250, 0.4)', 'rgba(255, 115, 250, 0.1)'];
const env0_10 = (ReanimatedRexport).createAnimatedComponent(LinearGradient);
const createStyles = CreateStylesModule.createStyles;
object = {};
const object2 = {};
PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object2.paddingVertical = PX_4;
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.paddingHorizontal = PX_16;
object.container = object2;
const object3 = {height: 30};
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
const BACKGROUND_MOD_NORMAL = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_NORMAL;
object3.backgroundColor = BACKGROUND_MOD_NORMAL;
object3.justifyContent = 'center';
object.track = object3;
const object4 = {};
copyDataProperties(object4, StyleSheet.absoluteFillObject, undefined);
object4['padding'] = 2;
object.fillContainer = object4;
const object5 = {'height': '100%', 'minWidth': 26, 'borderRadius': null, 'borderWidth': 1,
'borderColor': 'rgba(255, 115, 250, 0.2)', 'overflow': 'hidden'};
object5.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
object.fill = object5;
object.fillShadow = {'shadowColor': 'rgba(0, 0, 0, 0.14)', 'shadowOffset': null, 'shadowOpacity': 1,
'shadowRadius': 4, 'elevation': 2, shadowOffset: {'width': 0, 'height': 1}};
const PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.textContainer = {'flexDirection': 'row', 'justifyContent': 'space-between', 'alignItems': 'center',
paddingHorizontal: PX_12};
object.rightContent = {'flexDirection': 'row', 'alignItems': 'center'};
const env0_11 = Reflect.apply(createStyles, CreateStylesModule, [object]);
object = {code: 'function GuildPowerupsProgressBarTsx1(){const{animatedFillPercent,animatedFillOpacity}=this.__closure;return{width:animatedFillPercent.get()+"%",opacity:animatedFillOpacity.get()};}'};
(FileImportTrackerModule).fileFinishedImporting('modules/premium/powerups/native/GuildPowerupsProgressBar.tsx');
exports.default = GuildPowerupsProgressBar;
exports.BOOST_PROGRESS_BAR_HEIGHT = value + 30;
function GuildPowerupsProgressBar({guildId}) { // fn#110833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14886:1340, offset: 0x02388eb6, size: 1296 bytes, params: 2, frame: 32
const intl = (IndexNativeModule).intl;
let env0_3 = undefined;
const styles = useStyles();
const value3 = (require(632) /* metro dependency 632: useStateFromStores */).useStateFromStores([GuildStore],
function() {
return GuildStore.getGuild(guildId);
}, [guildId]);
const value4 = (UseTotalPossibleBoostCount)(value3);
const value5 = (require(632) /* metro dependency 632: useStateFromStores */).useStateFromStores([GuildBoostingProgressBarPersistedStore],
_fun110835, [guildId]);
let r11 = value3?.premiumSubscriberCount ?? 0;
let binding = env0_3;
binding.useEffect(_fun110836, [guildId, value5, r11]);
const r1 = value4 > 0 ? global.Math.min(value5 / value4 * 100, 100) : 0;
env0_3 = r1;
const value8 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(r1);
const value10 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(r1 > 0 ? 1 : 0);
binding = env0_3;
binding.useEffect(_fun110837, [value8, value10, r1]);
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const useAnimatedStyle = reanimatedRexportModule.useAnimatedStyle;
const GuildPowerupsProgressBarV2 = GuildPowerupsProgressBarV;
GuildPowerupsProgressBarV2.__closure = {animatedFillPercent: value8, animatedFillOpacity: value10};
GuildPowerupsProgressBarV2.__workletHash = 6718232104000;
GuildPowerupsProgressBarV2.__initData = env0_12;
const value11 = Reflect.apply(useAnimatedStyle, reanimatedRexportModule, [GuildPowerupsProgressBarV2]);
const value12 = binding.useCallback(_fun110840, [guildId]);
const r18 = value5 >= value4 ? intl.formatToPlainString((importDefault(2256) /* metro dependency 2256: GuildPowerupsMessages */)['Ehpq+7'],
{appliedBoostCount: value5}) : intl.formatToPlainString((importDefault(2256) /* metro dependency 2256: GuildPowerupsMessages */)['/rbPDs'],
{appliedBoostCount: value5, maxBoostCount: value4});
const PressableScale = (NativeModule).PressableScale;
object = {accessibilityRole: 'button'};
const string = intl.string;
const NI6Ihe = (importDefault(2256) /* metro dependency 2256: GuildPowerupsMessages */).NI6Ihe;
object.accessibilityLabel = Reflect.apply(string, intl, [NI6Ihe]);
object.onPress = value12;
object.style = styles.container;
const view = (
{((Component) => )(env0_10)}
);
const Text = (TextModule).Text;
r11 = r11 >= value4 ? '' + intl.string((importDefault(2256) /* metro dependency 2256: GuildPowerupsMessages */).NI6Ihe) + ' 🎉' : intl.string((importDefault(2256) /* metro dependency 2256: GuildPowerupsMessages */).NI6Ihe);
const text = (
{r11}
);
const text2 = (
{r18}
);
const ChevronSmallRightIcon = (ChevronSmallRightIconModule).ChevronSmallRightIcon;
const TEXT_DEFAULT = (Native).colors.TEXT_DEFAULT;
return (
{view}
{text}
{text2}
);
function _fun110835() { // fn#110835, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14886:1505, offset: 0x023893c6, size: 43 bytes, params: 1, frame: 11
const value = environment.__proto__;
return GuildBoostingProgressBarPersistedStore.getCountForGuild(guildId) ?? 0;
}
function _fun110836() { // fn#110836, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14886:1635, offset: 0x023893f1, size: 64 bytes, params: 1, frame: 13
var value2;
var moduleValue;
if (env0_1 !== env0_2) {
value2 = environment.__proto__;
moduleValue = require(14692) /* metro dependency 14692: GuildBoostingProgressBarActionCreators */;
moduleValue.updateGuildPremiumSubscriptionCount(guildId, env0_2);
}
}
function _fun110837() { // fn#110837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14886:1817, offset: 0x02389431, size: 136 bytes, params: 1, frame: 22
let binding = env0_4;
let set = binding.set;
let withTiming = TimingModule.withTiming;
Reflect.apply(set, binding, [Reflect.apply(withTiming, TimingModule, [env0_3, {duration: 500}])]);
binding = env0_5;
set = binding.set;
withTiming = TimingModule.withTiming;
const value = 0;
Reflect.apply(set, binding, [Reflect.apply(withTiming, TimingModule, [env0_3 > value ? 1 : value,
{duration: 500}])]);
return _fun110838;
function _fun110838() { // fn#110838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14886:1918, offset: 0x023894b9, size: 69 bytes, params: 1, frame: 16
const value = environment.__proto__.__proto__;
(ReanimatedRexportModule).cancelAnimation(env1_4);
(ReanimatedRexportModule).cancelAnimation(env1_5);
}
}
function GuildPowerupsProgressBarV() { // fn#110839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14886:2026, owner: GuildPowerupsProgressBar.v, offset: 0x023894fe, size: 68 bytes, params: 1, frame: 15
const object = {};
object.width = '' + env0_4.get() + '%';
object.opacity = env0_5.get();
return object;
}
function _fun110840() { // fn#110840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14886:2192, offset: 0x02389542, size: 68 bytes, params: 1, frame: 14
let value = environment.__proto__;
value = importDefault(14599) /* metro dependency 14599: openGuildPowerupsModal */;
const object = {};
object.guildId = guildId;
const GUILD_BOOSTING_SIDEBAR_DISPLAY = (AnalyticsLocation).GUILD_BOOSTING_SIDEBAR_DISPLAY;
object.analyticsLocation = GUILD_BOOSTING_SIDEBAR_DISPLAY;
value(object);
}
}
}
global.__d(_fun110832, 14689, [31, 27, 14690, 1867, 33, 697, 4017, 4589, 4501, 632, 14691, 14692, 4504, 14599, 6789,
1244, 2256, 8554, 4573, 6818,
2]) /* metro module 14689, dependencies: [31, 27, 14690, 1867, 33, 697, 4017, 4589, 4501, 632, 14691, 14692, 4504, 14599, 6789, 1244, 2256, 8554, 4573, 6818, 2] */;