/* Metro module 11734; source: modules/polls/native/PollCreation.tsx; dependencies: [31, 27, 7217, 33, 4501, 697, 477, 4500, 1244, 7981, 1305, 10376, 4573, 11735, 4080, 11736, 1962, 6238, 4015, 8742, 480, 5463, 11733, 3857, 11098, 3869, 11737, 11742, 5286, 7149, 4497, 11743, 5277, 5313, 11744, 7972, 11746, 8950, 2] */ import Module05313 from '../../../by-id/module-05313.js'; /* Metro dependency 5313 */ import UseSafeAreaInsetsKeyboardAwareNative from '../../safe_area/useSafeAreaInsetsKeyboardAware.native.tsx'; /* Metro dependency 5463 */ import UseTrackImpression from '../../app_analytics/useTrackImpression.tsx'; /* Metro dependency 8742 */ import UsePollDurationOptions from '../usePollDurationOptions.tsx'; /* Metro dependency 11735 */ import PollAnswerInput from './PollAnswerInput.tsx'; /* Metro dependency 11746 */ 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 JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */ import * as AnalyticsUtilsModule from '../../../external/discord_common/js/packages/analytics-utils/AnalyticsUtils.tsx'; /* Metro dependency 480 */ import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */ import * as AccessibilityAnnouncerAndroidModule from '../../../external/discord_common/js/packages/design/components/AccessibilityAnnouncer/AccessibilityAnnouncer.android.tsx'; /* Metro dependency 3869 */ import * as AlertModalNativeModule from '../../../design/components/AlertModal/native/AlertModal.native.tsx'; /* Metro dependency 4500 */ import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */ import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */ import * as HeaderActionButtonNativeModule from '../../../design/components/Navigator/native/HeaderActionButton.native.tsx'; /* Metro dependency 5277 */ import * as UseNavigatorBackPressHandlerNativeModule from '../../../design/components/Navigator/native/useNavigatorBackPressHandler.native.tsx'; /* Metro dependency 5286 */ import * as TableRowNativeModule from '../../../design/components/TableRow/native/TableRow.native.tsx'; /* Metro dependency 6238 */ import * as PollsUtilsModule from '../PollsUtils.tsx'; /* Metro dependency 7149 */ import * as PollsConstantsModule from '../PollsConstants.tsx'; /* Metro dependency 7217 */ import * as NativeModule2 from '../../../design/void/Form/native/index.tsx'; /* Metro dependency 7972 */ import * as TextInputNativeModule from '../../../design/components/TextInput/native/TextInput.native.tsx'; /* Metro dependency 7981 */ import * as TableCheckboxRowNativeModule from '../../../design/components/TableRow/native/TableCheckboxRow.native.tsx'; /* Metro dependency 8950 */ import * as PollsIconModule from '../../../design/components/Icon/native/redesign/generated/PollsIcon.tsx'; /* Metro dependency 11098 */ import * as PollCreationModalActionCreatorsModule from './PollCreationModalActionCreators.tsx'; /* Metro dependency 11733 */ import * as UseTrackPollEventsModule from '../useTrackPollEvents.tsx'; /* Metro dependency 11742 */ function _fun89916(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#89916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:6, offset: 0x02023666, size: 668 bytes, params: 8, frame: 26 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const createStyles = CreateStylesModule.createStyles; object = {}; object.viewPadding = {paddingHorizontal: 18}; object.scrollContainer = {'paddingVertical': 20, 'gap': 16}; const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW; object.safeAreaContainer = {backgroundColor: BACKGROUND_BASE_LOW, flex: 1}; const value6 = 10; object.header = {'flexDirection': 'row', 'paddingHorizontal': 18, 'paddingVertical': 10}; object.actionButton = {'flex': 0, 'justifyContent': 'flex-start', 'minWidth': 48, 'paddingHorizontal': 0, 'marginHorizontal': 0}; object.postButton = {justifyContent: 'flex-end'}; object.title = {'textAlign': 'center', 'flexGrow': 1}; object.label = {fontSize: 14}; object.answerInputsContainer = {'marginVertical': 20, 'rowGap': 16}; const object4 = {'paddingVertical': null, 'paddingLeft': 14, 'marginRight': 30, 'display': 'flex', 'flexDirection': 'row', 'gap': 16, 'alignItems': 'center', 'justifyContent': 'flex-start'}; object4.paddingVertical = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid() ? value6 : 8; const MESSAGE_BACKGROUND_HOVER = (importDefault(697) /* metro dependency 697: native */).colors.MESSAGE_BACKGROUND_HOVER; object4.backgroundColor = MESSAGE_BACKGROUND_HOVER; object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg; object.addAnswerButtonDefault = object4; const TEXT_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED; object.addAnswerIcon = {color: TEXT_MUTED}; const INTERACTIVE_BACKGROUND_HOVER = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_BACKGROUND_HOVER; object.pollConfigSection = {borderTopWidth: 1, borderColor: INTERACTIVE_BACKGROUND_HOVER}; const env0_12 = Reflect.apply(createStyles, CreateStylesModule, [object]); const env0_13 = ReactModule.forwardRef(_fun89921); (FileImportTrackerModule).fileFinishedImporting('modules/polls/native/PollCreation.tsx'); exports.default = PollCreation; function UnsavedChangesAlertModal({onConfirm}) { // fn#89917, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:1199, offset: 0x02023902, size: 370 bytes, params: 2, frame: 29 const AlertModal = (AlertModalNativeModule).AlertModal; const object = {}; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; let string = intl.string; const HMrgcp = (require(1244) /* metro dependency 1244: indexNative */).t.HMrgcp; object.title = Reflect.apply(string, intl, [HMrgcp]); object.content = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['Wxa/j8']); const jsxRuntimeEnv0_10Binding = jsxRuntimeEnv0_10; const AlertActionButton = (AlertModalNativeModule).AlertActionButton; string = intl.string; const TzJA4g = (require(1244) /* metro dependency 1244: indexNative */).t.TzJA4g; object.actions = ( <> ); return ; } function AddAnswerButton({onPress}) { // fn#89918, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:2194, offset: 0x02023a74, size: 319 bytes, params: 2, frame: 22 const styles = useStyles(); const addAnswerButtonDefault = styles.addAnswerButtonDefault; const Icon = (NativeModule).Icon; let object = {}; object.source = importDefault(10376) /* metro dependency 10376 */; const Icon2 = (NativeModule).Icon; const Sizes = Icon2.Sizes; const LARGE = Sizes.LARGE; object.size = LARGE; object.color = styles.addAnswerIcon.color; const icon = ; object = {onPress: onPress, style: addAnswerButtonDefault, accessibilityRole: 'button'}; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; let string = intl.string; let B2Uvme = (require(1244) /* metro dependency 1244: indexNative */).t.B2Uvme; object.accessibilityLabel = Reflect.apply(string, intl, [B2Uvme]); const Text = (TextModule).Text; string = intl.string; B2Uvme = (require(1244) /* metro dependency 1244: indexNative */).t.B2Uvme; return ( {icon} {Reflect.apply(string, intl, [B2Uvme])} ); } function PollDurationSelectionRow({selectedDuration, onChange}) { // fn#89919, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:2604, offset: 0x02023bb3, size: 342 bytes, params: 2, frame: 24 const property = (UsePollDurationOptions)()[selectedDuration]; const TableRow = (TableRowNativeModule).TableRow; const object = {}; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; let string = intl.string; object.label = Reflect.apply(string, intl, [(require(1244) /* metro dependency 1244: indexNative */).t.bGHzxb]); object.accessibilityLabel = '' + intl.string((require(1244) /* metro dependency 1244: indexNative */).t.bGHzxb) + ' ' + property; string = intl.string; const A4PJ1o = (require(1244) /* metro dependency 1244: indexNative */).t.A4PJ1o; object.accessibilityHint = Reflect.apply(string, intl, [A4PJ1o]); object.onPress = function() { require(dependencyMap[18]).dismissKeyboard(); importDefault(dependencyMap[14]).openLazy(require(dependencyMap[16])(dependencyMap[15], dependencyMap.paths), POLL_CREATION_DURATION_ACTION_SHEET_KEY, {selectedDuration: selectedDuration, onChange: onChange}); }; const Text = (TextModule).Text; object.trailing = ( {property} ); object.arrow = true; return ; } function _fun89921({onChange, onSubmitEditing, error}, a1) { // fn#89921, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:1616, offset: 0x02023d84, size: 410 bytes, params: 3, frame: 25 const r9 = error != null && error.length > 0; const TextInput = (TextInputNativeModule).TextInput; const object = {ref: a1, textAlignVertical: 'center'}; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; let string = intl.string; let WBiKnI = (require(1244) /* metro dependency 1244: indexNative */).t.WBiKnI; object.label = Reflect.apply(string, intl, [WBiKnI]); string = intl.string; WBiKnI = (require(1244) /* metro dependency 1244: indexNative */).t.WBiKnI; object.accessibilityLabel = Reflect.apply(string, intl, [WBiKnI]); object.accessibilityHint = r9 ? intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.jnq5Ho, {errorMessage: error}) : undefined; object.placeholder = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['/uQqJW']); object.onChange = onChange; object.isClearable = true; object.status = r9 ? 'error' : 'default'; object.errorMessage = error; object.maxLength = MAX_POLL_QUESTION_LENGTH; object.returnKeyType = 'next'; object.blurOnSubmit = false; object.onSubmitEditing = onSubmitEditing; object.textContentType = 'none'; object.autoFocus = true; object.autoCorrect = true; return ; } function PollCreation({channel, onCancel}) { // fn#89922, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:3104, offset: 0x02023f1e, size: 1620 bytes, params: 2, frame: 44 const defaultImport = UseTrackImpression; const object = {}; const ImpressionTypes = (AnalyticsUtilsModule).ImpressionTypes; const VIEW = ImpressionTypes.VIEW; object.type = VIEW; const ImpressionNames = (AnalyticsUtilsModule).ImpressionNames; const POLL_EDITOR_VIEWED = ImpressionNames.POLL_EDITOR_VIEWED; object.name = POLL_EDITOR_VIEWED; defaultImport(object); const binding = env0_3; binding.useEffect(function() { return _fun89924; }, [onCancel]); const styles = useStyles(); const insets = (UseSafeAreaInsetsKeyboardAwareNative)({includeKeyboardHeight: true}).insets; const env0_2 = binding.useRef(false); const value5 = (importDefault(11737) /* metro dependency 11737: useCreatePollFormData */)(channel, binding.useCallback(_fun89925, []), binding.useCallback(function({indexToRemove}) { var AccessibilityAnnouncer = require(dependencyMap[25]).AccessibilityAnnouncer; var intl = require(dependencyMap[8]).intl; var BByGU4 = require(dependencyMap[8]).t.BByGU4; AccessibilityAnnouncer.announce(intl.formatToPlainString(BByGU4, {number: indexToRemove + 1})); }, [])); const answers = value5.answers; const env0_4 = value5.question; const allowMultiSelect = value5.allowMultiSelect; const env0_6 = value5.setAllowMultiSelect; const canAddMoreAnswers = value5.canAddMoreAnswers; const env0_7 = value5.canRemoveMoreAnswers; const handleQuestionChange = value5.handleQuestionChange; const env0_8 = value5.handleAnswerTextChange; const env0_9 = value5.handleEmojiSelect; const handleAddAnswer = value5.handleAddAnswer; const env0_11 = value5.handleRemoveAnswer; const env0_12 = value5.handleRemoveAnswerImage; const handleSubmitPoll = value5.handleSubmitPoll; const fieldErrors = value5.fieldErrors; const fieldErrors2 = fieldErrors; const duration = value5.duration; const setDuration = value5.setDuration; const createPollError = value5.createPollError; const submitting = value5.submitting; const shouldFocusOnInvalidField = value5.shouldFocusOnInvalidField; const setShouldFocusOnInvalidField = value5.setShouldFocusOnInvalidField; const useTrackPollCreationEvents = UseTrackPollEventsModule.useTrackPollCreationEvents; const env0_16 = Reflect.apply(useTrackPollCreationEvents, UseTrackPollEventsModule, [answers, allowMultiSelect]).trackPollCreationCancelled; (UseNavigatorBackPressHandlerNativeModule).useNavigatorBackPressHandler(_fun89928); const value6 = (importDefault(11743) /* metro dependency 11743: useFocusHelper */)({onAddAnswer: function() { handleAddAnswer(); }}); binding.useEffect(_fun89930, [fieldErrors, value6, setShouldFocusOnInvalidField, shouldFocusOnInvalidField]); const items3 = [styles.safeAreaContainer]; items3[1] = {paddingTop: insets.top, paddingBottom: insets.bottom}; const jsxRuntimeEnv0_10Binding = jsxRuntimeEnv0_10; const HeaderActionButton = (HeaderActionButtonNativeModule).HeaderActionButton; let intl = (require(1244) /* metro dependency 1244: indexNative */).intl; let string = intl.string; const items2 = [ , ]; const Text = (TextModule).Text; string = intl.string; const Flr51u = (require(1244) /* metro dependency 1244: indexNative */).t.Flr51u; items2[1] = ( {Reflect.apply(string, intl, [Flr51u])} ); string = intl.string; const JOj8Zk = (require(1244) /* metro dependency 1244: indexNative */).t.JOj8Zk; items2[2] = ( ); const items4 = [ {items2} , ]; const items5 = [ createPollError != null && ((Component) => {createPollError?.getAnyErrorMessage()})(importDefault(11744) /* metro dependency 11744: ErrorBlock */), ]; items5[1] = ((Component) => )(fieldErrors2); const FormLabel = (NativeModule2).FormLabel; const items6 = [ , ]; items6[1] = answers.map(_fun89932); items6[2] = canAddMoreAnswers && ; items5[2] = ( {items6} ); items4[1] = ( {items5} ); const pollDurationSelectionRow = ; const TableCheckboxRow = (TableCheckboxRowNativeModule).TableCheckboxRow; items4[2] = ( {pollDurationSelectionRow} ); return ( <> {items4} ); function _fun89923() { // fn#89923, offset: 0x02024572, size: 11 bytes, params: 1, frame: 1 return _fun89924; function _fun89924() { // fn#89924, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:3263, offset: 0x0202457d, size: 42 bytes, params: 1, frame: 11 if (!(env1_2.current || onCancel == null)) { onCancel(); } } } function _fun89925() { // fn#89925, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:3387, offset: 0x020245a7, size: 166 bytes, params: 1, frame: 17 env0_2.current = true; let value = environment.__proto__; (PollCreationModalActionCreatorsModule).closeCreatePollModal(); value = importDefault(3857) /* metro dependency 3857: ToastActionCreators */; const open = value.open; const object = {key: 'POLL_CREATED_SUCCESS'}; const PollsIcon = (PollsIconModule).PollsIcon; object.IconComponent = PollsIcon; const intl = (IndexNativeModule).intl; const string = intl.string; const OPsckI = (IndexNativeModule).t.OPsckI; object.content = Reflect.apply(string, intl, [OPsckI]); Reflect.apply(open, value, [object]); } function handleCancelClose() { // fn#89927, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:4249, owner: PollCreation.handleCancelClose, offset: 0x020246c2, size: 124 bytes, params: 1, frame: 16 trackPollCreationCancelled(); const value = environment.__proto__; (PollCreationModalActionCreatorsModule).closeCreatePollModal(); const AccessibilityAnnouncer = (AccessibilityAnnouncerAndroidModule).AccessibilityAnnouncer; const announce = AccessibilityAnnouncer.announce; const intl = (IndexNativeModule).intl; Reflect.apply(announce, AccessibilityAnnouncer, [intl.string((IndexNativeModule).t['+G3oRq'])]); } function _fun89928() { // fn#89928, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:4413, offset: 0x0202473e, size: 214 bytes, params: 1, frame: 18 var r0; var moduleValue2; var openAlert; var AccessibilityAnnouncer; var announce; var intl; let value = environment.__proto__; if (PollsUtilsModule.isPollCreationEmpty(question, answers)) { trackPollCreationCancelled(); AccessibilityAnnouncer = (require(3869) /* metro dependency 3869: AccessibilityAnnouncerAndroid */).AccessibilityAnnouncer; announce = AccessibilityAnnouncer.announce; intl = (require(1244) /* metro dependency 1244: indexNative */).intl; Reflect.apply(announce, AccessibilityAnnouncer, [intl.string((require(1244) /* metro dependency 1244: indexNative */).t['+G3oRq'])]); r0 = false; } else { moduleValue2 = require(4497) /* metro dependency 4497: useAlertStoreNative */; openAlert = moduleValue2.openAlert; value = ; Reflect.apply(openAlert, moduleValue2, ['poll-creation-unsaved-changes', value]); value = true; r0 = value; } return r0; } function _fun89930() { // fn#89930, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:4720, offset: 0x02024814, size: 186 bytes, params: 1, frame: 20 var value3; var intl; const Object = global.Object; const value2 = Object.keys(fieldErrors); if (value2.length > 0) { value3 = environment.__proto__; intl = (require(1244) /* metro dependency 1244: indexNative */).intl; (require(3869) /* metro dependency 3869: AccessibilityAnnouncerAndroid */).AccessibilityAnnouncer.announce(intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.w8e4qF, {numOfErrors: value2.length})); if (shouldFocusOnInvalidField) { env0_18.focus(value2[0]); setShouldFocusOnInvalidField(false); } } } function PollCreationOnPress() { // fn#89931, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:5162, owner: PollCreation.onPress, offset: 0x020248ce, size: 126 bytes, params: 1, frame: 17 const value = environment.__proto__; if (PollsUtilsModule.isPollCreationEmpty(question, answers)) { handleCancelClose(); } else { (require(4497) /* metro dependency 4497: useAlertStoreNative */).openAlert('poll-creation-unsaved-changes', ); } } function _fun89932(a0, a1) { // fn#89932, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11920:6126, offset: 0x0202494c, size: 232 bytes, params: 3, frame: 22 let value = environment.__proto__; value = undefined; const binding = env0_18; return ( ); } } } global.__d(_fun89916, 11734, [31, 27, 7217, 33, 4501, 697, 477, 4500, 1244, 7981, 1305, 10376, 4573, 11735, 4080, 11736, 1962, 6238, 4015, 8742, 480, 5463, 11733, 3857, 11098, 3869, 11737, 11742, 5286, 7149, 4497, 11743, 5277, 5313, 11744, 7972, 11746, 8950, 2]) /* metro module 11734, dependencies: [31, 27, 7217, 33, 4501, 697, 477, 4500, 1244, 7981, 1305, 10376, 4573, 11735, 4080, 11736, 1962, 6238, 4015, 8742, 480, 5463, 11733, 3857, 11098, 3869, 11737, 11742, 5286, 7149, 4497, 11743, 5277, 5313, 11744, 7972, 11746, 8950, 2] */;