import { createEmptyHistoryState, registerHistory, } from "@lexical/history";
import { createEffect, onCleanup } from "solid-js";
export function useHistory(editor, externalHistoryState, delay) {
    const historyState = () => externalHistoryState() || createEmptyHistoryState();
    createEffect(() => {
        onCleanup(registerHistory(editor, historyState(), (delay && delay()) ?? 1000));
    });
}
