@feedmepos/mf-hrm-portal 2.3.2-dev.11 → 2.3.2-dev.12

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 (62) hide show
  1. package/dist/{ApprovalCodeList-DoNoFW6w.js → ApprovalCodeList-CCh9mNJh.js} +7 -7
  2. package/dist/AuditLogList-DCADUZ5s.js +2019 -0
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-C1dLOPFb.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BZQNDOg7.js} +10 -10
  4. package/dist/{EmployeeList-BX9gy9WG.js → EmployeeList-CRI7XjzX.js} +8 -8
  5. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-iCgTyICI.js → FormSection.vue_vue_type_script_setup_true_lang-y9_hxba6.js} +1 -1
  6. package/dist/{GrantUserList-DNvmmlDI.js → GrantUserList-DbMngkpK.js} +8 -8
  7. package/dist/{Main-BHmY7VHC.js → Main-BsFUfsmP.js} +29 -29
  8. package/dist/{Main-SzU5H5uC.js → Main-CrnM6wr8.js} +623 -629
  9. package/dist/{Main-2NivoQNg.js → Main-D4Zq5AXi.js} +5 -5
  10. package/dist/{MyPosProfile-2W5mT5d5.js → MyPosProfile-B4cE47im.js} +1 -1
  11. package/dist/{PermissionSetList-BCAm8rHm.js → PermissionSetList-D_2x-mDD.js} +112 -113
  12. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BM9Von-l.js +4212 -0
  13. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DYbfmF2P.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-COX-N0k6.js} +33 -33
  14. package/dist/{RoleForm.vue_vue_type_script_setup_true_lang-o4mXv2hT.js → RoleForm.vue_vue_type_script_setup_true_lang-D8V8KWiL.js} +41 -41
  15. package/dist/{RoleList-BXkyCeH0.js → RoleList-BC-c7fqn.js} +105 -96
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DOxRdHY1.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DBbuSrXV.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-4hV53-q6.js → ScheduleGeneralPage-eytzOZQr.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-D5jOHLA1.js → ScheduleModal.vue_vue_type_script_setup_true_lang-CP-kToVO.js} +4 -4
  19. package/dist/{SchedulePage-CqNa_p32.js → SchedulePage-B0QirzAk.js} +17 -17
  20. package/dist/{SchedulePositionPage-7xYBe1xd.js → SchedulePositionPage-BAE-NQvL.js} +3 -3
  21. package/dist/{SelectFilter-Dy2Nv1_D.js → SelectFilter-DrLJhxt6.js} +1 -1
  22. package/dist/TeamMemberList-CHkiL_q9.js +2083 -0
  23. package/dist/TimesheetList-BZuddmzy.js +402 -0
  24. package/dist/TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-LCUO-ogb.js +58 -0
  25. package/dist/{app-C37qvNnc.js → app-B9qAxMj1.js} +3516 -3470
  26. package/dist/app.js +1 -1
  27. package/dist/{approval-code-B7rpc4Oe.js → approval-code-CTgj9q6m.js} +1 -1
  28. package/dist/{dayjs.min-D35yhU4A.js → dayjs.min-giCSI3N8.js} +22 -22
  29. package/dist/employee-BD3NXG8h.js +210 -0
  30. package/dist/{grant-user-CostZ0Md.js → grant-user-jeTFzGU1.js} +1 -1
  31. package/dist/{index-DPiNc7mn.js → iteration-Tyg43nH0.js} +726 -698
  32. package/dist/{lodash-C8MGI_QW.js → lodash-CZsDR_DU.js} +1 -1
  33. package/dist/{member-grant-CktOoicv.js → member-grant-DsEMLN1N.js} +2 -2
  34. package/dist/restaurant-CDJ3VjdH.js +49 -0
  35. package/dist/role-BDRWt87n.js +91 -0
  36. package/dist/{rule-EYBPBkv_.js → rule-EiO87cJJ.js} +309 -313
  37. package/dist/src/api/employee/index.d.ts +2 -1
  38. package/dist/src/api/timesheet/index.d.ts +1 -1
  39. package/dist/src/composables/useTenant.d.ts +11 -0
  40. package/dist/src/router/courtGuard.d.ts +4 -0
  41. package/dist/src/stores/employee.d.ts +7 -1
  42. package/dist/src/stores/restaurant.d.ts +1 -61
  43. package/dist/src/stores/team.d.ts +1 -1
  44. package/dist/src/stores/timesheet.d.ts +51 -66
  45. package/dist/src/types/timesheet.d.ts +0 -3
  46. package/dist/style.css +1 -1
  47. package/dist/tsconfig.app.tsbuildinfo +1 -1
  48. package/dist/{useAppStore-BmBJPo1_.js → useAppStore-CkUZ2H5h.js} +1 -1
  49. package/dist/{useLoading-BtyGXkm_.js → useLoading-DJHJM5E0.js} +1 -1
  50. package/dist/useReportPermissions-2dfIX21b.js +80 -0
  51. package/dist/{useSsoProviders-CZrTNgfp.js → useSsoProviders-BarGHndw.js} +1 -1
  52. package/package.json +2 -2
  53. package/dist/AuditLogList-D5M0cl8g.js +0 -2026
  54. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-e2vu_Mcn.js +0 -4208
  55. package/dist/TeamMemberList-okhiXdLg.js +0 -2087
  56. package/dist/TimesheetList-BKj9OnJW.js +0 -437
  57. package/dist/employee-Bn6HTMxg.js +0 -172
  58. package/dist/iteration-CcXrOMQe.js +0 -30
  59. package/dist/restaurant-BgvuJL8G.js +0 -52
  60. package/dist/role-D8G5QOG1.js +0 -98
  61. package/dist/timesheet-D6jBeR-V.js +0 -76
  62. package/dist/useReportPermissions-C8z7EA7v.js +0 -82
@@ -0,0 +1,2019 @@
1
+ import { defineComponent as $t, ref as S, computed as A, onMounted as No, onBeforeUnmount as Ko, watch as se, resolveComponent as R, createElementBlock as g, openBlock as v, createBlock as Te, createCommentVNode as F, createElementVNode as s, Fragment as z, renderList as ce, withCtx as B, createVNode as y, toDisplayString as l, unref as u, nextTick as Yo, onUnmounted as Bo, createTextVNode as ye, normalizeClass as zo } from "vue";
2
+ import { d as V } from "./dayjs.min-giCSI3N8.js";
3
+ import { defineStore as qo, storeToRefs as Jo } from "pinia";
4
+ import { useI18n as dt, useCoreStore as Ho } from "@feedmepos/mf-common";
5
+ import { g as at, b as st, u as Wo, F as Mt, _ as Go, a as Xo } from "./app-B9qAxMj1.js";
6
+ import { components as ve } from "@feedmepos/ui-library";
7
+ import { S as Me } from "./SelectFilter-DrLJhxt6.js";
8
+ import { _ as Qo } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
9
+ import { _ as Zo } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
10
+ import { t as ea, p as Dt } from "./rule-EiO87cJJ.js";
11
+ import { u as ta } from "./restaurant-CDJ3VjdH.js";
12
+ import { u as oa } from "./useDebounce-B8ZPVS5C.js";
13
+ import { n as aa } from "./string-DZQ1uNjn.js";
14
+ import { useRoute as sa, useRouter as na } from "vue-router";
15
+ import { u as la } from "./useMessage-_ywT_N9X.js";
16
+ const ra = {
17
+ order: "Order",
18
+ refund: "Refund",
19
+ drawer: "Cash drawer",
20
+ menu: "Menu",
21
+ inventory: "Inventory",
22
+ deposit: "Deposit",
23
+ delivery: "Delivery",
24
+ counterRecord: "Counter",
25
+ counter: "Counter",
26
+ setting: "Settings",
27
+ display: "Display",
28
+ printer: "Printer",
29
+ table: "Table",
30
+ employee: "Employee",
31
+ system: "System",
32
+ tax: "Tax",
33
+ paymentType: "Payment type",
34
+ faceId: "Face ID",
35
+ mallIntegration: "Mall integration",
36
+ report: "Report"
37
+ }, De = [
38
+ { key: "all", label: "All", subjectPrefixes: [] },
39
+ { key: "inventory", label: "Inventory", subjectPrefixes: ["business::inventory", "inventory"], sources: ["portal"] },
40
+ { key: "report", label: "Report", subjectPrefixes: ["business::report", "report"], sources: ["portal"] },
41
+ { key: "hrm", label: "HRM", subjectPrefixes: ["business::hrm", "hrm"], sources: ["portal"] },
42
+ { key: "payment", label: "Payment", subjectPrefixes: ["business::payment", "payment"], sources: ["portal"] },
43
+ { key: "menu", label: "Menu", subjectPrefixes: ["business::menu", "menu"], sources: ["portal"] },
44
+ { key: "crm", label: "CRM", subjectPrefixes: ["business::crm", "crm"], sources: ["portal"] },
45
+ { key: "pos", label: "POS", subjectPrefixes: [], sources: ["pos-v8", "hrm-validate"] }
46
+ ], nt = "/audit-logs", Ce = {
47
+ async count(t) {
48
+ var r, c, d, b, _, w, D, O, i;
49
+ const o = {
50
+ ...t != null && t.from ? { from: t.from } : {},
51
+ ...t != null && t.to ? { to: t.to } : {},
52
+ ...(r = t == null ? void 0 : t.userIds) != null && r.length ? { userIds: t.userIds } : {},
53
+ ...(c = t == null ? void 0 : t.subjects) != null && c.length ? { subjects: t.subjects } : {},
54
+ ...(d = t == null ? void 0 : t.subjectPrefixes) != null && d.length ? { subjectPrefixes: t.subjectPrefixes } : {},
55
+ ...(b = t == null ? void 0 : t.actions) != null && b.length ? { actions: t.actions } : {},
56
+ ...(_ = t == null ? void 0 : t.outcomes) != null && _.length ? { outcomes: t.outcomes } : {},
57
+ ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
58
+ ...t != null && t.search ? { search: t.search } : {},
59
+ ...(w = t == null ? void 0 : t.searchUserIds) != null && w.length ? { searchUserIds: t.searchUserIds } : {},
60
+ ...(D = t == null ? void 0 : t.searchSubjects) != null && D.length ? { searchSubjects: t.searchSubjects } : {},
61
+ ...(O = t == null ? void 0 : t.sources) != null && O.length ? { sources: t.sources } : {},
62
+ ...(i = t == null ? void 0 : t.restaurantIds) != null && i.length ? { restaurantIds: t.restaurantIds } : {},
63
+ ...t != null && t.traceId ? { traceId: t.traceId } : {}
64
+ };
65
+ return (await at(
66
+ await st().get(`${nt}/count`, {
67
+ params: o,
68
+ paramsSerializer: ($) => {
69
+ const L = new URLSearchParams();
70
+ for (const [f, M] of Object.entries($))
71
+ if (Array.isArray(M))
72
+ for (const C of M) L.append(f, String(C));
73
+ else M != null && L.append(f, String(M));
74
+ return L.toString();
75
+ }
76
+ })
77
+ )).total;
78
+ },
79
+ async read(t) {
80
+ var n, r, c, d, b, _, w, D, O;
81
+ const o = {
82
+ limit: (t == null ? void 0 : t.limit) ?? 100,
83
+ offset: (t == null ? void 0 : t.offset) ?? 0,
84
+ ...t != null && t.from ? { from: t.from } : {},
85
+ ...t != null && t.to ? { to: t.to } : {},
86
+ ...(n = t == null ? void 0 : t.userIds) != null && n.length ? { userIds: t.userIds } : {},
87
+ ...t != null && t.feedmeAdminActors ? { feedmeAdminActors: !0 } : {},
88
+ ...(r = t == null ? void 0 : t.subjects) != null && r.length ? { subjects: t.subjects } : {},
89
+ ...(c = t == null ? void 0 : t.subjectPrefixes) != null && c.length ? { subjectPrefixes: t.subjectPrefixes } : {},
90
+ ...(d = t == null ? void 0 : t.actions) != null && d.length ? { actions: t.actions } : {},
91
+ ...(b = t == null ? void 0 : t.outcomes) != null && b.length ? { outcomes: t.outcomes } : {},
92
+ ...t != null && t.search ? { search: t.search } : {},
93
+ ...(_ = t == null ? void 0 : t.searchUserIds) != null && _.length ? { searchUserIds: t.searchUserIds } : {},
94
+ ...(w = t == null ? void 0 : t.searchSubjects) != null && w.length ? { searchSubjects: t.searchSubjects } : {},
95
+ ...(D = t == null ? void 0 : t.sources) != null && D.length ? { sources: t.sources } : {},
96
+ ...(O = t == null ? void 0 : t.restaurantIds) != null && O.length ? { restaurantIds: t.restaurantIds } : {},
97
+ ...t != null && t.traceId ? { traceId: t.traceId } : {}
98
+ };
99
+ return at(
100
+ await st().get(nt, {
101
+ params: o,
102
+ // Serialize arrays as repeated params: key=val1&key=val2
103
+ // (NestJS @Query expects this; axios default adds brackets which break matching)
104
+ paramsSerializer: (i) => {
105
+ const $ = new URLSearchParams();
106
+ for (const [L, f] of Object.entries(i))
107
+ if (Array.isArray(f))
108
+ for (const M of f) $.append(L, String(M));
109
+ else f != null && $.append(L, String(f));
110
+ return $.toString();
111
+ }
112
+ })
113
+ );
114
+ },
115
+ /**
116
+ * FeedMe-admin options for the User filter. `actors` is the named admin list (internal
117
+ * viewers only; empty for merchants). `showFeedmeAdminFilter` indicates whether to offer
118
+ * the "FeedMe Admin" catch-all (only when the business has relevant admin activity).
119
+ */
120
+ async getFeedmeAdminFilter(t) {
121
+ const o = {
122
+ ...t != null && t.from ? { from: t.from } : {},
123
+ ...t != null && t.to ? { to: t.to } : {}
124
+ };
125
+ return at(
126
+ await st().get(`${nt}/actors`, { params: o })
127
+ );
128
+ }
129
+ }, ia = { class: "flex h-[46px] items-center gap-8 rounded-sm px-16 hover:bg-fm-color-opacity-sm" }, ua = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, da = {
130
+ "data-more-measure": "",
131
+ class: "flex h-[46px] items-center gap-8 rounded-sm px-16"
132
+ }, ca = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, fa = /* @__PURE__ */ $t({
133
+ __name: "AuditLogModuleTabs",
134
+ props: {
135
+ modelValue: {},
136
+ items: {}
137
+ },
138
+ emits: ["update:modelValue"],
139
+ setup(t, { emit: o }) {
140
+ const n = t, r = o, { t: c } = dt(), d = S(!1), b = S(null), _ = S(null), w = S([]), D = S(0), O = S(0);
141
+ let i = null;
142
+ async function $() {
143
+ if (await Yo(), !_.value) return;
144
+ const p = _.value.querySelectorAll("[data-tab-measure]");
145
+ w.value = Array.from(p).map((K) => K.offsetWidth);
146
+ const j = _.value.querySelector("[data-more-measure]");
147
+ D.value = (j == null ? void 0 : j.offsetWidth) ?? 0;
148
+ }
149
+ const L = A(() => {
150
+ const p = n.items.length;
151
+ if (p === 0) return 0;
152
+ if (!O.value || w.value.length !== p) return p;
153
+ const j = w.value;
154
+ if (j.reduce((I, Q) => I + Q, 0) <= O.value) return p;
155
+ const E = D.value;
156
+ let X = 0, Y = 0;
157
+ for (let I = 0; I < p && !(X + j[I] + E > O.value); I++)
158
+ X += j[I], Y++;
159
+ return Y;
160
+ }), f = A(() => {
161
+ const p = L.value, j = n.items.length;
162
+ if (p >= j) return [...n.items];
163
+ const K = n.items.slice(0, p), E = n.items.find((W) => W.value === n.modelValue);
164
+ if (!E || K.some((W) => W.value === E.value)) return K;
165
+ if (p === 0) return [E];
166
+ const X = n.items.findIndex((W) => W.value === E.value), Y = w.value, I = D.value, Q = Y[X] ?? 0;
167
+ let H = p, xe = Y.slice(0, H - 1).reduce((W, Le) => W + Le, 0);
168
+ for (; H > 1 && xe + Q + I > O.value; )
169
+ H--, xe = Y.slice(0, H - 1).reduce((W, Le) => W + Le, 0);
170
+ return [...n.items.slice(0, Math.max(H - 1, 0)), E];
171
+ }), M = A(() => {
172
+ const p = new Set(f.value.map((j) => j.value));
173
+ return n.items.filter((j) => !p.has(j.value));
174
+ });
175
+ function C(p) {
176
+ d.value = !1, r("update:modelValue", p);
177
+ }
178
+ return No(async () => {
179
+ await $(), b.value && (O.value = b.value.clientWidth, i = new ResizeObserver(() => {
180
+ b.value && (O.value = b.value.clientWidth);
181
+ }), i.observe(b.value));
182
+ }), Ko(() => {
183
+ i == null || i.disconnect(), i = null;
184
+ }), se(
185
+ () => n.items,
186
+ () => {
187
+ $();
188
+ },
189
+ { deep: !0 }
190
+ ), (p, j) => {
191
+ const K = R("FmTab"), E = R("FmIcon"), X = R("FmMenuItem"), Y = R("FmMenu");
192
+ return v(), g("div", {
193
+ ref_key: "containerRef",
194
+ ref: b,
195
+ class: "relative flex w-full flex-row items-center"
196
+ }, [
197
+ (v(!0), g(z, null, ce(f.value, (I) => (v(), Te(K, {
198
+ key: I.value,
199
+ "model-value": t.modelValue,
200
+ label: I.label,
201
+ badge: I.badge,
202
+ disabled: I.disabled,
203
+ value: I.value,
204
+ "onUpdate:modelValue": C
205
+ }, null, 8, ["model-value", "label", "badge", "disabled", "value"]))), 128)),
206
+ M.value.length > 0 ? (v(), Te(Y, {
207
+ key: 0,
208
+ "show-menu": d.value,
209
+ class: "max-w-[360px] min-w-[90px] rounded-sm",
210
+ placement: "bottom-start",
211
+ onMenuChanged: j[0] || (j[0] = (I) => d.value = I)
212
+ }, {
213
+ "menu-button": B(() => [
214
+ s("div", ia, [
215
+ y(E, { name: "more_vert" }),
216
+ s("span", ua, l(u(c)("auditLog.modules.more")), 1)
217
+ ])
218
+ ]),
219
+ default: B(() => [
220
+ (v(!0), g(z, null, ce(M.value, (I) => (v(), Te(X, {
221
+ key: I.value,
222
+ "model-value": t.modelValue === I.value,
223
+ label: I.label,
224
+ disabled: I.disabled,
225
+ onClick: (Q) => C(I.value)
226
+ }, null, 8, ["model-value", "label", "disabled", "onClick"]))), 128))
227
+ ]),
228
+ _: 1
229
+ }, 8, ["show-menu"])) : F("", !0),
230
+ s("div", {
231
+ ref_key: "measurerRef",
232
+ ref: _,
233
+ "aria-hidden": "true",
234
+ class: "pointer-events-none invisible absolute -left-[9999px] -top-[9999px] flex flex-row items-center"
235
+ }, [
236
+ (v(!0), g(z, null, ce(t.items, (I) => (v(), g("div", {
237
+ key: `measure-${I.value}`,
238
+ "data-tab-measure": ""
239
+ }, [
240
+ y(K, {
241
+ "model-value": t.modelValue,
242
+ label: I.label,
243
+ badge: I.badge,
244
+ disabled: I.disabled,
245
+ value: I.value
246
+ }, null, 8, ["model-value", "label", "badge", "disabled", "value"])
247
+ ]))), 128)),
248
+ s("div", da, [
249
+ y(E, { name: "more_vert" }),
250
+ s("span", ca, l(u(c)("auditLog.modules.more")), 1)
251
+ ])
252
+ ], 512)
253
+ ], 512);
254
+ };
255
+ }
256
+ }), ma = qo("hrm-team", () => {
257
+ const t = S([]), o = S(!1), n = S(!1), r = A(
258
+ () => Object.fromEntries(t.value.map((_) => [_.doc.userId, _.name]))
259
+ ), c = A(
260
+ () => Object.fromEntries(t.value.map((_) => [_.doc.userId, _.email]))
261
+ ), d = A(
262
+ () => Object.fromEntries(t.value.map((_) => [_.doc.userId, _.phoneNumber]))
263
+ );
264
+ async function b({ force: _ = !1 } = {}) {
265
+ if (!(!_ && t.value.length > 0))
266
+ try {
267
+ o.value = !0;
268
+ const w = await ea.readTeamMembers();
269
+ t.value = w.sort((D, O) => D.doc.isOwner ? -1 : D.name.localeCompare(O.name)), n.value = !0;
270
+ } finally {
271
+ o.value = !1;
272
+ }
273
+ }
274
+ return {
275
+ members: t,
276
+ isLoading: o,
277
+ hasLoaded: n,
278
+ userIdToName: r,
279
+ userIdToEmail: c,
280
+ userIdToPhone: d,
281
+ readTeamMembers: b
282
+ };
283
+ });
284
+ function va(t) {
285
+ const o = t.indexOf(".");
286
+ return o <= 0 || o === t.length - 1 ? null : { entity: t.slice(0, o), verb: t.slice(o + 1) };
287
+ }
288
+ function Ot(t) {
289
+ const o = t.split("-").join(" ");
290
+ return o.charAt(0).toUpperCase() + o.slice(1);
291
+ }
292
+ function pa(t, o, n) {
293
+ const r = t(o, n);
294
+ return r === o ? null : r;
295
+ }
296
+ function ut(t, o) {
297
+ const { eventKey: n, params: r, operationLabel: c } = o;
298
+ if (n) {
299
+ const d = pa(t, `auditLog.event.sentence.${n}`, r);
300
+ if (d) return d;
301
+ const b = va(n);
302
+ if (b) {
303
+ const _ = `${Ot(b.verb)} ${Ot(b.entity)}`, w = (r == null ? void 0 : r.label) ?? (r == null ? void 0 : r.name);
304
+ return w !== void 0 && w !== "" ? `${_} — ${w}` : _;
305
+ }
306
+ }
307
+ return c ?? "";
308
+ }
309
+ function ga({ logs: t, selectedLog: o, isSheetOpen: n, businessId: r }) {
310
+ const c = sa(), d = na(), { t: b } = dt(), _ = la();
311
+ let w = 0;
312
+ function D(f) {
313
+ const { traceId: M, ...C } = c.query;
314
+ (M ?? void 0) !== f && d.replace({ query: f ? { ...C, traceId: f } : C });
315
+ }
316
+ function O(f) {
317
+ D(f.traceId || void 0);
318
+ }
319
+ function i() {
320
+ w++, D(void 0);
321
+ }
322
+ async function $(f) {
323
+ var p;
324
+ if (((p = o.value) == null ? void 0 : p.traceId) === f) return;
325
+ const M = ++w;
326
+ let C = t.value.find((j) => j.traceId === f);
327
+ if (!C) {
328
+ try {
329
+ [C] = await Ce.read({ traceId: f, limit: 1 });
330
+ } catch {
331
+ M === w && _.error(b("auditLog.deepLink.loadFailed"));
332
+ return;
333
+ }
334
+ if (M !== w) return;
335
+ }
336
+ if (!C) {
337
+ _.error(b("auditLog.deepLink.notFound")), D(void 0);
338
+ return;
339
+ }
340
+ o.value = C, n.value = !0;
341
+ }
342
+ se(
343
+ () => [c.query.traceId, r()],
344
+ ([f, M], C) => {
345
+ var p;
346
+ if (C != null && C[1] && M !== C[1]) {
347
+ w++, n.value = !1, o.value = null, D(void 0);
348
+ return;
349
+ }
350
+ typeof f == "string" && f ? M && $(f) : (w++, (p = o.value) != null && p.traceId && n.value && (n.value = !1, o.value = null));
351
+ },
352
+ { immediate: !0 }
353
+ );
354
+ async function L() {
355
+ try {
356
+ await navigator.clipboard.writeText(window.location.href), _.success(b("auditLog.detail.linkCopied"));
357
+ } catch {
358
+ _.error(b("auditLog.detail.linkCopyFailed"));
359
+ }
360
+ }
361
+ return { onSheetOpened: O, onSheetClosed: i, copyLink: L };
362
+ }
363
+ function _e(t) {
364
+ return typeof t == "object" && t !== null && !Array.isArray(t);
365
+ }
366
+ function je(t) {
367
+ return Array.isArray(t);
368
+ }
369
+ function Ke(t) {
370
+ if (t === null) return "null";
371
+ if (typeof t == "object")
372
+ try {
373
+ return JSON.stringify(t);
374
+ } catch {
375
+ return String(t);
376
+ }
377
+ return String(t);
378
+ }
379
+ function ha(t, o) {
380
+ return t ? `${t}.${o}` : o;
381
+ }
382
+ function Ct(t) {
383
+ if (typeof t != "string") return { ok: !1, value: void 0 };
384
+ const o = t.trim();
385
+ if (!o.startsWith("{") && !o.startsWith("[")) return { ok: !1, value: void 0 };
386
+ try {
387
+ const n = JSON.parse(o);
388
+ return _e(n) || je(n) ? { ok: !0, value: n } : { ok: !1, value: void 0 };
389
+ } catch {
390
+ return { ok: !1, value: void 0 };
391
+ }
392
+ }
393
+ const ya = ["_id", "id", "subject", "key", "name"];
394
+ function ba(t, o) {
395
+ if (t.length === 0 || o.length === 0) return null;
396
+ const n = (c, d) => c.every((b) => _e(b) && b[d] !== void 0), r = (c, d) => {
397
+ const b = c.map((_) => _[d]);
398
+ return b.length === new Set(b).size;
399
+ };
400
+ for (const c of ya)
401
+ if (n(t, c) && n(o, c) && r(t, c) && r(o, c))
402
+ return c;
403
+ return null;
404
+ }
405
+ function Pt(t, o, n) {
406
+ n.push({ path: t, type: "added", before: null, after: Ke(o) });
407
+ }
408
+ function Et(t, o, n) {
409
+ n.push({ path: t, type: "removed", before: Ke(o), after: null });
410
+ }
411
+ function _a(t, o, n, r) {
412
+ const c = /* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(n)]);
413
+ for (const d of Array.from(c)) {
414
+ const b = Object.prototype.hasOwnProperty.call(o, d), _ = Object.prototype.hasOwnProperty.call(n, d);
415
+ Ye(ha(t, d), o[d], b, n[d], _, r);
416
+ }
417
+ }
418
+ function xa(t, o, n, r) {
419
+ const c = ba(o, n);
420
+ if (c) {
421
+ const L = new Map(
422
+ o.map((p) => [p[c], p])
423
+ ), f = new Map(
424
+ n.map((p) => [p[c], p])
425
+ ), M = Array.from(L.keys()).concat(Array.from(f.keys())), C = Array.from(new Set(M));
426
+ for (const p of C) {
427
+ const j = L.has(p), K = f.has(p), E = `${t}[${String(p)}]`;
428
+ Ye(
429
+ E,
430
+ L.get(p),
431
+ j,
432
+ f.get(p),
433
+ K,
434
+ r
435
+ );
436
+ }
437
+ return;
438
+ }
439
+ const d = o.map((L, f) => ({ sig: JSON.stringify(L), idx: f, item: L })), b = n.map((L, f) => ({ sig: JSON.stringify(L), idx: f, item: L })), _ = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
440
+ for (const L of d)
441
+ _.has(L.sig) || _.set(L.sig, []), _.get(L.sig).push(L);
442
+ for (const L of b)
443
+ w.has(L.sig) || w.set(L.sig, []), w.get(L.sig).push(L);
444
+ const D = [], O = [], i = Array.from(_.keys()).concat(Array.from(w.keys())), $ = Array.from(new Set(i));
445
+ for (const L of $) {
446
+ const f = _.get(L) || [], M = w.get(L) || [], C = Math.min(f.length, M.length);
447
+ for (let p = C; p < f.length; p++)
448
+ D.push({ idx: f[p].idx, item: f[p].item });
449
+ for (let p = C; p < M.length; p++)
450
+ O.push({ idx: M[p].idx, item: M[p].item });
451
+ }
452
+ for (const { idx: L, item: f } of D)
453
+ Et(`${t}[${L}]`, f, r);
454
+ for (const { idx: L, item: f } of O)
455
+ Pt(`${t}[${L}]`, f, r);
456
+ }
457
+ function Ye(t, o, n, r, c, d) {
458
+ if (!n && !c) return;
459
+ if (n && !c) {
460
+ Et(t, o, d);
461
+ return;
462
+ }
463
+ if (!n && c) {
464
+ Pt(t, r, d);
465
+ return;
466
+ }
467
+ if (JSON.stringify(o) === JSON.stringify(r)) return;
468
+ if (_e(o) && _e(r)) {
469
+ _a(t, o, r, d);
470
+ return;
471
+ }
472
+ if (je(o) && je(r)) {
473
+ xa(t, o, r, d);
474
+ return;
475
+ }
476
+ const b = Ct(o), _ = Ct(r);
477
+ if (b.ok && _.ok) {
478
+ Ye(t, b.value, !0, _.value, !0, d);
479
+ return;
480
+ }
481
+ d.push({
482
+ path: t,
483
+ type: "changed",
484
+ before: Ke(o),
485
+ after: Ke(r)
486
+ });
487
+ }
488
+ function La(t, o) {
489
+ if (JSON.stringify(t) === JSON.stringify(o)) return [];
490
+ const n = t == null, r = o == null;
491
+ let c = t;
492
+ n && (_e(o) ? c = {} : je(o) && (c = []));
493
+ let d = o;
494
+ r && (_e(t) ? d = {} : je(t) && (d = []));
495
+ const b = [];
496
+ return Ye("", c, !0, d, !0, b), b;
497
+ }
498
+ function Tt(t) {
499
+ const o = t.operations;
500
+ return !o || o.length === 0 ? !1 : o.some((n) => n.status === "failed");
501
+ }
502
+ function lt(t, o) {
503
+ var c, d;
504
+ if (t.source === "hrm-validate") return o("auditLog.pos.device.posV7");
505
+ const n = (d = (c = t.metadata) == null ? void 0 : c.pos) == null ? void 0 : d.posMode, r = t.deviceId || "-";
506
+ return n ? `${r} · ${o(`auditLog.pos.mode.${n}`)}` : r;
507
+ }
508
+ function ka(t, o) {
509
+ var r;
510
+ const n = t.actorName || t.userId || "-";
511
+ return ((r = t.metadata) == null ? void 0 : r.actorKnown) === !1 ? `${n} (${o("auditLog.pos.unverified")})` : n;
512
+ }
513
+ function jt(t, o) {
514
+ var c;
515
+ const n = t.approverName || t.approverId;
516
+ if (!n)
517
+ return t.source === "hrm-validate" ? o("auditLog.pos.viaCode") : "-";
518
+ const r = ((c = t.metadata) == null ? void 0 : c.approverKnown) === !1 ? `${n} (${o("auditLog.pos.unverified")})` : n;
519
+ return t.source === "hrm-validate" ? `${r} · ${o("auditLog.pos.viaCode")}` : r;
520
+ }
521
+ function Sa(t, o) {
522
+ const n = t.approverName || t.approverId;
523
+ return n ? ` · ${o("auditLog.pos.approverInline", { name: n })}` : "";
524
+ }
525
+ function wa(t, o, n) {
526
+ return o || !(t != null && t.length) ? { userIds: [], feedmeAdminActors: !1 } : {
527
+ userIds: t.filter((r) => r !== n),
528
+ feedmeAdminActors: t.includes(n)
529
+ };
530
+ }
531
+ function be(t) {
532
+ return t === void 0 ? "—" : Array.isArray(t) ? t.length > 0 ? t.join(", ") : "—" : t || "—";
533
+ }
534
+ function Ia(t) {
535
+ return {
536
+ label: t.label,
537
+ labelKey: t.labelKey,
538
+ type: t.type,
539
+ beforeDisplay: be(t.before),
540
+ afterDisplay: be(t.after)
541
+ };
542
+ }
543
+ function Aa(t) {
544
+ return Array.isArray(t) && t.length > 0;
545
+ }
546
+ function Rt(t, o, n) {
547
+ return n.labelKey && o(n.labelKey) ? t(n.labelKey) : n.label;
548
+ }
549
+ function Ut(t, o) {
550
+ return ut(t, o) || t("auditLog.operation.unlabeled");
551
+ }
552
+ function Fa(t, o) {
553
+ return !o || o.length === 0 ? "" : o.map((n) => {
554
+ const r = Ut(t, n), c = t(`auditLog.outcome.${n.status}`);
555
+ let d = `${r}: ${c}`;
556
+ return n.status === "failed" && n.errorMessage && (d += ` — ${n.errorMessage}`), d;
557
+ }).join(`
558
+ `);
559
+ }
560
+ function Ma(t, o, n) {
561
+ const r = Rt(t, o, n);
562
+ return n.type === "add" ? `${r}: + ${be(n.after)}` : n.type === "remove" ? `${r}: - ${be(n.before)}` : `${r}: ${be(n.before)} → ${be(n.after)}`;
563
+ }
564
+ function Da(t, o, n) {
565
+ if (!n || n.length === 0) return "";
566
+ const r = n.filter((b) => b.changeNodes && b.changeNodes.length > 0);
567
+ if (r.length === 0) return "";
568
+ const c = r.length > 1;
569
+ return r.map((b) => {
570
+ const _ = (b.changeNodes ?? []).map((w) => Ma(t, o, w));
571
+ return c ? [`[${Ut(t, b)}]`, ..._].join(`
572
+ `) : _.join(`
573
+ `);
574
+ }).join(`
575
+ `);
576
+ }
577
+ const Oa = {
578
+ class: "flex flex-col gap-4 p-12 w-[260px]"
579
+ }, Ca = {
580
+ class: "text-xs font-semibold text-fm-color-typo-secondary mb-4"
581
+ }, Ta = {
582
+ class: "flex min-h-0 flex-1 flex-col gap-16"
583
+ }, ja = {
584
+ class: "space-y-16"
585
+ }, Va = {
586
+ class: "flex flex-wrap items-center gap-8"
587
+ }, $a = {
588
+ key: 0,
589
+ class: "w-fit"
590
+ }, Pa = {
591
+ key: 1,
592
+ class: "w-fit"
593
+ }, Ea = {
594
+ class: "w-fit"
595
+ }, Ra = {
596
+ class: "w-fit"
597
+ }, Ua = {
598
+ key: 2,
599
+ class: "w-fit"
600
+ }, Na = {
601
+ class: "flex h-full flex-col overflow-auto"
602
+ }, Ka = {
603
+ key: 0,
604
+ class: "space-y-12 p-4 text-sm"
605
+ }, Ya = {
606
+ class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
607
+ }, Ba = {
608
+ class: "min-w-0 flex-1"
609
+ }, za = {
610
+ class: "audit-log-operation-label-detail text-base font-bold leading-snug text-fm-color-typo-primary"
611
+ }, qa = {
612
+ key: 0,
613
+ class: "mt-4 break-all font-mono text-xs text-fm-color-typo-secondary"
614
+ }, Ja = {
615
+ key: 1,
616
+ class: "mt-2 break-all font-mono text-xs text-fm-color-typo-secondary"
617
+ }, Ha = {
618
+ class: "flex items-center gap-4"
619
+ }, Wa = {
620
+ class: "rounded-lg border border-fm-color-border-default p-12"
621
+ }, Ga = {
622
+ class: "space-y-12"
623
+ }, Xa = {
624
+ class: "text-xs text-fm-color-typo-secondary"
625
+ }, Qa = {
626
+ class: "font-semibold"
627
+ }, Za = {
628
+ class: "text-xs text-fm-color-typo-secondary"
629
+ }, es = {
630
+ class: "font-semibold"
631
+ }, ts = {
632
+ class: "text-xs text-fm-color-typo-secondary"
633
+ }, os = {
634
+ class: "break-all font-semibold"
635
+ }, as = {
636
+ key: 0
637
+ }, ss = {
638
+ class: "text-xs text-fm-color-typo-secondary"
639
+ }, ns = {
640
+ class: "break-all font-mono text-xs font-semibold"
641
+ }, ls = {
642
+ class: "text-xs text-fm-color-typo-secondary"
643
+ }, rs = {
644
+ class: "break-all font-mono text-xs font-semibold"
645
+ }, is = {
646
+ class: "text-xs text-fm-color-typo-secondary"
647
+ }, us = {
648
+ class: "font-semibold"
649
+ }, ds = {
650
+ class: "rounded-lg border border-fm-color-border-default"
651
+ }, cs = {
652
+ class: "p-12"
653
+ }, fs = {
654
+ class: "text-base font-bold text-fm-color-typo-primary"
655
+ }, ms = {
656
+ class: "space-y-12 p-12"
657
+ }, vs = {
658
+ class: "text-xs text-fm-color-typo-secondary"
659
+ }, ps = {
660
+ class: "font-semibold"
661
+ }, gs = {
662
+ class: "rounded-lg border border-fm-color-border-default"
663
+ }, hs = {
664
+ class: "p-12"
665
+ }, ys = {
666
+ class: "text-base font-bold text-fm-color-typo-primary"
667
+ }, bs = {
668
+ class: "space-y-12 p-12"
669
+ }, _s = {
670
+ class: "text-xs text-fm-color-typo-secondary"
671
+ }, xs = {
672
+ class: "font-semibold"
673
+ }, Ls = {
674
+ key: 0
675
+ }, ks = {
676
+ class: "text-xs text-fm-color-typo-secondary"
677
+ }, Ss = {
678
+ key: 0,
679
+ class: "font-semibold"
680
+ }, ws = {
681
+ key: 1,
682
+ class: "break-all font-mono text-xs text-fm-color-typo-secondary"
683
+ }, Is = {
684
+ key: 1
685
+ }, As = {
686
+ class: "text-xs text-fm-color-typo-secondary"
687
+ }, Fs = {
688
+ class: "font-semibold whitespace-pre-line"
689
+ }, Ms = {
690
+ class: "text-xs text-fm-color-typo-secondary"
691
+ }, Ds = {
692
+ class: "font-semibold"
693
+ }, Os = {
694
+ class: "text-xs text-fm-color-typo-secondary"
695
+ }, Cs = {
696
+ class: "break-all font-mono text-xs font-semibold"
697
+ }, Ts = {
698
+ class: "text-xs text-fm-color-typo-secondary"
699
+ }, js = {
700
+ class: "break-all font-mono text-xs font-semibold"
701
+ }, Vs = {
702
+ class: "text-xs text-fm-color-typo-secondary"
703
+ }, $s = {
704
+ class: "font-semibold"
705
+ }, Ps = {
706
+ key: 0,
707
+ class: "break-all font-mono text-xs"
708
+ }, Es = {
709
+ key: 0
710
+ }, Rs = {
711
+ class: "text-xs text-fm-color-typo-secondary"
712
+ }, Us = {
713
+ class: "font-semibold"
714
+ }, Ns = {
715
+ class: "text-xs text-fm-color-typo-secondary"
716
+ }, Ks = {
717
+ class: "font-semibold"
718
+ }, Ys = {
719
+ class: "text-xs text-fm-color-typo-secondary"
720
+ }, Bs = {
721
+ class: "font-semibold"
722
+ }, zs = {
723
+ key: 0
724
+ }, qs = {
725
+ key: 1
726
+ }, Js = {
727
+ class: "text-xs text-fm-color-typo-secondary"
728
+ }, Hs = {
729
+ class: "whitespace-pre-wrap break-all font-mono text-xs"
730
+ }, Ws = {
731
+ key: 3
732
+ }, Gs = {
733
+ class: "text-xs text-fm-color-typo-secondary"
734
+ }, Xs = {
735
+ class: "mt-4 space-y-4"
736
+ }, Qs = {
737
+ 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"
738
+ }, Zs = {
739
+ class: "text-xs font-semibold"
740
+ }, en = {
741
+ key: 0,
742
+ class: "text-fm-color-typo-secondary"
743
+ }, tn = {
744
+ key: 4
745
+ }, on = {
746
+ class: "text-xs text-fm-color-typo-secondary"
747
+ }, an = {
748
+ 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"
749
+ }, sn = {
750
+ key: 0,
751
+ class: "space-y-12 p-4 text-sm"
752
+ }, nn = {
753
+ class: "flex items-start justify-between gap-8 rounded-lg border border-fm-color-border-default p-12"
754
+ }, ln = {
755
+ class: "min-w-0 flex-1"
756
+ }, rn = {
757
+ class: "text-base font-bold leading-snug text-fm-color-typo-primary"
758
+ }, un = {
759
+ key: 0,
760
+ class: "text-xs text-fm-color-typo-secondary"
761
+ }, dn = {
762
+ class: "rounded-lg border border-fm-color-border-default p-12"
763
+ }, cn = {
764
+ class: "space-y-12"
765
+ }, fn = {
766
+ class: "text-xs text-fm-color-typo-secondary"
767
+ }, mn = {
768
+ class: "font-semibold"
769
+ }, vn = {
770
+ key: 0
771
+ }, pn = {
772
+ class: "text-xs text-fm-color-typo-secondary"
773
+ }, gn = {
774
+ class: "font-semibold"
775
+ }, hn = {
776
+ key: 1
777
+ }, yn = {
778
+ class: "text-xs text-fm-color-typo-secondary"
779
+ }, bn = {
780
+ class: "font-semibold"
781
+ }, _n = {
782
+ key: 0,
783
+ class: "rounded-lg border border-fm-color-border-default p-12"
784
+ }, xn = {
785
+ class: "text-xs text-fm-color-typo-secondary"
786
+ }, Ln = {
787
+ class: "whitespace-pre-line font-semibold text-fm-color-typo-error"
788
+ }, kn = {
789
+ class: "rounded-lg border border-fm-color-border-default"
790
+ }, Sn = {
791
+ class: "p-12"
792
+ }, wn = {
793
+ class: "text-base font-bold text-fm-color-typo-primary"
794
+ }, In = {
795
+ class: "p-12"
796
+ }, An = {
797
+ key: 0,
798
+ class: "divide-y divide-fm-color-border-default"
799
+ }, Fn = {
800
+ class: "flex flex-wrap items-center gap-8"
801
+ }, Mn = {
802
+ class: "break-all text-xs"
803
+ }, Dn = {
804
+ class: "break-all font-mono text-xs"
805
+ }, On = {
806
+ key: 0,
807
+ class: "text-fm-color-typo-success"
808
+ }, Cn = {
809
+ key: 1,
810
+ class: "text-fm-color-typo-error"
811
+ }, Tn = {
812
+ class: "text-fm-color-typo-error"
813
+ }, jn = {
814
+ class: "text-fm-color-typo-success"
815
+ }, Vn = {
816
+ key: 1,
817
+ class: "divide-y divide-fm-color-border-default"
818
+ }, $n = {
819
+ class: "flex flex-wrap items-center gap-8"
820
+ }, Pn = {
821
+ class: "break-all font-mono text-xs"
822
+ }, En = {
823
+ class: "space-y-4"
824
+ }, Rn = {
825
+ key: 0,
826
+ class: "text-fm-color-typo-success"
827
+ }, Un = {
828
+ key: 1,
829
+ class: "text-fm-color-typo-error"
830
+ }, Nn = {
831
+ class: "text-fm-color-typo-error"
832
+ }, Kn = {
833
+ class: "text-fm-color-typo-success"
834
+ }, Yn = {
835
+ key: 2,
836
+ class: "text-fm-color-typo-secondary"
837
+ }, Bn = {
838
+ key: 1,
839
+ class: "rounded-lg border border-fm-color-border-default"
840
+ }, zn = {
841
+ class: "text-base font-bold text-fm-color-typo-primary"
842
+ }, qn = {
843
+ class: "space-y-12 p-12"
844
+ }, Jn = {
845
+ key: 0
846
+ }, Hn = {
847
+ class: "text-xs text-fm-color-typo-secondary"
848
+ }, Wn = {
849
+ 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"
850
+ }, Gn = {
851
+ key: 1
852
+ }, Xn = {
853
+ class: "text-xs text-fm-color-typo-secondary"
854
+ }, Qn = {
855
+ 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"
856
+ }, Oe = 100, rt = 1e3, it = "__feedmeAdmin__", Zn = "D MMM YYYY h:mm A", el = "YYYY-MM-DD HH:mm", N = "YYYY-MM-DD", Vt = "audit-log-export-fields-v3", tl = /* @__PURE__ */ $t({
857
+ __name: "AuditLogList",
858
+ setup(t) {
859
+ const {
860
+ t: o,
861
+ te: n
862
+ } = dt(), r = Ho(), c = Wo(), d = ma(), b = ta(), {
863
+ restaurants: _
864
+ } = Jo(b), w = S(!1), D = S(!1), O = S([]), i = S(null), $ = S(!1), L = S({}), f = S(null), M = S(!1);
865
+ async function C(e) {
866
+ const a = Uint8Array.from(atob(e), (k) => k.charCodeAt(0)), m = new DecompressionStream("gzip"), x = m.writable.getWriter();
867
+ return await x.write(a), await x.close(), new Response(m.readable).text();
868
+ }
869
+ const p = S("");
870
+ let j = 0;
871
+ se(() => {
872
+ var e, a;
873
+ return (a = (e = i.value) == null ? void 0 : e.metadata) == null ? void 0 : a.requestBody;
874
+ }, async (e) => {
875
+ const a = ++j;
876
+ if (!e) {
877
+ p.value = "";
878
+ return;
879
+ }
880
+ if (typeof e == "object") {
881
+ p.value = JSON.stringify(e, null, 2);
882
+ return;
883
+ }
884
+ if (e.startsWith("gzip:")) {
885
+ try {
886
+ const m = await C(e.slice(5));
887
+ if (a !== j) return;
888
+ p.value = JSON.stringify(JSON.parse(m), null, 2);
889
+ } catch {
890
+ if (a !== j) return;
891
+ p.value = e;
892
+ }
893
+ return;
894
+ }
895
+ try {
896
+ p.value = JSON.stringify(JSON.parse(e), null, 2);
897
+ } catch {
898
+ p.value = e;
899
+ }
900
+ }, {
901
+ immediate: !0
902
+ });
903
+ async function K(e) {
904
+ if (!e) return;
905
+ let a = e;
906
+ if (e.startsWith("gzip:"))
907
+ try {
908
+ a = await C(e.slice(5));
909
+ } catch {
910
+ return e;
911
+ }
912
+ try {
913
+ return JSON.parse(a);
914
+ } catch {
915
+ return a;
916
+ }
917
+ }
918
+ function E(e) {
919
+ if (e === void 0) return "";
920
+ if (typeof e == "object" && e !== null)
921
+ try {
922
+ return JSON.stringify(e, null, 2);
923
+ } catch {
924
+ return String(e);
925
+ }
926
+ return String(e);
927
+ }
928
+ const X = S([]), Y = S([]), I = S(""), Q = S(""), H = S(!1);
929
+ let xe = 0;
930
+ se(f, async (e) => {
931
+ const a = ++xe;
932
+ if (X.value = [], Y.value = [], I.value = "", Q.value = "", H.value = !1, !e) return;
933
+ const [m, x] = await Promise.all([K(e.before), K(e.after)]);
934
+ a === xe && (Aa(e.changeNodes) ? Y.value = e.changeNodes.map(Ia) : X.value = La(m, x), I.value = E(m), Q.value = E(x));
935
+ });
936
+ function ct(e) {
937
+ return e === "added" ? "success" : e === "removed" ? "critical" : "warning";
938
+ }
939
+ function W(e) {
940
+ return o(e === "added" ? "auditLog.operation.added" : e === "removed" ? "auditLog.operation.removed" : "auditLog.operation.updated");
941
+ }
942
+ function Le(e) {
943
+ return e.replace(/\[[^\]]*\]/g, "");
944
+ }
945
+ function Nt(e) {
946
+ return e === "add" ? "success" : e === "remove" ? "critical" : "warning";
947
+ }
948
+ function Kt(e) {
949
+ return o(e === "add" ? "auditLog.operation.added" : e === "remove" ? "auditLog.operation.removed" : "auditLog.operation.updated");
950
+ }
951
+ function Yt(e) {
952
+ return Rt(o, n, e);
953
+ }
954
+ const ft = A(() => {
955
+ const e = [], a = /* @__PURE__ */ new Map();
956
+ for (const m of X.value) {
957
+ const x = Le(m.path), k = `${m.type}::${x}`;
958
+ let T = a.get(k);
959
+ T || (T = {
960
+ groupKey: k,
961
+ displayKey: x,
962
+ type: m.type,
963
+ rows: []
964
+ }, a.set(k, T), e.push(T)), T.rows.push(m);
965
+ }
966
+ return e;
967
+ }), Ve = S(1), Bt = S(!1), Be = S(0), mt = A(() => Math.max(1, Math.ceil(Be.value / Oe))), vt = V().format("YYYY-MM-DD"), ne = S({
968
+ startDate: `${vt} 00:00`,
969
+ endDate: `${vt} 23:59`
970
+ }), fe = S(), Z = S(), le = S(), re = S(), ie = S("all");
971
+ function zt(e) {
972
+ return typeof e == "string" ? [e] : Array.isArray(e) ? e.filter((a) => typeof a == "string") : [];
973
+ }
974
+ const pt = De.filter((e) => e.key !== "all").map((e) => e.key);
975
+ function $e(e) {
976
+ const a = De.find((m) => m.key !== "all" && m.subjectPrefixes.some((x) => e.startsWith(x)));
977
+ return (a == null ? void 0 : a.key) ?? "other";
978
+ }
979
+ function gt(e) {
980
+ const a = pt.indexOf(e);
981
+ return a === -1 ? pt.length : a;
982
+ }
983
+ const qt = ["all", "report", "hrm", "payment"], Jt = A(() => De.filter(({
984
+ key: e
985
+ }) => !c.isFoodCourt.value || qt.includes(e)).map(({
986
+ key: e
987
+ }) => ({
988
+ label: o(`auditLog.modules.${e}`),
989
+ value: e
990
+ }))), Pe = A(() => De.find((e) => e.key === ie.value) ?? De[0]), Ht = A(() => ie.value === "all"), q = A(() => ie.value === "pos"), pe = A(() => Pe.value.sources ?? []);
991
+ se(q, (e) => {
992
+ e && b.readRestaurants();
993
+ }, {
994
+ immediate: !0
995
+ });
996
+ const ee = S([]), Wt = A(() => _.value.map((e) => ({
997
+ label: e.profile.name,
998
+ value: String(e._id)
999
+ }))), Gt = A(() => Object.fromEntries(_.value.map((e) => [String(e._id), e.profile.name])));
1000
+ se(ie, () => {
1001
+ ee.value = [];
1002
+ });
1003
+ const ke = S([]), Ee = S(!1), Xt = A(() => [...Ee.value ? [{
1004
+ label: o("auditLog.user.feedmeAdmin"),
1005
+ value: it
1006
+ }] : [], ...d.members.map((e) => ({
1007
+ label: e.name,
1008
+ value: e.doc.userId
1009
+ })), ...ke.value.map((e) => ({
1010
+ label: `${e.name} (${o("auditLog.user.feedmeAdmin")})`,
1011
+ value: e.userId
1012
+ }))]), ue = A(() => wa(fe.value, q.value, it)), ze = S(""), te = S(""), Qt = oa(ze, (e) => {
1013
+ te.value = e.trim();
1014
+ });
1015
+ Bo(Qt);
1016
+ const {
1017
+ onSheetOpened: Zt,
1018
+ onSheetClosed: eo,
1019
+ copyLink: to
1020
+ } = ga({
1021
+ logs: O,
1022
+ selectedLog: i,
1023
+ isSheetOpen: $,
1024
+ businessId: () => {
1025
+ var e;
1026
+ return (e = r.currentBusiness.value) == null ? void 0 : e._id;
1027
+ }
1028
+ }), me = A(() => {
1029
+ const e = te.value.toLowerCase();
1030
+ if (!e) return [];
1031
+ const a = /* @__PURE__ */ new Set();
1032
+ for (const m of d.members) {
1033
+ const x = m.doc.userId;
1034
+ ((d.userIdToName[x] ?? "").toLowerCase().includes(e) || (d.userIdToEmail[x] ?? "").toLowerCase().includes(e) || (d.userIdToPhone[x] ?? "").toLowerCase().includes(e)) && a.add(x);
1035
+ }
1036
+ for (const m of ke.value)
1037
+ m.name.toLowerCase().includes(e) && a.add(m.userId);
1038
+ return [...a];
1039
+ }), qe = A(() => {
1040
+ const e = Dt.flatMap((k) => zt(k.subject).map((T) => ({
1041
+ label: k.label,
1042
+ value: T
1043
+ }))), a = Object.entries(Mt).map(([k, T]) => ({
1044
+ label: T,
1045
+ value: k
1046
+ })), m = /* @__PURE__ */ new Set(), x = [];
1047
+ for (const k of [...e, ...a])
1048
+ if (!m.has(k.value)) {
1049
+ m.add(k.value);
1050
+ const T = $e(k.value);
1051
+ x.push({
1052
+ ...k,
1053
+ group: o(`auditLog.modules.${T}`)
1054
+ });
1055
+ }
1056
+ return x.sort((k, T) => gt($e(k.value)) - gt($e(T.value)));
1057
+ }), ge = A(() => {
1058
+ const e = te.value.toLowerCase();
1059
+ if (!e) return [];
1060
+ const a = /* @__PURE__ */ new Set();
1061
+ for (const m of qe.value)
1062
+ m.label.toLowerCase().includes(e) && a.add(m.value);
1063
+ return [...a];
1064
+ }), oo = A(() => Ht.value ? qe.value : qe.value.filter((e) => $e(e.value) === ie.value));
1065
+ function ao(e, a) {
1066
+ const m = a.toLowerCase();
1067
+ return e.label.toLowerCase().includes(m) || e.value.replace(/^business::/, "").toLowerCase().includes(m) ? !0 : e.value.toLowerCase().includes(m);
1068
+ }
1069
+ const G = A(() => ({
1070
+ manage: o("auditLog.action.manage"),
1071
+ create: o("auditLog.action.create"),
1072
+ read: o("auditLog.action.read"),
1073
+ update: o("auditLog.action.update"),
1074
+ delete: o("auditLog.action.delete")
1075
+ })), so = A(() => [{
1076
+ label: G.value.manage,
1077
+ value: "manage"
1078
+ }, {
1079
+ label: G.value.create,
1080
+ value: "create"
1081
+ }, {
1082
+ label: G.value.read,
1083
+ value: "read"
1084
+ }, {
1085
+ label: G.value.update,
1086
+ value: "update"
1087
+ }, {
1088
+ label: G.value.delete,
1089
+ value: "delete"
1090
+ }]), Re = A(() => ({
1091
+ allowed: o("auditLog.outcome.success"),
1092
+ denied: o("auditLog.outcome.failed"),
1093
+ skipped: o("auditLog.outcome.skipped")
1094
+ })), Je = A(() => {
1095
+ var e;
1096
+ return ((e = r.sessionUser.value) == null ? void 0 : e.isInternal) ?? !1;
1097
+ });
1098
+ function ht(e) {
1099
+ return !Je.value && e === "skipped" ? "allowed" : e;
1100
+ }
1101
+ function He(e) {
1102
+ return !(e != null && e.length) || Je.value ? e : e.includes("allowed") ? [.../* @__PURE__ */ new Set([...e, "skipped"])] : e;
1103
+ }
1104
+ const no = A(() => [{
1105
+ label: Re.value.allowed,
1106
+ value: "allowed"
1107
+ }, {
1108
+ label: Re.value.denied,
1109
+ value: "denied"
1110
+ }, ...Je.value ? [{
1111
+ label: Re.value.skipped,
1112
+ value: "skipped"
1113
+ }] : []]), lo = A(() => ({
1114
+ admin: o("auditLog.detail.resolvedFromValue.admin"),
1115
+ staff: o("auditLog.detail.resolvedFromValue.staff"),
1116
+ permissionSet: o("auditLog.detail.resolvedFromValue.permissionSet"),
1117
+ systemPermissionSet: o("auditLog.detail.resolvedFromValue.systemPermissionSet"),
1118
+ custom: o("auditLog.detail.resolvedFromValue.custom"),
1119
+ "no-match": o("auditLog.detail.resolvedFromValue.noMatch"),
1120
+ unknown: o("auditLog.detail.resolvedFromValue.unknown")
1121
+ })), ro = A(() => ({
1122
+ GET: G.value.read,
1123
+ POST: G.value.create,
1124
+ PUT: G.value.update,
1125
+ PATCH: G.value.update,
1126
+ DELETE: G.value.delete
1127
+ })), io = {
1128
+ allowed: "success",
1129
+ denied: "critical",
1130
+ skipped: "warning"
1131
+ };
1132
+ function Ue(e) {
1133
+ return V(e).format(Zn);
1134
+ }
1135
+ const uo = A(() => {
1136
+ const {
1137
+ startDate: e,
1138
+ endDate: a
1139
+ } = ne.value;
1140
+ return e && a ? `${Ue(e)} – ${Ue(a)}` : e ? Ue(e) : a ? Ue(a) : o("auditLog.dateRange.placeholder");
1141
+ }), co = A(() => [{
1142
+ label: o("date.predefinedRanges.today"),
1143
+ value: {
1144
+ startDate: V().format(N),
1145
+ endDate: V().format(N)
1146
+ }
1147
+ }, {
1148
+ label: o("date.predefinedRanges.yesterday"),
1149
+ value: {
1150
+ startDate: V().subtract(1, "day").format(N),
1151
+ endDate: V().subtract(1, "day").format(N)
1152
+ }
1153
+ }, {
1154
+ label: o("date.predefinedRanges.thisWeek"),
1155
+ value: {
1156
+ startDate: V().startOf("week").format(N),
1157
+ endDate: V().endOf("week").format(N)
1158
+ }
1159
+ }, {
1160
+ label: o("date.predefinedRanges.lastWeek"),
1161
+ value: {
1162
+ startDate: V().subtract(1, "week").startOf("week").format(N),
1163
+ endDate: V().subtract(1, "week").endOf("week").format(N)
1164
+ }
1165
+ }, {
1166
+ label: o("date.predefinedRanges.last7Days"),
1167
+ value: {
1168
+ startDate: V().subtract(7, "day").format(N),
1169
+ endDate: V().subtract(1, "day").format(N)
1170
+ }
1171
+ }, {
1172
+ label: o("date.predefinedRanges.thisMonth"),
1173
+ value: {
1174
+ startDate: V().startOf("month").format(N),
1175
+ endDate: V().endOf("month").format(N)
1176
+ }
1177
+ }, {
1178
+ label: o("date.predefinedRanges.lastMonth"),
1179
+ value: {
1180
+ startDate: V().subtract(1, "month").startOf("month").format(N),
1181
+ endDate: V().subtract(1, "month").endOf("month").format(N)
1182
+ }
1183
+ }]);
1184
+ function We(e) {
1185
+ var a;
1186
+ return ((a = Dt.find((m) => m.subject === e)) == null ? void 0 : a.label) ?? Mt[e] ?? ra[e];
1187
+ }
1188
+ function Se(e) {
1189
+ var m, x;
1190
+ if (e.actorType === "posUser")
1191
+ return ka(e, o);
1192
+ if (e.actorType === "portalUser")
1193
+ return e.actorName ?? e.userId;
1194
+ if (e.actorType === "feedmeAdmin")
1195
+ return (m = r.sessionUser.value) != null && m.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin");
1196
+ const a = d.userIdToName[e.userId];
1197
+ return a || (d.hasLoaded ? (x = r.sessionUser.value) != null && x.isInternal ? `${e.actorName ?? e.userId} (${o("auditLog.user.feedmeAdmin")})` : o("auditLog.user.feedmeAdmin") : e.userId);
1198
+ }
1199
+ function yt(e) {
1200
+ return e.actorType === "posUser" ? q.value ? "" : lt(e, o) : d.userIdToPhone[e.userId] || "-";
1201
+ }
1202
+ function fo(e) {
1203
+ return d.userIdToEmail[e.userId] || "-";
1204
+ }
1205
+ function bt(e) {
1206
+ return V(e).format("DD MMM YYYY, HH:mm");
1207
+ }
1208
+ function Ge(e) {
1209
+ return V(e).format("DD MMM YYYY, HH:mm:ss").toUpperCase();
1210
+ }
1211
+ function _t(e) {
1212
+ return G.value[e] ?? e;
1213
+ }
1214
+ function xt(e) {
1215
+ const a = ut(o, {
1216
+ eventKey: e.eventKey,
1217
+ params: e.params,
1218
+ operationLabel: e.metadata.operationLabel ?? _t(e.action)
1219
+ });
1220
+ return e.actorType === "posUser" && !q.value ? a + Sa(e, o) : a;
1221
+ }
1222
+ function Lt(e) {
1223
+ return ut(o, e) || o("auditLog.operation.unlabeled");
1224
+ }
1225
+ function mo(e) {
1226
+ return We(e.subject) ?? e.subject;
1227
+ }
1228
+ function Xe(e) {
1229
+ return Re.value[ht(e)];
1230
+ }
1231
+ function kt(e) {
1232
+ return io[ht(e)] ?? "neutral";
1233
+ }
1234
+ function vo(e) {
1235
+ return lo.value[e] ?? e;
1236
+ }
1237
+ function po(e) {
1238
+ return e.metadata.requestMethod ? ro.value[e.metadata.requestMethod] ?? e.metadata.requestMethod : _t(e.action);
1239
+ }
1240
+ function St(e) {
1241
+ const a = String(e ?? "");
1242
+ return `"${(/^[=+\-@\t\r]/.test(a) ? `'${a}` : a).replace(/"/g, '""')}"`;
1243
+ }
1244
+ const Qe = [{
1245
+ key: "timestamp",
1246
+ labelKey: "auditLog.exportFields.timestamp",
1247
+ getValue: (e) => bt(e.timestamp),
1248
+ defaultSelected: !0
1249
+ }, {
1250
+ key: "userName",
1251
+ labelKey: "auditLog.exportFields.userName",
1252
+ getValue: (e) => Se(e),
1253
+ defaultSelected: !0
1254
+ }, {
1255
+ key: "userPhone",
1256
+ labelKey: "auditLog.exportFields.userPhone",
1257
+ getValue: (e) => yt(e),
1258
+ defaultSelected: !0
1259
+ }, {
1260
+ key: "subject",
1261
+ labelKey: "auditLog.exportFields.subject",
1262
+ getValue: (e) => We(e.subject) ?? e.subject,
1263
+ defaultSelected: !0
1264
+ }, {
1265
+ key: "action",
1266
+ labelKey: "auditLog.exportFields.action",
1267
+ getValue: (e) => e.action,
1268
+ defaultSelected: !0
1269
+ }, {
1270
+ key: "operation",
1271
+ labelKey: "auditLog.exportFields.operation",
1272
+ getValue: (e) => xt(e),
1273
+ defaultSelected: !0
1274
+ }, {
1275
+ key: "outcome",
1276
+ labelKey: "auditLog.exportFields.outcome",
1277
+ getValue: (e) => Xe(e.outcome),
1278
+ defaultSelected: !0
1279
+ }, {
1280
+ key: "operationEvents",
1281
+ labelKey: "auditLog.exportFields.operationEvents",
1282
+ getValue: (e) => Fa(o, e.operations),
1283
+ defaultSelected: !0
1284
+ }, {
1285
+ key: "changes",
1286
+ labelKey: "auditLog.exportFields.changes",
1287
+ getValue: (e) => Da(o, n, e.operations),
1288
+ defaultSelected: !1
1289
+ }, {
1290
+ key: "businessId",
1291
+ labelKey: "auditLog.exportFields.businessId",
1292
+ getValue: (e) => e.businessId,
1293
+ defaultSelected: !1
1294
+ }, {
1295
+ key: "restaurantId",
1296
+ labelKey: "auditLog.exportFields.restaurantId",
1297
+ getValue: (e) => e.restaurantId,
1298
+ defaultSelected: !1
1299
+ }, {
1300
+ key: "country",
1301
+ labelKey: "auditLog.exportFields.country",
1302
+ getValue: (e) => e.country,
1303
+ defaultSelected: !1
1304
+ }, {
1305
+ key: "resolvedFrom",
1306
+ labelKey: "auditLog.exportFields.resolvedFrom",
1307
+ getValue: (e) => {
1308
+ var a;
1309
+ return (a = e.metadata) == null ? void 0 : a.resolvedFrom;
1310
+ },
1311
+ defaultSelected: !1
1312
+ }, {
1313
+ key: "requestMethod",
1314
+ labelKey: "auditLog.exportFields.requestMethod",
1315
+ getValue: (e) => {
1316
+ var a;
1317
+ return (a = e.metadata) == null ? void 0 : a.requestMethod;
1318
+ },
1319
+ defaultSelected: !1
1320
+ }, {
1321
+ key: "requestPath",
1322
+ labelKey: "auditLog.exportFields.requestPath",
1323
+ getValue: (e) => {
1324
+ var a;
1325
+ return (a = e.metadata) == null ? void 0 : a.requestPath;
1326
+ },
1327
+ defaultSelected: !1
1328
+ }, {
1329
+ key: "traceId",
1330
+ labelKey: "auditLog.exportFields.traceId",
1331
+ getValue: (e) => e.traceId ?? "",
1332
+ defaultSelected: !1
1333
+ }];
1334
+ function go() {
1335
+ try {
1336
+ const e = localStorage.getItem(Vt);
1337
+ if (e) {
1338
+ const a = JSON.parse(e);
1339
+ if (Array.isArray(a) && a.length > 0) return new Set(a);
1340
+ }
1341
+ } catch {
1342
+ }
1343
+ return new Set(Qe.filter((e) => e.defaultSelected).map((e) => e.key));
1344
+ }
1345
+ const he = S(go());
1346
+ function ho(e) {
1347
+ const a = new Set(he.value);
1348
+ if (a.has(e)) {
1349
+ if (a.size <= 1) return;
1350
+ a.delete(e);
1351
+ } else
1352
+ a.add(e);
1353
+ he.value = a;
1354
+ try {
1355
+ localStorage.setItem(Vt, JSON.stringify([...a]));
1356
+ } catch {
1357
+ }
1358
+ }
1359
+ async function yo() {
1360
+ var e, a, m;
1361
+ if (!D.value) {
1362
+ D.value = !0;
1363
+ try {
1364
+ const {
1365
+ startDate: x,
1366
+ endDate: k
1367
+ } = ne.value, T = Pe.value.subjectPrefixes, U = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace("T", " "), ae = k ? de(k) : null, et = ae && ae < U ? ae : U, tt = {
1368
+ ...x ? {
1369
+ from: de(x)
1370
+ } : {},
1371
+ to: et,
1372
+ ...ue.value.userIds.length ? {
1373
+ userIds: ue.value.userIds
1374
+ } : {},
1375
+ ...ue.value.feedmeAdminActors ? {
1376
+ feedmeAdminActors: !0
1377
+ } : {},
1378
+ ...(e = Z.value) != null && e.length ? {
1379
+ subjects: Z.value
1380
+ } : {},
1381
+ ...T.length ? {
1382
+ subjectPrefixes: [...T]
1383
+ } : {},
1384
+ ...pe.value.length ? {
1385
+ sources: [...pe.value]
1386
+ } : {},
1387
+ ...q.value && ee.value.length ? {
1388
+ restaurantIds: [...ee.value]
1389
+ } : {},
1390
+ ...(a = re.value) != null && a.length ? {
1391
+ actions: re.value
1392
+ } : {},
1393
+ ...(m = le.value) != null && m.length ? {
1394
+ outcomes: He(le.value)
1395
+ } : {},
1396
+ ...te.value ? {
1397
+ search: te.value
1398
+ } : {},
1399
+ ...me.value.length ? {
1400
+ searchUserIds: me.value
1401
+ } : {},
1402
+ ...ge.value.length ? {
1403
+ searchSubjects: ge.value
1404
+ } : {}
1405
+ }, Ie = [];
1406
+ let Ne = 0;
1407
+ for (; ; ) {
1408
+ const J = await Ce.read({
1409
+ ...tt,
1410
+ limit: rt,
1411
+ offset: Ne
1412
+ });
1413
+ if (Ie.push(...J), J.length < rt) break;
1414
+ Ne += rt;
1415
+ }
1416
+ const Ae = Qe.filter((J) => he.value.has(J.key)), h = Ae.map((J) => o(J.labelKey)), P = Ie.map((J) => Ae.map((Uo) => Uo.getValue(J) ?? "")), ot = -(/* @__PURE__ */ new Date()).getTimezoneOffset(), Co = ot >= 0 ? "+" : "-", To = String(Math.floor(Math.abs(ot) / 60)).padStart(2, "0"), jo = String(Math.abs(ot) % 60).padStart(2, "0"), Vo = `UTC${Co}${To}:${jo}`, At = c.name.value || "", $o = [x, k].filter(Boolean).join(" – "), Po = [...[[o("auditLog.title")], [`${o("auditLog.frontMatter.date")}: ${$o}`], ...At ? [[`${o("auditLog.frontMatter.business")}: ${At}`]] : [], [`${o("auditLog.frontMatter.generatedBy")}: ${V().format("DD MMM YYYY, HH:mm")} (${Vo})`], []].map((J) => J.map(St).join(",")), ...[h, ...P].map((J) => J.map(St).join(","))].join(`
1417
+ `), Eo = `audit-log_${(c.name.value || "business").replace(/[^a-z0-9_-]+/gi, "_")}_${V().format("YYYYMMDD_HHmmss")}.csv`, Ro = new Blob([`\uFEFF${Po}`], {
1418
+ type: "text/csv;charset=utf-8;"
1419
+ }), Ft = window.URL.createObjectURL(Ro), Fe = document.createElement("a");
1420
+ Fe.href = Ft, Fe.download = Eo, document.body.appendChild(Fe), Fe.click(), Fe.remove(), window.URL.revokeObjectURL(Ft);
1421
+ } finally {
1422
+ D.value = !1;
1423
+ }
1424
+ }
1425
+ }
1426
+ function oe(e) {
1427
+ return "status" in e;
1428
+ }
1429
+ function bo(e) {
1430
+ return Tt(e) ? y(ve.FmTooltip, {
1431
+ variant: "plain",
1432
+ placement: "top"
1433
+ }, {
1434
+ default: () => y(ve.FmIcon, {
1435
+ name: "error",
1436
+ size: "sm",
1437
+ class: "cursor-help text-fm-color-typo-error"
1438
+ }, null),
1439
+ content: () => o("auditLog.operation.partialFailure")
1440
+ }) : null;
1441
+ }
1442
+ function _o(e) {
1443
+ var m;
1444
+ const a = e.original;
1445
+ return e.depth === 0 && !oe(a) && !!((m = a.operations) != null && m.length);
1446
+ }
1447
+ function xo(e) {
1448
+ return oe(e) ? void 0 : e.operations;
1449
+ }
1450
+ const we = [{
1451
+ accessorKey: "timestamp",
1452
+ header: () => o("auditLog.columns.timestamp"),
1453
+ cell(e) {
1454
+ return bt(e.row.original.timestamp);
1455
+ }
1456
+ }, {
1457
+ accessorKey: "userId",
1458
+ header: () => o("auditLog.columns.user"),
1459
+ enableSorting: !1,
1460
+ size: 220,
1461
+ cell(e) {
1462
+ const a = e.row.original;
1463
+ return oe(a) ? null : y("div", {
1464
+ class: "flex items-center gap-8"
1465
+ }, [y(ve.FmAvatar, {
1466
+ name: Se(a),
1467
+ initials: aa(Se(a)),
1468
+ size: "sm",
1469
+ class: "shrink-0"
1470
+ }, null), y("div", {
1471
+ class: "min-w-0"
1472
+ }, [y("p", {
1473
+ class: "truncate font-semibold"
1474
+ }, [Se(a)]), y("p", {
1475
+ class: "truncate text-fm-color-typo-secondary"
1476
+ }, [yt(a)])])]);
1477
+ }
1478
+ }, {
1479
+ accessorKey: "subject",
1480
+ header: () => o("auditLog.columns.subject"),
1481
+ cell(e) {
1482
+ const a = e.row.original;
1483
+ return oe(a) ? y("span", {
1484
+ class: "text-fm-color-typo-secondary"
1485
+ }, [o("auditLog.operation.rowHint")]) : We(a.subject) ?? a.subject;
1486
+ }
1487
+ }, {
1488
+ accessorKey: "action",
1489
+ header: () => o("auditLog.columns.action"),
1490
+ enableSorting: !1,
1491
+ size: 280,
1492
+ meta: {
1493
+ cellSpanClass: "audit-log-action-label"
1494
+ },
1495
+ cell(e) {
1496
+ var U;
1497
+ const a = e.row.original;
1498
+ if (oe(a))
1499
+ return y("span", {
1500
+ class: "audit-op-marker flex flex-wrap items-baseline gap-4"
1501
+ }, [y("span", {
1502
+ class: "text-fm-color-typo-secondary"
1503
+ }, [ye("↳")]), y("span", {
1504
+ class: "font-semibold"
1505
+ }, [Lt(a)]), a.entityId ? y("span", {
1506
+ class: "text-fm-color-typo-secondary"
1507
+ }, [ye("· "), a.entityId]) : null, a.status === "failed" && a.errorMessage ? y("span", {
1508
+ class: "text-fm-color-typo-error"
1509
+ }, [ye("· "), a.errorMessage]) : null]);
1510
+ const m = ((U = a.operations) == null ? void 0 : U.length) ?? 0, x = (ae) => {
1511
+ ae.stopPropagation(), e.row.getToggleExpandedHandler()();
1512
+ }, k = {
1513
+ variant: "tertiary",
1514
+ icon: e.row.getIsExpanded() ? "keyboard_arrow_up" : "keyboard_arrow_down",
1515
+ "aria-label": o("auditLog.operation.toggle"),
1516
+ class: "ml-auto shrink-0",
1517
+ onClick: x
1518
+ }, T = ve.FmButton;
1519
+ return y("span", {
1520
+ class: "flex items-center gap-8"
1521
+ }, [y("span", null, [xt(a)]), m > 0 ? y("span", {
1522
+ class: "cursor-pointer",
1523
+ onClick: x
1524
+ }, [y(ve.FmChip, {
1525
+ variant: "neutral",
1526
+ compact: !0,
1527
+ label: o("auditLog.operation.badge", {
1528
+ count: m
1529
+ })
1530
+ }, null)]) : null, e.row.getCanExpand() ? y(T, k, null) : null]);
1531
+ }
1532
+ }, {
1533
+ accessorKey: "outcome",
1534
+ header: () => o("auditLog.columns.outcome"),
1535
+ enableSorting: !1,
1536
+ cell(e) {
1537
+ const a = e.row.original;
1538
+ return oe(a) ? y(ve.FmChip, {
1539
+ variant: a.status === "failed" ? "critical" : "success",
1540
+ label: a.status === "failed" ? o("auditLog.outcome.failed") : o("auditLog.outcome.success"),
1541
+ compact: !0
1542
+ }, null) : y("span", {
1543
+ class: "flex items-center gap-4"
1544
+ }, [y(ve.FmChip, {
1545
+ variant: kt(a.outcome),
1546
+ label: Xe(a.outcome),
1547
+ compact: !0
1548
+ }, null), bo(a)]);
1549
+ }
1550
+ }], Lo = [
1551
+ we[0],
1552
+ // timestamp: Date
1553
+ we.find((e) => e.accessorKey === "userId"),
1554
+ // User: getUserName -> posActorLabel for posUser rows
1555
+ {
1556
+ accessorKey: "restaurantId",
1557
+ header: () => o("auditLog.columns.restaurant"),
1558
+ enableSorting: !1,
1559
+ cell(e) {
1560
+ const a = e.row.original;
1561
+ return oe(a) ? null : a.restaurantId && Gt.value[a.restaurantId] || a.restaurantId || "-";
1562
+ }
1563
+ },
1564
+ {
1565
+ accessorKey: "deviceId",
1566
+ header: () => o("auditLog.columns.device"),
1567
+ enableSorting: !1,
1568
+ cell(e) {
1569
+ const a = e.row.original;
1570
+ return oe(a) ? null : lt(a, o);
1571
+ }
1572
+ },
1573
+ {
1574
+ accessorKey: "approverName",
1575
+ header: () => o("auditLog.columns.approver"),
1576
+ enableSorting: !1,
1577
+ cell(e) {
1578
+ const a = e.row.original;
1579
+ return oe(a) ? null : jt(a, o);
1580
+ }
1581
+ },
1582
+ we.find((e) => e.accessorKey === "action"),
1583
+ // Action Description: event line
1584
+ we.find((e) => e.accessorKey === "outcome")
1585
+ // Status
1586
+ ], ko = A(() => q.value ? Lo : we);
1587
+ function de(e) {
1588
+ const a = V(e, el);
1589
+ return new Date(a.year(), a.month(), a.date(), a.hour(), a.minute(), 0).toISOString().slice(0, 19).replace("T", " ");
1590
+ }
1591
+ async function wt() {
1592
+ var e, a, m;
1593
+ w.value = !0;
1594
+ try {
1595
+ const {
1596
+ startDate: x,
1597
+ endDate: k
1598
+ } = ne.value, T = (Ve.value - 1) * Oe, U = Pe.value.subjectPrefixes, ae = await Ce.read({
1599
+ limit: Oe,
1600
+ offset: T,
1601
+ ...x ? {
1602
+ from: de(x)
1603
+ } : {},
1604
+ ...k ? {
1605
+ to: de(k)
1606
+ } : {},
1607
+ ...ue.value.userIds.length ? {
1608
+ userIds: ue.value.userIds
1609
+ } : {},
1610
+ ...ue.value.feedmeAdminActors ? {
1611
+ feedmeAdminActors: !0
1612
+ } : {},
1613
+ ...(e = Z.value) != null && e.length ? {
1614
+ subjects: Z.value
1615
+ } : {},
1616
+ ...U.length ? {
1617
+ subjectPrefixes: [...U]
1618
+ } : {},
1619
+ ...pe.value.length ? {
1620
+ sources: [...pe.value]
1621
+ } : {},
1622
+ ...q.value && ee.value.length ? {
1623
+ restaurantIds: [...ee.value]
1624
+ } : {},
1625
+ ...(a = re.value) != null && a.length ? {
1626
+ actions: re.value
1627
+ } : {},
1628
+ ...(m = le.value) != null && m.length ? {
1629
+ outcomes: He(le.value)
1630
+ } : {},
1631
+ ...te.value ? {
1632
+ search: te.value
1633
+ } : {},
1634
+ ...me.value.length ? {
1635
+ searchUserIds: me.value
1636
+ } : {},
1637
+ ...ge.value.length ? {
1638
+ searchSubjects: ge.value
1639
+ } : {}
1640
+ });
1641
+ O.value = ae, Bt.value = ae.length === Oe, L.value = {};
1642
+ } finally {
1643
+ w.value = !1;
1644
+ }
1645
+ }
1646
+ const It = A(() => JSON.stringify({
1647
+ businessId: c.id.value ?? "",
1648
+ dateRange: ne.value,
1649
+ users: [...fe.value ?? []].sort(),
1650
+ subjects: [...Z.value ?? []].sort(),
1651
+ outcomes: [...le.value ?? []].sort(),
1652
+ actions: [...re.value ?? []].sort(),
1653
+ moduleKey: ie.value,
1654
+ restaurantIds: [...ee.value].sort(),
1655
+ search: te.value,
1656
+ // Member/feedme-admin-actor lists resolve asynchronously (and actors refetch on
1657
+ // every date-range change), so searchUserIds can change after the key above is
1658
+ // computed — include it explicitly or a late-arriving match never refetches.
1659
+ searchUserIds: [...me.value].sort()
1660
+ }));
1661
+ async function So() {
1662
+ var x, k, T;
1663
+ const {
1664
+ startDate: e,
1665
+ endDate: a
1666
+ } = ne.value, m = Pe.value.subjectPrefixes;
1667
+ Be.value = await Ce.count({
1668
+ ...e ? {
1669
+ from: de(e)
1670
+ } : {},
1671
+ ...a ? {
1672
+ to: de(a)
1673
+ } : {},
1674
+ ...ue.value.userIds.length ? {
1675
+ userIds: ue.value.userIds
1676
+ } : {},
1677
+ ...ue.value.feedmeAdminActors ? {
1678
+ feedmeAdminActors: !0
1679
+ } : {},
1680
+ ...(x = Z.value) != null && x.length ? {
1681
+ subjects: Z.value
1682
+ } : {},
1683
+ ...m.length ? {
1684
+ subjectPrefixes: [...m]
1685
+ } : {},
1686
+ ...pe.value.length ? {
1687
+ sources: [...pe.value]
1688
+ } : {},
1689
+ ...q.value && ee.value.length ? {
1690
+ restaurantIds: [...ee.value]
1691
+ } : {},
1692
+ ...(k = re.value) != null && k.length ? {
1693
+ actions: re.value
1694
+ } : {},
1695
+ ...(T = le.value) != null && T.length ? {
1696
+ outcomes: He(le.value)
1697
+ } : {},
1698
+ ...te.value ? {
1699
+ search: te.value
1700
+ } : {},
1701
+ ...me.value.length ? {
1702
+ searchUserIds: me.value
1703
+ } : {},
1704
+ ...ge.value.length ? {
1705
+ searchSubjects: ge.value
1706
+ } : {}
1707
+ });
1708
+ }
1709
+ se(It, async () => {
1710
+ Ve.value = 1, c.id.value && await Promise.all([So(), wt()]);
1711
+ }, {
1712
+ immediate: !0
1713
+ }), se(ie, () => {
1714
+ Z.value = void 0, q.value && (fe.value = void 0);
1715
+ });
1716
+ let Ze = !1;
1717
+ async function wo({
1718
+ pageIndex: e
1719
+ }) {
1720
+ if (c.id.value && !(e === 0 && Ve.value === 1) && !Ze) {
1721
+ Ze = !0, Ve.value = e + 1;
1722
+ try {
1723
+ await wt();
1724
+ } finally {
1725
+ Ze = !1;
1726
+ }
1727
+ }
1728
+ }
1729
+ function Io(e) {
1730
+ if (oe(e)) {
1731
+ Fo(e);
1732
+ return;
1733
+ }
1734
+ i.value = e, $.value = !0, Zt(e);
1735
+ }
1736
+ function Ao() {
1737
+ $.value = !1, i.value = null, eo();
1738
+ }
1739
+ function Fo(e) {
1740
+ f.value = e, M.value = !0;
1741
+ }
1742
+ function Mo() {
1743
+ M.value = !1, f.value = null;
1744
+ }
1745
+ se(c.id, (e) => {
1746
+ e && d.readTeamMembers();
1747
+ }, {
1748
+ immediate: !0
1749
+ });
1750
+ function Do() {
1751
+ const e = fe.value;
1752
+ if (!(e != null && e.length)) return;
1753
+ const a = new Set(ke.value.map((k) => k.userId)), m = new Set(d.members.map((k) => k.doc.userId)), x = e.filter((k) => k === it ? Ee.value : d.hasLoaded ? m.has(k) || a.has(k) : !0);
1754
+ x.length !== e.length && (fe.value = x.length ? x : void 0);
1755
+ }
1756
+ async function Oo() {
1757
+ if (!c.id.value) return;
1758
+ const {
1759
+ startDate: e,
1760
+ endDate: a
1761
+ } = ne.value;
1762
+ try {
1763
+ const {
1764
+ actors: m,
1765
+ showFeedmeAdminFilter: x
1766
+ } = await Ce.getFeedmeAdminFilter({
1767
+ ...e ? {
1768
+ from: de(e)
1769
+ } : {},
1770
+ ...a ? {
1771
+ to: de(a)
1772
+ } : {}
1773
+ });
1774
+ ke.value = m, Ee.value = x;
1775
+ } catch {
1776
+ ke.value = [], Ee.value = !1;
1777
+ }
1778
+ Do();
1779
+ }
1780
+ return se(() => ({
1781
+ businessId: c.id.value,
1782
+ range: ne.value
1783
+ }), () => Oo(), {
1784
+ immediate: !0,
1785
+ deep: !0
1786
+ }), (e, a) => {
1787
+ const m = R("FmSpacer"), x = R("FmButton"), k = R("FmMenuItem"), T = R("FmMenu"), U = R("FmChip"), ae = R("FmDateRangePicker"), et = R("FmSearch"), tt = R("FmTable"), Ie = R("FmIcon"), Ne = R("FmTooltip"), Ae = R("FmSideSheet");
1788
+ return v(), g(z, null, [y(Qo, {
1789
+ heading: u(o)("auditLog.title")
1790
+ }, {
1791
+ "append-heading": B(() => [y(m), y(x, {
1792
+ variant: "primary",
1793
+ "prepend-icon": "upload",
1794
+ label: u(o)("auditLog.export"),
1795
+ disabled: O.value.length === 0 || D.value || u(d).isLoading || u(d).members.length === 0,
1796
+ loading: D.value,
1797
+ onClick: yo
1798
+ }, null, 8, ["label", "disabled", "loading"]), y(T, {
1799
+ "close-on-click": !1,
1800
+ "z-index": 50
1801
+ }, {
1802
+ "menu-button": B(() => [y(x, {
1803
+ variant: "tertiary",
1804
+ icon: "settings",
1805
+ "aria-label": u(o)("auditLog.exportSettings.title"),
1806
+ disabled: D.value
1807
+ }, null, 8, ["aria-label", "disabled"])]),
1808
+ default: B(() => [s("div", Oa, [s("p", Ca, l(u(o)("auditLog.exportSettings.title")), 1), (v(), g(z, null, ce(Qe, (h) => y(k, {
1809
+ key: h.key,
1810
+ label: u(o)(h.labelKey),
1811
+ "has-checkbox": "",
1812
+ "model-value": he.value.has(h.key),
1813
+ disabled: he.value.has(h.key) && he.value.size === 1,
1814
+ onClick: (P) => ho(h.key)
1815
+ }, null, 8, ["label", "model-value", "disabled", "onClick"])), 64))])]),
1816
+ _: 1
1817
+ })]),
1818
+ default: B(() => [s("div", Ta, [s("div", ja, [y(fa, {
1819
+ modelValue: ie.value,
1820
+ "onUpdate:modelValue": a[0] || (a[0] = (h) => ie.value = h),
1821
+ items: Jt.value
1822
+ }, null, 8, ["modelValue", "items"]), s("div", Va, [y(ae, {
1823
+ modelValue: ne.value,
1824
+ "onUpdate:modelValue": a[1] || (a[1] = (h) => ne.value = h),
1825
+ "show-predefined-range": "",
1826
+ "show-time": "",
1827
+ "predefined-range": co.value
1828
+ }, {
1829
+ "trigger-button": B(() => [y(U, {
1830
+ label: uo.value,
1831
+ icon: "calendar_month"
1832
+ }, null, 8, ["label"])]),
1833
+ _: 1
1834
+ }, 8, ["modelValue", "predefined-range"]), q.value ? F("", !0) : (v(), g("div", $a, [y(Me, {
1835
+ modelValue: fe.value,
1836
+ "onUpdate:modelValue": a[2] || (a[2] = (h) => fe.value = h),
1837
+ items: Xt.value,
1838
+ multiple: "",
1839
+ variant: "dark",
1840
+ placeholder: u(o)("auditLog.filter.user_placeholder"),
1841
+ "selected-prefix": u(o)("auditLog.filter.selected_user_prefix"),
1842
+ "chip-icon": "account_circle"
1843
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])), q.value ? F("", !0) : (v(), g("div", Pa, [y(Me, {
1844
+ modelValue: Z.value,
1845
+ "onUpdate:modelValue": a[3] || (a[3] = (h) => Z.value = h),
1846
+ items: oo.value,
1847
+ "filter-fn": ao,
1848
+ multiple: "",
1849
+ variant: "dark",
1850
+ placeholder: u(o)("auditLog.filter.subject_placeholder"),
1851
+ "selected-prefix": u(o)("auditLog.filter.selected_subject_prefix"),
1852
+ "chip-icon": "badge"
1853
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])), s("div", Ea, [y(Me, {
1854
+ modelValue: re.value,
1855
+ "onUpdate:modelValue": a[4] || (a[4] = (h) => re.value = h),
1856
+ items: so.value,
1857
+ multiple: "",
1858
+ variant: "dark",
1859
+ placeholder: u(o)("auditLog.filter.action_placeholder"),
1860
+ "selected-prefix": u(o)("auditLog.filter.selected_action_prefix"),
1861
+ searchable: !1
1862
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), s("div", Ra, [y(Me, {
1863
+ modelValue: le.value,
1864
+ "onUpdate:modelValue": a[5] || (a[5] = (h) => le.value = h),
1865
+ items: no.value,
1866
+ multiple: "",
1867
+ variant: "dark",
1868
+ placeholder: u(o)("auditLog.filter.status_placeholder"),
1869
+ "selected-prefix": u(o)("auditLog.filter.selected_status_prefix"),
1870
+ searchable: !1,
1871
+ "chip-icon": "check_circle"
1872
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])]), q.value ? (v(), g("div", Ua, [y(Me, {
1873
+ modelValue: ee.value,
1874
+ "onUpdate:modelValue": a[6] || (a[6] = (h) => ee.value = h),
1875
+ items: Wt.value,
1876
+ multiple: "",
1877
+ variant: "dark",
1878
+ placeholder: u(o)("auditLog.filter.restaurant_placeholder"),
1879
+ "selected-prefix": u(o)("auditLog.filter.selected_restaurant_prefix"),
1880
+ "chip-icon": "storefront"
1881
+ }, null, 8, ["modelValue", "items", "placeholder", "selected-prefix"])])) : F("", !0), y(et, {
1882
+ modelValue: ze.value,
1883
+ "onUpdate:modelValue": a[7] || (a[7] = (h) => ze.value = h),
1884
+ class: "ml-auto w-[280px]",
1885
+ placeholder: u(o)("auditLog.search.placeholder")
1886
+ }, null, 8, ["modelValue", "placeholder"])])]), y(Go, null, {
1887
+ default: B(() => [s("div", Na, [y(Zo, {
1888
+ "is-loading": w.value,
1889
+ "is-empty": O.value.length === 0,
1890
+ title: u(o)("auditLog.noData.title"),
1891
+ subtitle: u(o)("auditLog.noData.subtitle")
1892
+ }, {
1893
+ default: B(() => [(v(), Te(tt, {
1894
+ key: It.value,
1895
+ "column-defs": ko.value,
1896
+ "row-data": O.value,
1897
+ "page-size": Oe,
1898
+ "page-count": mt.value,
1899
+ "row-count": Be.value,
1900
+ "fetch-fn": wo,
1901
+ "hide-footer": mt.value <= 1,
1902
+ loading: w.value,
1903
+ "expanded-state": L.value,
1904
+ "get-row-can-expand": _o,
1905
+ "get-sub-row": xo,
1906
+ "pin-header-row": "",
1907
+ class: "audit-log-list-table cursor-pointer",
1908
+ "onUpdate:expandedState": a[8] || (a[8] = (h) => L.value = h),
1909
+ onRowClick: a[9] || (a[9] = (h) => Io(h.original))
1910
+ }, null, 8, ["column-defs", "row-data", "page-count", "row-count", "hide-footer", "loading", "expanded-state"]))]),
1911
+ _: 1
1912
+ }, 8, ["is-loading", "is-empty", "title", "subtitle"])])]),
1913
+ _: 1
1914
+ })])]),
1915
+ _: 1
1916
+ }, 8, ["heading"]), y(Ae, {
1917
+ header: u(o)("auditLog.detail.header"),
1918
+ "model-value": $.value,
1919
+ "max-width": 768,
1920
+ "dismiss-away": "",
1921
+ "onUpdate:modelValue": a[10] || (a[10] = (h) => {
1922
+ h || Ao();
1923
+ })
1924
+ }, {
1925
+ default: B(() => [i.value ? (v(), g("div", Ka, [s("div", Ya, [s("div", Ba, [s("p", za, l(mo(i.value)), 1), i.value.traceId ? (v(), g("p", qa, [ye(" Trace ID: " + l(i.value.traceId) + " ", 1), y(x, {
1926
+ variant: "tertiary",
1927
+ icon: "link",
1928
+ class: "ml-4 align-middle",
1929
+ "aria-label": u(o)("auditLog.detail.copyLink"),
1930
+ onClick: u(to)
1931
+ }, null, 8, ["aria-label", "onClick"])])) : F("", !0), i.value.eventId ? (v(), g("p", Ja, " Event ID: " + l(i.value.eventId), 1)) : F("", !0)]), s("div", Ha, [y(U, {
1932
+ variant: kt(i.value.outcome),
1933
+ label: Xe(i.value.outcome),
1934
+ compact: ""
1935
+ }, null, 8, ["variant", "label"]), u(Tt)(i.value) ? (v(), Te(Ne, {
1936
+ key: 0,
1937
+ variant: "plain",
1938
+ placement: "top"
1939
+ }, {
1940
+ content: B(() => [ye(l(u(o)("auditLog.operation.partialFailure")), 1)]),
1941
+ default: B(() => [y(Ie, {
1942
+ name: "error",
1943
+ size: "sm",
1944
+ class: "cursor-help text-fm-color-typo-error"
1945
+ })]),
1946
+ _: 1
1947
+ })) : F("", !0)])]), s("div", Wa, [s("div", Ga, [s("div", null, [s("p", Xa, l(u(o)("auditLog.detail.date")), 1), s("p", Qa, l(Ge(i.value.timestamp)), 1)]), s("div", null, [s("p", Za, l(u(o)("auditLog.detail.user")), 1), s("p", es, l(Se(i.value)), 1)]), s("div", null, [s("p", ts, l(u(o)("auditLog.detail.email")), 1), s("p", os, l(fo(i.value)), 1)]), i.value.field ? (v(), g("div", as, [s("p", ss, l(u(o)("auditLog.detail.field")), 1), s("p", ns, l(i.value.field), 1)])) : F("", !0), s("div", null, [s("p", ls, l(u(o)("auditLog.detail.business")), 1), s("p", rs, l(i.value.businessId || "-"), 1)]), s("div", null, [s("p", is, l(u(o)("auditLog.detail.restaurant")), 1), s("p", us, l(i.value.restaurantId || "-"), 1)])])]), s("div", ds, [s("div", cs, [s("p", fs, l(u(o)("auditLog.detail.eventDetails")), 1)]), a[13] || (a[13] = s("hr", {
1948
+ class: "border-fm-color-border-default"
1949
+ }, null, -1)), s("div", ms, [s("div", null, [s("p", vs, l(u(o)("auditLog.detail.actionDescription")), 1), s("p", ps, l(i.value.metadata.operationLabel || "-"), 1)])])]), s("div", gs, [s("div", hs, [s("p", ys, l(u(o)("auditLog.detail.metadata")), 1)]), a[14] || (a[14] = s("hr", {
1950
+ class: "border-fm-color-border-default"
1951
+ }, null, -1)), s("div", bs, [s("div", null, [s("p", _s, l(u(o)("auditLog.detail.resolvedFrom")), 1), s("p", xs, l(vo(i.value.metadata.resolvedFrom)), 1)]), (i.value.metadata.resolvedFrom === "permissionSet" || i.value.metadata.resolvedFrom === "systemPermissionSet") && (i.value.metadata.permissionSetName || i.value.metadata.permissionSetId) ? (v(), g("div", Ls, [s("p", ks, l(u(o)("auditLog.detail.permissionSet")), 1), i.value.metadata.permissionSetName ? (v(), g("p", Ss, l(i.value.metadata.permissionSetName), 1)) : F("", !0), i.value.metadata.permissionSetId ? (v(), g("p", ws, l(i.value.metadata.permissionSetId), 1)) : F("", !0)])) : F("", !0), i.value.metadata.reason ? (v(), g("div", Is, [s("p", As, l(u(o)("auditLog.detail.reason")), 1), s("p", Fs, l(i.value.metadata.reason), 1)])) : F("", !0), s("div", null, [s("p", Ms, l(u(o)("auditLog.detail.requestMethod")), 1), s("p", Ds, l(po(i.value)), 1)]), s("div", null, [s("p", Os, l(u(o)("auditLog.detail.requestPath")), 1), s("p", Cs, l(i.value.metadata.requestPath || "-"), 1)]), i.value.metadata.pos ? (v(), g(z, {
1952
+ key: 2
1953
+ }, [s("div", null, [s("p", Ts, l(u(o)("auditLog.pos.details.eventKey")), 1), s("p", js, l(i.value.eventKey || "-"), 1)]), s("div", null, [s("p", Vs, l(u(o)("auditLog.columns.device")), 1), s("p", $s, l(u(lt)(i.value, u(o))), 1), i.value.metadata.pos.machineId ? (v(), g("p", Ps, l(i.value.metadata.pos.machineId), 1)) : F("", !0)]), i.value.metadata.pos.appVersion ? (v(), g("div", Es, [s("p", Rs, l(u(o)("auditLog.pos.details.appVersion")), 1), s("p", Us, l(i.value.metadata.pos.appVersion), 1)])) : F("", !0), s("div", null, [s("p", Ns, l(u(o)("auditLog.columns.approver")), 1), s("p", Ks, l(u(jt)(i.value, u(o))), 1)]), s("div", null, [s("p", Ys, l(u(o)("auditLog.pos.details.clock")), 1), s("p", Bs, [ye(l(Ge(new Date(i.value.metadata.pos.occurredAt))) + " · " + l(i.value.metadata.pos.clockSkewMs) + " ms", 1), i.value.metadata.pos.clockClamped ? (v(), g("span", zs, " · " + l(u(o)("auditLog.pos.details.clamped")), 1)) : F("", !0)])]), i.value.params ? (v(), g("div", qs, [s("p", Js, l(u(o)("auditLog.pos.details.params")), 1), s("pre", Hs, l(i.value.params), 1)])) : F("", !0)], 64)) : F("", !0), i.value.metadata.trace && i.value.metadata.trace.length > 0 ? (v(), g("div", Ws, [s("p", Gs, l(u(o)("auditLog.detail.permissionTrace")), 1), s("ol", Xs, [(v(!0), g(z, null, ce(i.value.metadata.trace, (h, P) => (v(), g("li", {
1954
+ key: P,
1955
+ class: "flex items-center gap-6"
1956
+ }, [s("span", Qs, l(P + 1), 1), s("span", Zs, l(h), 1), P < i.value.metadata.trace.length - 1 ? (v(), g("span", en, "→")) : F("", !0)]))), 128))])])) : F("", !0), p.value ? (v(), g("div", tn, [s("p", on, l(u(o)("auditLog.detail.requestBody")), 1), s("pre", an, l(p.value), 1)])) : F("", !0)])])])) : F("", !0)]),
1957
+ _: 1
1958
+ }, 8, ["header", "model-value"]), y(Ae, {
1959
+ header: u(o)("auditLog.operation.sheetHeader"),
1960
+ "model-value": M.value,
1961
+ "max-width": 768,
1962
+ "dismiss-away": "",
1963
+ "onUpdate:modelValue": a[12] || (a[12] = (h) => {
1964
+ h || Mo();
1965
+ })
1966
+ }, {
1967
+ default: B(() => [f.value ? (v(), g("div", sn, [s("div", nn, [s("div", ln, [s("p", rn, l(Lt(f.value)), 1), f.value.entityId ? (v(), g("p", un, l(f.value.entityId), 1)) : F("", !0)]), y(U, {
1968
+ variant: f.value.status === "failed" ? "critical" : "success",
1969
+ label: f.value.status === "failed" ? u(o)("auditLog.outcome.failed") : u(o)("auditLog.outcome.success"),
1970
+ compact: ""
1971
+ }, null, 8, ["variant", "label"])]), s("div", dn, [s("div", cn, [s("div", null, [s("p", fn, l(u(o)("auditLog.detail.date")), 1), s("p", mn, l(Ge(f.value.timestamp)), 1)]), f.value.entityId ? (v(), g("div", vn, [s("p", pn, l(u(o)("auditLog.operation.entity")), 1), s("p", gn, l(f.value.entityId), 1)])) : F("", !0), f.value.durationMs !== void 0 ? (v(), g("div", hn, [s("p", yn, l(u(o)("auditLog.operation.duration")), 1), s("p", bn, l(u(o)("auditLog.operation.durationValue", {
1972
+ ms: f.value.durationMs
1973
+ })), 1)])) : F("", !0)])]), f.value.status === "failed" ? (v(), g("div", _n, [s("p", xn, l(u(o)("auditLog.operation.error")), 1), s("p", Ln, l(f.value.errorMessage || "-"), 1)])) : F("", !0), s("div", kn, [s("div", Sn, [s("p", wn, l(u(o)("auditLog.operation.changes")), 1)]), a[17] || (a[17] = s("hr", {
1974
+ class: "border-fm-color-border-default"
1975
+ }, null, -1)), s("div", In, [Y.value.length ? (v(), g("div", An, [(v(!0), g(z, null, ce(Y.value, (h, P) => (v(), g("div", {
1976
+ key: P,
1977
+ class: "space-y-4 py-8 first:pt-0 last:pb-0"
1978
+ }, [s("div", Fn, [y(U, {
1979
+ variant: Nt(h.type),
1980
+ label: Kt(h.type),
1981
+ compact: ""
1982
+ }, null, 8, ["variant", "label"]), s("span", Mn, l(Yt(h)), 1)]), s("p", Dn, [h.type === "add" ? (v(), g("span", On, l(h.afterDisplay), 1)) : h.type === "remove" ? (v(), g("span", Cn, l(h.beforeDisplay), 1)) : (v(), g(z, {
1983
+ key: 2
1984
+ }, [s("span", Tn, l(h.beforeDisplay), 1), a[15] || (a[15] = s("span", {
1985
+ class: "text-fm-color-typo-secondary"
1986
+ }, " → ", -1)), s("span", jn, l(h.afterDisplay), 1)], 64))])]))), 128))])) : ft.value.length ? (v(), g("div", Vn, [(v(!0), g(z, null, ce(ft.value, (h) => (v(), g("div", {
1987
+ key: h.groupKey,
1988
+ class: "space-y-4 py-8 first:pt-0 last:pb-0"
1989
+ }, [s("div", $n, [y(U, {
1990
+ variant: ct(h.type),
1991
+ label: W(h.type),
1992
+ compact: ""
1993
+ }, null, 8, ["variant", "label"]), s("span", Pn, l(h.displayKey), 1)]), s("div", En, [(v(!0), g(z, null, ce(h.rows, (P) => (v(), g("p", {
1994
+ key: P.path,
1995
+ class: "break-all font-mono text-xs"
1996
+ }, [P.type === "added" ? (v(), g("span", Rn, l(P.after ?? "—"), 1)) : P.type === "removed" ? (v(), g("span", Un, l(P.before ?? "—"), 1)) : (v(), g(z, {
1997
+ key: 2
1998
+ }, [s("span", Nn, l(P.before ?? "—"), 1), a[16] || (a[16] = s("span", {
1999
+ class: "text-fm-color-typo-secondary"
2000
+ }, " → ", -1)), s("span", Kn, l(P.after ?? "—"), 1)], 64))]))), 128))])]))), 128))])) : (v(), g("p", Yn, l(u(o)("auditLog.operation.noChanges")), 1))])]), I.value || Q.value ? (v(), g("div", Bn, [s("button", {
2001
+ type: "button",
2002
+ class: "flex w-full items-center justify-between p-12 text-left",
2003
+ onClick: a[11] || (a[11] = (h) => H.value = !H.value)
2004
+ }, [s("p", zn, l(u(o)("auditLog.operation.showData")), 1), y(Ie, {
2005
+ name: "keyboard_arrow_down",
2006
+ class: zo(["shrink-0 transition-transform", H.value ? "rotate-180" : ""])
2007
+ }, null, 8, ["class"])]), H.value ? (v(), g(z, {
2008
+ key: 0
2009
+ }, [a[18] || (a[18] = s("hr", {
2010
+ class: "border-fm-color-border-default"
2011
+ }, null, -1)), s("div", qn, [I.value ? (v(), g("div", Jn, [s("p", Hn, l(u(o)("auditLog.operation.before")), 1), s("pre", Wn, l(I.value), 1)])) : F("", !0), Q.value ? (v(), g("div", Gn, [s("p", Xn, l(u(o)("auditLog.operation.after")), 1), s("pre", Qn, l(Q.value), 1)])) : F("", !0)])], 64)) : F("", !0)])) : F("", !0)])) : F("", !0)]),
2012
+ _: 1
2013
+ }, 8, ["header", "model-value"])], 64);
2014
+ };
2015
+ }
2016
+ }), bl = /* @__PURE__ */ Xo(tl, [["__scopeId", "data-v-4caeef78"]]);
2017
+ export {
2018
+ bl as default
2019
+ };