@object-ui/layout 17.5.0 → 17.7.0

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