Files
discord-decomp/_bundle/maybeVectorAnim.js
T
2026-11-01 12:12:55 +02:00

700 lines
17 KiB
JavaScript

// Metro module 354 (f355).
import AnimatedAddition from "./AnimatedAddition";
import AnimatedSubtraction from "./AnimatedSubtraction";
import AnimatedDivision from "./AnimatedDivision";
import AnimatedMultiplication from "./AnimatedMultiplication";
import AnimatedModulo from "./AnimatedModulo";
import AnimatedDiffClamp from "./AnimatedDiffClamp";
import AnimatedValueXY from "./AnimatedValueXY";
import processColor from "./processColor_374";
import AnimatedNode from "./AnimatedNode";
import AnimatedTracking from "./AnimatedTracking";
import SpringAnimation from "./SpringAnimation";
import TimingAnimation from "./TimingAnimation";
import DecayAnimation from "./DecayAnimation";
import AnimatedValue from "./AnimatedValue";
import { AnimatedEvent, attachNativeEventImpl } from "./AnimatedEvent";
import mapStringToNumericComponents from "./mapStringToNumericComponents";
import createAnimatedComponent from "./createAnimatedComponent";
function $mk66178($env) {
return function(...args) {
const r3 = $env;
const r7 = r3[1];
if (r7.onComplete) {
r7.onComplete.apply(r7, [...args]);
}
const r17 = r3[0];
if (r17) {
r17.apply(void 0, [...args]);
}
};
}
function $mk66186($env) {
return function start(a0, a1) {
const r2 = $env;
r2[2](r2[0], {
...r2[1],
isLooping: a1
}, a0);
};
}
function $mk66187($env) {
return function stop() {
$env[0].stopAnimation();
};
}
function $mk66188($env) {
return function reset() {
$env[0].resetAnimation();
};
}
function $mk66189($env) {
return function _startNativeLoop(a0) {
const r2 = $env;
(0, r2[2])(r2[0], {
...r2[1],
iterations: a0
});
};
}
function $mk66190($env) {
return function _isUsingNativeDriver() {
return $env[1].useNativeDriver || false;
};
}
function $mk66196($env) {
return function start(a0, a1) {
const r4 = $env;
let env23681 = {
$parent: $env
};
env23681[0] = a0;
env23681[1] = a1;
const onComplete = function onComplete(a0) {
if (a0.finished) {
const r12 = env23681.$parent;
const r13 = r12[1] + 1;
r12[1] = r13;
const r6 = r12[0];
if (r13 === r6.length) {
r12[1] = 0;
const r20 = env23681[0];
if (r20) {
r20(a0);
}
return void 0;
}
r6[r12[1]].start(env23681[2], env23681[1]);
} else {
const r10 = env23681[0];
if (r10) {
r10(a0);
}
}
};
env23681[2] = onComplete;
const r8 = r4[0];
if (r8.length === 0) {
if (a0) {
a0({
finished: true
});
}
} else {
r8[r4[1]].start(onComplete, a1);
}
};
}
function $mk66197($env) {
return function stop() {
const r3 = $env;
const r0 = r3[1];
const r2 = r3[0];
if (r0 < r2.length) {
r2[r3[1]].stop();
}
};
}
function $mk66198($env) {
return function reset() {
const r2 = $env;
r2[0].forEach($mk101193(r2));
r2[1] = 0;
};
}
function $mk66199() {
return function _startNativeLoop() {
throw new Error("Loops run using the native driver cannot contain Animated.sequence animations");
};
}
function $mk66200() {
return function _isUsingNativeDriver() {
return false;
};
}
function $mk66201($env) {
return function start(a0, a1) {
const r3 = $env;
let env23682 = {
$parent: $env
};
env23682[0] = a0;
env23682[1] = a1;
const r0 = r3[1];
const r6 = r3[0];
if (r0 !== r6.length) {
r6.forEach((item, index) => {
if (item) {
item.start(function cb(a0) {
const r4 = env23682.$parent;
r4[2][index] = true;
const r9 = r4[1] + 1;
r4[1] = r9;
if (r9 === r4[0].length) {
r4[1] = 0;
const r20 = env23682[0];
if (r20) {
r20(a0);
}
return void 0;
}
const finished = a0.finished;
if (finished ? !finished : r4[3]) {
r4[4].stop();
}
}, env23682[1]);
} else {
const r8 = {
finished: true
};
const r6 = env23682.$parent;
r6[2][index] = true;
const r11 = r6[1] + 1;
r6[1] = r11;
if (r11 === r6[0].length) {
r6[1] = 0;
const r20 = env23682[0];
if (r20) {
r20(r8);
}
} else {
const finished = r8.finished;
if (finished ? !finished : r6[3]) {
r6[4].stop();
}
}
}
});
} else if (a0) {
a0({
finished: true
});
}
};
}
function $mk66202($env) {
return function stop() {
const r1 = $env;
r1[0].forEach($mk101195(r1));
};
}
function $mk66203($env) {
return function reset() {
const r1 = $env;
r1[0].forEach($mk101196(r1));
};
}
function $mk66204() {
return function _startNativeLoop() {
throw new Error("Loops run using the native driver cannot contain Animated.parallel animations");
};
}
function $mk66205() {
return function _isUsingNativeDriver() {
return false;
};
}
function $mk101193($env) {
return (a0, a1) => {
if (a1 <= $env[1]) {
a0.reset();
}
};
}
function $mk101195($env) {
return (a0, a1) => {
const r5 = $env[2];
if (!r5[a1]) {
a0.stop();
}
r5[a1] = true;
};
}
function $mk101196($env) {
return (a0, a1) => {
const r2 = $env;
a0.reset();
r2[2][a1] = false;
r2[1] = 0;
};
}
let maybeVectorAnim, springImpl, timingImpl, decayImpl, sequenceImpl, parallelImpl, delayImpl;
let $mk66185 = function() {
return function start(a0, a1, a2) {
let env23678;
let r8 = a2;
const r17 = env23678 = {};
env23678[0] = a2;
env23678[1] = a1;
if (a2 && a1.onComplete) {
r8 = $mk66178(r17);
} else if (!a2) {
r8 = a1.onComplete;
}
a0.stopTracking();
if (a1.toValue instanceof AnimatedNode) {
a0.track(new AnimatedTracking(a0, a1.toValue, TimingAnimation, a1, r8));
} else {
a0.animate(new TimingAnimation(a1), r8);
}
};
};
let env367 = {};
const _combineCallbacks = function _combineCallbacks(a0, a1) {};
maybeVectorAnim = function maybeVectorAnim(a0, a1, a2) {
if (a0 instanceof AnimatedValueXY) {
const r69 = {
...a1
};
const r73 = {
...a1
};
for (const key2 in a1) {
const r83 = a1[key2];
const { x: r84, y: r85 } = r83;
if (r84 !== void 0 && r85 !== void 0) {
r69[key2] = r84;
r73[key2] = r85;
}
}
const r88 = a2(a0.x, r69);
const r90 = a2(a0.y, r73);
const r92 = [r88, r90];
let env12260;
const r95 = {
stopTogether: false
};
const r96 = env12260 = {};
env12260[0] = r92;
env12260[1] = 0;
env12260[2] = {};
env12260[3] = !(r95.stopTogether === false);
const r104 = {
start: $mk66201(r96),
stop: $mk66202(r96),
reset: $mk66203(r96),
_startNativeLoop: $mk66204(),
_isUsingNativeDriver: $mk66205()
};
env12260[4] = r104;
return r104;
}
if (a0 instanceof processColor) {
const r12 = {
...a1
};
const r11 = {
...a1
};
const r32 = {
...a1
};
const r36 = {
...a1
};
for (const key in a1) {
const r16 = a1[key];
const { r: r20, g: r19, b: r18, a: r41 } = r16;
if (r20 !== void 0 && r19 !== void 0 && r18 !== void 0 && r41 !== void 0) {
r12[key] = r20;
r11[key] = r19;
r32[key] = r18;
r36[key] = r41;
}
}
const r44 = a2(a0.r, r12);
const r46 = a2(a0.g, r11);
const r48 = a2(a0.b, r32);
const r50 = a2(a0.a, r36);
const r52 = [r44, r46, r48, r50];
let env12259;
const r55 = {
stopTogether: false
};
const r56 = env12259 = {};
env12259[0] = r52;
env12259[1] = 0;
env12259[2] = {};
env12259[3] = !(r55.stopTogether === false);
const r64 = {
start: $mk66201(r56),
stop: $mk66202(r56),
reset: $mk66203(r56),
_startNativeLoop: $mk66204(),
_isUsingNativeDriver: $mk66205()
};
env12259[4] = r64;
return r64;
}
return null;
};
springImpl = function springImpl(a0, a1) {
let c12261_0 = a0;
let c12261_1 = a1;
const start2 = function start(a0, a1, a2) {
let env23677;
let r8 = a2;
const r17 = env23677 = {};
env23677[0] = a2;
env23677[1] = a1;
if (a2 && a1.onComplete) {
r8 = $mk66178(r17);
} else if (!a2) {
r8 = a1.onComplete;
}
a0.stopTracking();
if (a1.toValue instanceof AnimatedNode) {
a0.track(new AnimatedTracking(a0, a1.toValue, SpringAnimation, a1, r8));
} else {
a0.animate(new SpringAnimation(a1), r8);
}
};
return maybeVectorAnim(a0, a1, springImpl) || {
start: function start(a0) {
start2(c12261_0, c12261_1, a0);
},
stop: function stop() {
c12261_0.stopAnimation();
},
reset: function reset() {
c12261_0.resetAnimation();
},
_startNativeLoop: function _startNativeLoop(a0) {
start2(c12261_0, {
...c12261_1,
iterations: a0
});
},
_isUsingNativeDriver: function _isUsingNativeDriver() {
return c12261_1.useNativeDriver || false;
}
};
};
timingImpl = function timingImpl(a0, a1) {
let env12262;
const r3 = env12262 = {
$parent: env367
};
env12262[0] = a0;
env12262[1] = a1;
env12262[2] = $mk66185();
return maybeVectorAnim(a0, a1, timingImpl) || {
start: $mk66186(r3),
stop: $mk66187(r3),
reset: $mk66188(r3),
_startNativeLoop: $mk66189(r3),
_isUsingNativeDriver: $mk66190(r3)
};
};
decayImpl = function decayImpl(a0, a1) {
let c12263_0 = a0;
return maybeVectorAnim(a0, a1, decayImpl) || {
start: function start(a0) {
let env23679;
let r3 = a0;
const r12 = env23679 = {};
env23679[0] = a0;
env23679[1] = a1;
if (a0 && a1.onComplete) {
r3 = $mk66178(r12);
} else if (!a0) {
r3 = a1.onComplete;
}
c12263_0.stopTracking();
c12263_0.animate(new DecayAnimation(a1), r3);
},
stop: function stop() {
c12263_0.stopAnimation();
},
reset: function reset() {
c12263_0.resetAnimation();
},
_startNativeLoop: function _startNativeLoop(a0) {
const r6 = {
...a1,
iterations: a0
};
const onComplete2 = r6.onComplete;
c12263_0.stopTracking();
c12263_0.animate(new DecayAnimation(r6), onComplete2);
},
_isUsingNativeDriver: function _isUsingNativeDriver() {
return a1.useNativeDriver || false;
}
};
};
sequenceImpl = function sequenceImpl(a0) {
let env12264;
const r3 = env12264 = {};
env12264[0] = a0;
env12264[1] = 0;
return {
start: $mk66196(r3),
stop: $mk66197(r3),
reset: $mk66198(r3),
_startNativeLoop: $mk66199(),
_isUsingNativeDriver: $mk66200()
};
};
parallelImpl = function parallelImpl(a0, a1) {
let env12265;
const r3 = env12265 = {};
env12265[0] = a0;
env12265[1] = 0;
env12265[2] = {};
env12265[3] = !(a1 ? a1.stopTogether === false : a1);
const r10 = {
start: $mk66201(r3),
stop: $mk66202(r3),
reset: $mk66203(r3),
_startNativeLoop: $mk66204(),
_isUsingNativeDriver: $mk66205()
};
env12265[4] = r10;
return r10;
};
delayImpl = function delayImpl(a0) {
const animatedValue = new AnimatedValue(0);
const r5 = {
toValue: 0,
delay: a0,
duration: 0,
useNativeDriver: false
};
let env12266;
const r19 = env12266 = {
$parent: env367
};
env12266[0] = animatedValue;
env12266[1] = r5;
env12266[2] = $mk66185();
return maybeVectorAnim(animatedValue, r5, timingImpl) || {
start: $mk66186(r19),
stop: $mk66187(r19),
reset: $mk66188(r19),
_startNativeLoop: $mk66189(r19),
_isUsingNativeDriver: $mk66190(r19)
};
};
export default {
Value: AnimatedValue,
ValueXY: AnimatedValueXY,
Color: processColor,
Interpolation: mapStringToNumericComponents,
Node: AnimatedNode,
decay: decayImpl,
timing: timingImpl,
spring: springImpl,
add: function add(a0, a1) {
return new AnimatedAddition(a0, a1);
},
subtract: function subtract(a0, a1) {
return new AnimatedSubtraction(a0, a1);
},
divide: function divide(a0, a1) {
return new AnimatedDivision(a0, a1);
},
multiply: function multiply(a0, a1) {
return new AnimatedMultiplication(a0, a1);
},
modulo: function modulo(a0, a1) {
return new AnimatedModulo(a0, a1);
},
diffClamp: function diffClamp(a0, a1, a2) {
return new AnimatedDiffClamp(a0, a1, a2);
},
delay: delayImpl,
sequence: sequenceImpl,
parallel: parallelImpl,
stagger: function stagger(c12267_0, a1) {
const r10 = a1.map((item, index) => {
const r2 = env367;
const delay = c12267_0 * index;
const animatedValue = new AnimatedValue(0);
const r22 = {
toValue: 0,
delay,
duration: 0,
useNativeDriver: false
};
let env23683;
const r26 = env23683 = {
$parent: r2
};
env23683[0] = animatedValue;
env23683[1] = r22;
env23683[2] = $mk66185();
const r37 = [maybeVectorAnim(animatedValue, r22, timingImpl) || {
start: $mk66186(r26),
stop: $mk66187(r26),
reset: $mk66188(r26),
_startNativeLoop: $mk66189(r26),
_isUsingNativeDriver: $mk66190(r26)
}, item];
let env23684;
const r40 = env23684 = {};
env23684[0] = r37;
env23684[1] = 0;
return {
start: $mk66196(r40),
stop: $mk66197(r40),
reset: $mk66198(r40),
_startNativeLoop: $mk66199(),
_isUsingNativeDriver: $mk66200()
};
});
let env12268;
const r12 = env12268 = {};
env12268[0] = r10;
env12268[1] = 0;
env12268[2] = {};
env12268[3] = true;
const r15 = {
start: $mk66201(r12),
stop: $mk66202(r12),
reset: $mk66203(r12),
_startNativeLoop: $mk66204(),
_isUsingNativeDriver: $mk66205()
};
env12268[4] = r15;
return r15;
},
loop: function loop(c12269_0, r6 = {}) {
let iterations = r6.iterations;
if (iterations === void 0) {
iterations = -1;
}
let c12269_1 = iterations;
let resetBeforeIteration = r6.resetBeforeIteration;
if (resetBeforeIteration === void 0) {
resetBeforeIteration = true;
}
let c12269_2 = resetBeforeIteration;
let c12269_3 = false;
let c12269_4 = 0;
return {
start: function start(a0) {
let c23685_0, restart2;
L14: {
c23685_0 = a0;
restart2 = function restart(r5 = {
finished: true
}) {
L10: {
if (!c12269_3) {
const r0 = c12269_4;
if (r0 !== c12269_1 && r5.finished !== false) {
c12269_4 = c12269_4 + 1;
if (c12269_2) {
c12269_0.reset();
}
c12269_0.start(restart2, c12269_1 === -1);
break L10;
}
}
if (c23685_0) {
c23685_0(r5);
}
}
};
if (c12269_0) {
if (c12269_1 !== 0) {
if (c12269_0._isUsingNativeDriver()) {
c12269_0._startNativeLoop(c12269_1);
break L14;
}
const r14 = {
finished: true
};
if (!c12269_3 && c12269_4 !== c12269_1 && r14.finished !== false) {
c12269_4 = c12269_4 + 1;
if (c12269_2) {
c12269_0.reset();
}
c12269_0.start(restart2, c12269_1 === -1);
break L14;
}
if (!a0) {
break L14;
}
a0(r14);
break L14;
}
}
if (a0) {
a0({
finished: true
});
}
}
},
stop: function stop() {
c12269_3 = true;
c12269_0.stop();
},
reset: function reset() {
c12269_4 = 0;
c12269_3 = false;
c12269_0.reset();
},
_startNativeLoop: function _startNativeLoop() {
throw new Error("Loops run using the native driver cannot contain Animated.loop animations");
},
_isUsingNativeDriver: function _isUsingNativeDriver() {
return c12269_0._isUsingNativeDriver();
}
};
},
event: function event(a0, a1) {
const animatedEvent = new AnimatedEvent(a0, a1);
return animatedEvent.__isNative ? animatedEvent : animatedEvent.__getHandler();
},
createAnimatedComponent,
attachNativeEvent: attachNativeEventImpl,
forkEvent: function forkEventImpl(a0, a1) {
let r12;
let r1 = a1;
if (a0) {
if (a0 instanceof AnimatedEvent) {
a0.__addListener(a1);
r12 = a0;
} else {
r12 = function(...args) {
if (typeof a0 === "function") {
a0.apply(void 0, [...args]);
}
a1.apply(void 0, [...args]);
};
}
r1 = r12;
}
return r1;
},
unforkEvent: function unforkEventImpl(a0, a1) {
if (a0 ? a0 instanceof AnimatedEvent : a0) {
a0.__removeListener(a1);
}
},
Event: AnimatedEvent
};