@feedmepos/mf-hrm-portal 2.0.25 → 2.1.0-dev.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.
Files changed (63) hide show
  1. package/dist/AuditLogList-AGlAsWwd.js +1608 -0
  2. package/dist/ConditionFormHost.vue_vue_type_script_setup_true_lang-BYHKFwRm.js +383 -0
  3. package/dist/EmployeeList-KvjoGI87.js +884 -0
  4. package/dist/{Main-C6YMg19H.js → Main-BLh16xRg.js} +187 -184
  5. package/dist/{Main-DQg87aB2.js → Main-D3TSdtSE.js} +7 -7
  6. package/dist/{Main-CyqPnLTe.js → Main-Dn1TfDRj.js} +1033 -1029
  7. package/dist/PermissionSetList-Ds69m9UU.js +392 -0
  8. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Bk6ub3Dv.js +4030 -0
  9. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-DWeS7VXx.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-BHxCP_uW.js} +1 -1
  10. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-QrqYEy8i.js +42 -0
  11. package/dist/RoleList-v8McRCnz.js +684 -0
  12. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +16 -0
  13. package/dist/{index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js → TableEmptyState.vue_vue_type_script_setup_true_lang-Ci_MVqGK.js} +54 -20
  14. package/dist/TeamMemberList-BYQnNIhT.js +1169 -0
  15. package/dist/{TimesheetList-DzeE73Ns.js → TimesheetList-C1OWa6kf.js} +139 -133
  16. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_91afda4e_lang-CTQs7MIl.js → TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CLu9gzzi.js} +2 -2
  17. package/dist/{app-Df4eEEIU.js → app-CJouCBgi.js} +5248 -2273
  18. package/dist/app.js +1 -1
  19. package/dist/{dayjs.min-DmGoh5hw.js → dayjs.min-DUugkgDM.js} +1 -1
  20. package/dist/{employee-zWTRoOkw.js → employee-D5rEVmge.js} +3 -3
  21. package/dist/{iteration-DTV3udF0.js → iteration-QRRNYlps.js} +3 -3
  22. package/dist/{lodash-LInzVEDS.js → lodash-BlZhpHhM.js} +1 -1
  23. package/dist/rule-Dy7eMChN.js +1053 -0
  24. package/dist/src/api/audit-log/index.d.ts +6 -0
  25. package/dist/src/components/CheckboxInput.vue.d.ts +1 -1
  26. package/dist/src/components/button/ResponsiveFabButton.vue.d.ts +7 -1
  27. package/dist/src/components/table/EmptyDataTemplate/index.vue.d.ts +4 -1
  28. package/dist/src/components/table/TableEmptyState.vue.d.ts +31 -0
  29. package/dist/src/composables/useBasePermission.d.ts +1 -0
  30. package/dist/src/composables/useConditionDraft.d.ts +40 -0
  31. package/dist/src/composables/useCoverConditionOverride.d.ts +61 -0
  32. package/dist/src/helpers/business-timezone.d.ts +22 -0
  33. package/dist/src/helpers/permission-set.d.ts +4 -2
  34. package/dist/src/helpers/rule.d.ts +2 -1
  35. package/dist/src/stores/permission-set.d.ts +12 -3
  36. package/dist/src/types/audit-log.d.ts +1 -1
  37. package/dist/src/views/audit-log/event-line.d.ts +13 -0
  38. package/dist/src/views/audit-log/locales/index.d.ts +296 -0
  39. package/dist/src/views/audit-log/snapshot-diff.d.ts +11 -0
  40. package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +1 -0
  41. package/dist/src/views/team/components/BasePermission.vue.d.ts +13 -0
  42. package/dist/src/views/team/condition-builders/ConditionFormHost.vue.d.ts +22 -0
  43. package/dist/src/views/team/condition-builders/ConditionFormRenderer.vue.d.ts +23 -0
  44. package/dist/src/views/team/condition-builders/component-map.d.ts +4 -0
  45. package/dist/src/views/team/condition-builders/condition-form-dedupe.d.ts +23 -0
  46. package/dist/src/views/team/locales/index.d.ts +68 -0
  47. package/dist/style.css +1 -1
  48. package/dist/tsconfig.app.tsbuildinfo +1 -1
  49. package/dist/{useAppStore-BlQSL2ZO.js → useAppStore-CtMoad7V.js} +1 -1
  50. package/dist/useDebounce-B8ZPVS5C.js +15 -0
  51. package/dist/{useLoading-NkUvAr71.js → useLoading-CNqlchYO.js} +1 -1
  52. package/dist/{useReportPermissions-R-eg1L2r.js → useReportPermissions-C5wGC9bf.js} +3 -3
  53. package/package.json +2 -2
  54. package/dist/AuditLogList-BWwgm5wH.js +0 -1145
  55. package/dist/CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js +0 -58
  56. package/dist/EmployeeList-aRGYYmxf.js +0 -851
  57. package/dist/PermissionSetList-BfKgFFUh.js +0 -356
  58. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CNEAlTnY.js +0 -3457
  59. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js +0 -38
  60. package/dist/RoleList-CtcVwAPE.js +0 -566
  61. package/dist/TeamMemberList-DU1jYeql.js +0 -1130
  62. package/dist/rule-O-E9JWJz.js +0 -995
  63. package/dist/useDebounce-CWb5QR9G.js +0 -28
@@ -0,0 +1,1608 @@
1
+ import { defineComponent as St, ref as y, computed as w, onMounted as po, onBeforeUnmount as go, watch as ne, resolveComponent as U, createElementBlock as b, openBlock as g, createBlock as Ce, createCommentVNode as D, createElementVNode as l, Fragment as J, renderList as re, withCtx as B, createVNode as m, toDisplayString as i, unref as d, nextTick as ho, onUnmounted as bo, normalizeClass as yo, createTextVNode as We } from "vue";
2
+ import { d as A } from "./dayjs.min-DUugkgDM.js";
3
+ import { useI18n as wt, useCoreStore as _o } from "@feedmepos/mf-common";
4
+ import { G as ht, _ as xo } from "./app-CJouCBgi.js";
5
+ import { components as _e } from "@feedmepos/ui-library";
6
+ import { g as qe, b as Ge } from "./iteration-QRRNYlps.js";
7
+ import { S as je, _ as Lo } from "./SelectFilter-ATOm0hdn.js";
8
+ import { _ as So } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
9
+ import { _ as wo } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-Ci_MVqGK.js";
10
+ import { t as ko, p as bt } from "./rule-Dy7eMChN.js";
11
+ import { defineStore as Io } from "pinia";
12
+ import { u as Mo } from "./useDebounce-B8ZPVS5C.js";
13
+ const xe = [
14
+ { key: "all", label: "All", subjectPrefixes: [] },
15
+ { key: "inventory", label: "Inventory", subjectPrefixes: ["business::inventory", "inventory"] },
16
+ { key: "report", label: "Report", subjectPrefixes: ["business::report", "report"] },
17
+ { key: "hrm", label: "HRM", subjectPrefixes: ["business::hrm", "hrm"] },
18
+ { key: "payment", label: "Payment", subjectPrefixes: ["business::payment", "payment"] },
19
+ { key: "menu", label: "Menu", subjectPrefixes: ["business::menu", "menu"] },
20
+ { key: "crm", label: "CRM", subjectPrefixes: ["business::crm", "crm"] }
21
+ // Add more as modules are revamped with new actionguard:
22
+ // { key: 'restaurantOperation', label: 'Restaurant Operation', subjectPrefixes: ['restaurant'] },
23
+ ], Xe = "/audit-logs", Te = {
24
+ async count(t) {
25
+ var u, _, c, f, a, I, S;
26
+ const o = {
27
+ ...t != null && t.from ? { from: t.from } : {},
28
+ ...t != null && t.to ? { to: t.to } : {},
29
+ ...(u = t == null ? void 0 : t.userIds) != null && u.length ? { userIds: t.userIds } : {},
30
+ ...(_ = t == null ? void 0 : t.subjects) != null && _.length ? { subjects: t.subjects } : {},
31
+ ...(c = t == null ? void 0 : t.subjectPrefixes) != null && c.length ? { subjectPrefixes: t.subjectPrefixes } : {},
32
+ ...(f = t == null ? void 0 : t.actions) != null && f.length ? { actions: t.actions } : {},
33
+ ...(a = t == null ? void 0 : t.outcomes) != null && a.length ? { outcomes: t.outcomes } : {},
34
+ ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
35
+ ...t != null && t.search ? { search: t.search } : {},
36
+ ...(I = t == null ? void 0 : t.searchUserIds) != null && I.length ? { searchUserIds: t.searchUserIds } : {},
37
+ ...(S = t == null ? void 0 : t.searchSubjects) != null && S.length ? { searchSubjects: t.searchSubjects } : {}
38
+ };
39
+ return (await qe(
40
+ await Ge().get(`${Xe}/count`, {
41
+ params: o,
42
+ paramsSerializer: (x) => {
43
+ const F = new URLSearchParams();
44
+ for (const [T, j] of Object.entries(x))
45
+ if (Array.isArray(j))
46
+ for (const ee of j) F.append(T, String(ee));
47
+ else j != null && F.append(T, String(j));
48
+ return F.toString();
49
+ }
50
+ })
51
+ )).total;
52
+ },
53
+ async read(t) {
54
+ var n, u, _, c, f, a, I;
55
+ const o = {
56
+ limit: (t == null ? void 0 : t.limit) ?? 100,
57
+ offset: (t == null ? void 0 : t.offset) ?? 0,
58
+ ...t != null && t.from ? { from: t.from } : {},
59
+ ...t != null && t.to ? { to: t.to } : {},
60
+ ...(n = t == null ? void 0 : t.userIds) != null && n.length ? { userIds: t.userIds } : {},
61
+ ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
62
+ ...(u = t == null ? void 0 : t.subjects) != null && u.length ? { subjects: t.subjects } : {},
63
+ ...(_ = t == null ? void 0 : t.subjectPrefixes) != null && _.length ? { subjectPrefixes: t.subjectPrefixes } : {},
64
+ ...(c = t == null ? void 0 : t.actions) != null && c.length ? { actions: t.actions } : {},
65
+ ...(f = t == null ? void 0 : t.outcomes) != null && f.length ? { outcomes: t.outcomes } : {},
66
+ ...t != null && t.search ? { search: t.search } : {},
67
+ ...(a = t == null ? void 0 : t.searchUserIds) != null && a.length ? { searchUserIds: t.searchUserIds } : {},
68
+ ...(I = t == null ? void 0 : t.searchSubjects) != null && I.length ? { searchSubjects: t.searchSubjects } : {}
69
+ };
70
+ return qe(
71
+ await Ge().get(Xe, {
72
+ params: o,
73
+ // Serialize arrays as repeated params: key=val1&key=val2
74
+ // (NestJS @Query expects this; axios default adds brackets which break matching)
75
+ paramsSerializer: (S) => {
76
+ const x = new URLSearchParams();
77
+ for (const [F, T] of Object.entries(S))
78
+ if (Array.isArray(T))
79
+ for (const j of T) x.append(F, String(j));
80
+ else T != null && x.append(F, String(T));
81
+ return x.toString();
82
+ }
83
+ })
84
+ );
85
+ },
86
+ /**
87
+ * FeedMe-admin options for the User filter. `actors` is the named admin list (internal
88
+ * viewers only; empty for merchants). `showFeedmeAdminFilter` indicates whether to offer
89
+ * the "FeedMe Admin" catch-all (only when the business has relevant admin activity).
90
+ */
91
+ async getFeedmeAdminFilter(t) {
92
+ const o = {
93
+ ...t != null && t.from ? { from: t.from } : {},
94
+ ...t != null && t.to ? { to: t.to } : {}
95
+ };
96
+ return qe(
97
+ await Ge().get(`${Xe}/actors`, { params: o })
98
+ );
99
+ }
100
+ }, Oo = { class: "flex h-[46px] items-center gap-8 rounded-sm px-16 hover:bg-fm-color-opacity-sm" }, Ao = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Fo = {
101
+ "data-more-measure": "",
102
+ class: "flex h-[46px] items-center gap-8 rounded-sm px-16"
103
+ }, Do = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, jo = /* @__PURE__ */ St({
104
+ __name: "AuditLogModuleTabs",
105
+ props: {
106
+ modelValue: {},
107
+ items: {}
108
+ },
109
+ emits: ["update:modelValue"],
110
+ setup(t, { emit: o }) {
111
+ const n = t, u = o, { t: _ } = wt(), c = y(!1), f = y(null), a = y(null), I = y([]), S = y(0), x = y(0);
112
+ let F = null;
113
+ async function T() {
114
+ if (await ho(), !a.value) return;
115
+ const O = a.value.querySelectorAll("[data-tab-measure]");
116
+ I.value = Array.from(O).map((V) => V.offsetWidth);
117
+ const M = a.value.querySelector("[data-more-measure]");
118
+ S.value = (M == null ? void 0 : M.offsetWidth) ?? 0;
119
+ }
120
+ const j = w(() => {
121
+ const O = n.items.length;
122
+ if (O === 0) return 0;
123
+ if (!x.value || I.value.length !== O) return O;
124
+ const M = I.value;
125
+ if (M.reduce((L, ie) => L + ie, 0) <= x.value) return O;
126
+ const P = S.value;
127
+ let W = 0, Y = 0;
128
+ for (let L = 0; L < O && !(W + M[L] + P > x.value); L++)
129
+ W += M[L], Y++;
130
+ return Y;
131
+ }), ee = w(() => {
132
+ const O = j.value, M = n.items.length;
133
+ if (O >= M) return [...n.items];
134
+ const V = n.items.slice(0, O), P = n.items.find(($) => $.value === n.modelValue);
135
+ if (!P || V.some(($) => $.value === P.value)) return V;
136
+ if (O === 0) return [P];
137
+ const W = n.items.findIndex(($) => $.value === P.value), Y = I.value, L = S.value, ie = Y[W] ?? 0;
138
+ let te = O, se = Y.slice(0, te - 1).reduce(($, ue) => $ + ue, 0);
139
+ for (; te > 1 && se + ie + L > x.value; )
140
+ te--, se = Y.slice(0, te - 1).reduce(($, ue) => $ + ue, 0);
141
+ return [...n.items.slice(0, Math.max(te - 1, 0)), P];
142
+ }), pe = w(() => {
143
+ const O = new Set(ee.value.map((M) => M.value));
144
+ return n.items.filter((M) => !O.has(M.value));
145
+ });
146
+ function ge(O) {
147
+ c.value = !1, u("update:modelValue", O);
148
+ }
149
+ return po(async () => {
150
+ await T(), f.value && (x.value = f.value.clientWidth, F = new ResizeObserver(() => {
151
+ f.value && (x.value = f.value.clientWidth);
152
+ }), F.observe(f.value));
153
+ }), go(() => {
154
+ F == null || F.disconnect(), F = null;
155
+ }), ne(
156
+ () => n.items,
157
+ () => {
158
+ T();
159
+ },
160
+ { deep: !0 }
161
+ ), (O, M) => {
162
+ const V = U("FmTab"), P = U("FmIcon"), W = U("FmMenuItem"), Y = U("FmMenu");
163
+ return g(), b("div", {
164
+ ref_key: "containerRef",
165
+ ref: f,
166
+ class: "relative flex w-full flex-row items-center"
167
+ }, [
168
+ (g(!0), b(J, null, re(ee.value, (L) => (g(), Ce(V, {
169
+ key: L.value,
170
+ "model-value": t.modelValue,
171
+ label: L.label,
172
+ badge: L.badge,
173
+ disabled: L.disabled,
174
+ value: L.value,
175
+ "onUpdate:modelValue": ge
176
+ }, null, 8, ["model-value", "label", "badge", "disabled", "value"]))), 128)),
177
+ pe.value.length > 0 ? (g(), Ce(Y, {
178
+ key: 0,
179
+ "show-menu": c.value,
180
+ class: "max-w-[360px] min-w-[90px] rounded-sm",
181
+ placement: "bottom-start",
182
+ onMenuChanged: M[0] || (M[0] = (L) => c.value = L)
183
+ }, {
184
+ "menu-button": B(() => [
185
+ l("div", Oo, [
186
+ m(P, { name: "more_vert" }),
187
+ l("span", Ao, i(d(_)("auditLog.modules.more")), 1)
188
+ ])
189
+ ]),
190
+ default: B(() => [
191
+ (g(!0), b(J, null, re(pe.value, (L) => (g(), Ce(W, {
192
+ key: L.value,
193
+ "model-value": t.modelValue === L.value,
194
+ label: L.label,
195
+ disabled: L.disabled,
196
+ onClick: (ie) => ge(L.value)
197
+ }, null, 8, ["model-value", "label", "disabled", "onClick"]))), 128))
198
+ ]),
199
+ _: 1
200
+ }, 8, ["show-menu"])) : D("", !0),
201
+ l("div", {
202
+ ref_key: "measurerRef",
203
+ ref: a,
204
+ "aria-hidden": "true",
205
+ class: "pointer-events-none invisible absolute -left-[9999px] -top-[9999px] flex flex-row items-center"
206
+ }, [
207
+ (g(!0), b(J, null, re(t.items, (L) => (g(), b("div", {
208
+ key: `measure-${L.value}`,
209
+ "data-tab-measure": ""
210
+ }, [
211
+ m(V, {
212
+ "model-value": t.modelValue,
213
+ label: L.label,
214
+ badge: L.badge,
215
+ disabled: L.disabled,
216
+ value: L.value
217
+ }, null, 8, ["model-value", "label", "badge", "disabled", "value"])
218
+ ]))), 128)),
219
+ l("div", Fo, [
220
+ m(P, { name: "more_vert" }),
221
+ l("span", Do, i(d(_)("auditLog.modules.more")), 1)
222
+ ])
223
+ ], 512)
224
+ ], 512);
225
+ };
226
+ }
227
+ }), To = Io("team", () => {
228
+ const t = y([]), o = y(!1), n = y(!1), u = w(
229
+ () => Object.fromEntries(t.value.map((a) => [a.doc.userId, a.name]))
230
+ ), _ = w(
231
+ () => Object.fromEntries(t.value.map((a) => [a.doc.userId, a.email]))
232
+ ), c = w(
233
+ () => Object.fromEntries(t.value.map((a) => [a.doc.userId, a.phoneNumber]))
234
+ );
235
+ async function f({ force: a = !1 } = {}) {
236
+ if (!(!a && t.value.length > 0))
237
+ try {
238
+ o.value = !0;
239
+ const I = await ko.readTeamMembers();
240
+ t.value = I.sort((S, x) => S.doc.isOwner ? -1 : S.name.localeCompare(x.name)), n.value = !0;
241
+ } finally {
242
+ o.value = !1;
243
+ }
244
+ }
245
+ return {
246
+ members: t,
247
+ isLoading: o,
248
+ hasLoaded: n,
249
+ userIdToName: u,
250
+ userIdToEmail: _,
251
+ userIdToPhone: c,
252
+ readTeamMembers: f
253
+ };
254
+ });
255
+ function Po(t) {
256
+ const o = t.indexOf(".");
257
+ return o <= 0 || o === t.length - 1 ? null : { entity: t.slice(0, o), verb: t.slice(o + 1) };
258
+ }
259
+ function yt(t) {
260
+ const o = t.split("-").join(" ");
261
+ return o.charAt(0).toUpperCase() + o.slice(1);
262
+ }
263
+ function Co(t, o, n) {
264
+ const u = t(o, n);
265
+ return u === o ? null : u;
266
+ }
267
+ function _t(t, o) {
268
+ const { eventKey: n, params: u, operationLabel: _ } = o;
269
+ if (n) {
270
+ const c = Co(t, `auditLog.event.sentence.${n}`, u);
271
+ if (c) return c;
272
+ const f = Po(n);
273
+ if (f) {
274
+ const a = `${yt(f.verb)} ${yt(f.entity)}`, I = (u == null ? void 0 : u.label) ?? (u == null ? void 0 : u.name);
275
+ return I !== void 0 && I !== "" ? `${a} — ${I}` : a;
276
+ }
277
+ }
278
+ return _ ?? "";
279
+ }
280
+ function ve(t) {
281
+ return typeof t == "object" && t !== null && !Array.isArray(t);
282
+ }
283
+ function Se(t) {
284
+ return Array.isArray(t);
285
+ }
286
+ function Ve(t) {
287
+ if (t === null) return "null";
288
+ if (typeof t == "object")
289
+ try {
290
+ return JSON.stringify(t);
291
+ } catch {
292
+ return String(t);
293
+ }
294
+ return String(t);
295
+ }
296
+ function Vo(t, o) {
297
+ return t ? `${t}.${o}` : o;
298
+ }
299
+ function xt(t) {
300
+ if (typeof t != "string") return { ok: !1, value: void 0 };
301
+ const o = t.trim();
302
+ if (!o.startsWith("{") && !o.startsWith("[")) return { ok: !1, value: void 0 };
303
+ try {
304
+ const n = JSON.parse(o);
305
+ return ve(n) || Se(n) ? { ok: !0, value: n } : { ok: !1, value: void 0 };
306
+ } catch {
307
+ return { ok: !1, value: void 0 };
308
+ }
309
+ }
310
+ const Eo = ["_id", "id", "subject", "key", "roleId", "name"];
311
+ function Ro(t, o) {
312
+ if (t.length === 0 || o.length === 0) return null;
313
+ const n = (u, _) => u.every((c) => ve(c) && c[_] !== void 0);
314
+ for (const u of Eo)
315
+ if (n(t, u) && n(o, u)) return u;
316
+ return null;
317
+ }
318
+ function Uo(t, o, n) {
319
+ n.push({ path: t, type: "added", before: null, after: Ve(o) });
320
+ }
321
+ function $o(t, o, n) {
322
+ n.push({ path: t, type: "removed", before: Ve(o), after: null });
323
+ }
324
+ function No(t, o, n, u) {
325
+ const _ = /* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(n)]);
326
+ for (const c of _) {
327
+ const f = Object.prototype.hasOwnProperty.call(o, c), a = Object.prototype.hasOwnProperty.call(n, c);
328
+ we(Vo(t, c), o[c], f, n[c], a, u);
329
+ }
330
+ }
331
+ function Ko(t, o, n, u) {
332
+ const _ = Ro(o, n);
333
+ if (_) {
334
+ const f = new Map(
335
+ o.map((S) => [S[_], S])
336
+ ), a = new Map(
337
+ n.map((S) => [S[_], S])
338
+ ), I = /* @__PURE__ */ new Set([...f.keys(), ...a.keys()]);
339
+ for (const S of I) {
340
+ const x = f.has(S), F = a.has(S), T = `${t}[${String(S)}]`;
341
+ we(T, f.get(S), x, a.get(S), F, u);
342
+ }
343
+ return;
344
+ }
345
+ const c = Math.max(o.length, n.length);
346
+ for (let f = 0; f < c; f++) {
347
+ const a = f < o.length, I = f < n.length, S = `${t}[${f}]`;
348
+ we(S, o[f], a, n[f], I, u);
349
+ }
350
+ }
351
+ function we(t, o, n, u, _, c) {
352
+ if (!n && !_) return;
353
+ if (n && !_) {
354
+ $o(t, o, c);
355
+ return;
356
+ }
357
+ if (!n && _) {
358
+ Uo(t, u, c);
359
+ return;
360
+ }
361
+ if (JSON.stringify(o) === JSON.stringify(u)) return;
362
+ if (ve(o) && ve(u)) {
363
+ No(t, o, u, c);
364
+ return;
365
+ }
366
+ if (Se(o) && Se(u)) {
367
+ Ko(t, o, u, c);
368
+ return;
369
+ }
370
+ const f = xt(o), a = xt(u);
371
+ if (f.ok && a.ok) {
372
+ we(t, f.value, !0, a.value, !0, c);
373
+ return;
374
+ }
375
+ c.push({
376
+ path: t,
377
+ type: "changed",
378
+ before: Ve(o),
379
+ after: Ve(u)
380
+ });
381
+ }
382
+ function Bo(t, o) {
383
+ if (JSON.stringify(t) === JSON.stringify(o)) return [];
384
+ const n = t == null, u = o == null;
385
+ let _ = t;
386
+ n && (ve(o) ? _ = {} : Se(o) && (_ = []));
387
+ let c = o;
388
+ u && (ve(t) ? c = {} : Se(t) && (c = []));
389
+ const f = [];
390
+ return we("", _, !0, c, !0, f), f;
391
+ }
392
+ const Yo = {
393
+ class: "flex flex-col gap-4 p-12 w-[260px]"
394
+ }, zo = {
395
+ class: "text-xs font-semibold text-fm-color-typo-secondary mb-4"
396
+ }, Ho = {
397
+ class: "flex min-h-0 flex-1 flex-col gap-16"
398
+ }, Jo = {
399
+ class: "space-y-16"
400
+ }, Wo = {
401
+ class: "flex flex-wrap items-center gap-8"
402
+ }, qo = {
403
+ class: "w-fit"
404
+ }, Go = {
405
+ class: "w-fit"
406
+ }, Xo = {
407
+ class: "w-fit"
408
+ }, Qo = {
409
+ class: "w-fit"
410
+ }, Zo = {
411
+ class: "flex h-full flex-col overflow-auto"
412
+ }, es = {
413
+ key: 0,
414
+ class: "space-y-12 p-4 text-sm"
415
+ }, ts = {
416
+ class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
417
+ }, os = {
418
+ class: "min-w-0 flex-1"
419
+ }, ss = {
420
+ class: "audit-log-operation-label-detail text-base font-bold leading-snug text-fm-color-typo-primary"
421
+ }, ls = {
422
+ class: "rounded-lg border border-fm-color-border-default p-12"
423
+ }, as = {
424
+ class: "space-y-12"
425
+ }, ns = {
426
+ class: "text-xs text-fm-color-typo-secondary"
427
+ }, rs = {
428
+ class: "font-semibold"
429
+ }, is = {
430
+ class: "text-xs text-fm-color-typo-secondary"
431
+ }, us = {
432
+ class: "font-semibold"
433
+ }, ds = {
434
+ class: "text-xs text-fm-color-typo-secondary"
435
+ }, cs = {
436
+ class: "break-all font-semibold"
437
+ }, fs = {
438
+ key: 0
439
+ }, ms = {
440
+ class: "text-xs text-fm-color-typo-secondary"
441
+ }, vs = {
442
+ class: "break-all font-mono text-xs font-semibold"
443
+ }, ps = {
444
+ class: "text-xs text-fm-color-typo-secondary"
445
+ }, gs = {
446
+ class: "break-all font-mono text-xs font-semibold"
447
+ }, hs = {
448
+ class: "text-xs text-fm-color-typo-secondary"
449
+ }, bs = {
450
+ class: "font-semibold"
451
+ }, ys = {
452
+ class: "rounded-lg border border-fm-color-border-default"
453
+ }, _s = {
454
+ class: "p-12"
455
+ }, xs = {
456
+ class: "text-base font-bold text-fm-color-typo-primary"
457
+ }, Ls = {
458
+ class: "space-y-12 p-12"
459
+ }, Ss = {
460
+ class: "text-xs text-fm-color-typo-secondary"
461
+ }, ws = {
462
+ class: "font-semibold"
463
+ }, ks = {
464
+ class: "rounded-lg border border-fm-color-border-default"
465
+ }, Is = {
466
+ class: "p-12"
467
+ }, Ms = {
468
+ class: "text-base font-bold text-fm-color-typo-primary"
469
+ }, Os = {
470
+ class: "space-y-12 p-12"
471
+ }, As = {
472
+ class: "text-xs text-fm-color-typo-secondary"
473
+ }, Fs = {
474
+ class: "font-semibold"
475
+ }, Ds = {
476
+ key: 0
477
+ }, js = {
478
+ class: "text-xs text-fm-color-typo-secondary"
479
+ }, Ts = {
480
+ key: 0,
481
+ class: "font-semibold"
482
+ }, Ps = {
483
+ key: 1,
484
+ class: "break-all font-mono text-xs text-fm-color-typo-secondary"
485
+ }, Cs = {
486
+ key: 1
487
+ }, Vs = {
488
+ class: "text-xs text-fm-color-typo-secondary"
489
+ }, Es = {
490
+ class: "font-semibold whitespace-pre-line"
491
+ }, Rs = {
492
+ class: "text-xs text-fm-color-typo-secondary"
493
+ }, Us = {
494
+ class: "font-semibold"
495
+ }, $s = {
496
+ class: "text-xs text-fm-color-typo-secondary"
497
+ }, Ns = {
498
+ class: "break-all font-mono text-xs font-semibold"
499
+ }, Ks = {
500
+ key: 2
501
+ }, Bs = {
502
+ class: "text-xs text-fm-color-typo-secondary"
503
+ }, Ys = {
504
+ class: "mt-4 space-y-4"
505
+ }, zs = {
506
+ class: "flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-fm-color-primary-default text-xs font-bold text-white"
507
+ }, Hs = {
508
+ class: "text-xs font-semibold"
509
+ }, Js = {
510
+ key: 0,
511
+ class: "text-fm-color-typo-secondary"
512
+ }, Ws = {
513
+ key: 3
514
+ }, qs = {
515
+ class: "text-xs text-fm-color-typo-secondary"
516
+ }, Gs = {
517
+ class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
518
+ }, Xs = {
519
+ key: 0,
520
+ class: "space-y-12 p-4 text-sm"
521
+ }, Qs = {
522
+ class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
523
+ }, Zs = {
524
+ class: "min-w-0 flex-1"
525
+ }, el = {
526
+ class: "text-base font-bold leading-snug text-fm-color-typo-primary"
527
+ }, tl = {
528
+ key: 0,
529
+ class: "text-xs text-fm-color-typo-secondary"
530
+ }, ol = {
531
+ class: "rounded-lg border border-fm-color-border-default p-12"
532
+ }, sl = {
533
+ class: "space-y-12"
534
+ }, ll = {
535
+ class: "text-xs text-fm-color-typo-secondary"
536
+ }, al = {
537
+ class: "font-semibold"
538
+ }, nl = {
539
+ key: 0
540
+ }, rl = {
541
+ class: "text-xs text-fm-color-typo-secondary"
542
+ }, il = {
543
+ class: "font-semibold"
544
+ }, ul = {
545
+ key: 1
546
+ }, dl = {
547
+ class: "text-xs text-fm-color-typo-secondary"
548
+ }, cl = {
549
+ class: "font-semibold"
550
+ }, fl = {
551
+ key: 0,
552
+ class: "rounded-lg border border-fm-color-border-default p-12"
553
+ }, ml = {
554
+ class: "text-xs text-fm-color-typo-secondary"
555
+ }, vl = {
556
+ class: "whitespace-pre-line font-semibold text-fm-color-typo-error"
557
+ }, pl = {
558
+ class: "rounded-lg border border-fm-color-border-default"
559
+ }, gl = {
560
+ class: "p-12"
561
+ }, hl = {
562
+ class: "text-base font-bold text-fm-color-typo-primary"
563
+ }, bl = {
564
+ class: "p-12"
565
+ }, yl = {
566
+ key: 0,
567
+ class: "divide-y divide-fm-color-border-default"
568
+ }, _l = {
569
+ class: "flex flex-wrap items-center gap-8"
570
+ }, xl = {
571
+ class: "break-all font-mono text-xs"
572
+ }, Ll = {
573
+ class: "space-y-4"
574
+ }, Sl = {
575
+ key: 0,
576
+ class: "text-fm-color-typo-success"
577
+ }, wl = {
578
+ key: 1,
579
+ class: "text-fm-color-typo-error"
580
+ }, kl = {
581
+ class: "text-fm-color-typo-error"
582
+ }, Il = {
583
+ class: "text-fm-color-typo-success"
584
+ }, Ml = {
585
+ key: 1,
586
+ class: "text-fm-color-typo-secondary"
587
+ }, Ol = {
588
+ key: 1,
589
+ class: "rounded-lg border border-fm-color-border-default"
590
+ }, Al = {
591
+ class: "text-base font-bold text-fm-color-typo-primary"
592
+ }, Fl = {
593
+ class: "space-y-12 p-12"
594
+ }, Dl = {
595
+ key: 0
596
+ }, jl = {
597
+ class: "text-xs text-fm-color-typo-secondary"
598
+ }, Tl = {
599
+ class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
600
+ }, Pl = {
601
+ key: 1
602
+ }, Cl = {
603
+ class: "text-xs text-fm-color-typo-secondary"
604
+ }, Vl = {
605
+ class: "mt-4 max-h-[400px] overflow-auto rounded bg-gray-100 p-8 font-mono text-xs leading-relaxed shadow-inner whitespace-pre-wrap break-all"
606
+ }, Le = 100, Qe = 1e3, Pe = "__feedmeAdmin__", El = "D MMM YYYY h:mm A", Rl = "YYYY-MM-DD HH:mm", R = "YYYY-MM-DD", Lt = "audit-log-export-fields", Ul = /* @__PURE__ */ St({
607
+ __name: "AuditLogList",
608
+ setup(t) {
609
+ const {
610
+ t: o
611
+ } = wt(), n = _o(), u = To(), _ = y(!1), c = y(!1), f = y([]), a = y(null), I = y(!1), S = y({}), x = y(null), F = y(!1);
612
+ async function T(e) {
613
+ const s = Uint8Array.from(atob(e), (p) => p.charCodeAt(0)), r = new DecompressionStream("gzip"), v = r.writable.getWriter();
614
+ return await v.write(s), await v.close(), new Response(r.readable).text();
615
+ }
616
+ const j = y("");
617
+ let ee = 0;
618
+ ne(() => {
619
+ var e, s;
620
+ return (s = (e = a.value) == null ? void 0 : e.metadata) == null ? void 0 : s.requestBody;
621
+ }, async (e) => {
622
+ const s = ++ee;
623
+ if (!e) {
624
+ j.value = "";
625
+ return;
626
+ }
627
+ if (typeof e == "object") {
628
+ j.value = JSON.stringify(e, null, 2);
629
+ return;
630
+ }
631
+ if (e.startsWith("gzip:")) {
632
+ try {
633
+ const r = await T(e.slice(5));
634
+ if (s !== ee) return;
635
+ j.value = JSON.stringify(JSON.parse(r), null, 2);
636
+ } catch {
637
+ if (s !== ee) return;
638
+ j.value = e;
639
+ }
640
+ return;
641
+ }
642
+ try {
643
+ j.value = JSON.stringify(JSON.parse(e), null, 2);
644
+ } catch {
645
+ j.value = e;
646
+ }
647
+ }, {
648
+ immediate: !0
649
+ });
650
+ async function pe(e) {
651
+ if (!e) return;
652
+ let s = e;
653
+ if (e.startsWith("gzip:"))
654
+ try {
655
+ s = await T(e.slice(5));
656
+ } catch {
657
+ return e;
658
+ }
659
+ try {
660
+ return JSON.parse(s);
661
+ } catch {
662
+ return s;
663
+ }
664
+ }
665
+ function ge(e) {
666
+ if (e === void 0) return "";
667
+ if (typeof e == "object" && e !== null)
668
+ try {
669
+ return JSON.stringify(e, null, 2);
670
+ } catch {
671
+ return String(e);
672
+ }
673
+ return String(e);
674
+ }
675
+ const O = y([]), M = y(""), V = y(""), P = y(!1);
676
+ let W = 0;
677
+ ne(x, async (e) => {
678
+ const s = ++W;
679
+ if (O.value = [], M.value = "", V.value = "", P.value = !1, !e) return;
680
+ const [r, v] = await Promise.all([pe(e.before), pe(e.after)]);
681
+ s === W && (O.value = Bo(r, v), M.value = ge(r), V.value = ge(v));
682
+ });
683
+ function Y(e) {
684
+ return e === "added" ? "success" : e === "removed" ? "critical" : "warning";
685
+ }
686
+ function L(e) {
687
+ return o(e === "added" ? "auditLog.operation.added" : e === "removed" ? "auditLog.operation.removed" : "auditLog.operation.updated");
688
+ }
689
+ function ie(e) {
690
+ return e.replace(/\[[^\]]*\]/g, "");
691
+ }
692
+ const te = w(() => {
693
+ const e = [], s = /* @__PURE__ */ new Map();
694
+ for (const r of O.value) {
695
+ const v = ie(r.path), p = `${r.type}::${v}`;
696
+ let k = s.get(p);
697
+ k || (k = {
698
+ groupKey: p,
699
+ displayKey: v,
700
+ type: r.type,
701
+ rows: []
702
+ }, s.set(p, k), e.push(k)), k.rows.push(r);
703
+ }
704
+ return e;
705
+ }), se = y(1), Ze = y(!1), $ = y(0), ue = w(() => Math.max(1, Math.ceil($.value / Le))), et = A().format("YYYY-MM-DD"), q = y({
706
+ startDate: `${et} 00:00`,
707
+ endDate: `${et} 23:59`
708
+ }), de = y(), z = y(), G = y(), X = y(), le = y("all");
709
+ function kt(e) {
710
+ return typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((s) => typeof s == "string") : [];
711
+ }
712
+ const tt = xe.filter((e) => e.key !== "all").map((e) => e.key);
713
+ function ke(e) {
714
+ const s = xe.find((r) => r.key !== "all" && r.subjectPrefixes.some((v) => e.startsWith(v)));
715
+ return (s == null ? void 0 : s.key) ?? "other";
716
+ }
717
+ function ot(e) {
718
+ const s = tt.indexOf(e);
719
+ return s === -1 ? tt.length : s;
720
+ }
721
+ const It = w(() => xe.map(({
722
+ key: e
723
+ }) => ({
724
+ label: o(`auditLog.modules.${e}`),
725
+ value: e
726
+ }))), Ee = w(() => xe.find((e) => e.key === le.value) ?? xe[0]), Mt = w(() => le.value === "all"), he = y([]), Ie = y(!1), Ot = w(() => [...Ie.value ? [{
727
+ label: o("auditLog.user.feedmeAdmin"),
728
+ value: Pe
729
+ }] : [], ...u.members.map((e) => ({
730
+ label: e.name,
731
+ value: e.doc.userId
732
+ })), ...he.value.map((e) => ({
733
+ label: `${e.name} (${o("auditLog.user.feedmeAdmin")})`,
734
+ value: e.userId
735
+ }))]), Q = w(() => {
736
+ const e = de.value ?? [];
737
+ return {
738
+ userIds: e.filter((s) => s !== Pe),
739
+ feedmeAdminActors: e.includes(Pe)
740
+ };
741
+ }), Re = y(""), H = y(""), At = Mo(Re, (e) => {
742
+ H.value = e.trim();
743
+ });
744
+ bo(At);
745
+ const ce = w(() => {
746
+ const e = H.value.toLowerCase();
747
+ if (!e) return [];
748
+ const s = /* @__PURE__ */ new Set();
749
+ for (const r of u.members) {
750
+ const v = r.doc.userId;
751
+ ((u.userIdToName[v] ?? "").toLowerCase().includes(e) || (u.userIdToEmail[v] ?? "").toLowerCase().includes(e) || (u.userIdToPhone[v] ?? "").toLowerCase().includes(e)) && s.add(v);
752
+ }
753
+ for (const r of he.value)
754
+ r.name.toLowerCase().includes(e) && s.add(r.userId);
755
+ return [...s];
756
+ }), Ue = w(() => {
757
+ const e = bt.flatMap((p) => kt(p.subject).map((k) => ({
758
+ label: p.label,
759
+ value: k
760
+ }))), s = Object.entries(ht).map(([p, k]) => ({
761
+ label: k,
762
+ value: p
763
+ })), r = /* @__PURE__ */ new Set(), v = [];
764
+ for (const p of [...e, ...s])
765
+ if (!r.has(p.value)) {
766
+ r.add(p.value);
767
+ const k = ke(p.value);
768
+ v.push({
769
+ ...p,
770
+ group: o(`auditLog.modules.${k}`)
771
+ });
772
+ }
773
+ return v.sort((p, k) => ot(ke(p.value)) - ot(ke(k.value)));
774
+ }), fe = w(() => {
775
+ const e = H.value.toLowerCase();
776
+ if (!e) return [];
777
+ const s = /* @__PURE__ */ new Set();
778
+ for (const r of Ue.value)
779
+ r.label.toLowerCase().includes(e) && s.add(r.value);
780
+ return [...s];
781
+ }), Ft = w(() => Mt.value ? Ue.value : Ue.value.filter((e) => ke(e.value) === le.value));
782
+ function Dt(e, s) {
783
+ const r = s.toLowerCase();
784
+ return e.label.toLowerCase().includes(r) || e.value.replace(/^business::/, "").toLowerCase().includes(r) ? !0 : e.value.toLowerCase().includes(r);
785
+ }
786
+ const K = w(() => ({
787
+ manage: o("auditLog.action.manage"),
788
+ create: o("auditLog.action.create"),
789
+ read: o("auditLog.action.read"),
790
+ update: o("auditLog.action.update"),
791
+ delete: o("auditLog.action.delete")
792
+ })), jt = w(() => [{
793
+ label: K.value.manage,
794
+ value: "manage"
795
+ }, {
796
+ label: K.value.create,
797
+ value: "create"
798
+ }, {
799
+ label: K.value.read,
800
+ value: "read"
801
+ }, {
802
+ label: K.value.update,
803
+ value: "update"
804
+ }, {
805
+ label: K.value.delete,
806
+ value: "delete"
807
+ }]), Me = w(() => ({
808
+ allowed: o("auditLog.outcome.success"),
809
+ denied: o("auditLog.outcome.failed"),
810
+ skipped: o("auditLog.outcome.skipped")
811
+ })), $e = w(() => {
812
+ var e;
813
+ return ((e = n.sessionUser.value) == null ? void 0 : e.isInternal) ?? !1;
814
+ });
815
+ function st(e) {
816
+ return !$e.value && e === "skipped" ? "allowed" : e;
817
+ }
818
+ function Ne(e) {
819
+ return !(e != null && e.length) || $e.value ? e : e.includes("allowed") ? [.../* @__PURE__ */ new Set([...e, "skipped"])] : e;
820
+ }
821
+ const Tt = w(() => [{
822
+ label: Me.value.allowed,
823
+ value: "allowed"
824
+ }, {
825
+ label: Me.value.denied,
826
+ value: "denied"
827
+ }, ...$e.value ? [{
828
+ label: Me.value.skipped,
829
+ value: "skipped"
830
+ }] : []]), Pt = w(() => ({
831
+ admin: o("auditLog.detail.resolvedFromValue.admin"),
832
+ staff: o("auditLog.detail.resolvedFromValue.staff"),
833
+ permissionSet: o("auditLog.detail.resolvedFromValue.permissionSet"),
834
+ systemPermissionSet: o("auditLog.detail.resolvedFromValue.systemPermissionSet"),
835
+ custom: o("auditLog.detail.resolvedFromValue.custom"),
836
+ "no-match": o("auditLog.detail.resolvedFromValue.noMatch"),
837
+ unknown: o("auditLog.detail.resolvedFromValue.unknown")
838
+ })), Ct = w(() => ({
839
+ GET: K.value.read,
840
+ POST: K.value.create,
841
+ PUT: K.value.update,
842
+ PATCH: K.value.update,
843
+ DELETE: K.value.delete
844
+ })), Vt = {
845
+ allowed: "success",
846
+ denied: "critical",
847
+ skipped: "warning"
848
+ };
849
+ function Oe(e) {
850
+ return A(e).format(El);
851
+ }
852
+ const Et = w(() => {
853
+ const {
854
+ startDate: e,
855
+ endDate: s
856
+ } = q.value;
857
+ return e && s ? `${Oe(e)} – ${Oe(s)}` : e ? Oe(e) : s ? Oe(s) : o("auditLog.dateRange.placeholder");
858
+ }), Rt = w(() => [{
859
+ label: o("date.predefinedRanges.today"),
860
+ value: {
861
+ startDate: A().format(R),
862
+ endDate: A().format(R)
863
+ }
864
+ }, {
865
+ label: o("date.predefinedRanges.yesterday"),
866
+ value: {
867
+ startDate: A().subtract(1, "day").format(R),
868
+ endDate: A().subtract(1, "day").format(R)
869
+ }
870
+ }, {
871
+ label: o("date.predefinedRanges.thisWeek"),
872
+ value: {
873
+ startDate: A().startOf("week").format(R),
874
+ endDate: A().endOf("week").format(R)
875
+ }
876
+ }, {
877
+ label: o("date.predefinedRanges.lastWeek"),
878
+ value: {
879
+ startDate: A().subtract(1, "week").startOf("week").format(R),
880
+ endDate: A().subtract(1, "week").endOf("week").format(R)
881
+ }
882
+ }, {
883
+ label: o("date.predefinedRanges.last7Days"),
884
+ value: {
885
+ startDate: A().subtract(7, "day").format(R),
886
+ endDate: A().subtract(1, "day").format(R)
887
+ }
888
+ }, {
889
+ label: o("date.predefinedRanges.thisMonth"),
890
+ value: {
891
+ startDate: A().startOf("month").format(R),
892
+ endDate: A().endOf("month").format(R)
893
+ }
894
+ }, {
895
+ label: o("date.predefinedRanges.lastMonth"),
896
+ value: {
897
+ startDate: A().subtract(1, "month").startOf("month").format(R),
898
+ endDate: A().subtract(1, "month").endOf("month").format(R)
899
+ }
900
+ }]);
901
+ function Ke(e) {
902
+ var s;
903
+ return ((s = bt.find((r) => r.subject === e)) == null ? void 0 : s.label) ?? ht[e];
904
+ }
905
+ function Ae(e) {
906
+ var r;
907
+ const s = u.userIdToName[e.userId];
908
+ return s || (u.hasLoaded ? (r = n.sessionUser.value) != null && r.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin") : e.userId);
909
+ }
910
+ function lt(e) {
911
+ return u.userIdToPhone[e.userId] || "-";
912
+ }
913
+ function Ut(e) {
914
+ return u.userIdToEmail[e.userId] || "-";
915
+ }
916
+ function at(e) {
917
+ return A(e).format("DD MMM YYYY, HH:mm");
918
+ }
919
+ function nt(e) {
920
+ return A(e).format("DD MMM YYYY, HH:mm:ss").toUpperCase();
921
+ }
922
+ function rt(e) {
923
+ return K.value[e] ?? e;
924
+ }
925
+ function it(e) {
926
+ return _t(o, {
927
+ eventKey: e.eventKey,
928
+ params: e.params,
929
+ operationLabel: e.metadata.operationLabel ?? rt(e.action)
930
+ });
931
+ }
932
+ function ut(e) {
933
+ return _t(o, e) || o("auditLog.operation.unlabeled");
934
+ }
935
+ function $t(e) {
936
+ return Ke(e.subject) ?? e.subject;
937
+ }
938
+ function Be(e) {
939
+ return Me.value[st(e)];
940
+ }
941
+ function dt(e) {
942
+ return Vt[st(e)] ?? "neutral";
943
+ }
944
+ function Nt(e) {
945
+ return Pt.value[e] ?? e;
946
+ }
947
+ function Kt(e) {
948
+ return e.metadata.requestMethod ? Ct.value[e.metadata.requestMethod] ?? e.metadata.requestMethod : rt(e.action);
949
+ }
950
+ function ct(e) {
951
+ const s = String(e ?? "");
952
+ return `"${(/^[=+\-@\t\r]/.test(s) ? `'${s}` : s).replace(/"/g, '""')}"`;
953
+ }
954
+ const Ye = [{
955
+ key: "timestamp",
956
+ labelKey: "auditLog.exportFields.timestamp",
957
+ getValue: (e) => at(e.timestamp),
958
+ defaultSelected: !0
959
+ }, {
960
+ key: "userName",
961
+ labelKey: "auditLog.exportFields.userName",
962
+ getValue: (e) => Ae(e),
963
+ defaultSelected: !0
964
+ }, {
965
+ key: "userPhone",
966
+ labelKey: "auditLog.exportFields.userPhone",
967
+ getValue: (e) => lt(e),
968
+ defaultSelected: !0
969
+ }, {
970
+ key: "subject",
971
+ labelKey: "auditLog.exportFields.subject",
972
+ getValue: (e) => Ke(e.subject) ?? e.subject,
973
+ defaultSelected: !0
974
+ }, {
975
+ key: "action",
976
+ labelKey: "auditLog.exportFields.action",
977
+ getValue: (e) => e.action,
978
+ defaultSelected: !0
979
+ }, {
980
+ key: "operation",
981
+ labelKey: "auditLog.exportFields.operation",
982
+ getValue: (e) => it(e),
983
+ defaultSelected: !0
984
+ }, {
985
+ key: "outcome",
986
+ labelKey: "auditLog.exportFields.outcome",
987
+ getValue: (e) => Be(e.outcome),
988
+ defaultSelected: !0
989
+ }, {
990
+ key: "businessId",
991
+ labelKey: "auditLog.exportFields.businessId",
992
+ getValue: (e) => e.businessId,
993
+ defaultSelected: !1
994
+ }, {
995
+ key: "restaurantId",
996
+ labelKey: "auditLog.exportFields.restaurantId",
997
+ getValue: (e) => e.restaurantId,
998
+ defaultSelected: !1
999
+ }, {
1000
+ key: "country",
1001
+ labelKey: "auditLog.exportFields.country",
1002
+ getValue: (e) => e.country,
1003
+ defaultSelected: !1
1004
+ }, {
1005
+ key: "resolvedFrom",
1006
+ labelKey: "auditLog.exportFields.resolvedFrom",
1007
+ getValue: (e) => {
1008
+ var s;
1009
+ return (s = e.metadata) == null ? void 0 : s.resolvedFrom;
1010
+ },
1011
+ defaultSelected: !1
1012
+ }, {
1013
+ key: "requestMethod",
1014
+ labelKey: "auditLog.exportFields.requestMethod",
1015
+ getValue: (e) => {
1016
+ var s;
1017
+ return (s = e.metadata) == null ? void 0 : s.requestMethod;
1018
+ },
1019
+ defaultSelected: !1
1020
+ }, {
1021
+ key: "requestPath",
1022
+ labelKey: "auditLog.exportFields.requestPath",
1023
+ getValue: (e) => {
1024
+ var s;
1025
+ return (s = e.metadata) == null ? void 0 : s.requestPath;
1026
+ },
1027
+ defaultSelected: !1
1028
+ }];
1029
+ function Bt() {
1030
+ try {
1031
+ const e = localStorage.getItem(Lt);
1032
+ if (e) {
1033
+ const s = JSON.parse(e);
1034
+ if (Array.isArray(s) && s.length > 0) return new Set(s);
1035
+ }
1036
+ } catch {
1037
+ }
1038
+ return new Set(Ye.filter((e) => e.defaultSelected).map((e) => e.key));
1039
+ }
1040
+ const me = y(Bt());
1041
+ function Yt(e) {
1042
+ const s = new Set(me.value);
1043
+ if (s.has(e)) {
1044
+ if (s.size <= 1) return;
1045
+ s.delete(e);
1046
+ } else
1047
+ s.add(e);
1048
+ me.value = s;
1049
+ try {
1050
+ localStorage.setItem(Lt, JSON.stringify([...s]));
1051
+ } catch {
1052
+ }
1053
+ }
1054
+ async function zt() {
1055
+ var e, s, r, v, p;
1056
+ if (!c.value) {
1057
+ c.value = !0;
1058
+ try {
1059
+ const {
1060
+ startDate: k,
1061
+ endDate: E
1062
+ } = q.value, Z = Ee.value.subjectPrefixes, Fe = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " "), be = E ? oe(E) : null, De = be && be < Fe ? be : Fe, He = {
1063
+ ...k ? {
1064
+ from: oe(k)
1065
+ } : {},
1066
+ to: De,
1067
+ ...Q.value.userIds.length ? {
1068
+ userIds: Q.value.userIds
1069
+ } : {},
1070
+ ...Q.value.feedmeAdminActors ? {
1071
+ feedmeAdminActors: !0
1072
+ } : {},
1073
+ ...(e = z.value) != null && e.length ? {
1074
+ subjects: z.value
1075
+ } : {},
1076
+ ...Z.length ? {
1077
+ subjectPrefixes: [...Z]
1078
+ } : {},
1079
+ ...(s = X.value) != null && s.length ? {
1080
+ actions: X.value
1081
+ } : {},
1082
+ ...(r = G.value) != null && r.length ? {
1083
+ outcomes: Ne(G.value)
1084
+ } : {},
1085
+ ...H.value ? {
1086
+ search: H.value
1087
+ } : {},
1088
+ ...ce.value.length ? {
1089
+ searchUserIds: ce.value
1090
+ } : {},
1091
+ ...fe.value.length ? {
1092
+ searchSubjects: fe.value
1093
+ } : {}
1094
+ }, h = [];
1095
+ let C = 0;
1096
+ for (; ; ) {
1097
+ const N = await Te.read({
1098
+ ...He,
1099
+ limit: Qe,
1100
+ offset: C
1101
+ });
1102
+ if (h.push(...N), N.length < Qe) break;
1103
+ C += Qe;
1104
+ }
1105
+ const vt = Ye.filter((N) => me.value.has(N.key)), so = vt.map((N) => o(N.labelKey)), lo = h.map((N) => vt.map((vo) => vo.getValue(N) ?? "")), Je = -(/* @__PURE__ */ new Date()).getTimezoneOffset(), ao = Je >= 0 ? "+" : "-", no = String(Math.floor(Math.abs(Je) / 60)).padStart(2, "0"), ro = String(Math.abs(Je) % 60).padStart(2, "0"), io = `UTC${ao}${no}:${ro}`, pt = ((v = n.currentBusiness.value) == null ? void 0 : v.name) || "", uo = [k, E].filter(Boolean).join(" – "), co = [...[[o("auditLog.title")], [`${o("auditLog.frontMatter.date")}: ${uo}`], ...pt ? [[`${o("auditLog.frontMatter.business")}: ${pt}`]] : [], [`${o("auditLog.frontMatter.generatedBy")}: ${A().format("DD MMM YYYY, HH:mm")} (${io})`], []].map((N) => N.map(ct).join(",")), ...[so, ...lo].map((N) => N.map(ct).join(","))].join(`
1106
+ `), fo = `audit-log_${(((p = n.currentBusiness.value) == null ? void 0 : p.name) || "business").replace(/[^a-z0-9_-]+/gi, "_")}_${A().format("YYYYMMDD_HHmmss")}.csv`, mo = new Blob([`\uFEFF${co}`], {
1107
+ type: "text/csv;charset=utf-8;"
1108
+ }), gt = window.URL.createObjectURL(mo), ye = document.createElement("a");
1109
+ ye.href = gt, ye.download = fo, document.body.appendChild(ye), ye.click(), ye.remove(), window.URL.revokeObjectURL(gt);
1110
+ } finally {
1111
+ c.value = !1;
1112
+ }
1113
+ }
1114
+ }
1115
+ function ae(e) {
1116
+ return "status" in e;
1117
+ }
1118
+ function Ht(e) {
1119
+ var r;
1120
+ const s = e.original;
1121
+ return e.depth === 0 && !ae(s) && !!((r = s.operations) != null && r.length);
1122
+ }
1123
+ function Jt(e) {
1124
+ return ae(e) ? void 0 : e.operations;
1125
+ }
1126
+ const Wt = [{
1127
+ accessorKey: "timestamp",
1128
+ header: () => o("auditLog.columns.timestamp"),
1129
+ cell(e) {
1130
+ return at(e.row.original.timestamp);
1131
+ }
1132
+ }, {
1133
+ accessorKey: "userId",
1134
+ header: () => o("auditLog.columns.user"),
1135
+ enableSorting: !1,
1136
+ size: 220,
1137
+ cell(e) {
1138
+ const s = e.row.original;
1139
+ return ae(s) ? null : m("div", {
1140
+ class: "flex items-center gap-8"
1141
+ }, [m(_e.FmAvatar, {
1142
+ name: Ae(s),
1143
+ size: "sm",
1144
+ class: "shrink-0"
1145
+ }, null), m("div", {
1146
+ class: "min-w-0"
1147
+ }, [m("p", {
1148
+ class: "truncate font-semibold"
1149
+ }, [Ae(s)]), m("p", {
1150
+ class: "truncate text-fm-color-typo-secondary"
1151
+ }, [lt(s)])])]);
1152
+ }
1153
+ }, {
1154
+ accessorKey: "subject",
1155
+ header: () => o("auditLog.columns.subject"),
1156
+ cell(e) {
1157
+ const s = e.row.original;
1158
+ return ae(s) ? m("span", {
1159
+ class: "text-fm-color-typo-secondary"
1160
+ }, [o("auditLog.operation.rowHint")]) : Ke(s.subject) ?? s.subject;
1161
+ }
1162
+ }, {
1163
+ accessorKey: "action",
1164
+ header: () => o("auditLog.columns.action"),
1165
+ enableSorting: !1,
1166
+ size: 280,
1167
+ meta: {
1168
+ cellSpanClass: "audit-log-action-label"
1169
+ },
1170
+ cell(e) {
1171
+ var E;
1172
+ const s = e.row.original;
1173
+ if (ae(s))
1174
+ return m("span", {
1175
+ class: "audit-op-marker flex flex-wrap items-baseline gap-4"
1176
+ }, [m("span", {
1177
+ class: "text-fm-color-typo-secondary"
1178
+ }, [We("↳")]), m("span", {
1179
+ class: "font-semibold"
1180
+ }, [ut(s)]), s.entityId ? m("span", {
1181
+ class: "text-fm-color-typo-secondary"
1182
+ }, [We("· "), s.entityId]) : null, s.status === "failed" && s.errorMessage ? m("span", {
1183
+ class: "text-fm-color-typo-error"
1184
+ }, [We("· "), s.errorMessage]) : null]);
1185
+ const r = ((E = s.operations) == null ? void 0 : E.length) ?? 0, v = (Z) => {
1186
+ Z.stopPropagation(), e.row.getToggleExpandedHandler()();
1187
+ }, p = {
1188
+ variant: "tertiary",
1189
+ icon: e.row.getIsExpanded() ? "keyboard_arrow_up" : "keyboard_arrow_down",
1190
+ "aria-label": o("auditLog.operation.toggle"),
1191
+ class: "ml-auto shrink-0",
1192
+ onClick: v
1193
+ }, k = _e.FmButton;
1194
+ return m("span", {
1195
+ class: "flex items-center gap-8"
1196
+ }, [m("span", null, [it(s)]), r > 0 ? m("span", {
1197
+ class: "cursor-pointer",
1198
+ onClick: v
1199
+ }, [m(_e.FmChip, {
1200
+ variant: "neutral",
1201
+ compact: !0,
1202
+ label: o("auditLog.operation.badge", {
1203
+ count: r
1204
+ })
1205
+ }, null)]) : null, e.row.getCanExpand() ? m(k, p, null) : null]);
1206
+ }
1207
+ }, {
1208
+ accessorKey: "outcome",
1209
+ header: () => o("auditLog.columns.outcome"),
1210
+ enableSorting: !1,
1211
+ cell(e) {
1212
+ const s = e.row.original;
1213
+ return ae(s) ? m(_e.FmChip, {
1214
+ variant: s.status === "failed" ? "critical" : "success",
1215
+ label: s.status === "failed" ? o("auditLog.outcome.failed") : o("auditLog.outcome.success"),
1216
+ compact: !0
1217
+ }, null) : m(_e.FmChip, {
1218
+ variant: dt(s.outcome),
1219
+ label: Be(s.outcome),
1220
+ compact: !0
1221
+ }, null);
1222
+ }
1223
+ }];
1224
+ function oe(e) {
1225
+ const s = A(e, Rl);
1226
+ return new Date(s.year(), s.month(), s.date(), s.hour(), s.minute(), 0).toISOString().slice(0, 19).replace("T", " ");
1227
+ }
1228
+ async function ft() {
1229
+ var e, s, r;
1230
+ _.value = !0;
1231
+ try {
1232
+ const {
1233
+ startDate: v,
1234
+ endDate: p
1235
+ } = q.value, k = (se.value - 1) * Le, E = Ee.value.subjectPrefixes, Z = await Te.read({
1236
+ limit: Le,
1237
+ offset: k,
1238
+ ...v ? {
1239
+ from: oe(v)
1240
+ } : {},
1241
+ ...p ? {
1242
+ to: oe(p)
1243
+ } : {},
1244
+ ...Q.value.userIds.length ? {
1245
+ userIds: Q.value.userIds
1246
+ } : {},
1247
+ ...Q.value.feedmeAdminActors ? {
1248
+ feedmeAdminActors: !0
1249
+ } : {},
1250
+ ...(e = z.value) != null && e.length ? {
1251
+ subjects: z.value
1252
+ } : {},
1253
+ ...E.length ? {
1254
+ subjectPrefixes: [...E]
1255
+ } : {},
1256
+ ...(s = X.value) != null && s.length ? {
1257
+ actions: X.value
1258
+ } : {},
1259
+ ...(r = G.value) != null && r.length ? {
1260
+ outcomes: Ne(G.value)
1261
+ } : {},
1262
+ ...H.value ? {
1263
+ search: H.value
1264
+ } : {},
1265
+ ...ce.value.length ? {
1266
+ searchUserIds: ce.value
1267
+ } : {},
1268
+ ...fe.value.length ? {
1269
+ searchSubjects: fe.value
1270
+ } : {}
1271
+ });
1272
+ f.value = Z, Ze.value = Z.length === Le, S.value = {};
1273
+ } finally {
1274
+ _.value = !1;
1275
+ }
1276
+ }
1277
+ const mt = w(() => {
1278
+ var e;
1279
+ return JSON.stringify({
1280
+ businessId: ((e = n.currentBusiness.value) == null ? void 0 : e._id) ?? "",
1281
+ dateRange: q.value,
1282
+ users: [...de.value ?? []].sort(),
1283
+ subjects: [...z.value ?? []].sort(),
1284
+ outcomes: [...G.value ?? []].sort(),
1285
+ actions: [...X.value ?? []].sort(),
1286
+ moduleKey: le.value,
1287
+ search: H.value
1288
+ });
1289
+ });
1290
+ async function qt() {
1291
+ var v, p, k;
1292
+ const {
1293
+ startDate: e,
1294
+ endDate: s
1295
+ } = q.value, r = Ee.value.subjectPrefixes;
1296
+ $.value = await Te.count({
1297
+ ...e ? {
1298
+ from: oe(e)
1299
+ } : {},
1300
+ ...s ? {
1301
+ to: oe(s)
1302
+ } : {},
1303
+ ...Q.value.userIds.length ? {
1304
+ userIds: Q.value.userIds
1305
+ } : {},
1306
+ ...Q.value.feedmeAdminActors ? {
1307
+ feedmeAdminActors: !0
1308
+ } : {},
1309
+ ...(v = z.value) != null && v.length ? {
1310
+ subjects: z.value
1311
+ } : {},
1312
+ ...r.length ? {
1313
+ subjectPrefixes: [...r]
1314
+ } : {},
1315
+ ...(p = X.value) != null && p.length ? {
1316
+ actions: X.value
1317
+ } : {},
1318
+ ...(k = G.value) != null && k.length ? {
1319
+ outcomes: Ne(G.value)
1320
+ } : {},
1321
+ ...H.value ? {
1322
+ search: H.value
1323
+ } : {},
1324
+ ...ce.value.length ? {
1325
+ searchUserIds: ce.value
1326
+ } : {},
1327
+ ...fe.value.length ? {
1328
+ searchSubjects: fe.value
1329
+ } : {}
1330
+ });
1331
+ }
1332
+ ne(mt, async () => {
1333
+ var e;
1334
+ se.value = 1, (e = n.currentBusiness.value) != null && e._id && await Promise.all([qt(), ft()]);
1335
+ }, {
1336
+ immediate: !0
1337
+ }), ne(le, () => {
1338
+ z.value = void 0;
1339
+ });
1340
+ let ze = !1;
1341
+ async function Gt({
1342
+ pageIndex: e
1343
+ }) {
1344
+ var s;
1345
+ if ((s = n.currentBusiness.value) != null && s._id && !(e === 0 && se.value === 1) && !ze) {
1346
+ ze = !0, se.value = e + 1;
1347
+ try {
1348
+ await ft();
1349
+ } finally {
1350
+ ze = !1;
1351
+ }
1352
+ }
1353
+ }
1354
+ function Xt(e) {
1355
+ if (ae(e)) {
1356
+ Zt(e);
1357
+ return;
1358
+ }
1359
+ a.value = e, I.value = !0;
1360
+ }
1361
+ function Qt() {
1362
+ I.value = !1, a.value = null;
1363
+ }
1364
+ function Zt(e) {
1365
+ x.value = e, F.value = !0;
1366
+ }
1367
+ function eo() {
1368
+ F.value = !1, x.value = null;
1369
+ }
1370
+ ne(n.currentBusiness, (e) => {
1371
+ e && u.readTeamMembers();
1372
+ }, {
1373
+ immediate: !0
1374
+ });
1375
+ function to() {
1376
+ const e = de.value;
1377
+ if (!(e != null && e.length)) return;
1378
+ const s = new Set(he.value.map((p) => p.userId)), r = new Set(u.members.map((p) => p.doc.userId)), v = e.filter((p) => p === Pe ? Ie.value : u.hasLoaded ? r.has(p) || s.has(p) : !0);
1379
+ v.length !== e.length && (de.value = v.length ? v : void 0);
1380
+ }
1381
+ async function oo() {
1382
+ var r;
1383
+ if (!((r = n.currentBusiness.value) != null && r._id)) return;
1384
+ const {
1385
+ startDate: e,
1386
+ endDate: s
1387
+ } = q.value;
1388
+ try {
1389
+ const {
1390
+ actors: v,
1391
+ showFeedmeAdminFilter: p
1392
+ } = await Te.getFeedmeAdminFilter({
1393
+ ...e ? {
1394
+ from: oe(e)
1395
+ } : {},
1396
+ ...s ? {
1397
+ to: oe(s)
1398
+ } : {}
1399
+ });
1400
+ he.value = v, Ie.value = p;
1401
+ } catch {
1402
+ he.value = [], Ie.value = !1;
1403
+ }
1404
+ to();
1405
+ }
1406
+ return ne(() => {
1407
+ var e;
1408
+ return {
1409
+ businessId: (e = n.currentBusiness.value) == null ? void 0 : e._id,
1410
+ range: q.value
1411
+ };
1412
+ }, () => oo(), {
1413
+ immediate: !0,
1414
+ deep: !0
1415
+ }), (e, s) => {
1416
+ const r = U("FmSpacer"), v = U("FmButton"), p = U("FmMenuItem"), k = U("FmMenu"), E = U("FmChip"), Z = U("FmDateRangePicker"), Fe = U("FmSearch"), be = U("FmTable"), De = U("FmSideSheet"), He = U("FmIcon");
1417
+ return g(), b(J, null, [m(So, {
1418
+ heading: d(o)("auditLog.title")
1419
+ }, {
1420
+ "append-heading": B(() => [m(r), m(v, {
1421
+ variant: "primary",
1422
+ "prepend-icon": "upload",
1423
+ label: d(o)("auditLog.export"),
1424
+ disabled: f.value.length === 0 || c.value || d(u).isLoading || d(u).members.length === 0,
1425
+ loading: c.value,
1426
+ onClick: zt
1427
+ }, null, 8, ["label", "disabled", "loading"]), m(k, {
1428
+ "close-on-click": !1,
1429
+ "z-index": 50
1430
+ }, {
1431
+ "menu-button": B(() => [m(v, {
1432
+ variant: "tertiary",
1433
+ icon: "settings",
1434
+ "aria-label": d(o)("auditLog.exportSettings.title"),
1435
+ disabled: c.value
1436
+ }, null, 8, ["aria-label", "disabled"])]),
1437
+ default: B(() => [l("div", Yo, [l("p", zo, i(d(o)("auditLog.exportSettings.title")), 1), (g(), b(J, null, re(Ye, (h) => m(p, {
1438
+ key: h.key,
1439
+ label: d(o)(h.labelKey),
1440
+ "has-checkbox": "",
1441
+ "model-value": me.value.has(h.key),
1442
+ disabled: me.value.has(h.key) && me.value.size === 1,
1443
+ onClick: (C) => Yt(h.key)
1444
+ }, null, 8, ["label", "model-value", "disabled", "onClick"])), 64))])]),
1445
+ _: 1
1446
+ })]),
1447
+ default: B(() => [l("div", Ho, [l("div", Jo, [m(jo, {
1448
+ modelValue: le.value,
1449
+ "onUpdate:modelValue": s[0] || (s[0] = (h) => le.value = h),
1450
+ items: It.value
1451
+ }, null, 8, ["modelValue", "items"]), l("div", Wo, [m(Z, {
1452
+ modelValue: q.value,
1453
+ "onUpdate:modelValue": s[1] || (s[1] = (h) => q.value = h),
1454
+ "show-predefined-range": "",
1455
+ "show-time": "",
1456
+ "predefined-range": Rt.value
1457
+ }, {
1458
+ "trigger-button": B(() => [m(E, {
1459
+ label: Et.value,
1460
+ icon: "calendar_month"
1461
+ }, null, 8, ["label"])]),
1462
+ _: 1
1463
+ }, 8, ["modelValue", "predefined-range"]), l("div", qo, [m(je, {
1464
+ modelValue: de.value,
1465
+ "onUpdate:modelValue": s[2] || (s[2] = (h) => de.value = h),
1466
+ items: Ot.value,
1467
+ multiple: "",
1468
+ variant: "dark",
1469
+ placeholder: d(o)("auditLog.filter.user_placeholder"),
1470
+ "selected-prefix": d(o)("auditLog.filter.selected_user_prefix"),
1471
+ "chip-icon": "account_circle"
1472
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), l("div", Go, [m(je, {
1473
+ modelValue: z.value,
1474
+ "onUpdate:modelValue": s[3] || (s[3] = (h) => z.value = h),
1475
+ items: Ft.value,
1476
+ "filter-fn": Dt,
1477
+ multiple: "",
1478
+ variant: "dark",
1479
+ placeholder: d(o)("auditLog.filter.subject_placeholder"),
1480
+ "selected-prefix": d(o)("auditLog.filter.selected_subject_prefix"),
1481
+ "chip-icon": "badge"
1482
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), l("div", Xo, [m(je, {
1483
+ modelValue: X.value,
1484
+ "onUpdate:modelValue": s[4] || (s[4] = (h) => X.value = h),
1485
+ items: jt.value,
1486
+ multiple: "",
1487
+ variant: "dark",
1488
+ placeholder: d(o)("auditLog.filter.action_placeholder"),
1489
+ "selected-prefix": d(o)("auditLog.filter.selected_action_prefix"),
1490
+ searchable: !1
1491
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), l("div", Qo, [m(je, {
1492
+ modelValue: G.value,
1493
+ "onUpdate:modelValue": s[5] || (s[5] = (h) => G.value = h),
1494
+ items: Tt.value,
1495
+ multiple: "",
1496
+ variant: "dark",
1497
+ placeholder: d(o)("auditLog.filter.status_placeholder"),
1498
+ "selected-prefix": d(o)("auditLog.filter.selected_status_prefix"),
1499
+ searchable: !1,
1500
+ "chip-icon": "check_circle"
1501
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), m(Fe, {
1502
+ modelValue: Re.value,
1503
+ "onUpdate:modelValue": s[6] || (s[6] = (h) => Re.value = h),
1504
+ class: "ml-auto w-[280px]",
1505
+ placeholder: d(o)("auditLog.search.placeholder")
1506
+ }, null, 8, ["modelValue", "placeholder"])])]), m(xo, null, {
1507
+ default: B(() => [l("div", Zo, [m(wo, {
1508
+ "is-loading": _.value,
1509
+ "is-empty": f.value.length === 0,
1510
+ title: d(o)("auditLog.noData.title"),
1511
+ subtitle: d(o)("auditLog.noData.subtitle")
1512
+ }, {
1513
+ default: B(() => [(g(), Ce(be, {
1514
+ key: mt.value,
1515
+ "column-defs": Wt,
1516
+ "row-data": f.value,
1517
+ "page-size": Le,
1518
+ "page-count": ue.value,
1519
+ "row-count": $.value,
1520
+ "fetch-fn": Gt,
1521
+ "hide-footer": ue.value <= 1,
1522
+ loading: _.value,
1523
+ "expanded-state": S.value,
1524
+ "get-row-can-expand": Ht,
1525
+ "get-sub-row": Jt,
1526
+ "pin-header-row": "",
1527
+ class: "audit-log-list-table cursor-pointer",
1528
+ "onUpdate:expandedState": s[7] || (s[7] = (h) => S.value = h),
1529
+ onRowClick: s[8] || (s[8] = (h) => Xt(h.original))
1530
+ }, null, 8, ["row-data", "page-count", "row-count", "hide-footer", "loading", "expanded-state"]))]),
1531
+ _: 1
1532
+ }, 8, ["is-loading", "is-empty", "title", "subtitle"])])]),
1533
+ _: 1
1534
+ })])]),
1535
+ _: 1
1536
+ }, 8, ["heading"]), m(De, {
1537
+ header: d(o)("auditLog.detail.header"),
1538
+ "model-value": I.value,
1539
+ "max-width": 768,
1540
+ "dismiss-away": "",
1541
+ "onUpdate:modelValue": s[9] || (s[9] = (h) => {
1542
+ h || Qt();
1543
+ })
1544
+ }, {
1545
+ default: B(() => [a.value ? (g(), b("div", es, [l("div", ts, [l("div", os, [l("p", ss, i($t(a.value)), 1)]), m(E, {
1546
+ variant: dt(a.value.outcome),
1547
+ label: Be(a.value.outcome),
1548
+ compact: ""
1549
+ }, null, 8, ["variant", "label"])]), l("div", ls, [l("div", as, [l("div", null, [l("p", ns, i(d(o)("auditLog.detail.date")), 1), l("p", rs, i(nt(a.value.timestamp)), 1)]), l("div", null, [l("p", is, i(d(o)("auditLog.detail.user")), 1), l("p", us, i(Ae(a.value)), 1)]), l("div", null, [l("p", ds, i(d(o)("auditLog.detail.email")), 1), l("p", cs, i(Ut(a.value)), 1)]), a.value.field ? (g(), b("div", fs, [l("p", ms, i(d(o)("auditLog.detail.field")), 1), l("p", vs, i(a.value.field), 1)])) : D("", !0), l("div", null, [l("p", ps, i(d(o)("auditLog.detail.business")), 1), l("p", gs, i(a.value.businessId || "-"), 1)]), l("div", null, [l("p", hs, i(d(o)("auditLog.detail.restaurant")), 1), l("p", bs, i(a.value.restaurantId || "-"), 1)])])]), l("div", ys, [l("div", _s, [l("p", xs, i(d(o)("auditLog.detail.eventDetails")), 1)]), s[12] || (s[12] = l("hr", {
1550
+ class: "border-fm-color-border-default"
1551
+ }, null, -1)), l("div", Ls, [l("div", null, [l("p", Ss, i(d(o)("auditLog.detail.actionDescription")), 1), l("p", ws, i(a.value.metadata.operationLabel || "-"), 1)])])]), l("div", ks, [l("div", Is, [l("p", Ms, i(d(o)("auditLog.detail.metadata")), 1)]), s[13] || (s[13] = l("hr", {
1552
+ class: "border-fm-color-border-default"
1553
+ }, null, -1)), l("div", Os, [l("div", null, [l("p", As, i(d(o)("auditLog.detail.resolvedFrom")), 1), l("p", Fs, i(Nt(a.value.metadata.resolvedFrom)), 1)]), (a.value.metadata.resolvedFrom === "permissionSet" || a.value.metadata.resolvedFrom === "systemPermissionSet") && (a.value.metadata.permissionSetName || a.value.metadata.permissionSetId) ? (g(), b("div", Ds, [l("p", js, i(d(o)("auditLog.detail.permissionSet")), 1), a.value.metadata.permissionSetName ? (g(), b("p", Ts, i(a.value.metadata.permissionSetName), 1)) : D("", !0), a.value.metadata.permissionSetId ? (g(), b("p", Ps, i(a.value.metadata.permissionSetId), 1)) : D("", !0)])) : D("", !0), a.value.metadata.reason ? (g(), b("div", Cs, [l("p", Vs, i(d(o)("auditLog.detail.reason")), 1), l("p", Es, i(a.value.metadata.reason), 1)])) : D("", !0), l("div", null, [l("p", Rs, i(d(o)("auditLog.detail.requestMethod")), 1), l("p", Us, i(Kt(a.value)), 1)]), l("div", null, [l("p", $s, i(d(o)("auditLog.detail.requestPath")), 1), l("p", Ns, i(a.value.metadata.requestPath || "-"), 1)]), a.value.metadata.trace && a.value.metadata.trace.length > 0 ? (g(), b("div", Ks, [l("p", Bs, i(d(o)("auditLog.detail.permissionTrace")), 1), l("ol", Ys, [(g(!0), b(J, null, re(a.value.metadata.trace, (h, C) => (g(), b("li", {
1554
+ key: C,
1555
+ class: "flex items-center gap-6"
1556
+ }, [l("span", zs, i(C + 1), 1), l("span", Hs, i(h), 1), C < a.value.metadata.trace.length - 1 ? (g(), b("span", Js, "→")) : D("", !0)]))), 128))])])) : D("", !0), j.value ? (g(), b("div", Ws, [l("p", qs, i(d(o)("auditLog.detail.requestBody")), 1), l("pre", Gs, i(j.value), 1)])) : D("", !0)])])])) : D("", !0)]),
1557
+ _: 1
1558
+ }, 8, ["header", "model-value"]), m(De, {
1559
+ header: d(o)("auditLog.operation.sheetHeader"),
1560
+ "model-value": F.value,
1561
+ "max-width": 768,
1562
+ "dismiss-away": "",
1563
+ "onUpdate:modelValue": s[11] || (s[11] = (h) => {
1564
+ h || eo();
1565
+ })
1566
+ }, {
1567
+ default: B(() => [x.value ? (g(), b("div", Xs, [l("div", Qs, [l("div", Zs, [l("p", el, i(ut(x.value)), 1), x.value.entityId ? (g(), b("p", tl, i(x.value.entityId), 1)) : D("", !0)]), m(E, {
1568
+ variant: x.value.status === "failed" ? "critical" : "success",
1569
+ label: x.value.status === "failed" ? d(o)("auditLog.outcome.failed") : d(o)("auditLog.outcome.success"),
1570
+ compact: ""
1571
+ }, null, 8, ["variant", "label"])]), l("div", ol, [l("div", sl, [l("div", null, [l("p", ll, i(d(o)("auditLog.detail.date")), 1), l("p", al, i(nt(x.value.timestamp)), 1)]), x.value.entityId ? (g(), b("div", nl, [l("p", rl, i(d(o)("auditLog.operation.entity")), 1), l("p", il, i(x.value.entityId), 1)])) : D("", !0), x.value.durationMs !== void 0 ? (g(), b("div", ul, [l("p", dl, i(d(o)("auditLog.operation.duration")), 1), l("p", cl, i(d(o)("auditLog.operation.durationValue", {
1572
+ ms: x.value.durationMs
1573
+ })), 1)])) : D("", !0)])]), x.value.status === "failed" ? (g(), b("div", fl, [l("p", ml, i(d(o)("auditLog.operation.error")), 1), l("p", vl, i(x.value.errorMessage || "-"), 1)])) : D("", !0), l("div", pl, [l("div", gl, [l("p", hl, i(d(o)("auditLog.operation.changes")), 1)]), s[15] || (s[15] = l("hr", {
1574
+ class: "border-fm-color-border-default"
1575
+ }, null, -1)), l("div", bl, [te.value.length ? (g(), b("div", yl, [(g(!0), b(J, null, re(te.value, (h) => (g(), b("div", {
1576
+ key: h.groupKey,
1577
+ class: "space-y-4 py-8 first:pt-0 last:pb-0"
1578
+ }, [l("div", _l, [m(E, {
1579
+ variant: Y(h.type),
1580
+ label: L(h.type),
1581
+ compact: ""
1582
+ }, null, 8, ["variant", "label"]), l("span", xl, i(h.displayKey), 1)]), l("div", Ll, [(g(!0), b(J, null, re(h.rows, (C) => (g(), b("p", {
1583
+ key: C.path,
1584
+ class: "break-all font-mono text-xs"
1585
+ }, [C.type === "added" ? (g(), b("span", Sl, i(C.after ?? "—"), 1)) : C.type === "removed" ? (g(), b("span", wl, i(C.before ?? "—"), 1)) : (g(), b(J, {
1586
+ key: 2
1587
+ }, [l("span", kl, i(C.before ?? "—"), 1), s[14] || (s[14] = l("span", {
1588
+ class: "text-fm-color-typo-secondary"
1589
+ }, " → ", -1)), l("span", Il, i(C.after ?? "—"), 1)], 64))]))), 128))])]))), 128))])) : (g(), b("p", Ml, i(d(o)("auditLog.operation.noChanges")), 1))])]), M.value || V.value ? (g(), b("div", Ol, [l("button", {
1590
+ type: "button",
1591
+ class: "flex w-full items-center justify-between p-12 text-left",
1592
+ onClick: s[10] || (s[10] = (h) => P.value = !P.value)
1593
+ }, [l("p", Al, i(d(o)("auditLog.operation.showData")), 1), m(He, {
1594
+ name: "keyboard_arrow_down",
1595
+ class: yo(["shrink-0 transition-transform", P.value ? "rotate-180" : ""])
1596
+ }, null, 8, ["class"])]), P.value ? (g(), b(J, {
1597
+ key: 0
1598
+ }, [s[16] || (s[16] = l("hr", {
1599
+ class: "border-fm-color-border-default"
1600
+ }, null, -1)), l("div", Fl, [M.value ? (g(), b("div", Dl, [l("p", jl, i(d(o)("auditLog.operation.before")), 1), l("pre", Tl, i(M.value), 1)])) : D("", !0), V.value ? (g(), b("div", Pl, [l("p", Cl, i(d(o)("auditLog.operation.after")), 1), l("pre", Vl, i(V.value), 1)])) : D("", !0)])], 64)) : D("", !0)])) : D("", !0)])) : D("", !0)]),
1601
+ _: 1
1602
+ }, 8, ["header", "model-value"])], 64);
1603
+ };
1604
+ }
1605
+ }), ea = /* @__PURE__ */ Lo(Ul, [["__scopeId", "data-v-c4118552"]]);
1606
+ export {
1607
+ ea as default
1608
+ };