@plumile/backoffice-react 0.1.101 → 0.1.103

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 (94) hide show
  1. package/lib/esm/{BackofficeAcceptInvitationPage-CEtApVwL.js → BackofficeAcceptInvitationPage-BfRsORii.js} +3 -3
  2. package/lib/esm/{BackofficeAcceptInvitationPage-CEtApVwL.js.map → BackofficeAcceptInvitationPage-BfRsORii.js.map} +1 -1
  3. package/lib/esm/BackofficeDashboardPage-C0zP0QO7.js +344 -0
  4. package/lib/esm/BackofficeDashboardPage-C0zP0QO7.js.map +1 -0
  5. package/lib/esm/{BackofficeEntityActionFormDialog-BgRTJ_JS.js → BackofficeEntityActionFormDialog-BgMuhyU8.js} +2 -2
  6. package/lib/esm/{BackofficeEntityActionFormDialog-BgRTJ_JS.js.map → BackofficeEntityActionFormDialog-BgMuhyU8.js.map} +1 -1
  7. package/lib/esm/{BackofficeEntityDetailLayoutContext-C_tBqkVq.js → BackofficeEntityDetailLayoutContext-DeuH5PCW.js} +1 -1
  8. package/lib/esm/{BackofficeEntityDetailLayoutContext-C_tBqkVq.js.map → BackofficeEntityDetailLayoutContext-DeuH5PCW.js.map} +1 -1
  9. package/lib/esm/{BackofficeEntityDetailLayoutPage-DXjRqvcZ.js → BackofficeEntityDetailLayoutPage-Duc_DcIV.js} +2 -2
  10. package/lib/esm/{BackofficeEntityDetailLayoutPage-DXjRqvcZ.js.map → BackofficeEntityDetailLayoutPage-Duc_DcIV.js.map} +1 -1
  11. package/lib/esm/{BackofficeEntityDetailPage-CwzKp_Yw.js → BackofficeEntityDetailPage-ChxBrqz8.js} +7 -6
  12. package/lib/esm/{BackofficeEntityDetailPage-CwzKp_Yw.js.map → BackofficeEntityDetailPage-ChxBrqz8.js.map} +1 -1
  13. package/lib/esm/{BackofficeEntityDetailUnknownPageRedirect-DRWTeox-.js → BackofficeEntityDetailUnknownPageRedirect-xupMeril.js} +2 -2
  14. package/lib/esm/{BackofficeEntityDetailUnknownPageRedirect-DRWTeox-.js.map → BackofficeEntityDetailUnknownPageRedirect-xupMeril.js.map} +1 -1
  15. package/lib/esm/{BackofficeEntityListPage-DVT3rrfa.js → BackofficeEntityListPage-BACvfX6c.js} +5 -4
  16. package/lib/esm/{BackofficeEntityListPage-DVT3rrfa.js.map → BackofficeEntityListPage-BACvfX6c.js.map} +1 -1
  17. package/lib/esm/BackofficeHubPage-BsUXulN0.js +136 -0
  18. package/lib/esm/BackofficeHubPage-BsUXulN0.js.map +1 -0
  19. package/lib/esm/BackofficeLayoutPage-r6dXo9SI.js +699 -0
  20. package/lib/esm/BackofficeLayoutPage-r6dXo9SI.js.map +1 -0
  21. package/lib/esm/{BackofficeLoginPage-Cc3kcOQV.js → BackofficeLoginPage-BMPhO1cr.js} +4 -4
  22. package/lib/esm/{BackofficeLoginPage-Cc3kcOQV.js.map → BackofficeLoginPage-BMPhO1cr.js.map} +1 -1
  23. package/lib/esm/{BackofficePasswordResetCompletePage-CF_0t3Nq.js → BackofficePasswordResetCompletePage-OApMUiOi.js} +3 -3
  24. package/lib/esm/{BackofficePasswordResetCompletePage-CF_0t3Nq.js.map → BackofficePasswordResetCompletePage-OApMUiOi.js.map} +1 -1
  25. package/lib/esm/{BackofficePasswordResetRequestPage-BJOrQXcy.js → BackofficePasswordResetRequestPage-DPDImb37.js} +2 -2
  26. package/lib/esm/{BackofficePasswordResetRequestPage-BJOrQXcy.js.map → BackofficePasswordResetRequestPage-DPDImb37.js.map} +1 -1
  27. package/lib/esm/BackofficePermissionsContext-CmWwudBU.js +11 -0
  28. package/lib/esm/BackofficePermissionsContext-CmWwudBU.js.map +1 -0
  29. package/lib/esm/BackofficeRightPageLayout-BZb7LhT-.js +53 -0
  30. package/lib/esm/BackofficeRightPageLayout-BZb7LhT-.js.map +1 -0
  31. package/lib/esm/{BackofficeTopbarPortalContext-iD7dm4_h.js → BackofficeTopbarPortalContext-CphoSrZD.js} +1 -1
  32. package/lib/esm/{BackofficeTopbarPortalContext-iD7dm4_h.js.map → BackofficeTopbarPortalContext-CphoSrZD.js.map} +1 -1
  33. package/lib/esm/{BackofficeVerifyEmailPage-C81LlsNM.js → BackofficeVerifyEmailPage-DHuSOxDf.js} +3 -3
  34. package/lib/esm/{BackofficeVerifyEmailPage-C81LlsNM.js.map → BackofficeVerifyEmailPage-DHuSOxDf.js.map} +1 -1
  35. package/lib/esm/{LazyBackofficeEntityActionFormDialog-L8xwaGqH.js → LazyBackofficeEntityActionFormDialog-uyYFFJGM.js} +93 -45
  36. package/lib/esm/LazyBackofficeEntityActionFormDialog-uyYFFJGM.js.map +1 -0
  37. package/lib/esm/backoffice-react.js +289 -254
  38. package/lib/esm/backoffice-react.js.map +1 -1
  39. package/lib/esm/{backofficeAuthPaths-BiJvoI5Q.js → backofficeAuthPaths-2KMmkBLv.js} +1 -1
  40. package/lib/esm/{backofficeAuthPaths-BiJvoI5Q.js.map → backofficeAuthPaths-2KMmkBLv.js.map} +1 -1
  41. package/lib/esm/{buildBreadcrumbs-CqF9Nh6x.js → buildBreadcrumbs-C9cyiXb7.js} +8 -4
  42. package/lib/esm/buildBreadcrumbs-C9cyiXb7.js.map +1 -0
  43. package/lib/esm/buildDataTableColumns-DGPjPK4N.js +66 -0
  44. package/lib/esm/buildDataTableColumns-DGPjPK4N.js.map +1 -0
  45. package/lib/esm/sidebarUtils-BZETlHea.js +74 -0
  46. package/lib/esm/sidebarUtils-BZETlHea.js.map +1 -0
  47. package/lib/esm/style.css +1 -1
  48. package/lib/esm/{toastViewAction-BGTS7vqm.js → toastViewAction-DJkv_4p9.js} +1 -1
  49. package/lib/esm/{toastViewAction-BGTS7vqm.js.map → toastViewAction-DJkv_4p9.js.map} +1 -1
  50. package/lib/esm/{useBackofficeAuth-ers1FUGe.js → useBackofficeAuth-DVAXNAjP.js} +1 -1
  51. package/lib/esm/{useBackofficeAuth-ers1FUGe.js.map → useBackofficeAuth-DVAXNAjP.js.map} +1 -1
  52. package/lib/esm/{useBackofficeLazyValue-Bh_13h8A.js → useBackofficeLazyValue-CoIAK-5N.js} +1 -1
  53. package/lib/esm/{useBackofficeLazyValue-Bh_13h8A.js.map → useBackofficeLazyValue-CoIAK-5N.js.map} +1 -1
  54. package/lib/types/components/backoffice/columns/buildDataTableColumns.d.ts.map +1 -1
  55. package/lib/types/components/backoffice/layout/BackofficePermissionsContext.d.ts +8 -0
  56. package/lib/types/components/backoffice/layout/BackofficePermissionsContext.d.ts.map +1 -0
  57. package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts +4 -0
  58. package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts.map +1 -1
  59. package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts.map +1 -1
  60. package/lib/types/components/backoffice/layout/sidebarUtils.d.ts +11 -3
  61. package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
  62. package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
  63. package/lib/types/hooks/useBackofficeInfiniteScrollSentinel.d.ts +14 -0
  64. package/lib/types/hooks/useBackofficeInfiniteScrollSentinel.d.ts.map +1 -0
  65. package/lib/types/hooks/useBackofficeSidebarPins.d.ts +1 -0
  66. package/lib/types/hooks/useBackofficeSidebarPins.d.ts.map +1 -1
  67. package/lib/types/hooks/useSidebarGroupCollapse.d.ts +2 -0
  68. package/lib/types/hooks/useSidebarGroupCollapse.d.ts.map +1 -1
  69. package/lib/types/i18n/resources.d.ts +28 -2
  70. package/lib/types/i18n/resources.d.ts.map +1 -1
  71. package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
  72. package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts.map +1 -1
  73. package/lib/types/pages/BackofficeHubPage.d.ts +8 -0
  74. package/lib/types/pages/BackofficeHubPage.d.ts.map +1 -0
  75. package/lib/types/pages/BackofficeLayoutPage.d.ts.map +1 -1
  76. package/lib/types/pages/backofficeDashboardPage.css.d.ts +12 -0
  77. package/lib/types/pages/backofficeDashboardPage.css.d.ts.map +1 -1
  78. package/lib/types/pages/backofficeHubPage.css.d.ts +15 -0
  79. package/lib/types/pages/backofficeHubPage.css.d.ts.map +1 -0
  80. package/lib/types/provider/types.d.ts +27 -5
  81. package/lib/types/provider/types.d.ts.map +1 -1
  82. package/lib/types/router/createBackofficeRoutes.d.ts +6 -1
  83. package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
  84. package/package.json +5 -5
  85. package/lib/esm/BackofficeDashboardPage-r8vK_JA6.js +0 -196
  86. package/lib/esm/BackofficeDashboardPage-r8vK_JA6.js.map +0 -1
  87. package/lib/esm/BackofficeLayoutPage-DQ0sVv24.js +0 -609
  88. package/lib/esm/BackofficeLayoutPage-DQ0sVv24.js.map +0 -1
  89. package/lib/esm/BackofficeRightPageLayout-hexJmpam.js +0 -113
  90. package/lib/esm/BackofficeRightPageLayout-hexJmpam.js.map +0 -1
  91. package/lib/esm/LazyBackofficeEntityActionFormDialog-L8xwaGqH.js.map +0 -1
  92. package/lib/esm/buildBreadcrumbs-CqF9Nh6x.js.map +0 -1
  93. package/lib/esm/sidebarUtils-DVkLmFbS.js +0 -52
  94. package/lib/esm/sidebarUtils-DVkLmFbS.js.map +0 -1
@@ -0,0 +1,699 @@
1
+ import { o as e } from "./environment-DQfVyWHJ.js";
2
+ import { t } from "./useRelayEnvironment-vQ86aW-n.js";
3
+ import { r as n, t as r } from "./useBackofficeReactTranslation-Btt58EIo.js";
4
+ import { a as i, c as a, i as o, n as s, o as c, r as l, s as u, t as d, u as f } from "./sidebarUtils-BZETlHea.js";
5
+ import { t as p } from "./BackofficeErrorBoundary-BwRVSDHU.js";
6
+ import { t as m } from "./BackofficeTopbarPortalContext-CphoSrZD.js";
7
+ import { t as h } from "./backofficeAuthPaths-2KMmkBLv.js";
8
+ import { t as g } from "./BackofficePermissionsContext-CmWwudBU.js";
9
+ import { Suspense as _, useCallback as v, useContext as y, useEffect as b, useMemo as x, useState as S } from "react";
10
+ import { useTranslation as C } from "react-i18next";
11
+ import { RoutingContext as ee, useLocation as te } from "@plumile/router";
12
+ import { AdminShellLayout as ne, BackofficeSidebarProfileMenu as re, Button as w, EnvironmentBadge as T, GlobalSearchInput as E, GripDotsSvg as D, InlineBanner as O, PinFilledSvg as k, PinSvg as A, SidebarHomeSvg as j, SidebarTasksSvg as M, Skeleton as N, ToastProvider as ie } from "@plumile/ui";
13
+ import { commitMutation as P, usePreloadedQuery as F } from "react-relay";
14
+ import { jsx as I, jsxs as L } from "react/jsx-runtime";
15
+ //#region src/hooks/useBackofficeSidebarPins.ts
16
+ var ae = "backoffice.sidebar.pins.v1", R = (e) => {
17
+ if (typeof window > "u") return [];
18
+ try {
19
+ let t = window.localStorage.getItem(e);
20
+ if (t == null) return [];
21
+ let n = JSON.parse(t);
22
+ return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
23
+ } catch {
24
+ return [];
25
+ }
26
+ }, z = (e, t) => {
27
+ let n = [], r = /* @__PURE__ */ new Set();
28
+ return e.forEach((e) => {
29
+ t.has(e) && (r.has(e) || (r.add(e), n.push(e)));
30
+ }), n;
31
+ }, oe = (e) => {
32
+ let { enabled: t = !0, storageKey: n = ae, visibleEntityIds: r } = e, i = x(() => new Set(r), [r]), [a, o] = S(() => t ? z(R(n), i) : []);
33
+ b(() => {
34
+ if (!t) {
35
+ o([]);
36
+ return;
37
+ }
38
+ o((e) => {
39
+ let t = z(e, i);
40
+ if (t.length === e.length) {
41
+ let n = !0;
42
+ for (let r = 0; r < t.length; r += 1) if (t[r] !== e[r]) {
43
+ n = !1;
44
+ break;
45
+ }
46
+ if (n) return e;
47
+ }
48
+ return t;
49
+ });
50
+ }, [t, i]), b(() => {
51
+ if (!t) {
52
+ o([]);
53
+ return;
54
+ }
55
+ o(z(R(n), i));
56
+ }, [
57
+ t,
58
+ n,
59
+ i
60
+ ]), b(() => {
61
+ if (!(!t || typeof window > "u")) try {
62
+ window.localStorage.setItem(n, JSON.stringify(a));
63
+ } catch {}
64
+ }, [
65
+ t,
66
+ a,
67
+ n
68
+ ]);
69
+ let s = x(() => new Set(a), [a]), c = v((e) => {
70
+ t && i.has(e) && o((t) => t.includes(e) ? t : [...t, e]);
71
+ }, [t, i]), l = v((e) => {
72
+ t && o((t) => t.filter((t) => t !== e));
73
+ }, [t]), u = v((e) => {
74
+ s.has(e) ? l(e) : c(e);
75
+ }, [
76
+ c,
77
+ s,
78
+ l
79
+ ]), d = v((e, n) => {
80
+ t && e !== n && o((t) => {
81
+ let r = t.indexOf(e), i = t.indexOf(n);
82
+ if (r === -1 || i === -1 || r === i) return t;
83
+ let a = [...t];
84
+ return a.splice(r, 1), a.splice(i, 0, e), a;
85
+ });
86
+ }, [t]);
87
+ return {
88
+ pins: a,
89
+ isPinned: v((e) => s.has(e), [s]),
90
+ pin: c,
91
+ unpin: l,
92
+ toggle: u,
93
+ reorder: d
94
+ };
95
+ }, B = (e) => {
96
+ if (e == null || typeof window > "u") return null;
97
+ try {
98
+ let t = window.localStorage.getItem(e);
99
+ if (t == null) return null;
100
+ let n = JSON.parse(t);
101
+ if (typeof n != "object" || !n) return null;
102
+ let r = {};
103
+ return Object.entries(n).forEach(([e, t]) => {
104
+ typeof t == "boolean" && (r[e] = t);
105
+ }), r;
106
+ } catch {
107
+ return null;
108
+ }
109
+ }, V = (e, t, n) => {
110
+ let r = {};
111
+ return e.forEach((e) => {
112
+ r[e] = n?.[e] ?? !0;
113
+ }), t != null && e.includes(t) && (r[t] = !1), r;
114
+ }, se = (e) => {
115
+ let { activeGroupId: t, defaultCollapsedByGroupId: n, groupIds: r, persist: i = !1, storageKey: a } = e, o = x(() => [...r], [r]), [s, c] = S(() => {
116
+ if (i) {
117
+ let e = B(a);
118
+ if (e != null) return {
119
+ ...V(o, t, n),
120
+ ...e
121
+ };
122
+ }
123
+ return V(o, t, n);
124
+ });
125
+ return b(() => {
126
+ c((e) => {
127
+ let r = {};
128
+ return o.forEach((t) => {
129
+ r[t] = e[t] ?? n?.[t] ?? !0;
130
+ }), t != null && o.includes(t) && (r[t] = !1), r;
131
+ });
132
+ }, [
133
+ t,
134
+ n,
135
+ o
136
+ ]), b(() => {
137
+ if (!(!i || a == null || typeof window > "u")) try {
138
+ window.localStorage.setItem(a, JSON.stringify(s));
139
+ } catch {}
140
+ }, [
141
+ s,
142
+ i,
143
+ a
144
+ ]), b(() => {
145
+ t != null && c((e) => e[t] === !1 ? e : {
146
+ ...e,
147
+ [t]: !1
148
+ });
149
+ }, [t]), {
150
+ collapsedByGroupId: s,
151
+ setCollapsed: v((e, t) => {
152
+ c((n) => n[e] === t ? n : {
153
+ ...n,
154
+ [e]: t
155
+ });
156
+ }, [])
157
+ };
158
+ }, H = "_1xws1b00 txvbqb9jg txvbqbcp txvbqbdoy txvbqbtxp txvbqbc6p txvbqb1rg txvbqb12g txvbqb1py txvbqblag txvbqbv0t txvbqbva1 txvbqbv txvbqb78 txvbqb6x txvbqb7k", U = (e, t) => e == null ? t ?? null : /* @__PURE__ */ I(e, {
159
+ width: 18,
160
+ height: 18,
161
+ "aria-hidden": "true"
162
+ });
163
+ function ce(e) {
164
+ let { basePath: t, pathname: n, entities: r, sidebar: l, permissions: f, searchQuery: p, tApp: m, t: h, pinnedEntityIds: g = [], recentItems: _ = [], onTogglePin: v, onReorderPin: y, collapsedByGroupId: b, onGroupCollapsedChange: x } = e, S = u(r, l), C = Object.entries(S), ee = new Set(g), te = h("sidebar.actions.pin"), ne = h("sidebar.actions.unpin"), re = h("sidebar.actions.reorder"), w = d(S, l), T = p?.trim().toLowerCase() ?? "", E = (e) => T === "" || e.toLowerCase().includes(T), O = (e) => {
165
+ if (v == null) return null;
166
+ let t = ee.has(e), n = te, r = A;
167
+ return t && (n = ne, r = k), /* @__PURE__ */ I("button", {
168
+ type: "button",
169
+ className: H,
170
+ "aria-pressed": t,
171
+ "aria-label": n,
172
+ title: n,
173
+ onClick: (t) => {
174
+ t.preventDefault(), t.stopPropagation(), v(e);
175
+ },
176
+ children: /* @__PURE__ */ I(r, {
177
+ width: 14,
178
+ height: 14,
179
+ "aria-hidden": "true"
180
+ })
181
+ });
182
+ }, N = (e) => {
183
+ let { entityId: t, groupId: i, groupIcon: a, itemIcon: o, itemLabel: u, enableReorder: d } = e, p = r[t];
184
+ if (p == null) return null;
185
+ let h = {
186
+ kind: "entity",
187
+ id: t
188
+ };
189
+ if (p.kind === "tool" && (h = {
190
+ kind: "tool",
191
+ id: t
192
+ }), l?.isItemVisible?.(h, f) === !1) return null;
193
+ if (p.kind === "tool") {
194
+ let e = u ?? c(p.label, m);
195
+ return T !== "" && !e.toLowerCase().includes(T) ? null : {
196
+ id: `tool-${t}`,
197
+ data: {
198
+ kind: "tool",
199
+ id: t,
200
+ groupId: i
201
+ },
202
+ label: e,
203
+ href: p.routes.list,
204
+ icon: U(o ?? a, /* @__PURE__ */ I(M, {
205
+ width: 18,
206
+ height: 18,
207
+ "aria-hidden": "true"
208
+ })),
209
+ isActive: s(n, p.routes.list),
210
+ ariaLabel: e,
211
+ actionSlot: O(t)
212
+ };
213
+ }
214
+ if (!p.hasList) return null;
215
+ let g = u ?? c(p.label, m);
216
+ if (T !== "" && !g.toLowerCase().includes(T)) return null;
217
+ let _, v, b, x, S = !1;
218
+ d === !0 && y != null && (S = !0, _ = /* @__PURE__ */ I(D, {
219
+ width: 14,
220
+ height: 14,
221
+ "aria-hidden": "true"
222
+ }), v = (e) => {
223
+ let { dataTransfer: n } = e;
224
+ n.effectAllowed = "move", n.setData("text/plain", t);
225
+ }, b = (e) => {
226
+ e.preventDefault();
227
+ let { dataTransfer: t } = e;
228
+ t.dropEffect = "move";
229
+ }, x = (e) => {
230
+ e.preventDefault();
231
+ let n = e.dataTransfer.getData("text/plain");
232
+ n === "" || n === t || y(n, t);
233
+ });
234
+ let C;
235
+ return _ != null && (C = re), {
236
+ id: t,
237
+ data: {
238
+ kind: "entity",
239
+ id: t,
240
+ groupId: i
241
+ },
242
+ label: g,
243
+ href: p.routes.list,
244
+ icon: U(o ?? a, /* @__PURE__ */ I(M, {
245
+ width: 18,
246
+ height: 18,
247
+ "aria-hidden": "true"
248
+ })),
249
+ isActive: s(n, p.routes.list),
250
+ ariaLabel: g,
251
+ actionSlot: O(t),
252
+ dragHandleSlot: _,
253
+ dragHandleLabel: C,
254
+ draggable: S,
255
+ onDragStart: v,
256
+ onDragOver: b,
257
+ onDrop: x
258
+ };
259
+ }, ie = (e) => {
260
+ let { hub: t, groupId: a, icon: o } = e, u = {
261
+ kind: "hub",
262
+ id: t.id
263
+ };
264
+ if (l?.isItemVisible?.(u, f) === !1) return null;
265
+ let d = i(t), p = d.map((e) => r[e] ?? null).filter((e) => {
266
+ if (e == null) return !1;
267
+ let t = "entity";
268
+ e.kind === "tool" && (t = "tool");
269
+ let n = {
270
+ kind: t,
271
+ id: e.id
272
+ };
273
+ return !(l?.isItemVisible?.(n, f) === !1 || e.kind !== "tool" && !e.hasList);
274
+ });
275
+ if (d.length > 0 && p.length === 0) return null;
276
+ let h = c(t.title, m), g = E(h), _ = p.some((e) => E(c(e.label, m)));
277
+ if (!g && !_) return null;
278
+ let v = s(n, t.href) || p.some((e) => s(n, e.routes.list));
279
+ return {
280
+ id: `hub-${t.id}`,
281
+ data: {
282
+ kind: "hub",
283
+ id: t.id,
284
+ groupId: a
285
+ },
286
+ label: h,
287
+ href: t.href,
288
+ icon: U(o, /* @__PURE__ */ I(M, {
289
+ width: 18,
290
+ height: 18,
291
+ "aria-hidden": "true"
292
+ })),
293
+ isActive: v,
294
+ ariaLabel: h
295
+ };
296
+ }, P = [];
297
+ if (g.length > 0) {
298
+ let e = g.map((e) => {
299
+ let t = w.get(e);
300
+ return N({
301
+ entityId: e,
302
+ groupId: t?.groupId,
303
+ groupIcon: t?.icon,
304
+ enableReorder: !0
305
+ });
306
+ }).filter((e) => e != null);
307
+ e.length > 0 && P.push({
308
+ id: "pinned",
309
+ title: h("sidebar.sections.pinned"),
310
+ items: e,
311
+ collapsible: !1
312
+ });
313
+ }
314
+ if (_.length > 0) {
315
+ let e = _.map((e) => {
316
+ if (r[e.id] == null) return null;
317
+ let t = {
318
+ kind: e.kind,
319
+ id: e.id
320
+ };
321
+ if (l?.isItemVisible?.(t, f) === !1 || T !== "" && !e.label.toLowerCase().includes(T)) return null;
322
+ let i = w.get(e.id);
323
+ return {
324
+ id: `recent-${e.kind}-${e.id}`,
325
+ data: {
326
+ kind: e.kind,
327
+ id: e.id,
328
+ groupId: i?.groupId
329
+ },
330
+ label: e.label,
331
+ href: e.href,
332
+ icon: U(i?.icon, /* @__PURE__ */ I(M, {
333
+ width: 18,
334
+ height: 18,
335
+ "aria-hidden": "true"
336
+ })),
337
+ isActive: s(n, e.href),
338
+ ariaLabel: e.label
339
+ };
340
+ }).filter((e) => e != null);
341
+ e.length > 0 && P.push({
342
+ id: "recent",
343
+ title: h("sidebar.sections.recent"),
344
+ items: e,
345
+ collapsible: !1
346
+ });
347
+ }
348
+ return C.forEach(([e, r], i) => {
349
+ if (r.isVisible != null && !r.isVisible(f)) return;
350
+ let u = [];
351
+ if (i === 0 && l?.isItemVisible?.({
352
+ kind: "dashboard",
353
+ id: "dashboard"
354
+ }, f) !== !1) {
355
+ let r = h("sidebar.items.dashboard");
356
+ T !== "" && !r.toLowerCase().includes(T) || u.push({
357
+ id: "dashboard",
358
+ data: {
359
+ kind: "dashboard",
360
+ id: "dashboard",
361
+ groupId: e
362
+ },
363
+ label: r,
364
+ href: t,
365
+ icon: U(void 0, /* @__PURE__ */ I(j, {
366
+ width: 18,
367
+ height: 18,
368
+ "aria-hidden": "true"
369
+ })),
370
+ isActive: s(n, t),
371
+ ariaLabel: h("sidebar.items.dashboard")
372
+ });
373
+ }
374
+ let d = o(r);
375
+ if (d.length > 0 && d.forEach((t) => {
376
+ if (t.kind === "dashboard") return;
377
+ if (t.kind === "hub") {
378
+ let n = ie({
379
+ hub: a(t, l),
380
+ groupId: e,
381
+ icon: t.icon ?? r.icon
382
+ });
383
+ n != null && u.push(n);
384
+ return;
385
+ }
386
+ let n;
387
+ t.label != null && (n = c(t.label, m));
388
+ let i = N({
389
+ entityId: t.id,
390
+ groupId: e,
391
+ groupIcon: r.icon,
392
+ itemIcon: t.icon,
393
+ itemLabel: n
394
+ });
395
+ i != null && u.push(i);
396
+ }), u.length === 0) return;
397
+ let p;
398
+ r.title != null && (p = c(r.title, m));
399
+ let g = b?.[e], _;
400
+ x != null && (_ = (t) => {
401
+ x(e, t);
402
+ }), P.push({
403
+ id: e,
404
+ title: p,
405
+ items: u,
406
+ collapsible: r.behavior?.collapsible ?? !0,
407
+ defaultCollapsed: r.behavior?.defaultCollapsed ?? !0,
408
+ isCollapsed: g,
409
+ onCollapsedChange: _
410
+ });
411
+ }), P;
412
+ }
413
+ //#endregion
414
+ //#region src/components/backoffice/routing/backofficeContentError.css.ts
415
+ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", K = (e) => {
416
+ if (e instanceof Error) {
417
+ let t = e.message.trim();
418
+ return t.length > 0 ? t : null;
419
+ }
420
+ if (typeof e == "string") {
421
+ let t = e.trim();
422
+ return t.length > 0 ? t : null;
423
+ }
424
+ return null;
425
+ }, le = ({ error: e, onRetry: t }) => {
426
+ let { t: n } = r(), i = K(e);
427
+ return /* @__PURE__ */ I("div", {
428
+ className: W,
429
+ role: "alert",
430
+ children: /* @__PURE__ */ I(O, {
431
+ tone: "danger",
432
+ className: G,
433
+ actions: /* @__PURE__ */ I(w, {
434
+ type: "button",
435
+ variant: "secondary",
436
+ size: "small",
437
+ onClick: t,
438
+ children: n("common.actions.retry")
439
+ }),
440
+ children: i
441
+ })
442
+ });
443
+ }, q = "txvbqb9ip txvbqbai7 txvbqbaop txvbqbu7g txvbqbjs7", ue = "txvbqbjfg", de = "txvbqb9iy txvbqbaop txvbqbc17", fe = "txvbqb9ip txvbqbai7 txvbqbaog txvbqblbg txvbqbjny txvbqb1ry txvbqb1cp txvbqb1qg txvbqbwp txvbqbv45", J = () => /* @__PURE__ */ L("div", {
444
+ className: q,
445
+ role: "status",
446
+ "aria-live": "polite",
447
+ "aria-busy": "true",
448
+ children: [
449
+ /* @__PURE__ */ I(N, {
450
+ variant: "text",
451
+ width: "38%",
452
+ className: ue
453
+ }),
454
+ /* @__PURE__ */ I(N, {
455
+ variant: "text",
456
+ width: "62%"
457
+ }),
458
+ /* @__PURE__ */ I("div", {
459
+ className: de,
460
+ children: Array.from({ length: 4 }, (e, t) => /* @__PURE__ */ L("div", {
461
+ className: fe,
462
+ children: [
463
+ /* @__PURE__ */ I(N, {
464
+ variant: "text",
465
+ width: "46%"
466
+ }),
467
+ /* @__PURE__ */ I(N, {
468
+ variant: "text",
469
+ width: "82%",
470
+ lines: 2
471
+ }),
472
+ /* @__PURE__ */ I(N, {
473
+ variant: "block",
474
+ width: "100%",
475
+ height: 120
476
+ })
477
+ ]
478
+ }, `content-skeleton-${t}`))
479
+ })
480
+ ]
481
+ }), Y = "txvbqb9ip txvbqbai7 txvbqbjs7 txvbqbu7g txvbqbk5y", pe = ({ children: e }) => /* @__PURE__ */ I("div", {
482
+ className: Y,
483
+ children: /* @__PURE__ */ I(p, {
484
+ fallback: ({ error: e, reset: t }) => /* @__PURE__ */ I(le, {
485
+ error: e,
486
+ onRetry: t
487
+ }),
488
+ children: /* @__PURE__ */ I(_, {
489
+ fallback: /* @__PURE__ */ I(J, {}),
490
+ children: e
491
+ })
492
+ })
493
+ }), X = (e) => e?.trim() ?? "", me = ({ viewer: e, unknownUserLabel: t }) => {
494
+ let n = [X(e?.firstName), X(e?.lastName)].filter((e) => e !== "").join(" ").trim();
495
+ n === "" && (n = t);
496
+ let r = X(e?.email), i = X(e?.initials);
497
+ i === "" && (i = "?");
498
+ let a = [n];
499
+ return r !== "" && a.push(r), {
500
+ displayName: n,
501
+ email: r,
502
+ initials: i,
503
+ ariaLabel: a.join(" - ")
504
+ };
505
+ }, he = "plumile:backoffice:recent-items", ge = "plumile:backoffice:sidebar", _e = (e) => {
506
+ if (typeof window > "u") return [];
507
+ try {
508
+ let t = window.localStorage.getItem(e);
509
+ if (t == null) return [];
510
+ let n = JSON.parse(t);
511
+ return Array.isArray(n) ? n.filter((e) => {
512
+ if (typeof e != "object" || !e) return !1;
513
+ let t = e;
514
+ return (t.kind === "entity" || t.kind === "tool") && typeof t.id == "string" && typeof t.label == "string" && typeof t.href == "string" && typeof t.visitedAt == "number";
515
+ }) : [];
516
+ } catch {
517
+ return [];
518
+ }
519
+ }, ve = (e, t) => {
520
+ if (!(typeof window > "u")) try {
521
+ window.localStorage.setItem(e, JSON.stringify(t));
522
+ } catch {}
523
+ }, Z = ({ children: i, permissions: a, authStatus: o, activeGroupId: s }) => {
524
+ let { t: c } = C(), { t: d } = r(), { pathname: p } = te(), _ = y(ee), w = t(), { auth: D, basePath: O, entities: k, sidebar: A } = n(), [j, M] = S(""), N = A?.preferences?.storageKey ?? ge, F = A?.preferences?.persistCollapsed === !0, [L, ae] = S(() => {
525
+ if (!F || typeof window > "u") return !1;
526
+ try {
527
+ return window.localStorage.getItem(`${N}:collapsed`) === "true";
528
+ } catch {
529
+ return !1;
530
+ }
531
+ }), [R, z] = S(!1), [B, V] = S(null), H = A?.recentItems, U = H?.enabled === !0, W = H?.storageKey ?? he, G = H?.maxItems ?? 8, [K, le] = S(() => U ? _e(W) : []);
532
+ b(() => {
533
+ if (!(!F || typeof window > "u")) try {
534
+ window.localStorage.setItem(`${N}:collapsed`, String(L));
535
+ } catch {}
536
+ }, [
537
+ L,
538
+ F,
539
+ N
540
+ ]);
541
+ let q = x(() => u(k, A), [k, A]), ue = x(() => Object.keys(q), [q]), de = x(() => Object.fromEntries(Object.entries(q).map(([e, t]) => [e, t.behavior?.defaultCollapsed ?? !0])), [q]), fe = x(() => f(q, k, A, a), [
542
+ k,
543
+ q,
544
+ a,
545
+ A
546
+ ]), J = x(() => l(p, k), [k, p]);
547
+ b(() => {
548
+ if (!U || J == null) return;
549
+ let e = k[J];
550
+ if (e == null || e.kind !== "tool" && !e.hasList) return;
551
+ let t = e.routes.list, n = "entity";
552
+ e.kind === "tool" && (n = "tool");
553
+ let r = {
554
+ kind: n,
555
+ id: J,
556
+ label: e.label(c),
557
+ href: t,
558
+ visitedAt: Date.now()
559
+ };
560
+ le((e) => {
561
+ let t = [r, ...e.filter((e) => e.id !== r.id || e.kind !== r.kind)].slice(0, G);
562
+ return ve(W, t), t;
563
+ });
564
+ }, [
565
+ J,
566
+ k,
567
+ U,
568
+ G,
569
+ W,
570
+ c
571
+ ]);
572
+ let { pins: Y, toggle: X, reorder: Z } = oe({
573
+ enabled: A?.pinnedItems?.enabled === !0,
574
+ storageKey: A?.pinnedItems?.storageKey,
575
+ visibleEntityIds: fe
576
+ }), Q;
577
+ A?.preferences?.storageKey != null && (Q = `${A.preferences.storageKey}:groups`);
578
+ let { collapsedByGroupId: $, setCollapsed: ye } = se({
579
+ groupIds: ue,
580
+ activeGroupId: s,
581
+ defaultCollapsedByGroupId: de,
582
+ persist: A?.preferences?.persistGroups === !0,
583
+ storageKey: Q
584
+ }), be = x(() => ce({
585
+ basePath: O,
586
+ pathname: p,
587
+ entities: k,
588
+ sidebar: A,
589
+ permissions: a,
590
+ searchQuery: j,
591
+ tApp: c,
592
+ t: d,
593
+ pinnedEntityIds: Y,
594
+ recentItems: K,
595
+ onTogglePin: X,
596
+ onReorderPin: Z,
597
+ collapsedByGroupId: $,
598
+ onGroupCollapsedChange: ye
599
+ }), [
600
+ O,
601
+ $,
602
+ k,
603
+ p,
604
+ a,
605
+ Y,
606
+ K,
607
+ Z,
608
+ ye,
609
+ A,
610
+ j,
611
+ d,
612
+ c,
613
+ X
614
+ ]), xe = x(() => import.meta.env?.DEV === !0 ? "dev" : "prod", []), Se = v(() => {
615
+ R || (z(!0), (async () => {
616
+ try {
617
+ let t = await D.logout.load();
618
+ await new Promise((e, n) => {
619
+ P(w, {
620
+ mutation: t.logoutMutation,
621
+ variables: {},
622
+ onCompleted: () => {
623
+ e();
624
+ },
625
+ onError: (e) => {
626
+ n(e);
627
+ }
628
+ });
629
+ }), localStorage.removeItem("auth_token"), localStorage.removeItem("remember_me"), e(), _?.history.push({ pathname: h(O) });
630
+ } finally {
631
+ z(!1);
632
+ }
633
+ })().catch(() => {}));
634
+ }, [
635
+ D.logout,
636
+ O,
637
+ R,
638
+ w,
639
+ _
640
+ ]), Ce = o?.me ?? null, we = /* @__PURE__ */ I(re, {
641
+ collapsed: L,
642
+ viewer: x(() => me({
643
+ viewer: Ce,
644
+ unknownUserLabel: d("sidebar.profile.unknownUser")
645
+ }), [d, Ce]),
646
+ labels: {
647
+ sectionTitle: d("sidebar.profile.title"),
648
+ menuAriaLabel: d("sidebar.profile.menuAriaLabel"),
649
+ signOut: d("sidebar.profile.actions.signOut")
650
+ },
651
+ onSignOut: Se,
652
+ isSigningOut: R
653
+ }), Te = null;
654
+ B != null && (Te = /* @__PURE__ */ I(pe, { children: i }));
655
+ let Ee = null;
656
+ return L || (Ee = /* @__PURE__ */ I(E, {
657
+ value: j,
658
+ onChange: M,
659
+ placeholder: d("sidebar.search.placeholder"),
660
+ ariaLabel: d("sidebar.search.placeholder")
661
+ })), /* @__PURE__ */ I(ie, { children: /* @__PURE__ */ I(ne, {
662
+ sidebar: {
663
+ sections: be,
664
+ header: /* @__PURE__ */ I(T, { environment: xe }),
665
+ search: Ee,
666
+ footer: we,
667
+ isCollapsed: L,
668
+ onCollapsedChange: ae
669
+ },
670
+ topbar: { breadcrumb: /* @__PURE__ */ I("div", { ref: V }) },
671
+ children: /* @__PURE__ */ I(g, {
672
+ permissions: a,
673
+ children: /* @__PURE__ */ I(m, {
674
+ value: { target: B },
675
+ children: Te
676
+ })
677
+ })
678
+ }) });
679
+ }, Q = ({ children: e, permissionsQuery: t, prepared: n, authStatus: r, activeGroupId: i }) => /* @__PURE__ */ I(Z, {
680
+ permissions: F(t, n),
681
+ authStatus: r,
682
+ activeGroupId: i,
683
+ children: e
684
+ }), $ = ({ children: e, permissionsQuery: t, prepared: n, authStatus: r, activeGroupId: i }) => t != null && n != null ? /* @__PURE__ */ I(Q, {
685
+ permissionsQuery: t,
686
+ prepared: n,
687
+ authStatus: r,
688
+ activeGroupId: i,
689
+ children: e
690
+ }) : /* @__PURE__ */ I(Z, {
691
+ permissions: null,
692
+ authStatus: r,
693
+ activeGroupId: i,
694
+ children: e
695
+ });
696
+ //#endregion
697
+ export { $ as BackofficeLayoutPage, $ as default };
698
+
699
+ //# sourceMappingURL=BackofficeLayoutPage-r6dXo9SI.js.map