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

240 lines
7.2 KiB
React

// Metro module 649 (f650).
import { Component, forwardRef } from "react";
import { jsx } from "react/jsx-runtime";
import { BatchedStoreListener } from "./Module648";
import shallowEqual from "./shallowEqual";
import { HermesBuiltin, $deriveClass } from "../_hermes/prelude";
function $mk66825($env) {
return function getCachedResult(a0) {
let r16;
L9: {
const r3 = $env;
if (r3[1] != null && r3[2] != null) {
const r8 = $env.$parent;
if ((0, r8[1])(r8[2][4])(r3[1], a0)) {
r16 = r3[2];
break L9;
}
}
const r15 = r3[1] != null;
r16 = null;
if (r15) {
const r18 = r3[2] != null;
r16 = null;
if (r18) {
const r19 = $env.$parent;
const r25 = (0, r19[1])(r19[2][4])(r3[1], a0);
r16 = null;
if (r25) {
r3[1] = a0;
r16 = r3[2];
}
}
}
}
return r16;
};
}
function $mk66826($env) {
return function memoizedFunction(a0) {
let r4, r16;
L9: {
r4 = $env;
if (r4[1] != null && r4[2] != null) {
const r8 = $env.$parent;
if ((0, r8[1])(r8[2][4])(r4[1], a0)) {
r16 = r4[2];
break L9;
}
}
const r15 = r4[1] != null;
r16 = null;
if (r15) {
const r18 = r4[2] != null;
r16 = null;
if (r18) {
const r19 = $env.$parent;
const r25 = (0, r19[1])(r19[2][4])(r4[1], a0);
r16 = null;
if (r25) {
r4[1] = a0;
r16 = r4[2];
}
}
}
}
if (r16 == null) {
const r26 = r4[0];
r4[1] = a0;
const r28 = r26(a0);
r4[2] = r28;
r16 = r28;
}
return r16;
};
}
function $mk66827($env) {
return () => {
const r1 = $env;
r1[1] = null;
r1[2] = null;
};
}
let env572 = {};
export default function connectStores(a0, a1, a2) {
let r7;
if (a2 != null && a2.forwardRef) {
let c12421_0 = a0;
let c12421_1 = a1;
r7 = (a0) => {
let c28665_2, c28665_3;
let Component2 = a0;
let displayName = a0.displayName;
if (displayName == null) {
displayName = a0.name;
}
if (displayName == null) {
displayName = "<Unknown>";
}
const displayName2 = `FluxContainer(${displayName})`;
let c28665_1 = displayName2;
const r16 = $deriveClass(function FluxContainer() {
let env31158;
const prototypeOf = Object.getPrototypeOf(c28665_3);
const r2 = new.target;
const r13 = HermesBuiltin.applyArguments(prototypeOf, Object.create(r2.prototype), r2);
const r4 = env572;
let c31157_0 = r13;
const r6 = env31158 = {
$parent: r4
};
env31158[0] = c12421_1;
const memoizedGetStateFromStores = $mk66826(r6);
env31158[1] = null;
env31158[2] = null;
memoizedGetStateFromStores.getCachedResult = $mk66825(r6);
memoizedGetStateFromStores.clear = $mk66827(r6);
r13.memoizedGetStateFromStores = memoizedGetStateFromStores;
r13.listener = new BatchedStoreListener(c12421_0, () => {
const cachedResult = c31157_0.memoizedGetStateFromStores.getCachedResult(c31157_0.props.childProps);
let r9 = cachedResult != null;
if (r9) {
c31157_0.memoizedGetStateFromStores.clear();
r9 = shallowEqual(c31157_0.memoizedGetStateFromStores(c31157_0.props.childProps), cachedResult);
}
if (!r9) {
c31157_0.forceUpdate();
}
});
return r13;
}, Component);
const prototype = r16.prototype;
Object.defineProperty(prototype, "componentDidMount", {
value: function componentDidMount() {
this.listener.attach(c28665_1);
},
writable: true,
configurable: true
});
Object.defineProperty(prototype, "componentWillUnmount", {
value: function componentWillUnmount() {
this.listener.detach();
this.memoizedGetStateFromStores.clear();
},
writable: true,
configurable: true
});
Object.defineProperty(prototype, "render", {
value: function render() {
const props = this.props;
const { forwardedConnectStoresRef, childProps } = props;
return <Component2 ref={forwardedConnectStoresRef} {...childProps} {...this.memoizedGetStateFromStores(childProps)} />;
},
writable: true,
configurable: true
});
c28665_3 = r16;
r16.displayName = displayName2;
c28665_2 = r16;
const r25 = forwardRef((a0, a1) => (0, jsx)(c28665_2, {
childProps: a0,
forwardedConnectStoresRef: a1
}));
r25.displayName = `ForwardRef(${displayName2})`;
return r25;
};
} else {
let c12420_0 = a0;
let c12420_1 = a1;
r7 = (a0) => {
let c28666_2;
let displayName = a0.displayName;
if (displayName == null) {
displayName = a0.name;
}
if (displayName == null) {
displayName = "<Unknown>";
}
const displayName2 = `FluxContainer(${displayName})`;
let c28666_1 = displayName2;
const r14 = $deriveClass(function FluxContainer() {
let env31160;
const prototypeOf = Object.getPrototypeOf(c28666_2);
const r2 = new.target;
const r13 = HermesBuiltin.applyArguments(prototypeOf, Object.create(r2.prototype), r2);
const r4 = env572;
let c31159_0 = r13;
const r6 = env31160 = {
$parent: r4
};
env31160[0] = c12420_1;
const memoizedGetStateFromStores = $mk66826(r6);
env31160[1] = null;
env31160[2] = null;
memoizedGetStateFromStores.getCachedResult = $mk66825(r6);
memoizedGetStateFromStores.clear = $mk66827(r6);
r13.memoizedGetStateFromStores = memoizedGetStateFromStores;
r13.listener = new BatchedStoreListener(c12420_0, () => {
const cachedResult = c31159_0.memoizedGetStateFromStores.getCachedResult(c31159_0.props);
let r8 = cachedResult != null;
if (r8) {
c31159_0.memoizedGetStateFromStores.clear();
r8 = shallowEqual(c31159_0.memoizedGetStateFromStores(c31159_0.props), cachedResult);
}
if (!r8) {
c31159_0.forceUpdate();
}
});
return r13;
}, Component);
const prototype = r14.prototype;
Object.defineProperty(prototype, "componentDidMount", {
value: function componentDidMount() {
this.listener.attach(c28666_1);
},
writable: true,
configurable: true
});
Object.defineProperty(prototype, "componentWillUnmount", {
value: function componentWillUnmount() {
this.listener.detach();
this.memoizedGetStateFromStores.clear();
},
writable: true,
configurable: true
});
Object.defineProperty(prototype, "render", {
value: function render() {
return <a0 {...this.props} {...this.memoizedGetStateFromStores(this.props)} />;
},
writable: true,
configurable: true
});
c28666_2 = r14;
r14.displayName = displayName2;
return r14;
};
}
return r7;
};