import { jsx as _jsx } from "react/jsx-runtime";
import { useEditContext } from "../client/editContext";
import { EditorSlot } from "./EditorSlot";
import { Splitter } from "../ui/Splitter";
export function EditView() {
    const editContext = useEditContext();
    if (!editContext)
        return null;
    const slots = editContext.editorSlots;
    if (slots.length === 0)
        return (_jsx("div", { className: "grid h-full w-full items-center justify-center", children: _jsx("div", { className: "text-neutral-grey-50 text-xs", children: "No item selected" }) }));
    const panels = slots.map((slot) => ({
        // Use a stable name so persisted sizes don't shift when slots are added/removed.
        name: slot.slotId,
        // Use a reasonable numeric default so new slots don't get ~0px when other panels
        // have large persisted px weights.
        defaultSize: 480,
        className: "h-full",
        content: (_jsx("div", { className: "h-full w-full", children: _jsx(EditorSlot, { slotId: slot.slotId, itemDescriptor: slot.itemDescriptor, name: `slot-${slot.slotId}`, 
                // compareView prop here indicates if this view is part of a compare split panel.
                // The actual compare mode state is stored per-slot in EditorSlotContext.
                compareView: false, className: "h-full w-full", refreshToken: slot.refreshToken }) })),
    }));
    return (_jsx("div", { className: "h-full w-full", children: _jsx(Splitter, { panels: panels, direction: "horizontal", localStorageKey: "editor.editView.slots", splitterClassName: "bg-transparent md:w-[6px]" }) }));
}
//# sourceMappingURL=EditView.js.map