import { isMtsEnabled, isRunOnBackgroundEnabled } from './functionality.js';
import { registerBackgroundFunctionCtx } from '../../core/background-function/run-on-background.js';
/**
 * @internal
 */
export function onPostWorkletCtx(afterValue) {
    if (!isMtsEnabled() && afterValue) {
        lynx.reportError(new Error('Main thread script requires Lynx sdk version 2.14'));
        return null;
    }
    if (!afterValue || !isRunOnBackgroundEnabled()) {
        return afterValue;
    }
    registerBackgroundFunctionCtx(afterValue);
    return afterValue;
}
//# sourceMappingURL=ctx.js.map