"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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
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 — Databank (Datasheets & Installatiehandleidingen)

var DB_CATS = ['Alle', 'Zonnepanelen', 'Omvormers', 'Batterijen', 'Optimizers', 'Montagesystemen', 'Keuring & AREI', 'Warmtepompen', 'Airco', 'Certificaten', 'Algemeen'];
var DB_TYPES = ['Datasheet', 'Installatiehandleiding', 'Certificaat', 'Technische fiche', 'Garantiebewijs', 'Handleiding', 'Schema'];
var INITIAL_DOCS = [
// Zonnepanelen
{
  id: 'd1',
  cat: 'Zonnepanelen',
  type: 'Datasheet',
  brand: 'AIKO',
  name: 'AIKO 485 GLAS — Datasheet',
  version: 'v2.1',
  size: '2.4 MB',
  ext: 'pdf',
  date: '2026-03-15',
  downloads: 34,
  langs: ['NL', 'EN']
}, {
  id: 'd2',
  cat: 'Zonnepanelen',
  type: 'Datasheet',
  brand: 'AIKO',
  name: 'AIKO GEN2 500 — Datasheet',
  version: 'v1.0',
  size: '2.1 MB',
  ext: 'pdf',
  date: '2026-01-20',
  downloads: 18,
  langs: ['EN']
}, {
  id: 'd3',
  cat: 'Zonnepanelen',
  type: 'Datasheet',
  brand: 'JINKO',
  name: 'JINKO SOLAR 440WP — Datasheet',
  version: 'v3.2',
  size: '1.8 MB',
  ext: 'pdf',
  date: '2025-11-10',
  downloads: 22,
  langs: ['NL', 'EN', 'FR']
}, {
  id: 'd4',
  cat: 'Zonnepanelen',
  type: 'Datasheet',
  brand: 'LONGHI',
  name: 'LONGHI 615 — Datasheet',
  version: 'v1.1',
  size: '3.2 MB',
  ext: 'pdf',
  date: '2026-02-28',
  downloads: 9,
  langs: ['EN']
}, {
  id: 'd5',
  cat: 'Zonnepanelen',
  type: 'Certificaat',
  brand: 'AIKO',
  name: 'AIKO 485 — IEC 61215 Certificaat',
  version: '2024',
  size: '0.8 MB',
  ext: 'pdf',
  date: '2024-06-01',
  downloads: 12,
  langs: ['EN']
},
// Omvormers
{
  id: 'd6',
  cat: 'Omvormers',
  type: 'Installatiehandleiding',
  brand: 'HUAWEI',
  name: 'HUAWEI SUN2000 — Installatiegids',
  version: 'v4.0',
  size: '8.2 MB',
  ext: 'pdf',
  date: '2026-01-05',
  downloads: 67,
  langs: ['NL', 'EN', 'FR', 'DE']
}, {
  id: 'd7',
  cat: 'Omvormers',
  type: 'Datasheet',
  brand: 'HUAWEI',
  name: 'HUAWEI 5KTL M1 — Datasheet',
  version: 'v2.3',
  size: '1.5 MB',
  ext: 'pdf',
  date: '2025-09-12',
  downloads: 41,
  langs: ['NL', 'EN']
}, {
  id: 'd8',
  cat: 'Omvormers',
  type: 'Datasheet',
  brand: 'HUAWEI',
  name: 'HUAWEI 10KTL M1 — Datasheet',
  version: 'v2.3',
  size: '1.6 MB',
  ext: 'pdf',
  date: '2025-09-12',
  downloads: 38,
  langs: ['NL', 'EN']
}, {
  id: 'd9',
  cat: 'Omvormers',
  type: 'Installatiehandleiding',
  brand: 'SUNGROW',
  name: 'SUNGROW SH5.0RS — Installatie',
  version: 'v1.2',
  size: '5.4 MB',
  ext: 'pdf',
  date: '2025-12-01',
  downloads: 24,
  langs: ['NL', 'EN']
}, {
  id: 'd10',
  cat: 'Omvormers',
  type: 'Schema',
  brand: 'HUAWEI',
  name: 'Aansluitschema 1F/3F — Huawei',
  version: 'v3.0',
  size: '0.6 MB',
  ext: 'pdf',
  date: '2026-02-10',
  downloads: 55,
  langs: ['NL']
},
// Batterijen
{
  id: 'd11',
  cat: 'Batterijen',
  type: 'Installatiehandleiding',
  brand: 'HUAWEI',
  name: 'LUNA2000 EP — Installatiegids',
  version: 'v2.1',
  size: '6.8 MB',
  ext: 'pdf',
  date: '2026-01-15',
  downloads: 45,
  langs: ['NL', 'EN', 'FR']
}, {
  id: 'd12',
  cat: 'Batterijen',
  type: 'Datasheet',
  brand: 'HUAWEI',
  name: 'EP12 / EP18 — Datasheet',
  version: 'v1.4',
  size: '1.9 MB',
  ext: 'pdf',
  date: '2025-10-20',
  downloads: 29,
  langs: ['NL', 'EN']
}, {
  id: 'd13',
  cat: 'Batterijen',
  type: 'Technische fiche',
  brand: 'SUNGROW',
  name: 'SBR Series — Technische fiche',
  version: 'v2.0',
  size: '2.2 MB',
  ext: 'pdf',
  date: '2026-03-01',
  downloads: 17,
  langs: ['EN']
},
// Montage
{
  id: 'd14',
  cat: 'Montagesystemen',
  type: 'Installatiehandleiding',
  brand: 'K2',
  name: 'K2 Systems — Montagehandleiding',
  version: 'v5.1',
  size: '12.4 MB',
  ext: 'pdf',
  date: '2025-08-15',
  downloads: 88,
  langs: ['NL', 'EN', 'FR', 'DE']
}, {
  id: 'd15',
  cat: 'Montagesystemen',
  type: 'Schema',
  brand: 'Intern',
  name: 'Platdak O/W — Opstelplan template',
  version: 'v2.0',
  size: '1.1 MB',
  ext: 'pdf',
  date: '2026-04-01',
  downloads: 33,
  langs: ['NL']
},
// Keuring
{
  id: 'd16',
  cat: 'Keuring & AREI',
  type: 'Technische fiche',
  brand: 'AREI',
  name: 'AREI Keuring — Checklist installateur',
  version: '2026',
  size: '0.4 MB',
  ext: 'pdf',
  date: '2026-01-01',
  downloads: 120,
  langs: ['NL', 'FR']
}, {
  id: 'd17',
  cat: 'Keuring & AREI',
  type: 'Schema',
  brand: 'Intern',
  name: 'Aansluitschema AREI-conform',
  version: 'v1.3',
  size: '0.9 MB',
  ext: 'pdf',
  date: '2026-03-10',
  downloads: 74,
  langs: ['NL']
}, {
  id: 'd18',
  cat: 'Keuring & AREI',
  type: 'Handleiding',
  brand: 'Fluvius',
  name: 'Fluvius — Prosument procedure',
  version: '2025',
  size: '1.2 MB',
  ext: 'pdf',
  date: '2025-06-01',
  downloads: 95,
  langs: ['NL', 'FR']
},
// Certificaten
{
  id: 'd19',
  cat: 'Certificaten',
  type: 'Certificaat',
  brand: 'GHS',
  name: 'GHS — VCA Certificaat 2026',
  version: '2026',
  size: '0.5 MB',
  ext: 'pdf',
  date: '2026-01-10',
  downloads: 8,
  langs: ['NL']
}, {
  id: 'd20',
  cat: 'Certificaten',
  type: 'Garantiebewijs',
  brand: 'HUAWEI',
  name: 'HUAWEI — Garantieformulier',
  version: 'v1.0',
  size: '0.3 MB',
  ext: 'pdf',
  date: '2025-12-01',
  downloads: 14,
  langs: ['NL', 'EN', 'FR']
}];
var ExtIcon = function ExtIcon(_ref) {
  var ext = _ref.ext;
  var colors = {
    pdf: '#ff5a4d',
    docx: '#0078D4',
    xlsx: '#217346',
    png: '#bf63ff',
    jpg: '#ffb020'
  };
  return /*#__PURE__*/React.createElement("div", {
    style: {
      width: 36,
      height: 44,
      borderRadius: 4,
      background: colors[ext] || T.fg3,
      display: 'flex',
      flexDirection: 'column',
      alignItems: 'center',
      justifyContent: 'center',
      flexShrink: 0
    }
  }, /*#__PURE__*/React.createElement(Icon, {
    name: "file",
    size: 18,
    color: "#fff"
  }), /*#__PURE__*/React.createElement("span", {
    style: {
      fontSize: 8,
      color: 'rgba(255,255,255,0.9)',
      fontFamily: T.fontBody,
      fontWeight: 700,
      marginTop: 1,
      textTransform: 'uppercase'
    }
  }, ext));
};
var DatabankPage = function DatabankPage() {
  var _mostDownloaded$;
  var _React$useState = React.useState(INITIAL_DOCS),
    _React$useState2 = _slicedToArray(_React$useState, 2),
    docs = _React$useState2[0],
    setDocs = _React$useState2[1];
  var _React$useState3 = React.useState('Alle'),
    _React$useState4 = _slicedToArray(_React$useState3, 2),
    cat = _React$useState4[0],
    setCat = _React$useState4[1];
  var _React$useState5 = React.useState('Alle'),
    _React$useState6 = _slicedToArray(_React$useState5, 2),
    type = _React$useState6[0],
    setType = _React$useState6[1];
  var _React$useState7 = React.useState(''),
    _React$useState8 = _slicedToArray(_React$useState7, 2),
    search = _React$useState8[0],
    setSearch = _React$useState8[1];
  var _React$useState9 = React.useState('grid'),
    _React$useState0 = _slicedToArray(_React$useState9, 2),
    view = _React$useState0[0],
    setView = _React$useState0[1];
  var _React$useState1 = React.useState(null),
    _React$useState10 = _slicedToArray(_React$useState1, 2),
    selected = _React$useState10[0],
    setSelected = _React$useState10[1];
  var _React$useState11 = React.useState(false),
    _React$useState12 = _slicedToArray(_React$useState11, 2),
    showUpload = _React$useState12[0],
    setShowUpload = _React$useState12[1];
  var _React$useState13 = React.useState({
      name: '',
      cat: 'Zonnepanelen',
      type: 'Datasheet',
      brand: '',
      version: 'v1.0'
    }),
    _React$useState14 = _slicedToArray(_React$useState13, 2),
    uploadForm = _React$useState14[0],
    setUploadForm = _React$useState14[1];
  var filtered = docs.filter(function (d) {
    var cm = cat === 'Alle' || d.cat === cat;
    var tm = type === 'Alle' || d.type === type;
    var sm = ghsMatch("".concat(d.name, " ").concat(d.brand, " ").concat(d.cat, " ").concat(d.type), search);
    return cm && tm && sm;
  });
  var download = function download(doc) {
    setDocs(function (prev) {
      return prev.map(function (d) {
        return d.id === doc.id ? _objectSpread(_objectSpread({}, d), {}, {
          downloads: d.downloads + 1
        }) : d;
      });
    });
  };
  var addDoc = function addDoc() {
    if (!uploadForm.name) return;
    var newDoc = _objectSpread(_objectSpread({
      id: 'd' + Date.now()
    }, uploadForm), {}, {
      size: '—',
      ext: 'pdf',
      date: '26 mei 2026',
      downloads: 0,
      langs: ['NL']
    });
    setDocs(function (prev) {
      return [newDoc].concat(_toConsumableArray(prev));
    });
    setShowUpload(false);
    setUploadForm({
      name: '',
      cat: 'Zonnepanelen',
      type: 'Datasheet',
      brand: '',
      version: 'v1.0'
    });
  };
  var mostDownloaded = _toConsumableArray(docs).sort(function (a, b) {
    return b.downloads - a.downloads;
  }).slice(0, 3);
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Topbar, {
    title: "Databank",
    user: {
      name: 'Nick De Roeck'
    }
  }), /*#__PURE__*/React.createElement("div", {
    className: "ghs-stapel",
    style: {
      padding: 24
    }
  }, /*#__PURE__*/React.createElement(GhsKpiRij, null, /*#__PURE__*/React.createElement(GhsKpi, {
    label: "Totaal documenten",
    value: docs.length,
    icon: "filetext",
    accent: true
  }), /*#__PURE__*/React.createElement(GhsKpi, {
    label: "Meest gedownload",
    value: ((_mostDownloaded$ = mostDownloaded[0]) === null || _mostDownloaded$ === void 0 ? void 0 : _mostDownloaded$.name.split(' —')[0]) || '—',
    icon: "trending",
    color: "#00aaff"
  }), /*#__PURE__*/React.createElement(GhsKpi, {
    label: "Categorie\xEBn",
    value: DB_CATS.length - 1,
    icon: "list",
    color: "#bf63ff"
  }), /*#__PURE__*/React.createElement(GhsKpi, {
    label: "Totaal downloads",
    value: docs.reduce(function (s, d) {
      return s + d.downloads;
    }, 0),
    icon: "download",
    color: T.accent
  })), /*#__PURE__*/React.createElement(Card, {
    p: 16
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      fontSize: 10,
      fontFamily: T.fontBody,
      fontWeight: 700,
      letterSpacing: '0.16em',
      textTransform: 'uppercase',
      color: T.fg3,
      marginBottom: 10
    }
  }, "MEEST GEBRUIKT"), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      gap: 8
    }
  }, mostDownloaded.map(function (doc) {
    return /*#__PURE__*/React.createElement("div", {
      key: doc.id,
      onClick: function onClick() {
        return setSelected(doc);
      },
      style: {
        flex: 1,
        display: 'flex',
        alignItems: 'center',
        gap: 10,
        padding: '10px 12px',
        background: T.bg2,
        clipPath: cutPath(8),
        cursor: 'pointer',
        border: "1px solid ".concat(T.stroke1),
        transition: 'all 140ms'
      },
      onMouseEnter: function onMouseEnter(e) {
        e.currentTarget.style.borderColor = T.accent;
      },
      onMouseLeave: function onMouseLeave(e) {
        e.currentTarget.style.borderColor = T.stroke1;
      }
    }, /*#__PURE__*/React.createElement(ExtIcon, {
      ext: doc.ext
    }), /*#__PURE__*/React.createElement("div", {
      style: {
        flex: 1,
        minWidth: 0
      }
    }, /*#__PURE__*/React.createElement("div", {
      style: {
        fontFamily: T.fontBody,
        fontSize: 12,
        fontWeight: 600,
        color: T.fg1,
        overflow: 'hidden',
        textOverflow: 'ellipsis',
        whiteSpace: 'nowrap'
      }
    }, doc.name), /*#__PURE__*/React.createElement("div", {
      style: {
        fontSize: 10,
        color: T.fg3,
        fontFamily: T.fontBody,
        marginTop: 2
      }
    }, doc.downloads, "\xD7 gedownload")));
  }))), /*#__PURE__*/React.createElement("div", {
    className: "ghs-werkbalk"
  }, /*#__PURE__*/React.createElement(Button, {
    variant: "primary",
    size: "sm",
    icon: "plus",
    onClick: function onClick() {
      return setShowUpload(true);
    }
  }, "Document toevoegen"), /*#__PURE__*/React.createElement("div", {
    className: "ghs-wb-zoek"
  }, /*#__PURE__*/React.createElement(SearchBar, {
    value: search,
    onChange: setSearch,
    placeholder: "Naam, merk of type\u2026"
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      width: 180
    }
  }, /*#__PURE__*/React.createElement(GhsSelect, {
    value: type,
    onChange: setType,
    options: [{
      value: 'Alle',
      label: 'Alle types'
    }].concat(_toConsumableArray(DB_TYPES.map(function (t) {
      return {
        value: t,
        label: t
      };
    }))),
    style: {
      padding: '7px 32px 7px 12px',
      fontSize: 12
    }
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      flex: 1
    }
  }), /*#__PURE__*/React.createElement(GhsKeuze, {
    waarde: view,
    onKies: setView,
    opties: [{
      id: 'grid',
      label: 'Tegels',
      icon: 'dashboard'
    }, {
      id: 'list',
      label: 'Lijst',
      icon: 'list'
    }]
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      gap: 4,
      flexWrap: 'wrap'
    }
  }, DB_CATS.map(function (c) {
    return /*#__PURE__*/React.createElement("button", {
      key: c,
      onClick: function onClick() {
        return setCat(c);
      },
      style: {
        background: cat === c ? T.bg2 : 'transparent',
        border: "1px solid ".concat(cat === c ? T.strokeAccent : T.stroke1),
        borderRadius: 4,
        padding: '5px 8px',
        cursor: 'pointer',
        color: cat === c ? T.fg1 : T.fg3,
        fontFamily: T.fontBody,
        fontSize: 10,
        fontWeight: 600,
        whiteSpace: 'nowrap'
      }
    }, c);
  })), view === 'grid' ? /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'grid',
      gridTemplateColumns: 'repeat(auto-fill,minmax(280px,1fr))',
      gap: 12
    }
  }, filtered.map(function (doc) {
    return /*#__PURE__*/React.createElement("div", {
      key: doc.id,
      style: {
        background: T.bg1,
        clipPath: cutPath(12),
        padding: '14px 16px',
        border: "1px solid ".concat(T.stroke1),
        transition: 'all 180ms'
      },
      onMouseEnter: function onMouseEnter(e) {
        e.currentTarget.style.borderColor = T.stroke2;
        e.currentTarget.style.background = T.bg2;
      },
      onMouseLeave: function onMouseLeave(e) {
        e.currentTarget.style.borderColor = T.stroke1;
        e.currentTarget.style.background = T.bg1;
      }
    }, /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        gap: 12,
        alignItems: 'flex-start',
        marginBottom: 10
      }
    }, /*#__PURE__*/React.createElement(ExtIcon, {
      ext: doc.ext
    }), /*#__PURE__*/React.createElement("div", {
      style: {
        flex: 1,
        minWidth: 0
      }
    }, /*#__PURE__*/React.createElement("div", {
      style: {
        fontFamily: T.fontBody,
        fontSize: 13,
        fontWeight: 600,
        color: T.fg1,
        lineHeight: 1.3,
        marginBottom: 3
      }
    }, doc.name), /*#__PURE__*/React.createElement("div", {
      style: {
        fontSize: 10,
        color: T.fg3,
        fontFamily: T.fontBody
      }
    }, doc.brand, " \xB7 ", doc.version))), /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        gap: 5,
        flexWrap: 'wrap',
        marginBottom: 10
      }
    }, /*#__PURE__*/React.createElement(Badge, {
      type: "neutral"
    }, doc.type), /*#__PURE__*/React.createElement(Badge, {
      type: "neutral"
    }, doc.cat), doc.langs.map(function (l) {
      return /*#__PURE__*/React.createElement(Badge, {
        key: l,
        type: "neutral"
      }, l);
    })), /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        justifyContent: 'space-between',
        alignItems: 'center'
      }
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        fontSize: 10,
        color: T.fg4,
        fontFamily: T.fontBody
      }
    }, doc.size, " \xB7 ", doc.downloads, "\xD7 gedownload"), /*#__PURE__*/React.createElement("div", {
      style: {
        display: 'flex',
        gap: 6
      }
    }, /*#__PURE__*/React.createElement("button", {
      onClick: function onClick() {
        return setSelected(doc);
      },
      style: {
        background: 'none',
        border: 'none',
        cursor: 'pointer',
        color: T.fg3,
        display: 'flex',
        padding: 2
      }
    }, /*#__PURE__*/React.createElement(Icon, {
      name: "eye",
      size: 14
    })), /*#__PURE__*/React.createElement("button", {
      onClick: function onClick() {
        return download(doc);
      },
      style: {
        background: 'rgba(0,217,0,0.1)',
        border: '1px solid rgba(0,217,0,0.25)',
        borderRadius: 4,
        padding: '4px 8px',
        cursor: 'pointer',
        color: T.accent,
        display: 'flex',
        alignItems: 'center',
        gap: 4
      }
    }, /*#__PURE__*/React.createElement(Icon, {
      name: "download",
      size: 12,
      color: T.accent
    }), /*#__PURE__*/React.createElement("span", {
      style: {
        fontFamily: T.fontBody,
        fontSize: 10,
        fontWeight: 600
      }
    }, "Download")))));
  })) : /*#__PURE__*/React.createElement(Card, {
    p: 0
  }, /*#__PURE__*/React.createElement(GhsTable, {
    columns: [{
      key: 'name',
      label: 'Document',
      render: function render(v, r) {
        return /*#__PURE__*/React.createElement("div", {
          style: {
            display: 'flex',
            alignItems: 'center',
            gap: 10
          }
        }, /*#__PURE__*/React.createElement(ExtIcon, {
          ext: r.ext
        }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
          style: {
            fontWeight: 600,
            fontSize: 13
          }
        }, v), /*#__PURE__*/React.createElement("div", {
          style: {
            fontSize: 11,
            color: T.fg3
          }
        }, r.brand, " \xB7 ", r.version)));
      }
    }, {
      key: 'type',
      label: 'Type',
      render: function render(v) {
        return /*#__PURE__*/React.createElement(Badge, {
          type: "neutral"
        }, v);
      }
    }, {
      key: 'cat',
      label: 'Categorie'
    }, {
      key: 'langs',
      label: 'Talen',
      render: function render(v) {
        return /*#__PURE__*/React.createElement("div", {
          style: {
            display: 'flex',
            gap: 4
          }
        }, v.map(function (l) {
          return /*#__PURE__*/React.createElement(Badge, {
            key: l,
            type: "neutral"
          }, l);
        }));
      }
    }, {
      key: 'size',
      label: 'Grootte'
    }, {
      key: 'downloads',
      label: 'Downloads',
      align: 'center',
      render: function render(v) {
        return /*#__PURE__*/React.createElement("span", {
          style: {
            fontFamily: T.fontDisplay,
            fontWeight: 600
          }
        }, v);
      }
    }, {
      key: 'date',
      label: 'Datum'
    }, {
      key: 'id',
      label: '',
      render: function render(_, r) {
        return /*#__PURE__*/React.createElement("button", {
          onClick: function onClick() {
            return download(r);
          },
          style: {
            background: 'rgba(0,217,0,0.1)',
            border: '1px solid rgba(0,217,0,0.25)',
            borderRadius: 4,
            padding: '5px 10px',
            cursor: 'pointer',
            color: T.accent,
            fontFamily: T.fontBody,
            fontSize: 11,
            fontWeight: 600,
            display: 'flex',
            alignItems: 'center',
            gap: 5
          }
        }, /*#__PURE__*/React.createElement(Icon, {
          name: "download",
          size: 11,
          color: T.accent
        }), "Download");
      }
    }],
    rows: filtered,
    onRow: setSelected
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      marginTop: 8,
      fontSize: 11,
      color: T.fg3,
      fontFamily: T.fontBody
    }
  }, filtered.length, " van ", docs.length, " documenten")), selected && /*#__PURE__*/React.createElement(Modal, {
    open: !!selected,
    onClose: function onClose() {
      return setSelected(null);
    },
    title: selected.name,
    width: 520
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      flexDirection: 'column',
      gap: 14
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      gap: 14,
      alignItems: 'center'
    }
  }, /*#__PURE__*/React.createElement(ExtIcon, {
    ext: selected.ext
  }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
    style: {
      fontFamily: T.fontDisplay,
      fontSize: 18,
      fontWeight: 600,
      color: T.fg1
    }
  }, selected.name), /*#__PURE__*/React.createElement("div", {
    style: {
      fontSize: 12,
      color: T.fg3,
      fontFamily: T.fontBody,
      marginTop: 3
    }
  }, selected.brand, " \xB7 ", selected.version, " \xB7 ", selected.size))), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'grid',
      gridTemplateColumns: '1fr 1fr',
      gap: 10
    }
  }, [{
    label: 'Categorie',
    value: selected.cat
  }, {
    label: 'Type',
    value: selected.type
  }, {
    label: 'Merk',
    value: selected.brand
  }, {
    label: 'Versie',
    value: selected.version
  }, {
    label: 'Bestandsgrootte',
    value: selected.size
  }, {
    label: 'Downloads',
    value: selected.downloads
  }, {
    label: 'Toegevoegd',
    value: selected.date
  }].map(function (f) {
    return /*#__PURE__*/React.createElement("div", {
      key: f.label,
      style: {
        padding: '10px 12px',
        background: T.bg2,
        clipPath: cutPath(8)
      }
    }, /*#__PURE__*/React.createElement("div", {
      style: {
        fontSize: 9,
        fontFamily: T.fontBody,
        fontWeight: 700,
        letterSpacing: '0.13em',
        textTransform: 'uppercase',
        color: T.fg3,
        marginBottom: 2
      }
    }, f.label), /*#__PURE__*/React.createElement("div", {
      style: {
        fontSize: 13,
        fontFamily: T.fontBody,
        color: T.fg1
      }
    }, f.value));
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      gap: 6
    }
  }, selected.langs.map(function (l) {
    return /*#__PURE__*/React.createElement(Badge, {
      key: l,
      type: "neutral"
    }, l);
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      gap: 8,
      justifyContent: 'flex-end'
    }
  }, /*#__PURE__*/React.createElement(Button, {
    variant: "ghost",
    onClick: function onClick() {
      return setSelected(null);
    }
  }, "Sluiten"), /*#__PURE__*/React.createElement(Button, {
    variant: "beige",
    icon: "download",
    onClick: function onClick() {
      download(selected);
      setSelected(null);
    }
  }, "Downloaden")))), showUpload && /*#__PURE__*/React.createElement(Modal, {
    open: showUpload,
    onClose: function onClose() {
      return setShowUpload(false);
    },
    title: "Document toevoegen",
    width: 480
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      flexDirection: 'column',
      gap: 12
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      border: "2px dashed ".concat(T.stroke1),
      clipPath: cutPath(10),
      padding: '28px 20px',
      textAlign: 'center',
      cursor: 'pointer',
      transition: 'all 160ms'
    },
    onMouseEnter: function onMouseEnter(e) {
      e.currentTarget.style.borderColor = T.accent;
      e.currentTarget.style.background = 'rgba(0,217,0,0.04)';
    },
    onMouseLeave: function onMouseLeave(e) {
      e.currentTarget.style.borderColor = T.stroke1;
      e.currentTarget.style.background = 'transparent';
    }
  }, /*#__PURE__*/React.createElement(Icon, {
    name: "download",
    size: 28,
    color: T.fg4
  }), /*#__PURE__*/React.createElement("div", {
    style: {
      fontSize: 13,
      color: T.fg2,
      fontFamily: T.fontBody,
      marginTop: 8,
      fontWeight: 600
    }
  }, "Klik of sleep bestand hier"), /*#__PURE__*/React.createElement("div", {
    style: {
      fontSize: 11,
      color: T.fg4,
      fontFamily: T.fontBody,
      marginTop: 4
    }
  }, "PDF, DOCX, XLSX, PNG \u2014 max 50 MB")), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'grid',
      gridTemplateColumns: '1fr 1fr',
      gap: 12
    }
  }, /*#__PURE__*/React.createElement(Input, {
    label: "Naam",
    value: uploadForm.name,
    onChange: function onChange(v) {
      return setUploadForm(function (p) {
        return _objectSpread(_objectSpread({}, p), {}, {
          name: v
        });
      });
    },
    placeholder: "Naam document",
    required: true
  }), /*#__PURE__*/React.createElement(Input, {
    label: "Merk / fabrikant",
    value: uploadForm.brand,
    onChange: function onChange(v) {
      return setUploadForm(function (p) {
        return _objectSpread(_objectSpread({}, p), {}, {
          brand: v
        });
      });
    },
    placeholder: "HUAWEI, AIKO, ..."
  }), /*#__PURE__*/React.createElement(GhsSelect, {
    label: "Categorie",
    value: uploadForm.cat,
    onChange: function onChange(v) {
      return setUploadForm(function (p) {
        return _objectSpread(_objectSpread({}, p), {}, {
          cat: v
        });
      });
    },
    options: DB_CATS.slice(1).map(function (c) {
      return {
        value: c,
        label: c
      };
    })
  }), /*#__PURE__*/React.createElement(GhsSelect, {
    label: "Type",
    value: uploadForm.type,
    onChange: function onChange(v) {
      return setUploadForm(function (p) {
        return _objectSpread(_objectSpread({}, p), {}, {
          type: v
        });
      });
    },
    options: DB_TYPES.map(function (t) {
      return {
        value: t,
        label: t
      };
    })
  }), /*#__PURE__*/React.createElement(Input, {
    label: "Versie",
    value: uploadForm.version,
    onChange: function onChange(v) {
      return setUploadForm(function (p) {
        return _objectSpread(_objectSpread({}, p), {}, {
          version: v
        });
      });
    },
    placeholder: "v1.0"
  })), /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      justifyContent: 'flex-end',
      gap: 8
    }
  }, /*#__PURE__*/React.createElement(Button, {
    variant: "ghost",
    onClick: function onClick() {
      return setShowUpload(false);
    }
  }, "Annuleren"), /*#__PURE__*/React.createElement(Button, {
    variant: "primary",
    icon: "check",
    onClick: addDoc
  }, "Toevoegen")))));
};
Object.assign(window, {
  DatabankPage: DatabankPage
});