import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2007-2025 GoodData Corporation
import { isDataTooLargeToCompute, isDataTooLargeToDisplay, isNoDataSdkError, isProtectedReport, isResultCacheMissingSdkError, } from "@gooddata/sdk-ui";
import { DataTooLargeError } from "./DataTooLargeError.js";
import { ExecuteProtectedError } from "./ExecuteProtectedError.js";
import { NoDataError } from "./NoDataError.js";
import { OtherError } from "./OtherError.js";
import { ResultCacheMissingError } from "./ResultCacheMissingError.js";
import { shouldRenderFullContent } from "./sizingUtils.js";
export function CustomError({ error, height, width, forceFullContent }) {
    const fullContent = forceFullContent || shouldRenderFullContent(height, width);
    if (isProtectedReport(error)) {
        return _jsx(ExecuteProtectedError, { fullContent: fullContent });
    }
    else if (isDataTooLargeToDisplay(error) || isDataTooLargeToCompute(error)) {
        return _jsx(DataTooLargeError, { fullContent: fullContent });
    }
    else if (isNoDataSdkError(error)) {
        return _jsx(NoDataError, { fullContent: fullContent });
    }
    else if (isResultCacheMissingSdkError(error)) {
        return _jsx(ResultCacheMissingError, { fullContent: fullContent });
    }
    else if (error) {
        return _jsx(OtherError, { fullContent: fullContent });
    }
    return null;
}
