@object-ui/layout 4.3.0 → 4.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,119 @@
1
1
  # @object-ui/layout
2
2
 
3
+ ## 4.5.0
4
+
5
+ ### Patch Changes
6
+
7
+ - d714e85: Lookup display-name resolution now falls back through a Salesforce-style chain
8
+ when an `$expand`'d reference object lacks a top-level `name`/`label`/
9
+ `display_name`/`title` field:
10
+ 1. Standard display fields (existing behaviour)
11
+ 2. `salutation first_name last_name` composite — handles person records that
12
+ only carry first/last name parts
13
+ 3. `email` — last-resort identifier, beats the opaque id
14
+
15
+ Applies to `LookupCellRenderer`, `PageHeader.subtitle` interpolation,
16
+ `DetailView` page-mode `titleFormat`, and the shared `formatRecordTitle`
17
+ utility. Concretely: a Contact reference with `first_name: Bob`, `last_name:
18
+ Lin` and no `name` field now renders as `Bob Lin` everywhere — instead of
19
+ the email or [object Object] fallback.
20
+
21
+ - Updated dependencies [ab5e281]
22
+ - Updated dependencies [6b6afd1]
23
+ - Updated dependencies [aa7855f]
24
+ - Updated dependencies [170d89f]
25
+ - @object-ui/types@4.5.0
26
+ - @object-ui/components@4.5.0
27
+ - @object-ui/core@4.5.0
28
+ - @object-ui/react@4.5.0
29
+
30
+ ## 4.4.0
31
+
32
+ ### Minor Changes
33
+
34
+ - 67dabe1: feat(page-header): first-class `actions` property on page:header
35
+
36
+ PageHeader now accepts an `actions: ActionDef[]` (or string[]) property
37
+ and renders the toolbar inline in the header's right-aligned action slot.
38
+ Removes the need for authors to declare a sibling `record:quick_actions`
39
+ node and the `-mt-12` visual offset hack to pair the toolbar with the
40
+ title. The hack still applies for legacy schemas using the sibling form
41
+ (via location:'record_header'); the new in-header rendering opts out via
42
+ an `inline: true` flag automatically set by PageHeader.
43
+
44
+ ### Patch Changes
45
+
46
+ - 63eb66d: fix(detail): expand lookup fields so subtitle + lookup cells show display names
47
+
48
+ The record-page fetch in `RecordDetailView` (the page-mode path) now
49
+ requests `$expand` for every lookup/master_detail field on the object,
50
+ mirroring the behaviour the legacy `DetailView` already had. Combined
51
+ with two small downstream fixes — `PageHeader` subtitle interpolation
52
+ now extracts `name/label` from expanded reference objects instead of
53
+ rendering `[object Object]`, and `LookupCellRenderer` now short-circuits
54
+ to `pickRecordDisplayName` when the value is already a nested record —
55
+ all `record:*` renderers and the page header subtitle (`Owned by
56
+ {account}`) now display the related record's name rather than the raw
57
+ foreign-key id.
58
+
59
+ - ef0e30d: feat(page-header): back-to-list arrow on record pages
60
+
61
+ `page:header` now renders a ← back arrow at the left when a record
62
+ context with an id is present. Clicking it strips the trailing
63
+ `/record/{id}` segment from the URL so users return to the object list,
64
+ falling back to `history.back()` for deep-linked entry. The legacy app
65
+ pages without a record context are unaffected.
66
+
67
+ - 2bd45af: feat(shell): main becomes the scroll container; record tabs are sticky
68
+ - `AppShell`'s SidebarProvider wrapper is now constrained to viewport
69
+ height (`h-svh overflow-hidden`) instead of expanding with content via
70
+ the default `min-h-svh`. This makes the inner `<main>` (which is
71
+ `overflow-auto`) the actual scroll container instead of the window.
72
+ - `RecordDetailView` page-mode container drops the redundant
73
+ `h-full overflow-auto` (avoids nested scrollers; main owns scroll now).
74
+ - `page:tabs` (horizontal) gets `sticky top-0 z-20` with a translucent
75
+ backdrop so the tab strip stays visible while users scroll through
76
+ long record pages — the Salesforce Lightning behaviour our schemas
77
+ were already implying.
78
+
79
+ - Updated dependencies [2bd45af]
80
+ - @object-ui/components@4.4.0
81
+ - @object-ui/types@4.4.0
82
+ - @object-ui/core@4.4.0
83
+ - @object-ui/react@4.4.0
84
+
85
+ ## 4.3.1
86
+
87
+ ### Patch Changes
88
+
89
+ - 6b683c8: fix(detail): clean up record page rendering
90
+ - Drop `ai:chat_window` from the protocol-component placeholder list. The
91
+ floating chat overlay (plugin-chatbot) is the canonical AI entry point;
92
+ inline page schemas that still reference `ai:chat_window` now surface
93
+ as an explicit "Unknown component type" so the misconfiguration is
94
+ fixed at the source instead of silently leaking a placeholder card.
95
+ - `page:header` now resolves `{field.path}` tokens in `title` / `description`
96
+ against the current record context (matching the behaviour of the
97
+ alternative `containers.tsx` renderer). Without this, schemas like
98
+ `title: "{first_name} {last_name}"` rendered the literal template.
99
+ - `containers.tsx` `PageHeaderRenderer`: also read from `schema.properties.*`
100
+ as a fallback so both inlined and raw-bag schema shapes are supported.
101
+
102
+ - 0d8eb98: feat(detail): Salesforce-style record header + section field grid
103
+ - `page:header` now renders an icon chip (resolves Lucide names via
104
+ `LazyIcon`) plus subtitle, so detail pages can show
105
+ "Name / Company" without an extra component.
106
+ - `record:details` normalises string field entries (`fields: ['email']`)
107
+ into the `{name, label?}` shape expected by `DetailSection`, and maps
108
+ section `label` → `title`. Schemas authored against `@objectstack/spec`
109
+ now produce a real grouped field grid instead of an empty card.
110
+
111
+ - Updated dependencies [6b683c8]
112
+ - @object-ui/components@4.3.1
113
+ - @object-ui/react@4.3.1
114
+ - @object-ui/types@4.3.1
115
+ - @object-ui/core@4.3.1
116
+
3
117
  ## 4.3.0
4
118
 
5
119
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,34 +1,77 @@
1
1
  import { ComponentRegistry as e } from "@object-ui/core";
2
2
  import t, { useEffect as n, useMemo as r, useState as i } from "react";
3
- import { Badge as a, Collapsible as o, CollapsibleContent as s, CollapsibleTrigger as c, Input as l, Separator as u, Sidebar as d, SidebarContent as f, SidebarFooter as p, SidebarGroup as m, SidebarGroupContent as h, SidebarGroupLabel as g, SidebarHeader as _, SidebarInput as v, SidebarInset as y, SidebarMenu as b, SidebarMenuAction as x, SidebarMenuButton as S, SidebarMenuItem as C, SidebarMenuSub as w, SidebarMenuSubButton as T, SidebarMenuSubItem as E, SidebarProvider as D, cn as O, getLazyIcon as k } from "@object-ui/components";
4
- import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
5
- import { Link as N, NavLink as P, useLocation as F } from "react-router-dom";
6
- import { ChevronRight as I, FileText as ee, GripVertical as te, Layers as L, Pin as R, PinOff as ne, Search as re, Star as ie } from "lucide-react";
7
- import { DndContext as z, KeyboardSensor as B, PointerSensor as ae, closestCenter as oe, useSensor as V, useSensors as se } from "@dnd-kit/core";
8
- import { SortableContext as ce, arrayMove as le, useSortable as ue, verticalListSortingStrategy as de } from "@dnd-kit/sortable";
9
- import { CSS as fe } from "@dnd-kit/utilities";
10
- import { menuItemToNavigationItem as pe } from "@object-ui/types";
11
- import { SchemaRenderer as me } from "@object-ui/react";
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 } from "@object-ui/components";
4
+ import { ArrowLeft as M, ChevronRight as ee, FileText as N, GripVertical as te, Layers as ne, Pin as re, PinOff as ie, Search as P, Star as F } from "lucide-react";
5
+ import { SchemaRenderer as I, useRecordContext as ae } from "@object-ui/react";
6
+ import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
7
+ import { Link as oe, NavLink as se, useLocation as B } from "react-router-dom";
8
+ import { DndContext as ce, KeyboardSensor as le, PointerSensor as ue, closestCenter as de, useSensor as fe, useSensors as pe } from "@dnd-kit/core";
9
+ import { SortableContext as me, arrayMove as he, useSortable as ge, verticalListSortingStrategy as _e } from "@dnd-kit/sortable";
10
+ import { CSS as ve } from "@dnd-kit/utilities";
11
+ import { menuItemToNavigationItem as ye } from "@object-ui/types";
12
12
  //#region src/PageHeader.tsx
13
- function H({ title: e, description: t, action: n, className: r, children: i, ...a }) {
14
- return /* @__PURE__ */ j("div", {
15
- className: O("flex flex-col gap-4 pb-4 md:pb-8", r),
16
- ...a,
17
- children: /* @__PURE__ */ M("div", {
18
- className: "flex flex-wrap items-end gap-x-4 gap-y-2",
19
- children: [/* @__PURE__ */ M("div", {
20
- className: "flex flex-col gap-1 min-w-0",
21
- children: [/* @__PURE__ */ j("h1", {
22
- className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
23
- children: e
24
- }), t && /* @__PURE__ */ j("p", {
25
- className: "text-sm text-muted-foreground",
26
- children: t
27
- })]
28
- }), (n || i) && /* @__PURE__ */ M("div", {
29
- className: "flex items-center gap-2 ml-auto sm:ml-0",
30
- children: [n, i]
31
- })]
13
+ var be = (e) => {
14
+ let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
15
+ return t != null && String(t).trim() ? String(t) : [
16
+ e?.salutation,
17
+ e?.first_name,
18
+ e?.last_name
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
+ }, V = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
21
+ let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
22
+ return r == null ? "" : typeof r == "object" ? be(r) ?? "" : String(r);
23
+ }).replace(/\s+/g, " ").trim() : e;
24
+ function H({ 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 = V(e, m?.data) || e, g = n ?? r, _ = V(g, m?.data) || g, v = !!m?.recordId, y = c ?? v, b = t.useCallback(() => {
26
+ if (typeof window > "u") return;
27
+ let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
28
+ t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
29
+ }, []), x = Array.isArray(l?.children) ? l.children.filter(Boolean).map((e, t) => /* @__PURE__ */ R(I, { schema: e }, e?.id || `pgh-child-${t}`)) : null, S = 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, C = a || f || (S ? /* @__PURE__ */ R(I, { schema: {
30
+ type: "record:quick_actions",
31
+ properties: {
32
+ actions: S,
33
+ location: "record_header",
34
+ align: "end",
35
+ inline: !0
36
+ }
37
+ } }) : null) || x;
38
+ return /* @__PURE__ */ R("div", {
39
+ className: A("flex flex-col gap-3 pb-4 border-b", u),
40
+ ...p,
41
+ children: /* @__PURE__ */ z("div", {
42
+ className: "flex flex-wrap items-center gap-x-4 gap-y-2",
43
+ children: [
44
+ y && /* @__PURE__ */ R(o, {
45
+ type: "button",
46
+ variant: "ghost",
47
+ size: "icon",
48
+ onClick: b,
49
+ "aria-label": "Back to list",
50
+ className: "flex-shrink-0 -ml-2",
51
+ children: /* @__PURE__ */ R(M, { className: "size-4" })
52
+ }),
53
+ i && /* @__PURE__ */ R("div", {
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, {
56
+ name: i,
57
+ className: "size-5"
58
+ }) : i
59
+ }),
60
+ /* @__PURE__ */ z("div", {
61
+ className: "flex flex-col min-w-0 flex-1",
62
+ children: [/* @__PURE__ */ R("h1", {
63
+ className: "text-2xl font-bold tracking-tight md:text-3xl truncate",
64
+ children: h
65
+ }), _ && /* @__PURE__ */ R("p", {
66
+ className: "text-sm text-muted-foreground truncate",
67
+ children: _
68
+ })]
69
+ }),
70
+ C && /* @__PURE__ */ R("div", {
71
+ className: "flex items-center gap-2 ml-auto",
72
+ children: C
73
+ })
74
+ ]
32
75
  })
33
76
  });
34
77
  }
@@ -77,7 +120,7 @@ function K(e) {
77
120
  }, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
78
121
  return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
79
122
  }
80
- function q(e, t) {
123
+ function xe(e, t) {
81
124
  n(() => {
82
125
  let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
83
126
  if (e?.primaryColor) {
@@ -113,19 +156,19 @@ function q(e, t) {
113
156
  t
114
157
  ]);
115
158
  }
116
- function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a }) {
117
- return q(a, a?.title), /* @__PURE__ */ M(D, {
159
+ function q({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a }) {
160
+ return xe(a, a?.title), /* @__PURE__ */ z(k, {
118
161
  defaultOpen: i,
119
- className: "!flex-col",
120
- children: [/* @__PURE__ */ j("header", {
162
+ className: "!flex-col h-svh overflow-hidden",
163
+ children: [/* @__PURE__ */ R("header", {
121
164
  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",
122
165
  children: t
123
- }), /* @__PURE__ */ M("div", {
166
+ }), /* @__PURE__ */ z("div", {
124
167
  className: "flex flex-1 min-h-0 w-full",
125
- children: [e, /* @__PURE__ */ j(y, {
168
+ children: [e, /* @__PURE__ */ R(x, {
126
169
  className: "min-w-0",
127
- children: /* @__PURE__ */ j("main", {
128
- className: O("flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6", r),
170
+ children: /* @__PURE__ */ R("main", {
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),
129
172
  children: n
130
173
  })
131
174
  })]
@@ -134,11 +177,11 @@ function J({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
134
177
  }
135
178
  //#endregion
136
179
  //#region src/PageCard.tsx
137
- function he({ className: e, children: t, ...n }) {
138
- return /* @__PURE__ */ j("div", {
139
- className: O("rounded-xl border bg-card text-card-foreground shadow", e),
180
+ function Se({ className: e, children: t, ...n }) {
181
+ return /* @__PURE__ */ R("div", {
182
+ className: A("rounded-xl border bg-card text-card-foreground shadow", e),
140
183
  ...n,
141
- children: /* @__PURE__ */ j("div", {
184
+ children: /* @__PURE__ */ R("div", {
142
185
  className: "p-6",
143
186
  children: t
144
187
  })
@@ -146,7 +189,7 @@ function he({ className: e, children: t, ...n }) {
146
189
  }
147
190
  //#endregion
148
191
  //#region src/ResponsiveGrid.tsx
149
- var ge = {
192
+ var Ce = {
150
193
  xs: {
151
194
  1: "grid-cols-1",
152
195
  2: "grid-cols-2",
@@ -196,11 +239,11 @@ var ge = {
196
239
  12: "2xl:grid-cols-12"
197
240
  }
198
241
  };
199
- function _e(e) {
242
+ function we(e) {
200
243
  if (!e) return "grid-cols-1";
201
244
  let t = [];
202
245
  for (let [n, r] of Object.entries(e)) {
203
- let e = ge[n];
246
+ let e = Ce[n];
204
247
  if (e && r) {
205
248
  let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
206
249
  t.push(e[n]);
@@ -208,7 +251,7 @@ function _e(e) {
208
251
  }
209
252
  return t.join(" ") || "grid-cols-1";
210
253
  }
211
- var ve = {
254
+ var Te = {
212
255
  0: "gap-0",
213
256
  1: "gap-1",
214
257
  2: "gap-2",
@@ -217,16 +260,16 @@ var ve = {
217
260
  5: "gap-5",
218
261
  6: "gap-6",
219
262
  8: "gap-8"
220
- }, ye = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ j("div", {
221
- className: O("grid", _e(e), typeof t == "number" ? ve[t] || `gap-${t}` : "", n),
263
+ }, Ee = ({ columns: e, gap: t = 4, className: n, children: r }) => /* @__PURE__ */ R("div", {
264
+ className: A("grid", we(e), typeof t == "number" ? Te[t] || `gap-${t}` : "", n),
222
265
  children: r
223
266
  });
224
267
  //#endregion
225
268
  //#region src/NavigationRenderer.tsx
226
- function Y(e) {
227
- return e ? k(e) : ee;
269
+ function J(e) {
270
+ return e ? j(e) : N;
228
271
  }
229
- function X(e, t) {
272
+ function Y(e, t) {
230
273
  if (typeof e == "string") return e;
231
274
  if (t) {
232
275
  let n = t(e.key, {
@@ -237,12 +280,12 @@ function X(e, t) {
237
280
  }
238
281
  return e.defaultValue || e.key;
239
282
  }
240
- function be(e, t, n, r, i) {
241
- let a = X(e.label, n);
283
+ function X(e, t, n, r, i) {
284
+ let a = Y(e.label, n);
242
285
  return typeof e.label == "string" ? t && e.type === "object" && e.objectName ? t(e.objectName, a) : r && e.type === "dashboard" && e.dashboardName ? r(e.dashboardName, a) : i && e.type === "group" && e.id ? i(e.id, a) : a : a;
243
286
  }
244
- var xe = (e) => !(e === !1 || e === "false"), Se = () => !0, Ce = () => !0;
245
- function we(e, t) {
287
+ var De = (e) => !(e === !1 || e === "false"), Oe = () => !0, ke = () => !0;
288
+ function Ae(e, t) {
246
289
  switch (e.type) {
247
290
  case "object": {
248
291
  let n = `${t}/${e.objectName ?? ""}`;
@@ -285,25 +328,25 @@ function Z(e, t) {
285
328
  children: n
286
329
  }), e;
287
330
  }
288
- return X(r.label).toLowerCase().includes(n) && e.push(r), e;
331
+ return Y(r.label).toLowerCase().includes(n) && e.push(r), e;
289
332
  }, []);
290
333
  }
291
- var Te = 5;
292
- function Ee({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, t: f }) {
293
- let { attributes: p, listeners: m, setNodeRef: h, transform: g, transition: _, isDragging: v } = ue({
334
+ var je = 5;
335
+ function Me({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAction: a, enablePinning: o, onPinToggle: s, enableReorder: c, resolveObjectLabel: l, resolveDashboardLabel: u, resolveGroupLabel: d, t: f }) {
336
+ let { attributes: p, listeners: m, setNodeRef: h, transform: g, transition: _, isDragging: v } = ge({
294
337
  id: e.id,
295
338
  disabled: !c
296
339
  });
297
- return /* @__PURE__ */ j("div", {
340
+ return /* @__PURE__ */ R("div", {
298
341
  ref: h,
299
342
  style: {
300
- transform: fe.Transform.toString(g),
343
+ transform: ve.Transform.toString(g),
301
344
  transition: _,
302
345
  opacity: v ? .5 : void 0,
303
346
  zIndex: v ? 10 : void 0
304
347
  },
305
348
  ...p,
306
- children: /* @__PURE__ */ j(Q, {
349
+ children: /* @__PURE__ */ R(Q, {
307
350
  item: e,
308
351
  basePath: t,
309
352
  evalVis: n,
@@ -320,119 +363,119 @@ function Ee({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, onAct
320
363
  })
321
364
  });
322
365
  }
323
- function Q({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: l, onAction: d, enablePinning: f, onPinToggle: p, dragListeners: _, resolveObjectLabel: v, resolveDashboardLabel: y, resolveGroupLabel: w, t: T }) {
324
- let E = F(), [D, O] = i(e.defaultOpen !== !1);
366
+ function Q({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: o, onAction: u, enablePinning: d, onPinToggle: p, dragListeners: m, resolveObjectLabel: h, resolveDashboardLabel: y, resolveGroupLabel: b, t: x }) {
367
+ let E = B(), [D, O] = i(e.defaultOpen !== !1);
325
368
  if (!n(e.visible) || e.requiredPermissions?.length && !r(e.requiredPermissions)) return null;
326
- let k = e.requiresObject, P = e.requiresService;
327
- if (k && !l("object", k) || P && !l("service", P)) return null;
328
- if (e.type === "separator") return /* @__PURE__ */ j(u, { className: "my-2" });
369
+ let k = e.requiresObject, A = e.requiresService;
370
+ if (k && !o("object", k) || A && !o("service", A)) return null;
371
+ if (e.type === "separator") return /* @__PURE__ */ R(f, { className: "my-2" });
329
372
  if (e.type === "group") {
330
373
  let i = (e.children ?? []).slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0));
331
- return /* @__PURE__ */ j(o, {
374
+ return /* @__PURE__ */ R(s, {
332
375
  open: D,
333
376
  onOpenChange: O,
334
- children: /* @__PURE__ */ M(m, { children: [/* @__PURE__ */ j(g, {
377
+ children: /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ R(v, {
335
378
  asChild: !0,
336
- children: /* @__PURE__ */ M(c, {
379
+ children: /* @__PURE__ */ z(l, {
337
380
  className: "flex w-full items-center justify-between",
338
- children: [be(e, v, T, y, w), /* @__PURE__ */ j(I, { className: `ml-auto h-4 w-4 transition-transform ${D ? "rotate-90" : ""}` })]
381
+ children: [X(e, h, x, y, b), /* @__PURE__ */ R(ee, { className: `ml-auto h-4 w-4 transition-transform ${D ? "rotate-90" : ""}` })]
339
382
  })
340
- }), /* @__PURE__ */ j(s, { children: /* @__PURE__ */ j(h, { children: /* @__PURE__ */ j(b, { children: i.map((e) => /* @__PURE__ */ j(Q, {
383
+ }), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: i.map((e) => /* @__PURE__ */ R(Q, {
341
384
  item: e,
342
385
  basePath: t,
343
386
  evalVis: n,
344
387
  checkPerm: r,
345
- checkCap: l,
346
- onAction: d,
347
- enablePinning: f,
388
+ checkCap: o,
389
+ onAction: u,
390
+ enablePinning: d,
348
391
  onPinToggle: p,
349
- resolveObjectLabel: v,
392
+ resolveObjectLabel: h,
350
393
  resolveDashboardLabel: y,
351
- resolveGroupLabel: w,
352
- t: T
394
+ resolveGroupLabel: b,
395
+ t: x
353
396
  }, e.id)) }) }) })] })
354
397
  });
355
398
  }
356
399
  if (e.type === "action") {
357
- let t = Y(e.icon), n = X(e.label, T);
358
- return /* @__PURE__ */ M(C, { children: [
359
- _ && /* @__PURE__ */ j("span", {
400
+ let t = J(e.icon), n = Y(e.label, x);
401
+ return /* @__PURE__ */ z(T, { children: [
402
+ m && /* @__PURE__ */ R("span", {
360
403
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
361
- "aria-label": T ? T("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
362
- ..._,
363
- children: /* @__PURE__ */ j(te, { className: "h-3.5 w-3.5" })
404
+ "aria-label": x ? x("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
405
+ ...m,
406
+ children: /* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" })
364
407
  }),
365
- /* @__PURE__ */ M(S, {
408
+ /* @__PURE__ */ z(w, {
366
409
  tooltip: n,
367
- onClick: () => d?.(e),
410
+ onClick: () => u?.(e),
368
411
  children: [
369
- /* @__PURE__ */ j(t, { className: "h-4 w-4" }),
370
- /* @__PURE__ */ j("span", { children: n }),
371
- e.badge != null && /* @__PURE__ */ j(a, {
412
+ /* @__PURE__ */ R(t, { className: "h-4 w-4" }),
413
+ /* @__PURE__ */ R("span", { children: n }),
414
+ e.badge != null && /* @__PURE__ */ R(a, {
372
415
  variant: e.badgeVariant ?? "default",
373
416
  className: "ml-auto text-[10px] px-1.5 py-0",
374
417
  children: e.badge
375
418
  })
376
419
  ]
377
420
  }),
378
- f && p && /* @__PURE__ */ j(x, {
421
+ d && p && /* @__PURE__ */ R(C, {
379
422
  showOnHover: !0,
380
423
  onClick: () => p(e.id, !e.pinned),
381
- "aria-label": T ? T(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
424
+ "aria-label": x ? x(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
382
425
  defaultValue: e.pinned ? `Unpin ${n}` : `Pin ${n}`,
383
426
  name: n
384
427
  }) : e.pinned ? `Unpin ${n}` : `Pin ${n}`,
385
- children: e.pinned ? /* @__PURE__ */ j(ne, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ j(R, { className: "h-3.5 w-3.5" })
428
+ children: e.pinned ? /* @__PURE__ */ R(ie, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" })
386
429
  })
387
430
  ] });
388
431
  }
389
- let ee = Y(e.icon), { href: L, external: re } = we(e, t), ie = L !== "#" && E.pathname.startsWith(L), z = be(e, v, T, y, w), B = /* @__PURE__ */ M(A, { children: [
390
- /* @__PURE__ */ j(ee, { className: "h-4 w-4" }),
391
- /* @__PURE__ */ j("span", { children: z }),
392
- e.badge != null && /* @__PURE__ */ j(a, {
432
+ let j = J(e.icon), { href: M, external: N } = Ae(e, t), ne = M !== "#" && E.pathname.startsWith(M), P = X(e, h, x, y, b), F = /* @__PURE__ */ z(L, { children: [
433
+ /* @__PURE__ */ R(j, { className: "h-4 w-4" }),
434
+ /* @__PURE__ */ R("span", { children: P }),
435
+ e.badge != null && /* @__PURE__ */ R(a, {
393
436
  variant: e.badgeVariant ?? "default",
394
437
  className: "ml-auto text-[10px] px-1.5 py-0",
395
438
  children: e.badge
396
439
  })
397
440
  ] });
398
- return /* @__PURE__ */ M(C, { children: [
399
- _ && /* @__PURE__ */ j("span", {
441
+ return /* @__PURE__ */ z(T, { children: [
442
+ m && /* @__PURE__ */ R("span", {
400
443
  className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
401
- "aria-label": T ? T("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
402
- ..._,
403
- children: /* @__PURE__ */ j(te, { className: "h-3.5 w-3.5" })
444
+ "aria-label": x ? x("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
445
+ ...m,
446
+ children: /* @__PURE__ */ R(te, { className: "h-3.5 w-3.5" })
404
447
  }),
405
- /* @__PURE__ */ j(S, {
448
+ /* @__PURE__ */ R(w, {
406
449
  asChild: !0,
407
- isActive: ie,
408
- tooltip: z,
409
- children: re ? /* @__PURE__ */ j("a", {
410
- href: L,
450
+ isActive: ne,
451
+ tooltip: P,
452
+ children: N ? /* @__PURE__ */ R("a", {
453
+ href: M,
411
454
  target: "_blank",
412
455
  rel: "noopener noreferrer",
413
- children: B
414
- }) : /* @__PURE__ */ j(N, {
415
- to: L,
416
- children: B
456
+ children: F
457
+ }) : /* @__PURE__ */ R(oe, {
458
+ to: M,
459
+ children: F
417
460
  })
418
461
  }),
419
- f && p && /* @__PURE__ */ j(x, {
462
+ d && p && /* @__PURE__ */ R(C, {
420
463
  showOnHover: !0,
421
464
  onClick: () => p(e.id, !e.pinned),
422
- "aria-label": T ? T(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
423
- defaultValue: e.pinned ? `Unpin ${z}` : `Pin ${z}`,
424
- name: z
425
- }) : e.pinned ? `Unpin ${z}` : `Pin ${z}`,
426
- children: e.pinned ? /* @__PURE__ */ j(ne, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ j(R, { className: "h-3.5 w-3.5" })
465
+ "aria-label": x ? x(e.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
466
+ defaultValue: e.pinned ? `Unpin ${P}` : `Pin ${P}`,
467
+ name: P
468
+ }) : e.pinned ? `Unpin ${P}` : `Pin ${P}`,
469
+ children: e.pinned ? /* @__PURE__ */ R(ie, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ R(re, { className: "h-3.5 w-3.5" })
427
470
  })
428
471
  ] });
429
472
  }
430
- function $({ items: e, basePath: t = "", evaluateVisibility: n = xe, checkPermission: i = Se, checkCapability: a = Ce, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: _, t: v }) {
431
- let y = r(() => s ? Z(e, s) : e, [e, s]), x = r(() => De(y), [y]), S = y.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), C = se(V(ae, { activationConstraint: { distance: Te } }), V(B)), w = (e) => {
473
+ function $({ items: e, basePath: t = "", evaluateVisibility: n = De, checkPermission: i = Oe, checkCapability: a = ke, onAction: o, searchQuery: s, enablePinning: c, onPinToggle: l, enableReorder: u, onReorder: d, resolveObjectLabel: f, resolveDashboardLabel: p, resolveGroupLabel: m, t: h }) {
474
+ let y = r(() => s ? Z(e, s) : e, [e, s]), b = r(() => Ne(y), [y]), x = y.slice().sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), C = pe(fe(ue, { activationConstraint: { distance: je } }), fe(le)), w = (e) => {
432
475
  let { active: t, over: n } = e;
433
476
  if (!n || t.id === n.id || !d) return;
434
- let r = S.findIndex((e) => e.id === t.id), i = S.findIndex((e) => e.id === n.id);
435
- r === -1 || i === -1 || d(le(S, r, i).map((e, t) => ({
477
+ let r = x.findIndex((e) => e.id === t.id), i = x.findIndex((e) => e.id === n.id);
478
+ r === -1 || i === -1 || d(he(x, r, i).map((e, t) => ({
436
479
  ...e,
437
480
  order: t
438
481
  })));
@@ -446,167 +489,167 @@ function $({ items: e, basePath: t = "", evaluateVisibility: n = xe, checkPermis
446
489
  onPinToggle: l,
447
490
  resolveObjectLabel: f,
448
491
  resolveDashboardLabel: p,
449
- resolveGroupLabel: _,
450
- t: v
451
- }, E = S.some((e) => e.type === "group"), D = x.length > 0 && c ? /* @__PURE__ */ M(m, { children: [/* @__PURE__ */ M(g, {
492
+ resolveGroupLabel: m,
493
+ t: h
494
+ }, E = x.some((e) => e.type === "group"), D = b.length > 0 && c ? /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
452
495
  className: "flex items-center gap-1.5",
453
- children: [/* @__PURE__ */ j(ie, { className: "h-3.5 w-3.5" }), v ? v("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
454
- }), /* @__PURE__ */ j(h, { children: /* @__PURE__ */ j(b, { children: x.map((e) => /* @__PURE__ */ j(Q, {
496
+ children: [/* @__PURE__ */ R(F, { className: "h-3.5 w-3.5" }), h ? h("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
497
+ }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: b.map((e) => /* @__PURE__ */ R(Q, {
455
498
  item: e,
456
499
  ...T
457
500
  }, `fav-${e.id}`)) }) })] }) : null;
458
501
  if (!E) {
459
- let e = S.filter((e) => e.type !== "group").map((e) => e.id);
460
- return /* @__PURE__ */ M(A, { children: [D, /* @__PURE__ */ j(m, { children: /* @__PURE__ */ j(h, { children: u ? /* @__PURE__ */ j(z, {
502
+ let e = x.filter((e) => e.type !== "group").map((e) => e.id);
503
+ return /* @__PURE__ */ z(L, { children: [D, /* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: u ? /* @__PURE__ */ R(ce, {
461
504
  sensors: C,
462
- collisionDetection: oe,
505
+ collisionDetection: de,
463
506
  onDragEnd: w,
464
- children: /* @__PURE__ */ j(ce, {
507
+ children: /* @__PURE__ */ R(me, {
465
508
  items: e,
466
- strategy: de,
467
- children: /* @__PURE__ */ j(b, { children: S.map((e) => /* @__PURE__ */ j(Ee, {
509
+ strategy: _e,
510
+ children: /* @__PURE__ */ R(S, { children: x.map((e) => /* @__PURE__ */ R(Me, {
468
511
  item: e,
469
512
  enableReorder: u,
470
513
  ...T
471
514
  }, e.id)) })
472
515
  })
473
- }) : /* @__PURE__ */ j(b, { children: S.map((e) => /* @__PURE__ */ j(Q, {
516
+ }) : /* @__PURE__ */ R(S, { children: x.map((e) => /* @__PURE__ */ R(Q, {
474
517
  item: e,
475
518
  ...T
476
519
  }, e.id)) }) }) })] });
477
520
  }
478
- let O = [], k = [], N = (e) => {
521
+ let O = [], k = [], A = (e) => {
479
522
  if (k.length === 0) return;
480
523
  let t = k;
481
- k = [], O.push(/* @__PURE__ */ j(m, { children: /* @__PURE__ */ j(h, { children: /* @__PURE__ */ j(b, { children: t.map((e) => /* @__PURE__ */ j(Q, {
524
+ k = [], O.push(/* @__PURE__ */ R(g, { children: /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: t.map((e) => /* @__PURE__ */ R(Q, {
482
525
  item: e,
483
526
  ...T
484
527
  }, e.id)) }) }) }, e));
485
528
  };
486
- return S.forEach((e, t) => {
487
- e.type === "group" ? (N(`leaf-${t}`), O.push(/* @__PURE__ */ j(Q, {
529
+ return x.forEach((e, t) => {
530
+ e.type === "group" ? (A(`leaf-${t}`), O.push(/* @__PURE__ */ R(Q, {
488
531
  item: e,
489
532
  ...T
490
533
  }, e.id))) : k.push(e);
491
- }), N("leaf-end"), /* @__PURE__ */ M(A, { children: [D, O] });
534
+ }), A("leaf-end"), /* @__PURE__ */ z(L, { children: [D, O] });
492
535
  }
493
- function De(e) {
536
+ function Ne(e) {
494
537
  let t = [];
495
- for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...De(n.children));
538
+ for (let n of e) n.pinned && n.type !== "group" && n.type !== "separator" && t.push(n), n.children?.length && t.push(...Ne(n.children));
496
539
  return t;
497
540
  }
498
541
  //#endregion
499
542
  //#region src/AppSchemaRenderer.tsx
500
- function Oe({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm: i }) {
543
+ function Pe({ areas: e, activeAreaId: t, onAreaChange: n, evalVis: r, checkPerm: i }) {
501
544
  let a = e.filter((e) => !(!r(e.visible) || e.requiredPermissions?.length && !i(e.requiredPermissions)));
502
- return a.length <= 1 ? null : /* @__PURE__ */ M(m, { children: [/* @__PURE__ */ M(g, {
545
+ return a.length <= 1 ? null : /* @__PURE__ */ z(g, { children: [/* @__PURE__ */ z(v, {
503
546
  className: "flex items-center gap-1.5",
504
- children: [/* @__PURE__ */ j(L, { className: "h-3.5 w-3.5" }), "Area"]
505
- }), /* @__PURE__ */ j(h, { children: /* @__PURE__ */ j(b, { children: a.map((e) => {
506
- let r = Y(e.icon);
507
- return /* @__PURE__ */ j(C, { children: /* @__PURE__ */ M(S, {
547
+ children: [/* @__PURE__ */ R(ne, { className: "h-3.5 w-3.5" }), "Area"]
548
+ }), /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: a.map((e) => {
549
+ let r = J(e.icon);
550
+ return /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
508
551
  isActive: e.id === t,
509
- tooltip: X(e.label),
552
+ tooltip: Y(e.label),
510
553
  onClick: () => n(e.id),
511
- children: [/* @__PURE__ */ j(r, { className: "h-4 w-4" }), /* @__PURE__ */ j("span", { children: X(e.label) })]
554
+ children: [/* @__PURE__ */ R(r, { className: "h-4 w-4" }), /* @__PURE__ */ R("span", { children: Y(e.label) })]
512
555
  }) }, e.id);
513
556
  }) }) })] });
514
557
  }
515
- function ke({ items: e, basePath: t }) {
516
- let n = F(), r = (e) => {
558
+ function Fe({ items: e, basePath: t }) {
559
+ let n = B(), r = (e) => {
517
560
  let t = [];
518
561
  for (let n of e) n.type !== "separator" && (n.type === "group" ? t.push(...r(n.children || [])) : t.push(n));
519
562
  return t;
520
563
  }, i = r(e).slice(0, 5);
521
- return i.length === 0 ? null : /* @__PURE__ */ j("div", {
564
+ return i.length === 0 ? null : /* @__PURE__ */ R("div", {
522
565
  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",
523
566
  role: "navigation",
524
567
  "aria-label": "Mobile navigation",
525
568
  children: i.map((e) => {
526
- let r = Y(e.icon), i = "#";
569
+ let r = J(e.icon), i = "#";
527
570
  e.type === "object" ? (i = `${t}/${e.objectName}`, e.viewName && (i += `/view/${e.viewName}`)) : e.type === "dashboard" ? i = e.dashboardName ? `${t}/dashboard/${e.dashboardName}` : "#" : e.type === "page" ? i = e.pageName ? `${t}/page/${e.pageName}` : "#" : e.type === "report" ? i = e.reportName ? `${t}/report/${e.reportName}` : "#" : e.type === "url" && (i = e.url ?? "#");
528
571
  let a = i !== "#" && n.pathname.startsWith(i);
529
- return /* @__PURE__ */ M(N, {
572
+ return /* @__PURE__ */ z(oe, {
530
573
  to: i,
531
574
  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"}`,
532
- children: [/* @__PURE__ */ j(r, { className: "h-5 w-5" }), /* @__PURE__ */ j("span", {
575
+ children: [/* @__PURE__ */ R(r, { className: "h-5 w-5" }), /* @__PURE__ */ R("span", {
533
576
  className: "text-[10px] truncate max-w-[60px]",
534
- children: X(e.label)
577
+ children: Y(e.label)
535
578
  })]
536
579
  }, e.id);
537
580
  })
538
581
  });
539
582
  }
540
- function Ae({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, onAction: o, sidebarHeader: s, sidebarFooter: c, sidebarExtra: l, activeAreaId: u, setActiveAreaId: m, resolvedNavigation: h, enableSearch: g, enablePinning: y, onPinToggle: x, enableReorder: w, onReorder: T }) {
541
- let E = Y(e.logo), D = e.areas ?? [], [O, k] = i("");
542
- return /* @__PURE__ */ M(d, {
583
+ function Ie({ 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 }) {
584
+ let E = J(e.logo), D = e.areas ?? [], [O, k] = i("");
585
+ return /* @__PURE__ */ z(p, {
543
586
  collapsible: "icon",
544
587
  children: [
545
- /* @__PURE__ */ M(_, { children: [s ?? /* @__PURE__ */ j(b, { children: /* @__PURE__ */ j(C, { children: /* @__PURE__ */ M(S, {
588
+ /* @__PURE__ */ z(y, { children: [s ?? /* @__PURE__ */ R(S, { children: /* @__PURE__ */ R(T, { children: /* @__PURE__ */ z(w, {
546
589
  size: "lg",
547
590
  tooltip: e.title ?? e.name,
548
- children: [/* @__PURE__ */ j("div", {
591
+ children: [/* @__PURE__ */ R("div", {
549
592
  className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",
550
- children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ j("img", {
593
+ children: e.logo && e.logo.startsWith("http") ? /* @__PURE__ */ R("img", {
551
594
  src: e.logo,
552
595
  alt: e.title ?? "",
553
596
  className: "size-6 object-contain"
554
- }) : /* @__PURE__ */ j(E, { className: "size-4" })
555
- }), /* @__PURE__ */ M("div", {
597
+ }) : /* @__PURE__ */ R(E, { className: "size-4" })
598
+ }), /* @__PURE__ */ z("div", {
556
599
  className: "grid flex-1 text-left text-sm leading-tight",
557
- children: [/* @__PURE__ */ j("span", {
600
+ children: [/* @__PURE__ */ R("span", {
558
601
  className: "truncate font-semibold",
559
602
  children: e.title ?? e.name ?? "App"
560
- }), e.description && /* @__PURE__ */ j("span", {
603
+ }), e.description && /* @__PURE__ */ R("span", {
561
604
  className: "truncate text-xs text-muted-foreground",
562
605
  children: e.description
563
606
  })]
564
607
  })]
565
- }) }) }), g && /* @__PURE__ */ j(v, {
608
+ }) }) }), g && /* @__PURE__ */ R(b, {
566
609
  placeholder: "Search navigation…",
567
610
  value: O,
568
611
  onChange: (e) => k(e.target.value),
569
612
  "aria-label": "Search navigation"
570
613
  })] }),
571
- /* @__PURE__ */ M(f, { children: [
572
- D.length > 1 && u && /* @__PURE__ */ j(Oe, {
614
+ /* @__PURE__ */ z(m, { children: [
615
+ D.length > 1 && u && /* @__PURE__ */ R(Pe, {
573
616
  areas: D,
574
617
  activeAreaId: u,
575
- onAreaChange: m,
618
+ onAreaChange: d,
576
619
  evalVis: n,
577
620
  checkPerm: r
578
621
  }),
579
- /* @__PURE__ */ j($, {
580
- items: h,
622
+ /* @__PURE__ */ R($, {
623
+ items: f,
581
624
  basePath: t,
582
625
  evaluateVisibility: n,
583
626
  checkPermission: r,
584
627
  checkCapability: a,
585
628
  onAction: o,
586
629
  searchQuery: O,
587
- enablePinning: y,
588
- onPinToggle: x,
589
- enableReorder: w,
590
- onReorder: T
630
+ enablePinning: _,
631
+ onPinToggle: v,
632
+ enableReorder: x,
633
+ onReorder: C
591
634
  }),
592
635
  l
593
636
  ] }),
594
- c && /* @__PURE__ */ j(p, { children: c })
637
+ c && /* @__PURE__ */ R(h, { children: c })
595
638
  ]
596
639
  });
597
640
  }
598
- function je({ 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 }) {
599
- 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 ?? [], [O, k] = i(() => D.length > 0 ? D[0].id : null), N = D.map((e) => e.id).join(",");
641
+ function Le({ 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 }) {
642
+ let S = o ?? ((e) => !(e === !1 || e === "false")), C = s ?? (() => !0), w = c ?? (() => !0), T = r(() => (e.menu ?? []).map((e, t) => ye(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(",");
600
643
  n(() => {
601
644
  D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
602
- }, [e.name, N]);
603
- let P = D.find((e) => e.id === O)?.navigation ?? E, F = {
645
+ }, [e.name, A]);
646
+ let j = D.find((e) => e.id === O)?.navigation ?? E, M = {
604
647
  title: e.title,
605
648
  favicon: e.favicon,
606
649
  logo: e.logo
607
650
  };
608
- return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(J, {
609
- sidebar: /* @__PURE__ */ j(Ae, {
651
+ return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(q, {
652
+ sidebar: /* @__PURE__ */ R(Ie, {
610
653
  schema: e,
611
654
  basePath: t,
612
655
  evalVis: S,
@@ -618,7 +661,7 @@ function je({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
618
661
  sidebarExtra: p,
619
662
  activeAreaId: O,
620
663
  setActiveAreaId: k,
621
- resolvedNavigation: P,
664
+ resolvedNavigation: j,
622
665
  enableSearch: _,
623
666
  enablePinning: v,
624
667
  onPinToggle: y,
@@ -628,28 +671,28 @@ function je({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluate
628
671
  navbar: u,
629
672
  className: h,
630
673
  defaultOpen: g,
631
- branding: F,
674
+ branding: M,
632
675
  children: m
633
- }), a === "bottom_nav" && /* @__PURE__ */ j(ke, {
634
- items: P,
676
+ }), a === "bottom_nav" && /* @__PURE__ */ R(Fe, {
677
+ items: j,
635
678
  basePath: t
636
679
  })] });
637
680
  }
638
681
  //#endregion
639
682
  //#region src/Page.tsx
640
- var Me = (e) => e ? Array.isArray(e) ? e : [e] : [];
641
- function Ne({ schema: e, className: t, style: n, id: r, ...i }) {
642
- let a = Me(e.children);
643
- return /* @__PURE__ */ M("div", {
683
+ var Re = (e) => e ? Array.isArray(e) ? e : [e] : [];
684
+ function ze({ schema: e, className: t, style: n, id: r, ...i }) {
685
+ let a = Re(e.children);
686
+ return /* @__PURE__ */ z("div", {
644
687
  id: r || e.id,
645
- className: O("flex flex-col h-full space-y-4", t),
688
+ className: A("flex flex-col h-full space-y-4", t),
646
689
  style: n,
647
- children: [/* @__PURE__ */ j(H, {
690
+ children: [/* @__PURE__ */ R(H, {
648
691
  title: e.title,
649
692
  description: e.description
650
- }), /* @__PURE__ */ j("div", {
693
+ }), /* @__PURE__ */ R("div", {
651
694
  className: "flex-1 overflow-auto",
652
- children: a.map((e, t) => /* @__PURE__ */ j(me, {
695
+ children: a.map((e, t) => /* @__PURE__ */ R(I, {
653
696
  schema: e,
654
697
  ...i
655
698
  }, e?.id || t))
@@ -658,38 +701,38 @@ function Ne({ schema: e, className: t, style: n, id: r, ...i }) {
658
701
  }
659
702
  //#endregion
660
703
  //#region src/SidebarNav.tsx
661
- function Pe(e) {
704
+ function Be(e) {
662
705
  return "items" in e && !("href" in e);
663
706
  }
664
- function Fe({ item: e, pathname: t }) {
665
- return e.children && e.children.length > 0 ? /* @__PURE__ */ j(o, {
707
+ function Ve({ item: e, pathname: t }) {
708
+ return e.children && e.children.length > 0 ? /* @__PURE__ */ R(s, {
666
709
  asChild: !0,
667
710
  defaultOpen: !0,
668
711
  className: "group/collapsible",
669
- children: /* @__PURE__ */ M(C, { children: [/* @__PURE__ */ j(c, {
712
+ children: /* @__PURE__ */ z(T, { children: [/* @__PURE__ */ R(l, {
670
713
  asChild: !0,
671
- children: /* @__PURE__ */ M(S, {
714
+ children: /* @__PURE__ */ z(w, {
672
715
  tooltip: e.title,
673
716
  children: [
674
- e.icon && /* @__PURE__ */ j(e.icon, {}),
675
- /* @__PURE__ */ j("span", { children: e.title }),
676
- e.badge != null && /* @__PURE__ */ j(a, {
717
+ e.icon && /* @__PURE__ */ R(e.icon, {}),
718
+ /* @__PURE__ */ R("span", { children: e.title }),
719
+ e.badge != null && /* @__PURE__ */ R(a, {
677
720
  variant: e.badgeVariant || "default",
678
721
  className: "ml-auto mr-1 h-5 min-w-5 px-1 text-xs",
679
722
  children: e.badge
680
723
  }),
681
- /* @__PURE__ */ j(I, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
724
+ /* @__PURE__ */ R(ee, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
682
725
  ]
683
726
  })
684
- }), /* @__PURE__ */ j(s, { children: /* @__PURE__ */ j(w, { children: e.children.map((e) => /* @__PURE__ */ j(E, { children: /* @__PURE__ */ j(T, {
727
+ }), /* @__PURE__ */ R(c, { children: /* @__PURE__ */ R(E, { children: e.children.map((e) => /* @__PURE__ */ R(O, { children: /* @__PURE__ */ R(D, {
685
728
  asChild: !0,
686
729
  isActive: t === e.href,
687
- children: /* @__PURE__ */ M(P, {
730
+ children: /* @__PURE__ */ z(se, {
688
731
  to: e.href,
689
732
  children: [
690
- e.icon && /* @__PURE__ */ j(e.icon, {}),
691
- /* @__PURE__ */ j("span", { children: e.title }),
692
- e.badge != null && /* @__PURE__ */ j(a, {
733
+ e.icon && /* @__PURE__ */ R(e.icon, {}),
734
+ /* @__PURE__ */ R("span", { children: e.title }),
735
+ e.badge != null && /* @__PURE__ */ R(a, {
693
736
  variant: e.badgeVariant || "default",
694
737
  className: "ml-auto h-5 min-w-5 px-1 text-xs",
695
738
  children: e.badge
@@ -697,16 +740,16 @@ function Fe({ item: e, pathname: t }) {
697
740
  ]
698
741
  })
699
742
  }) }, e.href)) }) })] })
700
- }) : /* @__PURE__ */ j(C, { children: /* @__PURE__ */ j(S, {
743
+ }) : /* @__PURE__ */ R(T, { children: /* @__PURE__ */ R(w, {
701
744
  asChild: !0,
702
745
  isActive: t === e.href,
703
746
  tooltip: e.title,
704
- children: /* @__PURE__ */ M(P, {
747
+ children: /* @__PURE__ */ z(se, {
705
748
  to: e.href,
706
749
  children: [
707
- e.icon && /* @__PURE__ */ j(e.icon, {}),
708
- /* @__PURE__ */ j("span", { children: e.title }),
709
- e.badge != null && /* @__PURE__ */ j(a, {
750
+ e.icon && /* @__PURE__ */ R(e.icon, {}),
751
+ /* @__PURE__ */ R("span", { children: e.title }),
752
+ e.badge != null && /* @__PURE__ */ R(a, {
710
753
  variant: e.badgeVariant || "default",
711
754
  className: "ml-auto h-5 min-w-5 px-1 text-xs",
712
755
  children: e.badge
@@ -715,43 +758,43 @@ function Fe({ item: e, pathname: t }) {
715
758
  })
716
759
  }) });
717
760
  }
718
- function Ie({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search..." }) {
719
- let s = F(), [c, u] = t.useState(""), p = t.useMemo(() => e.length === 0 ? [] : Pe(e[0]) ? e.map((e) => ({
761
+ function He({ items: e, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search..." }) {
762
+ let s = B(), [c, l] = t.useState(""), d = t.useMemo(() => e.length === 0 ? [] : Be(e[0]) ? e.map((e) => ({
720
763
  groupLabel: e.label,
721
764
  items: e.items
722
- })) : [{ items: e }], [e]), _ = t.useMemo(() => {
723
- if (!c) return p;
765
+ })) : [{ items: e }], [e]), f = t.useMemo(() => {
766
+ if (!c) return d;
724
767
  let e = c.toLowerCase();
725
- return p.map((t) => ({
768
+ return d.map((t) => ({
726
769
  ...t,
727
770
  items: t.items.filter((t) => t.title.toLowerCase().includes(e) || t.children?.some((t) => t.title.toLowerCase().includes(e)))
728
771
  })).filter((e) => e.items.length > 0);
729
- }, [p, c]);
730
- return /* @__PURE__ */ j(d, {
772
+ }, [d, c]);
773
+ return /* @__PURE__ */ R(p, {
731
774
  className: r,
732
775
  collapsible: i,
733
- children: /* @__PURE__ */ M(f, { children: [a && /* @__PURE__ */ j("div", {
776
+ children: /* @__PURE__ */ z(m, { children: [a && /* @__PURE__ */ R("div", {
734
777
  className: "px-3 py-2",
735
- children: /* @__PURE__ */ M("div", {
778
+ children: /* @__PURE__ */ z("div", {
736
779
  className: "relative",
737
- children: [/* @__PURE__ */ j(re, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ j(l, {
780
+ children: [/* @__PURE__ */ R(P, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ R(u, {
738
781
  type: "search",
739
782
  placeholder: o,
740
783
  value: c,
741
- onChange: (e) => u(e.target.value),
784
+ onChange: (e) => l(e.target.value),
742
785
  className: "pl-8 h-9"
743
786
  })]
744
787
  })
745
- }), _.map((e, t) => /* @__PURE__ */ M(m, { children: [
746
- t > 0 && /* @__PURE__ */ j("div", {
788
+ }), f.map((e, t) => /* @__PURE__ */ z(g, { children: [
789
+ t > 0 && /* @__PURE__ */ R("div", {
747
790
  className: "mx-3 mb-1 h-px bg-sidebar-border/60",
748
791
  "aria-hidden": !0
749
792
  }),
750
- /* @__PURE__ */ j(g, {
793
+ /* @__PURE__ */ R(v, {
751
794
  className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
752
795
  children: e.groupLabel || n
753
796
  }),
754
- /* @__PURE__ */ j(h, { children: /* @__PURE__ */ j(b, { children: e.items.map((e) => /* @__PURE__ */ j(Fe, {
797
+ /* @__PURE__ */ R(_, { children: /* @__PURE__ */ R(S, { children: e.items.map((e) => /* @__PURE__ */ R(Ve, {
755
798
  item: e,
756
799
  pathname: s.pathname
757
800
  }, e.href)) }) })
@@ -760,7 +803,7 @@ function Ie({ items: e, title: n = "Application", className: r, collapsible: i =
760
803
  }
761
804
  //#endregion
762
805
  //#region src/index.ts
763
- function Le() {
806
+ function Ue() {
764
807
  e.register("page-header", H, {
765
808
  namespace: "layout",
766
809
  label: "Page Header",
@@ -772,16 +815,16 @@ function Le() {
772
815
  name: "description",
773
816
  type: "string"
774
817
  }]
775
- }), e.register("page:header", H, { namespace: "layout" }), e.register("page:card", he, {
818
+ }), e.register("page:header", H, { namespace: "layout" }), e.register("page:card", Se, {
776
819
  namespace: "layout",
777
820
  label: "Page Card",
778
821
  category: "Layout",
779
822
  isContainer: !0
780
- }), e.register("app-shell", J, {
823
+ }), e.register("app-shell", q, {
781
824
  namespace: "layout",
782
825
  label: "App Shell",
783
826
  category: "Layout"
784
- }), e.register("responsive-grid", ye, {
827
+ }), e.register("responsive-grid", Ee, {
785
828
  namespace: "layout",
786
829
  label: "Responsive Grid",
787
830
  category: "Layout",
@@ -804,7 +847,7 @@ function Le() {
804
847
  name: "basePath",
805
848
  type: "string"
806
849
  }]
807
- }), e.register("app-schema-renderer", je, {
850
+ }), e.register("app-schema-renderer", Le, {
808
851
  namespace: "layout",
809
852
  label: "App Schema Renderer",
810
853
  category: "Layout",
@@ -826,7 +869,7 @@ function Le() {
826
869
  });
827
870
  }
828
871
  try {
829
- Le();
872
+ Ue();
830
873
  } catch {}
831
874
  //#endregion
832
- export { je as AppSchemaRenderer, J as AppShell, $ as NavigationRenderer, Ne as Page, he as PageCard, H as PageHeader, ye as ResponsiveGrid, Ie as SidebarNav, Z as filterNavigationItems, Le as registerLayout, Y as resolveIcon, X as resolveLabel, q as useAppShellBranding };
875
+ export { Le as AppSchemaRenderer, q as AppShell, $ as NavigationRenderer, ze as Page, Se as PageCard, H as PageHeader, Ee as ResponsiveGrid, He as SidebarNav, Z as filterNavigationItems, Ue as registerLayout, J as resolveIcon, Y as resolveLabel, xe as useAppShellBranding };
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`react/jsx-runtime`),require(`react-router-dom`),require(`lucide-react`),require(`@dnd-kit/core`),require(`@dnd-kit/sortable`),require(`@dnd-kit/utilities`),require(`@object-ui/types`),require(`@object-ui/react`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`react/jsx-runtime`,`react-router-dom`,`lucide-react`,`@dnd-kit/core`,`@dnd-kit/sortable`,`@dnd-kit/utilities`,`@object-ui/types`,`@object-ui/react`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUILayout={},e._object_ui_core,e.react,e._object_ui_components,e.react_jsx_runtime,e.react_router_dom,e.lucide_react,e._dnd_kit_core,e._dnd_kit_sortable,e._dnd_kit_utilities,e._object_ui_types,e._object_ui_react))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);function y({title:e,description:t,action:n,className:a,children:o,...s}){return(0,i.jsx)(`div`,{className:(0,r.cn)(`flex flex-col gap-4 pb-4 md:pb-8`,a),...s,children:(0,i.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-2`,children:[(0,i.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,i.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight md:text-3xl truncate`,children:e}),t&&(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),(n||o)&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto sm:ml-0`,children:[n,o]})]})})}function b(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;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;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case n:s=((r-i)/e+(r<i?6:0))/6;break;case r:s=((i-n)/e+2)/6;break;case i:s=((n-r)/e+4)/6;break}}return{h:s*360,s:c*100,l:l*100}}function x(e){let t=b(e);return t?`${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%`:null}function S(e){let t=b(e);if(!t)return null;let n=Math.max(t.l,65),r=t.s>80?Math.max(t.s-10,70):t.s;return`${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`}function C(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return`0 0% 100%`;let n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},r=n(parseInt(t[1],16)),i=n(parseInt(t[2],16)),a=n(parseInt(t[3],16));return .2126*r+.7152*i+.0722*a>.6?`222 47% 11%`:`0 0% 100%`}function w(e,t){(0,n.useEffect)(()=>{let n=document.documentElement,r=()=>n.classList.contains(`dark`),i=()=>{if(e?.primaryColor){let t=x(e.primaryColor),i=S(e.primaryColor),a=r()&&i||t;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%`:C(e.primaryColor)),n.style.setProperty(`--ring`,a),n.style.setProperty(`--sidebar-primary`,a),n.style.setProperty(`--sidebar-ring`,a))}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`);if(e?.accentColor){let t=x(e.accentColor),i=S(e.accentColor),a=r()&&i||t;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%`:C(e.accentColor)))}else n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)};i();let a=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){i();break}});if(a.observe(n,{attributes:!0,attributeFilter:[`class`]}),e?.favicon){let t=document.querySelector(`#favicon`)||document.querySelector(`link[rel="icon"]`);t&&(t.href=e.favicon)}return t&&(document.title=t),()=>{a.disconnect(),n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function T({sidebar:e,navbar:t,children:n,className:a,defaultOpen:o=!0,branding:s}){return w(s,s?.title),(0,i.jsxs)(r.SidebarProvider,{defaultOpen:o,className:`!flex-col`,children:[(0,i.jsx)(`header`,{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`,children:t}),(0,i.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[e,(0,i.jsx)(r.SidebarInset,{className:`min-w-0`,children:(0,i.jsx)(`main`,{className:(0,r.cn)(`flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6`,a),children:n})})]})]})}function E({className:e,children:t,...n}){return(0,i.jsx)(`div`,{className:(0,r.cn)(`rounded-xl border bg-card text-card-foreground shadow`,e),...n,children:(0,i.jsx)(`div`,{className:`p-6`,children:t})})}var D={xs:{1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,6:`grid-cols-6`,12:`grid-cols-12`},sm:{1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,6:`sm:grid-cols-6`,12:`sm:grid-cols-12`},md:{1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,6:`md:grid-cols-6`,12:`md:grid-cols-12`},lg:{1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,6:`lg:grid-cols-6`,12:`lg:grid-cols-12`},xl:{1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,6:`xl:grid-cols-6`,12:`xl:grid-cols-12`},"2xl":{1:`2xl:grid-cols-1`,2:`2xl:grid-cols-2`,3:`2xl:grid-cols-3`,4:`2xl:grid-cols-4`,6:`2xl:grid-cols-6`,12:`2xl:grid-cols-12`}};function O(e){if(!e)return`grid-cols-1`;let t=[];for(let[n,r]of Object.entries(e)){let e=D[n];if(e&&r){let n=Object.keys(e).map(Number).reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e);t.push(e[n])}}return t.join(` `)||`grid-cols-1`}var k={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`},A=({columns:e,gap:t=4,className:n,children:a})=>(0,i.jsx)(`div`,{className:(0,r.cn)(`grid`,O(e),typeof t==`number`?k[t]||`gap-${t}`:``,n),children:a});function j(e){return e?(0,r.getLazyIcon)(e):o.FileText}function M(e,t){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function N(e,t,n,r,i){let a=M(e.label,n);return typeof e.label==`string`?t&&e.type===`object`&&e.objectName?t(e.objectName,a):r&&e.type===`dashboard`&&e.dashboardName?r(e.dashboardName,a):i&&e.type===`group`&&e.id?i(e.id,a):a:a}var P=e=>!(e===!1||e===`false`),F=()=>!0,I=()=>!0;function L(e,t){switch(e.type){case`object`:{let n=`${t}/${e.objectName??``}`;return{href:e.viewName?`${n}/view/${e.viewName}`:n,external:!1}}case`dashboard`:return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`,external:!1};case`page`:return{href:e.pageName?`${t}/page/${e.pageName}`:`#`,external:!1};case`report`:return{href:e.reportName?`${t}/report/${e.reportName}`:`#`,external:!1};case`url`:return{href:e.url??`#`,external:e.target===`_blank`};default:return{href:`#`,external:!1}}}function R(e,t){if(!t.trim())return e;let n=t.toLowerCase().trim();return e.reduce((e,r)=>{if(r.type===`separator`)return e;if(r.type===`group`&&r.children?.length){let n=R(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return M(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var z=5;function B({item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:a,onAction:o,enablePinning:s,onPinToggle:u,enableReorder:d,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h}){let{attributes:g,listeners:_,setNodeRef:v,transform:y,transition:b,isDragging:x}=(0,c.useSortable)({id:e.id,disabled:!d});return(0,i.jsx)(`div`,{ref:v,style:{transform:l.CSS.Transform.toString(y),transition:b,opacity:x?.5:void 0,zIndex:x?10:void 0},...g,children:(0,i.jsx)(V,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:a,onAction:o,enablePinning:s,onPinToggle:u,dragListeners:d?_:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h})})}function V({item:e,basePath:t,evalVis:s,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,dragListeners:p,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,t:_}){let v=(0,a.useLocation)(),[y,b]=(0,n.useState)(e.defaultOpen!==!1);if(!s(e.visible)||e.requiredPermissions?.length&&!c(e.requiredPermissions))return null;let x=e.requiresObject,S=e.requiresService;if(x&&!l(`object`,x)||S&&!l(`service`,S))return null;if(e.type===`separator`)return(0,i.jsx)(r.Separator,{className:`my-2`});if(e.type===`group`){let n=(e.children??[]).slice().sort((e,t)=>(e.order??0)-(t.order??0));return(0,i.jsx)(r.Collapsible,{open:y,onOpenChange:b,children:(0,i.jsxs)(r.SidebarGroup,{children:[(0,i.jsx)(r.SidebarGroupLabel,{asChild:!0,children:(0,i.jsxs)(r.CollapsibleTrigger,{className:`flex w-full items-center justify-between`,children:[N(e,m,_,h,g),(0,i.jsx)(o.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${y?`rotate-90`:``}`})]})}),(0,i.jsx)(r.CollapsibleContent,{children:(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:n.map(e=>(0,i.jsx)(V,{item:e,basePath:t,evalVis:s,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,t:_},e.id))})})})]})})}if(e.type===`action`){let t=j(e.icon),n=M(e.label,_);return(0,i.jsxs)(r.SidebarMenuItem,{children:[p&&(0,i.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":_?_(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,i.jsx)(o.GripVertical,{className:`h-3.5 w-3.5`})}),(0,i.jsxs)(r.SidebarMenuButton,{tooltip:n,onClick:()=>u?.(e),children:[(0,i.jsx)(t,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:n}),e.badge!=null&&(0,i.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]}),d&&f&&(0,i.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":_?_(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${n}`:`Pin ${n}`,name:n}):e.pinned?`Unpin ${n}`:`Pin ${n}`,children:e.pinned?(0,i.jsx)(o.PinOff,{className:`h-3.5 w-3.5`}):(0,i.jsx)(o.Pin,{className:`h-3.5 w-3.5`})})]})}let C=j(e.icon),{href:w,external:T}=L(e,t),E=w!==`#`&&v.pathname.startsWith(w),D=N(e,m,_,h,g),O=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(C,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:D}),e.badge!=null&&(0,i.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]});return(0,i.jsxs)(r.SidebarMenuItem,{children:[p&&(0,i.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":_?_(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,i.jsx)(o.GripVertical,{className:`h-3.5 w-3.5`})}),(0,i.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:E,tooltip:D,children:T?(0,i.jsx)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,children:O}):(0,i.jsx)(a.Link,{to:w,children:O})}),d&&f&&(0,i.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":_?_(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${D}`:`Pin ${D}`,name:D}):e.pinned?`Unpin ${D}`:`Pin ${D}`,children:e.pinned?(0,i.jsx)(o.PinOff,{className:`h-3.5 w-3.5`}):(0,i.jsx)(o.Pin,{className:`h-3.5 w-3.5`})})]})}function H({items:e,basePath:t=``,evaluateVisibility:a=P,checkPermission:l=F,checkCapability:u=I,onAction:d,searchQuery:f,enablePinning:p,onPinToggle:m,enableReorder:h,onReorder:g,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,t:b}){let x=(0,n.useMemo)(()=>f?R(e,f):e,[e,f]),S=(0,n.useMemo)(()=>U(x),[x]),C=x.slice().sort((e,t)=>(e.order??0)-(t.order??0)),w=(0,s.useSensors)((0,s.useSensor)(s.PointerSensor,{activationConstraint:{distance:z}}),(0,s.useSensor)(s.KeyboardSensor)),T=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=C.findIndex(e=>e.id===t.id),i=C.findIndex(e=>e.id===n.id);r===-1||i===-1||g((0,c.arrayMove)(C,r,i).map((e,t)=>({...e,order:t})))},E={basePath:t,evalVis:a,checkPerm:l,checkCap:u,onAction:d,enablePinning:p,onPinToggle:m,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,t:b},D=C.some(e=>e.type===`group`),O=S.length>0&&p?(0,i.jsxs)(r.SidebarGroup,{children:[(0,i.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(o.Star,{className:`h-3.5 w-3.5`}),b?b(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:S.map(e=>(0,i.jsx)(V,{item:e,...E},`fav-${e.id}`))})})]}):null;if(!D){let e=C.filter(e=>e.type!==`group`).map(e=>e.id);return(0,i.jsxs)(i.Fragment,{children:[O,(0,i.jsx)(r.SidebarGroup,{children:(0,i.jsx)(r.SidebarGroupContent,{children:h?(0,i.jsx)(s.DndContext,{sensors:w,collisionDetection:s.closestCenter,onDragEnd:T,children:(0,i.jsx)(c.SortableContext,{items:e,strategy:c.verticalListSortingStrategy,children:(0,i.jsx)(r.SidebarMenu,{children:C.map(e=>(0,i.jsx)(B,{item:e,enableReorder:h,...E},e.id))})})}):(0,i.jsx)(r.SidebarMenu,{children:C.map(e=>(0,i.jsx)(V,{item:e,...E},e.id))})})})]})}let k=[],A=[],j=e=>{if(A.length===0)return;let t=A;A=[],k.push((0,i.jsx)(r.SidebarGroup,{children:(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:t.map(e=>(0,i.jsx)(V,{item:e,...E},e.id))})})},e))};return C.forEach((e,t)=>{e.type===`group`?(j(`leaf-${t}`),k.push((0,i.jsx)(V,{item:e,...E},e.id))):A.push(e)}),j(`leaf-end`),(0,i.jsxs)(i.Fragment,{children:[O,k]})}function U(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...U(n.children));return t}function W({areas:e,activeAreaId:t,onAreaChange:n,evalVis:a,checkPerm:s}){let c=e.filter(e=>!(!a(e.visible)||e.requiredPermissions?.length&&!s(e.requiredPermissions)));return c.length<=1?null:(0,i.jsxs)(r.SidebarGroup,{children:[(0,i.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,i.jsx)(o.Layers,{className:`h-3.5 w-3.5`}),`Area`]}),(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:c.map(e=>{let a=j(e.icon);return(0,i.jsx)(r.SidebarMenuItem,{children:(0,i.jsxs)(r.SidebarMenuButton,{isActive:e.id===t,tooltip:M(e.label),onClick:()=>n(e.id),children:[(0,i.jsx)(a,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:M(e.label)})]})},e.id)})})})]})}function G({items:e,basePath:t}){let n=(0,a.useLocation)(),r=e=>{let t=[];for(let n of e)n.type!==`separator`&&(n.type===`group`?t.push(...r(n.children||[])):t.push(n));return t},o=r(e).slice(0,5);return o.length===0?null:(0,i.jsx)(`div`,{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`,role:`navigation`,"aria-label":`Mobile navigation`,children:o.map(e=>{let r=j(e.icon),o=`#`;e.type===`object`?(o=`${t}/${e.objectName}`,e.viewName&&(o+=`/view/${e.viewName}`)):e.type===`dashboard`?o=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`:e.type===`page`?o=e.pageName?`${t}/page/${e.pageName}`:`#`:e.type===`report`?o=e.reportName?`${t}/report/${e.reportName}`:`#`:e.type===`url`&&(o=e.url??`#`);let s=o!==`#`&&n.pathname.startsWith(o);return(0,i.jsxs)(a.Link,{to:o,className:`flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${s?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,i.jsx)(r,{className:`h-5 w-5`}),(0,i.jsx)(`span`,{className:`text-[10px] truncate max-w-[60px]`,children:M(e.label)})]},e.id)})})}function K({schema:e,basePath:t,evalVis:a,checkPerm:o,checkCap:s,onAction:c,sidebarHeader:l,sidebarFooter:u,sidebarExtra:d,activeAreaId:f,setActiveAreaId:p,resolvedNavigation:m,enableSearch:h,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}){let b=j(e.logo),x=e.areas??[],[S,C]=(0,n.useState)(``);return(0,i.jsxs)(r.Sidebar,{collapsible:`icon`,children:[(0,i.jsxs)(r.SidebarHeader,{children:[l??(0,i.jsx)(r.SidebarMenu,{children:(0,i.jsx)(r.SidebarMenuItem,{children:(0,i.jsxs)(r.SidebarMenuButton,{size:`lg`,tooltip:e.title??e.name,children:[(0,i.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:e.logo&&e.logo.startsWith(`http`)?(0,i.jsx)(`img`,{src:e.logo,alt:e.title??``,className:`size-6 object-contain`}):(0,i.jsx)(b,{className:`size-4`})}),(0,i.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[(0,i.jsx)(`span`,{className:`truncate font-semibold`,children:e.title??e.name??`App`}),e.description&&(0,i.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]})]})})}),h&&(0,i.jsx)(r.SidebarInput,{placeholder:`Search navigation…`,value:S,onChange:e=>C(e.target.value),"aria-label":`Search navigation`})]}),(0,i.jsxs)(r.SidebarContent,{children:[x.length>1&&f&&(0,i.jsx)(W,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:a,checkPerm:o}),(0,i.jsx)(H,{items:m,basePath:t,evaluateVisibility:a,checkPermission:o,checkCapability:s,onAction:c,searchQuery:S,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}),d]}),u&&(0,i.jsx)(r.SidebarFooter,{children:u})]})}function q({schema:e,basePath:t=``,mobileNavMode:r=`drawer`,evaluateVisibility:a,checkPermission:o,checkCapability:s,onAction:c,navbar:l,sidebarHeader:d,sidebarFooter:f,sidebarExtra:p,children:m,className:h,defaultOpen:g=!0,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}){let S=a??(e=>!(e===!1||e===`false`)),C=o??(()=>!0),w=s??(()=>!0),E=(0,n.useMemo)(()=>(e.menu??[]).map((e,t)=>(0,u.menuItemToNavigationItem)(e,t)),[e.menu]),D=e.navigation??E,O=e.areas??[],[k,A]=(0,n.useState)(()=>O.length>0?O[0].id:null),j=O.map(e=>e.id).join(`,`);(0,n.useEffect)(()=>{O.length>0?A(e=>O.some(t=>t.id===e)?e:O[0].id):A(null)},[e.name,j]);let M=O.find(e=>e.id===k)?.navigation??D,N={title:e.title,favicon:e.favicon,logo:e.logo};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(T,{sidebar:(0,i.jsx)(K,{schema:e,basePath:t,evalVis:S,checkPerm:C,checkCap:w,onAction:c,sidebarHeader:d,sidebarFooter:f,sidebarExtra:p,activeAreaId:k,setActiveAreaId:A,resolvedNavigation:M,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}),navbar:l,className:h,defaultOpen:g,branding:N,children:m}),r===`bottom_nav`&&(0,i.jsx)(G,{items:M,basePath:t})]})}var J=e=>e?Array.isArray(e)?e:[e]:[];function Y({schema:e,className:t,style:n,id:a,...o}){let s=J(e.children);return(0,i.jsxs)(`div`,{id:a||e.id,className:(0,r.cn)(`flex flex-col h-full space-y-4`,t),style:n,children:[(0,i.jsx)(y,{title:e.title,description:e.description}),(0,i.jsx)(`div`,{className:`flex-1 overflow-auto`,children:s.map((e,t)=>(0,i.jsx)(d.SchemaRenderer,{schema:e,...o},e?.id||t))})]})}function X(e){return`items`in e&&!(`href`in e)}function Z({item:e,pathname:t}){return e.children&&e.children.length>0?(0,i.jsx)(r.Collapsible,{asChild:!0,defaultOpen:!0,className:`group/collapsible`,children:(0,i.jsxs)(r.SidebarMenuItem,{children:[(0,i.jsx)(r.CollapsibleTrigger,{asChild:!0,children:(0,i.jsxs)(r.SidebarMenuButton,{tooltip:e.title,children:[e.icon&&(0,i.jsx)(e.icon,{}),(0,i.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,i.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto mr-1 h-5 min-w-5 px-1 text-xs`,children:e.badge}),(0,i.jsx)(o.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`})]})}),(0,i.jsx)(r.CollapsibleContent,{children:(0,i.jsx)(r.SidebarMenuSub,{children:e.children.map(e=>(0,i.jsx)(r.SidebarMenuSubItem,{children:(0,i.jsx)(r.SidebarMenuSubButton,{asChild:!0,isActive:t===e.href,children:(0,i.jsxs)(a.NavLink,{to:e.href,children:[e.icon&&(0,i.jsx)(e.icon,{}),(0,i.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,i.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})},e.href))})})]})}):(0,i.jsx)(r.SidebarMenuItem,{children:(0,i.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:t===e.href,tooltip:e.title,children:(0,i.jsxs)(a.NavLink,{to:e.href,children:[e.icon&&(0,i.jsx)(e.icon,{}),(0,i.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,i.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})})}function Q({items:e,title:t=`Application`,className:s,collapsible:c=`icon`,searchEnabled:l=!1,searchPlaceholder:u=`Search...`}){let d=(0,a.useLocation)(),[f,p]=n.default.useState(``),m=n.default.useMemo(()=>e.length===0?[]:X(e[0])?e.map(e=>({groupLabel:e.label,items:e.items})):[{items:e}],[e]),h=n.default.useMemo(()=>{if(!f)return m;let e=f.toLowerCase();return m.map(t=>({...t,items:t.items.filter(t=>t.title.toLowerCase().includes(e)||t.children?.some(t=>t.title.toLowerCase().includes(e)))})).filter(e=>e.items.length>0)},[m,f]);return(0,i.jsx)(r.Sidebar,{className:s,collapsible:c,children:(0,i.jsxs)(r.SidebarContent,{children:[l&&(0,i.jsx)(`div`,{className:`px-3 py-2`,children:(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(o.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,i.jsx)(r.Input,{type:`search`,placeholder:u,value:f,onChange:e=>p(e.target.value),className:`pl-8 h-9`})]})}),h.map((e,n)=>(0,i.jsxs)(r.SidebarGroup,{children:[n>0&&(0,i.jsx)(`div`,{className:`mx-3 mb-1 h-px bg-sidebar-border/60`,"aria-hidden":!0}),(0,i.jsx)(r.SidebarGroupLabel,{className:`text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60`,children:e.groupLabel||t}),(0,i.jsx)(r.SidebarGroupContent,{children:(0,i.jsx)(r.SidebarMenu,{children:e.items.map(e=>(0,i.jsx)(Z,{item:e,pathname:d.pathname},e.href))})})]},e.groupLabel||n))]})})}function $(){t.ComponentRegistry.register(`page-header`,y,{namespace:`layout`,label:`Page Header`,category:`Layout`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`}]}),t.ComponentRegistry.register(`page:header`,y,{namespace:`layout`}),t.ComponentRegistry.register(`page:card`,E,{namespace:`layout`,label:`Page Card`,category:`Layout`,isContainer:!0}),t.ComponentRegistry.register(`app-shell`,T,{namespace:`layout`,label:`App Shell`,category:`Layout`}),t.ComponentRegistry.register(`responsive-grid`,A,{namespace:`layout`,label:`Responsive Grid`,category:`Layout`,isContainer:!0,inputs:[{name:`columns`,type:`object`},{name:`gap`,type:`number`}]}),t.ComponentRegistry.register(`navigation-renderer`,H,{namespace:`layout`,label:`Navigation Renderer`,category:`Layout`,inputs:[{name:`items`,type:`object`},{name:`basePath`,type:`string`}]}),t.ComponentRegistry.register(`app-schema-renderer`,q,{namespace:`layout`,label:`App Schema Renderer`,category:`Layout`,isContainer:!0,inputs:[{name:`schema`,type:`object`},{name:`basePath`,type:`string`},{name:`mobileNavMode`,type:`string`}]})}try{$()}catch{}e.AppSchemaRenderer=q,e.AppShell=T,e.NavigationRenderer=H,e.Page=Y,e.PageCard=E,e.PageHeader=y,e.ResponsiveGrid=A,e.SidebarNav=Q,e.filterNavigationItems=R,e.registerLayout=$,e.resolveIcon=j,e.resolveLabel=M,e.useAppShellBranding=w});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`lucide-react`),require(`@object-ui/react`),require(`react/jsx-runtime`),require(`react-router-dom`),require(`@dnd-kit/core`),require(`@dnd-kit/sortable`),require(`@dnd-kit/utilities`),require(`@object-ui/types`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`@object-ui/react`,`react/jsx-runtime`,`react-router-dom`,`@dnd-kit/core`,`@dnd-kit/sortable`,`@dnd-kit/utilities`,`@object-ui/types`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUILayout={},e._object_ui_core,e.react,e._object_ui_components,e.lucide_react,e._object_ui_react,e.react_jsx_runtime,e.react_router_dom,e._dnd_kit_core,e._dnd_kit_sortable,e._dnd_kit_utilities,e._object_ui_types))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var y=e=>{let t=e?.name??e?.full_name??e?.display_name??e?.label??e?.title??e?.subject;return t!=null&&String(t).trim()?String(t):[e?.salutation,e?.first_name,e?.last_name].filter(e=>typeof e==`string`&&e.trim()).map(e=>e.trim()).join(` `)||(typeof e?.email==`string`&&e.email.trim()?e.email.trim():null)},b=(e,t)=>!e||typeof e!=`string`?e??``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,n)=>{let r=n.split(`.`).reduce((e,t)=>e==null?e:e[t],t);return r==null?``:typeof r==`object`?y(r)??``:String(r)}).replace(/\s+/g,` `).trim():e;function x({title:e,subtitle:t,description:s,icon:c,action:l,actions:u,showBack:d,schema:f,className:p,children:m,...h}){let g=(0,a.useRecordContext)(),_=b(e,g?.data)||e,v=t??s,y=b(v,g?.data)||v,x=!!g?.recordId,S=d??x,C=n.default.useCallback(()=>{if(typeof window>`u`)return;let e=window.location.pathname,t=e.replace(/\/record\/[^/]+\/?$/,``);t===e?window.history.length>1&&window.history.back():(window.history.pushState({},``,t+window.location.search),window.dispatchEvent(new PopStateEvent(`popstate`)))},[]),w=Array.isArray(f?.children)?f.children.filter(Boolean).map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e},e?.id||`pgh-child-${t}`)):null,T=Array.isArray(u)&&u.length>0&&u||Array.isArray(f?.actions)&&f.actions.length>0&&f.actions||Array.isArray(f?.properties?.actions)&&f.properties.actions.length>0&&f.properties.actions||null,E=l||m||(T?(0,o.jsx)(a.SchemaRenderer,{schema:{type:`record:quick_actions`,properties:{actions:T,location:`record_header`,align:`end`,inline:!0}}}):null)||w;return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex flex-col gap-3 pb-4 border-b`,p),...h,children:(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[S&&(0,o.jsx)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,onClick:C,"aria-label":`Back to list`,className:`flex-shrink-0 -ml-2`,children:(0,o.jsx)(i.ArrowLeft,{className:`size-4`})}),c&&(0,o.jsx)(`div`,{className:`flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary`,children:typeof c==`string`?(0,o.jsx)(r.LazyIcon,{name:c,className:`size-5`}):c}),(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[(0,o.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight md:text-3xl truncate`,children:_}),y&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground truncate`,children:y})]}),E&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:E})]})})}function S(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return null;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;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case n:s=((r-i)/e+(r<i?6:0))/6;break;case r:s=((i-n)/e+2)/6;break;case i:s=((n-r)/e+4)/6;break}}return{h:s*360,s:c*100,l:l*100}}function C(e){let t=S(e);return t?`${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%`:null}function w(e){let t=S(e);if(!t)return null;let n=Math.max(t.l,65),r=t.s>80?Math.max(t.s-10,70):t.s;return`${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`}function T(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return`0 0% 100%`;let n=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},r=n(parseInt(t[1],16)),i=n(parseInt(t[2],16)),a=n(parseInt(t[3],16));return .2126*r+.7152*i+.0722*a>.6?`222 47% 11%`:`0 0% 100%`}function E(e,t){(0,n.useEffect)(()=>{let n=document.documentElement,r=()=>n.classList.contains(`dark`),i=()=>{if(e?.primaryColor){let t=C(e.primaryColor),i=w(e.primaryColor),a=r()&&i||t;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%`:T(e.primaryColor)),n.style.setProperty(`--ring`,a),n.style.setProperty(`--sidebar-primary`,a),n.style.setProperty(`--sidebar-ring`,a))}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`);if(e?.accentColor){let t=C(e.accentColor),i=w(e.accentColor),a=r()&&i||t;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%`:T(e.accentColor)))}else n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)};i();let a=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===`class`){i();break}});if(a.observe(n,{attributes:!0,attributeFilter:[`class`]}),e?.favicon){let t=document.querySelector(`#favicon`)||document.querySelector(`link[rel="icon"]`);t&&(t.href=e.favicon)}return t&&(document.title=t),()=>{a.disconnect(),n.style.removeProperty(`--brand-primary`),n.style.removeProperty(`--brand-primary-hsl`),n.style.removeProperty(`--brand-accent`),n.style.removeProperty(`--brand-accent-hsl`),n.style.removeProperty(`--primary`),n.style.removeProperty(`--primary-foreground`),n.style.removeProperty(`--ring`),n.style.removeProperty(`--sidebar-primary`),n.style.removeProperty(`--sidebar-ring`),n.style.removeProperty(`--accent`),n.style.removeProperty(`--accent-foreground`)}},[e?.primaryColor,e?.accentColor,e?.favicon,t])}function D({sidebar:e,navbar:t,children:n,className:i,defaultOpen:a=!0,branding:s}){return E(s,s?.title),(0,o.jsxs)(r.SidebarProvider,{defaultOpen:a,className:`!flex-col h-svh overflow-hidden`,children:[(0,o.jsx)(`header`,{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`,children:t}),(0,o.jsxs)(`div`,{className:`flex flex-1 min-h-0 w-full`,children:[e,(0,o.jsx)(r.SidebarInset,{className:`min-w-0`,children:(0,o.jsx)(`main`,{className:(0,r.cn)(`flex-1 min-w-0 overflow-auto p-3 sm:p-4 md:p-6 pb-20 sm:pb-4 md:pb-6`,i),children:n})})]})]})}function O({className:e,children:t,...n}){return(0,o.jsx)(`div`,{className:(0,r.cn)(`rounded-xl border bg-card text-card-foreground shadow`,e),...n,children:(0,o.jsx)(`div`,{className:`p-6`,children:t})})}var k={xs:{1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,6:`grid-cols-6`,12:`grid-cols-12`},sm:{1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,6:`sm:grid-cols-6`,12:`sm:grid-cols-12`},md:{1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,6:`md:grid-cols-6`,12:`md:grid-cols-12`},lg:{1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,6:`lg:grid-cols-6`,12:`lg:grid-cols-12`},xl:{1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,6:`xl:grid-cols-6`,12:`xl:grid-cols-12`},"2xl":{1:`2xl:grid-cols-1`,2:`2xl:grid-cols-2`,3:`2xl:grid-cols-3`,4:`2xl:grid-cols-4`,6:`2xl:grid-cols-6`,12:`2xl:grid-cols-12`}};function A(e){if(!e)return`grid-cols-1`;let t=[];for(let[n,r]of Object.entries(e)){let e=k[n];if(e&&r){let n=Object.keys(e).map(Number).reduce((e,t)=>Math.abs(t-r)<Math.abs(e-r)?t:e);t.push(e[n])}}return t.join(` `)||`grid-cols-1`}var j={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`},M=({columns:e,gap:t=4,className:n,children:i})=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid`,A(e),typeof t==`number`?j[t]||`gap-${t}`:``,n),children:i});function N(e){return e?(0,r.getLazyIcon)(e):i.FileText}function P(e,t){if(typeof e==`string`)return e;if(t){let n=t(e.key,{defaultValue:e.defaultValue,...e.params});if(n&&n!==e.key)return n}return e.defaultValue||e.key}function F(e,t,n,r,i){let a=P(e.label,n);return typeof e.label==`string`?t&&e.type===`object`&&e.objectName?t(e.objectName,a):r&&e.type===`dashboard`&&e.dashboardName?r(e.dashboardName,a):i&&e.type===`group`&&e.id?i(e.id,a):a:a}var I=e=>!(e===!1||e===`false`),L=()=>!0,R=()=>!0;function z(e,t){switch(e.type){case`object`:{let n=`${t}/${e.objectName??``}`;return{href:e.viewName?`${n}/view/${e.viewName}`:n,external:!1}}case`dashboard`:return{href:e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`,external:!1};case`page`:return{href:e.pageName?`${t}/page/${e.pageName}`:`#`,external:!1};case`report`:return{href:e.reportName?`${t}/report/${e.reportName}`:`#`,external:!1};case`url`:return{href:e.url??`#`,external:e.target===`_blank`};default:return{href:`#`,external:!1}}}function B(e,t){if(!t.trim())return e;let n=t.toLowerCase().trim();return e.reduce((e,r)=>{if(r.type===`separator`)return e;if(r.type===`group`&&r.children?.length){let n=B(r.children,t);return n.length>0&&e.push({...r,children:n}),e}return P(r.label).toLowerCase().includes(n)&&e.push(r),e},[])}var V=5;function H({item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,enableReorder:d,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h}){let{attributes:g,listeners:_,setNodeRef:v,transform:y,transition:b,isDragging:x}=(0,l.useSortable)({id:e.id,disabled:!d});return(0,o.jsx)(`div`,{ref:v,style:{transform:u.CSS.Transform.toString(y),transition:b,opacity:x?.5:void 0,zIndex:x?10:void 0},...g,children:(0,o.jsx)(U,{item:e,basePath:t,evalVis:n,checkPerm:r,checkCap:i,onAction:a,enablePinning:s,onPinToggle:c,dragListeners:d?_:void 0,resolveObjectLabel:f,resolveDashboardLabel:p,resolveGroupLabel:m,t:h})})}function U({item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,dragListeners:p,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,t:_}){let v=(0,s.useLocation)(),[y,b]=(0,n.useState)(e.defaultOpen!==!1);if(!a(e.visible)||e.requiredPermissions?.length&&!c(e.requiredPermissions))return null;let x=e.requiresObject,S=e.requiresService;if(x&&!l(`object`,x)||S&&!l(`service`,S))return null;if(e.type===`separator`)return(0,o.jsx)(r.Separator,{className:`my-2`});if(e.type===`group`){let n=(e.children??[]).slice().sort((e,t)=>(e.order??0)-(t.order??0));return(0,o.jsx)(r.Collapsible,{open:y,onOpenChange:b,children:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsx)(r.SidebarGroupLabel,{asChild:!0,children:(0,o.jsxs)(r.CollapsibleTrigger,{className:`flex w-full items-center justify-between`,children:[F(e,m,_,h,g),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform ${y?`rotate-90`:``}`})]})}),(0,o.jsx)(r.CollapsibleContent,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:n.map(e=>(0,o.jsx)(U,{item:e,basePath:t,evalVis:a,checkPerm:c,checkCap:l,onAction:u,enablePinning:d,onPinToggle:f,resolveObjectLabel:m,resolveDashboardLabel:h,resolveGroupLabel:g,t:_},e.id))})})})]})})}if(e.type===`action`){let t=N(e.icon),n=P(e.label,_);return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":_?_(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsxs)(r.SidebarMenuButton,{tooltip:n,onClick:()=>u?.(e),children:[(0,o.jsx)(t,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:n}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":_?_(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${n}`:`Pin ${n}`,name:n}):e.pinned?`Unpin ${n}`:`Pin ${n}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}let C=N(e.icon),{href:w,external:T}=z(e,t),E=w!==`#`&&v.pathname.startsWith(w),D=F(e,m,_,h,g),O=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(C,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:D}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant??`default`,className:`ml-auto text-[10px] px-1.5 py-0`,children:e.badge})]});return(0,o.jsxs)(r.SidebarMenuItem,{children:[p&&(0,o.jsx)(`span`,{className:`absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground`,"aria-label":_?_(`console.nav.dragToReorder`,{defaultValue:`Drag to reorder`}):`Drag to reorder`,...p,children:(0,o.jsx)(i.GripVertical,{className:`h-3.5 w-3.5`})}),(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:E,tooltip:D,children:T?(0,o.jsx)(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,children:O}):(0,o.jsx)(s.Link,{to:w,children:O})}),d&&f&&(0,o.jsx)(r.SidebarMenuAction,{showOnHover:!0,onClick:()=>f(e.id,!e.pinned),"aria-label":_?_(e.pinned?`console.nav.unpinItem`:`console.nav.pinItem`,{defaultValue:e.pinned?`Unpin ${D}`:`Pin ${D}`,name:D}):e.pinned?`Unpin ${D}`:`Pin ${D}`,children:e.pinned?(0,o.jsx)(i.PinOff,{className:`h-3.5 w-3.5`}):(0,o.jsx)(i.Pin,{className:`h-3.5 w-3.5`})})]})}function W({items:e,basePath:t=``,evaluateVisibility:a=I,checkPermission:s=L,checkCapability:u=R,onAction:d,searchQuery:f,enablePinning:p,onPinToggle:m,enableReorder:h,onReorder:g,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,t:b}){let x=(0,n.useMemo)(()=>f?B(e,f):e,[e,f]),S=(0,n.useMemo)(()=>G(x),[x]),C=x.slice().sort((e,t)=>(e.order??0)-(t.order??0)),w=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:V}}),(0,c.useSensor)(c.KeyboardSensor)),T=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!g)return;let r=C.findIndex(e=>e.id===t.id),i=C.findIndex(e=>e.id===n.id);r===-1||i===-1||g((0,l.arrayMove)(C,r,i).map((e,t)=>({...e,order:t})))},E={basePath:t,evalVis:a,checkPerm:s,checkCap:u,onAction:d,enablePinning:p,onPinToggle:m,resolveObjectLabel:_,resolveDashboardLabel:v,resolveGroupLabel:y,t:b},D=C.some(e=>e.type===`group`),O=S.length>0&&p?(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Star,{className:`h-3.5 w-3.5`}),b?b(`console.nav.favorites`,{defaultValue:`Favorites`}):`Favorites`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:S.map(e=>(0,o.jsx)(U,{item:e,...E},`fav-${e.id}`))})})]}):null;if(!D){let e=C.filter(e=>e.type!==`group`).map(e=>e.id);return(0,o.jsxs)(o.Fragment,{children:[O,(0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:h?(0,o.jsx)(c.DndContext,{sensors:w,collisionDetection:c.closestCenter,onDragEnd:T,children:(0,o.jsx)(l.SortableContext,{items:e,strategy:l.verticalListSortingStrategy,children:(0,o.jsx)(r.SidebarMenu,{children:C.map(e=>(0,o.jsx)(H,{item:e,enableReorder:h,...E},e.id))})})}):(0,o.jsx)(r.SidebarMenu,{children:C.map(e=>(0,o.jsx)(U,{item:e,...E},e.id))})})})]})}let k=[],A=[],j=e=>{if(A.length===0)return;let t=A;A=[],k.push((0,o.jsx)(r.SidebarGroup,{children:(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:t.map(e=>(0,o.jsx)(U,{item:e,...E},e.id))})})},e))};return C.forEach((e,t)=>{e.type===`group`?(j(`leaf-${t}`),k.push((0,o.jsx)(U,{item:e,...E},e.id))):A.push(e)}),j(`leaf-end`),(0,o.jsxs)(o.Fragment,{children:[O,k]})}function G(e){let t=[];for(let n of e)n.pinned&&n.type!==`group`&&n.type!==`separator`&&t.push(n),n.children?.length&&t.push(...G(n.children));return t}function K({areas:e,activeAreaId:t,onAreaChange:n,evalVis:a,checkPerm:s}){let c=e.filter(e=>!(!a(e.visible)||e.requiredPermissions?.length&&!s(e.requiredPermissions)));return c.length<=1?null:(0,o.jsxs)(r.SidebarGroup,{children:[(0,o.jsxs)(r.SidebarGroupLabel,{className:`flex items-center gap-1.5`,children:[(0,o.jsx)(i.Layers,{className:`h-3.5 w-3.5`}),`Area`]}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:c.map(e=>{let i=N(e.icon);return(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{isActive:e.id===t,tooltip:P(e.label),onClick:()=>n(e.id),children:[(0,o.jsx)(i,{className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:P(e.label)})]})},e.id)})})})]})}function q({items:e,basePath:t}){let n=(0,s.useLocation)(),r=e=>{let t=[];for(let n of e)n.type!==`separator`&&(n.type===`group`?t.push(...r(n.children||[])):t.push(n));return t},i=r(e).slice(0,5);return i.length===0?null:(0,o.jsx)(`div`,{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`,role:`navigation`,"aria-label":`Mobile navigation`,children:i.map(e=>{let r=N(e.icon),i=`#`;e.type===`object`?(i=`${t}/${e.objectName}`,e.viewName&&(i+=`/view/${e.viewName}`)):e.type===`dashboard`?i=e.dashboardName?`${t}/dashboard/${e.dashboardName}`:`#`:e.type===`page`?i=e.pageName?`${t}/page/${e.pageName}`:`#`:e.type===`report`?i=e.reportName?`${t}/report/${e.reportName}`:`#`:e.type===`url`&&(i=e.url??`#`);let a=i!==`#`&&n.pathname.startsWith(i);return(0,o.jsxs)(s.Link,{to:i,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`}`,children:[(0,o.jsx)(r,{className:`h-5 w-5`}),(0,o.jsx)(`span`,{className:`text-[10px] truncate max-w-[60px]`,children:P(e.label)})]},e.id)})})}function J({schema:e,basePath:t,evalVis:i,checkPerm:a,checkCap:s,onAction:c,sidebarHeader:l,sidebarFooter:u,sidebarExtra:d,activeAreaId:f,setActiveAreaId:p,resolvedNavigation:m,enableSearch:h,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}){let b=N(e.logo),x=e.areas??[],[S,C]=(0,n.useState)(``);return(0,o.jsxs)(r.Sidebar,{collapsible:`icon`,children:[(0,o.jsxs)(r.SidebarHeader,{children:[l??(0,o.jsx)(r.SidebarMenu,{children:(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsxs)(r.SidebarMenuButton,{size:`lg`,tooltip:e.title??e.name,children:[(0,o.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground`,children:e.logo&&e.logo.startsWith(`http`)?(0,o.jsx)(`img`,{src:e.logo,alt:e.title??``,className:`size-6 object-contain`}):(0,o.jsx)(b,{className:`size-4`})}),(0,o.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[(0,o.jsx)(`span`,{className:`truncate font-semibold`,children:e.title??e.name??`App`}),e.description&&(0,o.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]})]})})}),h&&(0,o.jsx)(r.SidebarInput,{placeholder:`Search navigation…`,value:S,onChange:e=>C(e.target.value),"aria-label":`Search navigation`})]}),(0,o.jsxs)(r.SidebarContent,{children:[x.length>1&&f&&(0,o.jsx)(K,{areas:x,activeAreaId:f,onAreaChange:p,evalVis:i,checkPerm:a}),(0,o.jsx)(W,{items:m,basePath:t,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,searchQuery:S,enablePinning:g,onPinToggle:_,enableReorder:v,onReorder:y}),d]}),u&&(0,o.jsx)(r.SidebarFooter,{children:u})]})}function Y({schema:e,basePath:t=``,mobileNavMode:r=`drawer`,evaluateVisibility:i,checkPermission:a,checkCapability:s,onAction:c,navbar:l,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,children:m,className:h,defaultOpen:g=!0,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}){let S=i??(e=>!(e===!1||e===`false`)),C=a??(()=>!0),w=s??(()=>!0),T=(0,n.useMemo)(()=>(e.menu??[]).map((e,t)=>(0,d.menuItemToNavigationItem)(e,t)),[e.menu]),E=e.navigation??T,O=e.areas??[],[k,A]=(0,n.useState)(()=>O.length>0?O[0].id:null),j=O.map(e=>e.id).join(`,`);(0,n.useEffect)(()=>{O.length>0?A(e=>O.some(t=>t.id===e)?e:O[0].id):A(null)},[e.name,j]);let M=O.find(e=>e.id===k)?.navigation??E,N={title:e.title,favicon:e.favicon,logo:e.logo};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(D,{sidebar:(0,o.jsx)(J,{schema:e,basePath:t,evalVis:S,checkPerm:C,checkCap:w,onAction:c,sidebarHeader:u,sidebarFooter:f,sidebarExtra:p,activeAreaId:k,setActiveAreaId:A,resolvedNavigation:M,enableSearch:_,enablePinning:v,onPinToggle:y,enableReorder:b,onReorder:x}),navbar:l,className:h,defaultOpen:g,branding:N,children:m}),r===`bottom_nav`&&(0,o.jsx)(q,{items:M,basePath:t})]})}var X=e=>e?Array.isArray(e)?e:[e]:[];function Z({schema:e,className:t,style:n,id:i,...s}){let c=X(e.children);return(0,o.jsxs)(`div`,{id:i||e.id,className:(0,r.cn)(`flex flex-col h-full space-y-4`,t),style:n,children:[(0,o.jsx)(x,{title:e.title,description:e.description}),(0,o.jsx)(`div`,{className:`flex-1 overflow-auto`,children:c.map((e,t)=>(0,o.jsx)(a.SchemaRenderer,{schema:e,...s},e?.id||t))})]})}function Q(e){return`items`in e&&!(`href`in e)}function ee({item:e,pathname:t}){return e.children&&e.children.length>0?(0,o.jsx)(r.Collapsible,{asChild:!0,defaultOpen:!0,className:`group/collapsible`,children:(0,o.jsxs)(r.SidebarMenuItem,{children:[(0,o.jsx)(r.CollapsibleTrigger,{asChild:!0,children:(0,o.jsxs)(r.SidebarMenuButton,{tooltip:e.title,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto mr-1 h-5 min-w-5 px-1 text-xs`,children:e.badge}),(0,o.jsx)(i.ChevronRight,{className:`ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`})]})}),(0,o.jsx)(r.CollapsibleContent,{children:(0,o.jsx)(r.SidebarMenuSub,{children:e.children.map(e=>(0,o.jsx)(r.SidebarMenuSubItem,{children:(0,o.jsx)(r.SidebarMenuSubButton,{asChild:!0,isActive:t===e.href,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})},e.href))})})]})}):(0,o.jsx)(r.SidebarMenuItem,{children:(0,o.jsx)(r.SidebarMenuButton,{asChild:!0,isActive:t===e.href,tooltip:e.title,children:(0,o.jsxs)(s.NavLink,{to:e.href,children:[e.icon&&(0,o.jsx)(e.icon,{}),(0,o.jsx)(`span`,{children:e.title}),e.badge!=null&&(0,o.jsx)(r.Badge,{variant:e.badgeVariant||`default`,className:`ml-auto h-5 min-w-5 px-1 text-xs`,children:e.badge})]})})})}function te({items:e,title:t=`Application`,className:a,collapsible:c=`icon`,searchEnabled:l=!1,searchPlaceholder:u=`Search...`}){let d=(0,s.useLocation)(),[f,p]=n.default.useState(``),m=n.default.useMemo(()=>e.length===0?[]:Q(e[0])?e.map(e=>({groupLabel:e.label,items:e.items})):[{items:e}],[e]),h=n.default.useMemo(()=>{if(!f)return m;let e=f.toLowerCase();return m.map(t=>({...t,items:t.items.filter(t=>t.title.toLowerCase().includes(e)||t.children?.some(t=>t.title.toLowerCase().includes(e)))})).filter(e=>e.items.length>0)},[m,f]);return(0,o.jsx)(r.Sidebar,{className:a,collapsible:c,children:(0,o.jsxs)(r.SidebarContent,{children:[l&&(0,o.jsx)(`div`,{className:`px-3 py-2`,children:(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(i.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(r.Input,{type:`search`,placeholder:u,value:f,onChange:e=>p(e.target.value),className:`pl-8 h-9`})]})}),h.map((e,n)=>(0,o.jsxs)(r.SidebarGroup,{children:[n>0&&(0,o.jsx)(`div`,{className:`mx-3 mb-1 h-px bg-sidebar-border/60`,"aria-hidden":!0}),(0,o.jsx)(r.SidebarGroupLabel,{className:`text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60`,children:e.groupLabel||t}),(0,o.jsx)(r.SidebarGroupContent,{children:(0,o.jsx)(r.SidebarMenu,{children:e.items.map(e=>(0,o.jsx)(ee,{item:e,pathname:d.pathname},e.href))})})]},e.groupLabel||n))]})})}function $(){t.ComponentRegistry.register(`page-header`,x,{namespace:`layout`,label:`Page Header`,category:`Layout`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`}]}),t.ComponentRegistry.register(`page:header`,x,{namespace:`layout`}),t.ComponentRegistry.register(`page:card`,O,{namespace:`layout`,label:`Page Card`,category:`Layout`,isContainer:!0}),t.ComponentRegistry.register(`app-shell`,D,{namespace:`layout`,label:`App Shell`,category:`Layout`}),t.ComponentRegistry.register(`responsive-grid`,M,{namespace:`layout`,label:`Responsive Grid`,category:`Layout`,isContainer:!0,inputs:[{name:`columns`,type:`object`},{name:`gap`,type:`number`}]}),t.ComponentRegistry.register(`navigation-renderer`,W,{namespace:`layout`,label:`Navigation Renderer`,category:`Layout`,inputs:[{name:`items`,type:`object`},{name:`basePath`,type:`string`}]}),t.ComponentRegistry.register(`app-schema-renderer`,Y,{namespace:`layout`,label:`App Schema Renderer`,category:`Layout`,isContainer:!0,inputs:[{name:`schema`,type:`object`},{name:`basePath`,type:`string`},{name:`mobileNavMode`,type:`string`}]})}try{$()}catch{}e.AppSchemaRenderer=Y,e.AppShell=D,e.NavigationRenderer=W,e.Page=Z,e.PageCard=O,e.PageHeader=x,e.ResponsiveGrid=M,e.SidebarNav=te,e.filterNavigationItems=B,e.registerLayout=$,e.resolveIcon=N,e.resolveLabel=P,e.useAppShellBranding=E});
@@ -1,7 +1,47 @@
1
1
  import { default as React } from 'react';
2
2
  export interface PageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
3
3
  title: string;
4
+ /**
5
+ * Optional secondary line under the title. Spec schemas use `subtitle`,
6
+ * the legacy console pages use `description` — both are supported and
7
+ * resolve {field.path} tokens against the current record context.
8
+ */
9
+ subtitle?: string;
4
10
  description?: string;
11
+ /**
12
+ * Optional icon for the header chip. Accepts either a string Lucide icon
13
+ * name (resolved via `LazyIcon`, the standard ObjectUI helper) or a
14
+ * pre-rendered React node.
15
+ */
16
+ icon?: React.ReactNode | string;
5
17
  action?: React.ReactNode;
18
+ /**
19
+ * Show a back arrow at the left of the header that navigates one level
20
+ * up the URL (e.g. /apps/{app}/{obj}/record/{id} → /apps/{app}/{obj}).
21
+ * Defaults to true on record pages and false otherwise — the inference
22
+ * is based on whether a record context with a recordId is available.
23
+ */
24
+ showBack?: boolean;
25
+ /**
26
+ * Optional inline action list rendered into the header's right-aligned
27
+ * slot. Accepts an array of `ActionDef` objects (or action ids) and
28
+ * delegates rendering to the standard `record:quick_actions` widget
29
+ * with `location: 'record_header'`. Authors no longer need to declare
30
+ * a sibling `record:quick_actions` node + visual `-mt-12` hack.
31
+ */
32
+ actions?: unknown[];
33
+ /**
34
+ * When rendered from a schema, `SchemaRenderer` injects the full schema
35
+ * node so we can render its `children` into the right-aligned action
36
+ * slot (Salesforce Lightning-style header). React children passed at
37
+ * the JSX call site take precedence over schema children.
38
+ */
39
+ schema?: {
40
+ children?: unknown[];
41
+ actions?: unknown[];
42
+ properties?: {
43
+ actions?: unknown[];
44
+ };
45
+ };
6
46
  }
7
- export declare function PageHeader({ title, description, action, className, children, ...props }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
47
+ export declare function PageHeader({ title, subtitle, description, icon, action, actions, showBack, schema, className, children, ...props }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/layout",
3
- "version": "4.3.0",
3
+ "version": "4.5.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.umd.cjs",
@@ -22,10 +22,10 @@
22
22
  "react": "19.2.6",
23
23
  "react-dom": "19.2.6",
24
24
  "tailwind-merge": "^3.6.0",
25
- "@object-ui/components": "4.3.0",
26
- "@object-ui/core": "4.3.0",
27
- "@object-ui/react": "4.3.0",
28
- "@object-ui/types": "4.3.0"
25
+ "@object-ui/components": "4.5.0",
26
+ "@object-ui/core": "4.5.0",
27
+ "@object-ui/react": "4.5.0",
28
+ "@object-ui/types": "4.5.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": "^18.0.0 || ^19.0.0",