/* Metro module 4596; source: components_native/common/Alert.tsx; dependencies: [6, 7, 15, 17, 18, 31, 27, 33, 4501, 697, 1305, 4597, 4041, 4570, 4573, 1244, 4578, 5278, 7704, 3868, 1478, 8750, 2] */ import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import UseWindowDimensionsNative from '../../modules/screen/useWindowDimensions.native.tsx'; /* Metro dependency 1478 */ import ThemedGradient from '../../modules/client_themes/native/ThemedGradient.tsx'; /* Metro dependency 7704 */ 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 NativeModule from '../../design/void/native.tsx'; /* Metro dependency 1305 */ import * as NativeModule2 from '../../external/discord_common/js/packages/design/native.tsx'; /* Metro dependency 3868 */ import * as TimersModule from '../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */ import * as CreateStylesModule from '../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */ import * as SetAccessibilityFocusAndroidModule from '../../modules/a11y/native/setAccessibilityFocus.android.tsx'; /* Metro dependency 4570 */ import * as ButtonNativeModule from '../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */ import * as UseIsScreenLandscapeNativeModule from '../../modules/screen/useIsScreenLandscape.native.tsx'; /* Metro dependency 8750 */ function _fun38946(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#38946, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:6, offset: 0x010d1d85, size: 700 bytes, params: 8, frame: 28 const env0_0 = require; const getAlertButtonVariant2 = getAlertButtonVariant; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ReactModule; const StyleSheet = ReactNativeModule.StyleSheet; const createLegacyClassComponentStyles = CreateStylesModule.createLegacyClassComponentStyles; object = {}; const object2 = {}; object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm; object2.padding = 16; const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW; object2.backgroundColor = BACKGROUND_BASE_LOW; object.alert = object2; const MOBILE_TEXT_HEADING_PRIMARY = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_TEXT_HEADING_PRIMARY; object.titleText = {marginBottom: 16, color: MOBILE_TEXT_HEADING_PRIMARY}; const object4 = {}; object4.height = StyleSheet.hairlineWidth; const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE; object4.backgroundColor = BORDER_SUBTLE; object.divider = object4; const TEXT_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_STRONG; object.body = {marginTop: 16, color: TEXT_STRONG}; object.buttons = {marginTop: 24}; object.cancelButton = {marginTop: 8}; object.secondaryConfirm = {'marginTop': 16, 'alignSelf': 'center'}; const object8 = {}; object8.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm; object.gradient = object8; const env0_15 = Reflect.apply(createLegacyClassComponentStyles, CreateStylesModule, [object]); const PureComponent = value.PureComponent; const value5 = _fun38951(PureComponent); const ThemeContext = (NativeModule2).ThemeContext; value5.contextType = ThemeContext; const ButtonColors = (NativeModule).ButtonColors; const BRAND = ButtonColors.BRAND; value5.defaultProps = {confirmColor: BRAND, autoCloseOnConfirm: true}; value = value.memo(_fun38967); value.Colors = ButtonColors; (FileImportTrackerModule).fileFinishedImporting('components_native/common/Alert.tsx'); exports.default = value; exports.getAlertButtonVariant = getAlertButtonVariant2; function _isNativeReflectConstruct_38947() { // fn#38947, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:247, offset: 0x010d2041, size: 94 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_38947_isNativeReflectConstruct = function() { return !!result; })(); } function getAlertButtonVariant(a0) { // fn#38950, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:940, offset: 0x010d209f, size: 249 bytes, params: 2, frame: 14 const ButtonColors = (NativeModule).ButtonColors; const GREEN = ButtonColors.GREEN; if (GREEN === a0) { return 'active'; } const RED = ButtonColors.RED; if (RED === a0) { return 'destructive'; } const GREY = ButtonColors.GREY; if (GREY === a0) { return 'secondary'; } const LIGHTGREY = ButtonColors.LIGHTGREY; if (LIGHTGREY === a0) { return 'secondary'; } const TRANSPARENT = ButtonColors.TRANSPARENT; if (TRANSPARENT === a0) { return 'secondary'; } const WHITE = ButtonColors.WHITE; if (WHITE === a0) { return 'primary-overlay'; } return 'primary'; } function _fun38951(a0) { // fn#38951, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1297, offset: 0x010d2198, size: 233 bytes, params: 2, frame: 16 const Alert_389522 = Alert_38952; Inherits(Alert_389522, a0); return CreateClass(Alert_389522, [{key: 'componentDidMount', value: function() { var env0_0 = this; if (this.titleRef.current != null) { global.setImmediate(_fun38958); } }}, {key: 'componentWillUnmount', value: function() { this.timeout.stop(); this.focusTimeout.stop(); }}, {key: 'componentDidUpdate', value: function() { var confirming = this.props.confirming; if (confirming != null) { this.timeout.stop(); this.setState({confirming: confirming}); } }}, {key: 'renderHeader', value: value_38962}, {key: 'renderBody', value: value_38963}, {key: 'renderButtons', value: value_38964}, {key: 'renderFooter', value: value_38965}, {key: 'render', value: value_38966}]); function Alert_38952(a0) { // fn#38952, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1309, offset: 0x010d2281, size: 325 bytes, params: 2, frame: 21 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_4; binding(this, Alert_38952); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_7(Alert_38952); binding = env1_6; if (_isNativeReflectConstruct_38947()) { Reflect = global.Reflect; value = Reflect.construct(value, items2, env1_7(this).constructor); r0 = value; } else { value = value.apply(this, items2); r0 = value; } value = binding(this, r0); value.titleRef = env1_9.createRef(); value.state = {confirming: false}; value.renderContent = (importAll(4597) /* metro dependency 4597: CustomMarkupNative */).getParser(); const Timeout = (TimersModule).Timeout; const value4 = Object.create(Timeout.prototype, {constructor: {value: Timeout}}); let timeout = new Timeout(); value.timeout = timeout instanceof Object ? timeout : value4; const value6 = Object.create(Timeout.prototype, {constructor: {value: Timeout}}); timeout = new Timeout(); value.focusTimeout = timeout instanceof Object ? timeout : value6; value.handleConfirm = handleConfirm; value.handleCancel = handleCancel; value.handleSecondaryConfirm = handleSecondaryConfirm; return value; function handleConfirm() { // fn#38953, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1681, owner: Alert_38952.handleConfirm, offset: 0x010d23c6, size: 129 bytes, params: 1, frame: 16 var binding; var props; var onClose; var onConfirm; var autoCloseOnConfirm; if (!env0_0.state.confirming) { binding = env0_0; props = binding.props; onClose = props.onClose; onConfirm = props.onConfirm; autoCloseOnConfirm = props.autoCloseOnConfirm; binding.setState({confirming: true}); binding.timeout.start(500, _fun38954); if (autoCloseOnConfirm) { if (onClose != null) { onClose(); } } if (onConfirm != null) { onConfirm(); } } function _fun38954() { // fn#38954, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1822, offset: 0x010d2447, size: 31 bytes, params: 1, frame: 12 env1_0.setState({confirming: false}); } } function handleCancel() { // fn#38955, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1906, owner: Alert_38952.handleCancel, offset: 0x010d2466, size: 50 bytes, params: 1, frame: 11 const {onClose, onCancel} = env0_0.props; if (onCancel != null) { onCancel(); } if (onClose != null) { onClose(); } } function handleSecondaryConfirm() { // fn#38956, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2002, owner: Alert_38952.handleSecondaryConfirm, offset: 0x010d2498, size: 50 bytes, params: 1, frame: 11 const {onClose, onConfirmSecondary} = env0_0.props; if (onClose != null) { onClose(); } if (onConfirmSecondary != null) { onConfirmSecondary(); } } } function value_38957() { // fn#38957, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2143, offset: 0x010d24ca, size: 50 bytes, params: 1, frame: 11 if (this.titleRef.current != null) { global.setImmediate(_fun38958); } function _fun38958() { // fn#38958, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2197, offset: 0x010d24fc, size: 41 bytes, params: 1, frame: 13 env0_0.focusTimeout.start(300, _fun38959); function _fun38959() { // fn#38959, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2231, offset: 0x010d2525, size: 57 bytes, params: 1, frame: 13 const value = environment.__proto__.__proto__.__proto__; (SetAccessibilityFocusAndroidModule).setAccessibilityFocus({ref: env1_0.titleRef}); } } } function value_38962() { // fn#38962, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2548, offset: 0x010d25bf, size: 219 bytes, params: 1, frame: 24 const value = environment.__proto__; const value2 = env1_15(this.context); const title = this.props.title; const value3 = null; return ( value3 == title || title === '' ? value3 : ( {((Text) => {typeof title !== 'string' ? title : this.renderContent(title)})((require(4573) /* metro dependency 4573: Text */).Text)} ) ); } function value_38963() { // fn#38963, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2895, offset: 0x010d269a, size: 206 bytes, params: 1, frame: 25 const value = environment.__proto__; const value2 = env1_15(this.context); const {body, children} = this.props; const jsxRuntimeEnv1_14Binding = jsxRuntimeEnv1_14; const value3 = null; return ( <> { value3 != body ? ( {((Text) => {typeof body !== 'string' ? body : this.renderContent(body)})((require(4573) /* metro dependency 4573: Text */).Text)} ) : value3 } {children} ); } function value_38964() { // fn#38964, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:3200, offset: 0x010d2768, size: 607 bytes, params: 1, frame: 31 var r16; var r7; var r6; var r8; var r14; var r15; var r0; var intl; const Button = (ButtonNativeModule).Button; let value = environment.__proto__; const binding = env1_15; const context = this.context; const value2 = undefined; const value3 = binding(context); const props = this.props; const cancelText = props.cancelText; const confirmText = props.confirmText; if (value2 !== confirmText) { r16 = confirmText; } else { intl = (require(1244) /* metro dependency 1244: indexNative */).intl; r16 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.BddRzS); } const confirmColor = props.confirmColor; const secondaryConfirmText = props.secondaryConfirmText; const noDefaultButtons = props.noDefaultButtons; const renderConfirmIcon = props.renderConfirmIcon; const renderConfirmRightIcon = props.renderConfirmRightIcon; const renderConfirmButton = props.renderConfirmButton; const isConfirmButtonDisabled = props.isConfirmButtonDisabled; const confirming = this.state.confirming; const value5 = null; if (noDefaultButtons) { r0 = value5; } else { r7 = ( value5 != cancelText ? (