decord/alpha/source/utils/ContextUtils.tsx

84 lines
2.3 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7148
// Function ID: 7149
// Name: ContextUtils
2026-10-03 08:58:59 +00:00
// Dependencies: [19, 21, 558, 576, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-10-12 06:59:38 +00:00
// Module 7148 (ContextUtils)
2026-10-03 08:58:59 +00:00
import Fragment from "Fragment" /* 21 */;
import react from "react" /* 19 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-08 09:57:35 +00:00
let dependencyMap, value;
2026-10-03 08:58:59 +00:00
const jsx = Fragment.jsx;
const result = size.fileFinishedImporting("utils/ContextUtils.tsx");
2026-07-20 16:05:17 +00:00
export default function createDefinedContext() {
2026-10-03 08:58:59 +00:00
let closure_1;
let context = react.createContext(undefined);
let tmp2 = context;
let tmp3 = dependencyMap;
let obj = context(558);
2026-10-08 09:57:35 +00:00
const tmp4 = obj.isReactCompilerEnabled() ? (function useContext() {
let context;
2026-10-03 08:58:59 +00:00
context = react.useContext(context);
if (null == context) {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Context was used outside of defined provider.");
throw error;
} else {
return context;
}
2026-10-08 09:57:35 +00:00
}) : (function useContext() {
let context;
2026-10-03 08:58:59 +00:00
context = react.useContext(context);
if (null == context) {
const _Error = Error;
const self = this;
const self2 = this;
const error = new Error("Context was used outside of defined provider.");
throw error;
} else {
return context;
}
});
dependencyMap = tmp4;
const items = [context, tmp4, ];
const tmp2Result = tmp2(558);
2026-10-08 09:57:35 +00:00
items[2] = tmp2Result.isReactCompilerEnabled() ? (function useForwardedContext() {
2026-10-03 08:58:59 +00:00
let tmp3;
const obj = context(closure_1[3]);
const cResult = obj.c(2);
const tmp2 = closure_1();
2026-10-08 09:57:35 +00:00
value = tmp2;
2026-10-03 08:58:59 +00:00
if (cResult[0] !== tmp2) {
2026-10-08 09:57:35 +00:00
class ForwardedContext {
constructor(arg0) {
obj = { value: closure_0, children: arg0.children };
return jsx(closure_0.Provider, obj);
}
}
2026-10-03 08:58:59 +00:00
cResult[0] = tmp2;
2026-10-08 09:57:35 +00:00
cResult[1] = ForwardedContext;
tmp3 = ForwardedContext;
2026-10-03 08:58:59 +00:00
} else {
2026-10-08 09:57:35 +00:00
class ForwardedContext {
constructor(arg0) {
obj = { value: closure_0, children: arg0.children };
return jsx(closure_0.Provider, obj);
}
}
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp3;
2026-10-08 09:57:35 +00:00
}) : (function useForwardedContext() {
value = closure_1();
return function ForwardedContext(children) {
return <context.Provider value={value}>{arg0.children}</context.Provider>;
};
2026-10-03 08:58:59 +00:00
});
2026-07-20 16:05:17 +00:00
return items;
};