/* linked.market — line icon set (1.75px stroke, rounded) */
const { createElement: h } = React;

const ICONS = {
  // nav
  home:   's M3 10.5 12 3l9 7.5 M5.5 9v11h13V9 M10 20v-6h4v6',
  search: 'c11 11 7|s M20 20 16.2 16.2', // composed below
  bell:   's M18 8a6 6 0 1 0-12 0c0 7-3 9-3 9h18s-3-2-3-9 M13.7 21a2 2 0 0 1-3.4 0',
  user:   'c12 8 3.6|s M4.5 20a7.5 7.5 0 0 1 15 0',
  grid:   's M4 4h7v7H4z M13 4h7v7h-7z M4 13h7v7H4z M13 13h7v7h-7z',

  // actions
  bookmark: 's M6 4h12v16l-6-4-6 4z',
  share:    'c6 5 1.6|c18 5 1.6|c18 19 1.6|s M7.4 10.7 16.6 6.3 M7.4 13.3l9.2 4.4',
  send:     's M22 3 11 14 M22 3 15 21l-4-7-7-4z',
  plus:     's M12 5v14 M5 12h14',
  minus:    's M5 12h14',
  x:        's M6 6 18 18 M18 6 6 18',
  check:    's M5 12.5 9.5 17 19 6.5',
  chevL:    's M15 5 8 12l7 7',
  chevR:    's M9 5l7 7-7 7',
  chevD:    's M5 9l7 7 7-7',
  arrowUR:  's M7 17 17 7 M8 7h9v9',
  sliders:  's M4 7h11 M19 7h1 M4 12h3 M11 12h9 M4 17h8 M16 17h4|c17 7 2.2|c9 12 2.2|c14 17 2.2',
  dots:     'c5 12 1|c12 12 1|c19 12 1',
  trash:    's M4 7h16 M9 7V4h6v3 M6 7l1 13h10l1-13 M10 11v6 M14 11v6',
  eye:      's M2 12s4-7 10-7 10 7 10 7-4 7-10 7-10-7-10-7z|c12 12 3',

  // trust / meta
  clock:    'c12 12 9|s M12 7v5l3.5 2',
  pin:      's M12 21s7-6.5 7-12a7 7 0 1 0-14 0c0 5.5 7 12 7 12z|c12 9 2.6',
  store:    's M4 9 5 4h14l1 5 M4 9v11h16V9 M4 9h16 M9 20v-6h6v6',
  package:  's M21 8 12 3 3 8v8l9 5 9-5z M3 8l9 5 9-5 M12 13v8',
  lock:     's M7 11V8a5 5 0 0 1 10 0v3 M5 11h14v9H5z',
  star:     's M12 3.5l2.6 5.6 6 .7-4.4 4.1 1.2 6L12 17l-5.4 3 1.2-6L3.4 9.8l6-.7z',
  bolt:     's M13 3 4 14h7l-1 7 9-11h-7z',

  // channels (generic, non-branded)
  chat:     's M21 12a8.5 8.5 0 0 1-12.4 7.5L3 21l1.5-5.4A8.5 8.5 0 1 1 21 12z',
  camera:   's M4 7h4l1.5-2h5L16 7h4v13H4z|c12 13 3.4',
  linkico:  's M9 15 15 9 M8 12l-2 2a3.5 3.5 0 0 0 5 5l2-2 M16 12l2-2a3.5 3.5 0 0 0-5-5l-2 2',

  // category glyphs
  shirt:  's M8 3 4 6l2 3 2-1v12h8V8l2 1 2-3-4-3-3 2H11z',
  device: 's M7 3h10v18H7z M10 18h4',
  bottle: 's M10 2h4v3l1 2v14H9V7l1-2z M9 11h6',
  bag:    's M6 8h12l1 12H5z M9 8V6a3 3 0 0 1 6 0v2',

  // vendor
  chart:  's M4 20h16 M7 20v-5 M12 20v-9 M17 20v-13',
  cart:   's M3 4h2l1.6 10h11L19 7H6|c9.5 19 1.4|c16.5 19 1.4',
  receipt:'s M6 3h12v18l-2-1.4-2 1.4-2-1.4-2 1.4-2-1.4L6 21z M9.5 8h5 M9.5 12h5',
  gear:   'c12 12 3.2|s M12 3.5v2.5 M12 18v2.5 M3.5 12h2.5 M18 12h2.5 M6 6l1.8 1.8 M16.2 16.2 18 18 M18 6l-1.8 1.8 M7.8 16.2 6 18',
  shield: 's M12 3 5 6v5c0 4 3 7 7 8 4-1 7-4 7-8V6z M9 11.5l2 2 4-4',
  edit:   's M4 20h4L18.5 9.5l-4-4L4 16z M13.5 6.5l4 4',
  upload: 's M12 16V4 M7 9l5-5 5 5 M5 20h14',
};

function pathsFor(name) {
  // base composites that needed special handling
  if (name === 'search') return [{ c: [11, 11, 7] }, { s: 'M20 20 16.2 16.2' }];
  const spec = ICONS[name];
  if (!spec) return [{ s: 'M4 12h16' }];
  return spec.split('|').map(seg => {
    if (seg[0] === 'c') { const [x, y, r] = seg.slice(1).trim().split(/\s+/).map(Number); return { c: [x, y, r] }; }
    return { s: seg.slice(2) };
  });
}

function Icon({ name, fill = false, style, className }) {
  const parts = pathsFor(name);
  return h('svg', {
    viewBox: '0 0 24 24', className, style,
    fill: fill ? 'currentColor' : 'none',
    stroke: fill ? 'none' : 'currentColor',
    strokeWidth: 1.75, strokeLinecap: 'round', strokeLinejoin: 'round',
  }, parts.map((p, i) =>
    p.c ? h('circle', { key: i, cx: p.c[0], cy: p.c[1], r: p.c[2] })
        : h('path',   { key: i, d: p.s })
  ));
}

window.Icon = Icon;
