import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import cx from "classnames";
import { useKdaState } from "../providers/KdaState.js";
export function KdaContent({ contentError, leftContent, rightContent, leftLoader, rightLoader, rightError, }) {
    const { state } = useKdaState();
    const loading = state.relevantStatus === "loading" || state.relevantStatus === "pending";
    const leftPanelLoading = loading || state.itemsStatus === "pending" || state.itemsStatus === "loading";
    const rightPanelLoading = loading || state.selectedStatus === "pending" || state.selectedStatus === "loading";
    const fullContentError = state.itemsStatus === "error";
    const rightPanelError = state.selectedStatus === "error";
    return (_jsx("div", { className: cx("gd-kda-dialog-content"), children: fullContentError ? (_jsx("div", { className: cx("gd-kda-dialog-content-full"), children: contentError?.(state.itemsError) })) : (_jsxs(_Fragment, { children: [
                _jsx("div", { className: cx("gd-kda-dialog-content-left-panel"), children: leftPanelLoading ? leftLoader : leftContent }), _jsx("div", { className: cx("gd-kda-dialog-content-divider") }), _jsx("div", { className: cx("gd-kda-dialog-content-right-panel"), children: rightPanelLoading
                        ? rightLoader
                        : rightPanelError
                            ? rightError?.(state.selectedError)
                            : rightContent })
            ] })) }));
}
