import { cn } from "./index3.js";
import { cva } from "class-variance-authority";
import { ChevronDown, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, MoreHorizontal } from "lucide-react";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
//#region src/components/molecules/navigation/Pagination/Pagination.tsx
var sizeMap = {
	xs: {
		h: "h-[26px]",
		sq: "size-[26px]",
		px: "px-2",
		pxNav: "px-2",
		gap: "gap-1.5",
		text: "text-xs",
		icon: "size-4"
	},
	sm: {
		h: "h-8",
		sq: "size-8",
		px: "px-3",
		pxNav: "px-3",
		gap: "gap-1.5",
		text: "text-sm",
		icon: "size-4"
	},
	md: {
		h: "h-9",
		sq: "size-9",
		px: "px-3.5",
		pxNav: "px-4",
		gap: "gap-2",
		text: "text-sm",
		icon: "size-4"
	},
	lg: {
		h: "h-10",
		sq: "size-10",
		px: "px-4",
		pxNav: "px-6",
		gap: "gap-2",
		text: "text-sm",
		icon: "size-4"
	}
};
var activeColorMap = {
	primary: "bg-primary text-primary-foreground",
	info: "bg-info text-info-foreground",
	warning: "bg-warning text-warning-foreground",
	success: "bg-success text-success-foreground",
	destructive: "bg-destructive text-destructive-foreground"
};
var variantClasses = (v) => v === "outlined" ? "border border-border bg-background/60 backdrop-blur-sm text-secondary-foreground hover:bg-muted" : "text-secondary-foreground hover:bg-muted";
var shapeRadius = (shape) => shape === "rounded" ? "rounded-full" : "rounded-xl";
var iconNavIcons = {
	previous: ChevronLeft,
	next: ChevronRight,
	first: ChevronsLeft,
	last: ChevronsRight
};
var iconNavLabels = {
	previous: "Go to previous page",
	next: "Go to next page",
	first: "Go to first page",
	last: "Go to last page"
};
var paginationDotsVariants = cva("flex items-center justify-center", {
	variants: {
		size: {
			md: "",
			lg: ""
		},
		style: {
			dot: "",
			line: ""
		},
		framed: {
			true: "rounded-full bg-card dark:bg-muted",
			false: ""
		}
	},
	compoundVariants: [
		{
			size: "md",
			style: "dot",
			framed: true,
			className: "gap-3 p-2"
		},
		{
			size: "md",
			style: "line",
			framed: true,
			className: "w-40 gap-2 p-2"
		},
		{
			size: "lg",
			style: "dot",
			framed: true,
			className: "gap-4 p-3"
		},
		{
			size: "lg",
			style: "line",
			framed: true,
			className: "w-44 gap-3 p-3"
		},
		{
			size: "md",
			style: "dot",
			framed: false,
			className: "gap-3"
		},
		{
			size: "md",
			style: "line",
			framed: false,
			className: "w-36 gap-2"
		},
		{
			size: "lg",
			style: "dot",
			framed: false,
			className: "gap-4"
		},
		{
			size: "lg",
			style: "line",
			framed: false,
			className: "w-38 gap-3"
		}
	],
	defaultVariants: {
		size: "md",
		style: "dot",
		framed: false
	}
});
var paginationDotIndicatorVariants = cva("shrink-0 rounded-full", {
	variants: {
		size: {
			md: "",
			lg: ""
		},
		style: {
			dot: "",
			line: "min-h-px min-w-px grow basis-0"
		},
		current: {
			true: "bg-primary/10 dark:bg-primary",
			false: "bg-surface-2 dark:bg-muted"
		}
	},
	compoundVariants: [
		{
			size: "md",
			style: "dot",
			className: "size-2"
		},
		{
			size: "lg",
			style: "dot",
			className: "size-2.5"
		},
		{
			size: "md",
			style: "line",
			className: "h-1.5"
		},
		{
			size: "lg",
			style: "line",
			className: "h-2"
		}
	],
	defaultVariants: {
		size: "md",
		style: "dot",
		current: false
	}
});
function PaginationDots({ className, total = 3, current = 0, variant = "dot", size = "md", framed = false, onDotClick, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		className: cn(paginationDotsVariants({
			size,
			style: variant,
			framed
		}), className),
		role: "tablist",
		"aria-label": "Pagination dots",
		...props,
		children: Array.from({ length: total }, (_, index) => /* @__PURE__ */ jsx("button", {
			type: "button",
			role: "tab",
			"aria-selected": index === current,
			"aria-label": `Go to page ${index + 1}`,
			onClick: () => onDotClick?.(index),
			className: cn(paginationDotIndicatorVariants({
				size,
				style: variant,
				current: index === current
			}), onDotClick && "cursor-pointer transition-colors duration-200 ease-smooth motion-reduce:transition-none", !onDotClick && "cursor-default")
		}, index))
	});
}
PaginationDots.displayName = "PaginationDots";
function generatePageNumbers(currentPage, totalPages, siblingCount) {
	if (totalPages <= siblingCount * 2 + 5) return Array.from({ length: totalPages }, (_, i) => i + 1);
	const leftSiblingIndex = Math.max(currentPage - siblingCount, 1);
	const rightSiblingIndex = Math.min(currentPage + siblingCount, totalPages);
	const shouldShowLeftEllipsis = leftSiblingIndex > 2;
	const shouldShowRightEllipsis = rightSiblingIndex < totalPages - 1;
	if (!shouldShowLeftEllipsis && shouldShowRightEllipsis) {
		const leftItemCount = 3 + 2 * siblingCount;
		return [
			...Array.from({ length: leftItemCount }, (_, i) => i + 1),
			"ellipsis",
			totalPages
		];
	}
	if (shouldShowLeftEllipsis && !shouldShowRightEllipsis) {
		const rightItemCount = 3 + 2 * siblingCount;
		return [
			1,
			"ellipsis",
			...Array.from({ length: rightItemCount }, (_, i) => totalPages - rightItemCount + i + 1)
		];
	}
	return [
		1,
		"ellipsis",
		...Array.from({ length: rightSiblingIndex - leftSiblingIndex + 1 }, (_, i) => leftSiblingIndex + i),
		"ellipsis",
		totalPages
	];
}
var btnBase = "inline-flex items-center justify-center font-medium shrink-0 select-none outline-none transition-[color,background-color,border-color,box-shadow] duration-150 ease-out focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50";
function PageButton({ page, isActive, size, variant, shape, activeColor, onClick }) {
	const s = sizeMap[size];
	return /* @__PURE__ */ jsx("button", {
		type: "button",
		onClick,
		"aria-current": isActive ? "page" : void 0,
		className: cn(btnBase, s.sq, s.text, shapeRadius(shape), isActive ? activeColorMap[activeColor] : variantClasses(variant)),
		children: page
	});
}
PageButton.displayName = "PageButton";
function EllipsisIndicator({ size, shape }) {
	const s = sizeMap[size];
	return /* @__PURE__ */ jsx("span", {
		"aria-hidden": true,
		className: cn("inline-flex items-center justify-center text-muted-foreground shrink-0", s.sq, shapeRadius(shape)),
		children: /* @__PURE__ */ jsx(MoreHorizontal, { className: s.icon })
	});
}
EllipsisIndicator.displayName = "EllipsisIndicator";
function NavButton({ direction, disabled, size, variant, prevNextStyle, text, onClick }) {
	const s = sizeMap[size];
	const isIconOnly = prevNextStyle === "icon-only";
	const Icon = direction === "previous" ? ChevronLeft : ChevronRight;
	return /* @__PURE__ */ jsxs("button", {
		type: "button",
		onClick,
		disabled,
		"aria-label": direction === "previous" ? "Go to previous page" : "Go to next page",
		className: cn(btnBase, "rounded-xl", isIconOnly ? s.sq : [
			s.h,
			s.pxNav,
			s.gap
		], s.text, variantClasses(variant)),
		children: [
			direction === "previous" && /* @__PURE__ */ jsx(Icon, { className: cn(s.icon, "rtl:rotate-180") }),
			!isIconOnly && /* @__PURE__ */ jsx("span", { children: text }),
			direction === "next" && /* @__PURE__ */ jsx(Icon, { className: cn(s.icon, "rtl:rotate-180") })
		]
	});
}
NavButton.displayName = "NavButton";
function IconNavButton({ direction, disabled, size, onClick, className: extraClassName }) {
	const s = sizeMap[size];
	const Icon = iconNavIcons[direction];
	return /* @__PURE__ */ jsx("button", {
		type: "button",
		onClick,
		disabled,
		"aria-label": iconNavLabels[direction],
		className: cn(btnBase, "rounded-xl text-secondary-foreground hover:bg-muted", s.sq, extraClassName),
		children: /* @__PURE__ */ jsx(Icon, { className: cn(s.icon, "rtl:rotate-180") })
	});
}
IconNavButton.displayName = "IconNavButton";
function PageInfo({ currentPage, totalPages, size }) {
	const s = sizeMap[size];
	return /* @__PURE__ */ jsxs("span", {
		className: cn("text-muted-foreground whitespace-nowrap", s.text),
		children: [
			"Page ",
			/* @__PURE__ */ jsx("span", {
				className: "text-foreground",
				children: currentPage
			}),
			" of",
			" ",
			/* @__PURE__ */ jsx("span", {
				className: "text-foreground",
				children: totalPages
			})
		]
	});
}
PageInfo.displayName = "PageInfo";
function PageNumberButtons({ currentPage, totalPages, siblingCount, size, variant, shape, activeColor, onPageChange }) {
	return /* @__PURE__ */ jsx(Fragment, { children: generatePageNumbers(currentPage, totalPages, siblingCount).map((page, index) => page === "ellipsis" ? /* @__PURE__ */ jsx(EllipsisIndicator, {
		size,
		shape
	}, `ellipsis-${index}`) : /* @__PURE__ */ jsx(PageButton, {
		page,
		isActive: page === currentPage,
		size,
		variant,
		shape,
		activeColor,
		onClick: () => onPageChange(page)
	}, page)) });
}
function DefaultPagination({ currentPage, totalPages, siblingCount, size, variant, shape, prevNextStyle, activeColor, previousText, nextText, onPageChange, showPageNumbers }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-1",
		children: [
			/* @__PURE__ */ jsx(NavButton, {
				direction: "previous",
				disabled: currentPage <= 1,
				size,
				variant,
				prevNextStyle,
				text: previousText,
				onClick: () => onPageChange(currentPage - 1)
			}),
			showPageNumbers && /* @__PURE__ */ jsx(PageNumberButtons, {
				currentPage,
				totalPages,
				siblingCount,
				size,
				variant,
				shape,
				activeColor,
				onPageChange
			}),
			/* @__PURE__ */ jsx(NavButton, {
				direction: "next",
				disabled: currentPage >= totalPages,
				size,
				variant,
				prevNextStyle,
				text: nextText,
				onClick: () => onPageChange(currentPage + 1)
			})
		]
	});
}
function PreviousNextPagination({ currentPage, totalPages, size, variant, previousText, nextText, onPageChange }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex w-full items-center justify-between",
		children: [/* @__PURE__ */ jsx(NavButton, {
			direction: "previous",
			disabled: currentPage <= 1,
			size,
			variant,
			prevNextStyle: "icon-text",
			text: previousText,
			onClick: () => onPageChange(currentPage - 1)
		}), /* @__PURE__ */ jsx(NavButton, {
			direction: "next",
			disabled: currentPage >= totalPages,
			size,
			variant,
			prevNextStyle: "icon-text",
			text: nextText,
			onClick: () => onPageChange(currentPage + 1)
		})]
	});
}
function WithButtonsPagination({ currentPage, totalPages, siblingCount, size, shape, activeColor, previousText, nextText, onPageChange, showPageNumbers }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-start gap-1.5",
		children: [
			/* @__PURE__ */ jsx(NavButton, {
				direction: "previous",
				disabled: currentPage <= 1,
				size,
				variant: "outlined",
				prevNextStyle: "icon-text",
				text: previousText,
				onClick: () => onPageChange(currentPage - 1)
			}),
			showPageNumbers && /* @__PURE__ */ jsx(PageNumberButtons, {
				currentPage,
				totalPages,
				siblingCount,
				size,
				variant: "outlined",
				shape,
				activeColor,
				onPageChange
			}),
			/* @__PURE__ */ jsx(NavButton, {
				direction: "next",
				disabled: currentPage >= totalPages,
				size,
				variant: "outlined",
				prevNextStyle: "icon-text",
				text: nextText,
				onClick: () => onPageChange(currentPage + 1)
			})
		]
	});
}
function CombinePagination({ currentPage, totalPages, siblingCount, size, onPageChange }) {
	const pages = generatePageNumbers(currentPage, totalPages, siblingCount);
	const s = sizeMap[size];
	const cellBase = cn(btnBase, "border-y border-l border-input", s.sq, s.text);
	return /* @__PURE__ */ jsxs("div", {
		className: "inline-flex items-start",
		children: [
			/* @__PURE__ */ jsx("button", {
				type: "button",
				onClick: () => onPageChange(currentPage - 1),
				disabled: currentPage <= 1,
				"aria-label": "Go to previous page",
				className: cn(cellBase, "rounded-l-lg text-secondary-foreground hover:bg-muted"),
				children: /* @__PURE__ */ jsx(ChevronLeft, { className: cn(s.icon, "rtl:rotate-180") })
			}),
			pages.map((page, index) => /* @__PURE__ */ jsx("button", {
				type: "button",
				onClick: () => page !== "ellipsis" && onPageChange(page),
				disabled: page === "ellipsis",
				"aria-current": page === currentPage ? "page" : void 0,
				"aria-label": page === "ellipsis" ? "More pages" : `Go to page ${page}`,
				className: cn(cellBase, page === currentPage ? "bg-accent text-accent-foreground" : "text-foreground hover:bg-muted", page === "ellipsis" && "pointer-events-none"),
				children: page === "ellipsis" ? /* @__PURE__ */ jsx(MoreHorizontal, { className: s.icon }) : page
			}, page === "ellipsis" ? `ellipsis-${index}` : page)),
			/* @__PURE__ */ jsx("button", {
				type: "button",
				onClick: () => onPageChange(currentPage + 1),
				disabled: currentPage >= totalPages,
				"aria-label": "Go to next page",
				className: cn(cellBase, "rounded-r-lg border-r text-secondary-foreground hover:bg-muted"),
				children: /* @__PURE__ */ jsx(ChevronRight, { className: cn(s.icon, "rtl:rotate-180") })
			})
		]
	});
}
function CombineStepsPagination({ currentPage, totalPages, size, onPageChange }) {
	const s = sizeMap[size];
	const cellBase = cn(btnBase, "border-y border-l border-border", s.sq);
	return /* @__PURE__ */ jsxs("div", {
		className: "inline-flex items-start",
		children: [
			/* @__PURE__ */ jsx("button", {
				type: "button",
				onClick: () => onPageChange(currentPage - 1),
				disabled: currentPage <= 1,
				"aria-label": "Go to previous page",
				className: cn(cellBase, "rounded-l-md text-secondary-foreground hover:bg-muted"),
				children: /* @__PURE__ */ jsx(ChevronLeft, { className: cn(s.icon, "rtl:rotate-180") })
			}),
			/* @__PURE__ */ jsxs("div", {
				className: cn("inline-flex items-center justify-center border-y border-l border-input", s.h, "px-4", s.text, "font-medium text-foreground"),
				children: [/* @__PURE__ */ jsx("span", { children: currentPage }), /* @__PURE__ */ jsxs("span", {
					className: "text-muted-foreground",
					children: ["/", totalPages]
				})]
			}),
			/* @__PURE__ */ jsx("button", {
				type: "button",
				onClick: () => onPageChange(currentPage + 1),
				disabled: currentPage >= totalPages,
				"aria-label": "Go to next page",
				className: cn(cellBase, "rounded-r-md border-r text-secondary-foreground hover:bg-muted"),
				children: /* @__PURE__ */ jsx(ChevronRight, { className: cn(s.icon, "rtl:rotate-180") })
			})
		]
	});
}
function MinimalPagination({ currentPage, totalPages, siblingCount, size, shape, activeColor, onPageChange, showPageNumbers }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-1.5",
		children: [
			/* @__PURE__ */ jsx(IconNavButton, {
				direction: "previous",
				disabled: currentPage <= 1,
				size,
				onClick: () => onPageChange(currentPage - 1)
			}),
			showPageNumbers && /* @__PURE__ */ jsx(PageNumberButtons, {
				currentPage,
				totalPages,
				siblingCount,
				size,
				variant: "default",
				shape,
				activeColor,
				onPageChange
			}),
			/* @__PURE__ */ jsx(IconNavButton, {
				direction: "next",
				disabled: currentPage >= totalPages,
				size,
				onClick: () => onPageChange(currentPage + 1)
			})
		]
	});
}
function FirstLastPagination({ currentPage, totalPages, siblingCount, size, shape, activeColor, onPageChange, showPageNumbers }) {
	const s = sizeMap[size];
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-1.5",
		children: [
			/* @__PURE__ */ jsxs("button", {
				type: "button",
				onClick: () => onPageChange(1),
				disabled: currentPage <= 1,
				className: cn(btnBase, "rounded-md text-secondary-foreground hover:bg-muted", s.h, s.pxNav, s.gap, s.text),
				children: [/* @__PURE__ */ jsx(ChevronsLeft, { className: cn(s.icon, "rtl:rotate-180") }), /* @__PURE__ */ jsx("span", { children: "First" })]
			}),
			/* @__PURE__ */ jsx(IconNavButton, {
				direction: "previous",
				disabled: currentPage <= 1,
				size,
				onClick: () => onPageChange(currentPage - 1)
			}),
			showPageNumbers && /* @__PURE__ */ jsx(PageNumberButtons, {
				currentPage,
				totalPages,
				siblingCount,
				size,
				variant: "default",
				shape,
				activeColor,
				onPageChange
			}),
			/* @__PURE__ */ jsx(IconNavButton, {
				direction: "next",
				disabled: currentPage >= totalPages,
				size,
				onClick: () => onPageChange(currentPage + 1)
			}),
			/* @__PURE__ */ jsxs("button", {
				type: "button",
				onClick: () => onPageChange(totalPages),
				disabled: currentPage >= totalPages,
				className: cn(btnBase, "rounded-md text-secondary-foreground hover:bg-muted", s.h, s.pxNav, s.gap, s.text),
				children: [/* @__PURE__ */ jsx("span", { children: "Last" }), /* @__PURE__ */ jsx(ChevronsRight, { className: cn(s.icon, "rtl:rotate-180") })]
			})
		]
	});
}
function PageNumberPagination({ currentPage, totalPages, siblingCount, size, shape, activeColor, previousText, nextText, onPageChange, showPageNumbers }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex w-full items-center justify-between",
		children: [/* @__PURE__ */ jsx(PageInfo, {
			currentPage,
			totalPages,
			size
		}), /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-1",
			children: [
				/* @__PURE__ */ jsx(NavButton, {
					direction: "previous",
					disabled: currentPage <= 1,
					size,
					variant: "default",
					prevNextStyle: "icon-text",
					text: previousText,
					onClick: () => onPageChange(currentPage - 1)
				}),
				showPageNumbers && /* @__PURE__ */ jsx(PageNumberButtons, {
					currentPage,
					totalPages,
					siblingCount,
					size,
					variant: "default",
					shape,
					activeColor,
					onPageChange
				}),
				/* @__PURE__ */ jsx(NavButton, {
					direction: "next",
					disabled: currentPage >= totalPages,
					size,
					variant: "default",
					prevNextStyle: "icon-text",
					text: nextText,
					onClick: () => onPageChange(currentPage + 1)
				})
			]
		})]
	});
}
function LeftRightChevronPagination({ currentPage, totalPages, size, onPageChange }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-1",
		children: [
			/* @__PURE__ */ jsx(IconNavButton, {
				direction: "previous",
				disabled: currentPage <= 1,
				size,
				onClick: () => onPageChange(currentPage - 1)
			}),
			/* @__PURE__ */ jsx(PageInfo, {
				currentPage,
				totalPages,
				size
			}),
			/* @__PURE__ */ jsx(IconNavButton, {
				direction: "next",
				disabled: currentPage >= totalPages,
				size,
				onClick: () => onPageChange(currentPage + 1)
			})
		]
	});
}
function PageDropdownPagination({ currentPage, totalPages, siblingCount, size, shape, activeColor, previousText, onPageChange, showPageNumbers, itemsPerPage, perPageOptions, onPerPageChange }) {
	const s = sizeMap[size];
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-1.5",
		children: [
			/* @__PURE__ */ jsx(PageInfo, {
				currentPage,
				totalPages,
				size
			}),
			/* @__PURE__ */ jsx(NavButton, {
				direction: "previous",
				disabled: currentPage <= 1,
				size,
				variant: "default",
				prevNextStyle: "icon-text",
				text: previousText,
				onClick: () => onPageChange(currentPage - 1)
			}),
			showPageNumbers && /* @__PURE__ */ jsx(PageNumberButtons, {
				currentPage,
				totalPages,
				siblingCount,
				size,
				variant: "default",
				shape,
				activeColor,
				onPageChange
			}),
			onPerPageChange && /* @__PURE__ */ jsxs("div", {
				className: cn("relative inline-flex items-center justify-center rounded-md border border-border font-medium", s.h, "px-4", s.gap, s.text, "text-foreground"),
				children: [
					/* @__PURE__ */ jsx("select", {
						value: itemsPerPage,
						onChange: (e) => onPerPageChange(Number(e.target.value)),
						className: "absolute inset-0 cursor-pointer opacity-0",
						"aria-label": "Items per page",
						children: (perPageOptions ?? [
							10,
							20,
							50
						]).map((opt) => /* @__PURE__ */ jsxs("option", {
							value: opt,
							children: [opt, "/page"]
						}, opt))
					}),
					/* @__PURE__ */ jsxs("span", { children: [itemsPerPage ?? 10, "/page"] }),
					/* @__PURE__ */ jsx(ChevronDown, { className: s.icon })
				]
			})
		]
	});
}
function PageDropdownNavPagination({ currentPage, totalPages, size, onPageChange }) {
	const s = sizeMap[size];
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-1",
		children: [
			/* @__PURE__ */ jsx(IconNavButton, {
				direction: "previous",
				disabled: currentPage <= 1,
				size,
				onClick: () => onPageChange(currentPage - 1)
			}),
			/* @__PURE__ */ jsxs("div", {
				className: cn("relative inline-flex items-center justify-center rounded-xl border border-border font-medium", s.h, "px-4", s.gap, s.text, "text-foreground"),
				children: [
					/* @__PURE__ */ jsx("select", {
						value: currentPage,
						onChange: (e) => onPageChange(Number(e.target.value)),
						className: "absolute inset-0 cursor-pointer opacity-0",
						"aria-label": "Select page",
						children: Array.from({ length: totalPages }, (_, i) => /* @__PURE__ */ jsxs("option", {
							value: i + 1,
							children: ["Page ", i + 1]
						}, i + 1))
					}),
					/* @__PURE__ */ jsxs("span", { children: ["Page ", currentPage] }),
					/* @__PURE__ */ jsx(ChevronDown, { className: s.icon })
				]
			}),
			/* @__PURE__ */ jsx(IconNavButton, {
				direction: "next",
				disabled: currentPage >= totalPages,
				size,
				onClick: () => onPageChange(currentPage + 1)
			})
		]
	});
}
function WithUnderlinePagination({ currentPage, totalPages, siblingCount, size, onPageChange }) {
	const pages = generatePageNumbers(currentPage, totalPages, siblingCount);
	const s = sizeMap[size];
	return /* @__PURE__ */ jsx("div", {
		className: "flex items-start gap-1",
		children: pages.map((page, index) => page === "ellipsis" ? /* @__PURE__ */ jsx(EllipsisIndicator, {
			size,
			shape: "square"
		}, `ellipsis-${index}`) : /* @__PURE__ */ jsx("button", {
			type: "button",
			onClick: () => onPageChange(page),
			"aria-current": page === currentPage ? "page" : void 0,
			className: cn(btnBase, s.sq, s.text, page === currentPage ? "border-b-2 border-foreground text-foreground" : "text-foreground hover:bg-muted"),
			children: page
		}, page))
	});
}
function OutlinePagination({ currentPage, totalPages, size, previousText, nextText, onPageChange }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-1",
		children: [/* @__PURE__ */ jsx(NavButton, {
			direction: "previous",
			disabled: currentPage <= 1,
			size,
			variant: "outlined",
			prevNextStyle: "icon-text",
			text: previousText,
			onClick: () => onPageChange(currentPage - 1)
		}), /* @__PURE__ */ jsx(NavButton, {
			direction: "next",
			disabled: currentPage >= totalPages,
			size,
			variant: "outlined",
			prevNextStyle: "icon-text",
			text: nextText,
			onClick: () => onPageChange(currentPage + 1)
		})]
	});
}
function BoxStylePagination({ currentPage, totalPages, size, previousText, nextText, onPageChange }) {
	const s = sizeMap[size];
	return /* @__PURE__ */ jsxs("div", {
		className: "inline-flex items-center",
		children: [/* @__PURE__ */ jsx("button", {
			type: "button",
			onClick: () => onPageChange(currentPage - 1),
			disabled: currentPage <= 1,
			className: cn(btnBase, "rounded-l-md border border-border bg-background text-foreground hover:bg-muted", s.h, s.pxNav, s.gap, s.text),
			children: previousText
		}), /* @__PURE__ */ jsx("button", {
			type: "button",
			onClick: () => onPageChange(currentPage + 1),
			disabled: currentPage >= totalPages,
			className: cn(btnBase, "rounded-r-md border border-l-0 border-border bg-primary/10 text-foreground hover:bg-muted", s.h, s.pxNav, s.gap, s.text),
			children: nextText
		})]
	});
}
function resolveLegacyProps(type) {
	switch (type) {
		case "page-default": return {
			resolvedType: "default",
			card: false
		};
		case "page-minimal": return {
			resolvedType: "outline",
			card: false,
			overrideVariant: "outlined"
		};
		case "card-default": return {
			resolvedType: "default",
			card: true,
			overrideVariant: "outlined"
		};
		case "card-minimal": return {
			resolvedType: "page-number",
			card: true
		};
		case "card-button-group": return {
			resolvedType: "combine",
			card: false
		};
		default: return {
			resolvedType: type,
			card: false
		};
	}
}
var typeComponents = {
	default: DefaultPagination,
	"previous-next": PreviousNextPagination,
	"with-buttons": WithButtonsPagination,
	combine: CombinePagination,
	"combine-steps": CombineStepsPagination,
	minimal: MinimalPagination,
	"first-last": FirstLastPagination,
	"page-number": PageNumberPagination,
	"left-right-chevron": LeftRightChevronPagination,
	"page-dropdown": PageDropdownPagination,
	"page-dropdown-nav": PageDropdownNavPagination,
	"with-underline": WithUnderlinePagination,
	outline: OutlinePagination,
	"box-style": BoxStylePagination
};
function Pagination({ className, type = "default", size = "md", variant = "default", shape = "square", prevNextStyle = "icon-text", currentPage = 1, totalPages = 10, siblingCount = 1, onPageChange, showPageNumbers = true, previousText = "Previous", nextText = "Next", itemsPerPage, perPageOptions, onPerPageChange, activeColor = "primary", ...props }) {
	const { resolvedType, card, overrideVariant } = resolveLegacyProps(type);
	const finalVariant = overrideVariant ?? variant;
	const finalShape = shape === "circle" ? "rounded" : shape;
	const handlePageChange = (page) => {
		if (page >= 1 && page <= totalPages && onPageChange) onPageChange(page);
	};
	const typeProps = {
		currentPage,
		totalPages,
		siblingCount,
		size,
		variant: finalVariant,
		shape: finalShape,
		prevNextStyle,
		activeColor,
		previousText,
		nextText,
		onPageChange: handlePageChange,
		showPageNumbers,
		itemsPerPage,
		perPageOptions,
		onPerPageChange
	};
	const TypeComponent = typeComponents[resolvedType] ?? DefaultPagination;
	return /* @__PURE__ */ jsx("nav", {
		"aria-label": "pagination",
		"data-slot": "pagination",
		className: cn("flex w-full", card && "rounded-xl border border-border bg-background p-4 dark:border-border dark:bg-muted", className),
		...props,
		children: /* @__PURE__ */ jsx(TypeComponent, { ...typeProps })
	});
}
Pagination.displayName = "Pagination";
//#endregion
export { Pagination, PaginationDots, paginationDotIndicatorVariants, paginationDotsVariants };

//# sourceMappingURL=index404.js.map