const DEFAULT_PAGE_SIZE = 10;
const getPageBufferSize = (showLessItems)=>showLessItems ? 1 : 2;
const getQuickJumperAutoThreshold = (showLessItems)=>2 * getPageBufferSize(showLessItems) + 3;
const getPaginationPageCount = (pagination)=>{
    if (!pagination) return 0;
    const total = Number(pagination.total);
    const pageSize = Number(pagination.pageSize || pagination.defaultPageSize || DEFAULT_PAGE_SIZE);
    if (!Number.isFinite(total) || total <= 0 || !Number.isFinite(pageSize) || pageSize <= 0) return 0;
    return Math.ceil(total / pageSize);
};
const shouldAutoEnableQuickJumper = (pagination)=>{
    if (!pagination || void 0 !== pagination.showQuickJumper || pagination.simple) return false;
    return getPaginationPageCount(pagination) > getQuickJumperAutoThreshold(pagination.showLessItems);
};
const withAutoQuickJumper = (pagination)=>{
    if (!pagination || false === pagination || !shouldAutoEnableQuickJumper(pagination)) return pagination;
    return {
        ...pagination,
        showQuickJumper: true
    };
};
export { getPaginationPageCount, shouldAutoEnableQuickJumper, withAutoQuickJumper };
