"use client";

// src/components/ui/avatar.tsx
import { Check, Plus } from "lucide-react";
import { Avatar as AvatarPrimitive } from "radix-ui";
import { cva as cva2 } from "class-variance-authority";

// src/lib/utils.ts
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
function cn(...inputs) {
  return twMerge(clsx(inputs));
}

// src/components/ui/badge.tsx
import { cva } from "class-variance-authority";
import { Slot } from "radix-ui";
import { jsx } from "react/jsx-runtime";
var badgeVariants = cva(
  "group/badge inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-1 text-xs font-medium leading-none whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
  {
    variants: {
      variant: {
        default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
        secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
        destructive: "bg-destructive/10 text-[var(--chip-destructive)] focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:text-red-100 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
        outline: "border-border text-foreground [a]:hover:bg-interactive-hover [a]:hover:text-muted-foreground",
        ghost: "hover:bg-interactive-hover hover:text-muted-foreground dark:hover:bg-interactive-hover-subtle",
        link: "text-primary underline-offset-4 hover:underline"
      }
    },
    defaultVariants: {
      variant: "default"
    }
  }
);
function Badge({
  className,
  variant = "default",
  asChild = false,
  ...props
}) {
  const Comp = asChild ? Slot.Root : "span";
  return /* @__PURE__ */ jsx(
    Comp,
    {
      "data-slot": "badge",
      "data-variant": variant,
      className: cn(badgeVariants({ variant }), className),
      ...props
    }
  );
}

// src/components/ui/avatar.tsx
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
var avatarRootVariants = cva2(
  "group/avatar relative flex shrink-0 overflow-hidden select-none",
  {
    variants: {
      size: {
        sm: "size-6",
        default: "size-8",
        lg: "size-10"
      },
      shape: {
        circle: "rounded-full",
        square: "rounded-none",
        "rounded-sm": "rounded-sm",
        "rounded-md": "rounded-md",
        "rounded-lg": "rounded-lg",
        "rounded-xl": "rounded-xl"
      },
      variant: {
        default: "",
        ring: "ring-2 ring-ring",
        "ring-offset": "ring-2 ring-ring ring-offset-2 ring-offset-background",
        group: "ring-2 ring-background"
      }
    },
    defaultVariants: {
      size: "default",
      shape: "circle",
      variant: "default"
    }
  }
);
var AVATAR_INSET_AFTER = {
  circle: "after:rounded-full",
  square: "after:rounded-none",
  "rounded-sm": "after:rounded-sm",
  "rounded-md": "after:rounded-md",
  "rounded-lg": "after:rounded-lg",
  "rounded-xl": "after:rounded-xl"
};
var avatarImageShape = cn(
  "aspect-square size-full object-cover",
  "group-data-[shape=circle]/avatar:rounded-full",
  "group-data-[shape=square]/avatar:rounded-none",
  "group-data-[shape=rounded-sm]/avatar:rounded-sm",
  "group-data-[shape=rounded-md]/avatar:rounded-md",
  "group-data-[shape=rounded-lg]/avatar:rounded-lg",
  "group-data-[shape=rounded-xl]/avatar:rounded-xl"
);
var avatarFallbackShape = cn(
  "flex size-full items-center justify-center bg-muted text-sm text-muted-foreground",
  "group-data-[shape=circle]/avatar:rounded-full",
  "group-data-[shape=square]/avatar:rounded-none",
  "group-data-[shape=rounded-sm]/avatar:rounded-sm",
  "group-data-[shape=rounded-md]/avatar:rounded-md",
  "group-data-[shape=rounded-lg]/avatar:rounded-lg",
  "group-data-[shape=rounded-xl]/avatar:rounded-xl",
  "group-data-[size=sm]/avatar:text-xs"
);
function Avatar({
  className,
  size = "default",
  shape = "circle",
  variant = "default",
  insetBorder = false,
  ...props
}) {
  const shapeKey = shape ?? "circle";
  const insetClass = insetBorder && cn(
    "after:pointer-events-none after:absolute after:inset-0 after:border after:border-border after:mix-blend-darken dark:after:mix-blend-lighten",
    AVATAR_INSET_AFTER[shapeKey]
  );
  return /* @__PURE__ */ jsx2(
    AvatarPrimitive.Root,
    {
      "data-slot": "avatar",
      "data-size": size,
      "data-shape": shape,
      className: cn(avatarRootVariants({ size, shape, variant }), insetClass, className),
      ...props
    }
  );
}
function AvatarImage({
  className,
  referrerPolicy = "no-referrer",
  ...props
}) {
  return /* @__PURE__ */ jsx2(
    AvatarPrimitive.Image,
    {
      "data-slot": "avatar-image",
      referrerPolicy,
      className: cn(avatarImageShape, className),
      ...props
    }
  );
}
function AvatarFallback({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx2(
    AvatarPrimitive.Fallback,
    {
      "data-slot": "avatar-fallback",
      className: cn(avatarFallbackShape, className),
      ...props
    }
  );
}
function AvatarBadge({ className, ...props }) {
  return /* @__PURE__ */ jsx2(
    "span",
    {
      "data-slot": "avatar-badge",
      className: cn(
        "absolute end-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
        "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
        "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
        "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
        className
      ),
      ...props
    }
  );
}
function AvatarGroup({ className, ...props }) {
  return /* @__PURE__ */ jsx2(
    "div",
    {
      "data-slot": "avatar-group",
      className: cn(
        "group/avatar-group flex items-center gap-1.5",
        className
      ),
      ...props
    }
  );
}
function AvatarGroupCount({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx2(
    "div",
    {
      "data-slot": "avatar-group-count",
      className: cn(
        "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
        className
      ),
      ...props
    }
  );
}
function AvatarInitials({
  initials,
  decorative = true,
  fallbackClassName,
  className,
  ...avatarProps
}) {
  return /* @__PURE__ */ jsx2(Avatar, { className, ...avatarProps, children: /* @__PURE__ */ jsx2(
    AvatarFallback,
    {
      "aria-hidden": decorative ? true : void 0,
      className: cn(
        "border-0 bg-[var(--avatar-initials-bg)] font-semibold text-[var(--avatar-initials-fg)]",
        fallbackClassName
      ),
      children: initials
    }
  ) });
}
var avatarStatusDot = {
  online: "bg-emerald-600 dark:bg-emerald-400",
  busy: "bg-destructive",
  away: "bg-amber-600 dark:bg-amber-400"
};
function AvatarStatus({
  children,
  status,
  label,
  className,
  position = "bottom-end"
}) {
  const pos = position === "top-end" ? "-top-0.5 -end-0.5 bottom-auto start-auto" : "-end-0.5 -bottom-0.5 top-auto start-auto";
  return /* @__PURE__ */ jsxs("span", { className: cn("relative inline-flex w-fit shrink-0", className), children: [
    children,
    /* @__PURE__ */ jsx2(
      "span",
      {
        className: cn(
          "pointer-events-none absolute z-10 size-3 rounded-full border-2 border-background",
          pos,
          avatarStatusDot[status]
        ),
        "aria-hidden": true
      }
    ),
    /* @__PURE__ */ jsx2("span", { className: "sr-only", children: label })
  ] });
}
function AvatarNotificationCount({
  children,
  count,
  className,
  badgeClassName
}) {
  return /* @__PURE__ */ jsxs("span", { className: cn("relative inline-flex w-fit shrink-0", className), children: [
    children,
    /* @__PURE__ */ jsx2(
      Badge,
      {
        className: cn(
          "absolute -top-2.5 -end-2.5 z-10 h-5 min-w-5 justify-center px-1 tabular-nums",
          badgeClassName
        ),
        children: count
      }
    )
  ] });
}
function AvatarVerified({
  children,
  label = "Verified",
  className
}) {
  return /* @__PURE__ */ jsxs("span", { className: cn("relative inline-flex w-fit shrink-0", className), children: [
    children,
    /* @__PURE__ */ jsxs("span", { className: "pointer-events-none absolute -top-1.5 -end-1.5 z-10 inline-flex size-4 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm", children: [
      /* @__PURE__ */ jsx2(Check, { className: "size-2.5", strokeWidth: 3, "aria-hidden": true }),
      /* @__PURE__ */ jsx2("span", { className: "sr-only", children: label })
    ] })
  ] });
}
function AvatarLeoAssistant({
  className,
  size = "sm",
  ...props
}) {
  return /* @__PURE__ */ jsx2(Avatar, { size, shape: "circle", insetBorder: false, className, ...props, children: /* @__PURE__ */ jsxs(AvatarFallback, { className: "bg-brand/15 p-0", children: [
    /* @__PURE__ */ jsx2("span", { className: "sr-only", children: "Leo" }),
    /* @__PURE__ */ jsx2(
      "i",
      {
        className: "fa-duotone fa-solid fa-star-christmas text-xs text-brand",
        "aria-hidden": "true"
      }
    )
  ] }) });
}
function AvatarPlusAction({
  children,
  actionLabel,
  onClick,
  className,
  buttonClassName
}) {
  return /* @__PURE__ */ jsxs("span", { className: cn("relative inline-flex w-fit shrink-0", className), children: [
    children,
    /* @__PURE__ */ jsxs(
      "button",
      {
        type: "button",
        onClick,
        className: cn(
          "focus-visible:ring-ring/50 absolute -end-1 -bottom-1 z-10 inline-flex size-7 cursor-pointer items-center justify-center rounded-full bg-background shadow-sm ring-1 ring-border focus-visible:ring-[3px] focus-visible:outline-none",
          buttonClassName
        ),
        children: [
          /* @__PURE__ */ jsx2(Plus, { className: "size-4 text-muted-foreground", "aria-hidden": true }),
          /* @__PURE__ */ jsx2("span", { className: "sr-only", children: actionLabel })
        ]
      }
    )
  ] });
}
export {
  Avatar,
  AvatarBadge,
  AvatarFallback,
  AvatarGroup,
  AvatarGroupCount,
  AvatarImage,
  AvatarInitials,
  AvatarLeoAssistant,
  AvatarNotificationCount,
  AvatarPlusAction,
  AvatarStatus,
  AvatarVerified,
  avatarRootVariants
};
//# sourceMappingURL=avatar.js.map