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

245 lines
6.8 KiB
JavaScript

// Metro module 381 (f382).
import _classCallCheck from "./_classCallCheck";
import _createClass from "./_createClass";
import _possibleConstructorReturn from "./_possibleConstructorReturn";
import _getPrototypeOf from "./_getPrototypeOf";
import _get from "./_get";
import _inherits from "./_inherits";
import { shouldUseAnimatedObjectForTransform } from "./Module27";
import flatAnimatedNodes from "./flatAnimatedNodes";
import AnimatedTransform from "./AnimatedTransform";
import AnimatedNode from "./AnimatedNode";
import AnimatedWithChildren from "./AnimatedWithChildren";
function $mk66427($env) {
return function(a0) {
const r0 = $env;
return r0[1].apply(r0[0], a0);
};
}
let hasOwnProperty, hasOwn;
let AnimatedStyle;
let env406 = {};
env406[8] = function _isNativeReflectConstruct() {
let c12292_0;
try {
c12292_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
} catch ($e) {}
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
return !!c12292_0;
};
env406[8] = _isNativeReflectConstruct2;
return _isNativeReflectConstruct2();
};
AnimatedStyle = function AnimatedStyle(a0, a1, a2, a3, a4) {
_classCallCheck(this, AnimatedStyle);
const r8 = [a4];
const r7 = _getPrototypeOf(AnimatedStyle);
const r24 = _possibleConstructorReturn(this, (0, env406[8])() ? Reflect.construct(r7, r8, _getPrototypeOf(this).constructor) : r7.apply(this, r8));
r24._nodeKeys = a0;
r24._nodes = a1;
r24._style = a2;
return r24;
};
_inherits(AnimatedStyle, AnimatedWithChildren);
const r53 = _createClass(AnimatedStyle, [{
key: "__getValue",
value: function __getValue() {
const r6 = {};
const r15 = Object.keys(this._style);
const length = r15.length;
let r0 = 0;
while (r0 < length) {
const r11 = r15[r0];
const r12 = this._style[r11];
const r21 = r12 instanceof AnimatedNode;
const r1 = r0;
if (r21) {
r6[r11] = r12.__getValue();
} else {
r6[r11] = r12;
}
r0 = r1 + 1;
}
return this.__getValueForStyle(r6);
}
}, {
key: "__getValueForStyle",
value: function __getValueForStyle(a0) {
return a0;
}
}, {
key: "__replaceAnimatedNodeWithValues",
value: function __replaceAnimatedNodeWithValues(a0) {
const r7 = Object.keys(a0);
const length = r7.length;
let r0 = 0;
while (r0 < length) {
const r13 = r7[r0];
const r15 = this._style[r13];
const r1 = r0;
if (r13 === "transform" && r15 instanceof AnimatedTransform) {
a0[r13] = r15.__getValueWithStaticTransforms(Array.isArray(a0[r13]) ? a0[r13] : []);
} else if (r15 instanceof flatAnimatedNodes) {
a0[r13] = r15.__getValueWithStaticObject(a0[r13]);
} else if (r15 instanceof AnimatedNode) {
a0[r13] = r15.__getValue();
}
r0 = r1 + 1;
}
}
}, {
key: "__getAnimatedValue",
value: function __getAnimatedValue() {
const r4 = {};
const _nodeKeys = this._nodeKeys;
const _nodes = this._nodes;
const length = _nodes.length;
let r0 = 0;
while (r0 < length) {
r4[_nodeKeys[r0]] = _nodes[r0].__getAnimatedValue();
r0 = r0 + 1;
}
return r4;
}
}, {
key: "__attach",
value: function __attach() {
const _nodes = this._nodes;
const length = _nodes.length;
let r0 = 0;
while (r0 < length) {
_nodes[r0].__addChild(this);
r0 = r0 + 1;
}
let env23743;
const r13 = env23743 = {};
env23743[0] = this;
let r20 = _get(_getPrototypeOf(AnimatedStyle.prototype), "__attach", this);
env23743[1] = r20;
if (typeof r20 === "function") {
r20 = $mk66427(r13);
}
r20([]);
}
}, {
key: "__detach",
value: function __detach() {
const _nodes = this._nodes;
const length = _nodes.length;
let r0 = 0;
while (r0 < length) {
_nodes[r0].__removeChild(this);
r0 = r0 + 1;
}
let env23744;
const r13 = env23744 = {};
env23744[0] = this;
let r20 = _get(_getPrototypeOf(AnimatedStyle.prototype), "__detach", this);
env23744[1] = r20;
if (typeof r20 === "function") {
r20 = $mk66427(r13);
}
r20([]);
}
}, {
key: "__makeNative",
value: function __makeNative(a0) {
const _nodes = this._nodes;
const length = _nodes.length;
let r0 = 0;
while (r0 < length) {
_nodes[r0].__makeNative(a0);
r0 = r0 + 1;
}
let env23745;
const r14 = env23745 = {};
env23745[0] = this;
let r21 = _get(_getPrototypeOf(AnimatedStyle.prototype), "__makeNative", this);
env23745[1] = r21;
if (typeof r21 === "function") {
r21 = $mk66427(r14);
}
r21([a0]);
}
}, {
key: "__getNativeConfig",
value: function __getNativeConfig() {
const r9 = this.__getPlatformConfig();
const style = {};
const _nodeKeys = this._nodeKeys;
const _nodes = this._nodes;
const length = _nodes.length;
let r0 = 0;
while (r0 < length) {
const r11 = _nodeKeys[r0];
const r12 = _nodes[r0];
r12.__makeNative(r9);
style[r11] = r12.__getNativeTag();
r0 = r0 + 1;
}
return {
type: "style",
style,
debugID: this.__getDebugID()
};
}
}], [{
key: "from",
value: function from(a0, a1, a2) {
if (a0 == null) {
return null;
}
const r11 = [];
const r10 = [];
const r7 = {};
const r13 = Object.keys(a0);
const length = r13.length;
const r5 = 0 < length;
let r0 = 0;
if (r5) {
do {
const r18 = r13[r0];
const r17 = a0[r18];
const r1 = r0;
if (a1 != null && !hasOwn(a1, r18)) {
r7[r18] = r17;
} else {
const r31 = r17 != null && r18 === "transform" ? shouldUseAnimatedObjectForTransform() ? flatAnimatedNodes.from(r17) : AnimatedTransform.from(r17) : r17 instanceof AnimatedNode ? r17 : flatAnimatedNodes.from(r17);
if (r31 == null) {
r7[r18] = r17;
} else {
r11.push(r18);
r10.push(r31);
r7[r18] = r31;
}
}
r0 = r1 + 1;
} while (r0 < length);
}
const [_nodeKeys, _nodes, _style] = [r11, r10, r7];
const length2 = _nodes.length;
let r61 = null;
if (length2 !== 0) {
const r65 = {
__proto__: AnimatedStyle.prototype
};
_classCallCheck(r65, AnimatedStyle);
const r68 = [void 0];
const r70 = _getPrototypeOf(AnimatedStyle);
const r80 = _possibleConstructorReturn(r65, (0, env406[8])() ? Reflect.construct(r70, r68, _getPrototypeOf(r65).constructor) : r70.apply(r65, r68));
r80._nodeKeys = _nodeKeys;
r80._nodes = _nodes;
r80._style = _style;
r61 = r80 instanceof Object ? r80 : r65;
}
return r61;
}
}]);
hasOwnProperty = Object.prototype.hasOwnProperty;
let hasOwn2 = Object.hasOwn;
if (hasOwn2 == null) {
hasOwn2 = (a0, a1) => hasOwnProperty.call(a0, a1);
}
hasOwn = hasOwn2;
export default r53;