377 lines
18 KiB
TypeScript
377 lines
18 KiB
TypeScript
/* Metro module 12761; source: design/components/Menu/native/Menu.tsx; dependencies: [57, 31, 27, 661, 33, 12751, 4501, 697, 4017, 3875, 1585, 1478, 477, 3869, 1244, 4570, 4504, 12755, 12749, 4577, 2] */
|
|
function _fun97523(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#97523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:6, offset: 0x02187616, size: 515 bytes, params: 8, frame: 24
|
|
var object4;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const value2 = require(27) /* metro dependency 27 */;
|
|
const StyleSheet = value2.StyleSheet;
|
|
const env0_5 = value2.ScrollView;
|
|
const NOOP = (require(661) /* metro dependency 661: Constants */).NOOP;
|
|
const env0_7 = (require(33) /* metro dependency 33 */).jsx;
|
|
const env0_8 = {'mass': 1, 'stiffness': 300, 'damping': 25, 'restSpeedThreshold': 0.01,
|
|
'restDisplacementThreshold': 0.01};
|
|
object4 = {duration: 250};
|
|
const STANDARD_EASING = (require(12751) /* metro dependency 12751: Easing */).STANDARD_EASING;
|
|
object4.easing = STANDARD_EASING;
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = createStylesModule.createStyles;
|
|
object4 = {};
|
|
const object5 = {};
|
|
copyDataProperties(object5, StyleSheet.absoluteFillObject, undefined);
|
|
object5['zIndex'] = 1;
|
|
object4.backdrop = object5;
|
|
const object6 = {position: 'absolute'};
|
|
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
|
|
object6.backgroundColor = BACKGROUND_SURFACE_HIGH;
|
|
object6.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
object6.width = 220;
|
|
object4.menu = object6;
|
|
const env0_10 = Reflect.apply(createStyles, createStylesModule, [object4]);
|
|
value = value.createContext({menuClose: NOOP, menuDismiss: NOOP});
|
|
object4 = {code: 'function measureButtonRef_MenuTsx1(ref,setDimensions){const{measure,runOnJS}=this.__closure;const measurements=measure(ref);if(measurements==null)return;runOnJS(setDimensions)(measurements);}'};
|
|
const env0_13 = _fun97524();
|
|
object4 = {code: 'function MenuTsx2(){const{runOnJS,openMenuCallback}=this.__closure;return runOnJS(openMenuCallback)();}'};
|
|
object4 = {code: 'function MenuTsx3(){const{runOnJS,closeMenuCallback}=this.__closure;return runOnJS(closeMenuCallback)();}'};
|
|
object4 = {code: "function MenuTsx4(){const{visible,useReducedMotion,interpolate,dirX,size,offsetAnimated,dirY}=this.__closure;var _offsetAnimated,_offsetAnimated$get,_offsetAnimated2,_offsetAnimated$get2;return{opacity:visible.get(),transform:useReducedMotion?[]:[{translateX:interpolate(visible.get(),[0,1],[(dirX==='left'?-1:1)*size.get().width/4,((_offsetAnimated=offsetAnimated)===null||_offsetAnimated===void 0||(_offsetAnimated=_offsetAnimated.get())===null||_offsetAnimated===void 0?void 0:_offsetAnimated.x)!=null?(_offsetAnimated$get=offsetAnimated.get())===null||_offsetAnimated$get===void 0?void 0:_offsetAnimated$get.x:0])},{translateY:interpolate(visible.get(),[0,1],[(dirY==='top'?-1:1)*size.get().height/4,((_offsetAnimated2=offsetAnimated)===null||_offsetAnimated2===void 0||(_offsetAnimated2=_offsetAnimated2.get())===null||_offsetAnimated2===void 0?void 0:_offsetAnimated2.y)!=null?(_offsetAnimated$get2=offsetAnimated.get())===null||_offsetAnimated$get2===void 0?void 0:_offsetAnimated$get2.y:0])},{scale:visible.get()/2+0.5}]};}"};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('design/components/Menu/native/Menu.tsx');
|
|
exports.MENU_OFFSET = 10;
|
|
exports.MenuContext = value;
|
|
exports.Menu = Menu;
|
|
}
|
|
|
|
function _fun97524() { // fn#97524, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:770, offset: 0x02187819, size: 99 bytes, params: 1, frame: 16
|
|
const closure = measureButtonRef;
|
|
const object2 = {};
|
|
object2.measure = (require(4017) /* metro dependency 4017: ReanimatedRexport */).measure;
|
|
object2.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS;
|
|
closure.__closure = object2;
|
|
closure.__workletHash = 15651320687527;
|
|
closure.__initData = env0_12;
|
|
return closure;
|
|
}
|
|
|
|
function Menu({toggleButtonRef, onClose, position, align, offset, offsetAnimated, style, children}) { // fn#97526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:2440, offset: 0x021878ce, size: 878 bytes, params: 2, frame: 32
|
|
var object2;
|
|
if (position !== undefined) {
|
|
}
|
|
if (align !== undefined) {
|
|
}
|
|
const env0_4 = offsetAnimated;
|
|
const closure = menuClose;
|
|
const closure2 = onTouchDown;
|
|
const styles = useStyles();
|
|
const binding = env0_4;
|
|
const useContext = binding.useContext;
|
|
const AccessibilityPreferencesContext = (require(3875) /* metro dependency 3875: AccessibilityPreferencesContext */).AccessibilityPreferencesContext;
|
|
const enabled = Reflect.apply(useContext, binding, [AccessibilityPreferencesContext]).reducedMotion.enabled;
|
|
const env0_6 = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)();
|
|
const env0_7 = (importDefault(1478) /* metro dependency 1478: useWindowDimensionsNative */)();
|
|
const env0_8 = binding.useRef(null);
|
|
let [property, env0_10] = offset(binding.useState(null), 2);
|
|
const value4 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue(0);
|
|
const env0_11 = value4;
|
|
const value5 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).useSharedValue({'width': 0,
|
|
'height': 0});
|
|
binding.useLayoutEffect(_fun97531, [toggleButtonRef, property]);
|
|
const env0_13 = onClose ?? NOOP;
|
|
const shadowsModule = require(12755) /* metro dependency 12755: Shadows */;
|
|
const generateBoxShadowStyle = shadowsModule.generateBoxShadowStyle;
|
|
const EIGHT_DP_ELEVATION_SHADOW_PARAMS = shadowsModule.EIGHT_DP_ELEVATION_SHADOW_PARAMS;
|
|
const value6 = Reflect.apply(generateBoxShadowStyle, shadowsModule, [EIGHT_DP_ELEVATION_SHADOW_PARAMS]);
|
|
const value8 = offset(_fun97532(), 3);
|
|
property = value8[0];
|
|
const property2 = value8[1];
|
|
const property3 = value8[2];
|
|
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
const useAnimatedStyle = reanimatedRexportModule.useAnimatedStyle;
|
|
const closure3 = MenuP;
|
|
object2 = {visible: value4, useReducedMotion: enabled};
|
|
object2.interpolate = reanimatedRexportModule.interpolate;
|
|
object2.dirX = property2;
|
|
object2.size = value5;
|
|
object2.offsetAnimated = offsetAnimated;
|
|
object2.dirY = property3;
|
|
closure3.__closure = object2;
|
|
closure3.__workletHash = 7884133597410;
|
|
closure3.__initData = env0_16;
|
|
const value9 = Reflect.apply(useAnimatedStyle, reanimatedRexportModule, [closure3]);
|
|
const PassthroughTouchView = importDefault(12749) /* metro dependency 12749: PassthroughTouchView */;
|
|
const items2 = [styles.backdrop];
|
|
const View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
|
|
const Provider = env0_11.Provider;
|
|
const Children = env0_4.Children;
|
|
return (
|
|
<PassthroughTouchView
|
|
style={items2}
|
|
accessibilityViewIsModal
|
|
importantForAccessibility="yes"
|
|
onTouchDown={closure2}
|
|
onAccessibilityEscape={closure2}
|
|
>
|
|
<View
|
|
accessibilityRole="list"
|
|
style={[styles.menu, value6, property, value9, style]}
|
|
onLayout={onLayout_97534}
|
|
>
|
|
<ScrollView>
|
|
<Provider value={{menuClose: closure, menuDismiss: closure2}}>
|
|
{Children.map(children, _fun97536)}
|
|
</Provider>
|
|
</ScrollView>
|
|
</View>
|
|
</PassthroughTouchView>
|
|
);
|
|
}
|
|
|
|
function measureButtonRef(a0, a1) { // fn#97525, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:802, offset: 0x0218787c, size: 82 bytes, params: 3, frame: 14
|
|
let value = environment.__proto__;
|
|
const value2 = (require(4017) /* metro dependency 4017: ReanimatedRexport */).measure(a0);
|
|
if (value2 != null) {
|
|
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
value.runOnJS(a1)(value2);
|
|
}
|
|
}
|
|
|
|
function openMenuCallback() { // fn#97527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:2811, owner: Menu.openMenuCallback, offset: 0x02187c3c, size: 168 bytes, params: 1, frame: 17
|
|
var AccessibilityAnnouncer;
|
|
var announce;
|
|
var intl;
|
|
const value = environment.__proto__;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isAndroid()) {
|
|
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.ZqK0uI)]);
|
|
}
|
|
(require(4570) /* metro dependency 4570: setAccessibilityFocusAndroid */).setAccessibilityFocus({ref: env0_8});
|
|
}
|
|
|
|
function menuClose() { // fn#97528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3101, owner: Menu.menuClose, offset: 0x02187ce4, size: 146 bytes, params: 1, frame: 24
|
|
const binding = env0_11;
|
|
const set = binding.set;
|
|
const timingModule = require(4504) /* metro dependency 4504: timing */;
|
|
const withTiming = timingModule.withTiming;
|
|
const binding2 = env1_9;
|
|
const closure = menuCloseT;
|
|
const object2 = {};
|
|
object2.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS;
|
|
object2.closeMenuCallback = env0_13;
|
|
closure.__closure = object2;
|
|
closure.__workletHash = 5879184549724;
|
|
closure.__initData = env1_15;
|
|
Reflect.apply(set, binding, [Reflect.apply(withTiming, timingModule, [0, binding2, 'respect-motion-settings',
|
|
closure])]);
|
|
}
|
|
|
|
function menuDismiss() { // fn#97530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3322, owner: Menu.menuDismiss, offset: 0x02187da6, size: 59 bytes, params: 1, frame: 14
|
|
const value = environment.__proto__;
|
|
(require(4570) /* metro dependency 4570: setAccessibilityFocusAndroid */).setAccessibilityFocus({ref: toggleButtonRef});
|
|
menuClose();
|
|
}
|
|
|
|
function _fun97531() { // fn#97531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3002, offset: 0x02187de1, size: 101 bytes, params: 1, frame: 15
|
|
var value5;
|
|
const toggleButtonRefBinding = toggleButtonRef;
|
|
const value2 = undefined;
|
|
if ((toggleButtonRefBinding == null ? value2 : toggleButtonRef.current) != null && env0_9 == null) {
|
|
value5 = environment.__proto__;
|
|
(require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnUI(env1_13)(toggleButtonRef, env0_10);
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function _fun97532() { // fn#97532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3487, offset: 0x02187e46, size: 489 bytes, params: 1, frame: 11
|
|
var r1;
|
|
var r2;
|
|
var r0;
|
|
var r5;
|
|
var pageX;
|
|
var pageY;
|
|
var value5;
|
|
var value6;
|
|
var value7;
|
|
var value8;
|
|
var value16;
|
|
var value18;
|
|
var value21;
|
|
let positionBinding = position;
|
|
const value2 = 'left';
|
|
const r8 = value2 === positionBinding ? 'column' : position !== 'right' ? 'row' : 'column';
|
|
if (env0_9 == null) {
|
|
r0 = {'x': 0, 'y': 0};
|
|
} else {
|
|
pageX = env0_9.pageX;
|
|
pageY = env0_9.pageY;
|
|
positionBinding = position;
|
|
value5 = 0;
|
|
value6 = pageX + (positionBinding !== 'right' ? value5 : env0_9.width);
|
|
value7 = pageY + (position !== 'bottom' ? value5 : env0_9.height);
|
|
if (align !== 'end') {
|
|
r1 = value7;
|
|
r2 = value6;
|
|
} else {
|
|
value8 = value6 + (r8 !== 'row' ? value5 : env0_9.width);
|
|
r1 = value7 + (r8 !== 'column' ? value5 : env0_9.height);
|
|
r2 = value8;
|
|
}
|
|
r0 = {x: r2, y: r1};
|
|
}
|
|
const height = env0_7.height;
|
|
r2 = value2 === position ? 'right' : r8 !== 'row' || align !== 'end' ? value2 : 'right';
|
|
positionBinding = position;
|
|
const value11 = 'top';
|
|
r1 = value11 === positionBinding ? 'bottom' : r8 !== 'column' || align !== 'end' ? value11 : 'bottom';
|
|
const r10 = value2 === r2 ? r0.x : env0_7.width - r0.x;
|
|
const value14 = value11 === r1;
|
|
const y = r0.y;
|
|
const r9 = value14 ? y : height - y;
|
|
let offsetBinding = offset;
|
|
if (offsetBinding != null) {
|
|
offsetBinding = offset;
|
|
value21 = r10 + offsetBinding.x;
|
|
r0 = r9 + offsetBinding.y;
|
|
r5 = value21;
|
|
} else {
|
|
value16 = 0;
|
|
r5 = r8 !== 'column' ? value16 : 10;
|
|
value18 = r10 + r5;
|
|
r0 = r8 !== 'row' ? value16 : 10;
|
|
r0 = r9 + r0;
|
|
r5 = value18;
|
|
}
|
|
const value23 = height - r0;
|
|
const binding = env0_6;
|
|
return [{[r2]: r5, [r1]: r0, ['maxHeight']: value23 - (value14 ? binding.bottom : binding.top) - 12}, r2, r1];
|
|
}
|
|
|
|
function MenuP() { // fn#97533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:4104, owner: Menu.P, offset: 0x0218802f, size: 510 bytes, params: 1, frame: 28
|
|
var r4;
|
|
var x;
|
|
var r1;
|
|
var r10;
|
|
var y;
|
|
var value2;
|
|
var value3;
|
|
var moduleValue;
|
|
var interpolate;
|
|
var value4;
|
|
var value5;
|
|
var items4;
|
|
var value8;
|
|
var value9;
|
|
var value10;
|
|
var items2;
|
|
var moduleValue2;
|
|
var value11;
|
|
var items3;
|
|
var value14;
|
|
var value15;
|
|
var object2;
|
|
const object3 = {};
|
|
let binding = env0_11;
|
|
object3.opacity = binding.get();
|
|
if (enabled) {
|
|
r1 = [];
|
|
} else {
|
|
value2 = environment.__proto__;
|
|
value3 = undefined;
|
|
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
interpolate = moduleValue.interpolate;
|
|
binding = env0_11;
|
|
value4 = binding.get();
|
|
value5 = 1;
|
|
r4 = env0_14 !== 'left' ? value5 : -1;
|
|
binding = env0_12;
|
|
get = binding.get;
|
|
items4 = [r4 * Reflect.apply(get, binding, []).width / 4];
|
|
if (offsetAnimated == null) {
|
|
x = value3;
|
|
} else {
|
|
value8 = offsetAnimated.get();
|
|
x = value8 == null ? value3 : value8.x;
|
|
}
|
|
value9 = 0;
|
|
if (x != null) {
|
|
value10 = offsetAnimated.get();
|
|
r1 = value10 == null ? value3 : value10.x;
|
|
} else {
|
|
r1 = value9;
|
|
}
|
|
items4[1] = r1;
|
|
items2 = [{translateX: Reflect.apply(interpolate, moduleValue, [value4, [0, 1], items4])}];
|
|
moduleValue2 = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
interpolate = moduleValue2.interpolate;
|
|
binding = env0_11;
|
|
value11 = binding.get();
|
|
r10 = env0_15 !== 'top' ? value5 : -1;
|
|
binding = env0_12;
|
|
get = binding.get;
|
|
items3 = [r10 * Reflect.apply(get, binding, []).height / 4];
|
|
if (offsetAnimated == null) {
|
|
y = value3;
|
|
} else {
|
|
value14 = offsetAnimated.get();
|
|
y = value14 == null ? value3 : value14.y;
|
|
}
|
|
if (y != null) {
|
|
value15 = offsetAnimated.get();
|
|
r4 = value15 == null ? value3 : value15.y;
|
|
} else {
|
|
r4 = value9;
|
|
}
|
|
items3[1] = r4;
|
|
items2[1] = {translateY: Reflect.apply(interpolate, moduleValue2, [value11, [0, 1], items3])};
|
|
object2 = {};
|
|
binding = env0_11;
|
|
object2.scale = binding.get() / 2 + 0.5;
|
|
items2[2] = object2;
|
|
r1 = items2;
|
|
}
|
|
object3.transform = r1;
|
|
return object3;
|
|
}
|
|
|
|
function MenuOnLayout(a0) { // fn#97534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:4909, owner: Menu.onLayout, offset: 0x0218822d, size: 208 bytes, params: 2, frame: 24
|
|
var object2;
|
|
let binding = env0_12;
|
|
let set = binding.set;
|
|
Reflect.apply(set, binding, [{width: a0.nativeEvent.layout.width, height: a0.nativeEvent.layout.height}]);
|
|
binding = env0_11;
|
|
set = binding.set;
|
|
const springModule = require(4577) /* metro dependency 4577: spring */;
|
|
const withSpring = springModule.withSpring;
|
|
const binding2 = env1_8;
|
|
const closure = onLayoutN;
|
|
object2 = {};
|
|
object2.runOnJS = (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS;
|
|
object2.openMenuCallback = openMenuCallback;
|
|
closure.__closure = object2;
|
|
closure.__workletHash = 14966618105405;
|
|
closure.__initData = env1_14;
|
|
Reflect.apply(set, binding, [Reflect.apply(withSpring, springModule, [1, binding2, 'respect-motion-settings',
|
|
closure])]);
|
|
}
|
|
|
|
function _fun97536(a0, a1) { // fn#97536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:5346, offset: 0x0218832d, size: 70 bytes, params: 3, frame: 15
|
|
const value = a0;
|
|
return a1 !== 0 ? value : env1_4.isValidElement(value) ? env1_4.cloneElement(value, {ref: env0_8}) : value;
|
|
}
|
|
|
|
function menuCloseT() { // fn#97529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:3190, owner: Menu.menuClose.t, offset: 0x02187d76, size: 48 bytes, params: 1, frame: 12
|
|
let value = environment.__proto__.__proto__;
|
|
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
return value.runOnJS(env1_13)();
|
|
}
|
|
|
|
function onLayoutN() { // fn#97535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12951:5064, owner: Menu.onLayout.n, offset: 0x021882fd, size: 48 bytes, params: 1, frame: 12
|
|
let value = environment.__proto__.__proto__;
|
|
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
|
|
return value.runOnJS(openMenuCallback)();
|
|
}
|
|
|