decord/source/325__isNativeReflectConstruct.js

125 lines
3.6 KiB
JavaScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 325
// Function ID: 326
// Name: _isNativeReflectConstruct
// Dependencies: [41, 42, 93, 95, 96, 98, 19, 38]
// Module 325 (_isNativeReflectConstruct)
2026-08-24 06:08:38 +00:00
import noopAll from "noop" /* 19 */;
import _inheritsDefault from "_inherits" /* 98 */;
import closure_2 from "_classCallCheck" /* 41 */;
import closure_3 from "_possibleConstructorReturn" /* 93 */;
import closure_4 from "_getPrototypeOf" /* 95 */;
import closure_5 from "_get" /* 96 */;
import importDefaultResult from "_createClass" /* 42 */;
2026-07-29 08:29:29 +00:00
const StateSafePureComponent = importDefault;
function _isNativeReflectConstruct() {
try {
const _Boolean = Boolean;
const call = valueOf.call;
const _Reflect = Reflect;
const _Boolean2 = Boolean;
if (typeof call === "unknown") {
let callResult = valueOf();
} else {
callResult = call(constructResult);
}
2026-08-24 06:08:38 +00:00
closure_0 = !callResult;
_isNativeReflectConstruct = function _isNativeReflectConstruct() {
2026-07-29 08:29:29 +00:00
return closure_0;
2026-08-24 06:08:38 +00:00
};
2026-07-29 08:29:29 +00:00
return _isNativeReflectConstruct();
} catch (err) {
}
}
class StateSafePureComponent {
constructor(arg0) {
self = this;
2026-08-24 06:08:38 +00:00
tmp = closure_2(this, StateSafePureComponent);
2026-07-29 08:29:29 +00:00
items = [];
items[0] = global;
2026-08-24 06:08:38 +00:00
tmp2 = closure_4;
obj = closure_4(StateSafePureComponent);
tmp3 = closure_3;
2026-07-29 08:29:29 +00:00
if (_isNativeReflectConstruct()) {
tmp5 = globalThis;
_Reflect = Reflect;
constructResult = Reflect.construct(obj, items, tmp2(self).constructor);
} else {
constructResult = obj.apply(self, items);
}
tmp3Result = tmp3(self, constructResult);
tmp3Result._inAsyncStateUpdate = false;
result = tmp3Result._installSetStateHooks();
return tmp3Result;
}
}
2026-08-24 06:08:38 +00:00
_inheritsDefault(StateSafePureComponent, noopAll.PureComponent);
2026-07-29 08:29:29 +00:00
let items = [
{
key: "setState",
2026-08-04 21:03:28 +00:00
value: function setState(fn) {
2026-07-29 08:29:29 +00:00
let self = this;
let fn2 = this;
2026-08-04 21:03:28 +00:00
self = fn;
if (typeof fn === "function") {
fn = callback3(callback2(self.prototype), "setState", self);
2026-07-29 08:29:29 +00:00
fn2 = fn;
2026-08-04 21:03:28 +00:00
if (typeof fn === "function") {
2026-07-29 08:29:29 +00:00
fn = (items) => fn2.apply(self, items);
}
const items = [
(arg0, arg1) => {
fn2._inAsyncStateUpdate = true;
try {
tmp2._inAsyncStateUpdate = false;
return self(arg0, arg1);
} catch (tmp6) {
tmp._inAsyncStateUpdate = false;
throw tmp6;
}
},
arg1
];
fn(items);
} else {
fn2 = callback3(callback2(self.prototype), "setState", self);
2026-08-04 21:03:28 +00:00
if (typeof fn2 === "function") {
2026-07-29 08:29:29 +00:00
fn2 = (items) => fn2.apply(self, items);
}
2026-08-04 21:03:28 +00:00
const items1 = [fn, arg1];
2026-07-29 08:29:29 +00:00
fn2(items1);
}
}
},
{
key: "_installSetStateHooks",
value: function _installSetStateHooks() {
const self = this;
2026-08-24 06:08:38 +00:00
({ props: dependencyMap, state: closure_2 } = this);
2026-07-29 08:29:29 +00:00
let obj = {
get() {
2026-08-24 06:08:38 +00:00
self(closure_1_1[7])(!self._inAsyncStateUpdate, "\"this.props\" should not be accessed during state updates");
2026-07-29 08:29:29 +00:00
return closure_1;
},
set(arg0) {
2026-08-24 06:08:38 +00:00
closure_1 = arg0;
2026-07-29 08:29:29 +00:00
}
};
Object.defineProperty(this, "props", obj);
obj = {
get() {
2026-08-24 06:08:38 +00:00
self(closure_1_1[7])(!self._inAsyncStateUpdate, "\"this.state\" should not be acceessed during state updates");
return closure_2;
2026-07-29 08:29:29 +00:00
},
set(arg0) {
2026-08-24 06:08:38 +00:00
closure_2 = arg0;
2026-07-29 08:29:29 +00:00
}
};
Object.defineProperty(this, "state", obj);
}
}
];
export default importDefaultResult(StateSafePureComponent, items);