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

142 lines
10 KiB
JavaScript

/* Metro module 1690; source: unknown; dependencies: [1650] */
import * as Module01650Module from './module-01650.js'; /* Metro dependency 1650 */
function _fun18431(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#18431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1817:6, offset: 0x00e8c04a, size: 166 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = {code: "function pnpm_repeatTs2(){const{_nextAnimation,numberOfReps,reverse,callback,getReduceMotionForAnimation,reduceMotion}=this.__closure;const nextAnimation=typeof _nextAnimation==='function'?_nextAnimation():_nextAnimation;function repeat(animation,now){const finished=nextAnimation.onFrame(nextAnimation,now);animation.current=nextAnimation.current;if(finished){animation.reps+=1;if(nextAnimation.callback){nextAnimation.callback(true,animation.current);}if(animation.reduceMotion||numberOfReps>0&&animation.reps>=numberOfReps){return true;}const startValue=reverse?nextAnimation.current:animation.startValue;if(reverse){nextAnimation.toValue=animation.startValue;animation.startValue=startValue;}nextAnimation.onStart(nextAnimation,startValue,now,nextAnimation.previousAnimation);return false;}return false;}const repCallback=function(finished){if(callback){callback(finished);}if(!finished&&nextAnimation.callback){nextAnimation.callback(false);}};function onStart(animation,value,now,previousAnimation){animation.startValue=value;animation.reps=0;if(nextAnimation.reduceMotion===undefined){nextAnimation.reduceMotion=animation.reduceMotion;}if(animation.reduceMotion&&reverse&&(numberOfReps<=0||numberOfReps%2===0)){animation.current=animation.startValue;animation.onFrame=function(){return true;};}else{nextAnimation.onStart(nextAnimation,value,now,previousAnimation);}}return{isHigherOrder:true,onFrame:repeat,onStart:onStart,reps:0,current:nextAnimation.current,callback:repCallback,startValue:0,reduceMotion:getReduceMotionForAnimation(reduceMotion)};}"};
const withRepeat2 = withRepeat;
const object2 = {};
object2.defineAnimation = (require(1650) /* metro dependency 1650 */).defineAnimation;
const getReduceMotionForAnimation = (require(1650) /* metro dependency 1650 */).getReduceMotionForAnimation;
object2.getReduceMotionForAnimation = getReduceMotionForAnimation;
withRepeat2.__closure = object2;
withRepeat2.__workletHash = 13638828150427;
withRepeat2.__initData = {code: "function pnpm_repeatTs1(_nextAnimation,numberOfReps=2,reverse=false,callback,reduceMotion){const{defineAnimation,getReduceMotionForAnimation}=this.__closure;return defineAnimation(_nextAnimation,function(){'worklet';const nextAnimation=typeof _nextAnimation==='function'?_nextAnimation():_nextAnimation;function repeat(animation,now){const finished=nextAnimation.onFrame(nextAnimation,now);animation.current=nextAnimation.current;if(finished){animation.reps+=1;if(nextAnimation.callback){nextAnimation.callback(true,animation.current);}if(animation.reduceMotion||numberOfReps>0&&animation.reps>=numberOfReps){return true;}const startValue=reverse?nextAnimation.current:animation.startValue;if(reverse){nextAnimation.toValue=animation.startValue;animation.startValue=startValue;}nextAnimation.onStart(nextAnimation,startValue,now,nextAnimation.previousAnimation);return false;}return false;}const repCallback=function(finished){if(callback){callback(finished);}if(!finished&&nextAnimation.callback){nextAnimation.callback(false);}};function onStart(animation,value,now,previousAnimation){animation.startValue=value;animation.reps=0;if(nextAnimation.reduceMotion===undefined){nextAnimation.reduceMotion=animation.reduceMotion;}if(animation.reduceMotion&&reverse&&(numberOfReps<=0||numberOfReps%2===0)){animation.current=animation.startValue;animation.onFrame=function(){return true;};}else{nextAnimation.onStart(nextAnimation,value,now,previousAnimation);}}return{isHigherOrder:true,onFrame:repeat,onStart:onStart,reps:0,current:nextAnimation.current,callback:repCallback,startValue:0,reduceMotion:getReduceMotionForAnimation(reduceMotion)};});}"};
exports.withRepeat = withRepeat2;
function withRepeat(a0) { // fn#18432, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1817:3328, offset: 0x00e8c0f0, size: 248 bytes, params: 2, frame: 24
const value = undefined;
const env0_0 = a0;
const value2 = 2;
const r13 = arguments.length > 1 ? value === arguments[1] ? value2 : arguments[1] : value2;
const r12 = arguments.length > value2 && value !== arguments[value2] && arguments[value2];
const env0_2 = r12;
const r11 = arguments.length > 3 ? arguments[3] : value;
const r6 = arguments.length > 4 ? arguments[4] : value;
const defineAnimation = Module01650Module.defineAnimation;
const pnpm_repeatTs22 = pnpm_repeatTs2;
const object = {_nextAnimation: a0, numberOfReps: r13, reverse: r12, callback: r11};
const getReduceMotionForAnimation = Module01650Module.getReduceMotionForAnimation;
object.getReduceMotionForAnimation = getReduceMotionForAnimation;
object.reduceMotion = r6;
pnpm_repeatTs22.__closure = object;
pnpm_repeatTs22.__workletHash = 11413099333511;
pnpm_repeatTs22.__initData = env0_2;
return Reflect.apply(defineAnimation, Module01650Module, [a0, pnpm_repeatTs22]);
function pnpm_repeatTs2() { // fn#18433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1817:3597, owner: withRepeat.pnpm_repeatTs2, offset: 0x00e8c1e8, size: 144 bytes, params: 1, frame: 14
const r4 = typeof env0_0 === 'function' ? env0_0() : env0_0;
const object = {isHigherOrder: true, onFrame: onFrame_18434, onStart: onStart_18435, reps: 0};
object.current = r4.current;
object.callback = callback_18437;
object.startValue = 0;
object.reduceMotion = (require(1650) /* metro dependency 1650 */).getReduceMotionForAnimation(env0_4);
return object;
function pnpm_repeatTs2OnFrame(a0, a1) { // fn#18434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1817:3688, owner: withRepeat.pnpm_repeatTs2.onFrame, offset: 0x00e8c278, size: 239 bytes, params: 3, frame: 18
var r4;
var value3;
var onStart;
var binding2;
let binding = env0_0;
const value2 = binding.onFrame(env0_0, a1);
a0.current = env0_0.current;
if (value2) {
a0.reps = a0.reps + 1;
if (env0_0.callback) {
binding = env0_0;
binding.callback(true, a0.current);
}
if (a0.reduceMotion) {
return true;
}
value3 = environment.__proto__;
if (env1_1 > 0) {
if (a0.reps >= env1_1) {
return true;
}
r4 = env1_2 ? env0_0.current : a0.startValue;
if (env1_2) {
env0_0.toValue = a0.startValue;
a0.startValue = r4;
}
binding = env0_0;
onStart = binding.onStart;
binding2 = env0_0;
Reflect.apply(onStart, binding, [binding2, r4, a1, binding2.previousAnimation]);
return false;
}
r4 = env1_2 ? env0_0.current : a0.startValue;
if (env1_2) {
env0_0.toValue = a0.startValue;
a0.startValue = r4;
}
binding = env0_0;
onStart = binding.onStart;
binding2 = env0_0;
Reflect.apply(onStart, binding, [binding2, r4, a1, binding2.previousAnimation]);
}
return false;
}
function pnpm_repeatTs2OnStart(a0, a1, a2, a3) { // fn#18435, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1817:3985, owner: withRepeat.pnpm_repeatTs2.onStart, offset: 0x00e8c367, size: 156 bytes, params: 5, frame: 19
var environment;
var value2;
a0.startValue = a1;
a0.reps = 0;
if (env0_0.reduceMotion === undefined) {
env0_0.reduceMotion = a0.reduceMotion;
}
if (a0.reduceMotion) {
value2 = environment.__proto__;
if (env1_2) {
if (env1_1 <= 0) {
a0.current = a0.startValue;
a0.onFrame = function() {
return true;
};
} else if (env1_1 % 2 === 0) {
a0.current = a0.startValue;
a0.onFrame = onFrame_18436;
} else {
env0_0.onStart(env0_0, a1, a2, a3);
}
} else {
env0_0.onStart(env0_0, a1, a2, a3);
}
} else {
env0_0.onStart(env0_0, a1, a2, a3);
}
}
function pnpm_repeatTs2Callback(a0) { // fn#18437, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1817:4236, owner: withRepeat.pnpm_repeatTs2.callback, offset: 0x00e8c403, size: 70 bytes, params: 2, frame: 11
const value = environment.__proto__;
if (env1_3) {
env1_3(a0);
}
if (!a0 && env0_0.callback) {
env0_0.callback(false);
}
}
}
}
}
function onStartOnFrame_18436() { // fn#18436, owner: withRepeat.pnpm_repeatTs2.onStart.onFrame, offset: 0x00c4c231, size: 4 bytes, params: 1, frame: 1
return true;
}
global.__d(_fun18431, 1690, [1650]) /* metro module 1690, dependencies: [1650] */;