// Copyright 2025 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.
import { profileEnd, profileStart } from '../../debug/utils.js';
import { LifecycleConstant } from '../../lifecycleConstant.js';
import { __root } from '../../root.js';
let isJSReady;
let jsReadyEventIdSwap;
function jsReady() {
    isJSReady = true;
    if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
        profileStart('ReactLynx::transferRoot');
        profileStart('ReactLynx::serializeRoot');
    }
    const root = JSON.stringify(__root);
    if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
        profileEnd();
    }
    __OnLifecycleEvent([
        LifecycleConstant.firstScreen, /* FIRST_SCREEN */
        {
            root,
            jsReadyEventIdSwap,
        },
    ]);
    if (typeof __PROFILE__ !== 'undefined' && __PROFILE__) {
        profileEnd();
    }
    jsReadyEventIdSwap = {};
}
function clearJSReadyEventIdSwap() {
    jsReadyEventIdSwap = {};
}
function resetJSReady() {
    isJSReady = false;
    jsReadyEventIdSwap = {};
}
/**
 * @internal
 */
export { jsReady, isJSReady, jsReadyEventIdSwap, clearJSReadyEventIdSwap, resetJSReady };
//# sourceMappingURL=jsReady.js.map