import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useEditContext } from "../client/editContext";
import { cn } from "../../lib/utils";
import { ChevronLeft, ChevronRight } from "lucide-react";
export function NavButtons() {
    const editContext = useEditContext();
    if (!editContext)
        return;
    const item = editContext.item;
    if (!item)
        return;
    const history = editContext.browseHistory;
    const currentIndex = history.findIndex((x) => x.id === item.id && x.language === item.language);
    return (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(currentIndex < history.length - 1 ? "text-gray-200" : "text-gray-400", "flex cursor-pointer gap-2 rounded-md p-2 hover:bg-gray-500"), onClick: () => {
                    const currentIndex = history.findIndex((x) => x.id === item.id && x.language === item.language);
                    if (currentIndex < history.length - 1) {
                        const historyItem = history[currentIndex + 1];
                        if (!historyItem)
                            return;
                        editContext.loadItem({
                            id: historyItem.id,
                            language: historyItem.language,
                            version: historyItem.version || 0,
                        }, { addToBrowseHistory: false });
                    }
                }, children: _jsx(ChevronLeft, { className: "h-4 w-4" }) }, "nav-fwd"), _jsx("div", { className: cn(currentIndex > 0 ? "text-gray-200" : "text-gray-400", "flex cursor-pointer gap-2 rounded-md p-2 hover:bg-gray-500"), onClick: () => {
                    const currentIndex = history.findIndex((x) => x.id === item.id && x.language === item.language);
                    if (currentIndex > 0) {
                        const historyItem = history[currentIndex - 1];
                        if (!historyItem)
                            return;
                        editContext.loadItem({
                            id: historyItem.id,
                            language: historyItem.language,
                            version: historyItem.version || 0,
                        }, { addToBrowseHistory: false });
                    }
                }, children: _jsx(ChevronRight, { className: "h-4 w-4" }) }, "nav-back")] }));
}
//# sourceMappingURL=NavButtons.js.map