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

227 lines
6.4 KiB
JavaScript

// Metro module 382 (f383).
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 { isValidElement } from "react";
import AnimatedNode from "./AnimatedNode";
import AnimatedWithChildren from "./AnimatedWithChildren";
function $mk66440($env) {
return function(a0) {
const r0 = $env;
return r0[1].apply(r0[0], a0);
};
}
let flatAnimatedNodes, mapAnimatedNodes;
let AnimatedObject;
let env408 = {};
env408[7] = function _isNativeReflectConstruct() {
let c12293_0;
try {
c12293_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
} catch ($e) {}
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
return !!c12293_0;
};
env408[7] = _isNativeReflectConstruct2;
return _isNativeReflectConstruct2();
};
flatAnimatedNodes = function flatAnimatedNodes(a0, r8 = [], r5 = 0) {
if (r5 >= 5) {
return r8;
}
if (a0 instanceof AnimatedNode) {
r8.push(a0);
} else if (Array.isArray(a0)) {
const length2 = a0.length;
const r41 = 0 < length2;
const r43 = r5 + 1;
let r44 = 0;
if (r41) {
do {
flatAnimatedNodes(a0[r44], r8, r43);
r44 = r44 + 1;
} while (r44 < length2);
}
} else {
const r16 = a0 !== null ? typeof a0 === "object" ? Object.getPrototypeOf(a0) : void 0 : void 0;
if (r16 !== void 0 && ((r16 == null || r16.isPrototypeOf(Object)) && !(0, isValidElement)(a0))) {
const r31 = Object.keys(a0);
const length = r31.length;
const r33 = 0 < length;
const r3 = r5 + 1;
let r34 = 0;
if (r33) {
do {
flatAnimatedNodes(a0[r31[r34]], r8, r3);
r34 = r34 + 1;
} while (r34 < length);
}
}
}
return r8;
};
mapAnimatedNodes = function mapAnimatedNodes(a0, a1) {
let r5 = arguments[2];
if (r5 === void 0) {
r5 = 0;
}
let c12294_1 = r5;
if (r5 >= 5) {
return a0;
}
if (a0 instanceof AnimatedNode) {
return a1(a0);
}
if (Array.isArray(a0)) {
return a0.map((item) => mapAnimatedNodes(item, a1, c12294_1 + 1));
}
const r17 = a0 !== null ? typeof a0 === "object" ? Object.getPrototypeOf(a0) : void 0 : void 0;
if (r17 !== void 0 && ((r17 == null || r17.isPrototypeOf(Object)) && !(0, isValidElement)(a0))) {
const r30 = {};
const r33 = Object.keys(a0);
const length = r33.length;
const r35 = 0 < length;
const r3 = r5 + 1;
let r36 = 0;
if (r35) {
do {
const r37 = r33[r36];
r30[r37] = mapAnimatedNodes(a0[r37], a1, r3);
r36 = r36 + 1;
} while (r36 < length);
}
return r30;
}
return a0;
};
AnimatedObject = function AnimatedObject(a0, a1, a2) {
_classCallCheck(this, AnimatedObject);
const r8 = [a2];
const r7 = _getPrototypeOf(AnimatedObject);
const r23 = _possibleConstructorReturn(this, (0, env408[7])() ? Reflect.construct(r7, r8, _getPrototypeOf(this).constructor) : r7.apply(this, r8));
r23._nodes = a0;
r23._value = a1;
return r23;
};
_inherits(AnimatedObject, AnimatedWithChildren);
export default _createClass(AnimatedObject, [{
key: "__getValue",
value: function __getValue() {
return mapAnimatedNodes(this._value, (a0) => a0.__getValue());
}
}, {
key: "__getValueWithStaticObject",
value: function __getValueWithStaticObject(a0) {
const _nodes = this._nodes;
let c23746_1 = 0;
return mapAnimatedNodes(a0, () => {
const r4 = +c23746_1;
c23746_1 = r4 + 1;
return _nodes[r4].__getValue();
});
}
}, {
key: "__getAnimatedValue",
value: function __getAnimatedValue() {
return mapAnimatedNodes(this._value, (a0) => a0.__getAnimatedValue());
}
}, {
key: "__attach",
value: function __attach() {
const _nodes2 = this._nodes;
const length = _nodes2.length;
let r0 = 0;
while (r0 < length) {
_nodes2[r0].__addChild(this);
r0 = r0 + 1;
}
let env23747;
const r13 = env23747 = {};
env23747[0] = this;
let r20 = _get(_getPrototypeOf(AnimatedObject.prototype), "__attach", this);
env23747[1] = r20;
if (typeof r20 === "function") {
r20 = $mk66440(r13);
}
r20([]);
}
}, {
key: "__detach",
value: function __detach() {
const _nodes2 = this._nodes;
const length = _nodes2.length;
let r0 = 0;
while (r0 < length) {
_nodes2[r0].__removeChild(this);
r0 = r0 + 1;
}
let env23748;
const r13 = env23748 = {};
env23748[0] = this;
let r20 = _get(_getPrototypeOf(AnimatedObject.prototype), "__detach", this);
env23748[1] = r20;
if (typeof r20 === "function") {
r20 = $mk66440(r13);
}
r20([]);
}
}, {
key: "__makeNative",
value: function __makeNative(a0) {
const _nodes2 = this._nodes;
const length = _nodes2.length;
let r0 = 0;
while (r0 < length) {
_nodes2[r0].__makeNative(a0);
r0 = r0 + 1;
}
let env23749;
const r14 = env23749 = {};
env23749[0] = this;
let r21 = _get(_getPrototypeOf(AnimatedObject.prototype), "__makeNative", this);
env23749[1] = r21;
if (typeof r21 === "function") {
r21 = $mk66440(r14);
}
r21([a0]);
}
}, {
key: "__getNativeConfig",
value: function __getNativeConfig() {
return {
type: "object",
value: mapAnimatedNodes(this._value, (a0) => ({
nodeTag: a0.__getNativeTag()
})),
debugID: this.__getDebugID()
};
}
}], [{
key: "from",
value: function from(a0) {
const _nodes2 = flatAnimatedNodes(a0);
const length = _nodes2.length;
let r13 = null;
if (length !== 0) {
const r16 = {
__proto__: AnimatedObject.prototype
};
_classCallCheck(r16, AnimatedObject);
const r12 = [void 0];
const r11 = _getPrototypeOf(AnimatedObject);
const r27 = _possibleConstructorReturn(r16, (0, env408[7])() ? Reflect.construct(r11, r12, _getPrototypeOf(r16).constructor) : r11.apply(r16, r12));
r27._nodes = _nodes2;
r27._value = a0;
r13 = r27 instanceof Object ? r27 : r16;
}
return r13;
}
}]);
export function isPlainObject(a0) {
const r7 = a0 !== null ? typeof a0 === "object" ? Object.getPrototypeOf(a0) : void 0 : void 0;
return r7 !== void 0 && ((r7 == null || r7.isPrototypeOf(Object)) && !(0, isValidElement)(a0));
}