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

// 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;
}
var defaultSteps = [
  {
    icon: "lucide/lightbulb",
    title: "Discovery & Research",
    description: "We start by understanding your business, goals, and target audience through comprehensive research and analysis.",
    highlights: ["Market Analysis", "User Research", "Competitive Review"],
    badgeColor: "bg-blue-500"
  },
  {
    icon: "lucide/pencil-ruler",
    title: "Strategy & Planning",
    description: "Based on our findings, we develop a strategic roadmap that outlines the approach, timeline, and key deliverables.",
    highlights: ["Project Roadmap", "Resource Planning", "Risk Assessment"],
    badgeColor: "bg-purple-500"
  },
  {
    icon: "lucide/code",
    title: "Design & Development",
    description: "Our team brings the strategy to life through iterative design and development cycles with regular feedback loops.",
    highlights: ["UI/UX Design", "Frontend Development", "Backend Integration"],
    badgeColor: "bg-green-500"
  },
  {
    icon: "lucide/test-tube",
    title: "Testing & QA",
    description: "Rigorous testing ensures quality and reliability across all platforms and use cases before launch.",
    highlights: ["Unit Testing", "Integration Testing", "User Acceptance"],
    badgeColor: "bg-orange-500"
  },
  {
    icon: "lucide/rocket",
    title: "Launch & Deploy",
    description: "We handle the deployment process with care, ensuring a smooth transition to production environments.",
    highlights: ["Deployment Strategy", "Performance Monitoring", "Go-Live Support"],
    badgeColor: "bg-red-500"
  },
  {
    icon: "lucide/bar-chart-3",
    title: "Monitor & Optimize",
    description: "Post-launch, we continuously monitor performance and implement optimizations based on real-world data.",
    highlights: ["Analytics Review", "Performance Tuning", "A/B Testing"],
    badgeColor: "bg-teal-500"
  },
  {
    icon: "lucide/refresh-cw",
    title: "Iterate & Improve",
    description: "We believe in continuous improvement, regularly updating and enhancing based on user feedback and market changes.",
    highlights: ["Feature Updates", "User Feedback", "Continuous Delivery"],
    badgeColor: "bg-indigo-500"
  }
];
var defaultProps = {
  title: "Our Process",
  description: "A proven methodology that delivers exceptional results through careful planning and execution.",
  steps: defaultSteps
};
function ProcessIconTimeline({
  className,
  title = defaultProps.title,
  description = defaultProps.description,
  steps = defaultProps.steps
}) {
  return /* @__PURE__ */ jsx("section", { className: cn("py-32", className), children: /* @__PURE__ */ jsxs("div", { className: "container", children: [
    /* @__PURE__ */ jsxs("div", { className: "mb-16 max-w-2xl", children: [
      /* @__PURE__ */ jsx("h1", { className: "mb-4 text-4xl font-semibold tracking-tight lg:text-5xl", children: title }),
      /* @__PURE__ */ jsx("p", { className: "text-lg text-foreground/50", children: description })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "relative", children: [
      /* @__PURE__ */ jsx("div", { className: "absolute left-6 top-0 bottom-0 w-px bg-border lg:left-1/2 lg:-translate-x-1/2" }),
      /* @__PURE__ */ jsx("div", { className: "space-y-12", children: steps?.map((step, index) => /* @__PURE__ */ jsxs(
        "div",
        {
          className: cn(
            "relative flex flex-col gap-6 pl-16 lg:flex-row lg:gap-12 lg:pl-0",
            index % 2 === 0 ? "lg:flex-row" : "lg:flex-row-reverse"
          ),
          children: [
            /* @__PURE__ */ jsx(
              "div",
              {
                className: cn(
                  "absolute left-0 flex size-12 items-center justify-center rounded-full text-white lg:left-1/2 lg:-translate-x-1/2",
                  step.badgeColor || "bg-primary"
                ),
                children: /* @__PURE__ */ jsx(DynamicIcon, { name: step.icon, size: 24 })
              }
            ),
            /* @__PURE__ */ jsx(
              "div",
              {
                className: cn(
                  "flex-1 lg:text-right",
                  index % 2 !== 0 && "lg:text-left"
                ),
                children: /* @__PURE__ */ jsxs(
                  "div",
                  {
                    className: cn(
                      "rounded-lg border bg-card p-6 shadow-sm",
                      index % 2 === 0 ? "lg:mr-12" : "lg:ml-12"
                    ),
                    children: [
                      /* @__PURE__ */ jsx("h3", { className: "mb-2 text-xl font-semibold tracking-tight", children: step.title }),
                      /* @__PURE__ */ jsx("p", { className: "mb-4 text-foreground/50", children: step.description }),
                      step.highlights && step.highlights.length > 0 && /* @__PURE__ */ jsx(
                        "div",
                        {
                          className: cn(
                            "flex flex-wrap gap-2",
                            index % 2 === 0 ? "lg:justify-end" : "lg:justify-start"
                          ),
                          children: step.highlights.map((highlight, hIndex) => /* @__PURE__ */ jsx(
                            "span",
                            {
                              className: "rounded-full bg-muted px-3 py-1 text-xs font-medium text-muted-foreground",
                              children: highlight
                            },
                            hIndex
                          ))
                        }
                      )
                    ]
                  }
                )
              }
            ),
            /* @__PURE__ */ jsx("div", { className: "hidden flex-1 lg:block" })
          ]
        },
        index
      )) })
    ] })
  ] }) });
}

export { ProcessIconTimeline };
//# sourceMappingURL=process-icon-timeline.js.map
//# sourceMappingURL=process-icon-timeline.js.map