@feedmepos/mf-hrm-portal 2.2.1 → 2.2.2-dev

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