@nice2dev/ui-enterprise 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,182 +1,180 @@
1
- import { jsxs as c, jsx as e, Fragment as ee } from "react/jsx-runtime";
2
- import { NtdClipboard as Be, NtdFile as He, NtdBrackets as Fe, NtdBarChart as Je, NtdFileText as we, NtdList as Ge, NtdGrid as Ke, NtdSearch as pe, NtdDownload as me, NtdChevronDown as De, NtdChevronRight as $e, NtdCircle as Ce, NtdSettings as Pe, NtdKey as be, NtdLogOut as Re, NtdLogIn as We, NtdError as oe, NtdCheck as ae, NtdUpload as Xe, NtdEye as Ze, NtdClose as ge, NtdEdit as Oe, NtdPlus as Se, NtdArrowRight as Qe, NtdBook as ec, NtdClock as xe, NtdArrowUp as cc, NtdArrowDown as ic, NtdLock as Ee, NtdOctagon as ac, NtdDollar as sc, NtdWarning as Me, NtdCookieConsent as tc, NtdArrowLeft as nc, NtdTrash as lc, NtdZap as je, NtdHelp as Ue, NtdFolder as rc, NtdUser as Ye, NtdRefresh as Ne, NtdMinus as oc, NtdTable as dc, NtdCalendar as hc, NtdMap as Te, NtdShield as qe, NtdSlash as uc, NtdFlag as pc, NtdUnlock as mc, NtdSmartphone as fe, NtdMonitor as gc } from "@nice2dev/icons";
3
- import vc, { forwardRef as te, useState as w, useCallback as $, useImperativeHandle as ne, useEffect as ue, useRef as ye, useId as bc, useMemo as he } from "react";
4
- import { NiceAppShell as Nc, NiceTutorialButton as fc, resolveTutorial as yc } from "@nice2dev/ui";
5
- function kc(i, s, t) {
6
- const a = t.csvDelimiter || ",", n = [];
7
- return t.includeHeaders !== !1 && n.push(
8
- s.filter((l) => l.include).map((l) => `"${l.label}"`).join(a)
9
- ), i.forEach((l) => {
10
- const h = s.filter((r) => r.include).map((r) => {
11
- let u = l[r.field];
12
- return r.transform && (u = r.transform(u)), u == null ? "" : typeof u == "string" ? `"${u.replace(/"/g, '""')}"` : String(u);
1
+ import { jsxs as c, jsx as e, Fragment as te } from "react/jsx-runtime";
2
+ import { NtdClipboard as Ge, NtdFile as Ke, NtdBrackets as Re, NtdBarChart as We, NtdFileText as xe, NtdList as Xe, NtdGrid as Ze, NtdSearch as ge, NtdDownload as ve, NtdChevronDown as Se, NtdChevronRight as Fe, NtdCircle as De, NtdSettings as $e, NtdKey as fe, NtdLogOut as Me, NtdLogIn as Qe, NtdError as he, NtdCheck as se, NtdUpload as ec, NtdEye as cc, NtdClose as be, NtdEdit as je, NtdPlus as Te, NtdArrowRight as tc, NtdBook as ac, NtdClock as Ee, NtdArrowUp as ic, NtdArrowDown as sc, NtdLock as Ye, NtdOctagon as nc, NtdDollar as lc, NtdWarning as Ue, NtdCookieConsent as rc, NtdArrowLeft as oc, NtdTrash as dc, NtdZap as qe, NtdHelp as Ve, NtdFolder as hc, NtdUser as Be, NtdRefresh as ye, NtdMinus as pc, NtdTable as uc, NtdCalendar as mc, NtdMap as ze, NtdShield as He, NtdSlash as gc, NtdFlag as vc, NtdUnlock as bc, NtdSmartphone as we, NtdMonitor as Nc } from "@nice2dev/icons";
3
+ import { useNiceTranslation as K, NiceAppShell as fc, NiceTutorialButton as yc, resolveTutorial as wc, NiceIcon as Ae } from "@nice2dev/ui";
4
+ import kc, { forwardRef as le, useState as k, useCallback as R, useImperativeHandle as re, useEffect as me, useRef as ke, useId as Cc, useMemo as ue } from "react";
5
+ function xc(t, n, s) {
6
+ const i = s.csvDelimiter || ",", a = [];
7
+ return s.includeHeaders !== !1 && a.push(
8
+ n.filter((l) => l.include).map((l) => `"${l.label}"`).join(i)
9
+ ), t.forEach((l) => {
10
+ const h = n.filter((r) => r.include).map((r) => {
11
+ let o = l[r.field];
12
+ return r.transform && (o = r.transform(o)), o == null ? "" : typeof o == "string" ? `"${o.replace(/"/g, '""')}"` : String(o);
13
13
  });
14
- n.push(h.join(a));
15
- }), n.join(`
14
+ a.push(h.join(i));
15
+ }), a.join(`
16
16
  `);
17
17
  }
18
- function wc(i, s, t) {
19
- const a = s.filter((l) => l.include), n = i.map((l) => {
18
+ function Sc(t, n, s) {
19
+ const i = n.filter((l) => l.include), a = t.map((l) => {
20
20
  const h = {};
21
- return a.forEach((r) => {
22
- let u = l[r.field];
23
- r.transform && (u = r.transform(u)), h[r.field] = u;
21
+ return i.forEach((r) => {
22
+ let o = l[r.field];
23
+ r.transform && (o = r.transform(o)), h[r.field] = o;
24
24
  }), h;
25
25
  });
26
- return JSON.stringify(n, null, 2);
26
+ return JSON.stringify(a, null, 2);
27
27
  }
28
- const ke = {
29
- csv: { label: "CSV", icon: /* @__PURE__ */ e(we, { size: 20 }), description: "Comma-separated values" },
30
- xlsx: { label: "Excel", icon: /* @__PURE__ */ e(Je, { size: 20 }), description: "Microsoft Excel" },
28
+ const Ce = {
29
+ csv: { label: "CSV", icon: /* @__PURE__ */ e(xe, { size: 20 }), description: "Comma-separated values" },
30
+ xlsx: { label: "Excel", icon: /* @__PURE__ */ e(We, { size: 20 }), description: "Microsoft Excel" },
31
31
  json: {
32
32
  label: "JSON",
33
- icon: /* @__PURE__ */ e(Fe, { size: 20 }),
33
+ icon: /* @__PURE__ */ e(Re, { size: 20 }),
34
34
  description: "JavaScript Object Notation"
35
35
  },
36
- pdf: { label: "PDF", icon: /* @__PURE__ */ e(He, { size: 20 }), description: "Portable Document Format" },
36
+ pdf: { label: "PDF", icon: /* @__PURE__ */ e(Ke, { size: 20 }), description: "Portable Document Format" },
37
37
  xml: {
38
38
  label: "XML",
39
- icon: /* @__PURE__ */ e(Be, { size: 20 }),
39
+ icon: /* @__PURE__ */ e(Ge, { size: 20 }),
40
40
  description: "Extensible Markup Language"
41
41
  }
42
- }, Dc = ({ formats: i, selected: s, onChange: t }) => /* @__PURE__ */ e("div", { className: "nice-export-formats", children: i.map((a) => {
43
- const n = ke[a];
42
+ }, Dc = ({ formats: t, selected: n, onChange: s }) => /* @__PURE__ */ e("div", { className: "nice-export-formats", children: t.map((i) => {
43
+ const a = Ce[i];
44
44
  return /* @__PURE__ */ c(
45
45
  "button",
46
46
  {
47
47
  type: "button",
48
- className: `nice-export-format ${s === a ? "nice-export-format--selected" : ""}`,
49
- onClick: () => t(a),
50
- title: n.description,
48
+ className: `nice-export-format ${n === i ? "nice-export-format--selected" : ""}`,
49
+ onClick: () => s(i),
50
+ title: a.description,
51
51
  children: [
52
- /* @__PURE__ */ e("span", { className: "nice-export-format-icon", children: n.icon }),
53
- /* @__PURE__ */ e("span", { className: "nice-export-format-label", children: n.label })
52
+ /* @__PURE__ */ e("span", { className: "nice-export-format-icon", children: a.icon }),
53
+ /* @__PURE__ */ e("span", { className: "nice-export-format-label", children: a.label })
54
54
  ]
55
55
  },
56
- a
56
+ i
57
57
  );
58
- }) }), Cc = ({ fields: i, onChange: s }) => {
59
- const t = (l) => {
60
- const h = [...i];
61
- h[l] = { ...h[l], include: !h[l].include }, s(h);
62
- }, a = (l) => {
63
- s(i.map((h) => ({ ...h, include: l })));
64
- }, n = i.filter((l) => l.include).length;
58
+ }) }), Tc = ({ fields: t, onChange: n }) => {
59
+ const { t: s } = K(), i = (h) => {
60
+ const r = [...t];
61
+ r[h] = { ...r[h], include: !r[h].include }, n(r);
62
+ }, a = (h) => {
63
+ n(t.map((r) => ({ ...r, include: h })));
64
+ }, l = t.filter((h) => h.include).length;
65
65
  return /* @__PURE__ */ c("div", { className: "nice-export-fields", children: [
66
66
  /* @__PURE__ */ c("div", { className: "nice-export-fields-header", children: [
67
- /* @__PURE__ */ c("span", { children: [
68
- "Fields to export (",
69
- n,
70
- "/",
71
- i.length,
72
- ")"
73
- ] }),
67
+ /* @__PURE__ */ e("span", { children: s("dataExportCenter.fieldsToExport", "Fields to export ({selectedCount}/{fields})").replace("{selectedCount}", String(l)).replace("{fields}", String(t.length)) }),
74
68
  /* @__PURE__ */ c("div", { className: "nice-export-fields-actions", children: [
75
- /* @__PURE__ */ e("button", { type: "button", onClick: () => a(!0), children: "Select all" }),
76
- /* @__PURE__ */ e("button", { type: "button", onClick: () => a(!1), children: "Deselect all" })
69
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => a(!0), children: s("dataExportCenter.selectAll", "Select all") }),
70
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => a(!1), children: s("dataExportCenter.deselectAll", "Deselect all") })
77
71
  ] })
78
72
  ] }),
79
- /* @__PURE__ */ e("div", { className: "nice-export-fields-list", children: i.map((l, h) => /* @__PURE__ */ c("label", { className: "nice-export-field", children: [
80
- /* @__PURE__ */ e("input", { type: "checkbox", checked: l.include, onChange: () => t(h) }),
81
- /* @__PURE__ */ e("span", { className: "nice-export-field-label", children: l.label }),
82
- /* @__PURE__ */ e("span", { className: "nice-export-field-name", children: l.field })
83
- ] }, l.field)) })
73
+ /* @__PURE__ */ e("div", { className: "nice-export-fields-list", children: t.map((h, r) => /* @__PURE__ */ c("label", { className: "nice-export-field", children: [
74
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: h.include, onChange: () => i(r) }),
75
+ /* @__PURE__ */ e("span", { className: "nice-export-field-label", children: h.label }),
76
+ /* @__PURE__ */ e("span", { className: "nice-export-field-name", children: h.field })
77
+ ] }, h.field)) })
84
78
  ] });
85
- }, Sc = ({ format: i, options: s, onChange: t }) => {
86
- const a = (n, l) => {
87
- t({ ...s, [n]: l });
79
+ }, Ec = ({ format: t, options: n, onChange: s }) => {
80
+ const { t: i } = K(), a = (l, h) => {
81
+ s({ ...n, [l]: h });
88
82
  };
89
83
  return /* @__PURE__ */ c("div", { className: "nice-export-options", children: [
90
- /* @__PURE__ */ e("h4", { children: "Export Options" }),
84
+ /* @__PURE__ */ e("h4", { children: i("dataExportCenter.exportOptions", "Export Options") }),
91
85
  /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
92
86
  /* @__PURE__ */ e(
93
87
  "input",
94
88
  {
95
89
  type: "checkbox",
96
- checked: s.includeHeaders !== !1,
97
- onChange: (n) => a("includeHeaders", n.target.checked)
90
+ checked: n.includeHeaders !== !1,
91
+ onChange: (l) => a("includeHeaders", l.target.checked)
98
92
  }
99
93
  ),
100
- "Include headers"
94
+ i("dataExportCenter.includeHeaders", "Include headers")
101
95
  ] }),
102
- i === "csv" && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
103
- /* @__PURE__ */ e("span", { children: "Delimiter:" }),
96
+ t === "csv" && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
97
+ /* @__PURE__ */ e("span", { children: i("dataExportCenter.delimiter", "Delimiter:") }),
104
98
  /* @__PURE__ */ c(
105
99
  "select",
106
100
  {
107
- value: s.csvDelimiter || ",",
108
- onChange: (n) => a("csvDelimiter", n.target.value),
101
+ value: n.csvDelimiter || ",",
102
+ onChange: (l) => a("csvDelimiter", l.target.value),
109
103
  children: [
110
- /* @__PURE__ */ e("option", { value: ",", children: "Comma (,)" }),
111
- /* @__PURE__ */ e("option", { value: ";", children: "Semicolon (;)" }),
112
- /* @__PURE__ */ e("option", { value: "\\t", children: "Tab" }),
113
- /* @__PURE__ */ e("option", { value: "|", children: "Pipe (|)" })
104
+ /* @__PURE__ */ e("option", { value: ",", children: i("dataExportCenter.comma", "Comma (,)") }),
105
+ /* @__PURE__ */ e("option", { value: ";", children: i("dataExportCenter.semicolon", "Semicolon (;)") }),
106
+ /* @__PURE__ */ e("option", { value: "\\t", children: i("dataExportCenter.tab", "Tab") }),
107
+ /* @__PURE__ */ e("option", { value: "|", children: i("dataExportCenter.pipe", "Pipe (|)") })
114
108
  ]
115
109
  }
116
110
  )
117
111
  ] }),
118
112
  /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
119
- /* @__PURE__ */ e("span", { children: "Date format:" }),
113
+ /* @__PURE__ */ e("span", { children: i("dataExportCenter.dateFormat", "Date format:") }),
120
114
  /* @__PURE__ */ c(
121
115
  "select",
122
116
  {
123
- value: s.dateFormat || "YYYY-MM-DD",
124
- onChange: (n) => a("dateFormat", n.target.value),
117
+ value: n.dateFormat || "YYYY-MM-DD",
118
+ onChange: (l) => a("dateFormat", l.target.value),
125
119
  children: [
126
- /* @__PURE__ */ e("option", { value: "YYYY-MM-DD", children: "YYYY-MM-DD" }),
127
- /* @__PURE__ */ e("option", { value: "DD/MM/YYYY", children: "DD/MM/YYYY" }),
128
- /* @__PURE__ */ e("option", { value: "MM/DD/YYYY", children: "MM/DD/YYYY" }),
129
- /* @__PURE__ */ e("option", { value: "ISO", children: "ISO 8601" })
120
+ /* @__PURE__ */ e("option", { value: "YYYY-MM-DD", children: i("dataExportCenter.yyyyMmDd", "YYYY-MM-DD") }),
121
+ /* @__PURE__ */ e("option", { value: "DD/MM/YYYY", children: i("dataExportCenter.ddMmYyyy", "DD/MM/YYYY") }),
122
+ /* @__PURE__ */ e("option", { value: "MM/DD/YYYY", children: i("dataExportCenter.mmDdYyyy", "MM/DD/YYYY") }),
123
+ /* @__PURE__ */ e("option", { value: "ISO", children: i("dataExportCenter.iso8601", "ISO 8601") })
130
124
  ]
131
125
  }
132
126
  )
133
127
  ] }),
134
128
  /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
135
- /* @__PURE__ */ e("span", { children: "Encoding:" }),
129
+ /* @__PURE__ */ e("span", { children: i("dataExportCenter.encoding", "Encoding:") }),
136
130
  /* @__PURE__ */ c(
137
131
  "select",
138
132
  {
139
- value: s.encoding || "utf-8",
140
- onChange: (n) => a("encoding", n.target.value),
133
+ value: n.encoding || "utf-8",
134
+ onChange: (l) => a("encoding", l.target.value),
141
135
  children: [
142
- /* @__PURE__ */ e("option", { value: "utf-8", children: "UTF-8" }),
143
- /* @__PURE__ */ e("option", { value: "utf-16", children: "UTF-16" }),
144
- /* @__PURE__ */ e("option", { value: "iso-8859-1", children: "ISO-8859-1" })
136
+ /* @__PURE__ */ e("option", { value: "utf-8", children: i("dataExportCenter.utf8", "UTF-8") }),
137
+ /* @__PURE__ */ e("option", { value: "utf-16", children: i("dataExportCenter.utf16", "UTF-16") }),
138
+ /* @__PURE__ */ e("option", { value: "iso-8859-1", children: i("dataExportCenter.iso88591", "ISO-8859-1") })
145
139
  ]
146
140
  }
147
141
  )
148
142
  ] }),
149
- (i === "xlsx" || i === "pdf") && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
150
- /* @__PURE__ */ e("span", { children: "Password protect:" }),
143
+ (t === "xlsx" || t === "pdf") && /* @__PURE__ */ c("label", { className: "nice-export-option", children: [
144
+ /* @__PURE__ */ e("span", { children: i("dataExportCenter.passwordProtect", "Password protect:") }),
151
145
  /* @__PURE__ */ e(
152
146
  "input",
153
147
  {
154
148
  type: "password",
155
- value: s.password || "",
156
- onChange: (n) => a("password", n.target.value || void 0),
157
- placeholder: "Leave empty for no password"
149
+ value: n.password || "",
150
+ onChange: (l) => a("password", l.target.value || void 0),
151
+ placeholder: i(
152
+ "dataExportCenter.leaveEmptyForNoPassword",
153
+ "Leave empty for no password"
154
+ )
158
155
  }
159
156
  )
160
157
  ] })
161
158
  ] });
162
- }, xc = ({ jobs: i, onDownload: s }) => {
163
- if (i.length === 0)
164
- return /* @__PURE__ */ e("div", { className: "nice-export-history-empty", children: "No export history" });
165
- const t = (a) => a ? a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(1)} KB` : `${(a / 1024 / 1024).toFixed(1)} MB` : "-";
159
+ }, Lc = ({ jobs: t, onDownload: n }) => {
160
+ const { t: s } = K();
161
+ if (t.length === 0)
162
+ return /* @__PURE__ */ e("div", { className: "nice-export-history-empty", children: s("dataExportCenter.noExportHistory", "No export history") });
163
+ const i = (a) => a ? a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(1)} KB` : `${(a / 1024 / 1024).toFixed(1)} MB` : "-";
166
164
  return /* @__PURE__ */ c("div", { className: "nice-export-history", children: [
167
- /* @__PURE__ */ e("h4", { children: "Export History" }),
168
- /* @__PURE__ */ e("div", { className: "nice-export-history-list", children: i.map((a) => /* @__PURE__ */ c("div", { className: `nice-export-job nice-export-job--${a.status}`, children: [
165
+ /* @__PURE__ */ e("h4", { children: s("dataExportCenter.exportHistory", "Export History") }),
166
+ /* @__PURE__ */ e("div", { className: "nice-export-history-list", children: t.map((a) => /* @__PURE__ */ c("div", { className: `nice-export-job nice-export-job--${a.status}`, children: [
169
167
  /* @__PURE__ */ c("div", { className: "nice-export-job-info", children: [
170
168
  /* @__PURE__ */ e("span", { className: "nice-export-job-name", children: a.name }),
171
169
  /* @__PURE__ */ e("span", { className: "nice-export-job-format", children: a.format.toUpperCase() }),
172
170
  /* @__PURE__ */ e("span", { className: "nice-export-job-date", children: new Date(a.createdAt).toLocaleString() })
173
171
  ] }),
174
172
  /* @__PURE__ */ c("div", { className: "nice-export-job-meta", children: [
175
- a.rowCount && /* @__PURE__ */ c("span", { children: [
176
- a.rowCount,
177
- " rows"
178
- ] }),
179
- a.fileSize && /* @__PURE__ */ e("span", { children: t(a.fileSize) })
173
+ a.rowCount && /* @__PURE__ */ e("span", { children: s("dataExportCenter.rows", "{rowCount} rows").replace(
174
+ "{rowCount}",
175
+ String(a.rowCount)
176
+ ) }),
177
+ a.fileSize && /* @__PURE__ */ e("span", { children: i(a.fileSize) })
180
178
  ] }),
181
179
  /* @__PURE__ */ c("div", { className: "nice-export-job-status", children: [
182
180
  a.status === "processing" && /* @__PURE__ */ e("div", { className: "nice-export-job-progress", children: /* @__PURE__ */ e(
@@ -191,667 +189,679 @@ const ke = {
191
189
  {
192
190
  type: "button",
193
191
  className: "nice-export-job-download",
194
- onClick: () => s == null ? void 0 : s(a),
195
- children: "Download"
192
+ onClick: () => n == null ? void 0 : n(a),
193
+ children: s("dataExportCenter.download", "Download")
196
194
  }
197
195
  ),
198
- a.status === "failed" && /* @__PURE__ */ e("span", { className: "nice-export-job-error", title: a.error, children: "Failed" })
196
+ a.status === "failed" && /* @__PURE__ */ e("span", { className: "nice-export-job-error", title: a.error, children: s("dataExportCenter.failed", "Failed") })
199
197
  ] })
200
198
  ] }, a.id)) })
201
199
  ] });
202
- }, zc = te(
203
- ({
204
- dataSource: i,
205
- formats: s = ["csv", "xlsx", "json", "pdf"],
206
- templates: t = [],
207
- enableScheduling: a = !1,
208
- exportHistory: n = [],
209
- onExportStart: l,
210
- onExportComplete: h,
211
- onExportError: r,
212
- onSaveTemplate: u,
213
- onDeleteTemplate: T,
214
- onSchedule: E,
215
- customExportHandler: S,
216
- title: y = "Data Export",
217
- description: J,
218
- className: _ = "",
219
- style: K
220
- }, O) => {
221
- const [M, j] = w(s[0]), [U, B] = w(i.getFields()), [m, k] = w({
222
- includeHeaders: !0,
223
- dateFormat: "YYYY-MM-DD",
224
- encoding: "utf-8"
225
- }), [g, Y] = w(!1), [p, P] = w(0), [A, I] = w("export"), C = $(async () => {
226
- const v = {
227
- id: Date.now().toString(),
228
- name: `Export ${(/* @__PURE__ */ new Date()).toISOString()}`,
229
- format: M,
230
- status: "processing",
231
- progress: 0,
232
- createdAt: /* @__PURE__ */ new Date()
233
- };
234
- Y(!0), P(0), l == null || l(v);
235
- try {
236
- const x = await i.fetchData({
237
- fields: U,
238
- filters: void 0,
239
- sorting: void 0
240
- });
241
- P(50);
242
- let z;
243
- if (S)
244
- z = await S(M, x, m);
245
- else
246
- switch (M) {
247
- case "csv":
248
- z = kc(x, U, m);
249
- break;
250
- case "json":
251
- z = wc(x, U, m);
252
- break;
253
- default:
254
- throw new Error(`Format ${M} requires a custom export handler`);
255
- }
256
- P(100);
257
- const G = typeof z == "string" ? new Blob([z], { type: "text/plain" }) : z, V = URL.createObjectURL(G), b = document.createElement("a");
258
- b.href = V, b.download = `export-${Date.now()}.${M}`, document.body.appendChild(b), b.click(), document.body.removeChild(b), URL.revokeObjectURL(V);
259
- const L = {
260
- ...v,
261
- status: "completed",
262
- progress: 100,
263
- completedAt: /* @__PURE__ */ new Date(),
264
- rowCount: x.length,
265
- fileSize: G.size
200
+ }, at = /* @__PURE__ */ Object.assign(
201
+ /* @__PURE__ */ le(
202
+ ({
203
+ dataSource: t,
204
+ formats: n = ["csv", "xlsx", "json", "pdf"],
205
+ templates: s = [],
206
+ enableScheduling: i = !1,
207
+ exportHistory: a = [],
208
+ onExportStart: l,
209
+ onExportComplete: h,
210
+ onExportError: r,
211
+ onSaveTemplate: o,
212
+ onDeleteTemplate: w,
213
+ onSchedule: A,
214
+ customExportHandler: I,
215
+ title: C,
216
+ description: L,
217
+ className: F = "",
218
+ style: U
219
+ }, E) => {
220
+ const { t: $ } = K(), ce = C ?? $("dataExportCenter.title", "Data Export"), [M, q] = k(n[0]), [z, m] = k(t.getFields()), [N, g] = k({
221
+ includeHeaders: !0,
222
+ dateFormat: "YYYY-MM-DD",
223
+ encoding: "utf-8"
224
+ }), [V, u] = k(!1), [B, O] = k(0), [P, x] = k("export"), H = R(async () => {
225
+ const b = {
226
+ id: Date.now().toString(),
227
+ name: `Export ${(/* @__PURE__ */ new Date()).toISOString()}`,
228
+ format: M,
229
+ status: "processing",
230
+ progress: 0,
231
+ createdAt: /* @__PURE__ */ new Date()
266
232
  };
267
- h == null || h(L);
268
- } catch (x) {
269
- const z = {
270
- ...v,
271
- status: "failed",
272
- error: x instanceof Error ? x.message : "Unknown error"
273
- };
274
- r == null || r(z, x instanceof Error ? x : new Error("Export failed"));
275
- } finally {
276
- Y(!1), P(0);
277
- }
278
- }, [
279
- M,
280
- U,
281
- m,
282
- i,
283
- S,
284
- l,
285
- h,
286
- r
287
- ]), q = $(
288
- (v) => {
289
- const x = t.find((z) => z.id === v);
290
- x && (j(x.format), B(x.fields), x.options && k(x.options));
291
- },
292
- [t]
293
- );
294
- return ne(O, () => ({
295
- exportNow: async (v) => {
296
- j(v), await C();
297
- },
298
- getSelectedFields: () => U,
299
- loadTemplate: q
300
- })), /* @__PURE__ */ c("div", { className: `nice-export-center ${_}`, style: K, children: [
301
- /* @__PURE__ */ e("div", { className: "nice-export-header", children: /* @__PURE__ */ c("div", { className: "nice-export-title-area", children: [
302
- /* @__PURE__ */ e("h3", { className: "nice-export-title", children: y }),
303
- J && /* @__PURE__ */ e("p", { className: "nice-export-description", children: J })
304
- ] }) }),
305
- /* @__PURE__ */ c("div", { className: "nice-export-tabs", children: [
306
- /* @__PURE__ */ e(
307
- "button",
308
- {
309
- type: "button",
310
- className: `nice-export-tab ${A === "export" ? "nice-export-tab--active" : ""}`,
311
- onClick: () => I("export"),
312
- children: "Export"
313
- }
314
- ),
315
- t.length > 0 && /* @__PURE__ */ c(
316
- "button",
317
- {
318
- type: "button",
319
- className: `nice-export-tab ${A === "templates" ? "nice-export-tab--active" : ""}`,
320
- onClick: () => I("templates"),
321
- children: [
322
- "Templates (",
323
- t.length,
324
- ")"
325
- ]
326
- }
327
- ),
328
- n.length > 0 && /* @__PURE__ */ e(
329
- "button",
330
- {
331
- type: "button",
332
- className: `nice-export-tab ${A === "history" ? "nice-export-tab--active" : ""}`,
333
- onClick: () => I("history"),
334
- children: "History"
335
- }
336
- )
337
- ] }),
338
- /* @__PURE__ */ c("div", { className: "nice-export-content", children: [
339
- A === "export" && /* @__PURE__ */ c(ee, { children: [
233
+ u(!0), O(0), l == null || l(b);
234
+ try {
235
+ const S = await t.fetchData({
236
+ fields: z,
237
+ filters: void 0,
238
+ sorting: void 0
239
+ });
240
+ O(50);
241
+ let _;
242
+ if (I)
243
+ _ = await I(M, S, N);
244
+ else
245
+ switch (M) {
246
+ case "csv":
247
+ _ = xc(S, z, N);
248
+ break;
249
+ case "json":
250
+ _ = Sc(S, z, N);
251
+ break;
252
+ default:
253
+ throw new Error(`Format ${M} requires a custom export handler`);
254
+ }
255
+ O(100);
256
+ const J = typeof _ == "string" ? new Blob([_], { type: "text/plain" }) : _, f = URL.createObjectURL(J), T = document.createElement("a");
257
+ T.href = f, T.download = `export-${Date.now()}.${M}`, document.body.appendChild(T), T.click(), document.body.removeChild(T), URL.revokeObjectURL(f);
258
+ const X = {
259
+ ...b,
260
+ status: "completed",
261
+ progress: 100,
262
+ completedAt: /* @__PURE__ */ new Date(),
263
+ rowCount: S.length,
264
+ fileSize: J.size
265
+ };
266
+ h == null || h(X);
267
+ } catch (S) {
268
+ const _ = {
269
+ ...b,
270
+ status: "failed",
271
+ error: S instanceof Error ? S.message : "Unknown error"
272
+ };
273
+ r == null || r(_, S instanceof Error ? S : new Error("Export failed"));
274
+ } finally {
275
+ u(!1), O(0);
276
+ }
277
+ }, [
278
+ M,
279
+ z,
280
+ N,
281
+ t,
282
+ I,
283
+ l,
284
+ h,
285
+ r
286
+ ]), Y = R(
287
+ (b) => {
288
+ const S = s.find((_) => _.id === b);
289
+ S && (q(S.format), m(S.fields), S.options && g(S.options));
290
+ },
291
+ [s]
292
+ );
293
+ return re(E, () => ({
294
+ exportNow: async (b) => {
295
+ q(b), await H();
296
+ },
297
+ getSelectedFields: () => z,
298
+ loadTemplate: Y
299
+ })), /* @__PURE__ */ c("div", { className: `nice-export-center ${F}`, style: U, children: [
300
+ /* @__PURE__ */ e("div", { className: "nice-export-header", children: /* @__PURE__ */ c("div", { className: "nice-export-title-area", children: [
301
+ /* @__PURE__ */ e("h3", { className: "nice-export-title", children: ce }),
302
+ L && /* @__PURE__ */ e("p", { className: "nice-export-description", children: L })
303
+ ] }) }),
304
+ /* @__PURE__ */ c("div", { className: "nice-export-tabs", children: [
340
305
  /* @__PURE__ */ e(
341
- Dc,
306
+ "button",
307
+ {
308
+ type: "button",
309
+ className: `nice-export-tab ${P === "export" ? "nice-export-tab--active" : ""}`,
310
+ onClick: () => x("export"),
311
+ children: $("dataExportCenter.export", "Export")
312
+ }
313
+ ),
314
+ s.length > 0 && /* @__PURE__ */ e(
315
+ "button",
342
316
  {
343
- formats: s,
344
- selected: M,
345
- onChange: j
317
+ type: "button",
318
+ className: `nice-export-tab ${P === "templates" ? "nice-export-tab--active" : ""}`,
319
+ onClick: () => x("templates"),
320
+ children: $("dataExportCenter.templates", "Templates ({templates})").replace(
321
+ "{templates}",
322
+ String(s.length)
323
+ )
346
324
  }
347
325
  ),
348
- /* @__PURE__ */ e(Cc, { fields: U, onChange: B }),
349
- /* @__PURE__ */ e(Sc, { format: M, options: m, onChange: k }),
350
- /* @__PURE__ */ c("div", { className: "nice-export-actions", children: [
326
+ a.length > 0 && /* @__PURE__ */ e(
327
+ "button",
328
+ {
329
+ type: "button",
330
+ className: `nice-export-tab ${P === "history" ? "nice-export-tab--active" : ""}`,
331
+ onClick: () => x("history"),
332
+ children: $("dataExportCenter.history", "History")
333
+ }
334
+ )
335
+ ] }),
336
+ /* @__PURE__ */ c("div", { className: "nice-export-content", children: [
337
+ P === "export" && /* @__PURE__ */ c(te, { children: [
351
338
  /* @__PURE__ */ e(
352
- "button",
339
+ Dc,
353
340
  {
354
- type: "button",
355
- className: "nice-export-btn nice-export-btn--primary",
356
- onClick: C,
357
- disabled: g || U.filter((v) => v.include).length === 0,
358
- children: g ? `Exporting... ${p}%` : "Export Now"
341
+ formats: n,
342
+ selected: M,
343
+ onChange: q
359
344
  }
360
345
  ),
361
- u && /* @__PURE__ */ e(
362
- "button",
363
- {
364
- type: "button",
365
- className: "nice-export-btn nice-export-btn--secondary",
366
- onClick: () => u({
367
- id: Date.now().toString(),
368
- name: `Template ${t.length + 1}`,
369
- format: M,
370
- fields: U,
371
- options: m
372
- }),
373
- children: "Save as Template"
374
- }
375
- )
376
- ] })
377
- ] }),
378
- A === "templates" && /* @__PURE__ */ e("div", { className: "nice-export-templates", children: t.map((v) => /* @__PURE__ */ c("div", { className: "nice-export-template", children: [
379
- /* @__PURE__ */ c("div", { className: "nice-export-template-info", children: [
380
- /* @__PURE__ */ e("span", { className: "nice-export-template-name", children: v.name }),
381
- /* @__PURE__ */ c("span", { className: "nice-export-template-format", children: [
382
- ke[v.format].icon,
383
- " ",
384
- ke[v.format].label
385
- ] }),
386
- v.description && /* @__PURE__ */ e("span", { className: "nice-export-template-desc", children: v.description })
346
+ /* @__PURE__ */ e(Tc, { fields: z, onChange: m }),
347
+ /* @__PURE__ */ e(Ec, { format: M, options: N, onChange: g }),
348
+ /* @__PURE__ */ c("div", { className: "nice-export-actions", children: [
349
+ /* @__PURE__ */ e(
350
+ "button",
351
+ {
352
+ type: "button",
353
+ className: "nice-export-btn nice-export-btn--primary",
354
+ onClick: H,
355
+ disabled: V || z.filter((b) => b.include).length === 0,
356
+ children: V ? $("dataExportCenter.exporting", "Exporting... {progress}%").replace(
357
+ "{progress}",
358
+ String(B)
359
+ ) : $("dataExportCenter.exportNow", "Export Now")
360
+ }
361
+ ),
362
+ o && /* @__PURE__ */ e(
363
+ "button",
364
+ {
365
+ type: "button",
366
+ className: "nice-export-btn nice-export-btn--secondary",
367
+ onClick: () => o({
368
+ id: Date.now().toString(),
369
+ name: `Template ${s.length + 1}`,
370
+ format: M,
371
+ fields: z,
372
+ options: N
373
+ }),
374
+ children: $("dataExportCenter.saveAsTemplate", "Save as Template")
375
+ }
376
+ )
377
+ ] })
387
378
  ] }),
388
- /* @__PURE__ */ c("div", { className: "nice-export-template-actions", children: [
389
- /* @__PURE__ */ e(
390
- "button",
391
- {
392
- type: "button",
393
- onClick: () => {
394
- q(v.id), I("export");
395
- },
396
- children: "Use"
379
+ P === "templates" && /* @__PURE__ */ e("div", { className: "nice-export-templates", children: s.map((b) => /* @__PURE__ */ c("div", { className: "nice-export-template", children: [
380
+ /* @__PURE__ */ c("div", { className: "nice-export-template-info", children: [
381
+ /* @__PURE__ */ e("span", { className: "nice-export-template-name", children: b.name }),
382
+ /* @__PURE__ */ c("span", { className: "nice-export-template-format", children: [
383
+ Ce[b.format].icon,
384
+ " ",
385
+ Ce[b.format].label
386
+ ] }),
387
+ b.description && /* @__PURE__ */ e("span", { className: "nice-export-template-desc", children: b.description })
388
+ ] }),
389
+ /* @__PURE__ */ c("div", { className: "nice-export-template-actions", children: [
390
+ /* @__PURE__ */ e(
391
+ "button",
392
+ {
393
+ type: "button",
394
+ onClick: () => {
395
+ Y(b.id), x("export");
396
+ },
397
+ children: $("dataExportCenter.use", "Use")
398
+ }
399
+ ),
400
+ w && /* @__PURE__ */ e("button", { type: "button", onClick: () => w(b.id), children: $("dataExportCenter.delete", "Delete") })
401
+ ] })
402
+ ] }, b.id)) }),
403
+ P === "history" && /* @__PURE__ */ e(
404
+ Lc,
405
+ {
406
+ jobs: a,
407
+ onDownload: (b) => {
408
+ b.downloadUrl && window.open(b.downloadUrl, "_blank");
397
409
  }
398
- ),
399
- T && /* @__PURE__ */ e("button", { type: "button", onClick: () => T(v.id), children: "Delete" })
400
- ] })
401
- ] }, v.id)) }),
402
- A === "history" && /* @__PURE__ */ e(
403
- xc,
404
- {
405
- jobs: n,
406
- onDownload: (v) => {
407
- v.downloadUrl && window.open(v.downloadUrl, "_blank");
408
410
  }
409
- }
410
- )
411
- ] })
412
- ] });
413
- }
414
- );
415
- zc.displayName = "NiceDataExportCenter";
416
- const se = {
411
+ )
412
+ ] })
413
+ ] });
414
+ }
415
+ ),
416
+ { displayName: "NiceDataExportCenter" }
417
+ ), ne = {
417
418
  create: {
418
- icon: /* @__PURE__ */ e(Se, { size: 16 }),
419
+ icon: /* @__PURE__ */ e(Te, { size: 16 }),
419
420
  label: "Created",
420
421
  color: "var(--nice-color-success, #10b981)"
421
422
  },
422
423
  update: {
423
- icon: /* @__PURE__ */ e(Oe, { size: 16 }),
424
+ icon: /* @__PURE__ */ e(je, { size: 16 }),
424
425
  label: "Updated",
425
426
  color: "var(--nice-color-primary, #3b82f6)"
426
427
  },
427
428
  delete: {
428
- icon: /* @__PURE__ */ e(ge, { size: 16 }),
429
+ icon: /* @__PURE__ */ e(be, { size: 16 }),
429
430
  label: "Deleted",
430
431
  color: "var(--nice-color-error, #ef4444)"
431
432
  },
432
- view: { icon: /* @__PURE__ */ e(Ze, { size: 16 }), label: "Viewed", color: "var(--nice-text-muted, #6b7280)" },
433
+ view: { icon: /* @__PURE__ */ e(cc, { size: 16 }), label: "Viewed", color: "var(--nice-text-muted, #6b7280)" },
433
434
  export: {
434
- icon: /* @__PURE__ */ e(me, { size: 16 }),
435
+ icon: /* @__PURE__ */ e(ve, { size: 16 }),
435
436
  label: "Exported",
436
437
  color: "var(--nice-color-accent, #8b5cf6)"
437
438
  },
438
439
  import: {
439
- icon: /* @__PURE__ */ e(Xe, { size: 16 }),
440
+ icon: /* @__PURE__ */ e(ec, { size: 16 }),
440
441
  label: "Imported",
441
442
  color: "var(--nice-color-accent, #8b5cf6)"
442
443
  },
443
444
  approve: {
444
- icon: /* @__PURE__ */ e(ae, { size: 16 }),
445
+ icon: /* @__PURE__ */ e(se, { size: 16 }),
445
446
  label: "Approved",
446
447
  color: "var(--nice-color-success, #10b981)"
447
448
  },
448
449
  reject: {
449
- icon: /* @__PURE__ */ e(oe, { size: 16 }),
450
+ icon: /* @__PURE__ */ e(he, { size: 16 }),
450
451
  label: "Rejected",
451
452
  color: "var(--nice-color-error, #ef4444)"
452
453
  },
453
454
  login: {
454
- icon: /* @__PURE__ */ e(We, { size: 16 }),
455
+ icon: /* @__PURE__ */ e(Qe, { size: 16 }),
455
456
  label: "Login",
456
457
  color: "var(--nice-color-success, #10b981)"
457
458
  },
458
459
  logout: {
459
- icon: /* @__PURE__ */ e(Re, { size: 16 }),
460
+ icon: /* @__PURE__ */ e(Me, { size: 16 }),
460
461
  label: "Logout",
461
462
  color: "var(--nice-text-muted, #6b7280)"
462
463
  },
463
464
  permission_change: {
464
- icon: /* @__PURE__ */ e(be, { size: 16 }),
465
+ icon: /* @__PURE__ */ e(fe, { size: 16 }),
465
466
  label: "Permissions",
466
467
  color: "var(--nice-color-warning, #f59e0b)"
467
468
  },
468
469
  config_change: {
469
- icon: /* @__PURE__ */ e(Pe, { size: 16 }),
470
+ icon: /* @__PURE__ */ e($e, { size: 16 }),
470
471
  label: "Config",
471
472
  color: "var(--nice-color-warning, #f59e0b)"
472
473
  },
473
474
  custom: {
474
- icon: /* @__PURE__ */ e(Ce, { size: 16 }),
475
+ icon: /* @__PURE__ */ e(De, { size: 16 }),
475
476
  label: "Action",
476
477
  color: "var(--nice-text-muted, #6b7280)"
477
478
  }
478
- }, Tc = ({
479
- filter: i,
480
- onChange: s,
481
- availableFilters: t
479
+ }, zc = ({
480
+ filter: t,
481
+ onChange: n,
482
+ availableFilters: s
482
483
  }) => {
483
- var n, l;
484
- const a = (h, r) => {
485
- s({ ...i, [h]: r });
484
+ var l, h;
485
+ const { t: i } = K(), a = (r, o) => {
486
+ n({ ...t, [r]: o });
486
487
  };
487
488
  return /* @__PURE__ */ c("div", { className: "nice-audit-filters", children: [
488
489
  /* @__PURE__ */ c("div", { className: "nice-audit-filter-group", children: [
489
- /* @__PURE__ */ e("label", { children: "Date Range" }),
490
+ /* @__PURE__ */ e("label", { children: i("auditTrail.dateRange", "Date Range") }),
490
491
  /* @__PURE__ */ c("div", { className: "nice-audit-date-range", children: [
491
492
  /* @__PURE__ */ e(
492
493
  "input",
493
494
  {
494
495
  type: "date",
495
- value: ((n = i.startDate) == null ? void 0 : n.toISOString().split("T")[0]) || "",
496
- onChange: (h) => a("startDate", h.target.value ? new Date(h.target.value) : void 0)
496
+ value: ((l = t.startDate) == null ? void 0 : l.toISOString().split("T")[0]) || "",
497
+ onChange: (r) => a("startDate", r.target.value ? new Date(r.target.value) : void 0)
497
498
  }
498
499
  ),
499
- /* @__PURE__ */ e("span", { children: "to" }),
500
+ /* @__PURE__ */ e("span", { children: i("auditTrail.to", "to") }),
500
501
  /* @__PURE__ */ e(
501
502
  "input",
502
503
  {
503
504
  type: "date",
504
- value: ((l = i.endDate) == null ? void 0 : l.toISOString().split("T")[0]) || "",
505
- onChange: (h) => a("endDate", h.target.value ? new Date(h.target.value) : void 0)
505
+ value: ((h = t.endDate) == null ? void 0 : h.toISOString().split("T")[0]) || "",
506
+ onChange: (r) => a("endDate", r.target.value ? new Date(r.target.value) : void 0)
506
507
  }
507
508
  )
508
509
  ] })
509
510
  ] }),
510
511
  /* @__PURE__ */ c("div", { className: "nice-audit-filter-group", children: [
511
- /* @__PURE__ */ e("label", { children: "Actions" }),
512
- /* @__PURE__ */ e("div", { className: "nice-audit-action-chips", children: Object.keys(se).slice(0, 8).map((h) => {
513
- var T;
514
- const r = se[h], u = (T = i.actions) == null ? void 0 : T.includes(h);
512
+ /* @__PURE__ */ e("label", { children: i("auditTrail.actions", "Actions") }),
513
+ /* @__PURE__ */ e("div", { className: "nice-audit-action-chips", children: Object.keys(ne).slice(0, 8).map((r) => {
514
+ var A;
515
+ const o = ne[r], w = (A = t.actions) == null ? void 0 : A.includes(r);
515
516
  return /* @__PURE__ */ c(
516
517
  "button",
517
518
  {
518
519
  type: "button",
519
- className: `nice-audit-chip ${u ? "nice-audit-chip--selected" : ""}`,
520
- style: { "--chip-color": r.color },
520
+ className: `nice-audit-chip ${w ? "nice-audit-chip--selected" : ""}`,
521
+ style: { "--chip-color": o.color },
521
522
  onClick: () => {
522
- const E = i.actions || [];
523
+ const I = t.actions || [];
523
524
  a(
524
525
  "actions",
525
- u ? E.filter((S) => S !== h) : [...E, h]
526
+ w ? I.filter((C) => C !== r) : [...I, r]
526
527
  );
527
528
  },
528
529
  children: [
529
- /* @__PURE__ */ e("span", { className: "nice-audit-chip-icon", children: r.icon }),
530
- r.label
530
+ /* @__PURE__ */ e("span", { className: "nice-audit-chip-icon", children: o.icon }),
531
+ o.label
531
532
  ]
532
533
  },
533
- h
534
+ r
534
535
  );
535
536
  }) })
536
537
  ] }),
537
538
  /* @__PURE__ */ c("div", { className: "nice-audit-filter-group", children: [
538
- /* @__PURE__ */ e("label", { children: "Search" }),
539
+ /* @__PURE__ */ e("label", { children: i("auditTrail.search", "Search") }),
539
540
  /* @__PURE__ */ e(
540
541
  "input",
541
542
  {
542
543
  type: "text",
543
544
  className: "nice-audit-search",
544
- placeholder: "Search entries...",
545
- value: i.searchQuery || "",
546
- onChange: (h) => a("searchQuery", h.target.value || void 0)
545
+ placeholder: i("auditTrail.searchEntries", "Search entries..."),
546
+ value: t.searchQuery || "",
547
+ onChange: (r) => a("searchQuery", r.target.value || void 0)
547
548
  }
548
549
  )
549
550
  ] })
550
551
  ] });
551
- }, _c = ({ changes: i }) => {
552
- if (!i.length)
552
+ }, Ac = ({ changes: t }) => {
553
+ if (!t.length)
553
554
  return null;
554
- const s = (t, a) => a || (t == null ? "(empty)" : typeof t == "object" ? JSON.stringify(t, null, 2) : String(t));
555
- return /* @__PURE__ */ e("div", { className: "nice-audit-diff", children: i.map((t, a) => /* @__PURE__ */ c("div", { className: "nice-audit-diff-row", children: [
556
- /* @__PURE__ */ e("span", { className: "nice-audit-diff-field", children: t.field }),
555
+ const n = (s, i) => i || (s == null ? "(empty)" : typeof s == "object" ? JSON.stringify(s, null, 2) : String(s));
556
+ return /* @__PURE__ */ e("div", { className: "nice-audit-diff", children: t.map((s, i) => /* @__PURE__ */ c("div", { className: "nice-audit-diff-row", children: [
557
+ /* @__PURE__ */ e("span", { className: "nice-audit-diff-field", children: s.field }),
557
558
  /* @__PURE__ */ c("div", { className: "nice-audit-diff-values", children: [
558
- /* @__PURE__ */ e("span", { className: "nice-audit-diff-old", children: s(t.oldValue, t.displayOldValue) }),
559
- /* @__PURE__ */ e("span", { className: "nice-audit-diff-arrow", children: /* @__PURE__ */ e(Qe, { size: 14 }) }),
560
- /* @__PURE__ */ e("span", { className: "nice-audit-diff-new", children: s(t.newValue, t.displayNewValue) })
559
+ /* @__PURE__ */ e("span", { className: "nice-audit-diff-old", children: n(s.oldValue, s.displayOldValue) }),
560
+ /* @__PURE__ */ e("span", { className: "nice-audit-diff-arrow", children: /* @__PURE__ */ e(tc, { size: 14 }) }),
561
+ /* @__PURE__ */ e("span", { className: "nice-audit-diff-new", children: n(s.newValue, s.displayNewValue) })
561
562
  ] })
562
- ] }, a)) });
563
- }, Lc = ({
564
- entry: i,
565
- showDiff: s,
566
- renderActionIcon: t,
567
- renderUser: a,
568
- onClick: n
563
+ ] }, i)) });
564
+ }, _c = ({
565
+ entry: t,
566
+ showDiff: n,
567
+ renderActionIcon: s,
568
+ renderUser: i,
569
+ onClick: a
569
570
  }) => {
570
- const [l, h] = w(!1), r = se[i.action] || se.custom;
571
+ const { t: l } = K(), [h, r] = k(!1), o = ne[t.action] || ne.custom;
571
572
  return /* @__PURE__ */ c(
572
573
  "div",
573
574
  {
574
- className: `nice-audit-timeline-entry nice-audit-timeline-entry--${i.severity || "info"}`,
575
- onClick: n,
576
- role: n ? "button" : void 0,
577
- tabIndex: n ? 0 : void 0,
575
+ className: `nice-audit-timeline-entry nice-audit-timeline-entry--${t.severity || "info"}`,
576
+ onClick: a,
577
+ role: a ? "button" : void 0,
578
+ tabIndex: a ? 0 : void 0,
578
579
  children: [
579
580
  /* @__PURE__ */ e(
580
581
  "div",
581
582
  {
582
583
  className: "nice-audit-timeline-marker",
583
- style: { "--marker-color": r.color },
584
- children: t ? t(i.action) : r.icon
584
+ style: { "--marker-color": o.color },
585
+ children: s ? s(t.action) : o.icon
585
586
  }
586
587
  ),
587
588
  /* @__PURE__ */ c("div", { className: "nice-audit-timeline-content", children: [
588
589
  /* @__PURE__ */ c("div", { className: "nice-audit-timeline-header", children: [
589
- /* @__PURE__ */ e("span", { className: "nice-audit-timeline-action", children: i.actionLabel || r.label }),
590
+ /* @__PURE__ */ e("span", { className: "nice-audit-timeline-action", children: t.actionLabel || o.label }),
590
591
  /* @__PURE__ */ c("span", { className: "nice-audit-timeline-entity", children: [
591
- i.entityType,
592
+ t.entityType,
592
593
  " ",
593
- i.entityName && `"${i.entityName}"`
594
+ t.entityName && `"${t.entityName}"`
594
595
  ] }),
595
- /* @__PURE__ */ e("span", { className: "nice-audit-timeline-time", children: new Date(i.timestamp).toLocaleString() })
596
+ /* @__PURE__ */ e("span", { className: "nice-audit-timeline-time", children: new Date(t.timestamp).toLocaleString() })
596
597
  ] }),
597
- /* @__PURE__ */ e("div", { className: "nice-audit-timeline-user", children: a ? a(i) : /* @__PURE__ */ c(ee, { children: [
598
- i.userAvatar && /* @__PURE__ */ e("img", { src: i.userAvatar, alt: "", className: "nice-audit-avatar" }),
599
- /* @__PURE__ */ e("span", { className: "nice-audit-username", children: i.userName }),
600
- i.userRole && /* @__PURE__ */ e("span", { className: "nice-audit-role", children: i.userRole })
598
+ /* @__PURE__ */ e("div", { className: "nice-audit-timeline-user", children: i ? i(t) : /* @__PURE__ */ c(te, { children: [
599
+ t.userAvatar && /* @__PURE__ */ e("img", { src: t.userAvatar, alt: "", className: "nice-audit-avatar" }),
600
+ /* @__PURE__ */ e("span", { className: "nice-audit-username", children: t.userName }),
601
+ t.userRole && /* @__PURE__ */ e("span", { className: "nice-audit-role", children: t.userRole })
601
602
  ] }) }),
602
- i.notes && /* @__PURE__ */ e("div", { className: "nice-audit-timeline-notes", children: i.notes }),
603
- s && i.changes && i.changes.length > 0 && /* @__PURE__ */ c(ee, { children: [
603
+ t.notes && /* @__PURE__ */ e("div", { className: "nice-audit-timeline-notes", children: t.notes }),
604
+ n && t.changes && t.changes.length > 0 && /* @__PURE__ */ c(te, { children: [
604
605
  /* @__PURE__ */ e(
605
606
  "button",
606
607
  {
607
608
  type: "button",
608
609
  className: "nice-audit-expand-btn",
609
- onClick: (u) => {
610
- u.stopPropagation(), h(!l);
610
+ onClick: (w) => {
611
+ w.stopPropagation(), r(!h);
611
612
  },
612
- children: l ? /* @__PURE__ */ c(ee, { children: [
613
- /* @__PURE__ */ e(De, { size: 14 }),
614
- " Hide changes"
615
- ] }) : /* @__PURE__ */ c(ee, { children: [
616
- /* @__PURE__ */ e($e, { size: 14 }),
617
- " Show ",
618
- i.changes.length,
619
- " changes"
613
+ children: h ? /* @__PURE__ */ c(te, { children: [
614
+ /* @__PURE__ */ e(Se, { size: 14 }),
615
+ " ",
616
+ l("auditTrail.hideChanges", "Hide changes")
617
+ ] }) : /* @__PURE__ */ c(te, { children: [
618
+ /* @__PURE__ */ e(Fe, { size: 14 }),
619
+ " ",
620
+ l("auditTrail.showChanges", "Show {changes} changes").replace(
621
+ "{changes}",
622
+ String(t.changes.length)
623
+ )
620
624
  ] })
621
625
  }
622
626
  ),
623
- l && /* @__PURE__ */ e(_c, { changes: i.changes })
627
+ h && /* @__PURE__ */ e(Ac, { changes: t.changes })
624
628
  ] }),
625
- i.ipAddress && /* @__PURE__ */ c("div", { className: "nice-audit-timeline-meta", children: [
626
- /* @__PURE__ */ c("span", { children: [
627
- "IP: ",
628
- i.ipAddress
629
- ] }),
630
- i.location && /* @__PURE__ */ c("span", { children: [
629
+ t.ipAddress && /* @__PURE__ */ c("div", { className: "nice-audit-timeline-meta", children: [
630
+ /* @__PURE__ */ e("span", { children: l("auditTrail.ip", "IP: {ipAddress}").replace(
631
+ "{ipAddress}",
632
+ String(t.ipAddress)
633
+ ) }),
634
+ t.location && /* @__PURE__ */ c("span", { children: [
631
635
  "• ",
632
- i.location
636
+ t.location
633
637
  ] })
634
638
  ] })
635
639
  ] })
636
640
  ]
637
641
  }
638
642
  );
639
- }, Ac = ({ entries: i, showDiff: s, onEntryClick: t }) => /* @__PURE__ */ c("table", { className: "nice-audit-table", children: [
640
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
641
- /* @__PURE__ */ e("th", { children: "Timestamp" }),
642
- /* @__PURE__ */ e("th", { children: "Action" }),
643
- /* @__PURE__ */ e("th", { children: "User" }),
644
- /* @__PURE__ */ e("th", { children: "Entity" }),
645
- /* @__PURE__ */ e("th", { children: "Changes" }),
646
- /* @__PURE__ */ e("th", { children: "IP Address" })
647
- ] }) }),
648
- /* @__PURE__ */ e("tbody", { children: i.map((a) => {
649
- const n = se[a.action] || se.custom;
650
- return /* @__PURE__ */ c(
651
- "tr",
652
- {
653
- className: `nice-audit-row nice-audit-row--${a.severity || "info"}`,
654
- onClick: () => t == null ? void 0 : t(a),
655
- role: t ? "button" : void 0,
656
- children: [
657
- /* @__PURE__ */ e("td", { className: "nice-audit-cell-time", children: new Date(a.timestamp).toLocaleString() }),
658
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ c(
659
- "span",
660
- {
661
- className: "nice-audit-action-badge",
662
- style: { "--badge-color": n.color },
663
- children: [
664
- n.icon,
665
- " ",
666
- a.actionLabel || n.label
667
- ]
668
- }
669
- ) }),
670
- /* @__PURE__ */ c("td", { className: "nice-audit-cell-user", children: [
671
- a.userAvatar && /* @__PURE__ */ e("img", { src: a.userAvatar, alt: "", className: "nice-audit-avatar-sm" }),
672
- a.userName
673
- ] }),
674
- /* @__PURE__ */ c("td", { children: [
675
- a.entityType,
676
- a.entityName && `: ${a.entityName}`
677
- ] }),
678
- /* @__PURE__ */ e("td", { children: a.changes && a.changes.length > 0 ? /* @__PURE__ */ c("span", { className: "nice-audit-changes-count", children: [
679
- a.changes.length,
680
- " field(s)"
681
- ] }) : "-" }),
682
- /* @__PURE__ */ e("td", { className: "nice-audit-cell-ip", children: a.ipAddress || "-" })
683
- ]
684
- },
685
- a.id
686
- );
687
- }) })
688
- ] }), Ic = te(
689
- ({
690
- dataSource: i,
691
- initialFilter: s = {},
692
- pageSize: t = 50,
693
- viewMode: a = "timeline",
694
- enableExport: n = !0,
695
- showDiffs: l = !0,
696
- renderActionIcon: h,
697
- renderUser: r,
698
- onEntryClick: u,
699
- onExport: T,
700
- title: E = "Audit Trail",
701
- className: S = "",
702
- style: y
703
- }, J) => {
704
- const [_, K] = w([]), [O, M] = w(0), [j, U] = w(s), [B, m] = w(1), [k, g] = w(!1), [Y, p] = w(a), [P, A] = w(!1), I = $(async () => {
705
- g(!0);
706
- try {
707
- const v = await i.fetchEntries(j, { page: B, pageSize: t });
708
- K(v.entries), M(v.totalCount);
709
- } finally {
710
- g(!1);
711
- }
712
- }, [i, j, B, t]);
713
- vc.useEffect(() => {
714
- I();
715
- }, [I]);
716
- const C = $(
717
- (v) => {
718
- if (T)
719
- T(_, v);
720
- else {
721
- let x, z;
722
- if (v === "json")
723
- x = JSON.stringify(_, null, 2), z = "application/json";
643
+ }, Ic = ({ entries: t, showDiff: n, onEntryClick: s }) => {
644
+ const { t: i } = K();
645
+ return /* @__PURE__ */ c("table", { className: "nice-audit-table", children: [
646
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
647
+ /* @__PURE__ */ e("th", { children: i("auditTrail.timestamp", "Timestamp") }),
648
+ /* @__PURE__ */ e("th", { children: i("auditTrail.action", "Action") }),
649
+ /* @__PURE__ */ e("th", { children: i("auditTrail.user", "User") }),
650
+ /* @__PURE__ */ e("th", { children: i("auditTrail.entity", "Entity") }),
651
+ /* @__PURE__ */ e("th", { children: i("auditTrail.changes", "Changes") }),
652
+ /* @__PURE__ */ e("th", { children: i("auditTrail.ipAddress", "IP Address") })
653
+ ] }) }),
654
+ /* @__PURE__ */ e("tbody", { children: t.map((a) => {
655
+ const l = ne[a.action] || ne.custom;
656
+ return /* @__PURE__ */ c(
657
+ "tr",
658
+ {
659
+ className: `nice-audit-row nice-audit-row--${a.severity || "info"}`,
660
+ onClick: () => s == null ? void 0 : s(a),
661
+ role: s ? "button" : void 0,
662
+ children: [
663
+ /* @__PURE__ */ e("td", { className: "nice-audit-cell-time", children: new Date(a.timestamp).toLocaleString() }),
664
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ c(
665
+ "span",
666
+ {
667
+ className: "nice-audit-action-badge",
668
+ style: { "--badge-color": l.color },
669
+ children: [
670
+ l.icon,
671
+ " ",
672
+ a.actionLabel || l.label
673
+ ]
674
+ }
675
+ ) }),
676
+ /* @__PURE__ */ c("td", { className: "nice-audit-cell-user", children: [
677
+ a.userAvatar && /* @__PURE__ */ e("img", { src: a.userAvatar, alt: "", className: "nice-audit-avatar-sm" }),
678
+ a.userName
679
+ ] }),
680
+ /* @__PURE__ */ c("td", { children: [
681
+ a.entityType,
682
+ a.entityName && `: ${a.entityName}`
683
+ ] }),
684
+ /* @__PURE__ */ e("td", { children: a.changes && a.changes.length > 0 ? /* @__PURE__ */ e("span", { className: "nice-audit-changes-count", children: i("auditTrail.fieldS", "{changes} field(s)").replace(
685
+ "{changes}",
686
+ String(a.changes.length)
687
+ ) }) : "-" }),
688
+ /* @__PURE__ */ e("td", { className: "nice-audit-cell-ip", children: a.ipAddress || "-" })
689
+ ]
690
+ },
691
+ a.id
692
+ );
693
+ }) })
694
+ ] });
695
+ }, it = /* @__PURE__ */ Object.assign(
696
+ /* @__PURE__ */ le(
697
+ ({
698
+ dataSource: t,
699
+ initialFilter: n = {},
700
+ pageSize: s = 50,
701
+ viewMode: i = "timeline",
702
+ enableExport: a = !0,
703
+ showDiffs: l = !0,
704
+ renderActionIcon: h,
705
+ renderUser: r,
706
+ onEntryClick: o,
707
+ onExport: w,
708
+ title: A,
709
+ className: I = "",
710
+ style: C
711
+ }, L) => {
712
+ const { t: F } = K(), U = A ?? F("auditTrail.title", "Audit Trail"), [E, $] = k([]), [ce, M] = k(0), [q, z] = k(n), [m, N] = k(1), [g, V] = k(!1), [u, B] = k(i), [O, P] = k(!1), x = R(async () => {
713
+ V(!0);
714
+ try {
715
+ const b = await t.fetchEntries(q, { page: m, pageSize: s });
716
+ $(b.entries), M(b.totalCount);
717
+ } finally {
718
+ V(!1);
719
+ }
720
+ }, [t, q, m, s]);
721
+ kc.useEffect(() => {
722
+ x();
723
+ }, [x]);
724
+ const H = R(
725
+ (b) => {
726
+ if (w)
727
+ w(E, b);
724
728
  else {
725
- const L = [
726
- "Timestamp",
727
- "Action",
728
- "User",
729
- "Entity Type",
730
- "Entity",
731
- "IP",
732
- "Changes"
733
- ], W = _.map((F) => {
734
- var Q;
735
- return [
736
- new Date(F.timestamp).toISOString(),
737
- F.action,
738
- F.userName,
739
- F.entityType,
740
- F.entityName || F.entityId,
741
- F.ipAddress || "",
742
- ((Q = F.changes) == null ? void 0 : Q.length) || 0
743
- ];
744
- });
745
- x = [L.join(","), ...W.map((F) => F.join(","))].join(`
746
- `), z = "text/csv";
729
+ let S, _;
730
+ if (b === "json")
731
+ S = JSON.stringify(E, null, 2), _ = "application/json";
732
+ else {
733
+ const X = [
734
+ "Timestamp",
735
+ "Action",
736
+ "User",
737
+ "Entity Type",
738
+ "Entity",
739
+ "IP",
740
+ "Changes"
741
+ ], Z = E.map((G) => {
742
+ var v;
743
+ return [
744
+ new Date(G.timestamp).toISOString(),
745
+ G.action,
746
+ G.userName,
747
+ G.entityType,
748
+ G.entityName || G.entityId,
749
+ G.ipAddress || "",
750
+ ((v = G.changes) == null ? void 0 : v.length) || 0
751
+ ];
752
+ });
753
+ S = [X.join(","), ...Z.map((G) => G.join(","))].join(`
754
+ `), _ = "text/csv";
755
+ }
756
+ const J = new Blob([S], { type: _ }), f = URL.createObjectURL(J), T = document.createElement("a");
757
+ T.href = f, T.download = `audit-trail-${Date.now()}.${b}`, T.click(), URL.revokeObjectURL(f);
747
758
  }
748
- const G = new Blob([x], { type: z }), V = URL.createObjectURL(G), b = document.createElement("a");
749
- b.href = V, b.download = `audit-trail-${Date.now()}.${v}`, b.click(), URL.revokeObjectURL(V);
750
- }
751
- },
752
- [_, T]
753
- );
754
- ne(J, () => ({
755
- refresh: I,
756
- setFilter: (v) => {
757
- U(v), m(1);
758
- },
759
- getEntries: () => _
760
- }));
761
- const q = Math.ceil(O / t);
762
- return /* @__PURE__ */ c("div", { className: `nice-audit-trail ${S}`, style: y, children: [
763
- /* @__PURE__ */ c("div", { className: "nice-audit-header", children: [
764
- /* @__PURE__ */ e("h3", { className: "nice-audit-title", children: E }),
765
- /* @__PURE__ */ c("div", { className: "nice-audit-header-actions", children: [
766
- /* @__PURE__ */ e(
767
- "button",
759
+ },
760
+ [E, w]
761
+ );
762
+ re(L, () => ({
763
+ refresh: x,
764
+ setFilter: (b) => {
765
+ z(b), N(1);
766
+ },
767
+ getEntries: () => E
768
+ }));
769
+ const Y = Math.ceil(ce / s);
770
+ return /* @__PURE__ */ c("div", { className: `nice-audit-trail ${I}`, style: C, children: [
771
+ /* @__PURE__ */ c("div", { className: "nice-audit-header", children: [
772
+ /* @__PURE__ */ e("h3", { className: "nice-audit-title", children: U }),
773
+ /* @__PURE__ */ c("div", { className: "nice-audit-header-actions", children: [
774
+ /* @__PURE__ */ e(
775
+ "button",
776
+ {
777
+ type: "button",
778
+ className: `nice-audit-view-btn ${u === "timeline" ? "nice-audit-view-btn--active" : ""}`,
779
+ onClick: () => B("timeline"),
780
+ title: F("auditTrail.timelineView", "Timeline view"),
781
+ children: /* @__PURE__ */ e(Xe, { size: 16 })
782
+ }
783
+ ),
784
+ /* @__PURE__ */ e(
785
+ "button",
786
+ {
787
+ type: "button",
788
+ className: `nice-audit-view-btn ${u === "table" ? "nice-audit-view-btn--active" : ""}`,
789
+ onClick: () => B("table"),
790
+ title: F("auditTrail.tableView", "Table view"),
791
+ children: /* @__PURE__ */ e(Ze, { size: 16 })
792
+ }
793
+ ),
794
+ /* @__PURE__ */ c(
795
+ "button",
796
+ {
797
+ type: "button",
798
+ className: `nice-audit-filter-btn ${O ? "nice-audit-filter-btn--active" : ""}`,
799
+ onClick: () => P(!O),
800
+ children: [
801
+ /* @__PURE__ */ e(ge, { size: 16 }),
802
+ " ",
803
+ F("auditTrail.filter", "Filter")
804
+ ]
805
+ }
806
+ ),
807
+ a && /* @__PURE__ */ c("div", { className: "nice-audit-export-dropdown", children: [
808
+ /* @__PURE__ */ c("button", { type: "button", className: "nice-audit-export-btn", children: [
809
+ /* @__PURE__ */ e(ve, { size: 16 }),
810
+ " ",
811
+ F("auditTrail.export", "Export")
812
+ ] }),
813
+ /* @__PURE__ */ c("div", { className: "nice-audit-export-menu", children: [
814
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => H("csv"), children: F("auditTrail.exportAsCsv", "Export as CSV") }),
815
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => H("json"), children: F("auditTrail.exportAsJson", "Export as JSON") })
816
+ ] })
817
+ ] })
818
+ ] })
819
+ ] }),
820
+ O && /* @__PURE__ */ e(zc, { filter: q, onChange: z }),
821
+ /* @__PURE__ */ c("div", { className: "nice-audit-stats", children: [
822
+ /* @__PURE__ */ e("span", { children: F("auditTrail.showingOfEntries", "Showing {entries} of {totalCount} entries").replace("{entries}", String(E.length)).replace("{totalCount}", String(ce)) }),
823
+ q.startDate && q.endDate && /* @__PURE__ */ c("span", { className: "nice-audit-date-indicator", children: [
824
+ q.startDate.toLocaleDateString(),
825
+ " - ",
826
+ q.endDate.toLocaleDateString()
827
+ ] })
828
+ ] }),
829
+ /* @__PURE__ */ c("div", { className: `nice-audit-content ${g ? "nice-audit-content--loading" : ""}`, children: [
830
+ g && /* @__PURE__ */ e("div", { className: "nice-audit-loader", children: /* @__PURE__ */ e("div", { className: "nice-audit-spinner" }) }),
831
+ u === "timeline" ? /* @__PURE__ */ e("div", { className: "nice-audit-timeline", children: E.map((b) => /* @__PURE__ */ e(
832
+ _c,
768
833
  {
769
- type: "button",
770
- className: `nice-audit-view-btn ${Y === "timeline" ? "nice-audit-view-btn--active" : ""}`,
771
- onClick: () => p("timeline"),
772
- title: "Timeline view",
773
- children: /* @__PURE__ */ e(Ge, { size: 16 })
774
- }
775
- ),
834
+ entry: b,
835
+ showDiff: l,
836
+ renderActionIcon: h,
837
+ renderUser: r,
838
+ onClick: o ? () => o(b) : void 0
839
+ },
840
+ b.id
841
+ )) }) : /* @__PURE__ */ e(Ic, { entries: E, showDiff: l, onEntryClick: o }),
842
+ E.length === 0 && !g && /* @__PURE__ */ e("div", { className: "nice-audit-empty", children: F(
843
+ "auditTrail.noAuditEntriesFoundMatching",
844
+ "No audit entries found matching the current filters."
845
+ ) })
846
+ ] }),
847
+ Y > 1 && /* @__PURE__ */ c("div", { className: "nice-audit-pagination", children: [
848
+ /* @__PURE__ */ e("button", { type: "button", disabled: m === 1, onClick: () => N(m - 1), children: F("auditTrail.previous", "Previous") }),
849
+ /* @__PURE__ */ e("span", { children: F("auditTrail.pageOf", "Page {page} of {totalPages}").replace("{page}", String(m)).replace("{totalPages}", String(Y)) }),
776
850
  /* @__PURE__ */ e(
777
851
  "button",
778
852
  {
779
853
  type: "button",
780
- className: `nice-audit-view-btn ${Y === "table" ? "nice-audit-view-btn--active" : ""}`,
781
- onClick: () => p("table"),
782
- title: "Table view",
783
- children: /* @__PURE__ */ e(Ke, { size: 16 })
784
- }
785
- ),
786
- /* @__PURE__ */ c(
787
- "button",
788
- {
789
- type: "button",
790
- className: `nice-audit-filter-btn ${P ? "nice-audit-filter-btn--active" : ""}`,
791
- onClick: () => A(!P),
792
- children: [
793
- /* @__PURE__ */ e(pe, { size: 16 }),
794
- " Filter"
795
- ]
854
+ disabled: m === Y,
855
+ onClick: () => N(m + 1),
856
+ children: F("auditTrail.next", "Next")
796
857
  }
797
- ),
798
- n && /* @__PURE__ */ c("div", { className: "nice-audit-export-dropdown", children: [
799
- /* @__PURE__ */ c("button", { type: "button", className: "nice-audit-export-btn", children: [
800
- /* @__PURE__ */ e(me, { size: 16 }),
801
- " Export"
802
- ] }),
803
- /* @__PURE__ */ c("div", { className: "nice-audit-export-menu", children: [
804
- /* @__PURE__ */ e("button", { type: "button", onClick: () => C("csv"), children: "Export as CSV" }),
805
- /* @__PURE__ */ e("button", { type: "button", onClick: () => C("json"), children: "Export as JSON" })
806
- ] })
807
- ] })
808
- ] })
809
- ] }),
810
- P && /* @__PURE__ */ e(Tc, { filter: j, onChange: U }),
811
- /* @__PURE__ */ c("div", { className: "nice-audit-stats", children: [
812
- /* @__PURE__ */ c("span", { children: [
813
- "Showing ",
814
- _.length,
815
- " of ",
816
- O,
817
- " entries"
818
- ] }),
819
- j.startDate && j.endDate && /* @__PURE__ */ c("span", { className: "nice-audit-date-indicator", children: [
820
- j.startDate.toLocaleDateString(),
821
- " - ",
822
- j.endDate.toLocaleDateString()
858
+ )
823
859
  ] })
824
- ] }),
825
- /* @__PURE__ */ c("div", { className: `nice-audit-content ${k ? "nice-audit-content--loading" : ""}`, children: [
826
- k && /* @__PURE__ */ e("div", { className: "nice-audit-loader", children: /* @__PURE__ */ e("div", { className: "nice-audit-spinner" }) }),
827
- Y === "timeline" ? /* @__PURE__ */ e("div", { className: "nice-audit-timeline", children: _.map((v) => /* @__PURE__ */ e(
828
- Lc,
829
- {
830
- entry: v,
831
- showDiff: l,
832
- renderActionIcon: h,
833
- renderUser: r,
834
- onClick: u ? () => u(v) : void 0
835
- },
836
- v.id
837
- )) }) : /* @__PURE__ */ e(Ac, { entries: _, showDiff: l, onEntryClick: u }),
838
- _.length === 0 && !k && /* @__PURE__ */ e("div", { className: "nice-audit-empty", children: "No audit entries found matching the current filters." })
839
- ] }),
840
- q > 1 && /* @__PURE__ */ c("div", { className: "nice-audit-pagination", children: [
841
- /* @__PURE__ */ e("button", { type: "button", disabled: B === 1, onClick: () => m(B - 1), children: "Previous" }),
842
- /* @__PURE__ */ c("span", { children: [
843
- "Page ",
844
- B,
845
- " of ",
846
- q
847
- ] }),
848
- /* @__PURE__ */ e("button", { type: "button", disabled: B === q, onClick: () => m(B + 1), children: "Next" })
849
- ] })
850
- ] });
851
- }
852
- );
853
- Ic.displayName = "NiceAuditTrail";
854
- const Fc = [
860
+ ] });
861
+ }
862
+ ),
863
+ { displayName: "NiceAuditTrail" }
864
+ ), Oc = [
855
865
  {
856
866
  target: ".nice-contract-editor",
857
867
  titleKey: "tutorial.contractEditor.intro.title",
@@ -864,59 +874,59 @@ const Fc = [
864
874
  general: {
865
875
  label: "General",
866
876
  color: "var(--nice-text-muted, #6b7280)",
867
- icon: /* @__PURE__ */ e(we, { size: 16 })
877
+ icon: /* @__PURE__ */ e(xe, { size: 16 })
868
878
  },
869
879
  liability: {
870
880
  label: "Liability",
871
881
  color: "var(--nice-color-error, #ef4444)",
872
- icon: /* @__PURE__ */ e(Me, { size: 16 })
882
+ icon: /* @__PURE__ */ e(Ue, { size: 16 })
873
883
  },
874
884
  payment: {
875
885
  label: "Payment",
876
886
  color: "var(--nice-color-success, #10b981)",
877
- icon: /* @__PURE__ */ e(sc, { size: 16 })
887
+ icon: /* @__PURE__ */ e(lc, { size: 16 })
878
888
  },
879
889
  termination: {
880
890
  label: "Termination",
881
891
  color: "var(--nice-color-warning, #f59e0b)",
882
- icon: /* @__PURE__ */ e(ac, { size: 16 })
892
+ icon: /* @__PURE__ */ e(nc, { size: 16 })
883
893
  },
884
894
  confidentiality: {
885
895
  label: "Confidentiality",
886
896
  color: "var(--nice-color-accent, #8b5cf6)",
887
- icon: /* @__PURE__ */ e(Ee, { size: 16 })
897
+ icon: /* @__PURE__ */ e(Ye, { size: 16 })
888
898
  },
889
899
  compliance: {
890
900
  label: "Compliance",
891
901
  color: "var(--nice-color-primary, #3b82f6)",
892
- icon: /* @__PURE__ */ e(ae, { size: 16 })
902
+ icon: /* @__PURE__ */ e(se, { size: 16 })
893
903
  },
894
904
  custom: {
895
905
  label: "Custom",
896
906
  color: "var(--nice-text-muted, #64748b)",
897
- icon: /* @__PURE__ */ e(Oe, { size: 16 })
907
+ icon: /* @__PURE__ */ e(je, { size: 16 })
898
908
  }
899
- }, $c = {
909
+ }, Pc = {
900
910
  draft: { label: "Draft", color: "var(--nice-text-muted, #6b7280)" },
901
911
  pending_review: { label: "Pending Review", color: "var(--nice-color-warning, #f59e0b)" },
902
912
  approved: { label: "Approved", color: "var(--nice-color-success, #10b981)" },
903
913
  rejected: { label: "Rejected", color: "var(--nice-color-error, #ef4444)" },
904
914
  signed: { label: "Signed", color: "var(--nice-color-accent, #8b5cf6)" }
905
- }, Pc = ({ clauses: i, onInsert: s }) => {
906
- const [t, a] = w(""), [n, l] = w("all"), h = i.filter((r) => {
907
- const u = t === "" || r.name.toLowerCase().includes(t.toLowerCase()) || r.content.toLowerCase().includes(t.toLowerCase()), T = n === "all" || r.category === n;
908
- return u && T;
915
+ }, Rc = ({ clauses: t, onInsert: n }) => {
916
+ const { t: s } = K(), [i, a] = k(""), [l, h] = k("all"), r = t.filter((o) => {
917
+ const w = i === "" || o.name.toLowerCase().includes(i.toLowerCase()) || o.content.toLowerCase().includes(i.toLowerCase()), A = l === "all" || o.category === l;
918
+ return w && A;
909
919
  });
910
920
  return /* @__PURE__ */ c("div", { className: "nice-contract-library", children: [
911
921
  /* @__PURE__ */ c("div", { className: "nice-contract-library-header", children: [
912
- /* @__PURE__ */ e("h4", { children: "Clause Library" }),
922
+ /* @__PURE__ */ e("h4", { children: s("contractEditor.clauseLibrary", "Clause Library") }),
913
923
  /* @__PURE__ */ e(
914
924
  "input",
915
925
  {
916
926
  type: "text",
917
- placeholder: "Search clauses...",
918
- value: t,
919
- onChange: (r) => a(r.target.value),
927
+ placeholder: s("contractEditor.searchClauses", "Search clauses..."),
928
+ value: i,
929
+ onChange: (o) => a(o.target.value),
920
930
  className: "nice-contract-library-search"
921
931
  }
922
932
  )
@@ -926,193 +936,200 @@ const Fc = [
926
936
  "button",
927
937
  {
928
938
  type: "button",
929
- className: `nice-contract-category-btn ${n === "all" ? "nice-contract-category-btn--active" : ""}`,
930
- onClick: () => l("all"),
931
- children: "All"
939
+ className: `nice-contract-category-btn ${l === "all" ? "nice-contract-category-btn--active" : ""}`,
940
+ onClick: () => h("all"),
941
+ children: s("contractEditor.all", "All")
932
942
  }
933
943
  ),
934
- Object.keys(ie).map((r) => /* @__PURE__ */ c(
944
+ Object.keys(ie).map((o) => /* @__PURE__ */ c(
935
945
  "button",
936
946
  {
937
947
  type: "button",
938
- className: `nice-contract-category-btn ${n === r ? "nice-contract-category-btn--active" : ""}`,
939
- onClick: () => l(r),
940
- style: { "--cat-color": ie[r].color },
948
+ className: `nice-contract-category-btn ${l === o ? "nice-contract-category-btn--active" : ""}`,
949
+ onClick: () => h(o),
950
+ style: { "--cat-color": ie[o].color },
941
951
  children: [
942
- ie[r].icon,
952
+ ie[o].icon,
943
953
  " ",
944
- ie[r].label
954
+ ie[o].label
945
955
  ]
946
956
  },
947
- r
957
+ o
948
958
  ))
949
959
  ] }),
950
960
  /* @__PURE__ */ c("div", { className: "nice-contract-library-list", children: [
951
- h.map((r) => /* @__PURE__ */ c("div", { className: "nice-contract-library-item", children: [
961
+ r.map((o) => /* @__PURE__ */ c("div", { className: "nice-contract-library-item", children: [
952
962
  /* @__PURE__ */ c("div", { className: "nice-contract-library-item-header", children: [
953
- /* @__PURE__ */ e("span", { className: "nice-contract-library-item-name", children: r.name }),
963
+ /* @__PURE__ */ e("span", { className: "nice-contract-library-item-name", children: o.name }),
954
964
  /* @__PURE__ */ e(
955
965
  "span",
956
966
  {
957
967
  className: "nice-contract-library-item-cat",
958
- style: { "--cat-color": ie[r.category].color },
959
- children: ie[r.category].icon
968
+ style: { "--cat-color": ie[o.category].color },
969
+ children: ie[o.category].icon
960
970
  }
961
971
  )
962
972
  ] }),
963
- r.description && /* @__PURE__ */ e("p", { className: "nice-contract-library-item-desc", children: r.description }),
973
+ o.description && /* @__PURE__ */ e("p", { className: "nice-contract-library-item-desc", children: o.description }),
964
974
  /* @__PURE__ */ c(
965
975
  "button",
966
976
  {
967
977
  type: "button",
968
978
  className: "nice-contract-library-insert",
969
- onClick: () => s(r),
979
+ onClick: () => n(o),
970
980
  children: [
971
- /* @__PURE__ */ e(Se, { size: 14 }),
972
- " Insert"
981
+ /* @__PURE__ */ e(Te, { size: 14 }),
982
+ " ",
983
+ s("contractEditor.insert", "Insert")
973
984
  ]
974
985
  }
975
986
  )
976
- ] }, r.id)),
977
- h.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-library-empty", children: "No matching clauses" })
987
+ ] }, o.id)),
988
+ r.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-library-empty", children: s("contractEditor.noMatchingClauses", "No matching clauses") })
978
989
  ] })
979
990
  ] });
980
- }, Rc = ({ variables: i, definitions: s, onChange: t }) => /* @__PURE__ */ c("div", { className: "nice-contract-variables", children: [
981
- /* @__PURE__ */ e("h4", { children: "Variables" }),
982
- /* @__PURE__ */ e("div", { className: "nice-contract-variables-list", children: s.map((a) => /* @__PURE__ */ c("div", { className: "nice-contract-variable", children: [
983
- /* @__PURE__ */ c("label", { children: [
984
- a.name,
985
- a.required && /* @__PURE__ */ e("span", { className: "nice-contract-required", children: "*" })
986
- ] }),
987
- a.type === "select" && a.options ? /* @__PURE__ */ c(
988
- "select",
989
- {
990
- value: i[a.name] || a.defaultValue || "",
991
- onChange: (n) => t(a.name, n.target.value),
992
- children: [
993
- /* @__PURE__ */ e("option", { value: "", children: "Select..." }),
994
- a.options.map((n) => /* @__PURE__ */ e("option", { value: n, children: n }, n))
995
- ]
996
- }
997
- ) : a.type === "date" ? /* @__PURE__ */ e(
998
- "input",
999
- {
1000
- type: "date",
1001
- value: i[a.name] || a.defaultValue || "",
1002
- onChange: (n) => t(a.name, n.target.value)
1003
- }
1004
- ) : /* @__PURE__ */ e(
1005
- "input",
1006
- {
1007
- type: a.type === "number" || a.type === "currency" ? "number" : "text",
1008
- value: i[a.name] || a.defaultValue || "",
1009
- placeholder: a.placeholder,
1010
- onChange: (n) => t(a.name, n.target.value)
1011
- }
1012
- )
1013
- ] }, a.name)) })
1014
- ] }), Oc = ({
1015
- section: i,
1016
- variables: s,
1017
- readOnly: t,
1018
- onToggle: a,
1019
- onRemoveClause: n,
991
+ }, Fc = ({ variables: t, definitions: n, onChange: s }) => {
992
+ const { t: i } = K();
993
+ return /* @__PURE__ */ c("div", { className: "nice-contract-variables", children: [
994
+ /* @__PURE__ */ e("h4", { children: i("contractEditor.variables", "Variables") }),
995
+ /* @__PURE__ */ e("div", { className: "nice-contract-variables-list", children: n.map((a) => /* @__PURE__ */ c("div", { className: "nice-contract-variable", children: [
996
+ /* @__PURE__ */ c("label", { children: [
997
+ a.name,
998
+ a.required && /* @__PURE__ */ e("span", { className: "nice-contract-required", children: "*" })
999
+ ] }),
1000
+ a.type === "select" && a.options ? /* @__PURE__ */ c(
1001
+ "select",
1002
+ {
1003
+ value: t[a.name] || a.defaultValue || "",
1004
+ onChange: (l) => s(a.name, l.target.value),
1005
+ children: [
1006
+ /* @__PURE__ */ e("option", { value: "", children: i("contractEditor.select", "Select...") }),
1007
+ a.options.map((l) => /* @__PURE__ */ e("option", { value: l, children: l }, l))
1008
+ ]
1009
+ }
1010
+ ) : a.type === "date" ? /* @__PURE__ */ e(
1011
+ "input",
1012
+ {
1013
+ type: "date",
1014
+ value: t[a.name] || a.defaultValue || "",
1015
+ onChange: (l) => s(a.name, l.target.value)
1016
+ }
1017
+ ) : /* @__PURE__ */ e(
1018
+ "input",
1019
+ {
1020
+ type: a.type === "number" || a.type === "currency" ? "number" : "text",
1021
+ value: t[a.name] || a.defaultValue || "",
1022
+ placeholder: a.placeholder,
1023
+ onChange: (l) => s(a.name, l.target.value)
1024
+ }
1025
+ )
1026
+ ] }, a.name)) })
1027
+ ] });
1028
+ }, $c = ({
1029
+ section: t,
1030
+ variables: n,
1031
+ readOnly: s,
1032
+ onToggle: i,
1033
+ onRemoveClause: a,
1020
1034
  onMoveClause: l
1021
1035
  }) => {
1022
- const h = (r) => r.replace(/\{\{(\w+)\}\}/g, (u, T) => s[T] || `[${T}]`);
1036
+ const { t: h } = K(), r = (o) => o.replace(/\{\{(\w+)\}\}/g, (w, A) => n[A] || `[${A}]`);
1023
1037
  return /* @__PURE__ */ c(
1024
1038
  "div",
1025
1039
  {
1026
- className: `nice-contract-section ${i.collapsed ? "nice-contract-section--collapsed" : ""}`,
1040
+ className: `nice-contract-section ${t.collapsed ? "nice-contract-section--collapsed" : ""}`,
1027
1041
  children: [
1028
- /* @__PURE__ */ c("div", { className: "nice-contract-section-header", onClick: a, children: [
1029
- /* @__PURE__ */ e("span", { className: "nice-contract-section-toggle", children: i.collapsed ? /* @__PURE__ */ e($e, { size: 14 }) : /* @__PURE__ */ e(De, { size: 14 }) }),
1030
- /* @__PURE__ */ e("h3", { children: i.title }),
1031
- /* @__PURE__ */ c("span", { className: "nice-contract-section-count", children: [
1032
- i.clauses.length,
1033
- " clause(s)"
1034
- ] })
1042
+ /* @__PURE__ */ c("div", { className: "nice-contract-section-header", onClick: i, children: [
1043
+ /* @__PURE__ */ e("span", { className: "nice-contract-section-toggle", children: t.collapsed ? /* @__PURE__ */ e(Fe, { size: 14 }) : /* @__PURE__ */ e(Se, { size: 14 }) }),
1044
+ /* @__PURE__ */ e("h3", { children: t.title }),
1045
+ /* @__PURE__ */ e("span", { className: "nice-contract-section-count", children: h("contractEditor.clauseS", "{clauses} clause(s)").replace(
1046
+ "{clauses}",
1047
+ String(t.clauses.length)
1048
+ ) })
1035
1049
  ] }),
1036
- !i.collapsed && /* @__PURE__ */ c("div", { className: "nice-contract-section-content", children: [
1037
- i.clauses.map((r, u) => /* @__PURE__ */ c("div", { className: "nice-contract-clause", children: [
1050
+ !t.collapsed && /* @__PURE__ */ c("div", { className: "nice-contract-section-content", children: [
1051
+ t.clauses.map((o, w) => /* @__PURE__ */ c("div", { className: "nice-contract-clause", children: [
1038
1052
  /* @__PURE__ */ c("div", { className: "nice-contract-clause-header", children: [
1039
1053
  /* @__PURE__ */ e(
1040
1054
  "span",
1041
1055
  {
1042
1056
  className: "nice-contract-clause-cat",
1043
- style: { "--cat-color": ie[r.category].color },
1044
- children: ie[r.category].icon
1057
+ style: { "--cat-color": ie[o.category].color },
1058
+ children: ie[o.category].icon
1045
1059
  }
1046
1060
  ),
1047
- /* @__PURE__ */ e("span", { className: "nice-contract-clause-name", children: r.name }),
1048
- r.isRequired && /* @__PURE__ */ e("span", { className: "nice-contract-clause-required", children: "Required" }),
1049
- !t && /* @__PURE__ */ c("div", { className: "nice-contract-clause-actions", children: [
1061
+ /* @__PURE__ */ e("span", { className: "nice-contract-clause-name", children: o.name }),
1062
+ o.isRequired && /* @__PURE__ */ e("span", { className: "nice-contract-clause-required", children: h("contractEditor.required", "Required") }),
1063
+ !s && /* @__PURE__ */ c("div", { className: "nice-contract-clause-actions", children: [
1050
1064
  /* @__PURE__ */ e(
1051
1065
  "button",
1052
1066
  {
1053
1067
  type: "button",
1054
- onClick: () => l(r.id, "up"),
1055
- disabled: u === 0,
1056
- children: /* @__PURE__ */ e(cc, { size: 14 })
1068
+ onClick: () => l(o.id, "up"),
1069
+ disabled: w === 0,
1070
+ children: /* @__PURE__ */ e(ic, { size: 14 })
1057
1071
  }
1058
1072
  ),
1059
1073
  /* @__PURE__ */ e(
1060
1074
  "button",
1061
1075
  {
1062
1076
  type: "button",
1063
- onClick: () => l(r.id, "down"),
1064
- disabled: u === i.clauses.length - 1,
1065
- children: /* @__PURE__ */ e(ic, { size: 14 })
1077
+ onClick: () => l(o.id, "down"),
1078
+ disabled: w === t.clauses.length - 1,
1079
+ children: /* @__PURE__ */ e(sc, { size: 14 })
1066
1080
  }
1067
1081
  ),
1068
- /* @__PURE__ */ e("button", { type: "button", onClick: () => n(r.id), children: /* @__PURE__ */ e(ge, { size: 14 }) })
1082
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => a(o.id), children: /* @__PURE__ */ e(be, { size: 14 }) })
1069
1083
  ] })
1070
1084
  ] }),
1071
1085
  /* @__PURE__ */ e(
1072
1086
  "div",
1073
1087
  {
1074
1088
  className: "nice-contract-clause-content",
1075
- dangerouslySetInnerHTML: { __html: h(r.content) }
1089
+ dangerouslySetInnerHTML: { __html: r(o.content) }
1076
1090
  }
1077
1091
  )
1078
- ] }, r.id)),
1079
- i.clauses.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-section-empty", children: "No clauses in this section. Drag clauses here or use the library." })
1092
+ ] }, o.id)),
1093
+ t.clauses.length === 0 && /* @__PURE__ */ e("div", { className: "nice-contract-section-empty", children: h(
1094
+ "contractEditor.noClausesInThisSection",
1095
+ "No clauses in this section. Drag clauses here or use the library."
1096
+ ) })
1080
1097
  ] })
1081
1098
  ]
1082
1099
  }
1083
1100
  );
1084
- }, Ec = ({ workflow: i, onAction: s }) => {
1085
- const [t, a] = w(null), [n, l] = w("");
1101
+ }, Mc = ({ workflow: t, onAction: n }) => {
1102
+ const { t: s } = K(), [i, a] = k(null), [l, h] = k("");
1086
1103
  return /* @__PURE__ */ c("div", { className: "nice-contract-workflow", children: [
1087
- /* @__PURE__ */ e("h4", { children: "Approval Workflow" }),
1088
- /* @__PURE__ */ e("div", { className: "nice-contract-workflow-steps", children: i.steps.map((h, r) => /* @__PURE__ */ c(
1104
+ /* @__PURE__ */ e("h4", { children: s("contractEditor.approvalWorkflow", "Approval Workflow") }),
1105
+ /* @__PURE__ */ e("div", { className: "nice-contract-workflow-steps", children: t.steps.map((r, o) => /* @__PURE__ */ c(
1089
1106
  "div",
1090
1107
  {
1091
- className: `nice-contract-workflow-step nice-contract-workflow-step--${h.status}`,
1108
+ className: `nice-contract-workflow-step nice-contract-workflow-step--${r.status}`,
1092
1109
  children: [
1093
1110
  /* @__PURE__ */ c("div", { className: "nice-contract-workflow-step-header", children: [
1094
- /* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-num", children: r + 1 }),
1095
- /* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-name", children: h.name }),
1111
+ /* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-num", children: o + 1 }),
1112
+ /* @__PURE__ */ e("span", { className: "nice-contract-workflow-step-name", children: r.name }),
1096
1113
  /* @__PURE__ */ e(
1097
1114
  "span",
1098
1115
  {
1099
- className: `nice-contract-workflow-step-status nice-contract-workflow-step-status--${h.status}`,
1100
- children: h.status
1116
+ className: `nice-contract-workflow-step-status nice-contract-workflow-step-status--${r.status}`,
1117
+ children: r.status
1101
1118
  }
1102
1119
  )
1103
1120
  ] }),
1104
- /* @__PURE__ */ e("div", { className: "nice-contract-workflow-approvers", children: h.approvers.map((u) => /* @__PURE__ */ c("div", { className: "nice-contract-approver", children: [
1105
- u.avatar && /* @__PURE__ */ e("img", { src: u.avatar, alt: "", className: "nice-contract-approver-avatar" }),
1106
- /* @__PURE__ */ e("span", { children: u.name }),
1107
- /* @__PURE__ */ e("span", { className: "nice-contract-approver-role", children: u.role })
1108
- ] }, u.id)) }),
1109
- h.status === "pending" && i.currentStep === r && /* @__PURE__ */ e("div", { className: "nice-contract-workflow-actions", children: t === h.id ? /* @__PURE__ */ c(ee, { children: [
1121
+ /* @__PURE__ */ e("div", { className: "nice-contract-workflow-approvers", children: r.approvers.map((w) => /* @__PURE__ */ c("div", { className: "nice-contract-approver", children: [
1122
+ w.avatar && /* @__PURE__ */ e("img", { src: w.avatar, alt: "", className: "nice-contract-approver-avatar" }),
1123
+ /* @__PURE__ */ e("span", { children: w.name }),
1124
+ /* @__PURE__ */ e("span", { className: "nice-contract-approver-role", children: w.role })
1125
+ ] }, w.id)) }),
1126
+ r.status === "pending" && t.currentStep === o && /* @__PURE__ */ e("div", { className: "nice-contract-workflow-actions", children: i === r.id ? /* @__PURE__ */ c(te, { children: [
1110
1127
  /* @__PURE__ */ e(
1111
1128
  "textarea",
1112
1129
  {
1113
- placeholder: "Comments (optional)",
1114
- value: n,
1115
- onChange: (u) => l(u.target.value)
1130
+ placeholder: s("contractEditor.commentsOptional", "Comments (optional)"),
1131
+ value: l,
1132
+ onChange: (w) => h(w.target.value)
1116
1133
  }
1117
1134
  ),
1118
1135
  /* @__PURE__ */ c("div", { className: "nice-contract-workflow-btns", children: [
@@ -1122,11 +1139,12 @@ const Fc = [
1122
1139
  type: "button",
1123
1140
  className: "nice-contract-btn nice-contract-btn--approve",
1124
1141
  onClick: () => {
1125
- s(h.id, "approve", n), a(null), l("");
1142
+ n(r.id, "approve", l), a(null), h("");
1126
1143
  },
1127
1144
  children: [
1128
- /* @__PURE__ */ e(ae, { size: 14 }),
1129
- " Approve"
1145
+ /* @__PURE__ */ e(se, { size: 14 }),
1146
+ " ",
1147
+ s("contractEditor.approve", "Approve")
1130
1148
  ]
1131
1149
  }
1132
1150
  ),
@@ -1136,266 +1154,273 @@ const Fc = [
1136
1154
  type: "button",
1137
1155
  className: "nice-contract-btn nice-contract-btn--reject",
1138
1156
  onClick: () => {
1139
- s(h.id, "reject", n), a(null), l("");
1157
+ n(r.id, "reject", l), a(null), h("");
1140
1158
  },
1141
1159
  children: [
1142
- /* @__PURE__ */ e(oe, { size: 14 }),
1143
- " Reject"
1160
+ /* @__PURE__ */ e(he, { size: 14 }),
1161
+ " ",
1162
+ s("contractEditor.reject", "Reject")
1144
1163
  ]
1145
1164
  }
1146
1165
  ),
1147
- /* @__PURE__ */ e("button", { type: "button", onClick: () => a(null), children: "Cancel" })
1166
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => a(null), children: s("contractEditor.cancel", "Cancel") })
1148
1167
  ] })
1149
1168
  ] }) : /* @__PURE__ */ e(
1150
1169
  "button",
1151
1170
  {
1152
1171
  type: "button",
1153
1172
  className: "nice-contract-btn",
1154
- onClick: () => a(h.id),
1155
- children: "Review"
1173
+ onClick: () => a(r.id),
1174
+ children: s("contractEditor.review", "Review")
1156
1175
  }
1157
1176
  ) })
1158
1177
  ]
1159
1178
  },
1160
- h.id
1179
+ r.id
1161
1180
  )) })
1162
1181
  ] });
1163
- }, Mc = te(
1164
- ({
1165
- document: i,
1166
- clauseLibrary: s = [],
1167
- readOnly: t = !1,
1168
- showClauseLibrary: a = !0,
1169
- showVersionHistory: n = !1,
1170
- showComments: l = !1,
1171
- showWorkflow: h = !0,
1172
- currentUser: r,
1173
- onChange: u,
1174
- onAddClause: T,
1175
- onRemoveClause: E,
1176
- onVariableChange: S,
1177
- onAddComment: y,
1178
- onApprovalAction: J,
1179
- onRestoreVersion: _,
1180
- onSave: K,
1181
- onExport: O,
1182
- className: M = "",
1183
- style: j,
1184
- tutorial: U
1185
- }, B) => {
1186
- var Q;
1187
- const [m, k] = w(i), [g, Y] = w(a ? "library" : null), [p, P] = w(
1188
- ((Q = m.sections[0]) == null ? void 0 : Q.id) || null
1189
- ), I = m.sections.flatMap(
1190
- (N) => N.clauses.flatMap((D) => D.variables || [])
1191
- ).filter(
1192
- (N, D, R) => R.findIndex((H) => H.name === N.name) === D
1193
- ), C = $(
1194
- (N) => {
1195
- const D = { ...m, ...N, updatedAt: /* @__PURE__ */ new Date() };
1196
- k(D), u == null || u(D);
1197
- },
1198
- [m, u]
1199
- ), q = $(
1200
- (N, D) => {
1201
- const R = m.sections.map(
1202
- (H) => H.id === D ? { ...H, clauses: [...H.clauses, { ...N, id: `${N.id}-${Date.now()}` }] } : H
1203
- );
1204
- C({ sections: R }), T == null || T(N, D);
1205
- },
1206
- [m, C, T]
1207
- ), v = $(
1208
- (N, D) => {
1209
- const R = m.sections.map(
1210
- (H) => H.id === D ? { ...H, clauses: H.clauses.filter((X) => X.id !== N) } : H
1211
- );
1212
- C({ sections: R }), E == null || E(N, D);
1213
- },
1214
- [m, C, E]
1215
- ), x = $(
1216
- (N, D, R) => {
1217
- const H = m.sections.map((X) => {
1218
- if (X.id !== N)
1219
- return X;
1220
- const o = X.clauses.findIndex((Z) => Z.id === D);
1221
- if (o === -1)
1222
- return X;
1223
- const d = R === "up" ? o - 1 : o + 1;
1224
- if (d < 0 || d >= X.clauses.length)
1225
- return X;
1226
- const f = [...X.clauses];
1227
- return [f[o], f[d]] = [f[d], f[o]], { ...X, clauses: f };
1228
- });
1229
- C({ sections: H });
1230
- },
1231
- [m, C]
1232
- ), z = $(
1233
- (N) => {
1234
- const D = m.sections.map(
1235
- (R) => R.id === N ? { ...R, collapsed: !R.collapsed } : R
1236
- );
1237
- C({ sections: D });
1238
- },
1239
- [m, C]
1240
- ), G = $(
1241
- (N, D) => {
1242
- C({ variables: { ...m.variables, [N]: D } }), S == null || S(N, D);
1243
- },
1244
- [m, C, S]
1245
- ), V = $(() => {
1246
- const N = [];
1247
- return I.forEach((D) => {
1248
- D.required && !m.variables[D.name] && N.push(`Missing required variable: ${D.name}`);
1249
- }), m.sections.forEach((D) => {
1250
- D.clauses.forEach((R) => {
1251
- R.isRequired && !R.content && N.push(`Required clause "${R.name}" is empty`);
1252
- });
1253
- }), { valid: N.length === 0, errors: N };
1254
- }, [m, I]);
1255
- ne(B, () => ({
1256
- getDocument: () => m,
1257
- insertClause: q,
1258
- setVariable: G,
1259
- exportDocument: (N) => O == null ? void 0 : O(N),
1260
- validate: V
1261
- }));
1262
- const b = $c[m.status], L = /* @__PURE__ */ c("div", { className: "nice-contract-header", children: [
1263
- /* @__PURE__ */ c("div", { className: "nice-contract-header-info", children: [
1264
- /* @__PURE__ */ e("h2", { className: "nice-contract-title", children: m.title }),
1265
- /* @__PURE__ */ e(
1266
- "span",
1182
+ }, st = /* @__PURE__ */ Object.assign(
1183
+ /* @__PURE__ */ le(
1184
+ ({
1185
+ document: t,
1186
+ clauseLibrary: n = [],
1187
+ readOnly: s = !1,
1188
+ showClauseLibrary: i = !0,
1189
+ showVersionHistory: a = !1,
1190
+ showComments: l = !1,
1191
+ showWorkflow: h = !0,
1192
+ currentUser: r,
1193
+ onChange: o,
1194
+ onAddClause: w,
1195
+ onRemoveClause: A,
1196
+ onVariableChange: I,
1197
+ onAddComment: C,
1198
+ onApprovalAction: L,
1199
+ onRestoreVersion: F,
1200
+ onSave: U,
1201
+ onExport: E,
1202
+ className: $ = "",
1203
+ style: ce,
1204
+ tutorial: M
1205
+ }, q) => {
1206
+ var G;
1207
+ const { t: z } = K(), [m, N] = k(t), [g, V] = k(i ? "library" : null), [u, B] = k(
1208
+ ((G = m.sections[0]) == null ? void 0 : G.id) || null
1209
+ ), P = m.sections.flatMap(
1210
+ (v) => v.clauses.flatMap((D) => D.variables || [])
1211
+ ).filter(
1212
+ (v, D, j) => j.findIndex((W) => W.name === v.name) === D
1213
+ ), x = R(
1214
+ (v) => {
1215
+ const D = { ...m, ...v, updatedAt: /* @__PURE__ */ new Date() };
1216
+ N(D), o == null || o(D);
1217
+ },
1218
+ [m, o]
1219
+ ), H = R(
1220
+ (v, D) => {
1221
+ const j = m.sections.map(
1222
+ (W) => W.id === D ? { ...W, clauses: [...W.clauses, { ...v, id: `${v.id}-${Date.now()}` }] } : W
1223
+ );
1224
+ x({ sections: j }), w == null || w(v, D);
1225
+ },
1226
+ [m, x, w]
1227
+ ), Y = R(
1228
+ (v, D) => {
1229
+ const j = m.sections.map(
1230
+ (W) => W.id === D ? { ...W, clauses: W.clauses.filter((Q) => Q.id !== v) } : W
1231
+ );
1232
+ x({ sections: j }), A == null || A(v, D);
1233
+ },
1234
+ [m, x, A]
1235
+ ), b = R(
1236
+ (v, D, j) => {
1237
+ const W = m.sections.map((Q) => {
1238
+ if (Q.id !== v)
1239
+ return Q;
1240
+ const d = Q.clauses.findIndex((ee) => ee.id === D);
1241
+ if (d === -1)
1242
+ return Q;
1243
+ const p = j === "up" ? d - 1 : d + 1;
1244
+ if (p < 0 || p >= Q.clauses.length)
1245
+ return Q;
1246
+ const y = [...Q.clauses];
1247
+ return [y[d], y[p]] = [y[p], y[d]], { ...Q, clauses: y };
1248
+ });
1249
+ x({ sections: W });
1250
+ },
1251
+ [m, x]
1252
+ ), S = R(
1253
+ (v) => {
1254
+ const D = m.sections.map(
1255
+ (j) => j.id === v ? { ...j, collapsed: !j.collapsed } : j
1256
+ );
1257
+ x({ sections: D });
1258
+ },
1259
+ [m, x]
1260
+ ), _ = R(
1261
+ (v, D) => {
1262
+ x({ variables: { ...m.variables, [v]: D } }), I == null || I(v, D);
1263
+ },
1264
+ [m, x, I]
1265
+ ), J = R(() => {
1266
+ const v = [];
1267
+ return P.forEach((D) => {
1268
+ D.required && !m.variables[D.name] && v.push(`Missing required variable: ${D.name}`);
1269
+ }), m.sections.forEach((D) => {
1270
+ D.clauses.forEach((j) => {
1271
+ j.isRequired && !j.content && v.push(`Required clause "${j.name}" is empty`);
1272
+ });
1273
+ }), { valid: v.length === 0, errors: v };
1274
+ }, [m, P]);
1275
+ re(q, () => ({
1276
+ getDocument: () => m,
1277
+ insertClause: H,
1278
+ setVariable: _,
1279
+ exportDocument: (v) => E == null ? void 0 : E(v),
1280
+ validate: J
1281
+ }));
1282
+ const f = Pc[m.status], T = /* @__PURE__ */ c("div", { className: "nice-contract-header", children: [
1283
+ /* @__PURE__ */ c("div", { className: "nice-contract-header-info", children: [
1284
+ /* @__PURE__ */ e("h2", { className: "nice-contract-title", children: m.title }),
1285
+ /* @__PURE__ */ e(
1286
+ "span",
1287
+ {
1288
+ className: "nice-contract-status",
1289
+ style: { "--status-color": f.color },
1290
+ children: f.label
1291
+ }
1292
+ )
1293
+ ] }),
1294
+ /* @__PURE__ */ c("div", { className: "nice-contract-header-actions", children: [
1295
+ U && !s && /* @__PURE__ */ e(
1296
+ "button",
1297
+ {
1298
+ type: "button",
1299
+ className: "nice-contract-btn nice-contract-btn--primary",
1300
+ onClick: () => U(m),
1301
+ children: z("contractEditor.save", "Save")
1302
+ }
1303
+ ),
1304
+ E && /* @__PURE__ */ c("div", { className: "nice-contract-export-dropdown", children: [
1305
+ /* @__PURE__ */ c("button", { type: "button", className: "nice-contract-btn", children: [
1306
+ z("contractEditor.export", "Export"),
1307
+ " ",
1308
+ /* @__PURE__ */ e(Se, { size: 14 })
1309
+ ] }),
1310
+ /* @__PURE__ */ c("div", { className: "nice-contract-export-menu", children: [
1311
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => E("pdf"), children: "PDF" }),
1312
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => E("docx"), children: "Word (.docx)" }),
1313
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => E("html"), children: z("contractEditor.html", "HTML") })
1314
+ ] })
1315
+ ] })
1316
+ ] })
1317
+ ] }), X = /* @__PURE__ */ c("div", { className: "nice-contract-toolbar", children: [
1318
+ i && /* @__PURE__ */ c(
1319
+ "button",
1267
1320
  {
1268
- className: "nice-contract-status",
1269
- style: { "--status-color": b.color },
1270
- children: b.label
1321
+ type: "button",
1322
+ className: `nice-contract-toolbar-btn ${g === "library" ? "nice-contract-toolbar-btn--active" : ""}`,
1323
+ onClick: () => V(g === "library" ? null : "library"),
1324
+ children: [
1325
+ /* @__PURE__ */ e(ac, { size: 16 }),
1326
+ " ",
1327
+ z("contractEditor.library", "Library")
1328
+ ]
1271
1329
  }
1272
- )
1273
- ] }),
1274
- /* @__PURE__ */ c("div", { className: "nice-contract-header-actions", children: [
1275
- K && !t && /* @__PURE__ */ e(
1330
+ ),
1331
+ /* @__PURE__ */ c(
1276
1332
  "button",
1277
1333
  {
1278
1334
  type: "button",
1279
- className: "nice-contract-btn nice-contract-btn--primary",
1280
- onClick: () => K(m),
1281
- children: "Save"
1335
+ className: `nice-contract-toolbar-btn ${g === "variables" ? "nice-contract-toolbar-btn--active" : ""}`,
1336
+ onClick: () => V(g === "variables" ? null : "variables"),
1337
+ children: [
1338
+ /* @__PURE__ */ e(Re, { size: 16 }),
1339
+ " ",
1340
+ z("contractEditor.variables", "Variables")
1341
+ ]
1282
1342
  }
1283
1343
  ),
1284
- O && /* @__PURE__ */ c("div", { className: "nice-contract-export-dropdown", children: [
1285
- /* @__PURE__ */ c("button", { type: "button", className: "nice-contract-btn", children: [
1286
- "Export ",
1287
- /* @__PURE__ */ e(De, { size: 14 })
1288
- ] }),
1289
- /* @__PURE__ */ c("div", { className: "nice-contract-export-menu", children: [
1290
- /* @__PURE__ */ e("button", { type: "button", onClick: () => O("pdf"), children: "PDF" }),
1291
- /* @__PURE__ */ e("button", { type: "button", onClick: () => O("docx"), children: "Word (.docx)" }),
1292
- /* @__PURE__ */ e("button", { type: "button", onClick: () => O("html"), children: "HTML" })
1293
- ] })
1294
- ] })
1295
- ] })
1296
- ] }), W = /* @__PURE__ */ c("div", { className: "nice-contract-toolbar", children: [
1297
- a && /* @__PURE__ */ c(
1298
- "button",
1299
- {
1300
- type: "button",
1301
- className: `nice-contract-toolbar-btn ${g === "library" ? "nice-contract-toolbar-btn--active" : ""}`,
1302
- onClick: () => Y(g === "library" ? null : "library"),
1303
- children: [
1304
- /* @__PURE__ */ e(ec, { size: 16 }),
1305
- " Library"
1306
- ]
1307
- }
1308
- ),
1309
- /* @__PURE__ */ c(
1310
- "button",
1311
- {
1312
- type: "button",
1313
- className: `nice-contract-toolbar-btn ${g === "variables" ? "nice-contract-toolbar-btn--active" : ""}`,
1314
- onClick: () => Y(g === "variables" ? null : "variables"),
1315
- children: [
1316
- /* @__PURE__ */ e(Fe, { size: 16 }),
1317
- " Variables"
1318
- ]
1319
- }
1320
- ),
1321
- h && m.workflow && /* @__PURE__ */ c(
1322
- "button",
1323
- {
1324
- type: "button",
1325
- className: `nice-contract-toolbar-btn ${g === "workflow" ? "nice-contract-toolbar-btn--active" : ""}`,
1326
- onClick: () => Y(g === "workflow" ? null : "workflow"),
1327
- children: [
1328
- /* @__PURE__ */ e(ae, { size: 16 }),
1329
- " Workflow"
1330
- ]
1331
- }
1332
- ),
1333
- n && /* @__PURE__ */ c(
1334
- "button",
1335
- {
1336
- type: "button",
1337
- className: `nice-contract-toolbar-btn ${g === "history" ? "nice-contract-toolbar-btn--active" : ""}`,
1338
- onClick: () => Y(g === "history" ? null : "history"),
1339
- children: [
1340
- /* @__PURE__ */ e(xe, { size: 16 }),
1341
- " History"
1342
- ]
1343
- }
1344
- )
1345
- ] }), F = g ? /* @__PURE__ */ c("div", { className: "nice-contract-panel", children: [
1346
- g === "library" && /* @__PURE__ */ e(
1347
- Pc,
1348
- {
1349
- clauses: s,
1350
- onInsert: (N) => p && q(N, p)
1351
- }
1352
- ),
1353
- g === "variables" && /* @__PURE__ */ e(
1354
- Rc,
1355
- {
1356
- variables: m.variables,
1357
- definitions: I,
1358
- onChange: G
1359
- }
1360
- ),
1361
- g === "workflow" && m.workflow && /* @__PURE__ */ e(
1362
- Ec,
1344
+ h && m.workflow && /* @__PURE__ */ c(
1345
+ "button",
1346
+ {
1347
+ type: "button",
1348
+ className: `nice-contract-toolbar-btn ${g === "workflow" ? "nice-contract-toolbar-btn--active" : ""}`,
1349
+ onClick: () => V(g === "workflow" ? null : "workflow"),
1350
+ children: [
1351
+ /* @__PURE__ */ e(se, { size: 16 }),
1352
+ " ",
1353
+ z("contractEditor.workflow", "Workflow")
1354
+ ]
1355
+ }
1356
+ ),
1357
+ a && /* @__PURE__ */ c(
1358
+ "button",
1359
+ {
1360
+ type: "button",
1361
+ className: `nice-contract-toolbar-btn ${g === "history" ? "nice-contract-toolbar-btn--active" : ""}`,
1362
+ onClick: () => V(g === "history" ? null : "history"),
1363
+ children: [
1364
+ /* @__PURE__ */ e(Ee, { size: 16 }),
1365
+ " ",
1366
+ z("contractEditor.history", "History")
1367
+ ]
1368
+ }
1369
+ )
1370
+ ] }), Z = g ? /* @__PURE__ */ c("div", { className: "nice-contract-panel", children: [
1371
+ g === "library" && /* @__PURE__ */ e(
1372
+ Rc,
1373
+ {
1374
+ clauses: n,
1375
+ onInsert: (v) => u && H(v, u)
1376
+ }
1377
+ ),
1378
+ g === "variables" && /* @__PURE__ */ e(
1379
+ Fc,
1380
+ {
1381
+ variables: m.variables,
1382
+ definitions: P,
1383
+ onChange: _
1384
+ }
1385
+ ),
1386
+ g === "workflow" && m.workflow && /* @__PURE__ */ e(
1387
+ Mc,
1388
+ {
1389
+ workflow: m.workflow,
1390
+ onAction: (v, D, j) => L == null ? void 0 : L(v, D, j)
1391
+ }
1392
+ )
1393
+ ] }) : void 0;
1394
+ return /* @__PURE__ */ e(
1395
+ fc,
1363
1396
  {
1364
- workflow: m.workflow,
1365
- onAction: (N, D, R) => J == null ? void 0 : J(N, D, R)
1397
+ flush: !0,
1398
+ className: `nice-contract-editor ${$}`,
1399
+ style: ce,
1400
+ menubar: T,
1401
+ toolbar: X,
1402
+ sidebar: Z,
1403
+ children: /* @__PURE__ */ c("div", { className: "nice-contract-document", children: [
1404
+ /* @__PURE__ */ e("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ e(yc, { steps: wc(M, Oc) }) }),
1405
+ m.sections.map((v) => /* @__PURE__ */ e(
1406
+ $c,
1407
+ {
1408
+ section: v,
1409
+ variables: m.variables,
1410
+ readOnly: s,
1411
+ onToggle: () => S(v.id),
1412
+ onRemoveClause: (D) => Y(D, v.id),
1413
+ onMoveClause: (D, j) => b(v.id, D, j)
1414
+ },
1415
+ v.id
1416
+ ))
1417
+ ] })
1366
1418
  }
1367
- )
1368
- ] }) : void 0;
1369
- return /* @__PURE__ */ e(
1370
- Nc,
1371
- {
1372
- flush: !0,
1373
- className: `nice-contract-editor ${M}`,
1374
- style: j,
1375
- menubar: L,
1376
- toolbar: W,
1377
- sidebar: F,
1378
- children: /* @__PURE__ */ c("div", { className: "nice-contract-document", children: [
1379
- /* @__PURE__ */ e("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 30 }, children: /* @__PURE__ */ e(fc, { steps: yc(U, Fc) }) }),
1380
- m.sections.map((N) => /* @__PURE__ */ e(
1381
- Oc,
1382
- {
1383
- section: N,
1384
- variables: m.variables,
1385
- readOnly: t,
1386
- onToggle: () => z(N.id),
1387
- onRemoveClause: (D) => v(D, N.id),
1388
- onMoveClause: (D, R) => x(N.id, D, R)
1389
- },
1390
- N.id
1391
- ))
1392
- ] })
1393
- }
1394
- );
1395
- }
1396
- );
1397
- Mc.displayName = "NiceContractEditor";
1398
- const jc = [
1419
+ );
1420
+ }
1421
+ ),
1422
+ { displayName: "NiceContractEditor" }
1423
+ ), jc = [
1399
1424
  {
1400
1425
  id: "necessary",
1401
1426
  label: "Necessary",
@@ -1435,7 +1460,7 @@ const jc = [
1435
1460
  cookies: ["social_session"],
1436
1461
  partners: ["Twitter", "YouTube", "Instagram"]
1437
1462
  }
1438
- ], Uc = {
1463
+ ], Yc = {
1439
1464
  title: "Cookie Preferences",
1440
1465
  description: "We use cookies to enhance your experience. Choose which types of cookies you allow.",
1441
1466
  acceptAll: "Accept All",
@@ -1454,246 +1479,226 @@ const jc = [
1454
1479
  processing: "Processing",
1455
1480
  completed: "Completed",
1456
1481
  close: "Close"
1457
- }, Yc = ({ option: i, enabled: s, onChange: t }) => /* @__PURE__ */ c("div", { className: "nice-gdpr-option", children: [
1458
- /* @__PURE__ */ c("div", { className: "nice-gdpr-option-header", children: [
1459
- /* @__PURE__ */ c("label", { className: "nice-gdpr-option-toggle", children: [
1460
- /* @__PURE__ */ e(
1461
- "input",
1462
- {
1463
- type: "checkbox",
1464
- checked: s,
1465
- onChange: (a) => t(a.target.checked),
1466
- disabled: i.required
1467
- }
1468
- ),
1469
- /* @__PURE__ */ e("span", { className: "nice-gdpr-toggle-slider" })
1482
+ }, Uc = ({ option: t, enabled: n, onChange: s }) => {
1483
+ const { t: i } = K();
1484
+ return /* @__PURE__ */ c("div", { className: "nice-gdpr-option", children: [
1485
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-option-header", children: [
1486
+ /* @__PURE__ */ c("label", { className: "nice-gdpr-option-toggle", children: [
1487
+ /* @__PURE__ */ e(
1488
+ "input",
1489
+ {
1490
+ type: "checkbox",
1491
+ checked: n,
1492
+ onChange: (a) => s(a.target.checked),
1493
+ disabled: t.required
1494
+ }
1495
+ ),
1496
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-toggle-slider" })
1497
+ ] }),
1498
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-option-info", children: [
1499
+ /* @__PURE__ */ c("span", { className: "nice-gdpr-option-label", children: [
1500
+ t.label,
1501
+ t.required && /* @__PURE__ */ e("span", { className: "nice-gdpr-required", children: i("gdprConsent.required", "Required") })
1502
+ ] }),
1503
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-option-desc", children: t.description })
1504
+ ] })
1470
1505
  ] }),
1471
- /* @__PURE__ */ c("div", { className: "nice-gdpr-option-info", children: [
1472
- /* @__PURE__ */ c("span", { className: "nice-gdpr-option-label", children: [
1473
- i.label,
1474
- i.required && /* @__PURE__ */ e("span", { className: "nice-gdpr-required", children: "Required" })
1506
+ t.partners && t.partners.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-option-partners", children: [
1507
+ /* @__PURE__ */ c("span", { children: [
1508
+ i("gdprConsent.partners", "Partners:"),
1509
+ " "
1475
1510
  ] }),
1476
- /* @__PURE__ */ e("span", { className: "nice-gdpr-option-desc", children: i.description })
1511
+ t.partners.join(", ")
1477
1512
  ] })
1478
- ] }),
1479
- i.partners && i.partners.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-option-partners", children: [
1480
- /* @__PURE__ */ e("span", { children: "Partners: " }),
1481
- i.partners.join(", ")
1482
- ] })
1483
- ] }), qc = ({
1484
- requests: i,
1485
- policies: s,
1486
- onRequest: t,
1487
- onDownload: a,
1488
- labels: n
1489
- }) => /* @__PURE__ */ c("div", { className: "nice-gdpr-rights", children: [
1490
- /* @__PURE__ */ e("h4", { children: n.dataRights }),
1491
- /* @__PURE__ */ c("div", { className: "nice-gdpr-rights-actions", children: [
1492
- /* @__PURE__ */ c(
1493
- "button",
1494
- {
1495
- type: "button",
1496
- className: "nice-gdpr-btn nice-gdpr-btn--secondary",
1497
- onClick: () => t("export"),
1498
- children: [
1499
- /* @__PURE__ */ e(me, { size: 16 }),
1500
- " ",
1501
- n.exportData
1502
- ]
1503
- }
1504
- ),
1505
- /* @__PURE__ */ c(
1506
- "button",
1507
- {
1508
- type: "button",
1509
- className: "nice-gdpr-btn nice-gdpr-btn--danger",
1510
- onClick: () => t("delete"),
1511
- children: [
1512
- /* @__PURE__ */ e(lc, { size: 16 }),
1513
- " ",
1514
- n.deleteData
1515
- ]
1516
- }
1517
- )
1518
- ] }),
1519
- i.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-requests", children: [
1520
- /* @__PURE__ */ e("h5", { children: "Previous Requests" }),
1521
- i.map((l) => /* @__PURE__ */ c("div", { className: `nice-gdpr-request nice-gdpr-request--${l.status}`, children: [
1522
- /* @__PURE__ */ e("span", { className: "nice-gdpr-request-type", children: l.type }),
1523
- /* @__PURE__ */ e("span", { className: "nice-gdpr-request-date", children: new Date(l.requestedAt).toLocaleDateString() }),
1524
- /* @__PURE__ */ e("span", { className: "nice-gdpr-request-status", children: l.status }),
1525
- l.status === "completed" && l.downloadUrl && /* @__PURE__ */ e(
1513
+ ] });
1514
+ }, qc = ({
1515
+ requests: t,
1516
+ policies: n,
1517
+ onRequest: s,
1518
+ onDownload: i,
1519
+ labels: a
1520
+ }) => {
1521
+ const { t: l } = K();
1522
+ return /* @__PURE__ */ c("div", { className: "nice-gdpr-rights", children: [
1523
+ /* @__PURE__ */ e("h4", { children: a.dataRights }),
1524
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-rights-actions", children: [
1525
+ /* @__PURE__ */ c(
1526
1526
  "button",
1527
1527
  {
1528
1528
  type: "button",
1529
- className: "nice-gdpr-download-btn",
1530
- onClick: () => a(l.id),
1531
- children: "Download"
1532
- }
1533
- )
1534
- ] }, l.id))
1535
- ] }),
1536
- s.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-policies", children: [
1537
- /* @__PURE__ */ e("h5", { children: "Data Retention" }),
1538
- /* @__PURE__ */ c("table", { className: "nice-gdpr-policies-table", children: [
1539
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
1540
- /* @__PURE__ */ e("th", { children: "Category" }),
1541
- /* @__PURE__ */ e("th", { children: "Retention" }),
1542
- /* @__PURE__ */ e("th", { children: "Legal Basis" })
1543
- ] }) }),
1544
- /* @__PURE__ */ e("tbody", { children: s.map((l, h) => /* @__PURE__ */ c("tr", { children: [
1545
- /* @__PURE__ */ e("td", { children: l.category }),
1546
- /* @__PURE__ */ c("td", { children: [
1547
- l.retentionDays,
1548
- " days"
1549
- ] }),
1550
- /* @__PURE__ */ e("td", { children: l.legalBasis })
1551
- ] }, h)) })
1552
- ] })
1553
- ] })
1554
- ] }), Vc = te(
1555
- ({
1556
- appName: i,
1557
- companyName: s,
1558
- options: t = jc,
1559
- currentConsent: a = null,
1560
- retentionPolicies: n = [],
1561
- dataRequests: l = [],
1562
- privacyPolicy: h = [],
1563
- storageKey: r = "nice_gdpr_consent",
1564
- consentVersion: u = "1.0",
1565
- variant: T = "banner",
1566
- position: E = "bottom",
1567
- onConsentChange: S,
1568
- onDataRequest: y,
1569
- onDownloadExport: J,
1570
- privacyPolicyUrl: _,
1571
- cookiePolicyUrl: K,
1572
- termsUrl: O,
1573
- labels: M,
1574
- className: j = "",
1575
- style: U
1576
- }, B) => {
1577
- const m = { ...Uc, ...M }, [k, g] = w(!1), [Y, p] = w(!1), [P, A] = w(!1), [I, C] = w(() => {
1578
- const b = {};
1579
- return t.forEach((L) => {
1580
- b[L.id] = (a == null ? void 0 : a.categories[L.id]) ?? L.enabled;
1581
- }), b;
1582
- });
1583
- ue(() => {
1584
- (!a || a.version !== u) && g(!0);
1585
- }, [a, u]);
1586
- const q = $(
1587
- (b, L) => {
1588
- const W = L || I;
1589
- W.necessary = !0;
1590
- const F = {
1591
- version: u,
1592
- timestamp: /* @__PURE__ */ new Date(),
1593
- categories: W,
1594
- action: b
1595
- };
1596
- try {
1597
- localStorage.setItem(r, JSON.stringify(F));
1598
- } catch {
1599
- }
1600
- C(W), g(!1), p(!1), S == null || S(F);
1601
- },
1602
- [I, u, r, S]
1603
- ), v = $(() => {
1604
- const b = {};
1605
- t.forEach((L) => {
1606
- b[L.id] = !0;
1607
- }), q("accept_all", b);
1608
- }, [t, q]), x = $(() => {
1609
- const b = {};
1610
- t.forEach((L) => {
1611
- b[L.id] = L.required || !1;
1612
- }), q("reject_all", b);
1613
- }, [t, q]), z = $(
1614
- async (b) => {
1615
- y && await y(b);
1616
- },
1617
- [y]
1618
- );
1619
- if (ne(B, () => ({
1620
- showBanner: () => g(!0),
1621
- hideBanner: () => g(!1),
1622
- getConsent: () => {
1623
- try {
1624
- const b = localStorage.getItem(r);
1625
- return b ? JSON.parse(b) : null;
1626
- } catch {
1627
- return null;
1529
+ className: "nice-gdpr-btn nice-gdpr-btn--secondary",
1530
+ onClick: () => s("export"),
1531
+ children: [
1532
+ /* @__PURE__ */ e(ve, { size: 16 }),
1533
+ " ",
1534
+ a.exportData
1535
+ ]
1628
1536
  }
1629
- },
1630
- revokeConsent: () => {
1631
- try {
1632
- localStorage.removeItem(r);
1633
- } catch {
1537
+ ),
1538
+ /* @__PURE__ */ c(
1539
+ "button",
1540
+ {
1541
+ type: "button",
1542
+ className: "nice-gdpr-btn nice-gdpr-btn--danger",
1543
+ onClick: () => s("delete"),
1544
+ children: [
1545
+ /* @__PURE__ */ e(dc, { size: 16 }),
1546
+ " ",
1547
+ a.deleteData
1548
+ ]
1634
1549
  }
1635
- g(!0);
1636
- },
1637
- openPreferences: () => {
1638
- g(!0), p(!0);
1639
- }
1640
- })), !k && T !== "embedded")
1641
- return null;
1642
- const G = /* @__PURE__ */ c("div", { className: "nice-gdpr-content", children: [
1643
- /* @__PURE__ */ c("div", { className: "nice-gdpr-header", children: [
1644
- /* @__PURE__ */ e("div", { className: "nice-gdpr-icon", children: /* @__PURE__ */ e(tc, { size: 32 }) }),
1645
- /* @__PURE__ */ c("div", { className: "nice-gdpr-header-text", children: [
1646
- /* @__PURE__ */ e("h3", { children: m.title }),
1647
- /* @__PURE__ */ e("p", { children: m.description.replace("{app}", i).replace("{company}", s) })
1648
- ] })
1649
- ] }),
1650
- !Y && !P && /* @__PURE__ */ c("div", { className: "nice-gdpr-quick-actions", children: [
1651
- /* @__PURE__ */ e(
1550
+ )
1551
+ ] }),
1552
+ t.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-requests", children: [
1553
+ /* @__PURE__ */ e("h5", { children: l("gdprConsent.previousRequests", "Previous Requests") }),
1554
+ t.map((h) => /* @__PURE__ */ c("div", { className: `nice-gdpr-request nice-gdpr-request--${h.status}`, children: [
1555
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-request-type", children: h.type }),
1556
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-request-date", children: new Date(h.requestedAt).toLocaleDateString() }),
1557
+ /* @__PURE__ */ e("span", { className: "nice-gdpr-request-status", children: h.status }),
1558
+ h.status === "completed" && h.downloadUrl && /* @__PURE__ */ e(
1652
1559
  "button",
1653
1560
  {
1654
1561
  type: "button",
1655
- className: "nice-gdpr-btn nice-gdpr-btn--primary",
1656
- onClick: v,
1657
- children: m.acceptAll
1562
+ className: "nice-gdpr-download-btn",
1563
+ onClick: () => i(h.id),
1564
+ children: l("gdprConsent.download", "Download")
1658
1565
  }
1659
- ),
1660
- /* @__PURE__ */ e(
1661
- "button",
1662
- {
1663
- type: "button",
1664
- className: "nice-gdpr-btn nice-gdpr-btn--secondary",
1665
- onClick: x,
1666
- children: m.rejectAll
1566
+ )
1567
+ ] }, h.id))
1568
+ ] }),
1569
+ n.length > 0 && /* @__PURE__ */ c("div", { className: "nice-gdpr-policies", children: [
1570
+ /* @__PURE__ */ e("h5", { children: l("gdprConsent.dataRetention", "Data Retention") }),
1571
+ /* @__PURE__ */ c("table", { className: "nice-gdpr-policies-table", children: [
1572
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
1573
+ /* @__PURE__ */ e("th", { children: l("gdprConsent.category", "Category") }),
1574
+ /* @__PURE__ */ e("th", { children: l("gdprConsent.retention", "Retention") }),
1575
+ /* @__PURE__ */ e("th", { children: l("gdprConsent.legalBasis", "Legal Basis") })
1576
+ ] }) }),
1577
+ /* @__PURE__ */ e("tbody", { children: n.map((h, r) => /* @__PURE__ */ c("tr", { children: [
1578
+ /* @__PURE__ */ e("td", { children: h.category }),
1579
+ /* @__PURE__ */ e("td", { children: l("gdprConsent.days", "{retentionDays} days").replace(
1580
+ "{retentionDays}",
1581
+ String(h.retentionDays)
1582
+ ) }),
1583
+ /* @__PURE__ */ e("td", { children: h.legalBasis })
1584
+ ] }, r)) })
1585
+ ] })
1586
+ ] })
1587
+ ] });
1588
+ }, nt = /* @__PURE__ */ Object.assign(
1589
+ /* @__PURE__ */ le(
1590
+ ({
1591
+ appName: t,
1592
+ companyName: n,
1593
+ options: s = jc,
1594
+ currentConsent: i = null,
1595
+ retentionPolicies: a = [],
1596
+ dataRequests: l = [],
1597
+ privacyPolicy: h = [],
1598
+ storageKey: r = "nice_gdpr_consent",
1599
+ consentVersion: o = "1.0",
1600
+ variant: w = "banner",
1601
+ position: A = "bottom",
1602
+ onConsentChange: I,
1603
+ onDataRequest: C,
1604
+ onDownloadExport: L,
1605
+ privacyPolicyUrl: F,
1606
+ cookiePolicyUrl: U,
1607
+ termsUrl: E,
1608
+ labels: $,
1609
+ className: ce = "",
1610
+ style: M
1611
+ }, q) => {
1612
+ const { t: z } = K(), m = { ...Yc, ...$ }, [N, g] = k(!1), [V, u] = k(!1), [B, O] = k(!1), [P, x] = k(() => {
1613
+ const f = {};
1614
+ return s.forEach((T) => {
1615
+ f[T.id] = (i == null ? void 0 : i.categories[T.id]) ?? T.enabled;
1616
+ }), f;
1617
+ });
1618
+ me(() => {
1619
+ (!i || i.version !== o) && g(!0);
1620
+ }, [i, o]);
1621
+ const H = R(
1622
+ (f, T) => {
1623
+ const X = T || P;
1624
+ X.necessary = !0;
1625
+ const Z = {
1626
+ version: o,
1627
+ timestamp: /* @__PURE__ */ new Date(),
1628
+ categories: X,
1629
+ action: f
1630
+ };
1631
+ try {
1632
+ localStorage.setItem(r, JSON.stringify(Z));
1633
+ } catch {
1667
1634
  }
1668
- ),
1669
- /* @__PURE__ */ e(
1670
- "button",
1671
- {
1672
- type: "button",
1673
- className: "nice-gdpr-btn nice-gdpr-btn--link",
1674
- onClick: () => p(!0),
1675
- children: m.customize
1635
+ x(X), g(!1), u(!1), I == null || I(Z);
1636
+ },
1637
+ [P, o, r, I]
1638
+ ), Y = R(() => {
1639
+ const f = {};
1640
+ s.forEach((T) => {
1641
+ f[T.id] = !0;
1642
+ }), H("accept_all", f);
1643
+ }, [s, H]), b = R(() => {
1644
+ const f = {};
1645
+ s.forEach((T) => {
1646
+ f[T.id] = T.required || !1;
1647
+ }), H("reject_all", f);
1648
+ }, [s, H]), S = R(
1649
+ async (f) => {
1650
+ C && await C(f);
1651
+ },
1652
+ [C]
1653
+ );
1654
+ if (re(q, () => ({
1655
+ showBanner: () => g(!0),
1656
+ hideBanner: () => g(!1),
1657
+ getConsent: () => {
1658
+ try {
1659
+ const f = localStorage.getItem(r);
1660
+ return f ? JSON.parse(f) : null;
1661
+ } catch {
1662
+ return null;
1676
1663
  }
1677
- )
1678
- ] }),
1679
- Y && !P && /* @__PURE__ */ c("div", { className: "nice-gdpr-preferences", children: [
1680
- /* @__PURE__ */ e("div", { className: "nice-gdpr-options", children: t.map((b) => /* @__PURE__ */ e(
1681
- Yc,
1682
- {
1683
- option: b,
1684
- enabled: I[b.id],
1685
- onChange: (L) => C((W) => ({ ...W, [b.id]: L }))
1686
- },
1687
- b.id
1688
- )) }),
1689
- /* @__PURE__ */ c("div", { className: "nice-gdpr-pref-actions", children: [
1664
+ },
1665
+ revokeConsent: () => {
1666
+ try {
1667
+ localStorage.removeItem(r);
1668
+ } catch {
1669
+ }
1670
+ g(!0);
1671
+ },
1672
+ openPreferences: () => {
1673
+ g(!0), u(!0);
1674
+ }
1675
+ })), !N && w !== "embedded")
1676
+ return null;
1677
+ const _ = /* @__PURE__ */ c("div", { className: "nice-gdpr-content", children: [
1678
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-header", children: [
1679
+ /* @__PURE__ */ e("div", { className: "nice-gdpr-icon", children: /* @__PURE__ */ e(rc, { size: 32 }) }),
1680
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-header-text", children: [
1681
+ /* @__PURE__ */ e("h3", { children: m.title }),
1682
+ /* @__PURE__ */ e("p", { children: m.description.replace("{app}", t).replace("{company}", n) })
1683
+ ] })
1684
+ ] }),
1685
+ !V && !B && /* @__PURE__ */ c("div", { className: "nice-gdpr-quick-actions", children: [
1690
1686
  /* @__PURE__ */ e(
1691
1687
  "button",
1692
1688
  {
1693
1689
  type: "button",
1694
1690
  className: "nice-gdpr-btn nice-gdpr-btn--primary",
1695
- onClick: () => q("custom"),
1696
- children: m.savePreferences
1691
+ onClick: Y,
1692
+ children: m.acceptAll
1693
+ }
1694
+ ),
1695
+ /* @__PURE__ */ e(
1696
+ "button",
1697
+ {
1698
+ type: "button",
1699
+ className: "nice-gdpr-btn nice-gdpr-btn--secondary",
1700
+ onClick: b,
1701
+ children: m.rejectAll
1697
1702
  }
1698
1703
  ),
1699
1704
  /* @__PURE__ */ e(
@@ -1701,164 +1706,201 @@ const jc = [
1701
1706
  {
1702
1707
  type: "button",
1703
1708
  className: "nice-gdpr-btn nice-gdpr-btn--link",
1704
- onClick: () => A(!0),
1705
- children: m.dataRights
1709
+ onClick: () => u(!0),
1710
+ children: m.customize
1711
+ }
1712
+ )
1713
+ ] }),
1714
+ V && !B && /* @__PURE__ */ c("div", { className: "nice-gdpr-preferences", children: [
1715
+ /* @__PURE__ */ e("div", { className: "nice-gdpr-options", children: s.map((f) => /* @__PURE__ */ e(
1716
+ Uc,
1717
+ {
1718
+ option: f,
1719
+ enabled: P[f.id],
1720
+ onChange: (T) => x((X) => ({ ...X, [f.id]: T }))
1721
+ },
1722
+ f.id
1723
+ )) }),
1724
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-pref-actions", children: [
1725
+ /* @__PURE__ */ e(
1726
+ "button",
1727
+ {
1728
+ type: "button",
1729
+ className: "nice-gdpr-btn nice-gdpr-btn--primary",
1730
+ onClick: () => H("custom"),
1731
+ children: m.savePreferences
1732
+ }
1733
+ ),
1734
+ /* @__PURE__ */ e(
1735
+ "button",
1736
+ {
1737
+ type: "button",
1738
+ className: "nice-gdpr-btn nice-gdpr-btn--link",
1739
+ onClick: () => O(!0),
1740
+ children: m.dataRights
1741
+ }
1742
+ )
1743
+ ] })
1744
+ ] }),
1745
+ B && /* @__PURE__ */ c(te, { children: [
1746
+ /* @__PURE__ */ e(
1747
+ qc,
1748
+ {
1749
+ requests: l,
1750
+ policies: a,
1751
+ onRequest: S,
1752
+ onDownload: (f) => L == null ? void 0 : L(f),
1753
+ labels: m
1754
+ }
1755
+ ),
1756
+ /* @__PURE__ */ c(
1757
+ "button",
1758
+ {
1759
+ type: "button",
1760
+ className: "nice-gdpr-btn nice-gdpr-btn--link",
1761
+ onClick: () => O(!1),
1762
+ children: [
1763
+ /* @__PURE__ */ e(oc, { size: 14 }),
1764
+ " ",
1765
+ z("gdprConsent.backToPreferences", "Back to preferences")
1766
+ ]
1706
1767
  }
1707
1768
  )
1769
+ ] }),
1770
+ /* @__PURE__ */ c("div", { className: "nice-gdpr-footer", children: [
1771
+ F && /* @__PURE__ */ e("a", { href: F, target: "_blank", rel: "noopener noreferrer", children: z("gdprConsent.privacyPolicy", "Privacy Policy") }),
1772
+ U && /* @__PURE__ */ e("a", { href: U, target: "_blank", rel: "noopener noreferrer", children: z("gdprConsent.cookiePolicy", "Cookie Policy") }),
1773
+ E && /* @__PURE__ */ e("a", { href: E, target: "_blank", rel: "noopener noreferrer", children: z("gdprConsent.termsOfService", "Terms of Service") })
1708
1774
  ] })
1709
- ] }),
1710
- P && /* @__PURE__ */ c(ee, { children: [
1711
- /* @__PURE__ */ e(
1712
- qc,
1713
- {
1714
- requests: l,
1715
- policies: n,
1716
- onRequest: z,
1717
- onDownload: (b) => J == null ? void 0 : J(b),
1718
- labels: m
1719
- }
1720
- ),
1721
- /* @__PURE__ */ c(
1722
- "button",
1723
- {
1724
- type: "button",
1725
- className: "nice-gdpr-btn nice-gdpr-btn--link",
1726
- onClick: () => A(!1),
1727
- children: [
1728
- /* @__PURE__ */ e(nc, { size: 14 }),
1729
- " Back to preferences"
1730
- ]
1731
- }
1732
- )
1733
- ] }),
1734
- /* @__PURE__ */ c("div", { className: "nice-gdpr-footer", children: [
1735
- _ && /* @__PURE__ */ e("a", { href: _, target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" }),
1736
- K && /* @__PURE__ */ e("a", { href: K, target: "_blank", rel: "noopener noreferrer", children: "Cookie Policy" }),
1737
- O && /* @__PURE__ */ e("a", { href: O, target: "_blank", rel: "noopener noreferrer", children: "Terms of Service" })
1738
- ] })
1739
- ] }), V = `nice-gdpr-consent nice-gdpr-consent--${T} nice-gdpr-consent--${E} ${j}`;
1740
- return T === "modal" ? /* @__PURE__ */ e("div", { className: "nice-gdpr-overlay", children: /* @__PURE__ */ e("div", { className: V, style: U, role: "dialog", "aria-modal": "true", children: G }) }) : /* @__PURE__ */ e("div", { className: V, style: U, children: G });
1741
- }
1742
- );
1743
- Vc.displayName = "NiceGDPRConsent";
1744
- const Ve = {
1745
- document: /* @__PURE__ */ e(we, { size: 16 }),
1746
- user: /* @__PURE__ */ e(Ye, { size: 16 }),
1747
- task: /* @__PURE__ */ e(ae, { size: 16 }),
1748
- project: /* @__PURE__ */ e(rc, { size: 16 }),
1749
- setting: /* @__PURE__ */ e(Pe, { size: 16 }),
1750
- help: /* @__PURE__ */ e(Ue, { size: 16 }),
1751
- action: /* @__PURE__ */ e(je, { size: 16 }),
1752
- custom: /* @__PURE__ */ e(Ce, { size: 16 })
1753
- }, Bc = ({
1754
- value: i,
1755
- onChange: s,
1756
- onKeyDown: t,
1757
- placeholder: a,
1758
- isLoading: n,
1759
- inputRef: l
1760
- }) => /* @__PURE__ */ c("div", { className: "nice-search-input-container", children: [
1761
- /* @__PURE__ */ e("span", { className: "nice-search-icon", children: /* @__PURE__ */ e(pe, { size: 16 }) }),
1762
- /* @__PURE__ */ e(
1763
- "input",
1764
- {
1765
- ref: l,
1766
- type: "text",
1767
- className: "nice-search-input",
1768
- placeholder: a,
1769
- value: i,
1770
- onChange: (h) => s(h.target.value),
1771
- onKeyDown: t,
1772
- "aria-label": "Search"
1775
+ ] }), J = `nice-gdpr-consent nice-gdpr-consent--${w} nice-gdpr-consent--${A} ${ce}`;
1776
+ return w === "modal" ? /* @__PURE__ */ e("div", { className: "nice-gdpr-overlay", children: /* @__PURE__ */ e("div", { className: J, style: M, role: "dialog", "aria-modal": "true", children: _ }) }) : /* @__PURE__ */ e("div", { className: J, style: M, children: _ });
1773
1777
  }
1774
1778
  ),
1775
- n && /* @__PURE__ */ e("span", { className: "nice-search-loader" }),
1776
- i && !n && /* @__PURE__ */ e(
1777
- "button",
1778
- {
1779
- type: "button",
1780
- className: "nice-search-clear",
1781
- onClick: () => s(""),
1782
- "aria-label": "Clear search",
1783
- children: /* @__PURE__ */ e(ge, { size: 16 })
1784
- }
1785
- )
1786
- ] }), Hc = ({ result: i, isSelected: s, onSelect: t, renderResult: a }) => a ? /* @__PURE__ */ e("div", { onClick: t, children: a(i, s) }) : /* @__PURE__ */ c(
1779
+ { displayName: "NiceGDPRConsent" }
1780
+ ), Vc = [], Je = {
1781
+ document: /* @__PURE__ */ e(xe, { size: 16 }),
1782
+ user: /* @__PURE__ */ e(Be, { size: 16 }),
1783
+ task: /* @__PURE__ */ e(se, { size: 16 }),
1784
+ project: /* @__PURE__ */ e(hc, { size: 16 }),
1785
+ setting: /* @__PURE__ */ e($e, { size: 16 }),
1786
+ help: /* @__PURE__ */ e(Ve, { size: 16 }),
1787
+ action: /* @__PURE__ */ e(qe, { size: 16 }),
1788
+ custom: /* @__PURE__ */ e(De, { size: 16 })
1789
+ }, Bc = ({
1790
+ value: t,
1791
+ onChange: n,
1792
+ onKeyDown: s,
1793
+ placeholder: i,
1794
+ isLoading: a,
1795
+ inputRef: l
1796
+ }) => {
1797
+ const { t: h } = K();
1798
+ return /* @__PURE__ */ c("div", { className: "nice-search-input-container", children: [
1799
+ /* @__PURE__ */ e("span", { className: "nice-search-icon", children: /* @__PURE__ */ e(ge, { size: 16 }) }),
1800
+ /* @__PURE__ */ e(
1801
+ "input",
1802
+ {
1803
+ ref: l,
1804
+ type: "text",
1805
+ className: "nice-search-input",
1806
+ placeholder: i,
1807
+ value: t,
1808
+ onChange: (r) => n(r.target.value),
1809
+ onKeyDown: s,
1810
+ "aria-label": h("globalSearch.search", "Search")
1811
+ }
1812
+ ),
1813
+ a && /* @__PURE__ */ e("span", { className: "nice-search-loader" }),
1814
+ t && !a && /* @__PURE__ */ e(
1815
+ "button",
1816
+ {
1817
+ type: "button",
1818
+ className: "nice-search-clear",
1819
+ onClick: () => n(""),
1820
+ "aria-label": h("globalSearch.clearSearch", "Clear search"),
1821
+ children: /* @__PURE__ */ e(be, { size: 16 })
1822
+ }
1823
+ )
1824
+ ] });
1825
+ }, Hc = ({ result: t, isSelected: n, onSelect: s, renderResult: i }) => i ? /* @__PURE__ */ e("div", { onClick: s, children: i(t, n) }) : /* @__PURE__ */ c(
1787
1826
  "div",
1788
1827
  {
1789
- className: `nice-search-result ${s ? "nice-search-result--selected" : ""}`,
1790
- onClick: t,
1828
+ className: `nice-search-result ${n ? "nice-search-result--selected" : ""}`,
1829
+ onClick: s,
1791
1830
  role: "option",
1792
- "aria-selected": s,
1831
+ "aria-selected": n,
1793
1832
  children: [
1794
- /* @__PURE__ */ e("div", { className: "nice-search-result-icon", children: i.icon || (i.image ? /* @__PURE__ */ e("img", { src: i.image, alt: "" }) : Ve[i.type]) }),
1833
+ /* @__PURE__ */ e("div", { className: "nice-search-result-icon", children: t.icon || (t.image ? /* @__PURE__ */ e("img", { src: t.image, alt: "" }) : Je[t.type]) }),
1795
1834
  /* @__PURE__ */ c("div", { className: "nice-search-result-content", children: [
1796
- /* @__PURE__ */ e("span", { className: "nice-search-result-title", children: i.title }),
1797
- i.subtitle && /* @__PURE__ */ e("span", { className: "nice-search-result-subtitle", children: i.subtitle }),
1798
- i.description && /* @__PURE__ */ e("span", { className: "nice-search-result-desc", children: i.description })
1835
+ /* @__PURE__ */ e("span", { className: "nice-search-result-title", children: t.title }),
1836
+ t.subtitle && /* @__PURE__ */ e("span", { className: "nice-search-result-subtitle", children: t.subtitle }),
1837
+ t.description && /* @__PURE__ */ e("span", { className: "nice-search-result-desc", children: t.description })
1799
1838
  ] }),
1800
1839
  /* @__PURE__ */ c("div", { className: "nice-search-result-meta", children: [
1801
- /* @__PURE__ */ e("span", { className: "nice-search-result-source", children: i.source }),
1802
- /* @__PURE__ */ e("span", { className: "nice-search-result-type", children: i.type })
1840
+ /* @__PURE__ */ e("span", { className: "nice-search-result-source", children: t.source }),
1841
+ /* @__PURE__ */ e("span", { className: "nice-search-result-type", children: t.type })
1803
1842
  ] }),
1804
- i.actions && i.actions.length > 0 && /* @__PURE__ */ e("div", { className: "nice-search-result-actions", children: i.actions.map((n) => /* @__PURE__ */ e(
1843
+ t.actions && t.actions.length > 0 && /* @__PURE__ */ e("div", { className: "nice-search-result-actions", children: t.actions.map((a) => /* @__PURE__ */ e(
1805
1844
  "button",
1806
1845
  {
1807
1846
  type: "button",
1808
1847
  className: "nice-search-action-btn",
1809
1848
  onClick: (l) => {
1810
- l.stopPropagation(), n.onClick();
1849
+ l.stopPropagation(), a.onClick();
1811
1850
  },
1812
- title: n.label,
1813
- children: n.icon || n.label
1851
+ title: a.label,
1852
+ children: a.icon || a.label
1814
1853
  },
1815
- n.id
1854
+ a.id
1816
1855
  )) })
1817
1856
  ]
1818
1857
  }
1819
- ), Jc = ({ categories: i, selected: s, onSelect: t }) => /* @__PURE__ */ c("div", { className: "nice-search-categories", children: [
1820
- /* @__PURE__ */ e(
1821
- "button",
1822
- {
1823
- type: "button",
1824
- className: `nice-search-category ${s === null ? "nice-search-category--active" : ""}`,
1825
- onClick: () => t(null),
1826
- children: "All"
1827
- }
1828
- ),
1829
- i.map((a) => /* @__PURE__ */ c(
1830
- "button",
1831
- {
1832
- type: "button",
1833
- className: `nice-search-category ${s === a.id ? "nice-search-category--active" : ""}`,
1834
- onClick: () => t(a.id),
1835
- children: [
1836
- a.icon && /* @__PURE__ */ e("span", { className: "nice-search-category-icon", children: a.icon }),
1837
- a.label,
1838
- a.count !== void 0 && /* @__PURE__ */ e("span", { className: "nice-search-category-count", children: a.count })
1839
- ]
1840
- },
1841
- a.id
1842
- ))
1843
- ] }), Gc = ({
1844
- searches: i,
1845
- onSelect: s,
1846
- onClear: t,
1847
- label: a,
1848
- clearLabel: n
1858
+ ), Jc = ({ categories: t, selected: n, onSelect: s }) => {
1859
+ const { t: i } = K();
1860
+ return /* @__PURE__ */ c("div", { className: "nice-search-categories", children: [
1861
+ /* @__PURE__ */ e(
1862
+ "button",
1863
+ {
1864
+ type: "button",
1865
+ className: `nice-search-category ${n === null ? "nice-search-category--active" : ""}`,
1866
+ onClick: () => s(null),
1867
+ children: i("globalSearch.all", "All")
1868
+ }
1869
+ ),
1870
+ t.map((a) => /* @__PURE__ */ c(
1871
+ "button",
1872
+ {
1873
+ type: "button",
1874
+ className: `nice-search-category ${n === a.id ? "nice-search-category--active" : ""}`,
1875
+ onClick: () => s(a.id),
1876
+ children: [
1877
+ a.icon && /* @__PURE__ */ e("span", { className: "nice-search-category-icon", children: a.icon }),
1878
+ a.label,
1879
+ a.count !== void 0 && /* @__PURE__ */ e("span", { className: "nice-search-category-count", children: a.count })
1880
+ ]
1881
+ },
1882
+ a.id
1883
+ ))
1884
+ ] });
1885
+ }, Gc = ({
1886
+ searches: t,
1887
+ onSelect: n,
1888
+ onClear: s,
1889
+ label: i,
1890
+ clearLabel: a
1849
1891
  }) => /* @__PURE__ */ c("div", { className: "nice-search-recent", children: [
1850
1892
  /* @__PURE__ */ c("div", { className: "nice-search-recent-header", children: [
1851
- /* @__PURE__ */ e("span", { children: a }),
1852
- /* @__PURE__ */ e("button", { type: "button", onClick: t, children: n })
1893
+ /* @__PURE__ */ e("span", { children: i }),
1894
+ /* @__PURE__ */ e("button", { type: "button", onClick: s, children: a })
1853
1895
  ] }),
1854
- /* @__PURE__ */ e("div", { className: "nice-search-recent-list", children: i.map((l, h) => /* @__PURE__ */ c(
1896
+ /* @__PURE__ */ e("div", { className: "nice-search-recent-list", children: t.map((l, h) => /* @__PURE__ */ c(
1855
1897
  "button",
1856
1898
  {
1857
1899
  type: "button",
1858
1900
  className: "nice-search-recent-item",
1859
- onClick: () => s(l.query),
1901
+ onClick: () => n(l.query),
1860
1902
  children: [
1861
- /* @__PURE__ */ e("span", { className: "nice-search-recent-icon", children: /* @__PURE__ */ e(xe, { size: 14 }) }),
1903
+ /* @__PURE__ */ e("span", { className: "nice-search-recent-icon", children: /* @__PURE__ */ e(Ee, { size: 14 }) }),
1862
1904
  /* @__PURE__ */ e("span", { className: "nice-search-recent-query", children: l.query })
1863
1905
  ]
1864
1906
  },
@@ -1872,250 +1914,254 @@ const Ve = {
1872
1914
  clearRecent: "Clear",
1873
1915
  categories: "Categories",
1874
1916
  filters: "Filters"
1875
- }, Wc = te(
1876
- ({
1877
- sources: i,
1878
- placeholder: s,
1879
- minQueryLength: t = 2,
1880
- debounceMs: a = 300,
1881
- showCategories: n = !0,
1882
- filters: l = [],
1883
- showRecent: h = !0,
1884
- maxRecent: r = 5,
1885
- showShortcuts: u = !0,
1886
- hotkey: T = "k",
1887
- onResultSelect: E,
1888
- onSearch: S,
1889
- onClose: y,
1890
- renderResult: J,
1891
- renderEmpty: _,
1892
- defaultOpen: K = !1,
1893
- open: O,
1894
- variant: M = "modal",
1895
- labels: j,
1896
- className: U = "",
1897
- style: B
1898
- }, m) => {
1899
- const k = { ...Kc, ...j }, g = ye(null), Y = ye(void 0), [p, P] = w(K), [A, I] = w(""), [C, q] = w([]), [v, x] = w(!1), [z, G] = w(0), [V, b] = w(null), [L, W] = w([]), F = O !== void 0 ? O : p;
1900
- ue(() => {
1901
- try {
1902
- const d = localStorage.getItem("nice_recent_searches");
1903
- d && W(JSON.parse(d));
1904
- } catch {
1905
- }
1906
- }, []);
1907
- const Q = $(
1908
- (d, f) => {
1909
- const ce = [{
1910
- query: d,
1911
- timestamp: /* @__PURE__ */ new Date(),
1912
- resultCount: f
1913
- }, ...L.filter((de) => de.query !== d)].slice(
1914
- 0,
1915
- r
1916
- );
1917
- W(ce);
1917
+ }, lt = /* @__PURE__ */ Object.assign(
1918
+ /* @__PURE__ */ le(
1919
+ ({
1920
+ sources: t = Vc,
1921
+ placeholder: n,
1922
+ minQueryLength: s = 2,
1923
+ debounceMs: i = 300,
1924
+ showCategories: a = !0,
1925
+ filters: l = [],
1926
+ showRecent: h = !0,
1927
+ maxRecent: r = 5,
1928
+ showShortcuts: o = !0,
1929
+ hotkey: w = "k",
1930
+ onResultSelect: A,
1931
+ onSearch: I,
1932
+ onClose: C,
1933
+ renderResult: L,
1934
+ renderEmpty: F,
1935
+ defaultOpen: U = !1,
1936
+ open: E,
1937
+ variant: $ = "modal",
1938
+ labels: ce,
1939
+ className: M = "",
1940
+ style: q
1941
+ }, z) => {
1942
+ const { t: m } = K(), N = { ...Kc, ...ce }, g = ke(null), V = ke(void 0), [u, B] = k(U), [O, P] = k(""), [x, H] = k([]), [Y, b] = k(!1), [S, _] = k(0), [J, f] = k(null), [T, X] = k([]), Z = E !== void 0 ? E : u;
1943
+ me(() => {
1918
1944
  try {
1919
- localStorage.setItem("nice_recent_searches", JSON.stringify(ce));
1945
+ const p = localStorage.getItem("nice_recent_searches");
1946
+ p && X(JSON.parse(p));
1920
1947
  } catch {
1921
1948
  }
1922
- },
1923
- [L, r]
1924
- ), N = $(
1925
- async (d) => {
1926
- if (d.length < t) {
1927
- q([]);
1928
- return;
1929
- }
1930
- x(!0);
1931
- try {
1932
- const f = i.map(async (ce) => {
1933
- try {
1934
- return (await ce.search(d)).map((ze) => ({
1935
- ...ze,
1936
- source: ce.name,
1937
- relevanceScore: ze.relevanceScore * (ce.priority || 1)
1938
- }));
1939
- } catch {
1940
- return [];
1941
- }
1942
- }), Z = (await Promise.all(f)).flat();
1943
- Z.sort((ce, de) => de.relevanceScore - ce.relevanceScore), q(Z), G(0), S == null || S(d, Z), Z.length > 0 && Q(d, Z.length);
1944
- } finally {
1945
- x(!1);
1946
- }
1947
- },
1948
- [i, t, S, Q]
1949
- ), D = $(
1950
- (d) => {
1951
- I(d), Y.current && clearTimeout(Y.current), Y.current = setTimeout(() => {
1952
- N(d);
1953
- }, a);
1954
- },
1955
- [N, a]
1956
- ), R = $(
1957
- (d) => {
1958
- switch (d.key) {
1959
- case "ArrowDown":
1960
- d.preventDefault(), G((f) => Math.min(f + 1, C.length - 1));
1961
- break;
1962
- case "ArrowUp":
1963
- d.preventDefault(), G((f) => Math.max(f - 1, 0));
1964
- break;
1965
- case "Enter":
1966
- d.preventDefault(), C[z] && (E == null || E(C[z]), P(!1), y == null || y());
1967
- break;
1968
- case "Escape":
1969
- d.preventDefault(), P(!1), y == null || y();
1970
- break;
1971
- }
1972
- },
1973
- [C, z, E, y]
1974
- );
1975
- ue(() => {
1976
- const d = (f) => {
1977
- (f.metaKey || f.ctrlKey) && f.key === T && (f.preventDefault(), P(!0), setTimeout(() => {
1978
- var Z;
1979
- return (Z = g.current) == null ? void 0 : Z.focus();
1980
- }, 0));
1981
- };
1982
- return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
1983
- }, [T]), ue(() => {
1984
- F && setTimeout(() => {
1985
- var d;
1986
- return (d = g.current) == null ? void 0 : d.focus();
1987
- }, 0);
1988
- }, [F]);
1989
- const H = V ? C.filter((d) => d.type === V) : C, X = Array.from(new Set(C.map((d) => d.type))).map(
1990
- (d) => ({
1991
- id: d,
1992
- label: d.charAt(0).toUpperCase() + d.slice(1),
1993
- icon: Ve[d],
1994
- count: C.filter((f) => f.type === d).length
1995
- })
1996
- );
1997
- if (ne(m, () => ({
1998
- open: () => P(!0),
1999
- close: () => {
2000
- P(!1), y == null || y();
2001
- },
2002
- focus: () => {
2003
- var d;
2004
- return (d = g.current) == null ? void 0 : d.focus();
2005
- },
2006
- clear: () => {
2007
- I(""), q([]);
2008
- },
2009
- search: async (d) => {
2010
- I(d), await N(d);
2011
- }
2012
- })), !F && M !== "inline")
2013
- return null;
2014
- const o = /* @__PURE__ */ c("div", { className: "nice-search-content", children: [
2015
- /* @__PURE__ */ e(
2016
- Bc,
2017
- {
2018
- value: A,
2019
- onChange: D,
2020
- onKeyDown: R,
2021
- placeholder: s || k.placeholder,
2022
- isLoading: v,
2023
- inputRef: g
2024
- }
2025
- ),
2026
- n && X.length > 1 && A.length >= t && /* @__PURE__ */ e(
2027
- Jc,
2028
- {
2029
- categories: X,
2030
- selected: V,
2031
- onSelect: b
1949
+ }, []);
1950
+ const G = R(
1951
+ (p, y) => {
1952
+ const ae = [
1953
+ {
1954
+ query: p,
1955
+ timestamp: /* @__PURE__ */ new Date(),
1956
+ resultCount: y
1957
+ },
1958
+ ...T.filter((pe) => pe.query !== p)
1959
+ ].slice(0, r);
1960
+ X(ae);
1961
+ try {
1962
+ localStorage.setItem("nice_recent_searches", JSON.stringify(ae));
1963
+ } catch {
1964
+ }
1965
+ },
1966
+ [T, r]
1967
+ ), v = R(
1968
+ async (p) => {
1969
+ if (p.length < s) {
1970
+ H([]);
1971
+ return;
1972
+ }
1973
+ b(!0);
1974
+ try {
1975
+ const y = t.map(async (ae) => {
1976
+ try {
1977
+ return (await ae.search(p)).map((Le) => ({
1978
+ ...Le,
1979
+ source: ae.name,
1980
+ relevanceScore: Le.relevanceScore * (ae.priority || 1)
1981
+ }));
1982
+ } catch {
1983
+ return [];
1984
+ }
1985
+ }), ee = (await Promise.all(y)).flat();
1986
+ ee.sort((ae, pe) => pe.relevanceScore - ae.relevanceScore), H(ee), _(0), I == null || I(p, ee), ee.length > 0 && G(p, ee.length);
1987
+ } finally {
1988
+ b(!1);
1989
+ }
1990
+ },
1991
+ [t, s, I, G]
1992
+ ), D = R(
1993
+ (p) => {
1994
+ P(p), V.current && clearTimeout(V.current), V.current = setTimeout(() => {
1995
+ v(p);
1996
+ }, i);
1997
+ },
1998
+ [v, i]
1999
+ ), j = R(
2000
+ (p) => {
2001
+ switch (p.key) {
2002
+ case "ArrowDown":
2003
+ p.preventDefault(), _((y) => Math.min(y + 1, x.length - 1));
2004
+ break;
2005
+ case "ArrowUp":
2006
+ p.preventDefault(), _((y) => Math.max(y - 1, 0));
2007
+ break;
2008
+ case "Enter":
2009
+ p.preventDefault(), x[S] && (A == null || A(x[S]), B(!1), C == null || C());
2010
+ break;
2011
+ case "Escape":
2012
+ p.preventDefault(), B(!1), C == null || C();
2013
+ break;
2014
+ }
2015
+ },
2016
+ [x, S, A, C]
2017
+ );
2018
+ me(() => {
2019
+ const p = (y) => {
2020
+ (y.metaKey || y.ctrlKey) && y.key === w && (y.preventDefault(), B(!0), setTimeout(() => {
2021
+ var ee;
2022
+ return (ee = g.current) == null ? void 0 : ee.focus();
2023
+ }, 0));
2024
+ };
2025
+ return document.addEventListener("keydown", p), () => document.removeEventListener("keydown", p);
2026
+ }, [w]), me(() => {
2027
+ Z && setTimeout(() => {
2028
+ var p;
2029
+ return (p = g.current) == null ? void 0 : p.focus();
2030
+ }, 0);
2031
+ }, [Z]);
2032
+ const W = J ? x.filter((p) => p.type === J) : x, Q = Array.from(new Set(x.map((p) => p.type))).map(
2033
+ (p) => ({
2034
+ id: p,
2035
+ label: p.charAt(0).toUpperCase() + p.slice(1),
2036
+ icon: Je[p],
2037
+ count: x.filter((y) => y.type === p).length
2038
+ })
2039
+ );
2040
+ if (re(z, () => ({
2041
+ open: () => B(!0),
2042
+ close: () => {
2043
+ B(!1), C == null || C();
2044
+ },
2045
+ focus: () => {
2046
+ var p;
2047
+ return (p = g.current) == null ? void 0 : p.focus();
2048
+ },
2049
+ clear: () => {
2050
+ P(""), H([]);
2051
+ },
2052
+ search: async (p) => {
2053
+ P(p), await v(p);
2032
2054
  }
2033
- ),
2034
- /* @__PURE__ */ c("div", { className: "nice-search-results", role: "listbox", children: [
2035
- v && A.length >= t && /* @__PURE__ */ e("div", { className: "nice-search-loading", children: k.searching }),
2036
- !v && A.length >= t && H.length === 0 && /* @__PURE__ */ e("div", { className: "nice-search-empty", children: _ ? _(A) : /* @__PURE__ */ c(ee, { children: [
2037
- /* @__PURE__ */ e("span", { className: "nice-search-empty-icon", children: /* @__PURE__ */ e(pe, { size: 32 }) }),
2038
- /* @__PURE__ */ c("span", { children: [
2039
- k.noResults,
2040
- ' "',
2041
- A,
2042
- '"'
2043
- ] })
2044
- ] }) }),
2045
- H.map((d, f) => /* @__PURE__ */ e(
2046
- Hc,
2055
+ })), !Z && $ !== "inline")
2056
+ return null;
2057
+ const d = /* @__PURE__ */ c("div", { className: "nice-search-content", children: [
2058
+ /* @__PURE__ */ e(
2059
+ Bc,
2047
2060
  {
2048
- result: d,
2049
- isSelected: f === z,
2050
- onSelect: () => {
2051
- E == null || E(d), P(!1), y == null || y();
2061
+ value: O,
2062
+ onChange: D,
2063
+ onKeyDown: j,
2064
+ placeholder: n || N.placeholder,
2065
+ isLoading: Y,
2066
+ inputRef: g
2067
+ }
2068
+ ),
2069
+ a && Q.length > 1 && O.length >= s && /* @__PURE__ */ e(
2070
+ Jc,
2071
+ {
2072
+ categories: Q,
2073
+ selected: J,
2074
+ onSelect: f
2075
+ }
2076
+ ),
2077
+ /* @__PURE__ */ c("div", { className: "nice-search-results", role: "listbox", children: [
2078
+ Y && O.length >= s && /* @__PURE__ */ e("div", { className: "nice-search-loading", children: N.searching }),
2079
+ !Y && O.length >= s && W.length === 0 && /* @__PURE__ */ e("div", { className: "nice-search-empty", children: F ? F(O) : /* @__PURE__ */ c(te, { children: [
2080
+ /* @__PURE__ */ e("span", { className: "nice-search-empty-icon", children: /* @__PURE__ */ e(ge, { size: 32 }) }),
2081
+ /* @__PURE__ */ c("span", { children: [
2082
+ N.noResults,
2083
+ ' "',
2084
+ O,
2085
+ '"'
2086
+ ] })
2087
+ ] }) }),
2088
+ W.map((p, y) => /* @__PURE__ */ e(
2089
+ Hc,
2090
+ {
2091
+ result: p,
2092
+ isSelected: y === S,
2093
+ onSelect: () => {
2094
+ A == null || A(p), B(!1), C == null || C();
2095
+ },
2096
+ renderResult: L
2052
2097
  },
2053
- renderResult: J
2054
- },
2055
- d.id
2056
- ))
2057
- ] }),
2058
- h && A.length < t && L.length > 0 && /* @__PURE__ */ e(
2059
- Gc,
2060
- {
2061
- searches: L,
2062
- onSelect: (d) => {
2063
- I(d), N(d);
2064
- },
2065
- onClear: () => {
2066
- W([]), localStorage.removeItem("nice_recent_searches");
2067
- },
2068
- label: k.recent,
2069
- clearLabel: k.clearRecent
2070
- }
2071
- ),
2072
- u && /* @__PURE__ */ c("div", { className: "nice-search-shortcuts", children: [
2073
- /* @__PURE__ */ c("span", { children: [
2074
- /* @__PURE__ */ e("kbd", { children: "↑" }),
2075
- /* @__PURE__ */ e("kbd", { children: "↓" }),
2076
- " Navigate"
2077
- ] }),
2078
- /* @__PURE__ */ c("span", { children: [
2079
- /* @__PURE__ */ e("kbd", { children: "↵" }),
2080
- " Select"
2098
+ p.id
2099
+ ))
2081
2100
  ] }),
2082
- /* @__PURE__ */ c("span", { children: [
2083
- /* @__PURE__ */ e("kbd", { children: "Esc" }),
2084
- " Close"
2085
- ] })
2086
- ] })
2087
- ] });
2088
- return M === "modal" ? /* @__PURE__ */ e(
2089
- "div",
2090
- {
2091
- className: "nice-search-overlay",
2092
- onClick: () => {
2093
- P(!1), y == null || y();
2094
- },
2095
- children: /* @__PURE__ */ e(
2096
- "div",
2101
+ h && O.length < s && T.length > 0 && /* @__PURE__ */ e(
2102
+ Gc,
2097
2103
  {
2098
- className: `nice-global-search nice-global-search--modal ${U}`,
2099
- style: B,
2100
- onClick: (d) => d.stopPropagation(),
2101
- role: "dialog",
2102
- "aria-modal": "true",
2103
- children: o
2104
+ searches: T,
2105
+ onSelect: (p) => {
2106
+ P(p), v(p);
2107
+ },
2108
+ onClear: () => {
2109
+ X([]), localStorage.removeItem("nice_recent_searches");
2110
+ },
2111
+ label: N.recent,
2112
+ clearLabel: N.clearRecent
2104
2113
  }
2105
- )
2106
- }
2107
- ) : /* @__PURE__ */ e(
2108
- "div",
2109
- {
2110
- className: `nice-global-search nice-global-search--${M} ${U}`,
2111
- style: B,
2112
- children: o
2113
- }
2114
- );
2115
- }
2116
- );
2117
- Wc.displayName = "NiceGlobalSearch";
2118
- const le = {
2114
+ ),
2115
+ o && /* @__PURE__ */ c("div", { className: "nice-search-shortcuts", children: [
2116
+ /* @__PURE__ */ c("span", { children: [
2117
+ /* @__PURE__ */ e("kbd", { children: /* @__PURE__ */ e(Ae, { name: "arrow-up", size: 12 }) }),
2118
+ /* @__PURE__ */ e("kbd", { children: /* @__PURE__ */ e(Ae, { name: "arrow-down", size: 12 }) }),
2119
+ " ",
2120
+ m("globalSearch.navigate", "Navigate")
2121
+ ] }),
2122
+ /* @__PURE__ */ c("span", { children: [
2123
+ /* @__PURE__ */ e("kbd", { children: "↵" }),
2124
+ " ",
2125
+ m("globalSearch.select", "Select")
2126
+ ] }),
2127
+ /* @__PURE__ */ c("span", { children: [
2128
+ /* @__PURE__ */ e("kbd", { children: "Esc" }),
2129
+ " ",
2130
+ m("globalSearch.close", "Close")
2131
+ ] })
2132
+ ] })
2133
+ ] });
2134
+ return $ === "modal" ? /* @__PURE__ */ e(
2135
+ "div",
2136
+ {
2137
+ className: "nice-search-overlay",
2138
+ onClick: () => {
2139
+ B(!1), C == null || C();
2140
+ },
2141
+ children: /* @__PURE__ */ e(
2142
+ "div",
2143
+ {
2144
+ className: `nice-global-search nice-global-search--modal ${M}`,
2145
+ style: q,
2146
+ onClick: (p) => p.stopPropagation(),
2147
+ role: "dialog",
2148
+ "aria-modal": "true",
2149
+ children: d
2150
+ }
2151
+ )
2152
+ }
2153
+ ) : /* @__PURE__ */ e(
2154
+ "div",
2155
+ {
2156
+ className: `nice-global-search nice-global-search--${$} ${M}`,
2157
+ style: q,
2158
+ children: d
2159
+ }
2160
+ );
2161
+ }
2162
+ ),
2163
+ { displayName: "NiceGlobalSearch" }
2164
+ ), Wc = [], oe = {
2119
2165
  title: "Access Log",
2120
2166
  filters: "Filters",
2121
2167
  search: "Search users, IPs...",
@@ -2167,619 +2213,642 @@ const le = {
2167
2213
  risk: "Risk",
2168
2214
  status: "Status"
2169
2215
  }
2170
- }, ve = {
2171
- login_success: /* @__PURE__ */ e(ae, { size: 16 }),
2172
- login_failed: /* @__PURE__ */ e(oe, { size: 16 }),
2173
- logout: /* @__PURE__ */ e(Re, { size: 16 }),
2174
- password_change: /* @__PURE__ */ e(be, { size: 16 }),
2175
- password_reset: /* @__PURE__ */ e(Ne, { size: 16 }),
2176
- mfa_enabled: /* @__PURE__ */ e(qe, { size: 16 }),
2177
- mfa_disabled: /* @__PURE__ */ e(Me, { size: 16 }),
2178
- mfa_challenged: /* @__PURE__ */ e(fe, { size: 16 }),
2179
- permission_change: /* @__PURE__ */ e(Ye, { size: 16 }),
2180
- session_expired: /* @__PURE__ */ e(xe, { size: 16 }),
2181
- account_locked: /* @__PURE__ */ e(Ee, { size: 16 }),
2182
- account_unlocked: /* @__PURE__ */ e(mc, { size: 16 }),
2183
- api_key_created: /* @__PURE__ */ e(be, { size: 16 }),
2184
- api_key_revoked: /* @__PURE__ */ e(oe, { size: 16 }),
2185
- token_refresh: /* @__PURE__ */ e(Ne, { size: 16 }),
2186
- suspicious_activity: /* @__PURE__ */ e(je, { size: 16 })
2187
- }, re = {
2216
+ }, Ne = {
2217
+ login_success: /* @__PURE__ */ e(se, { size: 16 }),
2218
+ login_failed: /* @__PURE__ */ e(he, { size: 16 }),
2219
+ logout: /* @__PURE__ */ e(Me, { size: 16 }),
2220
+ password_change: /* @__PURE__ */ e(fe, { size: 16 }),
2221
+ password_reset: /* @__PURE__ */ e(ye, { size: 16 }),
2222
+ mfa_enabled: /* @__PURE__ */ e(He, { size: 16 }),
2223
+ mfa_disabled: /* @__PURE__ */ e(Ue, { size: 16 }),
2224
+ mfa_challenged: /* @__PURE__ */ e(we, { size: 16 }),
2225
+ permission_change: /* @__PURE__ */ e(Be, { size: 16 }),
2226
+ session_expired: /* @__PURE__ */ e(Ee, { size: 16 }),
2227
+ account_locked: /* @__PURE__ */ e(Ye, { size: 16 }),
2228
+ account_unlocked: /* @__PURE__ */ e(bc, { size: 16 }),
2229
+ api_key_created: /* @__PURE__ */ e(fe, { size: 16 }),
2230
+ api_key_revoked: /* @__PURE__ */ e(he, { size: 16 }),
2231
+ token_refresh: /* @__PURE__ */ e(ye, { size: 16 }),
2232
+ suspicious_activity: /* @__PURE__ */ e(qe, { size: 16 })
2233
+ }, de = {
2188
2234
  low: "var(--nice-color-success, #22c55e)",
2189
2235
  medium: "var(--nice-color-warning, #f59e0b)",
2190
2236
  high: "var(--nice-color-error, #ef4444)",
2191
2237
  critical: "var(--nice-color-accent-hover, #7c3aed)"
2192
2238
  }, _e = {
2193
- desktop: /* @__PURE__ */ e(gc, { size: 16 }),
2194
- mobile: /* @__PURE__ */ e(fe, { size: 16 }),
2195
- tablet: /* @__PURE__ */ e(fe, { size: 16 }),
2196
- unknown: /* @__PURE__ */ e(Ue, { size: 16 })
2197
- }, Le = (i) => (typeof i == "string" ? new Date(i) : i).toLocaleString("en-US", {
2239
+ desktop: /* @__PURE__ */ e(Nc, { size: 16 }),
2240
+ mobile: /* @__PURE__ */ e(we, { size: 16 }),
2241
+ tablet: /* @__PURE__ */ e(we, { size: 16 }),
2242
+ unknown: /* @__PURE__ */ e(Ve, { size: 16 })
2243
+ }, Ie = (t) => (typeof t == "string" ? new Date(t) : t).toLocaleString("en-US", {
2198
2244
  month: "short",
2199
2245
  day: "numeric",
2200
2246
  hour: "2-digit",
2201
2247
  minute: "2-digit",
2202
2248
  second: "2-digit"
2203
- }), Ae = (i) => {
2204
- if (!i)
2249
+ }), Oe = (t) => {
2250
+ if (!t)
2205
2251
  return "Unknown";
2206
- const s = [];
2207
- return i.city && s.push(i.city), i.country && s.push(i.country), s.length > 0 ? s.join(", ") : "Unknown";
2208
- }, Xc = (i) => {
2209
- if (!i)
2252
+ const n = [];
2253
+ return t.city && n.push(t.city), t.country && n.push(t.country), n.length > 0 ? n.join(", ") : "Unknown";
2254
+ }, Xc = (t) => {
2255
+ if (!t)
2210
2256
  return "Unknown";
2211
- const s = [];
2212
- return i.browser && s.push(i.browser), i.os && s.push(i.os), s.length > 0 ? s.join(" / ") : i.type;
2213
- }, Ie = (i) => i >= 80 ? re.critical : i >= 60 ? re.high : i >= 40 ? re.medium : re.low, Zc = (i, s) => {
2214
- var t, a, n, l, h;
2215
- if (s.startDate) {
2216
- const r = typeof s.startDate == "string" ? new Date(s.startDate) : s.startDate;
2217
- if ((typeof i.timestamp == "string" ? new Date(i.timestamp) : i.timestamp) < r)
2257
+ const n = [];
2258
+ return t.browser && n.push(t.browser), t.os && n.push(t.os), n.length > 0 ? n.join(" / ") : t.type;
2259
+ }, Pe = (t) => t >= 80 ? de.critical : t >= 60 ? de.high : t >= 40 ? de.medium : de.low, Zc = (t, n) => {
2260
+ var s, i, a, l, h;
2261
+ if (n.startDate) {
2262
+ const r = typeof n.startDate == "string" ? new Date(n.startDate) : n.startDate;
2263
+ if ((typeof t.timestamp == "string" ? new Date(t.timestamp) : t.timestamp) < r)
2218
2264
  return !1;
2219
2265
  }
2220
- if (s.endDate) {
2221
- const r = typeof s.endDate == "string" ? new Date(s.endDate) : s.endDate;
2222
- if ((typeof i.timestamp == "string" ? new Date(i.timestamp) : i.timestamp) > r)
2266
+ if (n.endDate) {
2267
+ const r = typeof n.endDate == "string" ? new Date(n.endDate) : n.endDate;
2268
+ if ((typeof t.timestamp == "string" ? new Date(t.timestamp) : t.timestamp) > r)
2223
2269
  return !1;
2224
2270
  }
2225
- if ((t = s.eventTypes) != null && t.length && !s.eventTypes.includes(i.eventType) || (a = s.riskLevels) != null && a.length && !s.riskLevels.includes(i.riskLevel) || s.userId && i.userId !== s.userId || s.ipAddress && !i.ipAddress.includes(s.ipAddress) || s.country && ((n = i.location) == null ? void 0 : n.country) !== s.country || s.successOnly && !i.success || s.failedOnly && i.success)
2271
+ if ((s = n.eventTypes) != null && s.length && !n.eventTypes.includes(t.eventType) || (i = n.riskLevels) != null && i.length && !n.riskLevels.includes(t.riskLevel) || n.userId && t.userId !== n.userId || n.ipAddress && !t.ipAddress.includes(n.ipAddress) || n.country && ((a = t.location) == null ? void 0 : a.country) !== n.country || n.successOnly && !t.success || n.failedOnly && t.success)
2226
2272
  return !1;
2227
- if (s.searchQuery) {
2228
- const r = s.searchQuery.toLowerCase();
2273
+ if (n.searchQuery) {
2274
+ const r = n.searchQuery.toLowerCase();
2229
2275
  if (![
2230
- i.userName,
2231
- i.userEmail,
2232
- i.userId,
2233
- i.ipAddress,
2234
- (l = i.location) == null ? void 0 : l.city,
2235
- (h = i.location) == null ? void 0 : h.country
2276
+ t.userName,
2277
+ t.userEmail,
2278
+ t.userId,
2279
+ t.ipAddress,
2280
+ (l = t.location) == null ? void 0 : l.city,
2281
+ (h = t.location) == null ? void 0 : h.country
2236
2282
  ].filter(Boolean).join(" ").toLowerCase().includes(r))
2237
2283
  return !1;
2238
2284
  }
2239
2285
  return !0;
2240
- }, Qc = te(
2241
- function(s, t) {
2242
- var H, X;
2243
- const {
2244
- entries: a,
2245
- filter: n = {},
2246
- stats: l,
2247
- realtime: h = !1,
2248
- pollingInterval: r = 3e4,
2249
- showMap: u = !1,
2250
- showStats: T = !0,
2251
- showDetails: E = !0,
2252
- pageSize: S = 50,
2253
- labels: y,
2254
- loading: J = !1,
2255
- onFilterChange: _,
2256
- onExport: K,
2257
- onEntrySelect: O,
2258
- onBlockIP: M,
2259
- onRefresh: j,
2260
- className: U = "",
2261
- ...B
2262
- } = s, m = ye(null);
2263
- bc();
2264
- const k = he(
2265
- () => ({
2266
- ...le,
2267
- ...y,
2268
- eventTypes: { ...le.eventTypes, ...y == null ? void 0 : y.eventTypes },
2269
- riskLevels: { ...le.riskLevels, ...y == null ? void 0 : y.riskLevels },
2270
- deviceTypes: { ...le.deviceTypes, ...y == null ? void 0 : y.deviceTypes },
2271
- columns: { ...le.columns, ...y == null ? void 0 : y.columns }
2272
- }),
2273
- [y]
2274
- ), [g, Y] = w(n), [p, P] = w(null), [A, I] = w(S), [C, q] = w(!1), [v, x] = w("table"), z = he(() => a.filter((o) => Zc(o, g)), [a, g]), G = he(() => z.slice(0, A), [z, A]), V = he(() => {
2275
- if (l)
2276
- return l;
2277
- const o = new Set(a.map((f) => f.ipAddress)), d = new Set(a.map((f) => {
2278
- var Z;
2279
- return (Z = f.location) == null ? void 0 : Z.country;
2280
- }).filter(Boolean));
2281
- return {
2282
- totalEvents: a.length,
2283
- successfulLogins: a.filter((f) => f.eventType === "login_success").length,
2284
- failedLogins: a.filter((f) => f.eventType === "login_failed").length,
2285
- uniqueIPs: o.size,
2286
- uniqueCountries: d.size,
2287
- highRiskEvents: a.filter((f) => f.riskLevel === "high" || f.riskLevel === "critical").length,
2288
- suspiciousActivities: a.filter((f) => f.eventType === "suspicious_activity").length
2289
- };
2290
- }, [a, l]), b = $(
2291
- (o) => {
2292
- const d = { ...g, ...o };
2293
- Y(d), I(S), _ == null || _(d);
2294
- },
2295
- [g, _, S]
2296
- ), L = $(() => {
2297
- Y({}), I(S), _ == null || _({});
2298
- }, [_, S]), W = $(
2299
- (o) => {
2300
- P(o), O == null || O(o);
2301
- },
2302
- [O]
2303
- ), F = $(
2304
- (o) => {
2305
- K == null || K(o);
2306
- },
2307
- [K]
2308
- ), Q = $(() => {
2309
- j == null || j();
2310
- }, [j]), N = $(() => {
2311
- I((o) => o + S);
2312
- }, [S]);
2313
- ne(
2314
- t,
2315
- () => ({
2316
- getFilter: () => g,
2317
- applyFilter: b,
2318
- clearFilters: L,
2319
- export: F,
2320
- refresh: Q,
2321
- getSelectedEntry: () => p,
2322
- getElement: () => m.current
2323
- }),
2324
- [g, b, L, F, Q, p]
2325
- );
2326
- const D = (o) => {
2327
- var d, f;
2328
- return /* @__PURE__ */ c(
2329
- "tr",
2330
- {
2331
- className: `nice-accesslog-row ${(p == null ? void 0 : p.id) === o.id ? "nice-accesslog-row--selected" : ""} ${o.success ? "" : "nice-accesslog-row--failed"}`,
2332
- onClick: () => W(o),
2333
- children: [
2334
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--timestamp", children: Le(o.timestamp) }),
2335
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--user", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-user", children: [
2336
- /* @__PURE__ */ e("span", { className: "nice-accesslog-username", children: o.userName || o.userId }),
2337
- o.userEmail && /* @__PURE__ */ e("span", { className: "nice-accesslog-email", children: o.userEmail })
2338
- ] }) }),
2339
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--event", children: /* @__PURE__ */ c("span", { className: `nice-accesslog-event nice-accesslog-event--${o.eventType}`, children: [
2340
- /* @__PURE__ */ e("span", { className: "nice-accesslog-event-icon", children: ve[o.eventType] }),
2341
- k.eventTypes[o.eventType]
2342
- ] }) }),
2343
- /* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--ip", children: [
2344
- /* @__PURE__ */ e("span", { className: "nice-accesslog-ip", children: o.ipAddress }),
2345
- M && /* @__PURE__ */ e(
2346
- "button",
2286
+ }, rt = /* @__PURE__ */ Object.assign(
2287
+ /* @__PURE__ */ le(
2288
+ function(n, s) {
2289
+ var W, Q;
2290
+ const { t: i } = K(), {
2291
+ entries: a = Wc,
2292
+ filter: l = {},
2293
+ stats: h,
2294
+ realtime: r = !1,
2295
+ pollingInterval: o = 3e4,
2296
+ showMap: w = !1,
2297
+ showStats: A = !0,
2298
+ showDetails: I = !0,
2299
+ pageSize: C = 50,
2300
+ labels: L,
2301
+ loading: F = !1,
2302
+ onFilterChange: U,
2303
+ onExport: E,
2304
+ onEntrySelect: $,
2305
+ onBlockIP: ce,
2306
+ onRefresh: M,
2307
+ className: q = "",
2308
+ ...z
2309
+ } = n, m = ke(null);
2310
+ Cc();
2311
+ const N = ue(
2312
+ () => ({
2313
+ ...oe,
2314
+ ...L,
2315
+ eventTypes: { ...oe.eventTypes, ...L == null ? void 0 : L.eventTypes },
2316
+ riskLevels: { ...oe.riskLevels, ...L == null ? void 0 : L.riskLevels },
2317
+ deviceTypes: { ...oe.deviceTypes, ...L == null ? void 0 : L.deviceTypes },
2318
+ columns: { ...oe.columns, ...L == null ? void 0 : L.columns }
2319
+ }),
2320
+ [L]
2321
+ ), [g, V] = k(l), [u, B] = k(null), [O, P] = k(C), [x, H] = k(!1), [Y, b] = k("table"), S = ue(() => a.filter((d) => Zc(d, g)), [a, g]), _ = ue(() => S.slice(0, O), [S, O]), J = ue(() => {
2322
+ if (h)
2323
+ return h;
2324
+ const d = new Set(a.map((y) => y.ipAddress)), p = new Set(a.map((y) => {
2325
+ var ee;
2326
+ return (ee = y.location) == null ? void 0 : ee.country;
2327
+ }).filter(Boolean));
2328
+ return {
2329
+ totalEvents: a.length,
2330
+ successfulLogins: a.filter((y) => y.eventType === "login_success").length,
2331
+ failedLogins: a.filter((y) => y.eventType === "login_failed").length,
2332
+ uniqueIPs: d.size,
2333
+ uniqueCountries: p.size,
2334
+ highRiskEvents: a.filter(
2335
+ (y) => y.riskLevel === "high" || y.riskLevel === "critical"
2336
+ ).length,
2337
+ suspiciousActivities: a.filter((y) => y.eventType === "suspicious_activity").length
2338
+ };
2339
+ }, [a, h]), f = R(
2340
+ (d) => {
2341
+ const p = { ...g, ...d };
2342
+ V(p), P(C), U == null || U(p);
2343
+ },
2344
+ [g, U, C]
2345
+ ), T = R(() => {
2346
+ V({}), P(C), U == null || U({});
2347
+ }, [U, C]), X = R(
2348
+ (d) => {
2349
+ B(d), $ == null || $(d);
2350
+ },
2351
+ [$]
2352
+ ), Z = R(
2353
+ (d) => {
2354
+ E == null || E(d);
2355
+ },
2356
+ [E]
2357
+ ), G = R(() => {
2358
+ M == null || M();
2359
+ }, [M]), v = R(() => {
2360
+ P((d) => d + C);
2361
+ }, [C]);
2362
+ re(
2363
+ s,
2364
+ () => ({
2365
+ getFilter: () => g,
2366
+ applyFilter: f,
2367
+ clearFilters: T,
2368
+ export: Z,
2369
+ refresh: G,
2370
+ getSelectedEntry: () => u,
2371
+ getElement: () => m.current
2372
+ }),
2373
+ [g, f, T, Z, G, u]
2374
+ );
2375
+ const D = (d) => {
2376
+ var p, y;
2377
+ return /* @__PURE__ */ c(
2378
+ "tr",
2379
+ {
2380
+ className: `nice-accesslog-row ${(u == null ? void 0 : u.id) === d.id ? "nice-accesslog-row--selected" : ""} ${d.success ? "" : "nice-accesslog-row--failed"}`,
2381
+ onClick: () => X(d),
2382
+ children: [
2383
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--timestamp", children: Ie(d.timestamp) }),
2384
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--user", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-user", children: [
2385
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-username", children: d.userName || d.userId }),
2386
+ d.userEmail && /* @__PURE__ */ e("span", { className: "nice-accesslog-email", children: d.userEmail })
2387
+ ] }) }),
2388
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--event", children: /* @__PURE__ */ c("span", { className: `nice-accesslog-event nice-accesslog-event--${d.eventType}`, children: [
2389
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-event-icon", children: Ne[d.eventType] }),
2390
+ N.eventTypes[d.eventType]
2391
+ ] }) }),
2392
+ /* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--ip", children: [
2393
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-ip", children: d.ipAddress }),
2394
+ ce && /* @__PURE__ */ e(
2395
+ "button",
2396
+ {
2397
+ type: "button",
2398
+ className: "nice-accesslog-block-btn",
2399
+ onClick: (ee) => {
2400
+ ee.stopPropagation(), ce(d.ipAddress);
2401
+ },
2402
+ title: i("accessLog.blockIp", "Block IP"),
2403
+ children: /* @__PURE__ */ e(gc, { size: 14 })
2404
+ }
2405
+ )
2406
+ ] }),
2407
+ /* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--location", children: [
2408
+ ((p = d.location) == null ? void 0 : p.countryCode) && /* @__PURE__ */ e("span", { className: "nice-accesslog-flag", children: /* @__PURE__ */ e(vc, { size: 14 }) }),
2409
+ Oe(d.location)
2410
+ ] }),
2411
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--device", children: /* @__PURE__ */ c("span", { className: "nice-accesslog-device", children: [
2412
+ _e[((y = d.device) == null ? void 0 : y.type) || "unknown"],
2413
+ Xc(d.device)
2414
+ ] }) }),
2415
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--risk", children: /* @__PURE__ */ c(
2416
+ "span",
2347
2417
  {
2348
- type: "button",
2349
- className: "nice-accesslog-block-btn",
2350
- onClick: (Z) => {
2351
- Z.stopPropagation(), M(o.ipAddress);
2352
- },
2353
- title: "Block IP",
2354
- children: /* @__PURE__ */ e(uc, { size: 14 })
2418
+ className: `nice-accesslog-risk nice-accesslog-risk--${d.riskLevel}`,
2419
+ style: { "--risk-color": Pe(d.riskScore) },
2420
+ children: [
2421
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-risk-score", children: d.riskScore }),
2422
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-risk-label", children: N.riskLevels[d.riskLevel] })
2423
+ ]
2355
2424
  }
2356
- )
2357
- ] }),
2358
- /* @__PURE__ */ c("td", { className: "nice-accesslog-cell nice-accesslog-cell--location", children: [
2359
- ((d = o.location) == null ? void 0 : d.countryCode) && /* @__PURE__ */ e("span", { className: "nice-accesslog-flag", children: /* @__PURE__ */ e(pc, { size: 14 }) }),
2360
- Ae(o.location)
2361
- ] }),
2362
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--device", children: /* @__PURE__ */ c("span", { className: "nice-accesslog-device", children: [
2363
- _e[((f = o.device) == null ? void 0 : f.type) || "unknown"],
2364
- Xc(o.device)
2365
- ] }) }),
2366
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--risk", children: /* @__PURE__ */ c(
2367
- "span",
2368
- {
2369
- className: `nice-accesslog-risk nice-accesslog-risk--${o.riskLevel}`,
2370
- style: { "--risk-color": Ie(o.riskScore) },
2371
- children: [
2372
- /* @__PURE__ */ e("span", { className: "nice-accesslog-risk-score", children: o.riskScore }),
2373
- /* @__PURE__ */ e("span", { className: "nice-accesslog-risk-label", children: k.riskLevels[o.riskLevel] })
2374
- ]
2375
- }
2376
- ) }),
2377
- /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--status", children: /* @__PURE__ */ e(
2378
- "span",
2425
+ ) }),
2426
+ /* @__PURE__ */ e("td", { className: "nice-accesslog-cell nice-accesslog-cell--status", children: /* @__PURE__ */ e(
2427
+ "span",
2428
+ {
2429
+ className: `nice-accesslog-status ${d.success ? "nice-accesslog-status--success" : "nice-accesslog-status--failed"}`,
2430
+ children: d.success ? /* @__PURE__ */ e(se, { size: 14 }) : /* @__PURE__ */ e(he, { size: 14 })
2431
+ }
2432
+ ) })
2433
+ ]
2434
+ },
2435
+ d.id
2436
+ );
2437
+ }, j = (d) => /* @__PURE__ */ c(
2438
+ "div",
2439
+ {
2440
+ className: `nice-accesslog-timeline-item nice-accesslog-timeline-item--${d.riskLevel}`,
2441
+ onClick: () => X(d),
2442
+ children: [
2443
+ /* @__PURE__ */ e(
2444
+ "div",
2379
2445
  {
2380
- className: `nice-accesslog-status ${o.success ? "nice-accesslog-status--success" : "nice-accesslog-status--failed"}`,
2381
- children: o.success ? /* @__PURE__ */ e(ae, { size: 14 }) : /* @__PURE__ */ e(oe, { size: 14 })
2446
+ className: "nice-accesslog-timeline-marker",
2447
+ style: { background: de[d.riskLevel] }
2382
2448
  }
2383
- ) })
2449
+ ),
2450
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-content", children: [
2451
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-header", children: [
2452
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-timeline-event", children: [
2453
+ Ne[d.eventType],
2454
+ " ",
2455
+ N.eventTypes[d.eventType]
2456
+ ] }),
2457
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-timeline-time", children: Ie(d.timestamp) })
2458
+ ] }),
2459
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-details", children: [
2460
+ /* @__PURE__ */ e("span", { children: d.userName || d.userId }),
2461
+ /* @__PURE__ */ e("span", { children: "•" }),
2462
+ /* @__PURE__ */ e("span", { children: d.ipAddress }),
2463
+ /* @__PURE__ */ e("span", { children: "•" }),
2464
+ /* @__PURE__ */ e("span", { children: Oe(d.location) })
2465
+ ] }),
2466
+ d.flags && d.flags.length > 0 && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline-flags", children: d.flags.map((p, y) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: p }, y)) })
2467
+ ] })
2384
2468
  ]
2385
2469
  },
2386
- o.id
2470
+ d.id
2387
2471
  );
2388
- }, R = (o) => /* @__PURE__ */ c(
2389
- "div",
2390
- {
2391
- className: `nice-accesslog-timeline-item nice-accesslog-timeline-item--${o.riskLevel}`,
2392
- onClick: () => W(o),
2393
- children: [
2394
- /* @__PURE__ */ e(
2395
- "div",
2396
- {
2397
- className: "nice-accesslog-timeline-marker",
2398
- style: { background: re[o.riskLevel] }
2399
- }
2400
- ),
2401
- /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-content", children: [
2402
- /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-header", children: [
2403
- /* @__PURE__ */ c("span", { className: "nice-accesslog-timeline-event", children: [
2404
- ve[o.eventType],
2405
- " ",
2406
- k.eventTypes[o.eventType]
2407
- ] }),
2408
- /* @__PURE__ */ e("span", { className: "nice-accesslog-timeline-time", children: Le(o.timestamp) })
2409
- ] }),
2410
- /* @__PURE__ */ c("div", { className: "nice-accesslog-timeline-details", children: [
2411
- /* @__PURE__ */ e("span", { children: o.userName || o.userId }),
2412
- /* @__PURE__ */ e("span", { children: "•" }),
2413
- /* @__PURE__ */ e("span", { children: o.ipAddress }),
2414
- /* @__PURE__ */ e("span", { children: "•" }),
2415
- /* @__PURE__ */ e("span", { children: Ae(o.location) })
2416
- ] }),
2417
- o.flags && o.flags.length > 0 && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline-flags", children: o.flags.map((d, f) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: d }, f)) })
2418
- ] })
2419
- ]
2420
- },
2421
- o.id
2422
- );
2423
- return /* @__PURE__ */ c("div", { ref: m, className: `nice-accesslog ${U}`, ...B, children: [
2424
- /* @__PURE__ */ c("div", { className: "nice-accesslog-header", children: [
2425
- /* @__PURE__ */ c("div", { className: "nice-accesslog-header-left", children: [
2426
- /* @__PURE__ */ e("h2", { className: "nice-accesslog-title", children: k.title }),
2427
- h && /* @__PURE__ */ c("span", { className: "nice-accesslog-realtime-badge", children: [
2428
- /* @__PURE__ */ e(Ce, { size: 10 }),
2429
- " Live"
2430
- ] })
2431
- ] }),
2432
- /* @__PURE__ */ c("div", { className: "nice-accesslog-header-actions", children: [
2433
- /* @__PURE__ */ c(
2434
- "button",
2435
- {
2436
- type: "button",
2437
- className: "nice-accesslog-btn",
2438
- onClick: Q,
2439
- disabled: J,
2440
- children: [
2441
- /* @__PURE__ */ e(Ne, { size: 16 }),
2442
- " ",
2443
- k.refresh
2444
- ]
2445
- }
2446
- ),
2447
- /* @__PURE__ */ c("div", { className: "nice-accesslog-export-dropdown", children: [
2448
- /* @__PURE__ */ c("button", { type: "button", className: "nice-accesslog-btn", children: [
2449
- /* @__PURE__ */ e(me, { size: 16 }),
2472
+ return /* @__PURE__ */ c("div", { ref: m, className: `nice-accesslog ${q}`, ...z, children: [
2473
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-header", children: [
2474
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-header-left", children: [
2475
+ /* @__PURE__ */ e("h2", { className: "nice-accesslog-title", children: N.title }),
2476
+ r && /* @__PURE__ */ c("span", { className: "nice-accesslog-realtime-badge", children: [
2477
+ /* @__PURE__ */ e(De, { size: 10 }),
2450
2478
  " ",
2451
- k.export
2452
- ] }),
2453
- /* @__PURE__ */ c("div", { className: "nice-accesslog-export-menu", children: [
2454
- /* @__PURE__ */ e("button", { onClick: () => F("csv"), children: "CSV" }),
2455
- /* @__PURE__ */ e("button", { onClick: () => F("json"), children: "JSON" }),
2456
- /* @__PURE__ */ e("button", { onClick: () => F("pdf"), children: "PDF" })
2479
+ i("accessLog.live", "Live")
2457
2480
  ] })
2458
- ] })
2459
- ] })
2460
- ] }),
2461
- T && /* @__PURE__ */ c("div", { className: "nice-accesslog-stats", children: [
2462
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2463
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.totalEvents }),
2464
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Total Events" })
2465
- ] }),
2466
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--success", children: [
2467
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.successfulLogins }),
2468
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Successful" })
2469
- ] }),
2470
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--failed", children: [
2471
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.failedLogins }),
2472
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Failed" })
2473
- ] }),
2474
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2475
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.uniqueIPs }),
2476
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Unique IPs" })
2477
- ] }),
2478
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2479
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.uniqueCountries }),
2480
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "Countries" })
2481
- ] }),
2482
- /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--warning", children: [
2483
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: V.highRiskEvents }),
2484
- /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: "High Risk" })
2485
- ] })
2486
- ] }),
2487
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filters", children: [
2488
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filters-row", children: [
2489
- /* @__PURE__ */ c("div", { className: "nice-accesslog-search", children: [
2490
- /* @__PURE__ */ e("span", { className: "nice-accesslog-search-icon", children: /* @__PURE__ */ e(pe, { size: 16 }) }),
2491
- /* @__PURE__ */ e(
2492
- "input",
2493
- {
2494
- type: "text",
2495
- placeholder: k.search,
2496
- value: g.searchQuery || "",
2497
- onChange: (o) => b({ searchQuery: o.target.value })
2498
- }
2499
- )
2500
2481
  ] }),
2501
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-quick", children: [
2502
- /* @__PURE__ */ e(
2503
- "button",
2504
- {
2505
- type: "button",
2506
- className: `nice-accesslog-filter-chip ${g.failedOnly ? "nice-accesslog-filter-chip--active" : ""}`,
2507
- onClick: () => b({ failedOnly: !g.failedOnly, successOnly: !1 }),
2508
- children: "Failed Only"
2509
- }
2510
- ),
2511
- /* @__PURE__ */ e(
2482
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-header-actions", children: [
2483
+ /* @__PURE__ */ c(
2512
2484
  "button",
2513
2485
  {
2514
2486
  type: "button",
2515
- className: `nice-accesslog-filter-chip ${(H = g.riskLevels) != null && H.includes("high") || (X = g.riskLevels) != null && X.includes("critical") ? "nice-accesslog-filter-chip--active" : ""}`,
2516
- onClick: () => {
2517
- var o;
2518
- return b({
2519
- riskLevels: (o = g.riskLevels) != null && o.includes("high") ? [] : ["high", "critical"]
2520
- });
2521
- },
2522
- children: "High Risk"
2487
+ className: "nice-accesslog-btn",
2488
+ onClick: G,
2489
+ disabled: F,
2490
+ children: [
2491
+ /* @__PURE__ */ e(ye, { size: 16 }),
2492
+ " ",
2493
+ N.refresh
2494
+ ]
2523
2495
  }
2524
2496
  ),
2525
- /* @__PURE__ */ e(
2526
- "button",
2527
- {
2528
- type: "button",
2529
- className: "nice-accesslog-filter-toggle",
2530
- onClick: () => q(!C),
2531
- children: C ? /* @__PURE__ */ c(ee, { children: [
2532
- /* @__PURE__ */ e(oc, { size: 14 }),
2533
- " Less"
2534
- ] }) : /* @__PURE__ */ c(ee, { children: [
2535
- /* @__PURE__ */ e(Se, { size: 14 }),
2536
- " More"
2537
- ] })
2538
- }
2539
- )
2497
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-export-dropdown", children: [
2498
+ /* @__PURE__ */ c("button", { type: "button", className: "nice-accesslog-btn", children: [
2499
+ /* @__PURE__ */ e(ve, { size: 16 }),
2500
+ " ",
2501
+ N.export
2502
+ ] }),
2503
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-export-menu", children: [
2504
+ /* @__PURE__ */ e("button", { onClick: () => Z("csv"), children: "CSV" }),
2505
+ /* @__PURE__ */ e("button", { onClick: () => Z("json"), children: i("accessLog.json", "JSON") }),
2506
+ /* @__PURE__ */ e("button", { onClick: () => Z("pdf"), children: "PDF" })
2507
+ ] })
2508
+ ] })
2540
2509
  ] })
2541
2510
  ] }),
2542
- C && /* @__PURE__ */ c("div", { className: "nice-accesslog-filters-expanded", children: [
2543
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2544
- /* @__PURE__ */ e("label", { children: "Event Type" }),
2545
- /* @__PURE__ */ e(
2546
- "select",
2547
- {
2548
- multiple: !0,
2549
- value: g.eventTypes || [],
2550
- onChange: (o) => {
2551
- const d = Array.from(
2552
- o.target.selectedOptions,
2553
- (f) => f.value
2554
- );
2555
- b({ eventTypes: d.length ? d : void 0 });
2556
- },
2557
- children: Object.entries(k.eventTypes).map(([o, d]) => /* @__PURE__ */ e("option", { value: o, children: d }, o))
2558
- }
2559
- )
2511
+ A && /* @__PURE__ */ c("div", { className: "nice-accesslog-stats", children: [
2512
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2513
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.totalEvents }),
2514
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.totalEvents", "Total Events") })
2515
+ ] }),
2516
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--success", children: [
2517
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.successfulLogins }),
2518
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.successful", "Successful") })
2560
2519
  ] }),
2561
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2562
- /* @__PURE__ */ e("label", { children: "Date Range" }),
2563
- /* @__PURE__ */ c("div", { className: "nice-accesslog-date-range", children: [
2520
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--failed", children: [
2521
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.failedLogins }),
2522
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.failed", "Failed") })
2523
+ ] }),
2524
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2525
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.uniqueIPs }),
2526
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.uniqueIps", "Unique IPs") })
2527
+ ] }),
2528
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat", children: [
2529
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.uniqueCountries }),
2530
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.countries", "Countries") })
2531
+ ] }),
2532
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-stat nice-accesslog-stat--warning", children: [
2533
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-value", children: J.highRiskEvents }),
2534
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-stat-label", children: i("accessLog.highRisk", "High Risk") })
2535
+ ] })
2536
+ ] }),
2537
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filters", children: [
2538
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filters-row", children: [
2539
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-search", children: [
2540
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-search-icon", children: /* @__PURE__ */ e(ge, { size: 16 }) }),
2564
2541
  /* @__PURE__ */ e(
2565
2542
  "input",
2566
2543
  {
2567
- type: "date",
2568
- value: g.startDate ? new Date(g.startDate).toISOString().split("T")[0] : "",
2569
- onChange: (o) => b({ startDate: o.target.value || void 0 })
2544
+ type: "text",
2545
+ placeholder: N.search,
2546
+ value: g.searchQuery || "",
2547
+ onChange: (d) => f({ searchQuery: d.target.value })
2548
+ }
2549
+ )
2550
+ ] }),
2551
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-quick", children: [
2552
+ /* @__PURE__ */ e(
2553
+ "button",
2554
+ {
2555
+ type: "button",
2556
+ className: `nice-accesslog-filter-chip ${g.failedOnly ? "nice-accesslog-filter-chip--active" : ""}`,
2557
+ onClick: () => f({ failedOnly: !g.failedOnly, successOnly: !1 }),
2558
+ children: i("accessLog.failedOnly", "Failed Only")
2570
2559
  }
2571
2560
  ),
2572
- /* @__PURE__ */ e("span", { children: "to" }),
2573
2561
  /* @__PURE__ */ e(
2574
- "input",
2562
+ "button",
2575
2563
  {
2576
- type: "date",
2577
- value: g.endDate ? new Date(g.endDate).toISOString().split("T")[0] : "",
2578
- onChange: (o) => b({ endDate: o.target.value || void 0 })
2564
+ type: "button",
2565
+ className: `nice-accesslog-filter-chip ${(W = g.riskLevels) != null && W.includes("high") || (Q = g.riskLevels) != null && Q.includes("critical") ? "nice-accesslog-filter-chip--active" : ""}`,
2566
+ onClick: () => {
2567
+ var d;
2568
+ return f({
2569
+ riskLevels: (d = g.riskLevels) != null && d.includes("high") ? [] : ["high", "critical"]
2570
+ });
2571
+ },
2572
+ children: i("accessLog.highRisk", "High Risk")
2573
+ }
2574
+ ),
2575
+ /* @__PURE__ */ e(
2576
+ "button",
2577
+ {
2578
+ type: "button",
2579
+ className: "nice-accesslog-filter-toggle",
2580
+ onClick: () => H(!x),
2581
+ children: x ? /* @__PURE__ */ c(te, { children: [
2582
+ /* @__PURE__ */ e(pc, { size: 14 }),
2583
+ " ",
2584
+ i("accessLog.less", "Less")
2585
+ ] }) : /* @__PURE__ */ c(te, { children: [
2586
+ /* @__PURE__ */ e(Te, { size: 14 }),
2587
+ " ",
2588
+ i("accessLog.more", "More")
2589
+ ] })
2579
2590
  }
2580
2591
  )
2581
2592
  ] })
2582
2593
  ] }),
2583
- /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2584
- /* @__PURE__ */ e("label", { children: "IP Address" }),
2594
+ x && /* @__PURE__ */ c("div", { className: "nice-accesslog-filters-expanded", children: [
2595
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2596
+ /* @__PURE__ */ e("label", { children: i("accessLog.eventType", "Event Type") }),
2597
+ /* @__PURE__ */ e(
2598
+ "select",
2599
+ {
2600
+ multiple: !0,
2601
+ value: g.eventTypes || [],
2602
+ onChange: (d) => {
2603
+ const p = Array.from(
2604
+ d.target.selectedOptions,
2605
+ (y) => y.value
2606
+ );
2607
+ f({ eventTypes: p.length ? p : void 0 });
2608
+ },
2609
+ children: Object.entries(N.eventTypes).map(([d, p]) => /* @__PURE__ */ e("option", { value: d, children: p }, d))
2610
+ }
2611
+ )
2612
+ ] }),
2613
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2614
+ /* @__PURE__ */ e("label", { children: i("accessLog.dateRange", "Date Range") }),
2615
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-date-range", children: [
2616
+ /* @__PURE__ */ e(
2617
+ "input",
2618
+ {
2619
+ type: "date",
2620
+ value: g.startDate ? new Date(g.startDate).toISOString().split("T")[0] : "",
2621
+ onChange: (d) => f({ startDate: d.target.value || void 0 })
2622
+ }
2623
+ ),
2624
+ /* @__PURE__ */ e("span", { children: i("accessLog.to", "to") }),
2625
+ /* @__PURE__ */ e(
2626
+ "input",
2627
+ {
2628
+ type: "date",
2629
+ value: g.endDate ? new Date(g.endDate).toISOString().split("T")[0] : "",
2630
+ onChange: (d) => f({ endDate: d.target.value || void 0 })
2631
+ }
2632
+ )
2633
+ ] })
2634
+ ] }),
2635
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-filter-group", children: [
2636
+ /* @__PURE__ */ e("label", { children: i("accessLog.ipAddress", "IP Address") }),
2637
+ /* @__PURE__ */ e(
2638
+ "input",
2639
+ {
2640
+ type: "text",
2641
+ placeholder: "e.g., 192.168",
2642
+ value: g.ipAddress || "",
2643
+ onChange: (d) => f({ ipAddress: d.target.value || void 0 })
2644
+ }
2645
+ )
2646
+ ] }),
2585
2647
  /* @__PURE__ */ e(
2586
- "input",
2648
+ "button",
2587
2649
  {
2588
- type: "text",
2589
- placeholder: "e.g., 192.168",
2590
- value: g.ipAddress || "",
2591
- onChange: (o) => b({ ipAddress: o.target.value || void 0 })
2650
+ type: "button",
2651
+ className: "nice-accesslog-clear-filters",
2652
+ onClick: T,
2653
+ children: i("accessLog.clearAllFilters", "Clear All Filters")
2592
2654
  }
2593
2655
  )
2594
- ] }),
2595
- /* @__PURE__ */ e("button", { type: "button", className: "nice-accesslog-clear-filters", onClick: L, children: "Clear All Filters" })
2596
- ] })
2597
- ] }),
2598
- /* @__PURE__ */ c("div", { className: "nice-accesslog-tabs", children: [
2599
- /* @__PURE__ */ c(
2600
- "button",
2601
- {
2602
- type: "button",
2603
- className: `nice-accesslog-tab ${v === "table" ? "nice-accesslog-tab--active" : ""}`,
2604
- onClick: () => x("table"),
2605
- children: [
2606
- /* @__PURE__ */ e(dc, { size: 16 }),
2607
- " Table"
2608
- ]
2609
- }
2610
- ),
2611
- /* @__PURE__ */ c(
2612
- "button",
2613
- {
2614
- type: "button",
2615
- className: `nice-accesslog-tab ${v === "timeline" ? "nice-accesslog-tab--active" : ""}`,
2616
- onClick: () => x("timeline"),
2617
- children: [
2618
- /* @__PURE__ */ e(hc, { size: 16 }),
2619
- " ",
2620
- k.timeline
2621
- ]
2622
- }
2623
- ),
2624
- u && /* @__PURE__ */ c(
2625
- "button",
2626
- {
2627
- type: "button",
2628
- className: `nice-accesslog-tab ${v === "map" ? "nice-accesslog-tab--active" : ""}`,
2629
- onClick: () => x("map"),
2630
- children: [
2631
- /* @__PURE__ */ e(Te, { size: 16 }),
2632
- " ",
2633
- k.map
2634
- ]
2635
- }
2636
- ),
2637
- /* @__PURE__ */ c("span", { className: "nice-accesslog-count", children: [
2638
- z.length,
2639
- " entries"
2640
- ] })
2641
- ] }),
2642
- /* @__PURE__ */ e("div", { className: "nice-accesslog-content", children: J ? /* @__PURE__ */ c("div", { className: "nice-accesslog-loading", children: [
2643
- /* @__PURE__ */ e("div", { className: "nice-accesslog-spinner" }),
2644
- "Loading access logs..."
2645
- ] }) : z.length === 0 ? /* @__PURE__ */ c("div", { className: "nice-accesslog-empty", children: [
2646
- /* @__PURE__ */ e("span", { className: "nice-accesslog-empty-icon", children: /* @__PURE__ */ e(qe, { size: 32 }) }),
2647
- /* @__PURE__ */ e("span", { children: k.noResults })
2648
- ] }) : /* @__PURE__ */ c(ee, { children: [
2649
- v === "table" && /* @__PURE__ */ e("div", { className: "nice-accesslog-table-wrapper", children: /* @__PURE__ */ c("table", { className: "nice-accesslog-table", children: [
2650
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
2651
- /* @__PURE__ */ e("th", { children: k.columns.timestamp }),
2652
- /* @__PURE__ */ e("th", { children: k.columns.user }),
2653
- /* @__PURE__ */ e("th", { children: k.columns.event }),
2654
- /* @__PURE__ */ e("th", { children: k.columns.ip }),
2655
- /* @__PURE__ */ e("th", { children: k.columns.location }),
2656
- /* @__PURE__ */ e("th", { children: k.columns.device }),
2657
- /* @__PURE__ */ e("th", { children: k.columns.risk }),
2658
- /* @__PURE__ */ e("th", { children: k.columns.status })
2656
+ ] })
2657
+ ] }),
2658
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-tabs", children: [
2659
+ /* @__PURE__ */ c(
2660
+ "button",
2661
+ {
2662
+ type: "button",
2663
+ className: `nice-accesslog-tab ${Y === "table" ? "nice-accesslog-tab--active" : ""}`,
2664
+ onClick: () => b("table"),
2665
+ children: [
2666
+ /* @__PURE__ */ e(uc, { size: 16 }),
2667
+ " ",
2668
+ i("accessLog.table", "Table")
2669
+ ]
2670
+ }
2671
+ ),
2672
+ /* @__PURE__ */ c(
2673
+ "button",
2674
+ {
2675
+ type: "button",
2676
+ className: `nice-accesslog-tab ${Y === "timeline" ? "nice-accesslog-tab--active" : ""}`,
2677
+ onClick: () => b("timeline"),
2678
+ children: [
2679
+ /* @__PURE__ */ e(mc, { size: 16 }),
2680
+ " ",
2681
+ N.timeline
2682
+ ]
2683
+ }
2684
+ ),
2685
+ w && /* @__PURE__ */ c(
2686
+ "button",
2687
+ {
2688
+ type: "button",
2689
+ className: `nice-accesslog-tab ${Y === "map" ? "nice-accesslog-tab--active" : ""}`,
2690
+ onClick: () => b("map"),
2691
+ children: [
2692
+ /* @__PURE__ */ e(ze, { size: 16 }),
2693
+ " ",
2694
+ N.map
2695
+ ]
2696
+ }
2697
+ ),
2698
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-count", children: i("accessLog.entries", "{filteredEntries} entries").replace(
2699
+ "{filteredEntries}",
2700
+ String(S.length)
2701
+ ) })
2702
+ ] }),
2703
+ /* @__PURE__ */ e("div", { className: "nice-accesslog-content", children: F ? /* @__PURE__ */ c("div", { className: "nice-accesslog-loading", children: [
2704
+ /* @__PURE__ */ e("div", { className: "nice-accesslog-spinner" }),
2705
+ i("accessLog.loadingAccessLogs", "Loading access logs...")
2706
+ ] }) : S.length === 0 ? /* @__PURE__ */ c("div", { className: "nice-accesslog-empty", children: [
2707
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-empty-icon", children: /* @__PURE__ */ e(He, { size: 32 }) }),
2708
+ /* @__PURE__ */ e("span", { children: N.noResults })
2709
+ ] }) : /* @__PURE__ */ c(te, { children: [
2710
+ Y === "table" && /* @__PURE__ */ e("div", { className: "nice-accesslog-table-wrapper", children: /* @__PURE__ */ c("table", { className: "nice-accesslog-table", children: [
2711
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
2712
+ /* @__PURE__ */ e("th", { children: N.columns.timestamp }),
2713
+ /* @__PURE__ */ e("th", { children: N.columns.user }),
2714
+ /* @__PURE__ */ e("th", { children: N.columns.event }),
2715
+ /* @__PURE__ */ e("th", { children: N.columns.ip }),
2716
+ /* @__PURE__ */ e("th", { children: N.columns.location }),
2717
+ /* @__PURE__ */ e("th", { children: N.columns.device }),
2718
+ /* @__PURE__ */ e("th", { children: N.columns.risk }),
2719
+ /* @__PURE__ */ e("th", { children: N.columns.status })
2720
+ ] }) }),
2721
+ /* @__PURE__ */ e("tbody", { children: _.map(D) })
2659
2722
  ] }) }),
2660
- /* @__PURE__ */ e("tbody", { children: G.map(D) })
2661
- ] }) }),
2662
- v === "timeline" && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline", children: G.map(R) }),
2663
- v === "map" && /* @__PURE__ */ e("div", { className: "nice-accesslog-map", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-map-placeholder", children: [
2664
- /* @__PURE__ */ e(Te, { size: 16 }),
2665
- " Geographic visualization would render here"
2666
- ] }) }),
2667
- A < z.length && /* @__PURE__ */ c("button", { type: "button", className: "nice-accesslog-show-more", onClick: N, children: [
2668
- k.showMore,
2669
- " (",
2670
- z.length - A,
2671
- " remaining)"
2672
- ] })
2673
- ] }) }),
2674
- E && p && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail", children: [
2675
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-header", children: [
2676
- /* @__PURE__ */ e("h3", { children: k.details }),
2677
- /* @__PURE__ */ e(
2723
+ Y === "timeline" && /* @__PURE__ */ e("div", { className: "nice-accesslog-timeline", children: _.map(j) }),
2724
+ Y === "map" && /* @__PURE__ */ e("div", { className: "nice-accesslog-map", children: /* @__PURE__ */ c("div", { className: "nice-accesslog-map-placeholder", children: [
2725
+ /* @__PURE__ */ e(ze, { size: 16 }),
2726
+ " ",
2727
+ i(
2728
+ "accessLog.geographicVisualizationWouldRenderHere",
2729
+ "Geographic visualization would render here"
2730
+ )
2731
+ ] }) }),
2732
+ O < S.length && /* @__PURE__ */ e(
2678
2733
  "button",
2679
2734
  {
2680
2735
  type: "button",
2681
- className: "nice-accesslog-detail-close",
2682
- onClick: () => P(null),
2683
- children: /* @__PURE__ */ e(ge, { size: 16 })
2736
+ className: "nice-accesslog-show-more",
2737
+ onClick: v,
2738
+ children: i("accessLog.remaining", "{showMore} ({filteredEntries} remaining)").replace("{showMore}", String(N.showMore)).replace("{filteredEntries}", String(S.length - O))
2684
2739
  }
2685
2740
  )
2686
- ] }),
2687
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-content", children: [
2688
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2689
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Event ID" }),
2690
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: p.id })
2691
- ] }),
2692
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2693
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Timestamp" }),
2694
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: new Date(p.timestamp).toISOString() })
2695
- ] }),
2696
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2697
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "User" }),
2698
- /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2699
- p.userName,
2700
- " (",
2701
- p.userId,
2702
- ")",
2703
- p.userEmail && /* @__PURE__ */ e("div", { children: p.userEmail })
2704
- ] })
2705
- ] }),
2706
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2707
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Event Type" }),
2708
- /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2709
- ve[p.eventType],
2710
- " ",
2711
- k.eventTypes[p.eventType]
2712
- ] })
2713
- ] }),
2714
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2715
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "IP Address" }),
2716
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: p.ipAddress })
2741
+ ] }) }),
2742
+ I && u && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail", children: [
2743
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-header", children: [
2744
+ /* @__PURE__ */ e("h3", { children: N.details }),
2745
+ /* @__PURE__ */ e(
2746
+ "button",
2747
+ {
2748
+ type: "button",
2749
+ className: "nice-accesslog-detail-close",
2750
+ onClick: () => B(null),
2751
+ children: /* @__PURE__ */ e(be, { size: 16 })
2752
+ }
2753
+ )
2717
2754
  ] }),
2718
- p.location && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2719
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Location" }),
2720
- /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2721
- p.location.city,
2722
- ", ",
2723
- p.location.region,
2724
- ",",
2725
- " ",
2726
- p.location.country,
2727
- p.location.latitude && p.location.longitude && /* @__PURE__ */ c("div", { className: "nice-accesslog-coords", children: [
2728
- "(",
2729
- p.location.latitude,
2755
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-content", children: [
2756
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2757
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.eventId", "Event ID") }),
2758
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: u.id })
2759
+ ] }),
2760
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2761
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.timestamp", "Timestamp") }),
2762
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: new Date(u.timestamp).toISOString() })
2763
+ ] }),
2764
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2765
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.user", "User") }),
2766
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2767
+ u.userName,
2768
+ " (",
2769
+ u.userId,
2770
+ ")",
2771
+ u.userEmail && /* @__PURE__ */ e("div", { children: u.userEmail })
2772
+ ] })
2773
+ ] }),
2774
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2775
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.eventType", "Event Type") }),
2776
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2777
+ Ne[u.eventType],
2778
+ " ",
2779
+ N.eventTypes[u.eventType]
2780
+ ] })
2781
+ ] }),
2782
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2783
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.ipAddress", "IP Address") }),
2784
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: u.ipAddress })
2785
+ ] }),
2786
+ u.location && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2787
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.location", "Location") }),
2788
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2789
+ u.location.city,
2730
2790
  ", ",
2731
- p.location.longitude,
2732
- ")"
2791
+ u.location.region,
2792
+ ",",
2793
+ " ",
2794
+ u.location.country,
2795
+ u.location.latitude && u.location.longitude && /* @__PURE__ */ c("div", { className: "nice-accesslog-coords", children: [
2796
+ "(",
2797
+ u.location.latitude,
2798
+ ", ",
2799
+ u.location.longitude,
2800
+ ")"
2801
+ ] })
2733
2802
  ] })
2734
- ] })
2735
- ] }),
2736
- p.device && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2737
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Device" }),
2738
- /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2739
- _e[p.device.type],
2740
- " ",
2741
- p.device.os,
2742
- " ",
2743
- p.device.osVersion,
2744
- /* @__PURE__ */ c("div", { children: [
2745
- p.device.browser,
2803
+ ] }),
2804
+ u.device && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2805
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.device", "Device") }),
2806
+ /* @__PURE__ */ c("span", { className: "nice-accesslog-detail-value", children: [
2807
+ _e[u.device.type],
2746
2808
  " ",
2747
- p.device.browserVersion
2748
- ] }),
2749
- p.device.fingerprint && /* @__PURE__ */ c("div", { className: "nice-accesslog-fingerprint", children: [
2750
- "Fingerprint: ",
2751
- p.device.fingerprint
2809
+ u.device.os,
2810
+ " ",
2811
+ u.device.osVersion,
2812
+ /* @__PURE__ */ c("div", { children: [
2813
+ u.device.browser,
2814
+ " ",
2815
+ u.device.browserVersion
2816
+ ] }),
2817
+ u.device.fingerprint && /* @__PURE__ */ e("div", { className: "nice-accesslog-fingerprint", children: i("accessLog.fingerprint", "Fingerprint: {fingerprint}").replace(
2818
+ "{fingerprint}",
2819
+ String(u.device.fingerprint)
2820
+ ) })
2752
2821
  ] })
2822
+ ] }),
2823
+ /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2824
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.riskScore", "Risk Score") }),
2825
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: /* @__PURE__ */ c("span", { style: { color: Pe(u.riskScore) }, children: [
2826
+ u.riskScore,
2827
+ "/100 (",
2828
+ N.riskLevels[u.riskLevel],
2829
+ ")"
2830
+ ] }) })
2831
+ ] }),
2832
+ u.flags && u.flags.length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2833
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.flags", "Flags") }),
2834
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: u.flags.map((d, p) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: d }, p)) })
2835
+ ] }),
2836
+ u.details && Object.keys(u.details).length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2837
+ /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: i("accessLog.additionalDetails", "Additional Details") }),
2838
+ /* @__PURE__ */ e("pre", { className: "nice-accesslog-detail-json", children: JSON.stringify(u.details, null, 2) })
2753
2839
  ] })
2754
- ] }),
2755
- /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2756
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Risk Score" }),
2757
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: /* @__PURE__ */ c("span", { style: { color: Ie(p.riskScore) }, children: [
2758
- p.riskScore,
2759
- "/100 (",
2760
- k.riskLevels[p.riskLevel],
2761
- ")"
2762
- ] }) })
2763
- ] }),
2764
- p.flags && p.flags.length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2765
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Flags" }),
2766
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-value", children: p.flags.map((o, d) => /* @__PURE__ */ e("span", { className: "nice-accesslog-flag-badge", children: o }, d)) })
2767
- ] }),
2768
- p.details && Object.keys(p.details).length > 0 && /* @__PURE__ */ c("div", { className: "nice-accesslog-detail-row", children: [
2769
- /* @__PURE__ */ e("span", { className: "nice-accesslog-detail-label", children: "Additional Details" }),
2770
- /* @__PURE__ */ e("pre", { className: "nice-accesslog-detail-json", children: JSON.stringify(p.details, null, 2) })
2771
2840
  ] })
2772
2841
  ] })
2773
- ] })
2774
- ] });
2775
- }
2842
+ ] });
2843
+ }
2844
+ ),
2845
+ { displayName: "NiceAccessLog" }
2776
2846
  );
2777
- Qc.displayName = "NiceAccessLog";
2778
2847
  export {
2779
- Qc as NiceAccessLog,
2780
- Ic as NiceAuditTrail,
2781
- Mc as NiceContractEditor,
2782
- zc as NiceDataExportCenter,
2783
- Vc as NiceGDPRConsent,
2784
- Wc as NiceGlobalSearch
2848
+ rt as NiceAccessLog,
2849
+ it as NiceAuditTrail,
2850
+ st as NiceContractEditor,
2851
+ at as NiceDataExportCenter,
2852
+ nt as NiceGDPRConsent,
2853
+ lt as NiceGlobalSearch
2785
2854
  };