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

87 lines
3.6 KiB
JavaScript

// Metro module 1644 (f1645).
export function valueSetter(a0, a1) {
let c24493_1, step2;
let c24493_0 = a0;
let r5 = arguments[2];
if (r5 === void 0) {
r5 = false;
}
c24493_1 = void 0;
step2 = void 0;
const _animation = a0._animation;
if (_animation) {
_animation.cancelled = true;
a0._animation = null;
}
L33: {
L12: {
if (typeof a1 !== "function") {
if (a1 !== null && typeof a1 === "object" && a1.onFrame !== void 0) {
break L12;
}
if (a0._value === a1 && !r5) {
return void 0;
}
a0._value = a1;
break L33;
}
}
const _animation2 = typeof a1 === "function" ? a1() : a1;
c24493_1 = _animation2;
if (a0._value === _animation2.current && !_animation2.isHigherOrder && !r5) {
if (_animation2.callback) {
_animation2.callback(true);
}
return void 0;
}
let timestamp = global.__frameTimestamp || global._getAnimationTimestamp();
_animation2.onStart(_animation2, a0.value, timestamp, _animation);
step2 = (a0) => {
const timestamp = a0 < (c24493_1.timestamp || 0) ? c24493_1.timestamp : a0;
if (c24493_1.cancelled) {
if (c24493_1.callback) {
c24493_1.callback(false);
}
} else {
const r10 = c24493_1.onFrame(c24493_1, timestamp);
c24493_1.finished = true;
c24493_1.timestamp = timestamp;
c24493_0._value = c24493_1.current;
if (r10) {
if (c24493_1.callback) {
c24493_1.callback(true);
}
} else {
requestAnimationFrame(step2);
}
}
};
a0._animation = _animation2;
if (timestamp < (_animation2.timestamp || 0)) {
timestamp = _animation2.timestamp;
}
if (_animation2.cancelled) {
if (_animation2.callback) {
_animation2.callback(false);
}
} else {
const r36 = _animation2.onFrame(_animation2, timestamp);
_animation2.finished = true;
_animation2.timestamp = timestamp;
a0._value = _animation2.current;
if (r36) {
if (_animation2.callback) {
_animation2.callback(true);
}
} else {
requestAnimationFrame(step2);
}
}
}
}
valueSetter.__closure = {};
valueSetter.__workletHash = 13584629644803;
valueSetter.__initData = {
code: "function valueSetter_Pnpm_valueSetterTs1(mutable,value,forceUpdate=false){const previousAnimation=mutable._animation;if(previousAnimation){previousAnimation.cancelled=true;mutable._animation=null;}if(typeof value==='function'||value!==null&&typeof value==='object'&&value.onFrame!==undefined){const animation=typeof value==='function'?value():value;if(mutable._value===animation.current&&!animation.isHigherOrder&&!forceUpdate){animation.callback&&animation.callback(true);return;}const initializeAnimation=function(timestamp){animation.onStart(animation,mutable.value,timestamp,previousAnimation);};const currentTimestamp=global.__frameTimestamp||global._getAnimationTimestamp();initializeAnimation(currentTimestamp);const step=function(newTimestamp){const timestamp=newTimestamp<(animation.timestamp||0)?animation.timestamp:newTimestamp;if(animation.cancelled){animation.callback&&animation.callback(false);return;}const finished=animation.onFrame(animation,timestamp);animation.finished=true;animation.timestamp=timestamp;mutable._value=animation.current;if(finished){animation.callback&&animation.callback(true);}else{requestAnimationFrame(step);}};mutable._animation=animation;step(currentTimestamp);}else{if(mutable._value===value&&!forceUpdate){return;}mutable._value=value;}}"
};