/**
 * AJL40 Digital Series
 * © 2026 sultanmuzaffar. Hak cipta terpelihara / All rights reserved.
 * Penggunaan, penyalinan atau pengedaran tanpa kebenaran bertulis adalah dilarang.
 * Unauthorized use, copying or distribution is prohibited.
 */

// Lucide-style stroke icons. 1.5px stroke, currentColor, sharp linecap.
// Keep this small — add only icons we use.
const { createElement: h } = React;

function Icon({ name, size = 20, strokeWidth = 1.5, style }) {
  const props = {
    width: size,
    height: size,
    viewBox: "0 0 24 24",
    fill: "none",
    stroke: "currentColor",
    strokeWidth: strokeWidth,
    strokeLinecap: "round",
    strokeLinejoin: "round",
    style: { display: "block", flexShrink: 0, ...(style || {}) },
  };

  switch (name) {
    case "play":
      return h("svg", props, h("polygon", { points: "6 4 20 12 6 20 6 4", fill: "currentColor", stroke: "none" }));
    case "pause":
      return h("svg", props,
        h("rect", { x: 6, y: 4, width: 4, height: 16, fill: "currentColor", stroke: "none" }),
        h("rect", { x: 14, y: 4, width: 4, height: 16, fill: "currentColor", stroke: "none" }));
    case "skip-back":
      return h("svg", props,
        h("polygon", { points: "19 20 9 12 19 4 19 20", fill: "currentColor" }),
        h("line", { x1: 5, y1: 19, x2: 5, y2: 5 }));
    case "skip-forward":
      return h("svg", props,
        h("polygon", { points: "5 4 15 12 5 20 5 4", fill: "currentColor" }),
        h("line", { x1: 19, y1: 5, x2: 19, y2: 19 }));
    case "arrow-right":
      return h("svg", props, h("line", { x1: 5, y1: 12, x2: 19, y2: 12 }), h("polyline", { points: "12 5 19 12 12 19" }));
    case "arrow-left":
      return h("svg", props, h("line", { x1: 19, y1: 12, x2: 5, y2: 12 }), h("polyline", { points: "12 19 5 12 12 5" }));
    case "search":
      return h("svg", props, h("circle", { cx: 11, cy: 11, r: 8 }), h("line", { x1: 21, y1: 21, x2: 16.65, y2: 16.65 }));
    case "menu":
      return h("svg", props, h("line", { x1: 4, y1: 7, x2: 20, y2: 7 }), h("line", { x1: 4, y1: 17, x2: 20, y2: 17 }));
    case "close":
      return h("svg", props, h("line", { x1: 18, y1: 6, x2: 6, y2: 18 }), h("line", { x1: 6, y1: 6, x2: 18, y2: 18 }));
    case "headphones":
      return h("svg", props,
        h("path", { d: "M6 9H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2" }),
        h("path", { d: "M18 9h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2" }),
        h("path", { d: "M6 13v-2a6 6 0 0 1 12 0v2" }));
    case "mic":
      return h("svg", props,
        h("rect", { x: 9, y: 2, width: 6, height: 13, rx: 3 }),
        h("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
        h("line", { x1: 12, y1: 19, x2: 12, y2: 22 }));
    case "music":
      return h("svg", props,
        h("path", { d: "M9 18V5l12-2v13" }),
        h("circle", { cx: 6, cy: 18, r: 3 }),
        h("circle", { cx: 18, cy: 16, r: 3 }));
    case "archive":
      return h("svg", props,
        h("polyline", { points: "3 6 5 6 21 6" }),
        h("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }),
        h("path", { d: "M10 11v6" }), h("path", { d: "M14 11v6" }));
    case "trophy":
      return h("svg", props,
        h("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
        h("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
        h("path", { d: "M4 22h16" }),
        h("path", { d: "M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22" }),
        h("path", { d: "M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22" }),
        h("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" }));
    case "globe":
      return h("svg", props,
        h("circle", { cx: 12, cy: 12, r: 10 }),
        h("line", { x1: 2, y1: 12, x2: 22, y2: 12 }),
        h("path", { d: "M12 2a15 15 0 0 1 4 10 15 15 0 0 1-4 10 15 15 0 0 1-4-10 15 15 0 0 1 4-10z" }));
    case "share":
      return h("svg", props,
        h("circle", { cx: 18, cy: 5, r: 3 }),
        h("circle", { cx: 6, cy: 12, r: 3 }),
        h("circle", { cx: 18, cy: 19, r: 3 }),
        h("line", { x1: 8.59, y1: 13.51, x2: 15.42, y2: 17.49 }),
        h("line", { x1: 15.41, y1: 6.51, x2: 8.59, y2: 10.49 }));
    case "bookmark":
      return h("svg", props, h("path", { d: "M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z" }));
    case "check":
      return h("svg", props, h("polyline", { points: "20 6 9 17 4 12" }));
    default:
      return null;
  }
}

window.Icon = Icon;
