"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
// GHS CRM — Shared Components & Tokens
// All symbols exposed on window for cross-file use

var _React = React,
  useState = _React.useState,
  useEffect = _React.useEffect,
  useRef = _React.useRef,
  useCallback = _React.useCallback;

/* ── Design tokens (mirrors colors_and_type.css) ─────────────────────────── */
var T = {
  bg0: '#010C08',
  bg1: '#022118',
  bg2: '#063520',
  bg3: '#0F5030',
  bgInverse: '#F6F7EB',
  fg1: '#F6F7EB',
  fg2: 'rgba(246,247,235,0.72)',
  fg3: 'rgba(246,247,235,0.48)',
  fg4: 'rgba(246,247,235,0.28)',
  fgAccent: '#00D900',
  accent: '#00D900',
  accentHover: '#2BEA2B',
  accentPressed: '#00B300',
  accentGlow: '0 0 24px rgba(0,217,0,0.45)',
  danger: '#ff5a4d',
  warning: '#ffb020',
  success: '#00d900',
  info: '#bf63ff',
  stroke1: 'rgba(246,247,235,0.10)',
  stroke2: 'rgba(246,247,235,0.18)',
  strokeAccent: 'rgba(0,217,0,0.55)',
  glass: 'rgba(0,56,52,0.55)',
  fontDisplay: '"Clash Display", "Space Grotesk", sans-serif',
  fontBody: '"Manrope", ui-sans-serif, sans-serif'
};
var cutPath = function cutPath() {
  var c = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 14;
  return "polygon(".concat(c, "px 0,100% 0,100% calc(100% - ").concat(c, "px),calc(100% - ").concat(c, "px) 100%,0 100%,0 ").concat(c, "px)");
};
var accentEdge = function accentEdge() {
  var c = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 14;
  return {
    position: 'absolute',
    top: 0,
    left: 0,
    width: "".concat((c * 1.41).toFixed(1), "px"),
    height: '1px',
    background: T.accent,
    boxShadow: '0 0 10px rgba(0,217,0,0.7)',
    transformOrigin: '0 0',
    transform: 'rotate(-45deg) translate(0,-0.5px)',
    pointerEvents: 'none'
  };
};

/* ── Icons ────────────────────────────────────────────────────────────────── */
var PATHS = {
  dashboard: '<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/>',
  users: '<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
  building: '<path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z"/><path d="M6 12H4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/><path d="M18 9h2a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2h-2"/><path d="M10 6h4"/><path d="M10 10h4"/><path d="M10 14h4"/><path d="M10 18h4"/>',
  handshake: '<path d="m11 17 2 2a1 1 0 1 0 3-3"/><path d="m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4"/><path d="m21 3 1 11h-1"/><path d="M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3"/><path d="M3 4h8"/>',
  calculator: '<rect x="2" y="2" width="20" height="20" rx="2"/><path d="M8 6h.01M12 6h.01M16 6h.01M8 10h.01M12 10h.01M16 10h.01M8 14h.01M12 14h.01M16 14h.01M8 18h.01M12 18h.01"/>',
  "package": '<path d="m7.5 4.27 9 5.15"/><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/>',
  calendar: '<rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" x2="16" y1="2" y2="6"/><line x1="8" x2="8" y1="2" y2="6"/><line x1="3" x2="21" y1="10" y2="10"/>',
  clipboard: '<rect width="8" height="4" x="8" y="2" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/>',
  ticket: '<path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z"/><path d="M13 5v2M13 17v2M13 11v2"/>',
  filetext: '<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/>',
  barchart: '<line x1="18" x2="18" y1="20" y2="10"/><line x1="12" x2="12" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="14"/>',
  clock: '<circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>',
  settings: '<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>',
  plus: '<line x1="12" x2="12" y1="5" y2="19"/><line x1="5" x2="19" y1="12" y2="12"/>',
  minus: '<line x1="5" x2="19" y1="12" y2="12"/>',
  search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/>',
  x: '<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>',
  edit: '<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>',
  archive: '<polyline points="21 8 21 21 3 21 3 8"/><rect x="1" y="3" width="22" height="5"/><line x1="10" y1="12" x2="14" y2="12"/>',
  trash: '<polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',
  download: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>',
  send: '<line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/>',
  phone: '<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.69 13a19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 3.18 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9a16 16 0 0 0 6.29 6.29l.61-.61a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z"/>',
  mail: '<rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>',
  mappin: '<path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"/><circle cx="12" cy="10" r="3"/>',
  zap: '<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>',
  battery: '<rect x="1" y="6" width="18" height="12" rx="2"/><line x1="23" y1="13" x2="23" y2="11"/>',
  sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/>',
  check: '<polyline points="20 6 9 17 4 12"/>',
  chevronright: '<polyline points="9 18 15 12 9 6"/>',
  arrowright: '<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/>',
  filter: '<polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/>',
  moredots: '<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',
  refresh: '<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',
  tag: '<path d="M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z"/><path d="M7 7h.01"/>',
  trending: '<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/>',
  pin: '<path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1Z"/>',
  star: '<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>',
  info: '<circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/>',
  alert: '<circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>',
  eye: '<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/>',
  eyeoff: '<path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.53 13.53 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><path d="M14.12 14.12a3 3 0 1 1-4.24-4.24"/><line x1="2" y1="2" x2="22" y2="22"/>',
  unlock: '<rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/>',
  link: '<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',
  file: '<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/>',
  user: '<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',
  percent: '<line x1="19" y1="5" x2="5" y2="19"/><circle cx="6.5" cy="6.5" r="2.5"/><circle cx="17.5" cy="17.5" r="2.5"/>',
  list: '<line x1="8" x2="21" y1="6" y2="6"/><line x1="8" x2="21" y1="12" y2="12"/><line x1="8" x2="21" y1="18" y2="18"/><line x1="3" x2="3.01" y1="6" y2="6"/><line x1="3" x2="3.01" y1="12" y2="12"/><line x1="3" x2="3.01" y1="18" y2="18"/>',
  megaphone: '<path d="m3 11 18-5v12L3 14v-3z"/><path d="M11.6 16.8a3 3 0 1 1-5.8-1.6"/>',
  facebook: '<path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"/>',
  instagram: '<rect x="2" y="2" width="20" height="20" rx="5"/><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"/><line x1="17.5" y1="6.5" x2="17.51" y2="6.5"/>',
  tiktok: '<path d="M9 12a4 4 0 1 0 4 4V4a5 5 0 0 0 5 5"/>',
  linkedin: '<path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-4 0v7h-4v-7a6 6 0 0 1 6-6z"/><rect x="2" y="9" width="4" height="12"/><circle cx="4" cy="4" r="2"/>',
  sparkles: '<path d="M12 3l1.9 5.3L19 10l-5.1 1.7L12 17l-1.9-5.3L5 10l5.1-1.7L12 3z"/><path d="M19 17l.7 1.9 1.9.7-1.9.7L19 22l-.7-1.7-1.9-.7 1.9-.7z"/>',
  play: '<polygon points="6 4 20 12 6 20 6 4"/>',
  pause: '<rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/>',
  image: '<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="1.5"/><polyline points="21 15 16 10 5 21"/>',
  camera: '<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/>',
  video: '<polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/>',
  target: '<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',
  heart: '<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>',
  messagecircle: '<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>',
  bookmark: '<path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"/>',
  share: '<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/>',
  music: '<path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/>',
  robot: '<rect x="3" y="8" width="18" height="12" rx="2"/><circle cx="9" cy="14" r="1"/><circle cx="15" cy="14" r="1"/><path d="M12 8V4"/><circle cx="12" cy="3" r="1"/><path d="M8 20v2M16 20v2"/>',
  shield: '<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/>',
  upload: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/>',
  globe: '<circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>',
  copy: '<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>',
  lock: '<rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',
  usercheck: '<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="8.5" cy="7" r="4"/><polyline points="17 11 19 13 23 9"/>',
  userplus: '<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="8.5" cy="7" r="4"/><line x1="20" y1="8" x2="20" y2="14"/><line x1="23" y1="11" x2="17" y2="11"/>',
  chevrondown: '<polyline points="6 9 12 15 18 9"/>',
  chevronleft: '<polyline points="15 18 9 12 15 6"/>',
  chevronup: '<polyline points="18 15 12 9 6 15"/>',
  arrowupright: '<line x1="7" y1="17" x2="17" y2="7"/><polyline points="7 7 17 7 17 17"/>',
  external: '<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/>',
  bolt: '<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>',
  grid: '<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/>',
  wind: '<path d="M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2"/><path d="M9.6 4.6A2 2 0 1 1 11 8H2"/><path d="M12.6 19.4A2 2 0 1 0 14 16H2"/>',
  thermometer: '<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"/>',
  gauge: '<path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/>',
  wallet: '<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>',
  mic: '<path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="22"/>',
  undo: '<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 0 11H11"/>',
  micoff: '<line x1="2" y1="2" x2="22" y2="22"/><path d="M18.89 13.23A7 7 0 0 0 19 12v-2"/><path d="M5 10v2a7 7 0 0 0 12 5"/><path d="M15 9.34V5a3 3 0 0 0-5.68-1.33"/><path d="M9 9v3a3 3 0 0 0 5.12 2.12"/><line x1="12" y1="19" x2="12" y2="22"/>'
};
var Icon = function Icon(_ref) {
  var name = _ref.name,
    _ref$size = _ref.size,
    size = _ref$size === void 0 ? 16 : _ref$size,
    _ref$color = _ref.color,
    color = _ref$color === void 0 ? 'currentColor' : _ref$color,
    _ref$sw = _ref.sw,
    sw = _ref$sw === void 0 ? 1.5 : _ref$sw;
  return /*#__PURE__*/React.createElement("svg", {
    width: size,
    height: size,
    viewBox: "0 0 24 24",
    fill: "none",
    stroke: color,
    strokeWidth: sw,
    strokeLinecap: "round",
    strokeLinejoin: "round",
    style: {
      flexShrink: 0,
      display: 'block'
    },
    dangerouslySetInnerHTML: {
      __html: PATHS[name] || PATHS.alert
    }
  });
};

/* ── Button ───────────────────────────────────────────────────────────────── */
/* flush: 'start' | 'end' | 'both' — voor een ghost-knop tegen de rand van zijn kader. Een ghost-knop heeft geen
   zichtbaar vlak; zonder zijn binnenruimte aan die kant staan icoon en tekst gelijk met de rest van de inhoud. */
var Button = function Button(_ref2) {
  var children = _ref2.children,
    _ref2$variant = _ref2.variant,
    variant = _ref2$variant === void 0 ? 'secondary' : _ref2$variant,
    _ref2$size = _ref2.size,
    size = _ref2$size === void 0 ? 'md' : _ref2$size,
    onClick = _ref2.onClick,
    disabled = _ref2.disabled,
    style = _ref2.style,
    icon = _ref2.icon,
    fullWidth = _ref2.fullWidth,
    title = _ref2.title,
    flush = _ref2.flush;
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    hov = _useState2[0],
    setHov = _useState2[1];
  var sizes = {
    sm: {
      p: '7px 14px',
      fs: 12,
      cut: 8
    },
    md: {
      p: '9px 18px',
      fs: 13,
      cut: 10
    },
    lg: {
      p: '12px 24px',
      fs: 14,
      cut: 12
    }
  };
  var s = sizes[size];
  var _s$p$split = s.p.split(' '),
    _s$p$split2 = _slicedToArray(_s$p$split, 2),
    pv = _s$p$split2[0],
    ph = _s$p$split2[1];
  var pad = flush && variant === 'ghost' ? "".concat(pv, " ").concat(flush === 'end' || flush === 'both' ? 0 : ph, " ").concat(pv, " ").concat(flush === 'start' || flush === 'both' ? 0 : ph) : s.p;
  var vars = {
    primary: {
      background: hov ? 'linear-gradient(135deg,#A8FCA8 0%,#2BEA2B 45%,#00C000 100%)' : 'linear-gradient(135deg,#7DFA7D 0%,#00D900 45%,#009E00 100%)',
      color: '#010C08',
      filter: hov ? 'drop-shadow(0 0 12px rgba(0,217,0,0.5))' : 'none',
      transform: hov ? 'translateY(-1px)' : 'none'
    },
    // Beige — tweede in rang na de groene knop: bewerken, voorbeeld, versturen
    // naast een groene bevestiging, openen. Nooit twee groene knoppen in één rij.
    beige: {
      background: hov ? 'linear-gradient(180deg,#F6F7EB 0%,#E7E8D2 55%,#D8DABF 100%)' : 'linear-gradient(180deg,#EDEEDC 0%,#DEE0C6 55%,#CCCFAF 100%)',
      color: '#022118',
      transform: hov ? 'translateY(-1px)' : 'none',
      filter: hov ? 'drop-shadow(0 3px 10px rgba(246,247,235,0.22))' : 'none'
    },
    // Blauw — derde in rang: documenten en herhaalacties naast groen en beige.
    blauw: {
      background: hov ? 'rgba(0,170,255,0.20)' : 'rgba(0,170,255,0.12)',
      color: '#00aaff',
      border: '1px solid rgba(0,170,255,0.45)'
    },
    secondary: {
      background: hov ? 'rgba(246,247,235,0.12)' : 'rgba(246,247,235,0.07)',
      color: T.fg1,
      border: "1px solid ".concat(T.stroke1)
    },
    ghost: {
      background: 'transparent',
      color: hov ? T.fg1 : T.fg2
    },
    danger: {
      background: hov ? '#ff3d2e' : '#ff5a4d',
      color: '#fff'
    },
    accent: {
      background: 'transparent',
      color: T.accent,
      border: "1px solid rgba(0,217,0,0.35)"
    }
  };
  return /*#__PURE__*/React.createElement("button", {
    onClick: !disabled ? onClick : undefined,
    onMouseEnter: function onMouseEnter() {
      return setHov(true);
    },
    onMouseLeave: function onMouseLeave() {
      return setHov(false);
    },
    title: title || (typeof children === 'string' ? children : undefined),
    "data-ghs-btn": variant,
    "data-ghs-ico": icon && children && variant !== 'primary' && variant !== 'beige' ? '' : undefined,
    style: _objectSpread(_objectSpread({
      fontFamily: T.fontBody,
      fontWeight: 600,
      fontSize: s.fs,
      padding: pad,
      cursor: disabled ? 'default' : 'pointer',
      display: 'inline-flex',
      alignItems: 'center',
      gap: 7,
      border: 0,
      lineHeight: 1,
      whiteSpace: 'nowrap',
      transition: 'all 200ms cubic-bezier(0.22,1,0.36,1)',
      opacity: disabled ? 0.4 : 1,
      clipPath: cutPath(s.cut),
      width: fullWidth ? '100%' : undefined,
      justifyContent: fullWidth ? 'center' : undefined
    }, vars[variant]), style)
  }, icon && /*#__PURE__*/React.createElement(Icon, {
    name: icon,
    size: s.fs + 2,
    color: vars[variant].color || T.fg1
  }), children != null && children !== false ? /*#__PURE__*/React.createElement("span", {
    "data-ghs-btn-label": "",
    style: {
      display: 'contents'
    }
  }, children) : null);
};

/* ── Badge ────────────────────────────────────────────────────────────────── */
var Badge = function Badge(_ref3) {
  var children = _ref3.children,
    _ref3$type = _ref3.type,
    type = _ref3$type === void 0 ? 'default' : _ref3$type,
    dot = _ref3.dot;
  var map = {
    "default": {
      bg: T.bg2,
      c: T.fg2
    },
    success: {
      bg: 'rgba(0,217,0,0.14)',
      c: '#00D900'
    },
    warning: {
      bg: 'rgba(255,176,32,0.14)',
      c: '#ffb020'
    },
    danger: {
      bg: 'rgba(255,90,77,0.14)',
      c: '#ff5a4d'
    },
    info: {
      bg: 'rgba(191,99,255,0.14)',
      c: '#bf63ff'
    },
    accent: {
      bg: 'rgba(0,217,0,0.10)',
      c: '#00D900'
    },
    neutral: {
      bg: 'rgba(246,247,235,0.08)',
      c: T.fg2
    }
  };
  var _ref4 = map[type] || map["default"],
    bg = _ref4.bg,
    c = _ref4.c;
  return /*#__PURE__*/React.createElement("span", {
    style: {
      display: 'inline-flex',
      alignItems: 'center',
      gap: dot ? 5 : 4,
      padding: '3px 8px',
      background: bg,
      color: c,
      borderRadius: 4,
      fontFamily: T.fontBody,
      fontSize: 11,
      fontWeight: 600,
      letterSpacing: '0.04em',
      whiteSpace: 'nowrap'
    }
  }, dot && /*#__PURE__*/React.createElement("span", {
    style: {
      width: 5,
      height: 5,
      borderRadius: '50%',
      background: c,
      boxShadow: type === 'success' ? "0 0 5px ".concat(c) : 'none',
      flexShrink: 0
    }
  }), children);
};

/* ── KPI Card ─────────────────────────────────────────────────────────────── */
/* ── Paginalayout — één ritme voor elke module ────────────────────────────────
   Afstand tussen blokken op een pagina: 18px. Binnenmarge van de pagina: 24px.
   Tegels in een rij: 12px uit elkaar. Knoppen en velden in een werkbalk: 34px hoog.
   .ghs-stapel  = verticale stapel met vaste tussenruimte (marges van de kinderen tellen niet).
   .ghs-werkbalk = één rij bediening, alles even hoog en verticaal gecentreerd. */
var GHS_RITME = 18,
  GHS_RAND = 24,
  GHS_TEGEL_GAP = 12,
  GHS_BALK_H = 34;
if (typeof document !== 'undefined' && !document.getElementById('ghs-layout-css')) {
  var st = document.createElement('style');
  st.id = 'ghs-layout-css';
  st.textContent = ['.ghs-stapel{display:flex;flex-direction:column;gap:' + GHS_RITME + 'px}', '.ghs-stapel>*{margin-top:0!important;margin-bottom:0!important}', '.ghs-werkbalk{display:flex;align-items:center;gap:8px;flex-wrap:wrap}', '.ghs-werkbalk>*{margin-top:0!important;margin-bottom:0!important}', '.ghs-werkbalk>button,.ghs-werkbalk>select,.ghs-werkbalk>input,.ghs-werkbalk>.ghs-wb-h,.ghs-werkbalk>*>.ghs-wb-h{height:' + GHS_BALK_H + 'px;box-sizing:border-box}', '.ghs-werkbalk>select,.ghs-werkbalk>*>select{height:' + GHS_BALK_H + 'px;box-sizing:border-box;padding-top:0!important;padding-bottom:0!important}', '.ghs-werkbalk [data-ghs-zoekveld] input{padding-top:7px!important;padding-bottom:7px!important}', '.ghs-werkbalk .ghs-wb-zoek{flex:0 1 300px;min-width:200px}'].join('');
  document.head.appendChild(st);
}

/* De kerncijfertegel — overal dezelfde: icoon in een gekleurd vak, het getal in die kleur,
   het label eronder en eventueel een korte toelichting. */
var GhsKpi = function GhsKpi(_ref5) {
  var label = _ref5.label,
    value = _ref5.value,
    sub = _ref5.sub,
    color = _ref5.color,
    icon = _ref5.icon,
    accent = _ref5.accent,
    unit = _ref5.unit,
    delta = _ref5.delta,
    onClick = _ref5.onClick,
    title = _ref5.title,
    attrs = _ref5.attrs,
    aan = _ref5.aan;
  var kleur = color || T.fg1;
  var ico = /^#[0-9a-f]{6}$/i.test(kleur) && kleur.toLowerCase() !== '#f6f7eb' ? kleur : accent ? T.accent : '#a9b0a2';
  return /*#__PURE__*/React.createElement("div", _extends({
    "data-ghs-kpi": label,
    title: title,
    onClick: onClick
  }, attrs || {}, {
    style: {
      background: accent ? 'linear-gradient(160deg,#0f5030 0%,#063520 55%,#022118 100%)' : T.bg1,
      clipPath: cutPath(12),
      padding: '14px 16px',
      display: 'flex',
      alignItems: 'center',
      gap: 12,
      position: 'relative',
      minWidth: 0,
      cursor: onClick ? 'pointer' : 'default',
      boxShadow: aan ? "inset 0 0 0 1.5px ".concat(ico) : accent ? '0 0 24px rgba(0,217,0,0.10)' : 'none'
    }
  }), accent && /*#__PURE__*/React.createElement("div", {
    style: accentEdge(12)
  }), icon && /*#__PURE__*/React.createElement("span", {
    style: {
      width: 34,
      height: 34,
      clipPath: cutPath(6),
      background: "".concat(ico, "1a"),
      border: "1px solid ".concat(ico, "55"),
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      flexShrink: 0
    }
  }, /*#__PURE__*/React.createElement(Icon, {
    name: icon,
    size: 15,
    color: ico
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      minWidth: 0
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      fontFamily: T.fontDisplay,
      fontSize: 20,
      fontWeight: 700,
      color: kleur,
      lineHeight: 1.1,
      whiteSpace: 'nowrap',
      overflow: 'hidden',
      textOverflow: 'ellipsis',
      fontVariantNumeric: 'tabular-nums'
    }
  }, value, unit && /*#__PURE__*/React.createElement("span", {
    style: {
      fontFamily: T.fontBody,
      fontSize: 11,
      fontWeight: 600,
      color: T.fg3,
      marginLeft: 4
    }
  }, unit)), /*#__PURE__*/React.createElement("div", {
    style: {
      fontFamily: T.fontBody,
      fontSize: 11,
      fontWeight: 600,
      color: T.fg2,
      marginTop: 3,
      lineHeight: 1.25,
      whiteSpace: 'nowrap',
      overflow: 'hidden',
      textOverflow: 'ellipsis'
    }
  }, label), (sub || delta != null) && /*#__PURE__*/React.createElement("div", {
    style: {
      fontFamily: T.fontBody,
      fontSize: 10,
      color: T.fg4,
      lineHeight: 1.3,
      marginTop: 1,
      whiteSpace: 'nowrap',
      overflow: 'hidden',
      textOverflow: 'ellipsis'
    }
  }, delta != null && /*#__PURE__*/React.createElement("span", {
    style: {
      color: delta >= 0 ? T.accent : T.danger,
      fontWeight: 700
    }
  }, delta >= 0 ? '↑' : '↓', " ", String(Math.abs(delta)).replace('.', ','), "%"), delta != null && sub == null ? ' vs vorige maand' : null, delta != null && sub ? ' · ' : null, sub)));
};
/* De rij kerncijfers bovenaan een module. */
var GhsKpiRij = function GhsKpiRij(_ref6) {
  var children = _ref6.children,
    _ref6$min = _ref6.min,
    min = _ref6$min === void 0 ? 190 : _ref6$min,
    attrs = _ref6.attrs;
  return /*#__PURE__*/React.createElement("div", _extends({
    "data-ghs-kpi-rij": ""
  }, attrs || {}, {
    style: {
      display: 'grid',
      gridTemplateColumns: "repeat(auto-fit,minmax(".concat(min, "px,1fr))"),
      gap: GHS_TEGEL_GAP
    }
  }), children);
};
/* Oude naam, zelfde tegel. */
var KPICard = function KPICard(_ref7) {
  var label = _ref7.label,
    value = _ref7.value,
    unit = _ref7.unit,
    delta = _ref7.delta,
    icon = _ref7.icon,
    accent = _ref7.accent,
    sub = _ref7.sub,
    color = _ref7.color;
  return /*#__PURE__*/React.createElement(GhsKpi, {
    label: label,
    value: value,
    unit: unit,
    delta: delta,
    icon: icon,
    accent: accent,
    sub: sub,
    color: color
  });
};

/* Eén keuze uit enkele (weergave of filter): een rij segmenten in een vak.
   opties: [{ id, label, icon, n, title }] of [id, label, n]. In een werkbalk 34px hoog. */
var GhsKeuze = function GhsKeuze(_ref8) {
  var opties = _ref8.opties,
    waarde = _ref8.waarde,
    onKies = _ref8.onKies,
    attrs = _ref8.attrs,
    klein = _ref8.klein;
  var h = klein ? 28 : GHS_BALK_H;
  return /*#__PURE__*/React.createElement("div", _extends({
    role: "radiogroup",
    className: "ghs-wb-h"
  }, attrs || {}, {
    style: {
      display: 'inline-flex',
      alignItems: 'stretch',
      gap: 2,
      padding: 2,
      height: h,
      boxSizing: 'border-box',
      background: T.bg0,
      border: "1px solid ".concat(T.stroke1),
      borderRadius: 4,
      flexShrink: 0
    }
  }), (opties || []).map(function (o) {
    var x = Array.isArray(o) ? {
      id: o[0],
      label: o[1],
      n: o[2]
    } : o;
    var on = waarde === x.id;
    return /*#__PURE__*/React.createElement("button", {
      key: x.id,
      type: "button",
      role: "radio",
      "aria-checked": on,
      "data-ghs-keuze": x.id,
      disabled: !!x.uit,
      title: x.uit ? x.waarom || x.title : x.title,
      onClick: function onClick() {
        if (!x.uit) onKies(x.id);
      },
      style: {
        display: 'inline-flex',
        alignItems: 'center',
        gap: 6,
        padding: '0 11px',
        border: 'none',
        borderRadius: 3,
        cursor: x.uit ? 'default' : 'pointer',
        whiteSpace: 'nowrap',
        background: on ? 'rgba(0,217,0,0.14)' : 'transparent',
        boxShadow: on ? 'inset 0 0 0 1px rgba(0,217,0,0.40)' : 'none',
        color: on ? T.accent : x.uit ? T.fg4 : T.fg2,
        fontFamily: T.fontBody,
        fontSize: 12,
        fontWeight: on ? 700 : 600,
        transition: 'background 120ms, color 120ms'
      },
      onMouseEnter: function onMouseEnter(e) {
        if (!on && !x.uit) e.currentTarget.style.color = T.fg1;
      },
      onMouseLeave: function onMouseLeave(e) {
        if (!on && !x.uit) e.currentTarget.style.color = T.fg2;
      }
    }, x.icon && /*#__PURE__*/React.createElement(Icon, {
      name: x.icon,
      size: 12,
      color: on ? T.accent : T.fg3
    }), x.voor, x.label, x.n != null && /*#__PURE__*/React.createElement("span", {
      style: {
        fontVariantNumeric: 'tabular-nums',
        fontWeight: 700,
        color: on ? 'rgba(0,217,0,0.75)' : T.fg3
      }
    }, x.n));
  }));
};

/* ── Card ─────────────────────────────────────────────────────────────────── */
var Card = function Card(_ref9) {
  var children = _ref9.children,
    style = _ref9.style,
    _ref9$p = _ref9.p,
    p = _ref9$p === void 0 ? 20 : _ref9$p,
    accent = _ref9.accent,
    onClick = _ref9.onClick,
    raised = _ref9.raised;
  return /*#__PURE__*/React.createElement("div", {
    onClick: onClick,
    style: _objectSpread({
      background: raised ? T.bg2 : T.bg1,
      backgroundImage: raised ? 'linear-gradient(180deg,rgba(246,247,235,0.04),rgba(246,247,235,0))' : undefined,
      padding: p,
      clipPath: cutPath(14),
      position: 'relative',
      cursor: onClick ? 'pointer' : 'default'
    }, style)
  }, accent && /*#__PURE__*/React.createElement("div", {
    style: accentEdge(14)
  }), children);
};

/* ── Input ────────────────────────────────────────────────────────────────── */
var Input = function Input(_ref0) {
  var label = _ref0.label,
    value = _ref0.value,
    _onChange = _ref0.onChange,
    placeholder = _ref0.placeholder,
    _ref0$type = _ref0.type,
    type = _ref0$type === void 0 ? 'text' : _ref0$type,
    suffix = _ref0.suffix,
    prefix = _ref0.prefix,
    required = _ref0.required,
    style = _ref0.style,
    readOnly = _ref0.readOnly,
    min = _ref0.min,
    max = _ref0.max,
    wisbaar = _ref0.wisbaar;
  // Datum en uur: eigen veld in huisstijl i.p.v. de niet-stijlbare browserpop-up.
  if (type === 'date' && window.GhsDatumVeld && !readOnly) return /*#__PURE__*/React.createElement(window.GhsDatumVeld, {
    label: label,
    value: value,
    onChange: _onChange,
    style: style,
    min: min,
    max: max,
    wisbaar: wisbaar,
    leeg: placeholder || undefined
  });
  if (type === 'time' && window.GhsTijdVeld && !readOnly) return /*#__PURE__*/React.createElement(window.GhsTijdVeld, {
    label: label,
    value: value,
    onChange: _onChange,
    style: style
  });
  return /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      flexDirection: 'column',
      gap: 5
    }
  }, label && /*#__PURE__*/React.createElement("label", {
    style: {
      fontFamily: T.fontBody,
      fontSize: 10,
      fontWeight: 700,
      letterSpacing: '0.14em',
      textTransform: 'uppercase',
      color: T.fg3
    }
  }, label, required && /*#__PURE__*/React.createElement("span", {
    style: {
      color: T.accent
    }
  }, " *")), /*#__PURE__*/React.createElement("div", {
    style: {
      position: 'relative',
      display: 'flex',
      alignItems: 'center'
    }
  }, prefix && /*#__PURE__*/React.createElement("span", {
    style: {
      position: 'absolute',
      left: 10,
      color: T.fg3,
      fontSize: 12,
      fontWeight: 600,
      pointerEvents: 'none'
    }
  }, prefix), /*#__PURE__*/React.createElement("input", {
    type: type,
    value: value,
    onChange: function onChange(e) {
      return _onChange && _onChange(e.target.value);
    },
    placeholder: placeholder,
    readOnly: readOnly,
    style: _objectSpread({
      width: '100%',
      background: T.bg0,
      border: "1px solid ".concat(T.stroke1),
      borderRadius: 4,
      padding: "9px ".concat(suffix ? 36 : 12, "px 9px ").concat(prefix ? 28 : 12, "px"),
      color: T.fg1,
      fontFamily: T.fontBody,
      fontSize: 13,
      outline: 'none',
      boxSizing: 'border-box'
    }, style)
  }), suffix && /*#__PURE__*/React.createElement("span", {
    style: {
      position: 'absolute',
      right: 10,
      color: T.fg3,
      fontSize: 12,
      fontWeight: 600,
      pointerEvents: 'none'
    }
  }, suffix)));
};

/* ── Select ───────────────────────────────────────────────────────────────
   Overal hetzelfde veld: klikken opent de lijst, typen filtert, Enter kiest de
   bovenste, Esc sluit. De lijst hangt in een laag boven de pagina (dus nooit
   afgesneden door een kaart) en toont zes regels, daarna scrollen. */
var GhsSelect = function GhsSelect(_ref1) {
  var label = _ref1.label,
    value = _ref1.value,
    _onChange2 = _ref1.onChange,
    options = _ref1.options,
    style = _ref1.style,
    _ref1$searchable = _ref1.searchable,
    searchable = _ref1$searchable === void 0 ? true : _ref1$searchable;
  var _React$useState = React.useState(false),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    open = _React$useState2[0],
    setOpen = _React$useState2[1];
  var _React$useState3 = React.useState(''),
    _React$useState4 = _slicedToArray(_React$useState3, 2),
    q = _React$useState4[0],
    setQ = _React$useState4[1];
  var _React$useState5 = React.useState(null),
    _React$useState6 = _slicedToArray(_React$useState5, 2),
    rect = _React$useState6[0],
    setRect = _React$useState6[1];
  var box = React.useRef(null);
  var veldRef = React.useRef(null);
  var meet = React.useCallback(function () {
    if (veldRef.current) setRect(veldRef.current.getBoundingClientRect());
  }, []);
  React.useEffect(function () {
    if (!open) return;
    meet();
    var down = function down(e) {
      if (box.current && !box.current.contains(e.target) && !(e.target.closest && e.target.closest('[data-ghs-drop]'))) {
        setOpen(false);
        setQ('');
      }
    };
    var key = function key(e) {
      if (e.key === 'Escape') {
        setOpen(false);
        setQ('');
      }
    };
    window.addEventListener('mousedown', down);
    window.addEventListener('keydown', key);
    window.addEventListener('scroll', meet, true);
    window.addEventListener('resize', meet);
    return function () {
      window.removeEventListener('mousedown', down);
      window.removeEventListener('keydown', key);
      window.removeEventListener('scroll', meet, true);
      window.removeEventListener('resize', meet);
    };
  }, [open, meet]);
  var cur = (options || []).find(function (o) {
    return String(o.value) === String(value);
  });
  var veld = _objectSpread({
    background: T.bg0,
    border: "1px solid ".concat(open ? T.accent : T.stroke1),
    borderRadius: 4,
    padding: '9px 32px 9px 12px',
    color: T.fg1,
    fontFamily: T.fontBody,
    fontSize: 13,
    outline: 'none',
    cursor: 'pointer',
    appearance: 'none',
    width: '100%',
    boxSizing: 'border-box',
    backgroundImage: "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(246,247,235,0.48)' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E\")",
    backgroundRepeat: 'no-repeat',
    backgroundPosition: 'right 10px center'
  }, style);
  if (!searchable) return /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      flexDirection: 'column',
      gap: 5
    }
  }, label && /*#__PURE__*/React.createElement("label", {
    style: {
      fontFamily: T.fontBody,
      fontSize: 10,
      fontWeight: 700,
      letterSpacing: '0.14em',
      textTransform: 'uppercase',
      color: T.fg3
    }
  }, label), /*#__PURE__*/React.createElement("select", {
    value: value,
    onChange: function onChange(e) {
      return _onChange2(e.target.value);
    },
    style: veld
  }, (options || []).map(function (o) {
    return /*#__PURE__*/React.createElement("option", {
      key: o.value,
      value: o.value
    }, o.label);
  })));
  var term = q.trim().toLowerCase();
  var res = (options || []).filter(function (o) {
    return !term || term.split(/\s+/).every(function (t) {
      return String(o.label).toLowerCase().includes(t);
    });
  });
  var kies = function kies(o) {
    _onChange2(o.value);
    setOpen(false);
    setQ('');
  };
  var RIJ = 34,
    MAX = RIJ * 6 + 2;
  var naarBoven = rect && window.innerHeight - rect.bottom < Math.min(MAX, res.length * RIJ) + 16 && rect.top > window.innerHeight - rect.bottom;
  var lijst = open && rect ? ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", {
    "data-ghs-drop": "1",
    style: _objectSpread(_objectSpread({
      position: 'fixed',
      left: rect.left,
      width: rect.width,
      zIndex: 4000
    }, naarBoven ? {
      bottom: window.innerHeight - rect.top + 4
    } : {
      top: rect.bottom + 4
    }), {}, {
      filter: 'drop-shadow(0 14px 26px rgba(0,0,0,0.55))'
    })
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      maxHeight: MAX,
      overflowY: 'auto',
      background: T.bg1,
      border: "1px solid ".concat(T.accent),
      clipPath: cutPath(8),
      padding: 4,
      boxSizing: 'border-box'
    }
  }, res.map(function (o) {
    return /*#__PURE__*/React.createElement("button", {
      key: o.value,
      onClick: function onClick() {
        return kies(o);
      },
      style: {
        display: 'block',
        width: '100%',
        height: RIJ,
        textAlign: 'left',
        padding: '0 12px',
        background: String(o.value) === String(value) ? 'rgba(0,217,0,0.10)' : 'transparent',
        border: 'none',
        borderBottom: "1px solid ".concat(T.stroke1),
        cursor: 'pointer',
        color: String(o.value) === String(value) ? T.accent : T.fg1,
        fontFamily: T.fontBody,
        fontSize: 12.5,
        whiteSpace: 'nowrap',
        overflow: 'hidden',
        textOverflow: 'ellipsis'
      }
    }, o.label);
  }), !res.length && /*#__PURE__*/React.createElement("div", {
    style: {
      padding: '13px 12px',
      fontFamily: T.fontBody,
      fontSize: 12,
      color: T.fg4
    }
  }, "Niets gevonden voor \u201C", q, "\u201D."))), document.body) : null;
  return /*#__PURE__*/React.createElement("div", {
    ref: box,
    style: {
      display: 'flex',
      flexDirection: 'column',
      gap: 5,
      position: 'relative'
    }
  }, label && /*#__PURE__*/React.createElement("label", {
    style: {
      fontFamily: T.fontBody,
      fontSize: 10,
      fontWeight: 700,
      letterSpacing: '0.14em',
      textTransform: 'uppercase',
      color: T.fg3
    }
  }, label), /*#__PURE__*/React.createElement("input", {
    ref: veldRef,
    value: open ? q : cur ? cur.label : '',
    placeholder: cur ? cur.label : 'Kies of typ…',
    onFocus: function onFocus() {
      setOpen(true);
      meet();
    },
    onClick: function onClick() {
      setOpen(true);
      meet();
    },
    onChange: function onChange(e) {
      setQ(e.target.value);
      setOpen(true);
    },
    onKeyDown: function onKeyDown(e) {
      if (e.key === 'Enter' && res.length) {
        e.preventDefault();
        kies(res[0]);
      }
    },
    style: _objectSpread(_objectSpread({}, veld), {}, {
      cursor: 'text'
    })
  }), lijst);
};

/* ── Modal ────────────────────────────────────────────────────────────────── */
/* Overlays altijd bovenop de hele app renderen — de contactfiche gebruikt
   backdrop-filter, waardoor een position:fixed kind anders in die laag vastzit
   en door de fiche wordt afgesneden. */
var GhsPortal = function GhsPortal(_ref10) {
  var children = _ref10.children;
  return window.ReactDOM && ReactDOM.createPortal ? ReactDOM.createPortal(children, document.body) : children;
};

/* Kopknoppen van overlays: geel-oranje = minimaliseren, rood = sluiten. */
var OVL_BTN = function OVL_BTN(tint) {
  return {
    width: 36,
    height: 36,
    flexShrink: 0,
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
    background: "".concat(tint, "1a"),
    border: "1px solid ".concat(tint, "61"),
    clipPath: cutPath(7),
    cursor: 'pointer',
    color: tint,
    padding: 0
  };
};
var OVL_AMBER = '#ffb020',
  OVL_RED = '#ff5a4d';

/* Dialoog: kop met titel en knoppen (boven en onder even veel ruimte), daaronder de inhoud die
   zelf scrolt — de kop blijft staan. Onderaan blijft de strook van de dock vrij. */
var Modal = function Modal(_ref11) {
  var open = _ref11.open,
    onClose = _ref11.onClose,
    title = _ref11.title,
    children = _ref11.children,
    _ref11$width = _ref11.width,
    width = _ref11$width === void 0 ? 580 : _ref11$width,
    onMinimize = _ref11.onMinimize;
  if (!open) return null;
  return /*#__PURE__*/React.createElement(GhsPortal, null, /*#__PURE__*/React.createElement("div", {
    onMouseDown: function onMouseDown(e) {
      return e.target === e.currentTarget && onClose();
    },
    style: {
      position: 'fixed',
      inset: 0,
      background: 'rgba(1,12,8,0.88)',
      backdropFilter: 'blur(4px)',
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      zIndex: 3000,
      padding: '20px 20px calc(20px + var(--ghs-dock, 0px))',
      boxSizing: 'border-box'
    }
  }, /*#__PURE__*/React.createElement("div", {
    role: "dialog",
    "aria-modal": "true",
    "aria-label": typeof title === 'string' && title ? title : undefined,
    "data-ghs-modal": "",
    style: {
      background: T.bg1,
      border: "1px solid ".concat(T.stroke2),
      clipPath: cutPath(16),
      width: Math.min(width, window.innerWidth - 40),
      maxWidth: '100%',
      maxHeight: '100%',
      display: 'flex',
      flexDirection: 'column',
      position: 'relative',
      boxSizing: 'border-box',
      boxShadow: '0 44px 96px -28px rgba(0,0,0,0.85)'
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: accentEdge(16)
  }), /*#__PURE__*/React.createElement("div", {
    "data-ghs-modal-kop": "",
    style: {
      padding: '16px 22px',
      display: 'flex',
      alignItems: 'center',
      gap: 12,
      borderBottom: "1px solid ".concat(T.stroke1),
      flexShrink: 0
    }
  }, /*#__PURE__*/React.createElement("h3", {
    style: {
      margin: 0,
      flex: 1,
      fontFamily: T.fontDisplay,
      fontSize: 17,
      fontWeight: 600,
      letterSpacing: '-0.02em',
      color: T.fg1,
      minWidth: 0,
      overflow: 'hidden',
      textOverflow: 'ellipsis',
      whiteSpace: 'nowrap'
    }
  }, title), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      alignItems: 'center',
      gap: 10,
      flexShrink: 0
    }
  }, onMinimize && /*#__PURE__*/React.createElement("button", {
    type: "button",
    onClick: onMinimize,
    title: "Minimaliseren",
    "aria-label": "Minimaliseren",
    style: OVL_BTN(OVL_AMBER)
  }, /*#__PURE__*/React.createElement("svg", {
    width: "17",
    height: "17",
    viewBox: "0 0 24 24",
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "2.2",
    strokeLinecap: "round"
  }, /*#__PURE__*/React.createElement("path", {
    d: "M6 15h12"
  }))), /*#__PURE__*/React.createElement("button", {
    type: "button",
    onClick: onClose,
    title: "Sluiten",
    "aria-label": "Sluiten",
    style: OVL_BTN(OVL_RED)
  }, /*#__PURE__*/React.createElement(Icon, {
    name: "x",
    size: 17,
    color: "currentColor"
  })))), /*#__PURE__*/React.createElement("div", {
    "data-ghs-modal-inhoud": "",
    style: {
      padding: 22,
      overflowY: 'auto',
      minHeight: 0,
      flex: '0 1 auto'
    }
  }, children))));
};

/* ── Table ────────────────────────────────────────────────────────────────── */
var SortIcon = function SortIcon(_ref12) {
  var active = _ref12.active,
    dir = _ref12.dir;
  return /*#__PURE__*/React.createElement("span", {
    style: {
      display: 'inline-flex',
      flexDirection: 'column',
      gap: 1,
      marginLeft: 4,
      verticalAlign: 'middle',
      opacity: active ? 1 : 0.3
    }
  }, /*#__PURE__*/React.createElement("svg", {
    width: "7",
    height: "5",
    viewBox: "0 0 7 5",
    fill: active && dir === 'asc' ? T.accent : T.fg3
  }, /*#__PURE__*/React.createElement("path", {
    d: "M3.5 0L7 5H0z"
  })), /*#__PURE__*/React.createElement("svg", {
    width: "7",
    height: "5",
    viewBox: "0 0 7 5",
    fill: active && dir === 'desc' ? T.accent : T.fg3
  }, /*#__PURE__*/React.createElement("path", {
    d: "M3.5 5L0 0h7z"
  })));
};
var GhsTable = function GhsTable(_ref13) {
  var columns = _ref13.columns,
    rows = _ref13.rows,
    onRow = _ref13.onRow,
    _ref13$empty = _ref13.empty,
    empty = _ref13$empty === void 0 ? 'Geen items.' : _ref13$empty,
    sortKey = _ref13.sortKey,
    sortDir = _ref13.sortDir,
    onSort = _ref13.onSort,
    nowrap = _ref13.nowrap;
  return /*#__PURE__*/React.createElement("div", {
    style: {
      width: '100%',
      overflowX: 'auto'
    }
  }, /*#__PURE__*/React.createElement("table", {
    style: {
      width: nowrap ? 'auto' : '100%',
      minWidth: '100%',
      borderCollapse: 'collapse',
      fontFamily: T.fontBody
    }
  }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, columns.map(function (c) {
    var sortable = onSort && c.sortable !== false && !c.always;
    var isActive = sortKey === c.key;
    return /*#__PURE__*/React.createElement("th", {
      key: c.key,
      onClick: function onClick() {
        return sortable && onSort(c.key);
      },
      style: {
        textAlign: c.align || 'left',
        padding: '14px 18px 13px',
        fontSize: 9.5,
        fontWeight: 700,
        letterSpacing: '0.18em',
        textTransform: 'uppercase',
        color: isActive ? T.accent : T.fg3,
        borderBottom: "1px solid ".concat(T.stroke2),
        whiteSpace: 'nowrap',
        cursor: sortable ? 'pointer' : 'default',
        userSelect: 'none',
        transition: 'color 140ms'
      },
      onMouseEnter: function onMouseEnter(e) {
        if (sortable) e.currentTarget.style.color = T.fg1;
      },
      onMouseLeave: function onMouseLeave(e) {
        e.currentTarget.style.color = isActive ? T.accent : T.fg3;
      }
    }, c.label, sortable && /*#__PURE__*/React.createElement(SortIcon, {
      active: isActive,
      dir: sortDir
    }));
  }))), /*#__PURE__*/React.createElement("tbody", null, rows.length === 0 ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
    colSpan: columns.length,
    style: {
      padding: '34px 18px',
      textAlign: 'center',
      color: T.fg3,
      fontSize: 13
    }
  }, empty)) : rows.map(function (row, i) {
    return /*#__PURE__*/React.createElement("tr", {
      key: row.id || i,
      "data-ghs-row": row.id,
      onClick: function onClick() {
        return onRow && onRow(row);
      },
      style: {
        background: i % 2 === 0 ? 'transparent' : 'rgba(246,247,235,0.015)',
        cursor: onRow ? 'pointer' : 'default',
        transition: 'background 140ms'
      },
      onMouseEnter: function onMouseEnter(e) {
        return onRow && (e.currentTarget.style.background = T.bg2);
      },
      onMouseLeave: function onMouseLeave(e) {
        return e.currentTarget.style.background = i % 2 === 0 ? 'transparent' : 'rgba(246,247,235,0.015)';
      }
    }, columns.map(function (c) {
      return /*#__PURE__*/React.createElement("td", {
        key: c.key,
        style: {
          padding: '15px 18px',
          fontSize: 13,
          color: T.fg1,
          borderBottom: "1px solid ".concat(T.stroke1),
          textAlign: c.align || 'left',
          whiteSpace: nowrap ? 'nowrap' : undefined
        }
      }, c.render ? c.render(row[c.key], row) : row[c.key]);
    }));
  }))));
};

/* ── Misc helpers ─────────────────────────────────────────────────────────── */
var SectionTitle = function SectionTitle(_ref14) {
  var title = _ref14.title,
    sub = _ref14.sub,
    action = _ref14.action;
  return /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      justifyContent: 'space-between',
      alignItems: 'flex-end',
      marginBottom: 18
    }
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", {
    style: {
      margin: 0,
      fontFamily: T.fontDisplay,
      fontSize: 20,
      fontWeight: 600,
      letterSpacing: '-0.02em',
      color: T.fg1
    }
  }, title), sub && /*#__PURE__*/React.createElement("p", {
    style: {
      margin: '3px 0 0',
      fontSize: 12,
      color: T.fg3,
      fontFamily: T.fontBody
    }
  }, sub)), action);
};
var Avatar = function Avatar(_ref15) {
  var _ref15$name = _ref15.name,
    name = _ref15$name === void 0 ? '?' : _ref15$name,
    _ref15$size = _ref15.size,
    size = _ref15$size === void 0 ? 32 : _ref15$size;
  var initials = (name || '?').split(' ').map(function (n) {
    return n[0];
  }).join('').slice(0, 2).toUpperCase();
  var colors = ['#0F5030', '#1E7040', '#063520', '#004A45', '#0a3520'];
  var bg = colors[(name.charCodeAt(0) || 0) % colors.length];
  return /*#__PURE__*/React.createElement("div", {
    style: {
      width: size,
      height: size,
      borderRadius: '50%',
      background: bg,
      border: "1px solid rgba(0,217,0,0.2)",
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      fontFamily: T.fontDisplay,
      fontSize: size * 0.33,
      fontWeight: 600,
      color: T.fg1,
      flexShrink: 0
    }
  }, initials);
};
var Dot = function Dot(_ref16) {
  var _ref16$status = _ref16.status,
    status = _ref16$status === void 0 ? 'default' : _ref16$status;
  var cols = {
    active: T.accent,
    inactive: T.fg4,
    warning: '#ffb020',
    danger: '#ff5a4d',
    pending: '#bf63ff'
  };
  var c = cols[status] || T.fg3;
  return /*#__PURE__*/React.createElement("span", {
    style: {
      display: 'inline-block',
      width: 7,
      height: 7,
      borderRadius: '50%',
      background: c,
      boxShadow: status === 'active' ? "0 0 7px ".concat(c) : 'none',
      flexShrink: 0
    }
  });
};
var AccentLine = function AccentLine() {
  return /*#__PURE__*/React.createElement("div", {
    style: {
      height: 1,
      background: 'linear-gradient(90deg,transparent,#00D900 50%,transparent)',
      margin: '2px 0'
    }
  });
};

/* Zoekbalk — merkvorm (gesneden hoek) met de fade-divider uit de designfile:
   de lijn onder het veld licht accentgroen op zodra je typt of focust. */
var SearchBar = function SearchBar(_ref17) {
  var value = _ref17.value,
    _onChange3 = _ref17.onChange,
    _ref17$placeholder = _ref17.placeholder,
    placeholder = _ref17$placeholder === void 0 ? 'Zoeken...' : _ref17$placeholder;
  var _useState3 = useState(false),
    _useState4 = _slicedToArray(_useState3, 2),
    foc = _useState4[0],
    setFoc = _useState4[1];
  var on = foc || !!value;
  return /*#__PURE__*/React.createElement("div", {
    "data-ghs-zoekveld": "",
    style: {
      display: 'flex',
      flexDirection: 'column',
      width: '100%'
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      position: 'relative',
      display: 'flex',
      alignItems: 'center',
      background: on ? 'rgba(0,217,0,0.05)' : T.bg0,
      border: "1px solid ".concat(on ? T.strokeAccent : T.stroke2),
      clipPath: cutPath(9),
      transition: 'background 180ms, border-color 180ms'
    }
  }, /*#__PURE__*/React.createElement("span", {
    style: {
      position: 'absolute',
      left: 11,
      pointerEvents: 'none',
      display: 'flex'
    }
  }, /*#__PURE__*/React.createElement(Icon, {
    name: "search",
    size: 14,
    color: on ? T.accent : T.fg3
  })), /*#__PURE__*/React.createElement("input", {
    value: value,
    onChange: function onChange(e) {
      return _onChange3(e.target.value);
    },
    placeholder: placeholder,
    onFocus: function onFocus() {
      return setFoc(true);
    },
    onBlur: function onBlur() {
      return setFoc(false);
    },
    style: {
      background: 'transparent',
      border: 0,
      padding: '9px 30px 9px 35px',
      color: T.fg1,
      fontFamily: T.fontBody,
      fontSize: 13,
      fontWeight: 500,
      outline: 'none',
      width: '100%'
    }
  }), !!value && /*#__PURE__*/React.createElement("button", {
    onClick: function onClick() {
      return _onChange3('');
    },
    title: "Zoekterm wissen",
    style: {
      position: 'absolute',
      right: 7,
      display: 'flex',
      background: 'none',
      border: 'none',
      cursor: 'pointer',
      color: T.fg3,
      padding: 3
    }
  }, /*#__PURE__*/React.createElement(Icon, {
    name: "x",
    size: 12
  }))), /*#__PURE__*/React.createElement("div", {
    style: {
      height: 1,
      background: on ? 'linear-gradient(90deg,transparent,#00D900 50%,transparent)' : 'linear-gradient(90deg,transparent,rgba(246,247,235,0.16) 50%,transparent)',
      transition: 'background 220ms'
    }
  }));
};

/* ── CRM-brede zoekfunctie — zoekt over contacten, deals, opmetingen, planning,
   werkbonnen, facturatie en tickets; klik opent de juiste tab in de contactfiche. */
/* ── Volgorde van een knoppengroep — één bron voor de hele app ───────────────
   Denk in een reeks die begint aan de kant waar de groep uitlijnt:
     positie 1 = de belangrijkste actie en ligt tegen die rand,
     daarna volgt positie 2, 3 … naar binnen toe.
   Rang bepaalt de reeks: gekleurd (primary/danger) → beige/secondary → ghost.
   Binnen dezelfde rang komt het langste label eerst en het kortste laatst.
   Rechts uitgelijnd staat de reeks dus gespiegeld in de DOM: de smalste ghost
   uiterst links, de gekleurde knop tegen de rechterrand. */
var _knopTekst = function _knopTekst(el) {
  var uit = [];
  var _loop = function loop(k) {
    if (k == null || k === false || k === true) return;
    if (typeof k === 'string' || typeof k === 'number') {
      uit.push(String(k));
      return;
    }
    if (Array.isArray(k)) {
      k.forEach(_loop);
      return;
    }
    if (k.props && k.props.children !== undefined) _loop(k.props.children);
  };
  _loop(el && el.props ? el.props.children : null);
  return uit.join(' ').trim();
};
var ghsKnopRang = function ghsKnopRang(el) {
  var p = el && el.props || {};
  /* Knoppen met een eigen stijl (geen variant-prop) geven hun rang mee via
     data-rang, zodat ze dezelfde volgorde volgen als de rest. */
  if (p['data-rang'] != null) return Number(p['data-rang']) || 0;
  /* Reeks: groen (2) → beige (1) → blauw (0.5) → ghost (0). Blauw is een
     derde-orde actie en komt dus nooit tussen groen en beige. */
  var v = p.variant || null;
  if (v === 'primary' || v === 'danger') return 2;
  if (v === 'beige' || v === 'secondary') return 1;
  if (v === 'blauw') return 0.5;
  return 0; // ghost-knoppen en losse meldingen
};
/* opties.rand: staat er een ghost-knop tegen de rand van de rij, dan valt zijn onzichtbare
   binnenruimte aan die kant weg (flush) — zo lijnt zijn tekst uit met de inhoud erboven.
   Enkel waar de rij zelf binnenruimte heeft (een kaart of lijstrij met padding). */
var ghsKnopRand = function ghsKnopRand(el, kant) {
  return el && React.isValidElement(el) && el.type === Button && el.props.variant === 'ghost' && !el.props.flush ? React.cloneElement(el, {
    flush: kant
  }) : el;
};
var ghsKnopVolgorde = function ghsKnopVolgorde(kids) {
  var uitlijnen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex-end';
  var opties = arguments.length > 2 ? arguments[2] : undefined;
  var links = String(uitlijnen || '').indexOf('start') >= 0 || uitlijnen === 'left';
  /* De reeks zelf: belangrijkste eerst, binnen dezelfde rang het langste label eerst. */
  var reeks = (Array.isArray(kids) ? kids : [kids]).filter(Boolean).map(function (el, i) {
    return {
      el: el,
      i: i,
      r: ghsKnopRang(el),
      n: _knopTekst(el).length
    };
  }).sort(function (a, b) {
    return b.r - a.r || b.n - a.n || a.i - b.i;
  }).map(function (x) {
    return x.el;
  });
  /* Links uitgelijnd loopt de reeks van links naar rechts; rechts uitgelijnd
     spiegelen we ze, zodat positie 1 tegen de rechterrand ligt. */
  var uit = links ? reeks : reeks.reverse();
  if (opties && opties.rand && uit.length) {
    if (links) uit[0] = ghsKnopRand(uit[0], 'start');else uit[uit.length - 1] = ghsKnopRand(uit[uit.length - 1], 'end');
  }
  return uit;
};
Object.assign(window, {
  ghsKnopVolgorde: ghsKnopVolgorde,
  ghsKnopRang: ghsKnopRang
});
Object.assign(window, {
  OVL_BTN: OVL_BTN,
  OVL_AMBER: OVL_AMBER,
  OVL_RED: OVL_RED
});
var crmGlobalSearch = function crmGlobalSearch(q, scope) {
  var s = (q || '').trim().toLowerCase();
  if (s.length < 2 || !window.crmStore || !scope) return [];
  var out = [];
  var wil = function wil(v) {
    return v === scope;
  }; // enkel treffers binnen deze module
  window.crmStore.getState().contacts.forEach(function (c) {
    var naam = "".concat(c.firstName, " ").concat(c.lastName).trim();
    /* Zelfde slimme vergelijking als de lijsten: accenten, typo's en telefoonnotaties
       (+32 473 81 39 41 = 0473813941) vallen weg. */
    var m = function m(txt) {
      return window.ghsMatch ? window.ghsMatch(txt, q) : String(txt).toLowerCase().includes(s);
    };
    var naamHit = m([naam, c.company, c.email, c.phone, c.address, c.city, c.postalCode, c.herkomst, c.verkoper, c.status, (c.tags || []).join(' ')].filter(Boolean).join(' '));
    var has = function has() {
      for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
        parts[_key] = arguments[_key];
      }
      return naamHit || m(parts.filter(Boolean).join(' '));
    };
    var n = 0;
    var hit = function hit(view, kind, sub) {
      if (wil(view) && n++ < 7) out.push({
        key: c.id + view + kind + sub,
        cid: c.id,
        view: view,
        kind: kind,
        sub: sub,
        name: naam,
        term: naam
      });
    };
    if (naamHit) hit('contact', c.archief ? 'Contact (archief)' : 'Contact', [c.address, c.city].filter(Boolean).join(' · '));
    (c.appts || []).forEach(function (a) {
      if (has(a.title, a.type, a.verkoper)) hit('afspraken', 'Afspraak', [a.date, a.title || a.type].filter(Boolean).join(' · '));
    });
    (c.deals || []).forEach(function (d) {
      if (has(d.ref, d.name)) hit('deals', 'Deal', "".concat(d.ref, " \xB7 ").concat(d.name));
    });
    (c.opmetingen || []).forEach(function (o) {
      if (has(o.nr, o.dealRef, o.dealName, o.uitvoerder)) hit('opmetingen', 'Opmeting', [o.nr, o.uitvoerder].filter(function (x) {
        return x && x !== '—';
      }).join(' · '));
    });
    /* Planning, werkbonnen en facturatie zijn dossier-gedreven: hun lijst toont één
       regel per werf (gewonnen deal) — ook zonder moment, werkbon of factuur. Zocht de
       dropdown enkel in planningSlots/werkbonState, dan vond hij een werf niet die de
       lijst wél toont. Zelfde bron en poort als mapPlanItems / mapWerven / mapFacturen. */
    (c.deals || []).filter(function (d) {
      return d.won && !d.lost && !d.service;
    }).forEach(function (d) {
      var slots = (c.planningSlots || []).filter(function (p) {
        return p.dealRef === d.ref;
      }).sort(function (a, b) {
        return String(a.date + (a.start || '')).localeCompare(String(b.date + (b.start || '')));
      });
      var ws = (c.werkbonState || {})[d.ref] || {};
      var fs = (c.facturatieState || {})[d.ref] || {};
      var bonNr = (ws.werkbon || {}).nr || '';
      var poort = slots.length || ws.installed || (window.dealKlaarVoorPlanning ? window.dealKlaarVoorPlanning(c, d) : true);
      if (poort && !(ws.planRemoved && !ws.installed && !slots.length) && has(d.ref, d.name, c.city, slots.map(function (p) {
        return "".concat(p.adres || '', " ").concat(p.info || '');
      }).join(' '))) hit('planning', slots.length ? 'Planning' : 'Te plannen', [slots.length ? slots[0].date : 'nog geen datum', d.ref].filter(Boolean).join(' · '));
      if (slots.length && has(d.ref, d.name, c.city, bonNr)) hit('werkbonnen', 'Werkbon', [bonNr || 'nog geen werkbon', slots[0].date].filter(Boolean).join(' · '));
      if (!fs.factuurNr && !fs.status && !fs.sentISO && ws.installed && ws.werkbon && has(d.ref, d.name, bonNr)) hit('facturatie', 'Te factureren', [d.ref, bonNr].filter(Boolean).join(' · '));
    });
    Object.values(c.facturatieState || {}).forEach(function (f) {
      if (has(f.factuurNr)) hit('facturatie', 'Factuur', [f.factuurNr, f.status].filter(Boolean).join(' · '));
    });
    /* Keuringen: elk dossier in de module — ook op organisme, dossiernummer of verslag. */
    if (wil('keuringen') && window.krDossiersVan) window.krDossiersVan(c).forEach(function (k) {
      var p = k.p || {};
      if (has(k.ref, k.deal.name, k.soort, p.organisme, p.dossierNr, p.verslagNr)) hit('keuringen', 'Keuring', [k.ref, (window.KR_STATUS[k.status] || {}).kort, p.organisme].filter(Boolean).join(' · '));
    });
    if (window.ticketStore) window.ticketStore.all().filter(function (t) {
      return t.cid === c.id;
    }).forEach(function (t) {
      if (has(t.id, t.subject, t.onderwerp, t.product)) hit('tickets', 'Ticket', [t.id, t.subject || t.onderwerp].filter(Boolean).join(' · '));
    });
  });
  return out.slice(0, 30);
};

/* ── Zoekresultaat tonen in de lijst ─────────────────────────────────────────
   Springt naar de module van de treffer en licht de rij van dat contact op,
   in plaats van meteen de fiche te openen. Doorklikken op de rij blijft werken. */
var GHS_VIEW_MODULE = {
  contact: 'contacts',
  afspraken: 'presales',
  deals: 'deals',
  opmetingen: 'opmetingen',
  planning: 'planning',
  werkbonnen: 'workorders',
  facturatie: 'invoices',
  keuringen: 'keuringen',
  tickets: 'tickets'
};
var ghsRevealInList = function ghsRevealInList(view, cid, term) {
  var mod = GHS_VIEW_MODULE[view] || 'contacts';
  // De module vult zijn eigen zoekveld met de naam (zichtbaar gefilterd) en
  // schakelt naar de lijstweergave; daarna lichten we de rij op.
  window.__ghsReveal = {
    mod: mod,
    cid: cid,
    view: view,
    term: term || '',
    t: Date.now()
  };
  if (window.ghsGoModule) window.ghsGoModule(mod);
  setTimeout(function () {
    return window.dispatchEvent(new CustomEvent('ghs-reveal', {
      detail: window.__ghsReveal
    }));
  }, 0);
  var pogingen = 0;
  var _zoek = function zoek() {
    var rij = document.querySelector("[data-ghs-row=\"".concat(cid, "\"]"));
    if (!rij) {
      if (++pogingen < 30) setTimeout(_zoek, 120);else if (window.crmStore) window.crmStore.openFiche(cid, view === 'contact' ? 'contact' : view);
      return;
    }
    // Dichtstbijzijnde scrollbare ouder — scrollIntoView vermijden.
    var p = rij.parentElement;
    while (p && p !== document.body && p.scrollHeight <= p.clientHeight + 4) p = p.parentElement;
    if (p && p !== document.body) {
      var pr = p.getBoundingClientRect(),
        rr = rij.getBoundingClientRect();
      p.scrollTo({
        top: p.scrollTop + (rr.top - pr.top) - (p.clientHeight / 2 - rr.height / 2),
        behavior: 'smooth'
      });
    } else {
      window.scrollTo({
        top: window.scrollY + rij.getBoundingClientRect().top - window.innerHeight / 2,
        behavior: 'smooth'
      });
    }
    var vorige = {
      outline: rij.style.outline,
      offset: rij.style.outlineOffset,
      shadow: rij.style.boxShadow,
      z: rij.style.position
    };
    rij.style.outline = '2px solid #00D900';
    rij.style.outlineOffset = '-2px';
    rij.style.boxShadow = '0 0 0 1px rgba(0,217,0,0.35), 0 0 26px rgba(0,217,0,0.28) inset';
    rij.style.transition = 'outline-color 400ms, box-shadow 400ms';
    setTimeout(function () {
      rij.style.outline = vorige.outline;
      rij.style.outlineOffset = vorige.offset;
      rij.style.boxShadow = vorige.shadow;
    }, 2600);
  };
  setTimeout(_zoek, 220);
};

/* Elke module roept dit één keer aan: zoekveld invullen + naar lijstweergave
   springen zodra een zoekresultaat naar deze module verwijst. */
var useGhsReveal = function useGhsReveal(mod, setSearch, setView, listView, extra) {
  React.useEffect(function () {
    var pas = function pas(r) {
      if (!r || r.mod !== mod) return;
      if (setSearch) setSearch(r.term || '');
      if (setView && listView) setView(listView);
      if (extra) extra(r);
    };
    var f = function f(e) {
      return pas(e.detail);
    };
    window.addEventListener('ghs-reveal', f);
    var r = window.__ghsReveal;
    if (r && Date.now() - r.t < 4000) pas(r); // module is net door de zoekactie geopend
    return function () {
      return window.removeEventListener('ghs-reveal', f);
    };
  }, [mod]);
};
Object.assign(window, {
  ghsRevealInList: ghsRevealInList,
  useGhsReveal: useGhsReveal
});

/* Zoekbalk per module: filtert de eigen lijst en toont enkel treffers uit déze
   module. Klik springt naar de rij in de lijst — nooit naar een andere module. */
var CrmSearchBar = function CrmSearchBar(_ref18) {
  var value = _ref18.value,
    _onChange4 = _ref18.onChange,
    _ref18$placeholder = _ref18.placeholder,
    placeholder = _ref18$placeholder === void 0 ? 'Zoeken...' : _ref18$placeholder,
    scope = _ref18.scope;
  var _React$useState7 = React.useState(false),
    _React$useState8 = _slicedToArray(_React$useState7, 2),
    open = _React$useState8[0],
    setOpen = _React$useState8[1];
  var results = React.useMemo(function () {
    return open ? crmGlobalSearch(value, scope) : [];
  }, [value, open, scope]);
  if (!scope) return /*#__PURE__*/React.createElement(SearchBar, {
    value: value,
    onChange: _onChange4,
    placeholder: placeholder
  });
  return /*#__PURE__*/React.createElement("div", {
    style: {
      position: 'relative'
    },
    onBlur: function onBlur(e) {
      if (!e.currentTarget.contains(e.relatedTarget)) setOpen(false);
    }
  }, /*#__PURE__*/React.createElement("div", {
    onFocus: function onFocus() {
      return setOpen(true);
    }
  }, /*#__PURE__*/React.createElement(SearchBar, {
    value: value,
    onChange: function onChange(v) {
      _onChange4(v);
      setOpen(true);
    },
    placeholder: placeholder
  })), open && value.trim().length >= 2 && /*#__PURE__*/React.createElement("div", {
    style: {
      position: 'absolute',
      top: 'calc(100% + 5px)',
      left: 0,
      minWidth: 330,
      maxWidth: 460,
      zIndex: 60,
      filter: 'drop-shadow(0 12px 26px rgba(0,0,0,0.45))'
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      maxHeight: 340,
      overflowY: 'auto',
      background: T.bg1,
      border: "1px solid ".concat(T.stroke2),
      clipPath: cutPath(8),
      padding: 5
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      padding: '5px 9px 7px',
      fontFamily: T.fontBody,
      fontSize: 9,
      fontWeight: 700,
      letterSpacing: '0.12em',
      textTransform: 'uppercase',
      color: T.fg4,
      display: 'flex',
      justifyContent: 'space-between'
    }
  }, /*#__PURE__*/React.createElement("span", null, "In deze lijst"), /*#__PURE__*/React.createElement("span", null, results.length)), results.map(function (r) {
    return /*#__PURE__*/React.createElement("button", {
      key: r.key,
      tabIndex: 0,
      onMouseDown: function onMouseDown(e) {
        return e.preventDefault();
      },
      onClick: function onClick() {
        setOpen(false);
        ghsRevealInList(r.view, r.cid, r.term);
      },
      style: {
        display: 'flex',
        alignItems: 'center',
        gap: 9,
        width: '100%',
        textAlign: 'left',
        padding: '7px 9px',
        background: 'transparent',
        border: 'none',
        borderRadius: 3,
        cursor: 'pointer',
        transition: 'background 120ms'
      },
      onMouseEnter: function onMouseEnter(e) {
        e.currentTarget.style.background = T.bg2;
      },
      onMouseLeave: function onMouseLeave(e) {
        e.currentTarget.style.background = 'transparent';
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        flex: 1,
        minWidth: 0
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        display: 'block',
        fontFamily: T.fontBody,
        fontSize: 12.5,
        fontWeight: 700,
        color: T.fg1,
        overflow: 'hidden',
        textOverflow: 'ellipsis',
        whiteSpace: 'nowrap'
      }
    }, r.name), /*#__PURE__*/React.createElement("span", {
      style: {
        display: 'block',
        fontFamily: T.fontBody,
        fontSize: 11,
        color: T.fg3,
        overflow: 'hidden',
        textOverflow: 'ellipsis',
        whiteSpace: 'nowrap'
      }
    }, r.sub)), /*#__PURE__*/React.createElement("span", {
      style: {
        flexShrink: 0,
        padding: '2px 8px',
        background: T.bg2,
        border: "1px solid ".concat(T.stroke1),
        borderRadius: 3,
        fontFamily: T.fontBody,
        fontSize: 9.5,
        fontWeight: 700,
        color: T.fg3,
        letterSpacing: '0.04em'
      }
    }, r.kind));
  }), results.length === 0 && /*#__PURE__*/React.createElement("div", {
    style: {
      padding: '12px 9px',
      fontFamily: T.fontBody,
      fontSize: 12,
      color: T.fg4
    }
  }, "Niets gevonden in deze module"))));
};

/* Tabs — de deelpagina's van een module of venster. Optioneel per tab: icon, count (neutraal),
   badge { n, kleur } (opvallend), title en attrs (extra attributen). `rechts` = acties rechts op de tabrij. */
var Tabs = function Tabs(_ref19) {
  var tabs = _ref19.tabs,
    active = _ref19.active,
    onChange = _ref19.onChange,
    _ref19$marge = _ref19.marge,
    marge = _ref19$marge === void 0 ? 18 : _ref19$marge,
    rechts = _ref19.rechts;
  return /*#__PURE__*/React.createElement("div", {
    "data-ghs-tabs": "",
    role: "tablist",
    style: {
      display: 'flex',
      alignItems: 'flex-end',
      borderBottom: "1px solid ".concat(T.stroke1),
      marginBottom: marge,
      gap: 0,
      flexWrap: 'wrap'
    }
  }, tabs.map(function (t) {
    return /*#__PURE__*/React.createElement("button", _extends({
      key: t.id,
      type: "button",
      role: "tab",
      "aria-selected": active === t.id,
      "data-ghs-tab": t.id,
      title: t.title
    }, t.attrs || {}, {
      onClick: function onClick() {
        return onChange(t.id);
      },
      style: {
        display: 'inline-flex',
        alignItems: 'center',
        gap: 7,
        background: 'none',
        border: 'none',
        cursor: 'pointer',
        padding: '9px 16px',
        fontFamily: T.fontBody,
        fontSize: 13,
        fontWeight: 600,
        color: active === t.id ? T.fg1 : T.fg3,
        borderBottom: active === t.id ? "2px solid ".concat(T.accent) : '2px solid transparent',
        marginBottom: -1,
        transition: 'all 160ms',
        whiteSpace: 'nowrap'
      }
    }), t.icon && /*#__PURE__*/React.createElement(Icon, {
      name: t.icon,
      size: 13,
      color: active === t.id ? T.accent : T.fg3
    }), t.label, t.count !== undefined && /*#__PURE__*/React.createElement("span", {
      style: {
        padding: '2px 6px',
        borderRadius: 9,
        background: active === t.id ? 'rgba(0,217,0,0.12)' : T.bg2,
        color: active === t.id ? T.accent : T.fg3,
        fontSize: 10,
        fontWeight: 700
      }
    }, t.count), t.badge && t.badge.n > 0 && /*#__PURE__*/React.createElement("span", {
      title: t.badge.title,
      style: {
        minWidth: 18,
        padding: '1px 6px',
        borderRadius: 9,
        background: t.badge.kleur || '#ffb020',
        color: '#0b0d0b',
        fontSize: 10,
        fontWeight: 800,
        textAlign: 'center',
        boxSizing: 'border-box'
      }
    }, t.badge.n));
  }), rechts && /*#__PURE__*/React.createElement("div", {
    style: {
      marginLeft: 'auto',
      alignSelf: 'center',
      display: 'flex',
      alignItems: 'center',
      gap: 8,
      paddingBottom: 4
    }
  }, rechts));
};

/* De topbalk toont wie er ingelogd is volgens de gebruikerscontext; de `user`-prop
   van een module is enkel nog de terugvaloptie. */
var Topbar = function Topbar(_ref20) {
  var title = _ref20.title,
    breadcrumb = _ref20.breadcrumb,
    _ref20$user = _ref20.user,
    user = _ref20$user === void 0 ? {
      name: 'Admin'
    } : _ref20$user,
    _ref20$notifications = _ref20.notifications,
    notifications = _ref20$notifications === void 0 ? 2 : _ref20$notifications;
  var ik = window.useGhsGebruiker ? window.useGhsGebruiker() : null;
  var wie = ik || user;
  /* Kruimel en titel komen uit de zijbalk: overal dezelfde opbouw (sectie › module). */
  var nav = window.ghsNavInfo && window.ghsActieveModule ? window.ghsNavInfo(window.ghsActieveModule) : null;
  if (nav) {
    breadcrumb = nav.sectie;
    title = nav.label;
  }
  var tier = window.useGhsTier ? window.useGhsTier() : {
    xs: false
  };
  /* Gsm: de zijbalk is een lade. De kop krijgt de menuknop, de titel en enkel wat je onderweg
     nodig hebt (ongedaan maken, wie je bent). Back-up en "werk als" zitten in de lade. */
  var grootScherm = tier.xs && window.GHS_GROOT_SCHERM && window.ghsActieveModule ? window.GHS_GROOT_SCHERM[window.ghsActieveModule] : null;
  if (tier.xs || tier.gsm) return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
    "data-ghs-topbar": "xs",
    style: {
      height: 54,
      display: 'flex',
      alignItems: 'center',
      gap: 4,
      padding: '0 max(8px, env(safe-area-inset-right, 0px)) 0 max(4px, env(safe-area-inset-left, 0px))',
      background: 'rgba(2,33,24,0.94)',
      backdropFilter: 'saturate(140%) blur(18px)',
      borderBottom: "1px solid ".concat(T.stroke1),
      flexShrink: 0,
      position: 'sticky',
      top: 0,
      zIndex: 40
    }
  }, /*#__PURE__*/React.createElement("button", {
    type: "button",
    "aria-label": "Menu openen",
    onClick: function onClick() {
      return window.dispatchEvent(new CustomEvent('ghs-menu', {
        detail: true
      }));
    },
    style: {
      width: 44,
      height: 44,
      flexShrink: 0,
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      background: 'none',
      border: 'none',
      cursor: 'pointer',
      color: T.fg1,
      borderRadius: 8
    }
  }, /*#__PURE__*/React.createElement("svg", {
    width: "22",
    height: "22",
    viewBox: "0 0 24 24",
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "1.8",
    strokeLinecap: "round"
  }, /*#__PURE__*/React.createElement("path", {
    d: "M4 7h16M4 12h16M4 17h16"
  }))), /*#__PURE__*/React.createElement("h1", {
    style: {
      margin: 0,
      flex: 1,
      minWidth: 0,
      fontFamily: T.fontDisplay,
      fontSize: 17,
      fontWeight: 600,
      letterSpacing: '-0.02em',
      color: T.fg1,
      whiteSpace: 'nowrap',
      overflow: 'hidden',
      textOverflow: 'ellipsis'
    }
  }, title), window.GhsInstellingenKnop ? /*#__PURE__*/React.createElement(window.GhsInstellingenKnop, null) : null, window.GhsUndoRedo ? /*#__PURE__*/React.createElement(window.GhsUndoRedo, null) : null, window.GhsWerkAlsAvatar ? /*#__PURE__*/React.createElement(window.GhsWerkAlsAvatar, null) : /*#__PURE__*/React.createElement("span", {
    title: wie.name
  }, /*#__PURE__*/React.createElement(Avatar, {
    name: wie.name,
    size: 30
  }))), grootScherm && window.GhsGrootScherm ? /*#__PURE__*/React.createElement(window.GhsGrootScherm, {
    wat: grootScherm.wat,
    kort: grootScherm.kort,
    sleutel: 'mod-' + window.ghsActieveModule
  }) : null);
  return /*#__PURE__*/React.createElement("div", {
    style: {
      height: 58,
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'space-between',
      padding: tier.lade ? '0 20px 0 8px' : '0 24px',
      background: 'rgba(2,33,24,0.90)',
      backdropFilter: 'saturate(140%) blur(18px)',
      borderBottom: "1px solid ".concat(T.stroke1),
      flexShrink: 0,
      position: tier.lade ? 'sticky' : 'relative',
      top: 0,
      zIndex: 40
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      alignItems: 'center',
      gap: tier.lade ? 10 : 16,
      minWidth: 0
    }
  }, tier.lade && /*#__PURE__*/React.createElement("button", {
    type: "button",
    "aria-label": "Menu openen",
    onClick: function onClick() {
      return window.dispatchEvent(new CustomEvent('ghs-menu', {
        detail: true
      }));
    },
    style: {
      width: 44,
      height: 44,
      flexShrink: 0,
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      background: 'none',
      border: 'none',
      cursor: 'pointer',
      color: T.fg1,
      borderRadius: 8
    }
  }, /*#__PURE__*/React.createElement("svg", {
    width: "22",
    height: "22",
    viewBox: "0 0 24 24",
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "1.8",
    strokeLinecap: "round"
  }, /*#__PURE__*/React.createElement("path", {
    d: "M4 7h16M4 12h16M4 17h16"
  }))), /*#__PURE__*/React.createElement("div", {
    style: {
      minWidth: 0
    }
  }, breadcrumb && /*#__PURE__*/React.createElement("div", {
    style: {
      fontSize: 10,
      fontFamily: T.fontBody,
      color: T.fg3,
      letterSpacing: '0.14em',
      textTransform: 'uppercase',
      marginBottom: 1
    }
  }, breadcrumb), /*#__PURE__*/React.createElement("h1", {
    style: {
      margin: 0,
      fontFamily: T.fontDisplay,
      fontSize: 17,
      fontWeight: 600,
      letterSpacing: '-0.02em',
      color: T.fg1,
      whiteSpace: 'nowrap'
    }
  }, title)), window.GhsInstellingenKnop ? /*#__PURE__*/React.createElement(window.GhsInstellingenKnop, null) : null), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      alignItems: 'center',
      gap: 10
    }
  }, window.GhsWerkAlsPil ? /*#__PURE__*/React.createElement(window.GhsWerkAlsPil, null) : null, window.GhsBackupPil ? /*#__PURE__*/React.createElement(window.GhsBackupPil, null) : null, window.GhsUndoRedo ? /*#__PURE__*/React.createElement(window.GhsUndoRedo, null) : null, /*#__PURE__*/React.createElement("div", {
    style: {
      position: 'relative'
    }
  }, /*#__PURE__*/React.createElement("button", {
    style: {
      background: 'none',
      border: 'none',
      cursor: 'pointer',
      color: T.fg2,
      padding: 5,
      display: 'flex'
    }
  }, /*#__PURE__*/React.createElement(Icon, {
    name: "alert",
    size: 17
  })), notifications > 0 && /*#__PURE__*/React.createElement("span", {
    style: {
      position: 'absolute',
      top: 1,
      right: 1,
      width: 14,
      height: 14,
      borderRadius: '50%',
      background: T.accent,
      color: '#010C08',
      fontSize: 8,
      fontWeight: 700,
      fontFamily: T.fontBody,
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center'
    }
  }, notifications)), window.GhsWerkAlsAvatar ? /*#__PURE__*/React.createElement(window.GhsWerkAlsAvatar, null) : /*#__PURE__*/React.createElement("span", {
    title: wie.functie ? "".concat(wie.name, " \u2014 ").concat(wie.functie) : wie.name
  }, /*#__PURE__*/React.createElement(Avatar, {
    name: wie.name,
    size: 30
  }))));
};
var Divider = function Divider() {
  return /*#__PURE__*/React.createElement("div", {
    style: {
      height: 1,
      background: T.stroke1
    }
  });
};
var fmt = function fmt(n) {
  var dec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  return Number(n).toLocaleString('nl-BE', {
    minimumFractionDigits: dec,
    maximumFractionDigits: dec
  });
};
var fmtEur = function fmtEur(n) {
  return "\u20AC ".concat(fmt(n));
};

/* ── Statuskleuren — één betekenislaag voor alle lijsten, kanbans en fiches ──
   nieuw → bezig → wacht → extern → klaar → afgerond, met negatief/archief ernaast.
   Rood blijft uitsluitend negatief, groen uitsluitend afgerond/succesvol.        */
var GS = {
  nieuw: {
    color: '#8aa0a0',
    bg: 'rgba(138,160,160,0.10)',
    label: 'Nieuw — nog niet opgepakt'
  },
  bezig: {
    color: '#00aaff',
    bg: 'rgba(0,170,255,0.10)',
    label: 'In behandeling bij ons'
  },
  wacht: {
    color: '#ffb020',
    bg: 'rgba(255,176,32,0.10)',
    label: 'Wacht op klant — opvolgen'
  },
  extern: {
    color: '#bf63ff',
    bg: 'rgba(191,99,255,0.10)',
    label: 'Bij een externe partij'
  },
  klaar: {
    color: '#00d4b8',
    bg: 'rgba(0,212,184,0.10)',
    label: 'Klaar voor de volgende stap'
  },
  afgerond: {
    color: '#00D900',
    bg: 'rgba(0,217,0,0.10)',
    label: 'Afgerond / succesvol'
  },
  negatief: {
    color: '#ff5a4d',
    bg: 'rgba(255,90,77,0.10)',
    label: 'Annulatie / te laat / negatief'
  },
  archief: {
    color: '#5f7a72',
    bg: 'rgba(95,122,114,0.12)',
    label: 'Afgesloten — geen actie'
  }
};
var gs = function gs(key, extra) {
  return _objectSpread({
    color: GS[key].color,
    bg: GS[key].bg
  }, extra);
};

/* ── In-/uitvouwbare lijstsecties (alle lijstweergaven) ──────────────────── */
var useListCollapse = function useListCollapse(ids, standaardDicht) {
  var _React$useState9 = React.useState(function () {
      return Object.fromEntries((standaardDicht || []).map(function (id) {
        return [id, true];
      }));
    }),
    _React$useState0 = _slicedToArray(_React$useState9, 2),
    collapsed = _React$useState0[0],
    setCollapsed = _React$useState0[1];
  var allCollapsed = ids.length > 0 && ids.every(function (id) {
    return collapsed[id];
  });
  return {
    collapsed: collapsed,
    isOpen: function isOpen(id) {
      return !collapsed[id];
    },
    toggle: function toggle(id) {
      return setCollapsed(function (s) {
        return _objectSpread(_objectSpread({}, s), {}, _defineProperty({}, id, !s[id]));
      });
    },
    allCollapsed: allCollapsed,
    toggleAll: function toggleAll() {
      return setCollapsed(allCollapsed ? {} : Object.fromEntries(ids.map(function (id) {
        return [id, true];
      })));
    }
  };
};
var CollapseAllBtn = function CollapseAllBtn(_ref21) {
  var allCollapsed = _ref21.allCollapsed,
    onToggle = _ref21.onToggle,
    style = _ref21.style;
  return /*#__PURE__*/React.createElement("button", {
    onClick: onToggle,
    style: _objectSpread({
      display: 'inline-flex',
      alignItems: 'center',
      gap: 6,
      background: 'transparent',
      border: "1px solid ".concat(T.stroke1),
      borderRadius: 4,
      padding: '5px 11px',
      cursor: 'pointer',
      color: T.fg3,
      fontFamily: T.fontBody,
      fontSize: 11.5,
      fontWeight: 600
    }, style)
  }, /*#__PURE__*/React.createElement("span", {
    style: {
      display: 'flex',
      transform: allCollapsed ? 'rotate(90deg)' : 'rotate(-90deg)',
      transition: 'transform 160ms'
    }
  }, /*#__PURE__*/React.createElement(Icon, {
    name: "chevronright",
    size: 12,
    color: T.fg3
  })), allCollapsed ? 'Alles uitvouwen' : 'Alles invouwen');
};
var SectionCaret = function SectionCaret(_ref22) {
  var open = _ref22.open,
    _onClick = _ref22.onClick,
    _ref22$color = _ref22.color,
    color = _ref22$color === void 0 ? T.fg3 : _ref22$color;
  return /*#__PURE__*/React.createElement("button", {
    onClick: function onClick(e) {
      e.stopPropagation();
      _onClick();
    },
    title: open ? 'Invouwen' : 'Uitvouwen',
    style: {
      width: 20,
      height: 20,
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      background: 'transparent',
      border: 'none',
      cursor: 'pointer',
      padding: 0,
      flexShrink: 0
    }
  }, /*#__PURE__*/React.createElement("span", {
    style: {
      display: 'flex',
      transform: open ? 'rotate(90deg)' : 'rotate(0deg)',
      transition: 'transform 160ms'
    }
  }, /*#__PURE__*/React.createElement(Icon, {
    name: "chevronright",
    size: 12,
    color: color
  })));
};
Object.assign(window, {
  T: T,
  cutPath: cutPath,
  accentEdge: accentEdge,
  Icon: Icon,
  PATHS: PATHS,
  Button: Button,
  Badge: Badge,
  KPICard: KPICard,
  GhsKpi: GhsKpi,
  GhsKpiRij: GhsKpiRij,
  GhsKeuze: GhsKeuze,
  GHS_RITME: GHS_RITME,
  GHS_RAND: GHS_RAND,
  GHS_TEGEL_GAP: GHS_TEGEL_GAP,
  GHS_BALK_H: GHS_BALK_H,
  Card: Card,
  Input: Input,
  GhsSelect: GhsSelect,
  Modal: Modal,
  GhsPortal: GhsPortal,
  GhsTable: GhsTable,
  SectionTitle: SectionTitle,
  Avatar: Avatar,
  Dot: Dot,
  AccentLine: AccentLine,
  SearchBar: SearchBar,
  CrmSearchBar: CrmSearchBar,
  crmGlobalSearch: crmGlobalSearch,
  ghsRevealInList: ghsRevealInList,
  Tabs: Tabs,
  Topbar: Topbar,
  Divider: Divider,
  fmt: fmt,
  fmtEur: fmtEur,
  useListCollapse: useListCollapse,
  CollapseAllBtn: CollapseAllBtn,
  SectionCaret: SectionCaret,
  GS: GS,
  gs: gs
});