// Lucide icon shim — wraps lucide UMD icons as React components
// Usage: <Icon.Play size={20} />
const { createElement: h, useEffect, useRef, useState, useCallback, useMemo, Fragment } = React;

function makeIcon(name) {
  return function LucideIcon({ size = 20, strokeWidth = 1.75, className = "", style }) {
    const ref = useRef(null);
    useEffect(() => {
      if (!ref.current || !window.lucide) return;
      ref.current.innerHTML = "";
      const node = window.lucide.createElement(window.lucide[name] || window.lucide.Circle);
      node.setAttribute("width", String(size));
      node.setAttribute("height", String(size));
      node.setAttribute("stroke-width", String(strokeWidth));
      ref.current.appendChild(node);
    }, [size, strokeWidth, name]);
    return h("span", {
      ref,
      className: "inline-flex items-center justify-center " + className,
      style: { lineHeight: 0, ...style },
      "aria-hidden": true,
    });
  };
}

const Icon = {
  Play: makeIcon("Play"),
  Check: makeIcon("Check"),
  CheckCircle2: makeIcon("CircleCheck"),
  Clock: makeIcon("Clock"),
  MapPin: makeIcon("MapPin"),
  Calendar: makeIcon("Calendar"),
  Users: makeIcon("Users"),
  TrendingUp: makeIcon("TrendingUp"),
  Award: makeIcon("Award"),
  Star: makeIcon("Star"),
  ChevronDown: makeIcon("ChevronDown"),
  ChevronRight: makeIcon("ChevronRight"),
  ChevronLeft: makeIcon("ChevronLeft"),
  ArrowRight: makeIcon("ArrowRight"),
  ArrowUpRight: makeIcon("ArrowUpRight"),
  Flame: makeIcon("Flame"),
  Sparkles: makeIcon("Sparkles"),
  Target: makeIcon("Target"),
  Megaphone: makeIcon("Megaphone"),
  HandCoins: makeIcon("HandCoins"),
  LineChart: makeIcon("ChartLine"),
  Building2: makeIcon("Building2"),
  Rocket: makeIcon("Rocket"),
  Briefcase: makeIcon("Briefcase"),
  GraduationCap: makeIcon("GraduationCap"),
  Brain: makeIcon("Brain"),
  Compass: makeIcon("Compass"),
  Crown: makeIcon("Crown"),
  Gem: makeIcon("Gem"),
  Medal: makeIcon("Medal"),
  Quote: makeIcon("Quote"),
  Mic: makeIcon("Mic"),
  Coffee: makeIcon("Coffee"),
  HeartHandshake: makeIcon("Handshake"),
  Lightbulb: makeIcon("Lightbulb"),
  ShieldCheck: makeIcon("ShieldCheck"),
  PiggyBank: makeIcon("PiggyBank"),
  BookOpen: makeIcon("BookOpen"),
  Gift: makeIcon("Gift"),
  PhoneCall: makeIcon("PhoneCall"),
  Video: makeIcon("Video"),
  Plus: makeIcon("Plus"),
  Minus: makeIcon("Minus"),
  Ticket: makeIcon("Ticket"),
  ExternalLink: makeIcon("ExternalLink"),
};

window.Icon = Icon;
window.h = h;
