@object-ui/layout 17.2.0 → 17.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,31 +2,31 @@ import { ComponentRegistry as e } from "@object-ui/core";
2
2
  import t, { useEffect as n, useMemo as r, useState as i } from "react";
3
3
  import { Badge as a, Button as o, Collapsible as s, CollapsibleContent as c, CollapsibleTrigger as l, Input as u, LazyIcon as d, Separator as f, Sidebar as p, SidebarContent as m, SidebarFooter as h, SidebarGroup as g, SidebarGroupContent as _, SidebarGroupLabel as v, SidebarHeader as y, SidebarInput as b, SidebarInset as x, SidebarMenu as S, SidebarMenuAction as C, SidebarMenuButton as w, SidebarMenuItem as T, SidebarMenuSub as E, SidebarMenuSubButton as D, SidebarMenuSubItem as O, SidebarProvider as k, cn as A, getLazyIcon as j, useIsMobile as M } from "@object-ui/components";
4
4
  import { ArrowLeft as N, ChevronRight as P, FileText as F, GripVertical as ee, Layers as te, Pin as ne, PinOff as re, Search as ie, Star as I } from "lucide-react";
5
- import { SchemaRenderer as L, useRecordContext as ae } from "@object-ui/react";
6
- import { Fragment as oe, jsx as R, jsxs as z } from "react/jsx-runtime";
7
- import { Link as se, NavLink as B, useLocation as V } from "react-router-dom";
8
- import { DndContext as ce, KeyboardSensor as H, PointerSensor as le, closestCenter as ue, useSensor as U, useSensors as W } from "@dnd-kit/core";
9
- import { SortableContext as de, arrayMove as fe, useSortable as pe, verticalListSortingStrategy as me } from "@dnd-kit/sortable";
10
- import { CSS as he } from "@dnd-kit/utilities";
11
- import { menuItemToNavigationItem as ge } from "@object-ui/types";
5
+ import { SchemaRenderer as L, useRecordContext as R } from "@object-ui/react";
6
+ import { Fragment as ae, jsx as z, jsxs as B } from "react/jsx-runtime";
7
+ import { Link as oe, NavLink as V, useLocation as H } from "react-router-dom";
8
+ import { DndContext as U, KeyboardSensor as se, PointerSensor as W, closestCenter as ce, useSensor as G, useSensors as K } from "@dnd-kit/core";
9
+ import { SortableContext as q, arrayMove as le, useSortable as ue, verticalListSortingStrategy as de } from "@dnd-kit/sortable";
10
+ import { CSS as fe } from "@dnd-kit/utilities";
11
+ import { menuItemToNavigationItem as pe } from "@object-ui/types";
12
12
  //#region src/PageHeader.tsx
13
- var _e = (e) => {
13
+ var me = (e) => {
14
14
  let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
15
15
  return t != null && String(t).trim() ? String(t) : [
16
16
  e?.salutation,
17
17
  e?.first_name,
18
18
  e?.last_name
19
19
  ].filter((e) => typeof e == "string" && e.trim()).map((e) => e.trim()).join(" ") || (typeof e?.email == "string" && e.email.trim() ? e.email.trim() : null);
20
- }, ve = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
20
+ }, he = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
21
21
  let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
22
- return r == null ? "" : typeof r == "object" ? _e(r) ?? "" : String(r);
22
+ return r == null ? "" : typeof r == "object" ? me(r) ?? "" : String(r);
23
23
  }).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
24
- function ye({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
25
- let m = ae(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = ve(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = ve(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
24
+ function ge({ title: e, subtitle: n, description: r, icon: i, action: a, actions: s, showBack: c, schema: l, className: u, children: f, ...p }) {
25
+ let m = R(), h = typeof e == "string" && /\{[a-zA-Z0-9_.]+\}/.test(e), g = he(e, m?.data) || (h ? "" : e), _ = n ?? r, v = typeof _ == "string" && /\{[a-zA-Z0-9_.]+\}/.test(_), y = he(_, m?.data) || (v ? "" : _), b = !!m?.recordId, x = !!m?.embedded, S = c ?? (b && !x), C = t.useCallback(() => {
26
26
  if (typeof window > "u") return;
27
27
  let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
28
28
  t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
29
- }, []), w = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ R(L, { schema: e }, e?.id || `pgh-child-${t}`)) : null, T = Array.isArray(s) && s.length > 0 && s || Array.isArray(l?.actions) && l.actions.length > 0 && l.actions || Array.isArray(l?.properties?.actions) && l.properties.actions.length > 0 && l.properties.actions || null, E = a || f || (T ? /* @__PURE__ */ R(L, { schema: {
29
+ }, []), w = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ z(L, { schema: e }, e?.id || `pgh-child-${t}`)) : null, T = Array.isArray(s) && s.length > 0 && s || Array.isArray(l?.actions) && l.actions.length > 0 && l.actions || Array.isArray(l?.properties?.actions) && l.properties.actions.length > 0 && l.properties.actions || null, E = a || f || (T ? /* @__PURE__ */ z(L, { schema: {
30
30
  type: "record:quick_actions",
31
31
  properties: {
32
32
  actions: T,
@@ -35,39 +35,39 @@ function ye({ title: e, subtitle: n, description: r, icon: i, action: a, actions
35
35
  inline: !0
36
36
  }
37
37
  } }) : null) || w;
38
- return /* @__PURE__ */ R("div", {
38
+ return /* @__PURE__ */ z("div", {
39
39
  className: A("flex flex-col gap-3 pb-4 border-b", u),
40
40
  ...p,
41
- children: /* @__PURE__ */ z("div", {
41
+ children: /* @__PURE__ */ B("div", {
42
42
  className: "flex flex-wrap items-center gap-x-4 gap-y-2",
43
43
  children: [
44
- S && /* @__PURE__ */ R(o, {
44
+ S && /* @__PURE__ */ z(o, {
45
45
  type: "button",
46
46
  variant: "ghost",
47
47
  size: "icon",
48
48
  onClick: C,
49
49
  "aria-label": "Back to list",
50
50
  className: "flex-shrink-0 -ml-2",
51
- children: /* @__PURE__ */ R(N, { className: "size-4" })
51
+ children: /* @__PURE__ */ z(N, { className: "size-4" })
52
52
  }),
53
- i && (g || y) && /* @__PURE__ */ R("div", {
53
+ i && (g || y) && /* @__PURE__ */ z("div", {
54
54
  className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
55
- children: typeof i == "string" ? /* @__PURE__ */ R(d, {
55
+ children: typeof i == "string" ? /* @__PURE__ */ z(d, {
56
56
  name: i,
57
57
  className: "size-5"
58
58
  }) : i
59
59
  }),
60
- /* @__PURE__ */ z("div", {
60
+ /* @__PURE__ */ B("div", {
61
61
  className: "flex flex-col min-w-0 flex-1",
62
- children: [g ? /* @__PURE__ */ R("h1", {
62
+ children: [g ? /* @__PURE__ */ z("h1", {
63
63
  className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
64
64
  children: g
65
- }) : null, y && /* @__PURE__ */ R("p", {
65
+ }) : null, y && /* @__PURE__ */ z("p", {
66
66
  className: "text-sm text-muted-foreground truncate",
67
67
  children: y
68
68
  })]
69
69
  }),
70
- E && /* @__PURE__ */ R("div", {
70
+ E && /* @__PURE__ */ z("div", {
71
71
  className: "flex items-center gap-2 ml-auto",
72
72
  children: E
73
73
  })
@@ -77,7 +77,7 @@ function ye({ title: e, subtitle: n, description: r, icon: i, action: a, actions
77
77
  }
78
78
  //#endregion
79
79
  //#region src/AppShell.tsx
80
- function be(e) {
80
+ function _e(e) {
81
81
  let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
82
82
  if (!t) return null;
83
83
  let n = parseInt(t[1], 16) / 255, r = parseInt(t[2], 16) / 255, i = parseInt(t[3], 16) / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = 0, c = 0, l = (a + o) / 2;
@@ -90,9 +90,7 @@ function be(e) {
90
90
  case r:
91
91
  s = ((i - n) / e + 2) / 6;
92
92
  break;
93
- case i:
94
- s = ((n - r) / e + 4) / 6;
95
- break;
93
+ case i: s = ((n - r) / e + 4) / 6;
96
94
  }
97
95
  }
98
96
  return {
@@ -101,17 +99,17 @@ function be(e) {
101
99
  l: l * 100
102
100
  };
103
101
  }
104
- function xe(e) {
105
- let t = be(e);
102
+ function ve(e) {
103
+ let t = _e(e);
106
104
  return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
107
105
  }
108
- function Se(e) {
109
- let t = be(e);
106
+ function ye(e) {
107
+ let t = _e(e);
110
108
  if (!t) return null;
111
109
  let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
112
110
  return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
113
111
  }
114
- function Ce(e) {
112
+ function be(e) {
115
113
  let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
116
114
  if (!t) return "0 0% 100%";
117
115
  let n = (e) => {
@@ -120,16 +118,16 @@ function Ce(e) {
120
118
  }, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
121
119
  return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
122
120
  }
123
- function we(e, t) {
121
+ function xe(e, t) {
124
122
  n(() => {
125
123
  let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
126
124
  if (e?.primaryColor) {
127
- let t = xe(e.primaryColor), i = Se(e.primaryColor), a = r() && i || t;
128
- a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : Ce(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
125
+ let t = ve(e.primaryColor), i = ye(e.primaryColor), a = r() && i || t;
126
+ a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : be(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
129
127
  } else n.style.removeProperty("--brand-primary"), n.style.removeProperty("--brand-primary-hsl"), n.style.removeProperty("--primary"), n.style.removeProperty("--primary-foreground"), n.style.removeProperty("--ring"), n.style.removeProperty("--sidebar-primary"), n.style.removeProperty("--sidebar-ring");
130
128
  if (e?.accentColor) {
131
- let t = xe(e.accentColor), i = Se(e.accentColor), a = r() && i || t;
132
- a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : Ce(e.accentColor)));
129
+ let t = ve(e.accentColor), i = ye(e.accentColor), a = r() && i || t;
130
+ a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : be(e.accentColor)));
133
131
  } else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
134
132
  };
135
133
  i();
@@ -156,20 +154,20 @@ function we(e, t) {
156
154
  t
157
155
  ]);
158
156
  }
159
- function G({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
160
- return we(a, a?.title), /* @__PURE__ */ z(k, {
157
+ function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
158
+ return xe(a, a?.title), /* @__PURE__ */ B(k, {
161
159
  defaultOpen: i,
162
160
  className: "!flex-col h-svh overflow-hidden",
163
- children: [/* @__PURE__ */ R("header", {
161
+ children: [/* @__PURE__ */ z("header", {
164
162
  className: "sticky top-0 z-30 flex h-14 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4",
165
163
  children: t
166
- }), /* @__PURE__ */ z("div", {
164
+ }), /* @__PURE__ */ B("div", {
167
165
  className: "flex flex-1 min-h-0 w-full",
168
166
  children: [
169
167
  e,
170
- /* @__PURE__ */ R(x, {
168
+ /* @__PURE__ */ z(x, {
171
169
  className: "min-w-0",
172
- children: /* @__PURE__ */ R("main", {
170
+ children: /* @__PURE__ */ z("main", {
173
171
  className: A("flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6", r),
174
172
  children: n
175
173
  })
@@ -181,11 +179,11 @@ function G({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
181
179
  }
182
180
  //#endregion
183
181
  //#region src/PageCard.tsx
184
- function Te({ className: e, children: t, ...n }) {
185
- return /* @__PURE__ */ R("div", {
182
+ function Se({ className: e, children: t, ...n }) {
183
+ return /* @__PURE__ */ z("div", {
186
184
  className: A("rounded-xl border bg-card text-card-foreground shadow", e),
187
185
  ...n,
188
- children: /* @__PURE__ */ R("div", {
186
+ children: /* @__PURE__ */ z("div", {
189
187
  className: "p-6",
190
188
  children: t
191
189
  })
@@ -193,7 +191,7 @@ function Te({ className: e, children: t, ...n }) {
193
191
  }
194
192
  //#endregion
195
193
  //#region src/ResponsiveGrid.tsx
196
- var Ee = {
194
+ var Ce = {
197
195
  xs: {
198
196
  1: "grid-cols-1",
199
197
  2: "grid-cols-2",
@@ -243,11 +241,11 @@ var Ee = {
243
241
  12: "2xl:grid-cols-12"
244
242
  }
245
243
  };
246
- function De(e) {
244
+ function we(e) {
247
245
  if (!e) return "grid-cols-1";
248
246
  let t = [];
249
247
  for (let [n, r] of Object.entries(e)) {
250
- let e = Ee[n];
248
+ let e = Ce[n];
251
249
  if (e && r) {
252
250
  let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
253
251
  t.push(e[n]);
@@ -255,7 +253,7 @@ function De(e) {
255
253
  }
256
254
  return t.join(" ") || "grid-cols-1";
257
255
  }
258
- var Oe = {
256
+ var Te = {
259
257
  0: "gap-0",
260
258
  1: "gap-1",
261
259
  2: "gap-2",
@@ -264,16 +262,19 @@ var Oe = {
264
262
  5: "gap-5",
265
263
  6: "gap-6",
266
264
  8: "gap-8"
267
- }, ke = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ R("div", {
268
- className: A("grid", De(e), typeof t == "number" ? Oe[t] || `gap-${t}` : "", n),
269
- children: r
270
- });
265
+ }, Ee = ({ columns: e, gap: t = 4, className: n, children: r }) => {
266
+ let i = we(e), a = typeof t == "number" ? Te[t] || `gap-${t}` : "";
267
+ return /* @__PURE__ */ z("div", {
268
+ className: A("grid", i, a, n),
269
+ children: r
270
+ });
271
+ };
271
272
  //#endregion
272
273
  //#region src/NavigationRenderer.tsx
273
- function K(e) {
274
+ function Y(e) {
274
275
  return e ? j(e) : F;
275
276
  }
276
- function q(e, t) {
277
+ function X(e, t) {
277
278
  if (typeof e == "string") return e;
278
279
  if (t) {
279
280
  let n = t(e.key, {
@@ -284,8 +285,8 @@ function q(e, t) {
284
285
  }
285
286
  return e.defaultValue || e.key;
286
287
  }
287
- function Ae(e, t, n, r, i, a, o) {
288
- let s = q(e.label, n);
288
+ function De(e, t, n, r, i, a, o) {
289
+ let s = X(e.label, n);
289
290
  if (typeof e.label != "string") return s;
290
291
  let c = (e) => !!e && s.trim().toLowerCase() !== e.trim().toLowerCase();
291
292
  if (e.type === "object" && e.objectName) {
@@ -303,21 +304,33 @@ function Ae(e, t, n, r, i, a, o) {
303
304
  }
304
305
  return o && e.id && !c(e.id) ? o(e.id, s) : s;
305
306
  }
306
- var je = (e) => !(e === !1 || e === "false"), Me = () => !0, Ne = () => !0, Pe = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
307
- function J(e, t) {
307
+ var Oe = (e) => e !== !1 && e !== "false", ke = () => !0, Ae = () => !0;
308
+ function je(e, t = {}) {
309
+ let { evaluateVisibility: n = Oe, checkPermission: r = ke, checkCapability: i = Ae, hasActionHandler: a = !1 } = t;
310
+ for (let o of e) if (n(o.visible) && !(o.requiredPermissions?.length && !r(o.requiredPermissions)) && !(o.requiresObject && !i("object", o.requiresObject)) && !(o.requiresService && !i("service", o.requiresService)) && o.type !== "separator") {
311
+ if (o.type === "group") {
312
+ if (je(o.children ?? [], t)) return !0;
313
+ continue;
314
+ }
315
+ if (!(o.type === "action" && !a)) return !0;
316
+ }
317
+ return !1;
318
+ }
319
+ var Me = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
320
+ function Z(e, t) {
308
321
  if (!e.includes("{")) return e;
309
- let n = !1, r = e.replace(Pe, (e, r) => {
322
+ let n = !1, r = e.replace(Me, (e, r) => {
310
323
  let i;
311
324
  return i = r === "current_user_id" ? t?.currentUserId : r === "current_org_id" ? t?.currentOrgId : t?.contextValues?.[r], i || (n = !0, "");
312
325
  });
313
326
  return n ? null : r;
314
327
  }
315
- function Y(e, t, n) {
328
+ function Ne(e, t, n) {
316
329
  switch (e.type) {
317
330
  case "object": {
318
331
  let r = `${t}/${e.objectName ?? ""}`, i = e.recordId;
319
332
  if (i) {
320
- let t = J(i, n);
333
+ let t = Z(i, n);
321
334
  if (t) {
322
335
  let n = `${r}/record/${encodeURIComponent(t)}`;
323
336
  return {
@@ -331,7 +344,7 @@ function Y(e, t, n) {
331
344
  let e = new URLSearchParams();
332
345
  for (let [t, r] of Object.entries(a)) {
333
346
  if (r == null || t === "") continue;
334
- let i = J(String(r), n);
347
+ let i = Z(String(r), n);
335
348
  i !== null && e.set(`filter[${t}]`, i);
336
349
  }
337
350
  let t = e.toString();
@@ -358,7 +371,7 @@ function Y(e, t, n) {
358
371
  if (r && typeof r == "object") {
359
372
  let e = new URLSearchParams();
360
373
  for (let [t, i] of Object.entries(r)) if (i != null) if (typeof i == "string") {
361
- let r = J(i, n);
374
+ let r = Z(i, n);
362
375
  r !== null && e.set(t, r);
363
376
  } else e.set(t, JSON.stringify(i));
364
377
  let t = e.toString();
@@ -393,8 +406,8 @@ function Y(e, t, n) {
393
406
  let e = i[1], r = a && typeof a.type == "string" ? a.type : void 0, o = a && typeof a.name == "string" ? a.name : void 0, s = "";
394
407
  if (a && typeof a == "object") {
395
408
  let e = new URLSearchParams();
396
- for (let [t, r] of Object.entries(a)) if (!(t === "type" || t === "name") && r != null) if (typeof r == "string") {
397
- let i = J(r, n);
409
+ for (let [t, r] of Object.entries(a)) if (t !== "type" && t !== "name" && r != null) if (typeof r == "string") {
410
+ let i = Z(r, n);
398
411
  i && e.set(t, i);
399
412
  } else e.set(t, JSON.stringify(r));
400
413
  let t = e.toString();
@@ -429,27 +442,27 @@ function Y(e, t, n) {
429
442
  };
430
443
  }
431
444
  }
432
- var Fe = 50, Ie = 40, Le = 30, Re = 25, ze = 10, Be = 5;
433
- function Ve(e) {
445
+ var Pe = 50, Fe = 40, Ie = 30, Le = 25, Re = 10, ze = 5;
446
+ function Be(e) {
434
447
  let t = /* @__PURE__ */ new Map();
435
448
  return new URLSearchParams(e).forEach((e, n) => {
436
449
  let r = /^filter\[(.+)\]$/.exec(n);
437
450
  r && r[1] && e !== "" && t.set(r[1], e);
438
451
  }), t;
439
452
  }
440
- function He(e, t) {
453
+ function Ve(e, t) {
441
454
  return t.startsWith(`${e}.`) ? t.slice(e.length + 1) : t;
442
455
  }
443
- function Ue(e, t, n, r, i) {
444
- let { href: a, external: o } = Y(e, r, i);
456
+ function He(e, t, n, r, i) {
457
+ let { href: a, external: o } = Ne(e, r, i);
445
458
  if (o || a === "#") return 0;
446
459
  if (e.type === "object" && e.objectName) {
447
460
  let a = `${r}/${e.objectName}`;
448
461
  if (t !== a && !t.startsWith(`${a}/`)) return 0;
449
462
  let o = t === a ? [] : t.slice(a.length + 1).split("/"), s = e.recordId;
450
463
  if (s) {
451
- let e = J(s, i);
452
- if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Fe : 0;
464
+ let e = Z(s, i);
465
+ if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Pe : 0;
453
466
  }
454
467
  let c = e.filters;
455
468
  if (c && typeof c == "object" && !Array.isArray(c)) {
@@ -457,65 +470,65 @@ function Ue(e, t, n, r, i) {
457
470
  let e = /* @__PURE__ */ new Map();
458
471
  for (let [t, n] of Object.entries(c)) {
459
472
  if (n == null || t === "") continue;
460
- let r = J(String(n), i);
473
+ let r = Z(String(n), i);
461
474
  r !== null && e.set(t, r);
462
475
  }
463
476
  if (e.size !== n.size) return 0;
464
477
  for (let [t, r] of e) if (n.get(t) !== r) return 0;
465
- return Ie;
478
+ return Fe;
466
479
  }
467
- return e.viewName ? o[0] !== "view" || !o[1] ? 0 : He(e.objectName, decodeURIComponent(o[1])) === He(e.objectName, e.viewName) ? Le : 0 : o.length === 0 ? Re : ze;
480
+ return e.viewName ? o[0] !== "view" || !o[1] ? 0 : Ve(e.objectName, decodeURIComponent(o[1])) === Ve(e.objectName, e.viewName) ? Ie : 0 : o.length === 0 ? Le : Re;
468
481
  }
469
482
  let s = a.split("?")[0];
470
- if (t === s) return Re;
483
+ if (t === s) return Le;
471
484
  let c = e.componentRef;
472
- return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ? Be : 0;
485
+ return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ? ze : 0;
473
486
  }
474
- function We(e, t, n, r, i) {
475
- let a = Ve(n), o = null, s = 0, c = (e) => {
487
+ function Ue(e, t, n, r, i) {
488
+ let a = Be(n), o = null, s = 0, c = (e) => {
476
489
  if (e) for (let n of e) {
477
490
  if (n.type === "group") {
478
491
  c(n.children);
479
492
  continue;
480
493
  }
481
- let e = Ue(n, t, a, r, i);
494
+ let e = He(n, t, a, r, i);
482
495
  e > s && (o = n, s = e);
483
496
  }
484
497
  };
485
498
  return c(e), o;
486
499
  }
487
- var X = t.createContext(null);
488
- function Z(e, t) {
500
+ var We = t.createContext(null);
501
+ function Ge(e, t) {
489
502
  if (!t.trim()) return e;
490
503
  let n = t.toLowerCase().trim();
491
504
  return e.reduce((e, r) => {
492
505
  if (r.type === "separator") return e;
493
506
  if (r.type === "group" && r.children?.length) {
494
- let n = Z(r.children, t);
507
+ let n = Ge(r.children, t);
495
508
  return n.length > 0 && e.push({
496
509
  ...r,
497
510
  children: n
498
511
  }), e;
499
512
  }
500
- return q(r.label).toLowerCase().includes(n) && e.push(r), e;
513
+ return X(r.label).toLowerCase().includes(n) && e.push(r), e;
501
514
  }, []);
502
515
  }
503
- var Ge = 5;
504
- function Ke({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, resolveViewLabel: f, resolveItemLabel: p, t: m, templateContext: h }) {
505
- let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } = pe({
516
+ var Ke = 5;
517
+ function qe({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, resolveViewLabel: f, resolveItemLabel: p, t: m, templateContext: h }) {
518
+ let { attributes: g, listeners: _, setNodeRef: v, transform: y, transition: b, isDragging: x } = ue({
506
519
  id: e.id,
507
520
  disabled: !c
508
- });
509
- return /* @__PURE__ */ R("div", {
521
+ }), S = {
522
+ transform: fe.Transform.toString(y),
523
+ transition: b,
524
+ opacity: x ? .5 : void 0,
525
+ zIndex: x ? 10 : void 0
526
+ };
527
+ return /* @__PURE__ */ z("div", {
510
528
  ref: v,
511
- style: {
512
- transform: he.Transform.toString(y),
513
- transition: b,
514
- opacity: x ? .5 : void 0,
515
- zIndex: x ? 10 : void 0
516
- },
529
+ style: S,
517
530
  ...g,
518
- children: /* @__PURE__ */ R(Q, {
531
+ children: /* @__PURE__ */ z(Q, {
519
532
  item: e,
520
533
  basePath: t,
521
534
  evalVis: n,
@@ -539,27 +552,27 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
539
552
  let j = M(), N = j ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, F = A("shrink-0", j ? "h-5 w-5" : "h-4 w-4"), te = (() => {
540
553
  if (typeof e.expanded == "boolean") return e.expanded;
541
554
  if (typeof e.defaultOpen == "boolean") return e.defaultOpen;
542
- })(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(X), [L, ae] = i(t.useMemo(() => {
555
+ })(), ie = e.type === "group" ? e.children?.length ?? 0 : 0, I = t.useContext(We), L = t.useMemo(() => {
543
556
  if (e.type !== "group" || !I) return !1;
544
557
  let t = (e) => !!e?.some((e) => e.id === I || e.type === "group" && t(e.children));
545
558
  return t(e.children);
546
- }, [e, I]) ? !0 : te ?? !(ie >= 8));
559
+ }, [e, I]) ? !0 : te ?? !(ie >= 8), [R, V] = i(L);
547
560
  if (!r(e.visible) || e.requiredPermissions?.length && !o(e.requiredPermissions)) return null;
548
- let B = e.requiresObject, V = e.requiresService;
549
- if (B && !u("object", B) || V && !u("service", V)) return null;
550
- if (e.type === "separator") return /* @__PURE__ */ R(f, { className: "my-2" });
561
+ let H = e.requiresObject, U = e.requiresService;
562
+ if (H && !u("object", H) || U && !u("service", U)) return null;
563
+ if (e.type === "separator") return /* @__PURE__ */ z(f, { className: "my-2" });
551
564
  if (e.type === "group") {
552
- let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = Ae(e, y, O, b, x, E, D);
553
- return /* @__PURE__ */ R(s, {
554
- open: L,
555
- onOpenChange: ae,
556
- children: /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ R(v, {
565
+ let t = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), i = De(e, y, O, b, x, E, D);
566
+ return /* @__PURE__ */ z(s, {
567
+ open: R,
568
+ onOpenChange: V,
569
+ children: /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, {
557
570
  asChild: !0,
558
- children: /* @__PURE__ */ z(l, {
571
+ children: /* @__PURE__ */ B(l, {
559
572
  className: A("flex w-full items-center justify-between", j && "min-h-[44px] text-[15px] rounded-xl"),
560
- children: [i, /* @__PURE__ */ R(P, { className: A("ml-auto transition-transform", j ? "h-5 w-5" : "h-4 w-4", L && "rotate-90") })]
573
+ children: [i, /* @__PURE__ */ z(P, { className: A("ml-auto transition-transform", j ? "h-5 w-5" : "h-4 w-4", R && "rotate-90") })]
561
574
  })
562
- }), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
575
+ }), /* @__PURE__ */ z(c, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z(Q, {
563
576
  item: e,
564
577
  basePath: n,
565
578
  evalVis: r,
@@ -580,93 +593,93 @@ function Q({ item: e, basePath: n, evalVis: r, checkPerm: o, checkCap: u, onActi
580
593
  }
581
594
  if (e.type === "action") {
582
595
  if (!d) return null;
583
- let t = K(e.icon), r = q(e.label, O);
584
- return /* @__PURE__ */ z(T, { children: [
585
- h && /* @__PURE__ */ R("span", {
596
+ let t = Y(e.icon), r = X(e.label, O);
597
+ return /* @__PURE__ */ B(T, { children: [
598
+ h && /* @__PURE__ */ z("span", {
586
599
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
587
600
  "aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
588
601
  ...h,
589
- children: /* @__PURE__ */ R(ee, { className: "h-3.5 w-3.5" })
602
+ children: /* @__PURE__ */ z(ee, { className: "h-3.5 w-3.5" })
590
603
  }),
591
- /* @__PURE__ */ z(w, {
604
+ /* @__PURE__ */ B(w, {
592
605
  tooltip: r,
593
606
  onClick: () => d?.(e),
594
607
  className: N,
595
608
  children: [
596
- /* @__PURE__ */ R(t, { className: F }),
597
- /* @__PURE__ */ R("span", { children: r }),
598
- e.badge != null && /* @__PURE__ */ R(a, {
609
+ /* @__PURE__ */ z(t, { className: F }),
610
+ /* @__PURE__ */ z("span", { children: r }),
611
+ e.badge != null && /* @__PURE__ */ z(a, {
599
612
  variant: e.badgeVariant ?? "default",
600
613
  className: "ml-auto text-[10px] px-1.5 py-0",
601
614
  children: e.badge
602
615
  })
603
616
  ]
604
617
  }),
605
- p && m && /* @__PURE__ */ R(C, {
618
+ p && m && /* @__PURE__ */ z(C, {
606
619
  showOnHover: !0,
607
620
  onClick: () => m(e.id, !e.pinned, e, n),
608
621
  "aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
609
622
  defaultValue: e.pinned ? `Unpin ${r}` : `Pin ${r}`,
610
623
  name: r
611
624
  }) : e.pinned ? `Unpin ${r}` : `Pin ${r}`,
612
- children: e.pinned ? /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
625
+ children: e.pinned ? /* @__PURE__ */ z(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
613
626
  })
614
627
  ] });
615
628
  }
616
- let ce = K(e.icon), { href: H, external: le } = Y(e, n, k), ue = I !== null && e.id === I, U = Ae(e, y, O, b, x, E, D), W = /* @__PURE__ */ z(oe, { children: [
617
- /* @__PURE__ */ R(ce, { className: F }),
618
- /* @__PURE__ */ R("span", { children: U }),
619
- e.badge != null && /* @__PURE__ */ R(a, {
629
+ let se = Y(e.icon), { href: W, external: ce } = Ne(e, n, k), G = I !== null && e.id === I, K = De(e, y, O, b, x, E, D), q = /* @__PURE__ */ B(ae, { children: [
630
+ /* @__PURE__ */ z(se, { className: F }),
631
+ /* @__PURE__ */ z("span", { children: K }),
632
+ e.badge != null && /* @__PURE__ */ z(a, {
620
633
  variant: e.badgeVariant ?? "default",
621
634
  className: "ml-auto text-[10px] px-1.5 py-0",
622
635
  children: e.badge
623
636
  })
624
637
  ] });
625
- return /* @__PURE__ */ z(T, { children: [
626
- h && /* @__PURE__ */ R("span", {
638
+ return /* @__PURE__ */ B(T, { children: [
639
+ h && /* @__PURE__ */ z("span", {
627
640
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
628
641
  "aria-label": O ? O("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
629
642
  ...h,
630
- children: /* @__PURE__ */ R(ee, { className: "h-3.5 w-3.5" })
643
+ children: /* @__PURE__ */ z(ee, { className: "h-3.5 w-3.5" })
631
644
  }),
632
- /* @__PURE__ */ R(w, {
645
+ /* @__PURE__ */ z(w, {
633
646
  asChild: !0,
634
- isActive: ue,
635
- tooltip: U,
647
+ isActive: G,
648
+ tooltip: K,
636
649
  className: N,
637
- children: le ? /* @__PURE__ */ R("a", {
638
- href: H,
650
+ children: ce ? /* @__PURE__ */ z("a", {
651
+ href: W,
639
652
  target: "_blank",
640
653
  rel: "noopener noreferrer",
641
- children: W
642
- }) : /* @__PURE__ */ R(se, {
643
- to: H,
644
- children: W
654
+ children: q
655
+ }) : /* @__PURE__ */ z(oe, {
656
+ to: W,
657
+ children: q
645
658
  })
646
659
  }),
647
- p && m && /* @__PURE__ */ R(C, {
660
+ p && m && /* @__PURE__ */ z(C, {
648
661
  showOnHover: !0,
649
662
  onClick: () => m(e.id, !e.pinned, e, n),
650
663
  "aria-label": O ? O(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
651
- defaultValue: e.pinned ? `Unpin ${U}` : `Pin ${U}`,
652
- name: U
653
- }) : e.pinned ? `Unpin ${U}` : `Pin ${U}`,
654
- children: e.pinned ? /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" })
664
+ defaultValue: e.pinned ? `Unpin ${K}` : `Pin ${K}`,
665
+ name: K
666
+ }) : e.pinned ? `Unpin ${K}` : `Pin ${K}`,
667
+ children: e.pinned ? /* @__PURE__ */ z(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
655
668
  })
656
669
  ] });
657
670
  }
658
- function $({ items: e, basePath: t = "", evaluateVisibility: n = je, checkPermission: i = Me, checkCapability: a = Ne, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, resolveViewLabel: h, resolveItemLabel: y, t: b, templateContext: x }) {
659
- let C = V(), w = r(() => We(e, C.pathname, C.search, t, x)?.id ?? null, [
671
+ function $({ items: e, basePath: t = "", evaluateVisibility: n = Oe, checkPermission: i = ke, checkCapability: a = Ae, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, resolveViewLabel: h, resolveItemLabel: y, t: b, templateContext: x }) {
672
+ let C = H(), w = r(() => Ue(e, C.pathname, C.search, t, x)?.id ?? null, [
660
673
  e,
661
674
  C.pathname,
662
675
  C.search,
663
676
  t,
664
677
  x
665
- ]), T = r(() => s ? Z(e, s) : e, [e, s]), E = r(() => qe(T), [T]), D = T.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), O = W(U(le, { activationConstraint: { distance: Ge } }), U(H)), k = (e) => {
678
+ ]), T = r(() => s ? Ge(e, s) : e, [e, s]), E = r(() => Je(T), [T]), D = T.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), O = K(G(W, { activationConstraint: { distance: Ke } }), G(se)), k = (e) => {
666
679
  let { active: t, over: n } = e;
667
680
  if (!n || t.id === n.id || !d) return;
668
681
  let r = D.findIndex((e) => e.id === t.id), i = D.findIndex((e) => e.id === n.id);
669
- r === -1 || i === -1 || d(fe(D, r, i).map((e, t) => ({
682
+ r !== -1 && i !== -1 && d(le(D, r, i).map((e, t) => ({
670
683
  ...e,
671
684
  order: t
672
685
  })));
@@ -685,88 +698,87 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = je, checkPermis
685
698
  resolveItemLabel: y,
686
699
  t: b,
687
700
  templateContext: x
688
- }, j = D.some((e) => e.type === "group"), M = E.length > 0 && c ? /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
701
+ }, j = D.some((e) => e.type === "group"), M = E.length > 0 && c ? /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
689
702
  className: "flex items-center gap-1.5",
690
- children: [/* @__PURE__ */ R(I, { className: "h-3.5 w-3.5" }), b ? b("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
691
- }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: E.map((e) => /* @__PURE__ */ R(Q, {
703
+ children: [/* @__PURE__ */ z(I, { className: "h-3.5 w-3.5" }), b ? b("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
704
+ }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: E.map((e) => /* @__PURE__ */ z(Q, {
692
705
  item: e,
693
706
  ...A
694
707
  }, `fav-${e.id}`)) }) })] }) : null;
695
708
  if (!j) {
696
- let e = D.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ R(ce, {
709
+ let e = D.filter((e) => e.type !== "group").map((e) => e.id), t = u ? /* @__PURE__ */ z(U, {
697
710
  sensors: O,
698
- collisionDetection: ue,
711
+ collisionDetection: ce,
699
712
  onDragEnd: k,
700
- children: /* @__PURE__ */ R(de, {
713
+ children: /* @__PURE__ */ z(q, {
701
714
  items: e,
702
- strategy: me,
703
- children: /* @__PURE__ */ R(S, { children: D.map((e) => /* @__PURE__ */ R(Ke, {
715
+ strategy: de,
716
+ children: /* @__PURE__ */ z(S, { children: D.map((e) => /* @__PURE__ */ z(qe, {
704
717
  item: e,
705
718
  enableReorder: u,
706
719
  ...A
707
720
  }, e.id)) })
708
721
  })
709
- }) : /* @__PURE__ */ R(S, { children: D.map((e) => /* @__PURE__ */ R(Q, {
722
+ }) : /* @__PURE__ */ z(S, { children: D.map((e) => /* @__PURE__ */ z(Q, {
710
723
  item: e,
711
724
  ...A
712
725
  }, e.id)) });
713
- return /* @__PURE__ */ z(X.Provider, {
726
+ return /* @__PURE__ */ B(We.Provider, {
714
727
  value: w,
715
- children: [M, /* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: t }) })]
728
+ children: [M, /* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: t }) })]
716
729
  });
717
730
  }
718
731
  let N = [], P = [], F = (e) => {
719
732
  if (P.length === 0) return;
720
733
  let t = P;
721
- P = [], N.push(/* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
734
+ P = [], N.push(/* @__PURE__ */ z(g, { children: /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: t.map((e) => /* @__PURE__ */ z(Q, {
722
735
  item: e,
723
736
  ...A
724
737
  }, e.id)) }) }) }, e));
725
738
  };
726
739
  return D.forEach((e, t) => {
727
- e.type === "group" ? (F(`leaf-${t}`), N.push(/* @__PURE__ */ R(Q, {
740
+ e.type === "group" ? (F(`leaf-${t}`), N.push(/* @__PURE__ */ z(Q, {
728
741
  item: e,
729
742
  ...A
730
743
  }, e.id))) : P.push(e);
731
- }), F("leaf-end"), /* @__PURE__ */ z(X.Provider, {
744
+ }), F("leaf-end"), /* @__PURE__ */ B(We.Provider, {
732
745
  value: w,
733
746
  children: [M, N]
734
747
  });
735
748
  }
736
- function qe(e) {
749
+ function Je(e) {
737
750
  let t = [];
738
- for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...qe(n.children));
751
+ for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Je(n.children));
739
752
  return t;
740
753
  }
741
754
  //#endregion
742
755
  //#region src/AppSchemaRenderer.tsx
743
- function Je({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm: i }) {
744
- let a = e.filter((e) => !(!r(e.visible) || e.requiredPermissions?.length && !i(e.requiredPermissions)));
745
- return a.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
756
+ function Ye({ areas: e, activeAreaId: t, onAreaChange: n }) {
757
+ return e.length <= 1 ? null : /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ B(v, {
746
758
  className: "flex items-center gap-1.5",
747
- children: [/* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" }), "Area"]
748
- }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: a.map((e) => {
749
- let r = K(e.icon);
750
- return /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
759
+ children: [/* @__PURE__ */ z(te, { className: "h-3.5 w-3.5" }), "Area"]
760
+ }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.map((e) => {
761
+ let r = Y(e.icon);
762
+ return /* @__PURE__ */ z(T, { children: /* @__PURE__ */ B(w, {
751
763
  isActive: e.id === t,
752
- tooltip: q(e.label),
764
+ tooltip: X(e.label),
753
765
  onClick: () => n(e.id),
754
- children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: q(e.label) })]
766
+ children: [/* @__PURE__ */ z(r, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: X(e.label) })]
755
767
  }) }, e.id);
756
768
  }) }) })] });
757
769
  }
758
- function Ye({ items: e, basePath: t }) {
759
- let n = V(), r = (e) => {
770
+ function Xe({ items: e, basePath: t }) {
771
+ let n = H(), r = (e) => {
760
772
  let t = [];
761
773
  for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
762
774
  return t;
763
775
  }, i = r(e).slice(0, 5);
764
- return i.length === 0 ? null : /* @__PURE__ */ R("div", {
776
+ return i.length === 0 ? null : /* @__PURE__ */ z("div", {
765
777
  className: "fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom",
766
778
  role: "navigation",
767
779
  "aria-label": "Mobile navigation",
768
780
  children: i.map((e) => {
769
- let r = K(e.icon), i = "#";
781
+ let r = Y(e.icon), i = "#";
770
782
  if (e.type === "object") i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`);
771
783
  else if (e.type === "dashboard") i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#";
772
784
  else if (e.type === "page") i = e.pageName ? `${t}/page/${e.pageName}` : "#";
@@ -786,153 +798,157 @@ function Ye({ items: e, basePath: t }) {
786
798
  }
787
799
  }
788
800
  let a = i !== "#" && n.pathname.startsWith(i);
789
- return /* @__PURE__ */ z(se, {
801
+ return /* @__PURE__ */ B(oe, {
790
802
  to: i,
791
803
  className: `flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${a ? "text-primary" : "text-muted-foreground hover:text-foreground"}`,
792
- children: [/* @__PURE__ */ R(r, { className: "h-5 w-5" }), /* @__PURE__ */ R("span", {
804
+ children: [/* @__PURE__ */ z(r, { className: "h-5 w-5" }), /* @__PURE__ */ z("span", {
793
805
  className: "text-[10px] truncate max-w-[60px]",
794
- children: q(e.label)
806
+ children: X(e.label)
795
807
  })]
796
808
  }, e.id);
797
809
  })
798
810
  });
799
811
  }
800
- function Xe({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, activeAreaId: u, setActiveAreaId: d, resolvedNavigation: f, enableSearch: g, enablePinning: _, onPinToggle: v, enableReorder: x, onReorder: C }) {
801
- let E = K(e.logo), D = e.areas ?? [], [O, k] = i("");
802
- return /* @__PURE__ */ z(p, {
812
+ function Ze({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, visibleAreas: u, activeAreaId: d, setActiveAreaId: f, resolvedNavigation: g, enableSearch: _, enablePinning: v, onPinToggle: x, enableReorder: C, onReorder: E }) {
813
+ let D = Y(e.logo), [O, k] = i("");
814
+ return /* @__PURE__ */ B(p, {
803
815
  collapsible: "icon",
804
816
  children: [
805
- /* @__PURE__ */ z(y, { children: [s ?? /* @__PURE__ */ R(S, { children: /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
817
+ /* @__PURE__ */ B(y, { children: [s ?? /* @__PURE__ */ z(S, { children: /* @__PURE__ */ z(T, { children: /* @__PURE__ */ B(w, {
806
818
  size: "lg",
807
819
  tooltip: e.title ?? e.name,
808
- children: [/* @__PURE__ */ R("div", {
820
+ children: [/* @__PURE__ */ z("div", {
809
821
  className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",
810
- children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ R("img", {
822
+ children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ z("img", {
811
823
  src: e.logo,
812
824
  alt: e.title ?? "",
813
825
  className: "size-6 object-contain"
814
- }) : /* @__PURE__ */ R(E, { className: "size-4" })
815
- }), /* @__PURE__ */ z("div", {
826
+ }) : /* @__PURE__ */ z(D, { className: "size-4" })
827
+ }), /* @__PURE__ */ B("div", {
816
828
  className: "grid flex-1 text-left text-sm leading-tight",
817
- children: [/* @__PURE__ */ R("span", {
829
+ children: [/* @__PURE__ */ z("span", {
818
830
  className: "truncate font-semibold",
819
831
  children: e.title ?? e.name ?? "App"
820
- }), e.description && /* @__PURE__ */ R("span", {
832
+ }), e.description && /* @__PURE__ */ z("span", {
821
833
  className: "truncate text-xs text-muted-foreground",
822
834
  children: e.description
823
835
  })]
824
836
  })]
825
- }) }) }), g && /* @__PURE__ */ R(b, {
837
+ }) }) }), _ && /* @__PURE__ */ z(b, {
826
838
  placeholder: "Search navigation…",
827
839
  value: O,
828
840
  onChange: (e) => k(e.target.value),
829
841
  "aria-label": "Search navigation"
830
842
  })] }),
831
- /* @__PURE__ */ z(m, { children: [
832
- D.length > 1 && u && /* @__PURE__ */ R(Je, {
833
- areas: D,
834
- activeAreaId: u,
835
- onAreaChange: d,
836
- evalVis: n,
837
- checkPerm: r
843
+ /* @__PURE__ */ B(m, { children: [
844
+ u.length > 1 && d && /* @__PURE__ */ z(Ye, {
845
+ areas: u,
846
+ activeAreaId: d,
847
+ onAreaChange: f
838
848
  }),
839
- /* @__PURE__ */ R($, {
840
- items: f,
849
+ /* @__PURE__ */ z($, {
850
+ items: g,
841
851
  basePath: t,
842
852
  evaluateVisibility: n,
843
853
  checkPermission: r,
844
854
  checkCapability: a,
845
855
  onAction: o,
846
856
  searchQuery: O,
847
- enablePinning: _,
848
- onPinToggle: v,
849
- enableReorder: x,
850
- onReorder: C
857
+ enablePinning: v,
858
+ onPinToggle: x,
859
+ enableReorder: C,
860
+ onReorder: E
851
861
  }),
852
862
  l
853
863
  ] }),
854
- c && /* @__PURE__ */ R(h, { children: c })
864
+ c && /* @__PURE__ */ z(h, { children: c })
855
865
  ]
856
866
  });
857
867
  }
858
- function Ze({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluateVisibility: o, checkPermission: s, checkCapability: c, onAction: l, navbar: u, sidebarHeader: d, sidebarFooter: f, sidebarExtra: p, children: m, className: h, defaultOpen: g = !0, enableSearch: _, enablePinning: v, onPinToggle: y, enableReorder: b, onReorder: x }) {
859
- let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => ge(e, t)), [e.menu]), E = e.navigation ?? T, D = e.areas ?? [], [O, k] = i(() => D.length > 0 ? D[0].id : null), A = D.map((e) => e.id).join(",");
868
+ function Qe({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluateVisibility: o, checkPermission: s, checkCapability: c, onAction: l, navbar: u, sidebarHeader: d, sidebarFooter: f, sidebarExtra: p, children: m, className: h, defaultOpen: g = !0, enableSearch: _, enablePinning: v, onPinToggle: y, enableReorder: b, onReorder: x }) {
869
+ let S = o ?? ((e) => e !== !1 && e !== "false"), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => pe(e, t)), [e.menu]), E = e.navigation ?? T, D = (e.areas ?? []).filter((e) => je(e.navigation, {
870
+ evaluateVisibility: S,
871
+ checkPermission: C,
872
+ checkCapability: w,
873
+ hasActionHandler: !!l
874
+ })), [O, k] = i(() => D.length > 0 ? D[0].id : null), A = D.map((e) => e.id).join(",");
860
875
  n(() => {
861
876
  D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
862
877
  }, [e.name, A]);
863
- let j = D.find((e) => e.id === O)?.navigation ?? E, M = {
878
+ let j = D.find((e) => e.id === O) ?? D[0], M = j?.navigation ?? E, N = {
864
879
  title: e.title,
865
880
  favicon: e.favicon,
866
881
  logo: e.logo
867
- };
868
- return /* @__PURE__ */ z(oe, { children: [/* @__PURE__ */ R(G, {
869
- sidebar: /* @__PURE__ */ R(Xe, {
870
- schema: e,
871
- basePath: t,
872
- evalVis: S,
873
- checkPerm: C,
874
- checkCap: w,
875
- onAction: l,
876
- sidebarHeader: d,
877
- sidebarFooter: f,
878
- sidebarExtra: p,
879
- activeAreaId: O,
880
- setActiveAreaId: k,
881
- resolvedNavigation: j,
882
- enableSearch: _,
883
- enablePinning: v,
884
- onPinToggle: y,
885
- enableReorder: b,
886
- onReorder: x
887
- }),
882
+ }, P = /* @__PURE__ */ z(Ze, {
883
+ schema: e,
884
+ basePath: t,
885
+ evalVis: S,
886
+ checkPerm: C,
887
+ checkCap: w,
888
+ onAction: l,
889
+ sidebarHeader: d,
890
+ sidebarFooter: f,
891
+ sidebarExtra: p,
892
+ visibleAreas: D,
893
+ activeAreaId: j?.id ?? null,
894
+ setActiveAreaId: k,
895
+ resolvedNavigation: M,
896
+ enableSearch: _,
897
+ enablePinning: v,
898
+ onPinToggle: y,
899
+ enableReorder: b,
900
+ onReorder: x
901
+ });
902
+ return /* @__PURE__ */ B(ae, { children: [/* @__PURE__ */ z(J, {
903
+ sidebar: P,
888
904
  navbar: u,
889
905
  className: h,
890
906
  defaultOpen: g,
891
- branding: M,
907
+ branding: N,
892
908
  children: m
893
- }), a === "bottom_nav" && /* @__PURE__ */ R(Ye, {
894
- items: j,
909
+ }), a === "bottom_nav" && /* @__PURE__ */ z(Xe, {
910
+ items: M,
895
911
  basePath: t
896
912
  })] });
897
913
  }
898
914
  //#endregion
899
915
  //#region src/SidebarNav.tsx
900
- function Qe(e) {
916
+ function $e(e) {
901
917
  return "items" in e && !("href" in e);
902
918
  }
903
- function $e({ item: e, pathname: t }) {
904
- return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
919
+ function et({ item: e, pathname: t }) {
920
+ return e.children && e.children.length > 0 ? /* @__PURE__ */ z(s, {
905
921
  asChild: !0,
906
922
  defaultOpen: !0,
907
923
  className: "group/collapsible",
908
- children: /* @__PURE__ */ z(T, { children: [/* @__PURE__ */ R(l, {
924
+ children: /* @__PURE__ */ B(T, { children: [/* @__PURE__ */ z(l, {
909
925
  asChild: !0,
910
- children: /* @__PURE__ */ z(w, {
926
+ children: /* @__PURE__ */ B(w, {
911
927
  tooltip: e.title,
912
928
  className: "motion-safe:transition-colors motion-safe:duration-150",
913
929
  children: [
914
- e.icon && /* @__PURE__ */ R(e.icon, {}),
915
- /* @__PURE__ */ R("span", { children: e.title }),
916
- e.badge != null && /* @__PURE__ */ R(a, {
930
+ e.icon && /* @__PURE__ */ z(e.icon, {}),
931
+ /* @__PURE__ */ z("span", { children: e.title }),
932
+ e.badge != null && /* @__PURE__ */ z(a, {
917
933
  variant: e.badgeVariant || "default",
918
934
  className: "ml-auto mr-1 h-5 min-w-5 px-1 text-xs",
919
935
  children: e.badge
920
936
  }),
921
- /* @__PURE__ */ R(P, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
937
+ /* @__PURE__ */ z(P, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
922
938
  ]
923
939
  })
924
- }), /* @__PURE__ */ R(c, {
940
+ }), /* @__PURE__ */ z(c, {
925
941
  className: "motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:slide-out-to-top-1 motion-safe:data-[state=open]:slide-in-from-top-1 motion-safe:duration-150",
926
- children: /* @__PURE__ */ R(E, { children: e.children.map((e) => /* @__PURE__ */ R(O, { children: /* @__PURE__ */ R(D, {
942
+ children: /* @__PURE__ */ z(E, { children: e.children.map((e) => /* @__PURE__ */ z(O, { children: /* @__PURE__ */ z(D, {
927
943
  asChild: !0,
928
944
  isActive: t === e.href,
929
945
  className: "motion-safe:transition-colors motion-safe:duration-150",
930
- children: /* @__PURE__ */ z(B, {
946
+ children: /* @__PURE__ */ B(V, {
931
947
  to: e.href,
932
948
  children: [
933
- e.icon && /* @__PURE__ */ R(e.icon, {}),
934
- /* @__PURE__ */ R("span", { children: e.title }),
935
- e.badge != null && /* @__PURE__ */ R(a, {
949
+ e.icon && /* @__PURE__ */ z(e.icon, {}),
950
+ /* @__PURE__ */ z("span", { children: e.title }),
951
+ e.badge != null && /* @__PURE__ */ z(a, {
936
952
  variant: e.badgeVariant || "default",
937
953
  className: "ml-auto h-5 min-w-5 px-1 text-xs",
938
954
  children: e.badge
@@ -941,17 +957,17 @@ function $e({ item: e, pathname: t }) {
941
957
  })
942
958
  }) }, e.href)) })
943
959
  })] })
944
- }) : /* @__PURE__ */ R(T, { children: /* @__PURE__ */ R(w, {
960
+ }) : /* @__PURE__ */ z(T, { children: /* @__PURE__ */ z(w, {
945
961
  asChild: !0,
946
962
  isActive: t === e.href,
947
963
  tooltip: e.title,
948
964
  className: "motion-safe:transition-colors motion-safe:duration-150",
949
- children: /* @__PURE__ */ z(B, {
965
+ children: /* @__PURE__ */ B(V, {
950
966
  to: e.href,
951
967
  children: [
952
- e.icon && /* @__PURE__ */ R(e.icon, {}),
953
- /* @__PURE__ */ R("span", { children: e.title }),
954
- e.badge != null && /* @__PURE__ */ R(a, {
968
+ e.icon && /* @__PURE__ */ z(e.icon, {}),
969
+ /* @__PURE__ */ z("span", { children: e.title }),
970
+ e.badge != null && /* @__PURE__ */ z(a, {
955
971
  variant: e.badgeVariant || "default",
956
972
  className: "ml-auto h-5 min-w-5 px-1 text-xs",
957
973
  children: e.badge
@@ -960,8 +976,8 @@ function $e({ item: e, pathname: t }) {
960
976
  })
961
977
  }) });
962
978
  }
963
- function et({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
964
- let s = V(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : Qe(e[0]) ? e.map((e) => ({
979
+ function tt({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
980
+ let s = H(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : $e(e[0]) ? e.map((e) => ({
965
981
  groupLabel: e.label,
966
982
  items: e.items
967
983
  })) : [{ items: e }], [e]), f = t.useMemo(() => {
@@ -972,14 +988,14 @@ function et({ items: e, title: n = "Application", className: r, collapsible: i =
972
988
  items: t.items.filter((t) => t.title.toLowerCase().includes(e) || t.children?.some((t) => t.title.toLowerCase().includes(e)))
973
989
  })).filter((e) => e.items.length > 0);
974
990
  }, [d, c]);
975
- return /* @__PURE__ */ R(p, {
991
+ return /* @__PURE__ */ z(p, {
976
992
  className: r,
977
993
  collapsible: i,
978
- children: /* @__PURE__ */ z(m, { children: [a && /* @__PURE__ */ R("div", {
994
+ children: /* @__PURE__ */ B(m, { children: [a && /* @__PURE__ */ z("div", {
979
995
  className: "px-3 py-2",
980
- children: /* @__PURE__ */ z("div", {
996
+ children: /* @__PURE__ */ B("div", {
981
997
  className: "relative",
982
- children: [/* @__PURE__ */ R(ie, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ R(u, {
998
+ children: [/* @__PURE__ */ z(ie, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ z(u, {
983
999
  type: "search",
984
1000
  placeholder: o,
985
1001
  value: c,
@@ -987,16 +1003,16 @@ function et({ items: e, title: n = "Application", className: r, collapsible: i =
987
1003
  className: "pl-8 h-9"
988
1004
  })]
989
1005
  })
990
- }), f.map((e, t) => /* @__PURE__ */ z(g, { children: [
991
- t > 0 && /* @__PURE__ */ R("div", {
1006
+ }), f.map((e, t) => /* @__PURE__ */ B(g, { children: [
1007
+ t > 0 && /* @__PURE__ */ z("div", {
992
1008
  className: "mx-3 mb-1 h-px bg-sidebar-border/60",
993
1009
  "aria-hidden": !0
994
1010
  }),
995
- /* @__PURE__ */ R(v, {
1011
+ /* @__PURE__ */ z(v, {
996
1012
  className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
997
1013
  children: e.groupLabel || n
998
1014
  }),
999
- /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R($e, {
1015
+ /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(S, { children: e.items.map((e) => /* @__PURE__ */ z(et, {
1000
1016
  item: e,
1001
1017
  pathname: s.pathname
1002
1018
  }, e.href)) }) })
@@ -1005,29 +1021,31 @@ function et({ items: e, title: n = "Application", className: r, collapsible: i =
1005
1021
  }
1006
1022
  //#endregion
1007
1023
  //#region src/index.ts
1008
- function tt() {
1009
- e.register("page-header", ye, {
1024
+ function nt() {
1025
+ e.register("page-header", ge, {
1010
1026
  namespace: "layout",
1011
1027
  label: "Page Header",
1012
1028
  category: "Layout",
1013
1029
  inputs: [{
1014
1030
  name: "title",
1015
- type: "string"
1031
+ type: "string",
1032
+ label: "Title"
1016
1033
  }, {
1017
- name: "description",
1018
- type: "string"
1034
+ name: "subtitle",
1035
+ type: "string",
1036
+ label: "Subtitle"
1019
1037
  }]
1020
- }), e.register("page:card", Te, {
1038
+ }), e.register("page:card", Se, {
1021
1039
  namespace: "layout",
1022
1040
  skipFallback: !0,
1023
1041
  label: "Page Card",
1024
1042
  category: "Layout",
1025
1043
  isContainer: !0
1026
- }), e.register("app-shell", G, {
1044
+ }), e.register("app-shell", J, {
1027
1045
  namespace: "layout",
1028
1046
  label: "App Shell",
1029
1047
  category: "Layout"
1030
- }), e.register("responsive-grid", ke, {
1048
+ }), e.register("responsive-grid", Ee, {
1031
1049
  namespace: "layout",
1032
1050
  label: "Responsive Grid",
1033
1051
  category: "Layout",
@@ -1050,7 +1068,7 @@ function tt() {
1050
1068
  name: "basePath",
1051
1069
  type: "string"
1052
1070
  }]
1053
- }), e.register("app-schema-renderer", Ze, {
1071
+ }), e.register("app-schema-renderer", Qe, {
1054
1072
  namespace: "layout",
1055
1073
  label: "App Schema Renderer",
1056
1074
  category: "Layout",
@@ -1072,7 +1090,7 @@ function tt() {
1072
1090
  });
1073
1091
  }
1074
1092
  try {
1075
- tt();
1093
+ nt();
1076
1094
  } catch {}
1077
1095
  //#endregion
1078
- export { Ze as AppSchemaRenderer, G as AppShell, $ as NavigationRenderer, Te as PageCard, ye as PageHeader, ke as ResponsiveGrid, et as SidebarNav, Z as filterNavigationItems, tt as registerLayout, We as resolveActiveNavItem, Y as resolveHref, K as resolveIcon, q as resolveLabel, we as useAppShellBranding };
1096
+ export { Qe as AppSchemaRenderer, J as AppShell, $ as NavigationRenderer, Se as PageCard, ge as PageHeader, Ee as ResponsiveGrid, tt as SidebarNav, Ge as filterNavigationItems, je as hasVisibleNavigationItems, nt as registerLayout, Ue as resolveActiveNavItem, Ne as resolveHref, Y as resolveIcon, X as resolveLabel, xe as useAppShellBranding };