"use client";
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import { Pressable } from '@page-speed/pressable';
import * as React from 'react';
import { Icon } from '@page-speed/icon';
import { jsx, jsxs } from 'react/jsx-runtime';

function cn(...inputs) {
  return twMerge(clsx(inputs));
}
var DEFAULT_ICON_API_KEY = "au382bi7fsh96w9h9xlrnat2jglx";
var DynamicIcon = React.memo(function DynamicIcon2({
  apiKey,
  ...props
}) {
  return /* @__PURE__ */ jsx(Icon, { ...props, apiKey: apiKey ?? DEFAULT_ICON_API_KEY });
});
DynamicIcon.displayName = "DynamicIcon";
var BUTTON_SIZES = {
  sm: { buttonSize: "size-8", iconSize: 16 },
  md: { buttonSize: "size-10", iconSize: 20 },
  lg: { buttonSize: "size-12", iconSize: 24 },
  xl: { buttonSize: "size-14", iconSize: 28 }
};
function CarouselPagination({
  onPrevious,
  onNext,
  canScrollPrevious = true,
  canScrollNext = true,
  size = "md",
  mobileSize,
  iconSize: customIconSize,
  className,
  buttonClassName,
  previousIcon = "lucide/arrow-left",
  nextIcon = "lucide/arrow-right",
  previousAriaLabel = "Previous",
  nextAriaLabel = "Next"
}) {
  const desktopConfig = BUTTON_SIZES[size];
  const mobileConfig = mobileSize ? BUTTON_SIZES[mobileSize] : desktopConfig;
  const sizeClasses = mobileSize && mobileSize !== size ? `${mobileConfig.buttonSize} md:${desktopConfig.buttonSize}` : desktopConfig.buttonSize;
  const effectiveIconSize = customIconSize ?? desktopConfig.iconSize;
  const baseButtonStyles = cn(
    "relative z-40 flex items-center justify-center",
    "aspect-square !p-0 rounded-full",
    // Force perfect circle
    sizeClasses,
    "disabled:opacity-50",
    buttonClassName
  );
  return /* @__PURE__ */ jsxs("div", { className: cn("flex justify-end gap-2", className), children: [
    /* @__PURE__ */ jsx(
      Pressable,
      {
        onClick: onPrevious,
        disabled: !canScrollPrevious,
        "aria-label": previousAriaLabel,
        asButton: true,
        className: baseButtonStyles,
        children: /* @__PURE__ */ jsx(DynamicIcon, { name: previousIcon, size: effectiveIconSize })
      }
    ),
    /* @__PURE__ */ jsx(
      Pressable,
      {
        onClick: onNext,
        disabled: !canScrollNext,
        "aria-label": nextAriaLabel,
        asButton: true,
        className: baseButtonStyles,
        children: /* @__PURE__ */ jsx(DynamicIcon, { name: nextIcon, size: effectiveIconSize })
      }
    )
  ] });
}

export { BUTTON_SIZES as CAROUSEL_PAGINATION_SIZES, CarouselPagination };
