Files
discord-decomp/sources/by-id/module-01665.js
T
2026-07-28 01:06:53 +03:00

294 lines
13 KiB
JavaScript

/* Metro module 1665; source: unknown; dependencies: [1635, 1666, 1614, 1679, 1680, 1698, 1696, 1697, 1662] */
import * as Module01614Module from './module-01614.js'; /* Metro dependency 1614 */
import * as Module01635Module from './module-01635.js'; /* Metro dependency 1635 */
import * as EasingModule from './module-01662-Easing.js'; /* Metro dependency 1662 */
import * as Module01666Module from './module-01666.js'; /* Metro dependency 1666 */
function _fun18329(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#18329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1792:6, offset: 0x00e8586b, size: 90 bytes, params: 8, frame: 17
const env0_0 = require;
const startWebLayoutAnimation2 = startWebLayoutAnimation;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.startWebLayoutAnimation = startWebLayoutAnimation2;
exports.tryActivateLayoutTransition = tryActivateLayoutTransition;
function tryGetAnimationConfig(a0, a1) { // fn#18330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1792:43, offset: 0x00e858c5, size: 572 bytes, params: 3, frame: 22
var r11;
var r2;
var r7;
var r6;
var value3;
var value4;
var value5;
var moduleValue;
var moduleValue2;
const logger = (Module01614Module).logger;
var Object;
var value10;
const LayoutAnimationType = (Module01635Module).LayoutAnimationType;
const ENTERING = LayoutAnimationType.ENTERING;
const r3 = a1 === ENTERING ? a0.entering : a1 === LayoutAnimationType.EXITING ? a0.exiting : a1 !== LayoutAnimationType.LAYOUT ? null : a0.layout;
if (r3) {
value3 = a1 === LayoutAnimationType.LAYOUT;
value4 = r3 instanceof (require(1680) /* metro dependency 1680 */).Keyframe;
value5 = r3.initialValues !== undefined;
if (value4) {
moduleValue = require(1698) /* metro dependency 1698 */;
r11 = moduleValue.createCustomKeyFrameAnimation(r3.definitions);
} else {
r11 = typeof r3 === 'function' ? r3.presetName : r3.constructor.presetName;
}
if (value5) {
moduleValue2 = require(1698) /* metro dependency 1698 */;
r2 = moduleValue2.createAnimationWithInitialValues(r11, r3.initialValues);
} else {
r2 = r11;
}
r7 = value3 || value4;
r7 = !r7 ? value5 : r7;
r6 = !(r2 in (require(1666) /* metro dependency 1666 */).Animations) && !r7;
if (r6) {
logger.warn("Couldn't load entering/exiting animation. Current version supports only predefined animations with modifiers: duration, delay, easing, randomizeDelay, withCallback, reducedMotion.");
r6 = true;
}
if (r6) {
return null;
}
if (value4) {
Object = global.Object;
value10 = Object.keys(r3.definitions);
if (!(value10.includes('100') || value10.includes('to'))) {
logger.warn("Neither '100' nor 'to' was specified in Keyframe definition. This may result in wrong final position of your component. One possible solution is to duplicate last timestamp in definition as '100' (or 'to')");
}
}
return (require(1679) /* metro dependency 1679 */).getProcessedConfig(r2, a1, r3);
}
return null;
}
function startWebLayoutAnimation(a0, a1, a2, a3) { // fn#18331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1792:1248, offset: 0x00e85b01, size: 427 bytes, params: 5, frame: 22
const LayoutAnimationType = (Module01635Module).LayoutAnimationType;
const tryGetAnimationConfigBinding = tryGetAnimationConfig;
const value2 = undefined;
const value3 = tryGetAnimationConfigBinding(a0, a2);
const moduleValue = require(1679) /* metro dependency 1679 */;
moduleValue.maybeModifyStyleForKeyframe(a1, a0.entering);
const animationName = value3 == null ? value2 : value3.animationName;
const Animations = (Module01666Module).Animations;
if (animationName in Animations) {
maybeReportOverwrittenProperties(Animations[value3 == null ? value2 : value3.animationName].style, a1.style);
}
if (value3) {
if (LayoutAnimationType.ENTERING === a2) {
moduleValue.setElementAnimation(a1, value3, true);
} else if (LayoutAnimationType.LAYOUT === a2) {
a3.reversed = value3.reversed;
(require(1679) /* metro dependency 1679 */).handleLayoutTransition(a1, value3, a3);
} else if (LayoutAnimationType.EXITING === a2) {
(require(1679) /* metro dependency 1679 */).handleExitingAnimation(a1, value3);
}
} else {
(require(1696) /* metro dependency 1696 */).makeElementVisible(a1, 0);
}
return value2;
function maybeReportOverwrittenProperties(a0, a1) { // fn#18332, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1792:1428, owner: startWebLayoutAnimation.maybeReportOverwrittenProperties, offset: 0x00e85cac, size: 272 bytes, params: 3, frame: 21
var environment;
var r8;
var add;
var property;
var error;
var Array;
var from;
var filter;
var length;
var value2;
const logger = (Module01614Module).logger;
var warn;
var value3;
var value4;
var join;
var HermesInternal;
var concat;
const Set = global.Set;
let set = new Set();
const iterator = a0.matchAll(RegExp('([a-zA-Z-]+)(?=:)', 'g'))[Symbol.iterator]();
const iterator2 = iterator.next;
let r4 = iterator;
let item2 = Reflect.apply(iterator2, r4, []);
let item = item2.value;
item2 = item2.done ? undefined : r4;
reducibleJoin2: while (true) {
if (item2 === undefined) {
Array = global.Array;
from = Array.from;
set = Reflect.apply(from, Array, [a1]);
filter = set.filter;
set = Reflect.apply(filter, set, [_fun18333]);
length = set.length;
reducibleJoin11: while (true) {
if (length === 0) {
break reducibleJoin11;
}
value2 = environment.__proto__;
warn = logger.warn;
length = set.length;
value3 = 'Properties';
reducibleJoin10: while (true) {
if (length !== 1) {
r8 = value3;
break reducibleJoin10;
}
value4 = 'Property';
r8 = value4;
break reducibleJoin10;
}
join = set.join;
set = Reflect.apply(join, set, [', ']);
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
Reflect.apply(warn, logger,
['' + r8 + ' [' + set + '] may be overwritten by a layout animation. Please wrap your component with an animated view and apply the layout animation on the wrapper.']);
break reducibleJoin11;
}
return undefined;
}
break reducibleJoin2;
}
reducibleLoop2: while (true) {
try {
add = set.add;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property = item[1];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
Reflect.apply(add, set, [property]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r4 = item2;
item2 = Reflect.apply(iterator2, r4, []);
item = item2.value;
item2 = item2.done ? undefined : r4;
if (item2 === undefined) {
break reducibleLoop2;
}
continue reducibleLoop2;
}
Array = global.Array;
set = Array.from(a1);
set = set.filter(_fun18333);
length = set.length;
reducibleJoin11: while (true) {
if (length === 0) {
break reducibleJoin11;
}
value2 = environment.__proto__;
warn = logger.warn;
length = set.length;
value3 = 'Properties';
reducibleJoin10: while (true) {
if (length !== 1) {
r8 = value3;
break reducibleJoin10;
}
value4 = 'Property';
r8 = value4;
break reducibleJoin10;
}
join = set.join;
set = Reflect.apply(join, set, [', ']);
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
Reflect.apply(warn, logger,
['' + r8 + ' [' + set + '] may be overwritten by a layout animation. Please wrap your component with an animated view and apply the layout animation on the wrapper.']);
break reducibleJoin11;
}
function _fun18333(a0) { // fn#18333, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1792:1575, offset: 0x00e4010b, size: 22 bytes, params: 2, frame: 11
return env0_0.has(a0);
}
}
}
function tryActivateLayoutTransition(a0, a1, a2) { // fn#18334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1792:2388, offset: 0x00e85dbc, size: 465 bytes, params: 4, frame: 25
var presetName;
var presetName2;
var r10;
var r8;
var value;
var value3;
var moduleValue;
var enteringV;
var exitingV;
var width;
var value4;
var height;
var value5;
var object;
var easingXV;
const EasingNameSymbol = (EasingModule).EasingNameSymbol;
var easingYV;
let layout = a0.layout;
if (layout) {
value = a1.getBoundingClientRect();
value3 = undefined;
moduleValue = require(1697) /* metro dependency 1697 */;
if (!moduleValue.areDOMRectsEqual(value, a2)) {
layout = a0.layout;
enteringV = layout.enteringV;
presetName = enteringV == null ? value3 : enteringV.presetName;
layout = a0.layout;
exitingV = layout.exitingV;
presetName2 = exitingV == null ? value3 : exitingV.presetName;
width = a2.width;
value4 = (width - value.width) / 2;
height = a2.height;
value5 = (height - value.height) / 2;
object = {};
object.translateX = a2.x - value.x + value4;
object.translateY = a2.y - value.y + value5;
width = a2.width;
object.scaleX = width / value.width;
height = a2.height;
object.scaleY = height / value.height;
object.reversed = false;
layout = a0.layout;
easingXV = layout.easingXV;
r10 = easingXV == null ? value3 : easingXV[EasingNameSymbol];
value = 'ease';
r8 = r10 ?? value;
object.easingX = r8;
layout = a0.layout;
easingYV = layout.easingYV;
r8 = easingYV == null ? value3 : easingYV[EasingNameSymbol];
object.easingY = r8 ?? value;
object.entering = presetName;
object.exiting = presetName2;
startWebLayoutAnimation(a0, a1, (require(1635) /* metro dependency 1635 */).LayoutAnimationType.LAYOUT,
object);
}
}
}
}
global.__d(_fun18329, 1665, [1635, 1666, 1614, 1679, 1680, 1698, 1696, 1697,
1662]) /* metro module 1665, dependencies: [1635, 1666, 1614, 1679, 1680, 1698, 1696, 1697, 1662] */;