"use client";
'use strict';

var clsx = require('clsx');
var tailwindMerge = require('tailwind-merge');
var React = require('react');
var jsxRuntime = require('react/jsx-runtime');
var AvatarPrimitive = require('@radix-ui/react-avatar');

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespace(React);
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);

// lib/utils.ts
function cn(...inputs) {
  return tailwindMerge.twMerge(clsx.clsx(inputs));
}
var svgCache = /* @__PURE__ */ new Map();
function DynamicIcon({
  name,
  size = 28,
  color,
  className,
  alt
}) {
  const [svgContent, setSvgContent] = React__namespace.useState(null);
  const [isLoading, setIsLoading] = React__namespace.useState(true);
  const [error, setError] = React__namespace.useState(null);
  const { url, iconName } = React__namespace.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__namespace.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__ */ jsxRuntime.jsx(
      "span",
      {
        className: cn("inline-block", className),
        style: { width: size, height: size },
        "aria-hidden": "true"
      }
    );
  }
  if (error || !svgContent) {
    return /* @__PURE__ */ jsxRuntime.jsx(
      "span",
      {
        className: cn("inline-block", className),
        style: { width: size, height: size },
        role: "img",
        "aria-label": alt || iconName
      }
    );
  }
  return /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
    AvatarPrimitive__namespace.Root,
    {
      "data-slot": "avatar",
      className: cn(
        "relative flex size-8 shrink-0 overflow-hidden rounded-full",
        className
      ),
      ...props
    }
  );
}
function AvatarImage({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    AvatarPrimitive__namespace.Image,
    {
      "data-slot": "avatar-image",
      className: cn("aspect-square size-full", className),
      ...props
    }
  );
}
function AvatarFallback({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    AvatarPrimitive__namespace.Fallback,
    {
      "data-slot": "avatar-fallback",
      className: cn(
        "bg-muted flex size-full items-center justify-center rounded-full",
        className
      ),
      ...props
    }
  );
}
function Card({ className, ...props }) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    {
      "data-slot": "card",
      className: cn(
        "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
        className
      ),
      ...props
    }
  );
}
function CardContent({ className, ...props }) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    {
      "data-slot": "card-content",
      className: cn("px-6", 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"};
var DEFAULT_TESTIMONIALS = [
  {
    id: "1",
    quote: "This platform has completely transformed how we approach our workflow. The intuitive design and powerful features have made our team significantly more productive. I can't imagine going back to our old tools.",
    author: {
      name: "Sarah Chen",
      role: "Product Manager",
      company: "TechCorp",
      avatar: blockBrandedIconsAndPlaceholders.avatar1
    },
    featured: true
  },
  {
    id: "2",
    quote: "The best investment we've made this year. ROI was visible within the first month.",
    author: {
      name: "Michael Torres",
      role: "CEO",
      company: "StartupXYZ",
      avatar: blockBrandedIconsAndPlaceholders.avatar2
    }
  },
  {
    id: "3",
    quote: "Customer support is exceptional. They went above and beyond to help us with our specific needs.",
    author: {
      name: "Emily Watson",
      role: "Operations Lead",
      company: "GrowthCo",
      avatar: blockBrandedIconsAndPlaceholders.avatar3
    }
  },
  {
    id: "4",
    quote: "Simple, elegant, and powerful. Everything we needed in one package.",
    author: {
      name: "David Kim",
      role: "CTO",
      company: "InnovateLabs",
      avatar: blockBrandedIconsAndPlaceholders.avatar4
    }
  },
  {
    id: "5",
    quote: "We've tried many solutions, but this one stands out for its reliability and ease of use.",
    author: {
      name: "Lisa Park",
      role: "Engineering Manager",
      company: "DevStudio",
      avatar: blockBrandedIconsAndPlaceholders.avatar5
    }
  }
];
function TestimonialsBentoGrid({
  testimonials = DEFAULT_TESTIMONIALS,
  title = "Loved by Teams Everywhere",
  subtitle = "See what our customers have to say about their experience",
  className
}) {
  const featured = testimonials.find((t) => t.featured) || testimonials[0];
  const others = testimonials.filter((t) => t.id !== featured.id);
  return /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("py-16 md:py-24", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container", children: [
    /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto mb-12 max-w-2xl text-center", children: [
      /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-3xl font-semibold tracking-tight md:text-4xl", children: title }),
      /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-4 text-lg text-muted-foreground", children: subtitle })
    ] }),
    /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: [
      /* @__PURE__ */ jsxRuntime.jsx(Card, { className: "md:col-span-2 lg:row-span-2", children: /* @__PURE__ */ jsxRuntime.jsxs(CardContent, { className: "flex h-full flex-col justify-between p-6 md:p-8", children: [
        /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntime.jsx(
            DynamicIcon,
            {
              name: "lucide/quote",
              size: 40,
              className: "mb-4 text-primary/20"
            }
          ),
          /* @__PURE__ */ jsxRuntime.jsxs("blockquote", { className: "text-xl font-medium leading-relaxed md:text-2xl", children: [
            "\u201C",
            featured.quote,
            "\u201D"
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-6 flex items-center gap-4", children: [
          /* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-12", children: [
            /* @__PURE__ */ jsxRuntime.jsx(
              AvatarImage,
              {
                src: featured.author.avatar,
                alt: featured.author.name
              }
            ),
            /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: featured.author.name.split(" ").map((n) => n[0]).join("") })
          ] }),
          /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold", children: featured.author.name }),
            /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
              featured.author.role,
              featured.author.company && ` at ${featured.author.company}`
            ] })
          ] })
        ] })
      ] }) }),
      others.slice(0, 4).map((testimonial) => /* @__PURE__ */ jsxRuntime.jsx(Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(CardContent, { className: "flex h-full flex-col justify-between p-6", children: [
        /* @__PURE__ */ jsxRuntime.jsxs("blockquote", { className: "text-sm leading-relaxed", children: [
          "\u201C",
          testimonial.quote,
          "\u201D"
        ] }),
        /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex items-center gap-3", children: [
          /* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-9", children: [
            /* @__PURE__ */ jsxRuntime.jsx(
              AvatarImage,
              {
                src: testimonial.author.avatar,
                alt: testimonial.author.name
              }
            ),
            /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "text-xs", children: testimonial.author.name.split(" ").map((n) => n[0]).join("") })
          ] }),
          /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: testimonial.author.name }),
            /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: testimonial.author.role })
          ] })
        ] })
      ] }) }, testimonial.id))
    ] })
  ] }) });
}

exports.TestimonialsBentoGrid = TestimonialsBentoGrid;
//# sourceMappingURL=testimonials-bento-grid.cjs.map
//# sourceMappingURL=testimonials-bento-grid.cjs.map