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

257 lines
9.9 KiB
JavaScript

// Metro module 1691 (f1692).
import _classCallCheck from "./_classCallCheck";
import _createClass from "./_createClass";
import { ReduceMotion } from "./Module1631";
import * as _Module1678 from "./Module1678";
import * as _Module1658 from "./Module1658";
import { ReanimatedError } from "./Module1617";
import * as _recognizePrefixSuffix from "./recognizePrefixSuffix";
function $mk113871() {
return (a0, a1) => a0 + a1.duration;
}
let makeKeyframeKey;
let env1334 = {};
const c1334_3 = {
code: "function pnpm_KeyframeTs1(){const{keyframes,delayFunction,delay,withTiming,Easing,withSequence,initialValues,makeKeyframeKey,callback}=this.__closure;const animations={};const addAnimation=function(key){const keyframePoints=keyframes[key];if(keyframePoints.length===0){return;}const animation=delayFunction(delay,keyframePoints.length===1?withTiming(keyframePoints[0].value,{duration:keyframePoints[0].duration,easing:keyframePoints[0].easing?keyframePoints[0].easing:Easing.linear}):withSequence(...keyframePoints.map(function(keyframePoint){return withTiming(keyframePoint.value,{duration:keyframePoint.duration,easing:keyframePoint.easing?keyframePoint.easing:Easing.linear});})));if(key.includes('transform')){if(!('transform'in animations)){animations.transform=[];}animations.transform.push({[key.split(':')[1]]:animation});}else{animations[key]=animation;}};Object.keys(initialValues).forEach(function(key){if(key.includes('transform')){initialValues[key].forEach(function(transformProp,index){Object.keys(transformProp).forEach(function(transformPropKey){addAnimation(makeKeyframeKey(index,transformPropKey));});});}else{addAnimation(key);}});return{animations:animations,initialValues:initialValues,callback:callback};}"
};
const c1334_4 = {
code: "function pnpm_KeyframeTs2(delay,animation){const{withDelay,reduceMotion}=this.__closure;return withDelay(delay,animation,reduceMotion);}"
};
const c1334_5 = {
code: "function pnpm_KeyframeTs3(_,animation){const{getReduceMotionFromConfig,reduceMotion}=this.__closure;animation.reduceMotion=getReduceMotionFromConfig(reduceMotion);return animation;}"
};
const InnerKeyframe = function InnerKeyframe(a0) {
const _this = this;
_classCallCheck(this, InnerKeyframe);
this.reduceMotionV = ReduceMotion.System;
this.build = () => {
const delayV = _this.delayV;
const delayFunction = _this.getDelayFunction();
const r13 = _this.parseDefinitions();
const { keyframes, initialValues } = r13;
const callbackV = _this.callbackV;
if (!_this.parsedAnimation) {
const parsedAnimation = function n() {
const animations = {};
let c31247_0 = animations;
const addAnimation2 = (a0) => {
const r12 = keyframes[a0];
if (r12.length !== 0) {
const r51 = delayFunction(delayV, r12.length === 1 ? _Module1678.withTiming(r12[0].value, {
duration: r12[0].duration,
easing: r12[0].easing ? r12[0].easing : _Module1658.Easing.linear
}) : _Module1678.withSequence.apply(_Module1678, [...r12.map((item) => _Module1678.withTiming(item.value, {
duration: item.duration,
easing: item.easing ? item.easing : _Module1658.Easing.linear
}))]));
const r54 = a0.includes("transform");
if (r54) {
if (!("transform" in c31247_0)) {
c31247_0.transform = [];
}
const transform = c31247_0.transform;
const r60 = {};
r60[a0.split(":")[1]] = r51;
transform.push(r60);
} else {
c31247_0[a0] = r51;
}
}
};
Object.keys(initialValues).forEach((item) => {
if (item.includes("transform")) {
initialValues[item].forEach((a0, c32099_0) => {
Object.keys(a0).forEach((item) => {
addAnimation2(`${c32099_0}_transform:${item}`);
});
});
} else {
addAnimation2(item);
}
});
return {
animations,
initialValues,
callback: callbackV
};
};
parsedAnimation.__closure = {
keyframes,
delayFunction,
delay: delayV,
withTiming: _Module1678.withTiming,
Easing: _Module1658.Easing,
withSequence: _Module1678.withSequence,
initialValues,
makeKeyframeKey,
callback: callbackV
};
parsedAnimation.__workletHash = 2209924843920;
parsedAnimation.__initData = c1334_3;
_this.parsedAnimation = parsedAnimation;
}
return _this.parsedAnimation;
};
this.definitions = a0;
};
const r35 = _createClass(InnerKeyframe, [{
key: "parseDefinitions",
value: function parseDefinitions() {
let getAnimationDuration2, c24550_2, durationV;
const keyframes2 = {};
let c24550_1 = keyframes2;
if (this.definitions.from) {
if (this.definitions[0]) {
throw new ReanimatedError("You cannot provide both keyframe 0 and 'from' as they both specified initial values.");
}
this.definitions[0] = this.definitions.from;
delete this.definitions["from"];
}
if (this.definitions.to) {
if (this.definitions[100]) {
throw new ReanimatedError("You cannot provide both keyframe 100 and 'to' as they both specified values at the end of the animation.");
}
this.definitions[100] = this.definitions.to;
delete this.definitions["to"];
}
if (this.definitions[0]) {
const initialValues2 = this.definitions[0];
c24550_2 = initialValues2;
Object.keys(initialValues2).forEach((a0) => {
if (a0 === "transform") {
const r5 = Array;
if (!r5.isArray(c24550_2.transform)) {
return void 0;
}
c24550_2.transform.forEach((a0, c31248_0) => {
Object.keys(a0).forEach((item) => {
c24550_1[`${c31248_0}_transform:${item}`] = [];
});
});
} else {
c24550_1[a0] = [];
}
});
durationV = this.durationV ? this.durationV : 500;
const r59 = Array.from(Object.keys(this.definitions)).map(Number);
getAnimationDuration2 = (a0, a1) => {};
r59.filter((item) => item !== 0).sort((a, b) => a - b).forEach((a0) => {
let c28941_1, easing, addKeyPointWith2;
let c28941_0 = a0;
if (!(a0 < 0) && !(a0 > 100)) {
const r5 = this.definitions[a0];
c28941_1 = r5;
easing = r5.easing;
delete r5["easing"];
addKeyPointWith2 = (a0, a1) => {};
Object.keys(r5).forEach((item) => {
if (item === "transform") {
const r45 = Array;
if (!r45.isArray(c28941_1.transform)) {
return void 0;
}
c28941_1.transform.forEach((a0, c31893_1) => {
Object.keys(a0).forEach((item) => {
const r21 = `${c31893_1}_transform:${item}`;
const value = a0[item];
if (r21 in c24550_1) {
c24550_1[r21].push({
duration: c28941_0 / 100 * durationV - c24550_1[r21].reduce($mk113871(), 0),
value,
easing
});
return void 0;
}
throw new ReanimatedError("Keyframe can contain only that set of properties that were provide with initial values (keyframe 0 or 'from')");
});
});
} else {
const value = c28941_1[item];
if (!(item in c24550_1)) {
throw new ReanimatedError("Keyframe can contain only that set of properties that were provide with initial values (keyframe 0 or 'from')");
}
c24550_1[item].push({
duration: c28941_0 / 100 * durationV - c24550_1[item].reduce($mk113871(), 0),
value,
easing
});
}
});
return void 0;
}
throw new ReanimatedError("Keyframe should be in between range 0 - 100.");
});
return {
initialValues: initialValues2,
keyframes: keyframes2
};
}
throw new ReanimatedError("Please provide 0 or 'from' keyframe with initial state of your object.");
}
}, {
key: "duration",
value: function duration(a0) {
this.durationV = a0;
return this;
}
}, {
key: "delay",
value: function delay(a0) {
this.delayV = a0;
return this;
}
}, {
key: "withCallback",
value: function withCallback(a0) {
this.callbackV = a0;
return this;
}
}, {
key: "reduceMotion",
value: function reduceMotion(a0) {
this.reduceMotionV = a0;
return this;
}
}, {
key: "getDelayFunction",
value: function getDelayFunction() {
let r9;
const delayV2 = this.delayV;
const reduceMotionV = this.reduceMotionV;
if (delayV2) {
const t = function t(a0, a1) {
return _Module1678.withDelay(a0, a1, reduceMotionV);
};
t.__closure = {
withDelay: _Module1678.withDelay,
reduceMotion: reduceMotionV
};
t.__workletHash = 6884672498893;
t.__initData = c1334_4;
r9 = t;
} else {
r9 = function n(a0, a1) {
a1.reduceMotion = _recognizePrefixSuffix.getReduceMotionFromConfig(reduceMotionV);
return a1;
};
r9.__closure = {
getReduceMotionFromConfig: _recognizePrefixSuffix.getReduceMotionFromConfig,
reduceMotion: reduceMotionV
};
r9.__workletHash = 14632587413843;
r9.__initData = c1334_5;
}
return r9;
}
}]);
const makeKeyframeKey2 = function makeKeyframeKey(a0, a1) {
return `${a0}_transform:${a1}`;
};
makeKeyframeKey2.__closure = {};
makeKeyframeKey2.__workletHash = 11090453666227;
makeKeyframeKey2.__initData = {
code: "function makeKeyframeKey_Pnpm_KeyframeTs4(index,transformProp){return index+\"_transform:\"+transformProp;}"
};
makeKeyframeKey = makeKeyframeKey2;
export { r35 as Keyframe };