"use client";
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import * as React from 'react';
import { jsx, jsxs } from 'react/jsx-runtime';
import * as AvatarPrimitive from '@radix-ui/react-avatar';

// lib/utils.ts
function cn(...inputs) {
  return twMerge(clsx(inputs));
}
var svgCache = /* @__PURE__ */ new Map();
function DynamicIcon({
  name,
  size = 28,
  color,
  className,
  alt
}) {
  const [svgContent, setSvgContent] = React.useState(null);
  const [isLoading, setIsLoading] = React.useState(true);
  const [error, setError] = React.useState(null);
  const { url, iconName } = React.useMemo(() => {
    const separator = name.includes("/") ? "/" : ":";
    const [prefix, iconName2] = name.split(separator);
    const baseUrl = `https://icons.opensite.ai/api/icon/${prefix}/${iconName2}?format=svg&width=${size}&height=${size}`;
    return {
      url: baseUrl,
      iconName: iconName2
    };
  }, [name, size]);
  React.useEffect(() => {
    let isMounted = true;
    const fetchSvg = async () => {
      const cached = svgCache.get(url);
      if (cached) {
        if (isMounted) {
          setSvgContent(cached);
          setIsLoading(false);
        }
        return;
      }
      try {
        setIsLoading(true);
        setError(null);
        const response = await fetch(url);
        if (!response.ok) {
          throw new Error(`Failed to fetch icon: ${response.status}`);
        }
        let svg = await response.text();
        svg = processSvgForCurrentColor(svg);
        svgCache.set(url, svg);
        if (isMounted) {
          setSvgContent(svg);
          setIsLoading(false);
        }
      } catch (err) {
        if (isMounted) {
          setError(err instanceof Error ? err.message : "Failed to load icon");
          setIsLoading(false);
        }
      }
    };
    fetchSvg();
    return () => {
      isMounted = false;
    };
  }, [url]);
  if (isLoading) {
    return /* @__PURE__ */ jsx(
      "span",
      {
        className: cn("inline-block", className),
        style: { width: size, height: size },
        "aria-hidden": "true"
      }
    );
  }
  if (error || !svgContent) {
    return /* @__PURE__ */ jsx(
      "span",
      {
        className: cn("inline-block", className),
        style: { width: size, height: size },
        role: "img",
        "aria-label": alt || iconName
      }
    );
  }
  return /* @__PURE__ */ jsx(
    "span",
    {
      className: cn("inline-flex items-center justify-center", className),
      style: {
        width: size,
        height: size,
        color: color || "inherit"
      },
      role: "img",
      "aria-label": alt || iconName,
      dangerouslySetInnerHTML: { __html: svgContent }
    }
  );
}
function processSvgForCurrentColor(svg) {
  let processed = svg;
  processed = processed.replace(
    /stroke=["'](#000000|#000|black)["']/gi,
    'stroke="currentColor"'
  );
  processed = processed.replace(
    /fill=["'](#000000|#000|black)["']/gi,
    'fill="currentColor"'
  );
  return processed;
}
function Avatar({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    AvatarPrimitive.Root,
    {
      "data-slot": "avatar",
      className: cn(
        "relative flex size-8 shrink-0 overflow-hidden rounded-full",
        className
      ),
      ...props
    }
  );
}
function AvatarImage({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    AvatarPrimitive.Image,
    {
      "data-slot": "avatar-image",
      className: cn("aspect-square size-full", className),
      ...props
    }
  );
}
function AvatarFallback({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    AvatarPrimitive.Fallback,
    {
      "data-slot": "avatar-fallback",
      className: cn(
        "bg-muted flex size-full items-center justify-center rounded-full",
        className
      ),
      ...props
    }
  );
}

// lib/blockBrandedIconsAndPlaceholders.ts
var blockBrandedIconsAndPlaceholders = {
  avatar1: "https://cdn.ing/assets/i/r/286239/ebm7o3j2kx48vw98emnwjaf5qvl6/avatar-1.webp",
  avatar2: "https://cdn.ing/assets/i/r/286240/vgf3rrkwn0769pfdtpal60uo5vpw/avatar-2.webp",
  avatar3: "https://cdn.ing/assets/i/r/286241/05vbqt3lls0q974r8fv4zn0njllq/avatar-3.webp",
  avatar4: "https://cdn.ing/assets/i/r/286242/y0zkazxawxrl3twwkw63twf04pdt/avatar-4.webp",
  avatar5: "https://cdn.ing/assets/i/r/286243/alziyfoo570m3vade3usufzlzj6x/avatar-5.webp",
  avatar6: "https://cdn.ing/assets/i/r/286244/t7u1jpe1phm0fvmh3ybh3flhfg6i/avatar-6.webp"};
var DEFAULT_TESTIMONIALS = [
  {
    id: "1",
    content: "Exceptional quality and outstanding customer service. Highly recommend!",
    author: {
      name: "Sarah Chen",
      role: "Product Manager",
      avatar: blockBrandedIconsAndPlaceholders.avatar1
    },
    rating: 5
  },
  {
    id: "2",
    content: "This solution has transformed how our team works. Incredible value.",
    author: {
      name: "Michael Torres",
      role: "CEO",
      avatar: blockBrandedIconsAndPlaceholders.avatar2
    },
    rating: 5
  },
  {
    id: "3",
    content: "Simple, elegant, and powerful. Everything we needed in one package.",
    author: {
      name: "Emily Watson",
      role: "Operations Lead",
      avatar: blockBrandedIconsAndPlaceholders.avatar3
    },
    rating: 5
  },
  {
    id: "4",
    content: "The best investment we've made this year. ROI was immediate.",
    author: {
      name: "David Kim",
      role: "CTO",
      avatar: blockBrandedIconsAndPlaceholders.avatar4
    },
    rating: 5
  },
  {
    id: "5",
    content: "Support team is always responsive and helpful. Great experience overall.",
    author: {
      name: "Lisa Park",
      role: "Engineering Manager",
      avatar: blockBrandedIconsAndPlaceholders.avatar5
    },
    rating: 4
  },
  {
    id: "6",
    content: "Clean interface and intuitive design. Our team adopted it instantly.",
    author: {
      name: "Alex Rivera",
      role: "Design Director",
      avatar: blockBrandedIconsAndPlaceholders.avatar6
    },
    rating: 5
  }
];
function StarRating({ rating, size = 14 }) {
  return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", children: [1, 2, 3, 4, 5].map((star) => /* @__PURE__ */ jsx(
    DynamicIcon,
    {
      name: "lucide/star",
      size,
      className: cn(
        star <= rating ? "fill-yellow-400 text-yellow-400" : "fill-muted text-muted"
      )
    },
    star
  )) });
}
function TestimonialsMiniDividers({
  testimonials = DEFAULT_TESTIMONIALS,
  title = "What People Say",
  subtitle = "Feedback from our customers",
  className
}) {
  return /* @__PURE__ */ jsx("section", { className: cn("py-16 md:py-24", className), children: /* @__PURE__ */ jsxs("div", { className: "container", children: [
    /* @__PURE__ */ jsxs("div", { className: "mx-auto mb-12 max-w-2xl text-center", children: [
      /* @__PURE__ */ jsx("h2", { className: "text-3xl font-semibold tracking-tight md:text-4xl", children: title }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-lg text-muted-foreground", children: subtitle })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "grid divide-y sm:grid-cols-2 sm:divide-x sm:divide-y-0 lg:grid-cols-3 lg:divide-x", children: testimonials.map((testimonial, index) => /* @__PURE__ */ jsxs(
      "div",
      {
        className: cn(
          "p-6",
          index >= 2 && "lg:border-t-0",
          index >= 3 && "sm:border-t lg:border-t-0"
        ),
        children: [
          testimonial.rating && /* @__PURE__ */ jsx(StarRating, { rating: testimonial.rating }),
          /* @__PURE__ */ jsxs("p", { className: "mt-3 text-sm leading-relaxed", children: [
            "\u201C",
            testimonial.content,
            "\u201D"
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center gap-3", children: [
            /* @__PURE__ */ jsxs(Avatar, { className: "size-8", children: [
              /* @__PURE__ */ jsx(
                AvatarImage,
                {
                  src: testimonial.author.avatar,
                  alt: testimonial.author.name
                }
              ),
              /* @__PURE__ */ jsx(AvatarFallback, { className: "text-xs", children: testimonial.author.name.split(" ").map((n) => n[0]).join("") })
            ] }),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: testimonial.author.name }),
              testimonial.author.role && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: testimonial.author.role })
            ] })
          ] })
        ]
      },
      testimonial.id
    )) })
  ] }) });
}

export { TestimonialsMiniDividers };
//# sourceMappingURL=testimonials-mini-dividers.js.map
//# sourceMappingURL=testimonials-mini-dividers.js.map