@declarion/react 0.1.28 → 0.1.30

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-lib/index.js CHANGED
@@ -3,22 +3,22 @@ var Es = (e, t, r) => t in e ? Rs(e, t, { enumerable: !0, configurable: !0, writ
3
3
  var st = (e, t, r) => Es(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { jsx as n, jsxs as d, Fragment as pe } from "react/jsx-runtime";
5
5
  import * as ae from "react";
6
- import { useCallback as z, useMemo as ee, Suspense as wr, lazy as _n, useState as V, useRef as me, useEffect as le, Component as Os } from "react";
7
- import { useNavigate as Xe, useLocation as Pr, Outlet as Fs, useSearchParams as yt, Link as Sn, useParams as Ls, BrowserRouter as qs, Routes as js, Route as Ie, Navigate as zs } from "react-router-dom";
6
+ import { useCallback as z, useMemo as ee, Suspense as wr, lazy as wn, useState as I, useRef as me, useEffect as le, Component as Os } from "react";
7
+ import { useNavigate as Xe, useLocation as Dr, Outlet as Fs, useSearchParams as yt, Link as _n, useParams as Ls, BrowserRouter as qs, Routes as js, Route as Ie, Navigate as zs } from "react-router-dom";
8
8
  import { useQuery as Ve, useQueryClient as Fe, useMutation as Ee, useInfiniteQuery as Ms, QueryClient as Us, QueryClientProvider as Is } from "@tanstack/react-query";
9
9
  import { toast as ie, Toaster as Vs } from "sonner";
10
- import { ChevronDown as Mt, ChevronRight as $r, ChevronLeft as kn, Check as Tt, Circle as Ks, ChevronsUpDown as Ws, LogOut as Hs, X as ze, ArrowLeft as Js, Copy as Qs, ChevronUp as Gs, ExternalLink as _r, Trash2 as Je, Plus as Oe, EyeOff as Rr, Eye as Er, Loader2 as sr, CheckCircle2 as Ys, AlertTriangle as Cn, XCircle as Xs, Filter as Tn, Columns3 as Bs, RotateCcw as An, Save as Or, Star as Zs, Globe as ei, MoreHorizontal as ti, Pencil as Yt, Search as Fr, ArrowUp as ri, ArrowDown as ni, ArrowUpDown as si, ArrowUpRight as ii, ArrowDownLeft as ai, Undo2 as Dn, GripVertical as oi } from "lucide-react";
10
+ import { ChevronDown as Mt, ChevronRight as Pr, ChevronLeft as Sn, Check as Tt, Circle as Ks, ChevronsUpDown as Ws, LogOut as Hs, X as ze, ArrowLeft as Js, Copy as Qs, ChevronUp as Gs, ExternalLink as _r, Trash2 as Je, Plus as Oe, EyeOff as $r, Eye as Rr, Loader2 as sr, CheckCircle2 as Ys, AlertTriangle as kn, XCircle as Xs, Filter as Cn, Columns3 as Bs, RotateCcw as Tn, Save as Er, Star as Zs, Globe as ei, MoreHorizontal as ti, Pencil as Yt, Search as Or, ArrowUp as ri, ArrowDown as ni, ArrowUpDown as si, ArrowUpRight as ii, ArrowDownLeft as ai, Undo2 as An, GripVertical as oi } from "lucide-react";
11
11
  import { clsx as li } from "clsx";
12
12
  import { twMerge as ci } from "tailwind-merge";
13
- import { create as Lr } from "zustand";
13
+ import { create as Fr } from "zustand";
14
14
  import di from "lucide-react/dynamicIconImports";
15
15
  import * as ye from "@radix-ui/react-dropdown-menu";
16
16
  import { Slot as ui } from "@radix-ui/react-slot";
17
- import { cva as qr } from "class-variance-authority";
18
- import { useSensors as Pn, useSensor as $n, PointerSensor as Rn, DndContext as En, closestCenter as On } from "@dnd-kit/core";
19
- import { SortableContext as Fn, horizontalListSortingStrategy as fi, useSortable as Ln, verticalListSortingStrategy as mi } from "@dnd-kit/sortable";
20
- import { CSS as qn } from "@dnd-kit/utilities";
21
- import * as jn from "@radix-ui/react-label";
17
+ import { cva as Lr } from "class-variance-authority";
18
+ import { useSensors as Dn, useSensor as Pn, PointerSensor as $n, DndContext as Rn, closestCenter as En } from "@dnd-kit/core";
19
+ import { SortableContext as On, horizontalListSortingStrategy as fi, useSortable as Fn, verticalListSortingStrategy as mi } from "@dnd-kit/sortable";
20
+ import { CSS as Ln } from "@dnd-kit/utilities";
21
+ import * as qn from "@radix-ui/react-label";
22
22
  import { useReactTable as pi, getCoreRowModel as hi, flexRender as dr } from "@tanstack/react-table";
23
23
  import { useVirtualizer as gi } from "@tanstack/react-virtual";
24
24
  import vi from "react-markdown";
@@ -39,14 +39,14 @@ class Jt extends Error {
39
39
  this.name = "ApiError", this.status = r, this.code = i, this.index = a;
40
40
  }
41
41
  }
42
- const zn = (e) => JSON.stringify(e ?? {});
42
+ const jn = (e) => JSON.stringify(e ?? {});
43
43
  let Ft = null;
44
44
  async function xi() {
45
45
  const e = {
46
46
  method: "POST",
47
47
  credentials: "include",
48
48
  headers: { "Content-Type": "application/json" },
49
- body: zn({})
49
+ body: jn({})
50
50
  }, t = await fetch("/api/actions/auth.refresh", e);
51
51
  if (t.status === 429) {
52
52
  const r = parseInt(t.headers.get("Retry-After") || "1", 10);
@@ -57,7 +57,7 @@ async function xi() {
57
57
  if (!t.ok)
58
58
  throw new Error("refresh failed");
59
59
  }
60
- async function Mn() {
60
+ async function zn() {
61
61
  return Ft || (Ft = xi().finally(() => {
62
62
  Ft = null;
63
63
  }), Ft);
@@ -80,7 +80,7 @@ async function ue(e, t = {}) {
80
80
  }
81
81
  if (s.status === 401 && (a === "TOKEN_REFRESH_NEEDED" || a === "UNAUTHORIZED"))
82
82
  try {
83
- await Mn();
83
+ await zn();
84
84
  const c = new Headers(t.headers);
85
85
  !c.has("Content-Type") && t.body && c.set("Content-Type", "application/json");
86
86
  const o = await fetch(e, {
@@ -109,7 +109,7 @@ async function lt(e, t = {}) {
109
109
  `/api/actions/${encodeURIComponent(e)}`,
110
110
  {
111
111
  method: "POST",
112
- body: zn(t)
112
+ body: jn(t)
113
113
  }
114
114
  )).result;
115
115
  }
@@ -123,7 +123,7 @@ function qe() {
123
123
  staleTime: 1 / 0
124
124
  });
125
125
  }
126
- const wi = ["/login", "/signup"], ht = Lr((e, t) => ({
126
+ const wi = ["/login", "/signup"], ht = Fr((e, t) => ({
127
127
  tabs: [],
128
128
  activeTabId: null,
129
129
  openTab: (r) => {
@@ -194,14 +194,14 @@ function Ut() {
194
194
  [e, t, r, s]
195
195
  );
196
196
  }
197
- const ln = /* @__PURE__ */ new Map();
197
+ const on = /* @__PURE__ */ new Map();
198
198
  function _i(e) {
199
- const t = ln.get(e);
199
+ const t = on.get(e);
200
200
  if (t) return t;
201
201
  const r = di[e];
202
202
  if (!r) return null;
203
- const s = _n(r);
204
- return ln.set(e, s), s;
203
+ const s = wn(r);
204
+ return on.set(e, s), s;
205
205
  }
206
206
  function Ge({ name: e, ...t }) {
207
207
  const r = ee(() => _i(e), [e]);
@@ -234,7 +234,7 @@ function ki(e) {
234
234
  structure: e.structure
235
235
  };
236
236
  }
237
- function jr(e) {
237
+ function qr(e) {
238
238
  var t;
239
239
  if (e.primary_key && e.primary_key.length > 0)
240
240
  return e.primary_key;
@@ -243,17 +243,17 @@ function jr(e) {
243
243
  return ["id"];
244
244
  }
245
245
  function Ci(e, t) {
246
- const r = jr(e), s = {};
246
+ const r = qr(e), s = {};
247
247
  for (const i of r)
248
248
  s[i] = String(t[i] ?? "");
249
249
  return s;
250
250
  }
251
- function cn(e) {
251
+ function ln(e) {
252
252
  const t = Object.values(e);
253
253
  return t.length === 1 ? t[0] : t.join("|");
254
254
  }
255
255
  function Ti() {
256
- const [e, t] = V(!1), [r, s] = V({}), i = Pr(), { data: a } = qe(), l = Ut(), c = (a == null ? void 0 : a.navigation) ?? [], o = a == null ? void 0 : a.branding, u = (o == null ? void 0 : o.app_name) || "Declarion", f = (o == null ? void 0 : o.app_initial) || u.charAt(0), m = (o == null ? void 0 : o.accent_color) || "#4f46e5";
256
+ const [e, t] = I(!1), [r, s] = I({}), i = Dr(), { data: a } = qe(), l = Ut(), c = (a == null ? void 0 : a.navigation) ?? [], o = a == null ? void 0 : a.branding, u = (o == null ? void 0 : o.app_name) || "Declarion", f = (o == null ? void 0 : o.app_initial) || u.charAt(0), m = (o == null ? void 0 : o.accent_color) || "#4f46e5";
257
257
  function p(b) {
258
258
  for (const w of b) {
259
259
  if (w.screen) return w;
@@ -376,14 +376,14 @@ function Ti() {
376
376
  {
377
377
  onClick: () => t(!e),
378
378
  className: "flex items-center justify-center h-10 border-t border-[var(--sidebar-border)] text-[var(--sidebar-muted)] hover:text-[var(--sidebar-foreground)] transition-colors",
379
- children: e ? /* @__PURE__ */ n($r, { className: "w-4 h-4" }) : /* @__PURE__ */ n(kn, { className: "w-4 h-4" })
379
+ children: e ? /* @__PURE__ */ n(Pr, { className: "w-4 h-4" }) : /* @__PURE__ */ n(Sn, { className: "w-4 h-4" })
380
380
  }
381
381
  )
382
382
  ]
383
383
  }
384
384
  );
385
385
  }
386
- async function Un() {
386
+ async function Mn() {
387
387
  return lt("auth.check_setup");
388
388
  }
389
389
  async function Ai(e, t) {
@@ -396,7 +396,7 @@ async function Di(e, t, r) {
396
396
  display_name: r
397
397
  });
398
398
  }
399
- async function In() {
399
+ async function Un() {
400
400
  return lt("auth.me");
401
401
  }
402
402
  async function Xt() {
@@ -422,7 +422,7 @@ function Ei(e, t, r) {
422
422
  const i = s.toString();
423
423
  return `/api/auth/sso/authorize/${encodeURIComponent(e)}${i ? `?${i}` : ""}`;
424
424
  }
425
- const ct = Lr((e) => ({
425
+ const ct = Fr((e) => ({
426
426
  user: null,
427
427
  isAuthenticated: !1,
428
428
  isLoading: !0,
@@ -430,7 +430,7 @@ const ct = Lr((e) => ({
430
430
  tenants: [],
431
431
  initialize: async () => {
432
432
  try {
433
- const t = await In(), r = t.tenant ?? null;
433
+ const t = await Un(), r = t.tenant ?? null;
434
434
  let s = [];
435
435
  try {
436
436
  s = await Xt();
@@ -474,7 +474,7 @@ const ct = Lr((e) => ({
474
474
  });
475
475
  }
476
476
  }));
477
- function zr() {
477
+ function jr() {
478
478
  const {
479
479
  user: e,
480
480
  isAuthenticated: t,
@@ -532,7 +532,7 @@ function zr() {
532
532
  isSwitchingTenant: p.isPending
533
533
  };
534
534
  }
535
- const Vn = ye.Root, Kn = ye.Trigger, Oi = ae.forwardRef(({ className: e, inset: t, children: r, ...s }, i) => /* @__PURE__ */ d(
535
+ const In = ye.Root, Vn = ye.Trigger, Oi = ae.forwardRef(({ className: e, inset: t, children: r, ...s }, i) => /* @__PURE__ */ d(
536
536
  ye.SubTrigger,
537
537
  {
538
538
  ref: i,
@@ -544,7 +544,7 @@ const Vn = ye.Root, Kn = ye.Trigger, Oi = ae.forwardRef(({ className: e, inset:
544
544
  ...s,
545
545
  children: [
546
546
  r,
547
- /* @__PURE__ */ n($r, { className: "ml-auto" })
547
+ /* @__PURE__ */ n(Pr, { className: "ml-auto" })
548
548
  ]
549
549
  }
550
550
  ));
@@ -561,7 +561,7 @@ const Fi = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
561
561
  }
562
562
  ));
563
563
  Fi.displayName = ye.SubContent.displayName;
564
- const Mr = ae.forwardRef(({ className: e, sideOffset: t = 4, ...r }, s) => /* @__PURE__ */ n(ye.Portal, { children: /* @__PURE__ */ n(
564
+ const zr = ae.forwardRef(({ className: e, sideOffset: t = 4, ...r }, s) => /* @__PURE__ */ n(ye.Portal, { children: /* @__PURE__ */ n(
565
565
  ye.Content,
566
566
  {
567
567
  ref: s,
@@ -573,7 +573,7 @@ const Mr = ae.forwardRef(({ className: e, sideOffset: t = 4, ...r }, s) => /* @_
573
573
  ...r
574
574
  }
575
575
  ) }));
576
- Mr.displayName = ye.Content.displayName;
576
+ zr.displayName = ye.Content.displayName;
577
577
  const mt = ae.forwardRef(({ className: e, inset: t, ...r }, s) => /* @__PURE__ */ n(
578
578
  ye.Item,
579
579
  {
@@ -633,7 +633,7 @@ const ji = ae.forwardRef(({ className: e, inset: t, ...r }, s) => /* @__PURE__ *
633
633
  }
634
634
  ));
635
635
  ji.displayName = ye.Label.displayName;
636
- const Wn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
636
+ const Kn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
637
637
  ye.Separator,
638
638
  {
639
639
  ref: r,
@@ -641,8 +641,8 @@ const Wn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
641
641
  ...t
642
642
  }
643
643
  ));
644
- Wn.displayName = ye.Separator.displayName;
645
- const Ur = qr(
644
+ Kn.displayName = ye.Separator.displayName;
645
+ const Mr = Lr(
646
646
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
647
647
  {
648
648
  variants: {
@@ -670,7 +670,7 @@ const Ur = qr(
670
670
  ({ className: e, variant: t, size: r, asChild: s = !1, ...i }, a) => /* @__PURE__ */ n(
671
671
  s ? ui : "button",
672
672
  {
673
- className: J(Ur({ variant: t, size: r, className: e })),
673
+ className: J(Mr({ variant: t, size: r, className: e })),
674
674
  ref: a,
675
675
  ...i
676
676
  }
@@ -679,10 +679,10 @@ const Ur = qr(
679
679
  j.displayName = "Button";
680
680
  function zi() {
681
681
  var o, u;
682
- const e = ct((f) => f.user), { logout: t, activeTenant: r, tenants: s, switchTenant: i, isSwitchingTenant: a } = zr(), l = e != null && e.display_name ? e.display_name.split(" ").map((f) => f[0]).join("").toUpperCase().slice(0, 2) : ((u = (o = e == null ? void 0 : e.email) == null ? void 0 : o[0]) == null ? void 0 : u.toUpperCase()) ?? "U", c = s.length > 1;
682
+ const e = ct((f) => f.user), { logout: t, activeTenant: r, tenants: s, switchTenant: i, isSwitchingTenant: a } = jr(), l = e != null && e.display_name ? e.display_name.split(" ").map((f) => f[0]).join("").toUpperCase().slice(0, 2) : ((u = (o = e == null ? void 0 : e.email) == null ? void 0 : o[0]) == null ? void 0 : u.toUpperCase()) ?? "U", c = s.length > 1;
683
683
  return /* @__PURE__ */ d("header", { className: "flex items-center justify-between h-14 px-6 border-b border-[var(--border)] bg-[var(--background)]", children: [
684
- /* @__PURE__ */ n("div", { className: "flex items-center gap-3", children: r && /* @__PURE__ */ d(Vn, { children: [
685
- /* @__PURE__ */ n(Kn, { asChild: !0, children: /* @__PURE__ */ d(
684
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-3", children: r && /* @__PURE__ */ d(In, { children: [
685
+ /* @__PURE__ */ n(Vn, { asChild: !0, children: /* @__PURE__ */ d(
686
686
  j,
687
687
  {
688
688
  variant: "outline",
@@ -695,7 +695,7 @@ function zi() {
695
695
  ]
696
696
  }
697
697
  ) }),
698
- c && /* @__PURE__ */ n(Mr, { align: "start", children: s.map((f) => /* @__PURE__ */ n(
698
+ c && /* @__PURE__ */ n(zr, { align: "start", children: s.map((f) => /* @__PURE__ */ n(
699
699
  mt,
700
700
  {
701
701
  onClick: () => i(f.id),
@@ -734,8 +734,8 @@ function Mi({
734
734
  transform: o,
735
735
  transition: u,
736
736
  isDragging: f
737
- } = Ln({ id: e.id }), m = {
738
- transform: qn.Translate.toString(o),
737
+ } = Fn({ id: e.id }), m = {
738
+ transform: Ln.Translate.toString(o),
739
739
  transition: u,
740
740
  zIndex: f ? 10 : void 0,
741
741
  opacity: f ? 0.5 : void 0
@@ -772,8 +772,8 @@ function Mi({
772
772
  );
773
773
  }
774
774
  function Ui() {
775
- const e = Xe(), { tabs: t, activeTabId: r, switchTab: s, closeTab: i, reorderTabs: a } = ht(), l = Pn(
776
- $n(Rn, { activationConstraint: { distance: 5 } })
775
+ const e = Xe(), { tabs: t, activeTabId: r, switchTab: s, closeTab: i, reorderTabs: a } = ht(), l = Dn(
776
+ Pn($n, { activationConstraint: { distance: 5 } })
777
777
  ), c = ee(() => t.map((p) => p.id), [t]), o = z(
778
778
  (p, g, y) => {
779
779
  s(p), e({ pathname: g, search: y || void 0 });
@@ -804,13 +804,13 @@ function Ui() {
804
804
  if (t.length === 0) return null;
805
805
  const m = t.length === 1;
806
806
  return /* @__PURE__ */ n("div", { className: "flex items-center gap-0.5 h-9 px-2 border-t border-[var(--border)] bg-[var(--background)] overflow-x-auto shrink-0", children: /* @__PURE__ */ n(
807
- En,
807
+ Rn,
808
808
  {
809
809
  sensors: l,
810
- collisionDetection: On,
810
+ collisionDetection: En,
811
811
  onDragEnd: f,
812
812
  children: /* @__PURE__ */ n(
813
- Fn,
813
+ On,
814
814
  {
815
815
  items: c,
816
816
  strategy: fi,
@@ -885,7 +885,7 @@ function It(e, t, r, s, i, a) {
885
885
  });
886
886
  }
887
887
  const Vi = 3e4, Ki = 1e3, Wi = 50;
888
- function dn(e, t) {
888
+ function cn(e, t) {
889
889
  if (t.length === 0) return;
890
890
  const r = /* @__PURE__ */ new Map();
891
891
  for (const s of t) {
@@ -910,7 +910,7 @@ function Hi() {
910
910
  const c = () => {
911
911
  if (l = null, a.length === 0) return;
912
912
  const f = a.splice(0, a.length);
913
- dn(t, f);
913
+ cn(t, f);
914
914
  }, o = () => {
915
915
  l === null && (l = setTimeout(c, Wi));
916
916
  };
@@ -923,7 +923,7 @@ function Hi() {
923
923
  if (!s) break;
924
924
  if (i = 0, m.type === "session_refresh") {
925
925
  try {
926
- await Mn();
926
+ await zn();
927
927
  } catch {
928
928
  }
929
929
  break;
@@ -941,12 +941,12 @@ function Hi() {
941
941
  }
942
942
  return u(), () => {
943
943
  var f;
944
- s = !1, (f = r.current) == null || f.abort(), l !== null && (clearTimeout(l), l = null), a.length > 0 && dn(t, a.splice(0, a.length));
944
+ s = !1, (f = r.current) == null || f.abort(), l !== null && (clearTimeout(l), l = null), a.length > 0 && cn(t, a.splice(0, a.length));
945
945
  };
946
946
  }, [e, t]);
947
947
  }
948
948
  function Ji() {
949
- const { isAuthenticated: e, isLoading: t } = ct(), r = Xe(), s = Pr();
949
+ const { isAuthenticated: e, isLoading: t } = ct(), r = Xe(), s = Dr();
950
950
  return Hi(), le(() => {
951
951
  if (!t && !e) {
952
952
  const i = s.pathname + s.search, a = i && i !== "/" ? `?redirect=${encodeURIComponent(i)}` : "";
@@ -974,17 +974,17 @@ const he = ae.forwardRef(({ className: e, type: t, ...r }, s) => /* @__PURE__ */
974
974
  }
975
975
  ));
976
976
  he.displayName = "Input";
977
- const Qi = qr(
977
+ const Qi = Lr(
978
978
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
979
979
  ), Qe = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
980
- jn.Root,
980
+ qn.Root,
981
981
  {
982
982
  ref: r,
983
983
  className: J(Qi(), e),
984
984
  ...t
985
985
  }
986
986
  ));
987
- Qe.displayName = jn.Root.displayName;
987
+ Qe.displayName = qn.Root.displayName;
988
988
  const xt = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
989
989
  "div",
990
990
  {
@@ -1015,7 +1015,7 @@ const Vt = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1015
1015
  }
1016
1016
  ));
1017
1017
  Vt.displayName = "CardTitle";
1018
- const Ir = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1018
+ const Ur = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1019
1019
  "div",
1020
1020
  {
1021
1021
  ref: r,
@@ -1023,7 +1023,7 @@ const Ir = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1023
1023
  ...t
1024
1024
  }
1025
1025
  ));
1026
- Ir.displayName = "CardDescription";
1026
+ Ur.displayName = "CardDescription";
1027
1027
  const Nt = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n("div", { ref: r, className: J("p-6 pt-0", e), ...t }));
1028
1028
  Nt.displayName = "CardContent";
1029
1029
  const Gi = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
@@ -1036,9 +1036,9 @@ const Gi = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1036
1036
  ));
1037
1037
  Gi.displayName = "CardFooter";
1038
1038
  function Yi() {
1039
- const e = Xe(), [t] = yt(), { login: r, isLoginPending: s, isAuthenticated: i } = zr(), [a, l] = V(""), [c, o] = V(""), u = t.get("redirect") || "/", f = u.startsWith("/") && !u.startsWith("//") ? u : "/", m = t.get("sso_error"), { data: p } = Ve({
1039
+ const e = Xe(), [t] = yt(), { login: r, isLoginPending: s, isAuthenticated: i } = jr(), [a, l] = I(""), [c, o] = I(""), u = t.get("redirect") || "/", f = u.startsWith("/") && !u.startsWith("//") ? u : "/", m = t.get("sso_error"), { data: p } = Ve({
1040
1040
  queryKey: ["check-setup"],
1041
- queryFn: Un
1041
+ queryFn: Mn
1042
1042
  }), { data: g } = Ve({
1043
1043
  queryKey: ["sso-providers"],
1044
1044
  queryFn: () => Ri(),
@@ -1059,7 +1059,7 @@ function Yi() {
1059
1059
  /* @__PURE__ */ d(bt, { className: "text-center", children: [
1060
1060
  /* @__PURE__ */ n("div", { className: "mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-[var(--primary)]", children: /* @__PURE__ */ n("span", { className: "text-lg font-bold text-[var(--primary-foreground)]", children: "D" }) }),
1061
1061
  /* @__PURE__ */ n(Vt, { className: "text-2xl", children: "Sign in" }),
1062
- /* @__PURE__ */ n(Ir, { children: "Enter your credentials to continue" })
1062
+ /* @__PURE__ */ n(Ur, { children: "Enter your credentials to continue" })
1063
1063
  ] }),
1064
1064
  /* @__PURE__ */ d(Nt, { children: [
1065
1065
  b && /* @__PURE__ */ d("div", { className: "space-y-2 mb-4", children: [
@@ -1116,15 +1116,15 @@ function Yi() {
1116
1116
  /* @__PURE__ */ d("p", { className: "mt-4 text-center text-sm text-[var(--muted-foreground)]", children: [
1117
1117
  "First time?",
1118
1118
  " ",
1119
- /* @__PURE__ */ n(Sn, { to: "/signup", className: "text-[var(--primary)] hover:underline", children: "Create account" })
1119
+ /* @__PURE__ */ n(_n, { to: "/signup", className: "text-[var(--primary)] hover:underline", children: "Create account" })
1120
1120
  ] })
1121
1121
  ] })
1122
1122
  ] }) });
1123
1123
  }
1124
1124
  function Xi() {
1125
- const e = Xe(), { signup: t, isSignupPending: r, isAuthenticated: s } = zr(), [i, a] = V(""), [l, c] = V(""), [o, u] = V(""), { data: f } = Ve({
1125
+ const e = Xe(), { signup: t, isSignupPending: r, isAuthenticated: s } = jr(), [i, a] = I(""), [l, c] = I(""), [o, u] = I(""), { data: f } = Ve({
1126
1126
  queryKey: ["check-setup"],
1127
- queryFn: Un
1127
+ queryFn: Mn
1128
1128
  });
1129
1129
  le(() => {
1130
1130
  f && !f.needs_setup && e("/login", { replace: !0 });
@@ -1138,7 +1138,7 @@ function Xi() {
1138
1138
  /* @__PURE__ */ d(bt, { className: "text-center", children: [
1139
1139
  /* @__PURE__ */ n("div", { className: "mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-[var(--primary)]", children: /* @__PURE__ */ n("span", { className: "text-lg font-bold text-[var(--primary-foreground)]", children: "D" }) }),
1140
1140
  /* @__PURE__ */ n(Vt, { className: "text-2xl", children: "Create account" }),
1141
- /* @__PURE__ */ n(Ir, { children: "Set up the first admin account" })
1141
+ /* @__PURE__ */ n(Ur, { children: "Set up the first admin account" })
1142
1142
  ] }),
1143
1143
  /* @__PURE__ */ n(Nt, { children: /* @__PURE__ */ d("form", { onSubmit: m, className: "space-y-4", children: [
1144
1144
  /* @__PURE__ */ d("div", { className: "space-y-2", children: [
@@ -1193,7 +1193,7 @@ function Bi() {
1193
1193
  const e = Xe(), [t] = yt(), { setUser: r, setTenants: s } = ct();
1194
1194
  return le(() => {
1195
1195
  const i = t.get("redirect") || "/", a = i.startsWith("/") && !i.startsWith("//") ? i : "/";
1196
- In().then((l) => {
1196
+ Un().then((l) => {
1197
1197
  r(l, l.tenant), Xt().then(s).catch(() => {
1198
1198
  }), e(a, { replace: !0 });
1199
1199
  }).catch(() => {
@@ -1205,7 +1205,7 @@ function Zi() {
1205
1205
  return /* @__PURE__ */ n("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ d("div", { className: "text-center", children: [
1206
1206
  /* @__PURE__ */ n("h1", { className: "text-6xl font-bold text-[var(--muted-foreground)]", children: "404" }),
1207
1207
  /* @__PURE__ */ n("p", { className: "mt-2 text-lg text-[var(--muted-foreground)]", children: "Page not found" }),
1208
- /* @__PURE__ */ n(j, { asChild: !0, variant: "outline", className: "mt-6", children: /* @__PURE__ */ n(Sn, { to: "/", children: "Go home" }) })
1208
+ /* @__PURE__ */ n(j, { asChild: !0, variant: "outline", className: "mt-6", children: /* @__PURE__ */ n(_n, { to: "/", children: "Go home" }) })
1209
1209
  ] }) });
1210
1210
  }
1211
1211
  function Bt({ title: e, backTo: t, actions: r }) {
@@ -1231,7 +1231,7 @@ function Bt({ title: e, backTo: t, actions: r }) {
1231
1231
  r && /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: r })
1232
1232
  ] });
1233
1233
  }
1234
- const ea = qr(
1234
+ const ea = Lr(
1235
1235
  "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-[var(--ring)] focus:ring-offset-2",
1236
1236
  {
1237
1237
  variants: {
@@ -1264,7 +1264,7 @@ function ke({ className: e, variant: t, color: r, style: s, ...i }) {
1264
1264
  );
1265
1265
  }
1266
1266
  function ta() {
1267
- const { data: e } = qe(), [t, r] = V("handlers");
1267
+ const { data: e } = qe(), [t, r] = I("handlers");
1268
1268
  return e ? /* @__PURE__ */ d("div", { className: "flex flex-col h-full", children: [
1269
1269
  /* @__PURE__ */ d("div", { className: "px-6 pt-6", children: [
1270
1270
  /* @__PURE__ */ n(Bt, { title: "Handler & Action Catalog" }),
@@ -1317,7 +1317,7 @@ function ra({ schema: e }) {
1317
1317
  }
1318
1318
  function na({ code: e, handler: t, entity: r }) {
1319
1319
  var l, c;
1320
- const [s, i] = V(!1), a = (l = t.display) != null && l.name ? P(t.display.name) : e;
1320
+ const [s, i] = I(!1), a = (l = t.display) != null && l.name ? P(t.display.name) : e;
1321
1321
  return /* @__PURE__ */ d("div", { className: "border border-[var(--border)] rounded-lg p-4", children: [
1322
1322
  /* @__PURE__ */ d("div", { className: "flex items-center justify-between cursor-pointer", onClick: () => i(!s), children: [
1323
1323
  /* @__PURE__ */ d("div", { className: "flex items-center gap-3", children: [
@@ -1419,7 +1419,7 @@ function oa(e, t) {
1419
1419
  r.searchParams.append("expand", s);
1420
1420
  return t.screen && r.searchParams.set("screen", t.screen), r.pathname + r.search;
1421
1421
  }
1422
- async function Hn(e, t = {}) {
1422
+ async function Wn(e, t = {}) {
1423
1423
  return ue(oa(e, t));
1424
1424
  }
1425
1425
  async function la(e, t) {
@@ -1431,20 +1431,20 @@ async function la(e, t) {
1431
1431
  r.set(s, i);
1432
1432
  return ue(`/api/data/${e}?${r.toString()}`);
1433
1433
  }
1434
- async function Vr(e, t) {
1434
+ async function Ir(e, t) {
1435
1435
  return { data: (await ue(`/api/data/${e}`, {
1436
1436
  method: "POST",
1437
1437
  body: JSON.stringify([t])
1438
1438
  }))[0] };
1439
1439
  }
1440
- async function Kr(e, t, r) {
1440
+ async function Vr(e, t, r) {
1441
1441
  const s = typeof t == "string" ? { id: t } : t;
1442
1442
  return { data: (await ue(`/api/data/${e}`, {
1443
1443
  method: "PATCH",
1444
1444
  body: JSON.stringify([{ ...s, ...r }])
1445
1445
  }))[0] };
1446
1446
  }
1447
- async function Wr(e, t) {
1447
+ async function Kr(e, t) {
1448
1448
  const r = typeof t == "string" ? { id: t } : t;
1449
1449
  await ue(`/api/data/${e}/delete`, {
1450
1450
  method: "POST",
@@ -1470,14 +1470,14 @@ async function da(e, t) {
1470
1470
  body: JSON.stringify(t)
1471
1471
  });
1472
1472
  }
1473
- async function Hr(e, t) {
1473
+ async function Wr(e, t) {
1474
1474
  const r = new URLSearchParams();
1475
1475
  return r.set("ids", t.join(",")), ue(`/api/associations/${e}?${r.toString()}`);
1476
1476
  }
1477
1477
  function Kt(e, t) {
1478
1478
  return Ve({
1479
1479
  queryKey: ["entity-data", e, t],
1480
- queryFn: () => Hn(e, t),
1480
+ queryFn: () => Wn(e, t),
1481
1481
  enabled: !!e,
1482
1482
  placeholderData: (r, s) => {
1483
1483
  var a;
@@ -1488,7 +1488,7 @@ function Kt(e, t) {
1488
1488
  function ua(e) {
1489
1489
  const t = Fe();
1490
1490
  return Ee({
1491
- mutationFn: (r) => Vr(e, r),
1491
+ mutationFn: (r) => Ir(e, r),
1492
1492
  onSuccess: () => {
1493
1493
  t.invalidateQueries({ queryKey: ["entity-data", e] }), ie.success("Record created");
1494
1494
  },
@@ -1497,10 +1497,10 @@ function ua(e) {
1497
1497
  }
1498
1498
  });
1499
1499
  }
1500
- function Jn(e) {
1500
+ function Hn(e) {
1501
1501
  const t = Fe();
1502
1502
  return Ee({
1503
- mutationFn: ({ pkValues: r, data: s }) => Kr(e, r, s),
1503
+ mutationFn: ({ pkValues: r, data: s }) => Vr(e, r, s),
1504
1504
  onSuccess: (r, s) => {
1505
1505
  t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: [Be, e] }), t.invalidateQueries({ queryKey: ["object-status", e] }), t.invalidateQueries({ queryKey: ["object-properties", e] }), ie.success("Record updated");
1506
1506
  },
@@ -1509,10 +1509,10 @@ function Jn(e) {
1509
1509
  }
1510
1510
  });
1511
1511
  }
1512
- function Qn(e) {
1512
+ function Jn(e) {
1513
1513
  const t = Fe();
1514
1514
  return Ee({
1515
- mutationFn: (r) => Wr(e, r),
1515
+ mutationFn: (r) => Kr(e, r),
1516
1516
  onSuccess: (r, s) => {
1517
1517
  t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), ie.success("Record deleted");
1518
1518
  },
@@ -1533,7 +1533,7 @@ function fa(e) {
1533
1533
  }
1534
1534
  });
1535
1535
  }
1536
- function Gn(e) {
1536
+ function Qn(e) {
1537
1537
  const t = Fe();
1538
1538
  return Ee({
1539
1539
  mutationFn: async ({ actionCode: r, body: s }) => {
@@ -1550,15 +1550,15 @@ function Gn(e) {
1550
1550
  }
1551
1551
  });
1552
1552
  }
1553
- function Yn(e, t) {
1554
- const [r, s] = V(e);
1553
+ function Gn(e, t) {
1554
+ const [r, s] = I(e);
1555
1555
  return le(() => {
1556
1556
  const i = setTimeout(() => s(e), t);
1557
1557
  return () => clearTimeout(i);
1558
1558
  }, [e, t]), r;
1559
1559
  }
1560
- function Jr({ value: e, title: t, className: r, size: s = "icon" }) {
1561
- const [i, a] = V(!1), l = z(async (u) => {
1560
+ function Hr({ value: e, title: t, className: r, size: s = "icon" }) {
1561
+ const [i, a] = I(!1), l = z(async (u) => {
1562
1562
  u.stopPropagation(), u.preventDefault();
1563
1563
  try {
1564
1564
  await navigator.clipboard.writeText(e), a(!0), setTimeout(() => a(!1), 2e3);
@@ -1583,7 +1583,7 @@ function qt({ field: e, value: t, mode: r, onChange: s }) {
1583
1583
  const i = String(t ?? "");
1584
1584
  return e.copyable && i ? /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1", children: [
1585
1585
  /* @__PURE__ */ n("span", { className: "text-sm", children: i }),
1586
- /* @__PURE__ */ n(Jr, { value: i, size: "sm" })
1586
+ /* @__PURE__ */ n(Hr, { value: i, size: "sm" })
1587
1587
  ] }) : /* @__PURE__ */ n("span", { className: "text-sm", children: i });
1588
1588
  }
1589
1589
  return /* @__PURE__ */ n(
@@ -1594,7 +1594,7 @@ function qt({ field: e, value: t, mode: r, onChange: s }) {
1594
1594
  }
1595
1595
  );
1596
1596
  }
1597
- const Qr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1597
+ const Jr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1598
1598
  "textarea",
1599
1599
  {
1600
1600
  className: J(
@@ -1605,7 +1605,7 @@ const Qr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1605
1605
  ...t
1606
1606
  }
1607
1607
  ));
1608
- Qr.displayName = "Textarea";
1608
+ Jr.displayName = "Textarea";
1609
1609
  const ma = [yi];
1610
1610
  function pa({ field: e, value: t, mode: r, onChange: s }) {
1611
1611
  var l;
@@ -1616,12 +1616,12 @@ function pa({ field: e, value: t, mode: r, onChange: s }) {
1616
1616
  const o = i === "markdown" ? /* @__PURE__ */ n("div", { className: "prose prose-sm dark:prose-invert max-w-none break-words overflow-hidden", children: /* @__PURE__ */ n(vi, { skipHtml: !0, remarkPlugins: ma, children: c }) }) : i === "code" ? /* @__PURE__ */ n("pre", { className: "text-sm font-mono bg-[var(--muted)] text-[var(--foreground)] rounded-md border border-[var(--border)] p-4 overflow-x-auto max-h-[600px] overflow-y-auto whitespace-pre", children: c }) : /* @__PURE__ */ n("p", { className: "text-sm whitespace-pre-wrap break-words", children: c });
1617
1617
  return e.copyable ? /* @__PURE__ */ d("div", { className: "group relative", children: [
1618
1618
  o,
1619
- /* @__PURE__ */ n("div", { className: "absolute top-0 right-0 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ n(Jr, { value: c, size: "sm" }) })
1619
+ /* @__PURE__ */ n("div", { className: "absolute top-0 right-0 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ n(Hr, { value: c, size: "sm" }) })
1620
1620
  ] }) : o;
1621
1621
  }
1622
1622
  const a = i === "markdown" || i === "code" ? 10 : 4;
1623
1623
  return /* @__PURE__ */ n(
1624
- Qr,
1624
+ Jr,
1625
1625
  {
1626
1626
  value: String(t ?? ""),
1627
1627
  onChange: (c) => s == null ? void 0 : s(c.target.value),
@@ -1646,7 +1646,7 @@ const gt = ve.Root, vt = ve.Value, at = ae.forwardRef(({ className: e, children:
1646
1646
  }
1647
1647
  ));
1648
1648
  at.displayName = ve.Trigger.displayName;
1649
- const Xn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1649
+ const Yn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1650
1650
  ve.ScrollUpButton,
1651
1651
  {
1652
1652
  ref: r,
@@ -1658,8 +1658,8 @@ const Xn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1658
1658
  children: /* @__PURE__ */ n(Gs, { className: "h-4 w-4" })
1659
1659
  }
1660
1660
  ));
1661
- Xn.displayName = ve.ScrollUpButton.displayName;
1662
- const Bn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1661
+ Yn.displayName = ve.ScrollUpButton.displayName;
1662
+ const Xn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1663
1663
  ve.ScrollDownButton,
1664
1664
  {
1665
1665
  ref: r,
@@ -1671,7 +1671,7 @@ const Bn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
1671
1671
  children: /* @__PURE__ */ n(Mt, { className: "h-4 w-4" })
1672
1672
  }
1673
1673
  ));
1674
- Bn.displayName = ve.ScrollDownButton.displayName;
1674
+ Xn.displayName = ve.ScrollDownButton.displayName;
1675
1675
  const ot = ae.forwardRef(({ className: e, children: t, position: r = "popper", ...s }, i) => /* @__PURE__ */ n(ve.Portal, { children: /* @__PURE__ */ d(
1676
1676
  ve.Content,
1677
1677
  {
@@ -1684,7 +1684,7 @@ const ot = ae.forwardRef(({ className: e, children: t, position: r = "popper", .
1684
1684
  position: r,
1685
1685
  ...s,
1686
1686
  children: [
1687
- /* @__PURE__ */ n(Xn, {}),
1687
+ /* @__PURE__ */ n(Yn, {}),
1688
1688
  /* @__PURE__ */ n(
1689
1689
  ve.Viewport,
1690
1690
  {
@@ -1695,7 +1695,7 @@ const ot = ae.forwardRef(({ className: e, children: t, position: r = "popper", .
1695
1695
  children: t
1696
1696
  }
1697
1697
  ),
1698
- /* @__PURE__ */ n(Bn, {})
1698
+ /* @__PURE__ */ n(Xn, {})
1699
1699
  ]
1700
1700
  }
1701
1701
  ) }));
@@ -1814,7 +1814,7 @@ function Ca(e) {
1814
1814
  }
1815
1815
  function Ta({ field: e, value: t, mode: r, onChange: s }) {
1816
1816
  var c;
1817
- const i = String(t ?? ""), [a, l] = V(null);
1817
+ const i = String(t ?? ""), [a, l] = I(null);
1818
1818
  if (r === "display") {
1819
1819
  if (!i) return /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)]", children: "-" });
1820
1820
  const u = ((c = e.display) == null ? void 0 : c.widget) === "link", f = Sa(i);
@@ -2043,7 +2043,7 @@ function pr({ field: e, fieldName: t, value: r, mode: s, onChange: i, record: a
2043
2043
  }
2044
2044
  );
2045
2045
  }
2046
- function Zn(e) {
2046
+ function Bn(e) {
2047
2047
  const { data: t } = qe();
2048
2048
  if (!(!t || !e))
2049
2049
  return t.entities[e];
@@ -2064,7 +2064,7 @@ function Oa({
2064
2064
  refs: i
2065
2065
  }) {
2066
2066
  var b, w, x, N, h;
2067
- const a = (b = e.ref) == null ? void 0 : b.entity, l = Zn(a), c = ((w = e.display) == null ? void 0 : w.ref_display_field) ?? ((N = (x = e.ref) == null ? void 0 : x.display) == null ? void 0 : N.field) ?? ((h = l == null ? void 0 : l.display) == null ? void 0 : h.display_field), o = ee(
2067
+ const a = (b = e.ref) == null ? void 0 : b.entity, l = Bn(a), c = ((w = e.display) == null ? void 0 : w.ref_display_field) ?? ((N = (x = e.ref) == null ? void 0 : x.display) == null ? void 0 : N.field) ?? ((h = l == null ? void 0 : l.display) == null ? void 0 : h.display_field), o = ee(
2068
2068
  () => {
2069
2069
  var v;
2070
2070
  return l ? ((v = Object.entries(l.fields).find(([, k]) => k.primary)) == null ? void 0 : v[0]) ?? "id" : "id";
@@ -2112,14 +2112,14 @@ function Oa({
2112
2112
  }
2113
2113
  );
2114
2114
  }
2115
- const un = _n(
2115
+ const dn = wn(
2116
2116
  () => import("./JsonEditor-C5NOzsey.js").then((e) => ({ default: e.JsonEditor }))
2117
2117
  );
2118
- function fn() {
2118
+ function un() {
2119
2119
  return /* @__PURE__ */ n("div", { className: "h-20 rounded-md border border-[var(--border)] bg-[var(--muted)] animate-pulse" });
2120
2120
  }
2121
- function es({ value: e, mode: t, onChange: r }) {
2122
- return t === "display" ? e == null || typeof e == "string" && !e ? /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)]", children: "-" }) : /* @__PURE__ */ n(wr, { fallback: /* @__PURE__ */ n(fn, {}), children: /* @__PURE__ */ n(un, { value: e, readOnly: !0 }) }) : /* @__PURE__ */ n(wr, { fallback: /* @__PURE__ */ n(fn, {}), children: /* @__PURE__ */ n(un, { value: e, onChange: r }) });
2121
+ function Zn({ value: e, mode: t, onChange: r }) {
2122
+ return t === "display" ? e == null || typeof e == "string" && !e ? /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)]", children: "-" }) : /* @__PURE__ */ n(wr, { fallback: /* @__PURE__ */ n(un, {}), children: /* @__PURE__ */ n(dn, { value: e, readOnly: !0 }) }) : /* @__PURE__ */ n(wr, { fallback: /* @__PURE__ */ n(un, {}), children: /* @__PURE__ */ n(dn, { value: e, onChange: r }) });
2123
2123
  }
2124
2124
  function Fa(e) {
2125
2125
  return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
@@ -2176,7 +2176,7 @@ function ja({
2176
2176
  return /* @__PURE__ */ n("div", { className: "space-y-3", children: i.map((o) => /* @__PURE__ */ d("div", { className: "space-y-1", children: [
2177
2177
  /* @__PURE__ */ n(Qe, { className: "text-xs text-[var(--muted-foreground)] uppercase", children: o.code }),
2178
2178
  /* @__PURE__ */ n(
2179
- Qr,
2179
+ Jr,
2180
2180
  {
2181
2181
  value: a[o.code] ?? "",
2182
2182
  onChange: (u) => l(o.code, u.target.value),
@@ -2206,7 +2206,7 @@ function Zt(e) {
2206
2206
  mode: s,
2207
2207
  onChange: i
2208
2208
  }
2209
- ) : /* @__PURE__ */ n(es, { ...e });
2209
+ ) : /* @__PURE__ */ n(Zn, { ...e });
2210
2210
  }
2211
2211
  function Sr({
2212
2212
  structDef: e,
@@ -2335,7 +2335,7 @@ function za({
2335
2335
  }
2336
2336
  const gr = "[SET]";
2337
2337
  function Ma({ value: e, mode: t, onChange: r, record: s }) {
2338
- const [i, a] = V(!1), [l, c] = V(""), o = s !== void 0, u = e === gr || typeof e == "string" && e !== "";
2338
+ const [i, a] = I(!1), [l, c] = I(""), o = s !== void 0, u = e === gr || typeof e == "string" && e !== "";
2339
2339
  if (t === "display")
2340
2340
  return u ? /* @__PURE__ */ n("span", { className: "text-sm font-mono text-[var(--muted-foreground)]", children: gr }) : /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)] italic", children: "Not set" });
2341
2341
  const f = (m) => {
@@ -2362,14 +2362,14 @@ function Ma({ value: e, mode: t, onChange: r, record: s }) {
2362
2362
  className: "h-8 w-8 shrink-0",
2363
2363
  onClick: () => a((m) => !m),
2364
2364
  title: i ? "Hide value" : "Show typed value",
2365
- children: i ? /* @__PURE__ */ n(Rr, { className: "h-4 w-4" }) : /* @__PURE__ */ n(Er, { className: "h-4 w-4" })
2365
+ children: i ? /* @__PURE__ */ n($r, { className: "h-4 w-4" }) : /* @__PURE__ */ n(Rr, { className: "h-4 w-4" })
2366
2366
  }
2367
2367
  )
2368
2368
  ] });
2369
2369
  }
2370
2370
  const vr = "[SET]";
2371
2371
  function Ua({ value: e, mode: t, onChange: r, record: s }) {
2372
- const [i, a] = V(""), [l, c] = V(!1), o = s !== void 0, u = e === vr || typeof e == "string" && e !== "";
2372
+ const [i, a] = I(""), [l, c] = I(!1), o = s !== void 0, u = e === vr || typeof e == "string" && e !== "";
2373
2373
  if (t === "display")
2374
2374
  return u ? /* @__PURE__ */ n("span", { className: "text-sm font-mono text-[var(--muted-foreground)]", children: vr }) : /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)] italic", children: "Not set" });
2375
2375
  const f = (m) => {
@@ -2395,7 +2395,7 @@ function Ua({ value: e, mode: t, onChange: r, record: s }) {
2395
2395
  "aria-label": l ? "Hide password" : "Show password",
2396
2396
  tabIndex: -1,
2397
2397
  className: "absolute inset-y-0 right-0 flex items-center pr-2 text-[var(--muted-foreground)] hover:text-[var(--foreground)]",
2398
- children: l ? /* @__PURE__ */ n(Rr, { className: "w-4 h-4" }) : /* @__PURE__ */ n(Er, { className: "w-4 h-4" })
2398
+ children: l ? /* @__PURE__ */ n($r, { className: "w-4 h-4" }) : /* @__PURE__ */ n(Rr, { className: "w-4 h-4" })
2399
2399
  }
2400
2400
  )
2401
2401
  ] });
@@ -2404,7 +2404,7 @@ function Ia(e) {
2404
2404
  return Array.isArray(e) ? e.filter((t) => t != null).map(String) : [];
2405
2405
  }
2406
2406
  function Va({ value: e, mode: t, onChange: r }) {
2407
- const s = Ia(e), [i, a] = V("");
2407
+ const s = Ia(e), [i, a] = I("");
2408
2408
  if (t === "display")
2409
2409
  return s.length === 0 ? /* @__PURE__ */ n("span", { className: "text-sm text-muted-foreground", children: "-" }) : /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-1", children: s.map((u, f) => /* @__PURE__ */ n(
2410
2410
  "span",
@@ -2461,7 +2461,7 @@ function Ka(e) {
2461
2461
  return Array.isArray(e) ? e.filter((t) => t != null).map(Number).filter((t) => !isNaN(t)) : [];
2462
2462
  }
2463
2463
  function Wa({ value: e, mode: t, onChange: r }) {
2464
- const s = Ka(e), [i, a] = V("");
2464
+ const s = Ka(e), [i, a] = I("");
2465
2465
  if (t === "display")
2466
2466
  return s.length === 0 ? /* @__PURE__ */ n("span", { className: "text-sm text-muted-foreground", children: "-" }) : /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-1", children: s.map((u, f) => /* @__PURE__ */ n(
2467
2467
  "span",
@@ -2533,7 +2533,7 @@ const yr = {
2533
2533
  decimal: pr,
2534
2534
  uuid: qt,
2535
2535
  ref: Oa,
2536
- json: es,
2536
+ json: Zn,
2537
2537
  tags: qt,
2538
2538
  string_array: Va,
2539
2539
  int_array: Wa,
@@ -2555,7 +2555,7 @@ function oe(e) {
2555
2555
  const r = yr[e.field.type] ?? qt;
2556
2556
  return /* @__PURE__ */ n(r, { ...e });
2557
2557
  }
2558
- function mn({ icon: e, title: t, description: r, action: s }) {
2558
+ function fn({ icon: e, title: t, description: r, action: s }) {
2559
2559
  return /* @__PURE__ */ d("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
2560
2560
  e && /* @__PURE__ */ n("div", { className: "mb-4 rounded-full bg-[var(--muted)] p-4", children: /* @__PURE__ */ n(Ge, { name: e, className: "w-8 h-8 text-[var(--muted-foreground)]" }) }),
2561
2561
  /* @__PURE__ */ n("h3", { className: "text-lg font-medium text-[var(--foreground)]", children: t }),
@@ -2584,7 +2584,7 @@ function Ha({ rows: e = 8, cols: t = 4 }) {
2584
2584
  Array.from({ length: e }).map((r, s) => /* @__PURE__ */ n("div", { className: "flex gap-4", children: Array.from({ length: t }).map((i, a) => /* @__PURE__ */ n(_e, { className: "h-8 flex-1" }, a)) }, s))
2585
2585
  ] });
2586
2586
  }
2587
- function ts() {
2587
+ function es() {
2588
2588
  return /* @__PURE__ */ d("div", { className: "space-y-6 p-6", children: [
2589
2589
  /* @__PURE__ */ n(_e, { className: "h-8 w-48" }),
2590
2590
  /* @__PURE__ */ n("div", { className: "space-y-4", children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ d("div", { className: "space-y-2", children: [
@@ -2593,7 +2593,7 @@ function ts() {
2593
2593
  ] }, t)) })
2594
2594
  ] });
2595
2595
  }
2596
- const rs = Le.Root, Ja = Le.Portal, ns = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2596
+ const ts = Le.Root, Ja = Le.Portal, rs = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2597
2597
  Le.Overlay,
2598
2598
  {
2599
2599
  className: J(
@@ -2604,9 +2604,9 @@ const rs = Le.Root, Ja = Le.Portal, ns = ae.forwardRef(({ className: e, ...t },
2604
2604
  ref: r
2605
2605
  }
2606
2606
  ));
2607
- ns.displayName = Le.Overlay.displayName;
2608
- const Gr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ d(Ja, { children: [
2609
- /* @__PURE__ */ n(ns, {}),
2607
+ rs.displayName = Le.Overlay.displayName;
2608
+ const Qr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ d(Ja, { children: [
2609
+ /* @__PURE__ */ n(rs, {}),
2610
2610
  /* @__PURE__ */ n(
2611
2611
  Le.Content,
2612
2612
  {
@@ -2619,8 +2619,8 @@ const Gr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ d(Ja, {
2619
2619
  }
2620
2620
  )
2621
2621
  ] }));
2622
- Gr.displayName = Le.Content.displayName;
2623
- function ss({
2622
+ Qr.displayName = Le.Content.displayName;
2623
+ function ns({
2624
2624
  className: e,
2625
2625
  ...t
2626
2626
  }) {
@@ -2635,7 +2635,7 @@ function ss({
2635
2635
  }
2636
2636
  );
2637
2637
  }
2638
- function is({
2638
+ function ss({
2639
2639
  className: e,
2640
2640
  ...t
2641
2641
  }) {
@@ -2650,7 +2650,7 @@ function is({
2650
2650
  }
2651
2651
  );
2652
2652
  }
2653
- const Yr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2653
+ const Gr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2654
2654
  Le.Title,
2655
2655
  {
2656
2656
  ref: r,
@@ -2658,8 +2658,8 @@ const Yr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2658
2658
  ...t
2659
2659
  }
2660
2660
  ));
2661
- Yr.displayName = Le.Title.displayName;
2662
- const Xr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2661
+ Gr.displayName = Le.Title.displayName;
2662
+ const Yr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2663
2663
  Le.Description,
2664
2664
  {
2665
2665
  ref: r,
@@ -2667,30 +2667,30 @@ const Xr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2667
2667
  ...t
2668
2668
  }
2669
2669
  ));
2670
- Xr.displayName = Le.Description.displayName;
2671
- const Br = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2670
+ Yr.displayName = Le.Description.displayName;
2671
+ const Xr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2672
2672
  Le.Action,
2673
2673
  {
2674
2674
  ref: r,
2675
- className: J(Ur(), e),
2675
+ className: J(Mr(), e),
2676
2676
  ...t
2677
2677
  }
2678
2678
  ));
2679
- Br.displayName = Le.Action.displayName;
2680
- const Zr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2679
+ Xr.displayName = Le.Action.displayName;
2680
+ const Br = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2681
2681
  Le.Cancel,
2682
2682
  {
2683
2683
  ref: r,
2684
2684
  className: J(
2685
- Ur({ variant: "outline" }),
2685
+ Mr({ variant: "outline" }),
2686
2686
  "mt-2 sm:mt-0",
2687
2687
  e
2688
2688
  ),
2689
2689
  ...t
2690
2690
  }
2691
2691
  ));
2692
- Zr.displayName = Le.Cancel.displayName;
2693
- function en({
2692
+ Br.displayName = Le.Cancel.displayName;
2693
+ function Zr({
2694
2694
  open: e,
2695
2695
  onOpenChange: t,
2696
2696
  title: r,
@@ -2699,15 +2699,15 @@ function en({
2699
2699
  onConfirm: a,
2700
2700
  destructive: l = !1
2701
2701
  }) {
2702
- return /* @__PURE__ */ n(rs, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Gr, { children: [
2703
- /* @__PURE__ */ d(ss, { children: [
2704
- /* @__PURE__ */ n(Yr, { children: r }),
2705
- /* @__PURE__ */ n(Xr, { children: s })
2702
+ return /* @__PURE__ */ n(ts, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Qr, { children: [
2703
+ /* @__PURE__ */ d(ns, { children: [
2704
+ /* @__PURE__ */ n(Gr, { children: r }),
2705
+ /* @__PURE__ */ n(Yr, { children: s })
2706
2706
  ] }),
2707
- /* @__PURE__ */ d(is, { children: [
2708
- /* @__PURE__ */ n(Zr, { children: "Cancel" }),
2707
+ /* @__PURE__ */ d(ss, { children: [
2708
+ /* @__PURE__ */ n(Br, { children: "Cancel" }),
2709
2709
  /* @__PURE__ */ n(
2710
- Br,
2710
+ Xr,
2711
2711
  {
2712
2712
  onClick: a,
2713
2713
  className: l ? "bg-[var(--destructive)] text-[var(--destructive-foreground)] hover:bg-[var(--destructive)]/90" : "",
@@ -2717,7 +2717,7 @@ function en({
2717
2717
  ] })
2718
2718
  ] }) });
2719
2719
  }
2720
- const as = Ke.Root, Qa = Ke.Portal, os = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2720
+ const is = Ke.Root, Qa = Ke.Portal, as = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2721
2721
  Ke.Overlay,
2722
2722
  {
2723
2723
  ref: r,
@@ -2728,9 +2728,9 @@ const as = Ke.Root, Qa = Ke.Portal, os = ae.forwardRef(({ className: e, ...t },
2728
2728
  ...t
2729
2729
  }
2730
2730
  ));
2731
- os.displayName = Ke.Overlay.displayName;
2732
- const tn = ae.forwardRef(({ className: e, children: t, ...r }, s) => /* @__PURE__ */ d(Qa, { children: [
2733
- /* @__PURE__ */ n(os, {}),
2731
+ as.displayName = Ke.Overlay.displayName;
2732
+ const en = ae.forwardRef(({ className: e, children: t, ...r }, s) => /* @__PURE__ */ d(Qa, { children: [
2733
+ /* @__PURE__ */ n(as, {}),
2734
2734
  /* @__PURE__ */ d(
2735
2735
  Ke.Content,
2736
2736
  {
@@ -2750,8 +2750,8 @@ const tn = ae.forwardRef(({ className: e, children: t, ...r }, s) => /* @__PURE_
2750
2750
  }
2751
2751
  )
2752
2752
  ] }));
2753
- tn.displayName = Ke.Content.displayName;
2754
- function ls({
2753
+ en.displayName = Ke.Content.displayName;
2754
+ function os({
2755
2755
  className: e,
2756
2756
  ...t
2757
2757
  }) {
@@ -2766,7 +2766,7 @@ function ls({
2766
2766
  }
2767
2767
  );
2768
2768
  }
2769
- function cs({
2769
+ function ls({
2770
2770
  className: e,
2771
2771
  ...t
2772
2772
  }) {
@@ -2781,7 +2781,7 @@ function cs({
2781
2781
  }
2782
2782
  );
2783
2783
  }
2784
- const rn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2784
+ const tn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2785
2785
  Ke.Title,
2786
2786
  {
2787
2787
  ref: r,
@@ -2792,8 +2792,8 @@ const rn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2792
2792
  ...t
2793
2793
  }
2794
2794
  ));
2795
- rn.displayName = Ke.Title.displayName;
2796
- const nn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2795
+ tn.displayName = Ke.Title.displayName;
2796
+ const rn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2797
2797
  Ke.Description,
2798
2798
  {
2799
2799
  ref: r,
@@ -2801,7 +2801,7 @@ const nn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
2801
2801
  ...t
2802
2802
  }
2803
2803
  ));
2804
- nn.displayName = Ke.Description.displayName;
2804
+ rn.displayName = Ke.Description.displayName;
2805
2805
  const Ga = /^\$row\.([a-zA-Z_][a-zA-Z0-9_]*)$/;
2806
2806
  function Ya(e, t) {
2807
2807
  if (typeof e != "string")
@@ -2827,7 +2827,7 @@ function Xa(e) {
2827
2827
  ref: e.ref ? { entity: e.ref } : void 0
2828
2828
  };
2829
2829
  }
2830
- function ds({
2830
+ function cs({
2831
2831
  open: e,
2832
2832
  onOpenChange: t,
2833
2833
  action: r,
@@ -2844,7 +2844,7 @@ function ds({
2844
2844
  for (const [w, x] of o)
2845
2845
  b[w] = Ya(x.default, l);
2846
2846
  return b;
2847
- }, [o, l]), [f, m] = V(
2847
+ }, [o, l]), [f, m] = I(
2848
2848
  u
2849
2849
  ), p = z(
2850
2850
  (b) => {
@@ -2862,10 +2862,10 @@ function ds({
2862
2862
  }
2863
2863
  i(f);
2864
2864
  }, [f, o, i]);
2865
- return /* @__PURE__ */ n(as, { open: e, onOpenChange: p, children: /* @__PURE__ */ d(tn, { className: "max-w-lg", children: [
2866
- /* @__PURE__ */ d(ls, { children: [
2867
- /* @__PURE__ */ n(rn, { children: s }),
2868
- /* @__PURE__ */ n(nn, { children: "Fill in the parameters below to execute this action." })
2865
+ return /* @__PURE__ */ n(is, { open: e, onOpenChange: p, children: /* @__PURE__ */ d(en, { className: "max-w-lg", children: [
2866
+ /* @__PURE__ */ d(os, { children: [
2867
+ /* @__PURE__ */ n(tn, { children: s }),
2868
+ /* @__PURE__ */ n(rn, { children: "Fill in the parameters below to execute this action." })
2869
2869
  ] }),
2870
2870
  /* @__PURE__ */ n("div", { className: "space-y-4 py-2", children: o.map(([b, w]) => {
2871
2871
  var h, v;
@@ -2885,13 +2885,13 @@ function ds({
2885
2885
  ((v = w.display) == null ? void 0 : v.description) && /* @__PURE__ */ n("p", { className: "text-xs text-[var(--muted-foreground)]", children: P(w.display.description) })
2886
2886
  ] }, b);
2887
2887
  }) }),
2888
- /* @__PURE__ */ d(cs, { children: [
2888
+ /* @__PURE__ */ d(ls, { children: [
2889
2889
  /* @__PURE__ */ n(j, { variant: "outline", onClick: () => t(!1), disabled: a, children: "Cancel" }),
2890
2890
  /* @__PURE__ */ n(j, { onClick: y, disabled: a, children: a ? "Executing..." : "Execute" })
2891
2891
  ] })
2892
2892
  ] }) });
2893
2893
  }
2894
- function us({
2894
+ function ds({
2895
2895
  open: e,
2896
2896
  onOpenChange: t,
2897
2897
  actionName: r,
@@ -2899,27 +2899,27 @@ function us({
2899
2899
  onConfirm: i,
2900
2900
  isPending: a
2901
2901
  }) {
2902
- return /* @__PURE__ */ n(rs, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Gr, { children: [
2903
- /* @__PURE__ */ d(ss, { children: [
2904
- /* @__PURE__ */ n(Yr, { children: r }),
2905
- /* @__PURE__ */ n(Xr, { children: s })
2902
+ return /* @__PURE__ */ n(ts, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Qr, { children: [
2903
+ /* @__PURE__ */ d(ns, { children: [
2904
+ /* @__PURE__ */ n(Gr, { children: r }),
2905
+ /* @__PURE__ */ n(Yr, { children: s })
2906
2906
  ] }),
2907
- /* @__PURE__ */ d(is, { children: [
2908
- /* @__PURE__ */ n(Zr, { disabled: a, children: "Cancel" }),
2909
- /* @__PURE__ */ n(Br, { onClick: i, disabled: a, children: a ? "Executing..." : "Confirm" })
2907
+ /* @__PURE__ */ d(ss, { children: [
2908
+ /* @__PURE__ */ n(Br, { disabled: a, children: "Cancel" }),
2909
+ /* @__PURE__ */ n(Xr, { onClick: i, disabled: a, children: a ? "Executing..." : "Confirm" })
2910
2910
  ] })
2911
2911
  ] }) });
2912
2912
  }
2913
2913
  function Ba({ open: e, onClose: t, display: r }) {
2914
- return /* @__PURE__ */ n(as, { open: e, onOpenChange: (s) => {
2914
+ return /* @__PURE__ */ n(is, { open: e, onOpenChange: (s) => {
2915
2915
  s || t();
2916
- }, children: /* @__PURE__ */ d(tn, { className: "max-w-lg", onInteractOutside: (s) => s.preventDefault(), onEscapeKeyDown: (s) => s.preventDefault(), children: [
2917
- /* @__PURE__ */ d(ls, { children: [
2918
- /* @__PURE__ */ n(rn, { children: r.title ?? "Action Result" }),
2919
- r.message && /* @__PURE__ */ n(nn, { children: r.message })
2916
+ }, children: /* @__PURE__ */ d(en, { className: "max-w-lg", onInteractOutside: (s) => s.preventDefault(), onEscapeKeyDown: (s) => s.preventDefault(), children: [
2917
+ /* @__PURE__ */ d(os, { children: [
2918
+ /* @__PURE__ */ n(tn, { children: r.title ?? "Action Result" }),
2919
+ r.message && /* @__PURE__ */ n(rn, { children: r.message })
2920
2920
  ] }),
2921
2921
  r.fields && r.fields.length > 0 && /* @__PURE__ */ n("div", { className: "space-y-3 py-2", children: r.fields.map((s, i) => /* @__PURE__ */ n(Za, { field: s }, i)) }),
2922
- /* @__PURE__ */ n(cs, { children: /* @__PURE__ */ n(j, { onClick: t, children: "Close" }) })
2922
+ /* @__PURE__ */ n(ls, { children: /* @__PURE__ */ n(j, { onClick: t, children: "Close" }) })
2923
2923
  ] }) });
2924
2924
  }
2925
2925
  function Za({ field: e }) {
@@ -2933,7 +2933,7 @@ function Za({ field: e }) {
2933
2933
  children: e.value
2934
2934
  }
2935
2935
  ),
2936
- e.copyable && /* @__PURE__ */ n(Jr, { value: e.value })
2936
+ e.copyable && /* @__PURE__ */ n(Hr, { value: e.value })
2937
2937
  ] })
2938
2938
  ] });
2939
2939
  }
@@ -2954,14 +2954,14 @@ function eo(e, t) {
2954
2954
  if (typeof e.value == "boolean" && s === "eq")
2955
2955
  return to(r) === e.value;
2956
2956
  if (typeof r == "number" && typeof e.value == "number")
2957
- return pn(r, e.value, s);
2957
+ return mn(r, e.value, s);
2958
2958
  const i = r == null ? "" : String(r), a = e.value == null ? "" : String(e.value);
2959
- return pn(i, a, s);
2959
+ return mn(i, a, s);
2960
2960
  }
2961
2961
  function to(e) {
2962
2962
  return e == null ? !1 : typeof e == "boolean" ? e : typeof e == "string" ? e !== "" : typeof e == "number" ? e !== 0 : !0;
2963
2963
  }
2964
- function pn(e, t, r) {
2964
+ function mn(e, t, r) {
2965
2965
  switch (r) {
2966
2966
  case "eq":
2967
2967
  return e === t;
@@ -2979,17 +2979,17 @@ function pn(e, t, r) {
2979
2979
  return !1;
2980
2980
  }
2981
2981
  }
2982
- function kr(e, t) {
2982
+ function us(e, t) {
2983
2983
  return e ? Object.entries(e).filter(([, r]) => {
2984
2984
  var s;
2985
2985
  return (s = r.visibility) == null ? void 0 : s.includes(t);
2986
2986
  }).map(([r, s]) => ({ code: r, action: s })) : [];
2987
2987
  }
2988
- function Cr(e, t, r, s) {
2988
+ function kr(e, t, r, s) {
2989
2989
  return !e && !s ? [] : t !== void 0 ? t.map((i) => {
2990
2990
  const a = (e == null ? void 0 : e[i]) ?? (s == null ? void 0 : s[i]);
2991
2991
  return a ? { code: i, action: a } : null;
2992
- }).filter((i) => i !== null) : kr(e, r);
2992
+ }).filter((i) => i !== null) : us(e, r);
2993
2993
  }
2994
2994
  function fs(e) {
2995
2995
  const t = e.resolved_params;
@@ -3017,7 +3017,7 @@ function ro(e, t) {
3017
3017
  Gt.get(e) === t && Gt.delete(e);
3018
3018
  };
3019
3019
  }
3020
- function Tr(e) {
3020
+ function Cr(e) {
3021
3021
  return Gt.get(e);
3022
3022
  }
3023
3023
  function xr(e, t) {
@@ -3035,7 +3035,7 @@ function no(e, t) {
3035
3035
  if (a && typeof a == "object") return a[l];
3036
3036
  }, t.row) : void 0;
3037
3037
  if (s === "field" && i.length >= 2) {
3038
- const [a, l] = i, c = Tr(a);
3038
+ const [a, l] = i, c = Cr(a);
3039
3039
  return c == null ? void 0 : c.getField(l);
3040
3040
  }
3041
3041
  }
@@ -3056,13 +3056,13 @@ async function io(e, t) {
3056
3056
  return;
3057
3057
  }
3058
3058
  if (e.set_field) {
3059
- const { target: r, value: s } = e.set_field, { region: i, field: a } = hn(r), l = Tr(i);
3059
+ const { target: r, value: s } = e.set_field, { region: i, field: a } = pn(r), l = Cr(i);
3060
3060
  if (!l) throw new Error(`region "${i}" not registered`);
3061
3061
  l.setField(a, xr(s, t));
3062
3062
  return;
3063
3063
  }
3064
3064
  if (e.focus_field) {
3065
- const { region: r, field: s } = hn(e.focus_field), i = Tr(r);
3065
+ const { region: r, field: s } = pn(e.focus_field), i = Cr(r);
3066
3066
  if (!i) throw new Error(`region "${r}" not registered`);
3067
3067
  i.focusField(s);
3068
3068
  return;
@@ -3073,7 +3073,7 @@ async function io(e, t) {
3073
3073
  return;
3074
3074
  }
3075
3075
  }
3076
- function hn(e) {
3076
+ function pn(e) {
3077
3077
  const t = e.indexOf(".");
3078
3078
  if (t <= 0) throw new Error(`invalid path "${e}" (expected "region.field")`);
3079
3079
  return { region: e.slice(0, t), field: e.slice(t + 1) };
@@ -3081,7 +3081,7 @@ function hn(e) {
3081
3081
  function ao(e) {
3082
3082
  return !e.handler && !!e.ui_steps && e.ui_steps.length > 0;
3083
3083
  }
3084
- function sn({
3084
+ function nn({
3085
3085
  actionCode: e,
3086
3086
  action: t,
3087
3087
  entityCode: r,
@@ -3094,13 +3094,13 @@ function sn({
3094
3094
  onBatchError: u,
3095
3095
  onBatchPartial: f
3096
3096
  }) {
3097
- var K, Q;
3098
- const [m, p] = V(!1), [g, y] = V(!1), [b, w] = V(!1), [x, N] = V(null), h = Gn(r), { data: v } = qe(), k = Ut(), A = ms(t), _ = fs(t), T = !!t.confirmation && Object.keys(t.confirmation).length > 0, $ = i ? pt(t.conditions, i) : !0, F = t.scope === "batch" && s.length === 0, M = t.scope === "single" && s.length !== 1, q = z(async () => {
3097
+ var V, Q;
3098
+ const [m, p] = I(!1), [g, y] = I(!1), [b, w] = I(!1), [x, N] = I(null), h = Qn(r), { data: v } = qe(), k = Ut(), A = ms(t), _ = fs(t), T = !!t.confirmation && Object.keys(t.confirmation).length > 0, $ = i ? pt(t.conditions, i) : !0, F = t.scope === "batch" && s.length === 0, M = t.scope === "single" && s.length !== 1, q = z(async () => {
3099
3099
  var Z, fe, Te;
3100
3100
  if (!(!t.association || s.length === 0)) {
3101
3101
  w(!0);
3102
3102
  try {
3103
- const Ne = r ? `${r}.${t.association}` : t.association, be = await Hr(Ne, s), je = er(v, be.target_entity);
3103
+ const Ne = r ? `${r}.${t.association}` : t.association, be = await Wr(Ne, s), je = er(v, be.target_entity);
3104
3104
  if (!je) {
3105
3105
  ie.error(`No list screen found for ${be.target_entity}`);
3106
3106
  return;
@@ -3125,7 +3125,7 @@ function sn({
3125
3125
  w(!1);
3126
3126
  }
3127
3127
  }
3128
- }, [t, r, s, v, k, c]), O = t.entity ? `${t.entity}.${e}` : e, U = s.length > 0 ? s : void 0, B = z(
3128
+ }, [t, r, s, v, k, c]), E = t.entity ? `${t.entity}.${e}` : e, U = s.length > 0 ? s : void 0, B = z(
3129
3129
  (Z, fe) => {
3130
3130
  var Ne;
3131
3131
  if (fe == null || fe(), Z.status === "accepted") {
@@ -3150,32 +3150,32 @@ function sn({
3150
3150
  return;
3151
3151
  }
3152
3152
  _ ? p(!0) : T ? y(!0) : (o == null || o(s.length), h.mutate(
3153
- { actionCode: O, body: Ct(void 0, U) },
3153
+ { actionCode: E, body: Ct(void 0, U) },
3154
3154
  {
3155
3155
  onSuccess: (Z) => B(Z),
3156
3156
  onError: () => u == null ? void 0 : u(s.length)
3157
3157
  }
3158
3158
  ));
3159
- }, [t, i, A, _, T, O, U, s, h, B, q, o, u, c]), Y = z(() => {
3159
+ }, [t, i, A, _, T, E, U, s, h, B, q, o, u, c]), Y = z(() => {
3160
3160
  o == null || o(s.length), h.mutate(
3161
- { actionCode: O, body: Ct(void 0, U) },
3161
+ { actionCode: E, body: Ct(void 0, U) },
3162
3162
  {
3163
3163
  onSuccess: (Z) => B(Z, () => y(!1)),
3164
3164
  onError: () => u == null ? void 0 : u(s.length)
3165
3165
  }
3166
3166
  );
3167
- }, [O, U, s, h, B, o, u]), R = z(
3167
+ }, [E, U, s, h, B, o, u]), R = z(
3168
3168
  (Z) => {
3169
3169
  o == null || o(s.length), h.mutate(
3170
- { actionCode: O, body: Ct(Z, U) },
3170
+ { actionCode: E, body: Ct(Z, U) },
3171
3171
  {
3172
3172
  onSuccess: (fe) => B(fe, () => p(!1)),
3173
3173
  onError: () => u == null ? void 0 : u(s.length)
3174
3174
  }
3175
3175
  );
3176
3176
  },
3177
- [O, U, s, h, B, o, u]
3178
- ), C = P((K = t.display) == null ? void 0 : K.name), L = (Q = t.display) == null ? void 0 : Q.icon;
3177
+ [E, U, s, h, B, o, u]
3178
+ ), C = P((V = t.display) == null ? void 0 : V.name), L = (Q = t.display) == null ? void 0 : Q.icon;
3179
3179
  return /* @__PURE__ */ d(pe, { children: [
3180
3180
  /* @__PURE__ */ d(
3181
3181
  j,
@@ -3193,7 +3193,7 @@ function sn({
3193
3193
  }
3194
3194
  ),
3195
3195
  _ && /* @__PURE__ */ n(
3196
- ds,
3196
+ cs,
3197
3197
  {
3198
3198
  open: m,
3199
3199
  onOpenChange: p,
@@ -3205,7 +3205,7 @@ function sn({
3205
3205
  }
3206
3206
  ),
3207
3207
  T && /* @__PURE__ */ n(
3208
- us,
3208
+ ds,
3209
3209
  {
3210
3210
  open: g,
3211
3211
  onOpenChange: y,
@@ -3236,11 +3236,11 @@ function oo({
3236
3236
  onSuccess: a
3237
3237
  }) {
3238
3238
  var T, $;
3239
- const [l, c] = V(!1), [o, u] = V(!1), f = Gn(r), { data: m } = qe(), p = Ut(), g = ms(t), y = fs(t), b = !!t.confirmation && Object.keys(t.confirmation).length > 0, w = pt(t.conditions, i), x = P((T = t.display) == null ? void 0 : T.name), N = ($ = t.display) == null ? void 0 : $.icon, h = z(async () => {
3239
+ const [l, c] = I(!1), [o, u] = I(!1), f = Qn(r), { data: m } = qe(), p = Ut(), g = ms(t), y = fs(t), b = !!t.confirmation && Object.keys(t.confirmation).length > 0, w = pt(t.conditions, i), x = P((T = t.display) == null ? void 0 : T.name), N = ($ = t.display) == null ? void 0 : $.icon, h = z(async () => {
3240
3240
  var F, M, q;
3241
3241
  if (t.association)
3242
3242
  try {
3243
- const O = r ? `${r}.${t.association}` : t.association, U = await Hr(O, [s]), B = er(m, U.target_entity);
3243
+ const E = r ? `${r}.${t.association}` : t.association, U = await Wr(E, [s]), B = er(m, U.target_entity);
3244
3244
  if (!B) {
3245
3245
  ie.error(`No list screen found for ${U.target_entity}`);
3246
3246
  return;
@@ -3251,16 +3251,16 @@ function oo({
3251
3251
  return;
3252
3252
  }
3253
3253
  const R = ((M = re == null ? void 0 : re.field_order) == null ? void 0 : M.find((L) => {
3254
- var K;
3255
- return (K = re.fields[L]) == null ? void 0 : K.primary;
3254
+ var V;
3255
+ return (V = re.fields[L]) == null ? void 0 : V.primary;
3256
3256
  })) ?? "id", C = new URLSearchParams();
3257
3257
  C.set(`filter_${R}`, U.ids.join(",")), p(B.route, {
3258
3258
  title: Y,
3259
3259
  icon: ((q = t.display) == null ? void 0 : q.icon) || B.icon,
3260
3260
  search: C.toString()
3261
3261
  }), a == null || a();
3262
- } catch (O) {
3263
- ie.error(O instanceof Error ? O.message : "Failed to resolve association");
3262
+ } catch (E) {
3263
+ ie.error(E instanceof Error ? E.message : "Failed to resolve association");
3264
3264
  }
3265
3265
  }, [t, r, s, m, p, a]), v = t.entity ? `${t.entity}.${e}` : e, k = z(() => {
3266
3266
  if (g) {
@@ -3302,7 +3302,7 @@ function oo({
3302
3302
  }
3303
3303
  ),
3304
3304
  y && /* @__PURE__ */ n(
3305
- ds,
3305
+ cs,
3306
3306
  {
3307
3307
  open: l,
3308
3308
  onOpenChange: c,
@@ -3313,7 +3313,7 @@ function oo({
3313
3313
  }
3314
3314
  ),
3315
3315
  b && /* @__PURE__ */ n(
3316
- us,
3316
+ ds,
3317
3317
  {
3318
3318
  open: o,
3319
3319
  onOpenChange: u,
@@ -3353,7 +3353,7 @@ function lo({
3353
3353
  ] })
3354
3354
  ] }),
3355
3355
  !t && i && /* @__PURE__ */ d(pe, { children: [
3356
- /* @__PURE__ */ n(Cn, { className: "w-4 h-4 text-yellow-600" }),
3356
+ /* @__PURE__ */ n(kn, { className: "w-4 h-4 text-yellow-600" }),
3357
3357
  /* @__PURE__ */ n("span", { children: "Partially completed - some items failed or were skipped" })
3358
3358
  ] }),
3359
3359
  !t && s && /* @__PURE__ */ d(pe, { children: [
@@ -3493,7 +3493,7 @@ function mo({
3493
3493
  }
3494
3494
  )
3495
3495
  ] }, f)) }, o) : c.field && c.op ? /* @__PURE__ */ n(
3496
- gn,
3496
+ hn,
3497
3497
  {
3498
3498
  node: c,
3499
3499
  fieldLabel: i,
@@ -3519,7 +3519,7 @@ function mo({
3519
3519
  const l = tr(e);
3520
3520
  return /* @__PURE__ */ d("div", { className: "flex items-center gap-2 flex-wrap pb-3", children: [
3521
3521
  l.map((c, o) => /* @__PURE__ */ n(
3522
- gn,
3522
+ hn,
3523
3523
  {
3524
3524
  node: c,
3525
3525
  fieldLabel: i,
@@ -3543,7 +3543,7 @@ function mo({
3543
3543
  )
3544
3544
  ] });
3545
3545
  }
3546
- function gn({
3546
+ function hn({
3547
3547
  node: e,
3548
3548
  fieldLabel: t,
3549
3549
  onRemove: r,
@@ -3589,7 +3589,7 @@ function po({
3589
3589
  onApply: s,
3590
3590
  availableFields: i
3591
3591
  }) {
3592
- const [a, l] = V(r), [c, o] = V(!1);
3592
+ const [a, l] = I(r), [c, o] = I(!1);
3593
3593
  if (le(() => {
3594
3594
  e && l(r);
3595
3595
  }, [e, r]), !e) return null;
@@ -3630,7 +3630,7 @@ function po({
3630
3630
  return /* @__PURE__ */ d("div", { className: "fixed inset-y-0 right-0 w-[400px] max-w-full bg-[var(--background)] border-l border-[var(--border)] shadow-lg z-50 flex flex-col", children: [
3631
3631
  /* @__PURE__ */ d("div", { className: "flex items-center justify-between px-4 py-3 border-b border-[var(--border)]", children: [
3632
3632
  /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
3633
- /* @__PURE__ */ n(Tn, { className: "w-4 h-4" }),
3633
+ /* @__PURE__ */ n(Cn, { className: "w-4 h-4" }),
3634
3634
  /* @__PURE__ */ n("h3", { className: "font-semibold text-sm", children: "Filters" })
3635
3635
  ] }),
3636
3636
  /* @__PURE__ */ n(j, { variant: "ghost", size: "icon", onClick: t, className: "h-8 w-8", children: /* @__PURE__ */ n(ze, { className: "w-4 h-4" }) })
@@ -3643,7 +3643,7 @@ function po({
3643
3643
  if (!x.field || !x.op) return null;
3644
3644
  const h = i.find((v) => v.code === x.field);
3645
3645
  return h ? /* @__PURE__ */ n(
3646
- Ar,
3646
+ Tr,
3647
3647
  {
3648
3648
  node: x,
3649
3649
  meta: h,
@@ -3672,7 +3672,7 @@ function po({
3672
3672
  if (!x.field || !x.op) return null;
3673
3673
  const h = i.find((v) => v.code === x.field);
3674
3674
  return h ? /* @__PURE__ */ n(
3675
- Ar,
3675
+ Tr,
3676
3676
  {
3677
3677
  node: x,
3678
3678
  meta: h,
@@ -3725,7 +3725,7 @@ function po({
3725
3725
  ] })
3726
3726
  ] });
3727
3727
  }
3728
- function Ar({
3728
+ function Tr({
3729
3729
  node: e,
3730
3730
  meta: t,
3731
3731
  onUpdate: r,
@@ -3793,7 +3793,7 @@ function ho({
3793
3793
  s.map((a, l) => {
3794
3794
  const c = t.find((o) => o.code === a.field);
3795
3795
  return c ? /* @__PURE__ */ n(
3796
- Ar,
3796
+ Tr,
3797
3797
  {
3798
3798
  node: a,
3799
3799
  meta: c,
@@ -3859,7 +3859,7 @@ function go({
3859
3859
  onSelect: r,
3860
3860
  onCancel: s
3861
3861
  }) {
3862
- const [i, a] = V(""), l = e.filter(
3862
+ const [i, a] = I(""), l = e.filter(
3863
3863
  (c) => !t.has(c.code) && (i === "" || c.label.toLowerCase().includes(i.toLowerCase()) || c.code.toLowerCase().includes(i.toLowerCase()))
3864
3864
  );
3865
3865
  return /* @__PURE__ */ d("div", { className: "w-full border border-[var(--border)] rounded-md p-2 space-y-2", children: [
@@ -3899,7 +3899,7 @@ function vo({
3899
3899
  onShowAll: i,
3900
3900
  columnLabel: a = (l) => l
3901
3901
  }) {
3902
- const [l, c] = V(!1);
3902
+ const [l, c] = I(!1);
3903
3903
  return /* @__PURE__ */ d("div", { className: "relative", children: [
3904
3904
  /* @__PURE__ */ d(
3905
3905
  j,
@@ -3940,7 +3940,7 @@ function vo({
3940
3940
  }) }),
3941
3941
  /* @__PURE__ */ d("div", { className: "border-t border-[var(--border)] px-2 py-1.5 flex items-center gap-1", children: [
3942
3942
  /* @__PURE__ */ d(j, { variant: "ghost", size: "sm", className: "text-xs h-7 flex-1", onClick: s, children: [
3943
- /* @__PURE__ */ n(An, { className: "w-3 h-3 mr-1" }),
3943
+ /* @__PURE__ */ n(Tn, { className: "w-3 h-3 mr-1" }),
3944
3944
  "Reset"
3945
3945
  ] }),
3946
3946
  /* @__PURE__ */ n(j, { variant: "ghost", size: "sm", className: "text-xs h-7 flex-1", onClick: i, children: "Show all" })
@@ -3958,7 +3958,7 @@ function yo({
3958
3958
  onSaveAs: a,
3959
3959
  onSetDefault: l
3960
3960
  }) {
3961
- const [c, o] = V(!1), u = e.find((y) => y.id === t), f = e.filter((y) => y.source === "system"), m = e.filter((y) => y.source === "personal"), p = e.filter((y) => y.source === "shared"), g = u ? P(u.name) : "Default view";
3961
+ const [c, o] = I(!1), u = e.find((y) => y.id === t), f = e.filter((y) => y.source === "system"), m = e.filter((y) => y.source === "personal"), p = e.filter((y) => y.source === "shared"), g = u ? P(u.name) : "Default view";
3962
3962
  return /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
3963
3963
  /* @__PURE__ */ d("div", { className: "relative", children: [
3964
3964
  /* @__PURE__ */ d(
@@ -4056,7 +4056,7 @@ function yo({
4056
4056
  ] })
4057
4057
  ] }),
4058
4058
  r && t && i && /* @__PURE__ */ d(j, { variant: "outline", size: "sm", className: "h-8", onClick: i, children: [
4059
- /* @__PURE__ */ n(Or, { className: "w-3 h-3 mr-1" }),
4059
+ /* @__PURE__ */ n(Er, { className: "w-3 h-3 mr-1" }),
4060
4060
  "Save"
4061
4061
  ] })
4062
4062
  ] });
@@ -4138,16 +4138,16 @@ function br(e, t, r, s) {
4138
4138
  }
4139
4139
  function No({ screenCode: e }) {
4140
4140
  var $t, Wt, tt, Rt, rt, Et, Ht, _t, St;
4141
- const t = Ut(), [r, s] = yt(), { data: i } = qe(), [a, l] = V(null), [c, o] = V({}), [u, f] = V({ isPending: !1, isSuccess: !1, isError: !1, isPartial: !1, count: 0 }), [m, p] = V(!1), { filters: g, activeCount: y, setFilters: b, clearFilters: w } = fo(), x = ct((S) => S.user), N = bo(e, x == null ? void 0 : x.id), h = i == null ? void 0 : i.screens[e], v = h != null && h.entity ? i == null ? void 0 : i.entities[h.entity] : void 0, k = h == null ? void 0 : h.entity, A = i == null ? void 0 : i.actions, _ = ee(
4142
- () => Cr(v == null ? void 0 : v.actions, h == null ? void 0 : h.actions, "toolbar", A),
4141
+ const t = Ut(), [r, s] = yt(), { data: i } = qe(), [a, l] = I(null), [c, o] = I({}), [u, f] = I({ isPending: !1, isSuccess: !1, isError: !1, isPartial: !1, count: 0 }), [m, p] = I(!1), { filters: g, activeCount: y, setFilters: b, clearFilters: w } = fo(), x = ct((S) => S.user), N = bo(e, x == null ? void 0 : x.id), h = i == null ? void 0 : i.screens[e], v = h != null && h.entity ? i == null ? void 0 : i.entities[h.entity] : void 0, k = h == null ? void 0 : h.entity, A = i == null ? void 0 : i.actions, _ = ee(
4142
+ () => kr(v == null ? void 0 : v.actions, h == null ? void 0 : h.actions, "list_toolbar", A),
4143
4143
  [v == null ? void 0 : v.actions, h == null ? void 0 : h.actions, A]
4144
4144
  ), T = ee(
4145
- () => Cr(v == null ? void 0 : v.actions, h == null ? void 0 : h.row_actions, "row", A),
4145
+ () => kr(v == null ? void 0 : v.actions, h == null ? void 0 : h.row_actions, "list_row", A),
4146
4146
  [v == null ? void 0 : v.actions, h == null ? void 0 : h.row_actions, A]
4147
4147
  ), $ = (h == null ? void 0 : h.row_actions) !== void 0, F = ee(
4148
- () => _.some((S) => S.action.scope === "batch"),
4148
+ () => _.some((S) => (S.action.visibility ?? []).includes("list_toolbar")),
4149
4149
  [_]
4150
- ), M = !!(v != null && v.soft_delete), q = M && ((x == null ? void 0 : x.permissions) ?? []).some((S) => S === "feature:view_deleted" || S === "feature:*" || S === "*"), O = q && r.get("include_deleted") === "true", { openTab: U, updateTabSearch: B, findTabByPathname: re } = ht();
4150
+ ), M = !!(v != null && v.soft_delete), q = M && ((x == null ? void 0 : x.permissions) ?? []).some((S) => S === "feature:view_deleted" || S === "feature:*" || S === "*"), E = q && r.get("include_deleted") === "true", { openTab: U, updateTabSearch: B, findTabByPathname: re } = ht();
4151
4151
  le(() => {
4152
4152
  var S, D;
4153
4153
  if (h != null && h.route && v) {
@@ -4165,22 +4165,22 @@ function No({ screenCode: e }) {
4165
4165
  const S = re(h.route);
4166
4166
  S && B(S.id, r.toString());
4167
4167
  }, [r, h == null ? void 0 : h.route]);
4168
- const Y = parseInt(r.get("page") ?? "1", 10), R = r.get("search") ?? "", C = r.get("sort") ?? (h == null ? void 0 : h.sort_default) ?? "", L = Yn(R, 300), K = ee(() => {
4168
+ const Y = parseInt(r.get("page") ?? "1", 10), R = r.get("search") ?? "", C = r.get("sort") ?? (h == null ? void 0 : h.sort_default) ?? "", L = Gn(R, 300), V = ee(() => {
4169
4169
  const S = r.get("columns");
4170
4170
  return S ? S.split(",").filter(Boolean) : (h == null ? void 0 : h.columns) ?? [];
4171
4171
  }, [r, h == null ? void 0 : h.columns]), Q = ee(() => {
4172
- const S = [], D = [...(h == null ? void 0 : h.columns) ?? [], ...K];
4172
+ const S = [], D = [...(h == null ? void 0 : h.columns) ?? [], ...V];
4173
4173
  return D.some((H) => H.startsWith("$status.")) && S.push("statuses"), D.some((H) => H.startsWith("$property.")) && S.push("properties"), S.length > 0 && S.unshift("refs"), S.length > 0 ? S : void 0;
4174
- }, [h == null ? void 0 : h.columns, K]), { data: Z, isLoading: fe, isError: Te } = Kt(k, {
4174
+ }, [h == null ? void 0 : h.columns, V]), { data: Z, isLoading: fe, isError: Te } = Kt(k, {
4175
4175
  page: Y,
4176
4176
  per_page: 50,
4177
4177
  sort: C || void 0,
4178
4178
  search: L || void 0,
4179
4179
  filters: g.length > 0 ? g : void 0,
4180
- include_deleted: O || void 0,
4180
+ include_deleted: E || void 0,
4181
4181
  expand: Q,
4182
4182
  screen: h != null && h.fixed_filters ? e : void 0
4183
- }), Ne = Qn(k ?? ""), be = ee(() => {
4183
+ }), Ne = Jn(k ?? ""), be = ee(() => {
4184
4184
  if (!C) return [];
4185
4185
  const [S, D] = C.split(":");
4186
4186
  return [{ id: S, desc: D === "desc" }];
@@ -4197,7 +4197,7 @@ function No({ screenCode: e }) {
4197
4197
  dt.current = X;
4198
4198
  const Ze = ee(() => {
4199
4199
  var H, ne, te;
4200
- if (K.length === 0 || !v) return [];
4200
+ if (V.length === 0 || !v) return [];
4201
4201
  const S = [];
4202
4202
  F && S.push({
4203
4203
  id: "_select",
@@ -4221,7 +4221,7 @@ function No({ screenCode: e }) {
4221
4221
  }
4222
4222
  )
4223
4223
  });
4224
- for (const G of K) {
4224
+ for (const G of V) {
4225
4225
  if (G.startsWith("$status.")) {
4226
4226
  const de = G.slice(8), ge = (H = v.status_groups) == null ? void 0 : H[de];
4227
4227
  if (!ge) continue;
@@ -4233,8 +4233,8 @@ function No({ screenCode: e }) {
4233
4233
  cell: ({ row: Ae }) => {
4234
4234
  const He = Ae.original.$statuses, nt = He == null ? void 0 : He.find((W) => W.group_code === de);
4235
4235
  if (!nt) return /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)]", children: "-" });
4236
- const E = Me.get(nt.status_code);
4237
- return /* @__PURE__ */ n(ke, { color: E == null ? void 0 : E.color, children: P(E == null ? void 0 : E.name) || nt.status_code });
4236
+ const O = Me.get(nt.status_code);
4237
+ return /* @__PURE__ */ n(ke, { color: O == null ? void 0 : O.color, children: P(O == null ? void 0 : O.name) || nt.status_code });
4238
4238
  }
4239
4239
  });
4240
4240
  continue;
@@ -4279,9 +4279,9 @@ function No({ screenCode: e }) {
4279
4279
  size: 48,
4280
4280
  cell: ({ row: G }) => {
4281
4281
  const xe = String(G.original[je] ?? ""), Ce = br(h, xe, v, i == null ? void 0 : i.screens);
4282
- return /* @__PURE__ */ d(Vn, { children: [
4283
- /* @__PURE__ */ n(Kn, { asChild: !0, children: /* @__PURE__ */ n(j, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ n(ti, { className: "h-4 w-4" }) }) }),
4284
- /* @__PURE__ */ d(Mr, { align: "end", children: [
4282
+ return /* @__PURE__ */ d(In, { children: [
4283
+ /* @__PURE__ */ n(Vn, { asChild: !0, children: /* @__PURE__ */ n(j, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ n(ti, { className: "h-4 w-4" }) }) }),
4284
+ /* @__PURE__ */ d(zr, { align: "end", children: [
4285
4285
  D && /* @__PURE__ */ d(pe, { children: [
4286
4286
  Ce && /* @__PURE__ */ d(
4287
4287
  mt,
@@ -4308,7 +4308,7 @@ function No({ screenCode: e }) {
4308
4308
  ]
4309
4309
  }
4310
4310
  ),
4311
- T.length > 0 && /* @__PURE__ */ n(Wn, {})
4311
+ T.length > 0 && /* @__PURE__ */ n(Kn, {})
4312
4312
  ] }),
4313
4313
  T.map(({ code: we, action: de }) => {
4314
4314
  var ge, Me;
@@ -4363,7 +4363,7 @@ function No({ screenCode: e }) {
4363
4363
  ] });
4364
4364
  }
4365
4365
  }), S;
4366
- }, [h, v, K, t, F, T, $, k, je]), Ye = (Z == null ? void 0 : Z.data) ?? [], Se = Z == null ? void 0 : Z.meta, ut = pi({
4366
+ }, [h, v, V, t, F, T, $, k, je]), Ye = (Z == null ? void 0 : Z.data) ?? [], Se = Z == null ? void 0 : Z.meta, ut = pi({
4367
4367
  data: Ye,
4368
4368
  columns: Ze,
4369
4369
  getCoreRowModel: hi(),
@@ -4524,7 +4524,7 @@ function No({ screenCode: e }) {
4524
4524
  );
4525
4525
  }
4526
4526
  return D.type === "edit" ? null : /* @__PURE__ */ n(
4527
- sn,
4527
+ nn,
4528
4528
  {
4529
4529
  actionCode: S,
4530
4530
  action: D,
@@ -4578,7 +4578,7 @@ function No({ screenCode: e }) {
4578
4578
  }
4579
4579
  ),
4580
4580
  /* @__PURE__ */ d("div", { className: "relative flex-1 max-w-sm", children: [
4581
- /* @__PURE__ */ n(Fr, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--muted-foreground)]" }),
4581
+ /* @__PURE__ */ n(Or, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--muted-foreground)]" }),
4582
4582
  /* @__PURE__ */ n(
4583
4583
  he,
4584
4584
  {
@@ -4597,7 +4597,7 @@ function No({ screenCode: e }) {
4597
4597
  onClick: () => p(!0),
4598
4598
  className: "h-8",
4599
4599
  children: [
4600
- /* @__PURE__ */ n(Tn, { className: "w-4 h-4 mr-1.5" }),
4600
+ /* @__PURE__ */ n(Cn, { className: "w-4 h-4 mr-1.5" }),
4601
4601
  "Filters",
4602
4602
  y > 0 && /* @__PURE__ */ n(ke, { variant: "secondary", className: "ml-1.5 h-5 min-w-[20px] px-1 text-xs", children: y })
4603
4603
  ]
@@ -4607,9 +4607,9 @@ function No({ screenCode: e }) {
4607
4607
  vo,
4608
4608
  {
4609
4609
  availableColumns: h.columns ?? [],
4610
- visibleColumns: K,
4610
+ visibleColumns: V,
4611
4611
  onToggle: (S) => {
4612
- const D = new URLSearchParams(r), H = K.includes(S) ? K.filter((ne) => ne !== S) : [...K, S];
4612
+ const D = new URLSearchParams(r), H = V.includes(S) ? V.filter((ne) => ne !== S) : [...V, S];
4613
4613
  H.length !== 0 && (D.set("columns", H.join(",")), s(D));
4614
4614
  },
4615
4615
  onReset: () => {
@@ -4638,13 +4638,13 @@ function No({ screenCode: e }) {
4638
4638
  q && /* @__PURE__ */ d(
4639
4639
  j,
4640
4640
  {
4641
- variant: O ? "secondary" : "outline",
4641
+ variant: E ? "secondary" : "outline",
4642
4642
  size: "sm",
4643
4643
  onClick: or,
4644
4644
  className: "ml-auto",
4645
4645
  children: [
4646
- O ? /* @__PURE__ */ n(Rr, { className: "w-4 h-4 mr-1.5" }) : /* @__PURE__ */ n(Er, { className: "w-4 h-4 mr-1.5" }),
4647
- O ? "Hide deleted" : "Show deleted"
4646
+ E ? /* @__PURE__ */ n($r, { className: "w-4 h-4 mr-1.5" }) : /* @__PURE__ */ n(Rr, { className: "w-4 h-4 mr-1.5" }),
4647
+ E ? "Hide deleted" : "Show deleted"
4648
4648
  ]
4649
4649
  }
4650
4650
  )
@@ -4673,14 +4673,14 @@ function No({ screenCode: e }) {
4673
4673
  )
4674
4674
  ] }),
4675
4675
  fe ? /* @__PURE__ */ n(Ha, { cols: ((Ht = h.columns) == null ? void 0 : Ht.length) ?? 4 }) : Te ? /* @__PURE__ */ n("div", { className: "px-6", children: /* @__PURE__ */ n(
4676
- mn,
4676
+ fn,
4677
4677
  {
4678
4678
  icon: "alert-circle",
4679
4679
  title: "Failed to load data",
4680
4680
  description: "Something went wrong. Please try again."
4681
4681
  }
4682
4682
  ) }) : Ye.length === 0 ? /* @__PURE__ */ n("div", { className: "px-6", children: /* @__PURE__ */ n(
4683
- mn,
4683
+ fn,
4684
4684
  {
4685
4685
  icon: ft,
4686
4686
  title: L || y > 0 ? "No results found" : `No ${Pt.toLowerCase()} yet`,
@@ -4784,7 +4784,7 @@ function No({ screenCode: e }) {
4784
4784
  onClick: () => Pe(Y - 1),
4785
4785
  disabled: Y <= 1,
4786
4786
  children: [
4787
- /* @__PURE__ */ n(kn, { className: "w-4 h-4" }),
4787
+ /* @__PURE__ */ n(Sn, { className: "w-4 h-4" }),
4788
4788
  "Prev"
4789
4789
  ]
4790
4790
  }
@@ -4804,7 +4804,7 @@ function No({ screenCode: e }) {
4804
4804
  disabled: Y >= Se.total_pages,
4805
4805
  children: [
4806
4806
  "Next",
4807
- /* @__PURE__ */ n($r, { className: "w-4 h-4" })
4807
+ /* @__PURE__ */ n(Pr, { className: "w-4 h-4" })
4808
4808
  ]
4809
4809
  }
4810
4810
  )
@@ -4821,7 +4821,7 @@ function No({ screenCode: e }) {
4821
4821
  }
4822
4822
  ),
4823
4823
  /* @__PURE__ */ n(
4824
- en,
4824
+ Zr,
4825
4825
  {
4826
4826
  open: a !== null,
4827
4827
  onOpenChange: (S) => !S && l(null),
@@ -4957,7 +4957,7 @@ function So({
4957
4957
  const i = ee(
4958
4958
  () => Object.entries(r),
4959
4959
  [r]
4960
- ), [a, l] = V(0);
4960
+ ), [a, l] = I(0);
4961
4961
  if (i.length === 0) return null;
4962
4962
  const [c, o] = i[a];
4963
4963
  return /* @__PURE__ */ d(xt, { children: [
@@ -5000,7 +5000,7 @@ function ko({
5000
5000
  }) {
5001
5001
  const a = Ut(), l = `${e}.${r}`, { data: c, isLoading: o } = Ve({
5002
5002
  queryKey: ["association", l, t],
5003
- queryFn: () => Hr(l, [t])
5003
+ queryFn: () => Wr(l, [t])
5004
5004
  }), u = (c == null ? void 0 : c.target_entity) ?? s.target, f = i.entities[u], m = (c == null ? void 0 : c.ids) ?? [], p = ee(
5005
5005
  () => {
5006
5006
  var k;
@@ -5012,7 +5012,7 @@ function ko({
5012
5012
  [f]
5013
5013
  ), g = ee(() => m.slice(0, 50), [m]), { data: y, isLoading: b } = Ve({
5014
5014
  queryKey: ["association-records", u, g],
5015
- queryFn: () => Hn(u, {
5015
+ queryFn: () => Wn(u, {
5016
5016
  per_page: 50,
5017
5017
  filters: [{ field: p, op: "in", value: g }]
5018
5018
  }),
@@ -5074,7 +5074,7 @@ function ko({
5074
5074
  ] });
5075
5075
  }
5076
5076
  const Co = /^(\d+)px$/;
5077
- function an(e) {
5077
+ function sn(e) {
5078
5078
  if (e == null || e === "") return null;
5079
5079
  if (e === "auto") return { kind: "auto" };
5080
5080
  if (e === "fill") return { kind: "fill" };
@@ -5087,7 +5087,7 @@ function an(e) {
5087
5087
  return !isNaN(r) && String(r) === e && r > 0 ? { kind: "weight", value: r } : null;
5088
5088
  }
5089
5089
  function To({ config: e, ctx: t }) {
5090
- const { items: r, gap: s = 0, resizable: i = !1, stack_below: a } = e, l = a === "never" ? 0 : a ?? 768, [c, o] = V(!1), u = me(null);
5090
+ const { items: r, gap: s = 0, resizable: i = !1, stack_below: a } = e, l = a === "never" ? 0 : a ?? 768, [c, o] = I(!1), u = me(null);
5091
5091
  le(() => {
5092
5092
  if (l === 0) return;
5093
5093
  const x = u.current;
@@ -5098,9 +5098,9 @@ function To({ config: e, ctx: t }) {
5098
5098
  });
5099
5099
  return N.observe(x), () => N.disconnect();
5100
5100
  }, [l]);
5101
- const [f, m] = V(null), p = me(null), g = z(() => r.map((x) => {
5101
+ const [f, m] = I(null), p = me(null), g = z(() => r.map((x) => {
5102
5102
  var v, k;
5103
- const N = x.width ?? ((v = x.column) == null ? void 0 : v.width) ?? ((k = x.row) == null ? void 0 : k.width) ?? e.width, h = an(N);
5103
+ const N = x.width ?? ((v = x.column) == null ? void 0 : v.width) ?? ((k = x.row) == null ? void 0 : k.width) ?? e.width, h = sn(N);
5104
5104
  return h && h.kind === "weight" ? h.value : 1;
5105
5105
  }), [r, e.width]), y = z(
5106
5106
  (x, N) => {
@@ -5110,7 +5110,7 @@ function To({ config: e, ctx: t }) {
5110
5110
  const v = (A) => {
5111
5111
  const _ = p.current;
5112
5112
  if (!_ || !u.current) return;
5113
- const T = u.current.getBoundingClientRect().width, $ = A.clientX - _.startX, F = _.startSizes.reduce((O, U) => O + U, 0), M = $ / T * F, q = [..._.startSizes];
5113
+ const T = u.current.getBoundingClientRect().width, $ = A.clientX - _.startX, F = _.startSizes.reduce((E, U) => E + U, 0), M = $ / T * F, q = [..._.startSizes];
5114
5114
  q[_.index] = Math.max(0.1, _.startSizes[_.index] + M), q[_.index + 1] = Math.max(0.1, _.startSizes[_.index + 1] - M), m(q);
5115
5115
  }, k = () => {
5116
5116
  p.current = null, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", k);
@@ -5150,13 +5150,13 @@ function To({ config: e, ctx: t }) {
5150
5150
  );
5151
5151
  }
5152
5152
  function Ao(e, t, r, s) {
5153
- const i = an(e);
5153
+ const i = sn(e);
5154
5154
  let a;
5155
5155
  return !i || i.kind === "weight" ? a = `${t} 1 0%` : i.kind === "px" ? a = `0 0 ${i.value}px` : i.kind === "fill" ? a = "1 1 0%" : a = "0 0 auto", { flex: a, minWidth: r, maxWidth: s };
5156
5156
  }
5157
5157
  function Do(e) {
5158
5158
  if (!e) return;
5159
- const t = an(e);
5159
+ const t = sn(e);
5160
5160
  if ((t == null ? void 0 : t.kind) === "px") return { height: `${t.value}px`, overflow: "hidden" };
5161
5161
  if (typeof e == "string" && (e.includes("vh") || e.includes("calc") || e.includes("%")))
5162
5162
  return { height: e, overflow: "hidden" };
@@ -5194,7 +5194,7 @@ function Ro(e, t) {
5194
5194
  }
5195
5195
  }
5196
5196
  function Eo({ config: e, ctx: t }) {
5197
- const { items: r } = e, [s, i] = V(0);
5197
+ const { items: r } = e, [s, i] = I(0);
5198
5198
  return r.length === 0 ? null : /* @__PURE__ */ d(xt, { children: [
5199
5199
  /* @__PURE__ */ n(bt, { className: "py-3", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-1 border-b border-[var(--border)]", children: r.map((a, l) => {
5200
5200
  const c = $o(a, t), o = Ro(a, t);
@@ -5225,7 +5225,7 @@ function Eo({ config: e, ctx: t }) {
5225
5225
  ] });
5226
5226
  }
5227
5227
  function Oo({ config: e, ctx: t }) {
5228
- const { name: r, items: s, collapsed: i = !1, columns: a } = e, [l, c] = V(i), o = a ? { ...t, columns: a } : t;
5228
+ const { name: r, items: s, collapsed: i = !1, columns: a } = e, [l, c] = I(i), o = a ? { ...t, columns: a } : t;
5229
5229
  return /* @__PURE__ */ d(xt, { children: [
5230
5230
  /* @__PURE__ */ n(
5231
5231
  bt,
@@ -5306,7 +5306,7 @@ function jo(e, t) {
5306
5306
  }
5307
5307
  function zo(e, t) {
5308
5308
  const r = { ...e };
5309
- return r.time_field || (r.time_field = Io(t)), r.type_field || (r.type_field = vn(t, "enum")), r.summary_field || (r.summary_field = Vo(t, "string", "text")), r.content_field || (r.content_field = vn(t, "text")), r.author_field || t.fields.created_by && (r.author_field = "created_by"), r.direction_field || (r.direction_field = Mo(t)), r.intent_field || (r.intent_field = Uo(t)), r;
5309
+ return r.time_field || (r.time_field = Io(t)), r.type_field || (r.type_field = gn(t, "enum")), r.summary_field || (r.summary_field = Vo(t, "string", "text")), r.content_field || (r.content_field = gn(t, "text")), r.author_field || t.fields.created_by && (r.author_field = "created_by"), r.direction_field || (r.direction_field = Mo(t)), r.intent_field || (r.intent_field = Uo(t)), r;
5310
5310
  }
5311
5311
  function Mo(e) {
5312
5312
  const t = e.fields.direction;
@@ -5334,7 +5334,7 @@ function Io(e) {
5334
5334
  if (i && i.type === "timestamp") return s;
5335
5335
  }
5336
5336
  }
5337
- function vn(e, t) {
5337
+ function gn(e, t) {
5338
5338
  for (const r of e.field_order) {
5339
5339
  const s = e.fields[r];
5340
5340
  if (s && s.type === t)
@@ -5351,7 +5351,7 @@ function Vo(e, ...t) {
5351
5351
  }
5352
5352
  }
5353
5353
  function Ko(e) {
5354
- const t = jr(e);
5354
+ const t = qr(e);
5355
5355
  return t.length > 0 ? t[0] : void 0;
5356
5356
  }
5357
5357
  function Wo(e, t) {
@@ -5378,26 +5378,26 @@ function Jo(e, t) {
5378
5378
  }
5379
5379
  return !0;
5380
5380
  }
5381
- function yn() {
5381
+ function vn() {
5382
5382
  const e = /* @__PURE__ */ new Date(), t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), s = String(e.getDate()).padStart(2, "0"), i = String(e.getHours()).padStart(2, "0"), a = String(e.getMinutes()).padStart(2, "0");
5383
5383
  return `${t}-${r}-${s}T${i}:${a}`;
5384
5384
  }
5385
5385
  function Ns(e, t, r, s) {
5386
- const [i, a] = V(() => {
5386
+ const [i, a] = I(() => {
5387
5387
  var v, k;
5388
5388
  const x = e.quick_add, N = s.entities[e.entity], h = {};
5389
5389
  if (x != null && x.fields)
5390
5390
  for (const A of x.fields)
5391
- ((v = x.defaults) == null ? void 0 : v[A]) != null ? h[A] = x.defaults[A] : ((k = N == null ? void 0 : N.fields[A]) == null ? void 0 : k.type) === "timestamp" && (h[A] = yn());
5391
+ ((v = x.defaults) == null ? void 0 : v[A]) != null ? h[A] = x.defaults[A] : ((k = N == null ? void 0 : N.fields[A]) == null ? void 0 : k.type) === "timestamp" && (h[A] = vn());
5392
5392
  return h;
5393
5393
  }), l = Fe(), { mutate: c, isPending: o, error: u, reset: f } = Ee({
5394
- mutationFn: (x) => Vr(e.entity, x),
5394
+ mutationFn: (x) => Ir(e.entity, x),
5395
5395
  onSuccess: () => {
5396
5396
  var k, A;
5397
5397
  const x = e.quick_add, N = s.entities[e.entity], h = {};
5398
5398
  if (x != null && x.fields)
5399
5399
  for (const _ of x.fields)
5400
- ((k = x == null ? void 0 : x.defaults) == null ? void 0 : k[_]) != null ? h[_] = x.defaults[_] : ((A = N == null ? void 0 : N.fields[_]) == null ? void 0 : A.type) === "timestamp" ? h[_] = yn() : h[_] = "";
5400
+ ((k = x == null ? void 0 : x.defaults) == null ? void 0 : k[_]) != null ? h[_] = x.defaults[_] : ((A = N == null ? void 0 : N.fields[_]) == null ? void 0 : A.type) === "timestamp" ? h[_] = vn() : h[_] = "";
5401
5401
  a(h);
5402
5402
  const v = Array.isArray(r) ? r.join("|") : r;
5403
5403
  l.invalidateQueries({
@@ -5429,7 +5429,7 @@ function Ns(e, t, r, s) {
5429
5429
  handleFieldChange: w
5430
5430
  };
5431
5431
  }
5432
- function on({ config: e, parentEntity: t, parentId: r, schema: s }) {
5432
+ function an({ config: e, parentEntity: t, parentId: r, schema: s }) {
5433
5433
  const { values: i, quickAdd: a, childEntity: l, isPending: c, error: o, isReady: u, handleSubmit: f, handleFieldChange: m } = Ns(e, t, r, s);
5434
5434
  return !a || a.fields.length === 0 || !l ? null : /* @__PURE__ */ d(
5435
5435
  "form",
@@ -5457,12 +5457,12 @@ function on({ config: e, parentEntity: t, parentId: r, schema: s }) {
5457
5457
  }
5458
5458
  );
5459
5459
  }
5460
- function xn({ config: e, parentEntity: t, parentId: r, schema: s }) {
5460
+ function yn({ config: e, parentEntity: t, parentId: r, schema: s }) {
5461
5461
  const i = s.entities[e.entity], { data: a, isLoading: l, isError: c } = It(t, r, e.entity, e.foreign_key, e.sort, e.limit), o = (a == null ? void 0 : a.data) ?? [], u = a == null ? void 0 : a.$refs, f = e.columns;
5462
5462
  if (!i)
5463
5463
  return /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: "Entity not found." });
5464
5464
  const m = /* @__PURE__ */ n(
5465
- on,
5465
+ an,
5466
5466
  {
5467
5467
  config: e,
5468
5468
  parentEntity: t,
@@ -5516,7 +5516,7 @@ function Qo({ config: e, parentEntity: t, parentId: r, schema: s }) {
5516
5516
  if (!i)
5517
5517
  return /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: "Entity not found." });
5518
5518
  const m = /* @__PURE__ */ n(
5519
- on,
5519
+ an,
5520
5520
  {
5521
5521
  config: e,
5522
5522
  parentEntity: t,
@@ -5577,7 +5577,7 @@ function Go({ config: e, parentEntity: t, parentId: r, schema: s }) {
5577
5577
  if (!i)
5578
5578
  return /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: "Entity not found." });
5579
5579
  const b = /* @__PURE__ */ n(
5580
- on,
5580
+ an,
5581
5581
  {
5582
5582
  config: e,
5583
5583
  parentEntity: t,
@@ -5593,7 +5593,7 @@ function Go({ config: e, parentEntity: t, parentId: r, schema: s }) {
5593
5593
  if (l)
5594
5594
  return /* @__PURE__ */ d("div", { children: [
5595
5595
  b,
5596
- /* @__PURE__ */ d("div", { className: bn(y), children: [
5596
+ /* @__PURE__ */ d("div", { className: xn(y), children: [
5597
5597
  /* @__PURE__ */ n(_e, { className: "h-24 w-full rounded-xl" }),
5598
5598
  /* @__PURE__ */ n(_e, { className: "h-24 w-full rounded-xl" }),
5599
5599
  /* @__PURE__ */ n(_e, { className: "h-24 w-full rounded-xl" })
@@ -5607,7 +5607,7 @@ function Go({ config: e, parentEntity: t, parentId: r, schema: s }) {
5607
5607
  const w = f.filter((x) => x !== p && x !== g);
5608
5608
  return /* @__PURE__ */ d("div", { children: [
5609
5609
  b,
5610
- /* @__PURE__ */ n("div", { className: bn(y), children: o.map((x, N) => /* @__PURE__ */ d(xt, { className: "overflow-hidden", children: [
5610
+ /* @__PURE__ */ n("div", { className: xn(y), children: o.map((x, N) => /* @__PURE__ */ d(xt, { className: "overflow-hidden", children: [
5611
5611
  /* @__PURE__ */ n(bt, { className: "py-3 px-4", children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
5612
5612
  /* @__PURE__ */ n(Vt, { className: "text-sm truncate", children: p && i.fields[p] ? oe({
5613
5613
  field: i.fields[p],
@@ -5647,7 +5647,7 @@ function Go({ config: e, parentEntity: t, parentId: r, schema: s }) {
5647
5647
  ] }, String(x.id ?? N))) })
5648
5648
  ] });
5649
5649
  }
5650
- function bn(e) {
5650
+ function xn(e) {
5651
5651
  switch (e) {
5652
5652
  case 1:
5653
5653
  return "grid grid-cols-1 gap-3";
@@ -5662,8 +5662,8 @@ function bn(e) {
5662
5662
  }
5663
5663
  }
5664
5664
  const Yo = "quick_entry", Xo = 100, Bo = 180, Zo = 800;
5665
- function Nn({ config: e, parentEntity: t, parentId: r, schema: s }) {
5666
- const { values: i, quickAdd: a, childEntity: l, isPending: c, error: o, isReady: u, handleSubmit: f, handleFieldChange: m } = Ns(e, t, r, s), [p, g] = V(Bo), y = me(null), b = me(i);
5665
+ function bn({ config: e, parentEntity: t, parentId: r, schema: s }) {
5666
+ const { values: i, quickAdd: a, childEntity: l, isPending: c, error: o, isReady: u, handleSubmit: f, handleFieldChange: m } = Ns(e, t, r, s), [p, g] = I(Bo), y = me(null), b = me(i);
5667
5667
  b.current = i;
5668
5668
  const w = me(m);
5669
5669
  w.current = m;
@@ -5684,8 +5684,8 @@ function Nn({ config: e, parentEntity: t, parentId: r, schema: s }) {
5684
5684
  T.preventDefault(), y.current = { startY: T.clientY, startHeight: p };
5685
5685
  const $ = (M) => {
5686
5686
  if (!y.current) return;
5687
- const q = y.current.startY - M.clientY, O = Math.min(Zo, Math.max(Xo, y.current.startHeight + q));
5688
- g(O);
5687
+ const q = y.current.startY - M.clientY, E = Math.min(Zo, Math.max(Xo, y.current.startHeight + q));
5688
+ g(E);
5689
5689
  }, F = () => {
5690
5690
  y.current = null, document.removeEventListener("mousemove", $), document.removeEventListener("mouseup", F);
5691
5691
  };
@@ -5770,7 +5770,7 @@ function el({ config: e, parentEntity: t, parentId: r, schema: s }) {
5770
5770
  const T = !y.current, $ = o.length > b.current && b.current > 0;
5771
5771
  b.current = o.length, (T && p === "bottom" || $) && (g.current.scrollTop = g.current.scrollHeight, y.current = !0);
5772
5772
  }, [o, p]);
5773
- const [w, x] = V(null);
5773
+ const [w, x] = I(null);
5774
5774
  if (!i)
5775
5775
  return /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: "Entity not found." });
5776
5776
  const N = ((k = e.quick_add) == null ? void 0 : k.fields) ?? [f == null ? void 0 : f.content_field].filter(Boolean), h = P((A = i.display) == null ? void 0 : A.name_plural) || P((_ = i.display) == null ? void 0 : _.name) || e.entity;
@@ -5803,10 +5803,10 @@ function el({ config: e, parentEntity: t, parentId: r, schema: s }) {
5803
5803
  }), m ? /* @__PURE__ */ d("div", { className: "flex flex-col h-full border-l border-[var(--border)] bg-[var(--muted)]/50 text-[var(--card-foreground)]", children: [
5804
5804
  /* @__PURE__ */ n("div", { className: "px-4 py-3 border-b border-[var(--border)] bg-[var(--card)]", children: /* @__PURE__ */ n("h3", { className: "text-sm font-semibold", children: h }) }),
5805
5805
  /* @__PURE__ */ n("div", { ref: g, className: "flex-1 overflow-y-auto p-3 space-y-2", children: v }),
5806
- /* @__PURE__ */ n(Nn, { config: e, parentEntity: t, parentId: r, schema: s })
5806
+ /* @__PURE__ */ n(bn, { config: e, parentEntity: t, parentId: r, schema: s })
5807
5807
  ] }) : /* @__PURE__ */ d("div", { children: [
5808
5808
  /* @__PURE__ */ n("div", { className: "space-y-2", children: v }),
5809
- /* @__PURE__ */ n(Nn, { config: e, parentEntity: t, parentId: r, schema: s })
5809
+ /* @__PURE__ */ n(bn, { config: e, parentEntity: t, parentId: r, schema: s })
5810
5810
  ] });
5811
5811
  }
5812
5812
  function tl({
@@ -5825,34 +5825,34 @@ function tl({
5825
5825
  onSaved: p,
5826
5826
  schema: g
5827
5827
  }) {
5828
- const y = Fe(), [b, w] = V({}), x = z(() => {
5828
+ const y = Fe(), [b, w] = I({}), x = z(() => {
5829
5829
  y.invalidateQueries({ queryKey: [Be, i, a, s] });
5830
5830
  }, [y, i, a, s]), N = Ee({
5831
- mutationFn: (O) => Kr(s, t, O),
5831
+ mutationFn: (E) => Vr(s, t, E),
5832
5832
  onSuccess: () => {
5833
5833
  x(), ie.success("Updated"), p();
5834
5834
  },
5835
- onError: (O) => ie.error(O.message)
5835
+ onError: (E) => ie.error(E.message)
5836
5836
  }), h = Ee({
5837
- mutationFn: () => Wr(s, t),
5837
+ mutationFn: () => Kr(s, t),
5838
5838
  onSuccess: () => {
5839
5839
  x(), ie.success("Deleted");
5840
5840
  },
5841
- onError: (O) => ie.error(O.message)
5841
+ onError: (E) => ie.error(E.message)
5842
5842
  }), v = z(() => {
5843
- const O = {};
5844
- for (const U of c) O[U] = e[U] ?? "";
5845
- w(O), f();
5846
- }, [e, c, f]), k = z((O, U) => {
5847
- w((B) => ({ ...B, [O]: U }));
5843
+ const E = {};
5844
+ for (const U of c) E[U] = e[U] ?? "";
5845
+ w(E), f();
5846
+ }, [e, c, f]), k = z((E, U) => {
5847
+ w((B) => ({ ...B, [E]: U }));
5848
5848
  }, []), A = l == null ? void 0 : l.time_field, _ = l == null ? void 0 : l.type_field, T = l == null ? void 0 : l.summary_field, $ = l == null ? void 0 : l.content_field, F = l == null ? void 0 : l.author_field, M = l == null ? void 0 : l.direction_field, q = l == null ? void 0 : l.intent_field;
5849
5849
  return u ? /* @__PURE__ */ d("div", { className: "rounded-lg border-2 border-[var(--primary)]/40 bg-[var(--card)] p-3 space-y-2", children: [
5850
- c.map((O) => {
5851
- const U = r.fields[O];
5850
+ c.map((E) => {
5851
+ const U = r.fields[E];
5852
5852
  return U ? /* @__PURE__ */ d("div", { children: [
5853
- /* @__PURE__ */ n("label", { className: "text-xs text-[var(--muted-foreground)] mb-1 block", children: De(U, O, g.entities) }),
5854
- oe({ field: U, fieldName: O, value: b[O] ?? "", mode: "edit", onChange: (B) => k(O, B), record: b })
5855
- ] }, O) : null;
5853
+ /* @__PURE__ */ n("label", { className: "text-xs text-[var(--muted-foreground)] mb-1 block", children: De(U, E, g.entities) }),
5854
+ oe({ field: U, fieldName: E, value: b[E] ?? "", mode: "edit", onChange: (B) => k(E, B), record: b })
5855
+ ] }, E) : null;
5856
5856
  }),
5857
5857
  /* @__PURE__ */ d("div", { className: "flex items-center gap-1.5 pt-1", children: [
5858
5858
  /* @__PURE__ */ d(j, { size: "sm", onClick: () => N.mutate(b), disabled: N.isPending, className: "h-7 text-xs gap-1", children: [
@@ -5970,28 +5970,28 @@ function sl({
5970
5970
  const _ = Array.from(k.cells).indexOf(v), T = Array.from(A.rows).indexOf(k);
5971
5971
  if (N.key === "Tab") {
5972
5972
  const M = N.shiftKey ? -1 : 1, q = Array.from(A.rows);
5973
- let O = T, U = _ + M;
5974
- for (; O >= 0 && O < q.length; )
5975
- if (U >= 0 && U < q[O].cells.length) {
5976
- const re = q[O].cells[U].querySelector("input, select, textarea, [tabindex]");
5973
+ let E = T, U = _ + M;
5974
+ for (; E >= 0 && E < q.length; )
5975
+ if (U >= 0 && U < q[E].cells.length) {
5976
+ const re = q[E].cells[U].querySelector("input, select, textarea, [tabindex]");
5977
5977
  if (re) {
5978
5978
  N.preventDefault(), re.focus();
5979
5979
  return;
5980
5980
  }
5981
5981
  U += M;
5982
5982
  } else
5983
- O += M, U = M > 0 ? 0 : ((($ = q[O]) == null ? void 0 : $.cells.length) ?? 1) - 1;
5983
+ E += M, U = M > 0 ? 0 : ((($ = q[E]) == null ? void 0 : $.cells.length) ?? 1) - 1;
5984
5984
  } else if (N.key === "Enter") {
5985
5985
  N.preventDefault();
5986
5986
  const M = Array.from(A.rows);
5987
5987
  if (T < M.length - 1) {
5988
- const q = M[T + 1].cells[_], O = q == null ? void 0 : q.querySelector("input, select, textarea, [tabindex]");
5989
- O && O.focus();
5988
+ const q = M[T + 1].cells[_], E = q == null ? void 0 : q.querySelector("input, select, textarea, [tabindex]");
5989
+ E && E.focus();
5990
5990
  } else
5991
5991
  g(), requestAnimationFrame(() => {
5992
- const q = A.querySelectorAll("tr"), O = q[q.length - 1];
5993
- if (O) {
5994
- const U = O.querySelector("input, select, textarea, [tabindex]");
5992
+ const q = A.querySelectorAll("tr"), E = q[q.length - 1];
5993
+ if (E) {
5994
+ const U = E.querySelector("input, select, textarea, [tabindex]");
5995
5995
  U && U.focus();
5996
5996
  }
5997
5997
  });
@@ -6064,7 +6064,7 @@ function sl({
6064
6064
  className: "h-7 w-7",
6065
6065
  onClick: () => b(N._key),
6066
6066
  title: "Undo delete",
6067
- children: /* @__PURE__ */ n(Dn, { className: "h-4 w-4" })
6067
+ children: /* @__PURE__ */ n(An, { className: "h-4 w-4" })
6068
6068
  }
6069
6069
  ) : /* @__PURE__ */ n(
6070
6070
  j,
@@ -6108,8 +6108,8 @@ function il({
6108
6108
  refs: l
6109
6109
  }) {
6110
6110
  var A;
6111
- const c = me(null), o = e.position_field, u = e.columns, f = Pn(
6112
- $n(Rn, { activationConstraint: { distance: 5 } })
6111
+ const c = me(null), o = e.position_field, u = e.columns, f = Dn(
6112
+ Pn($n, { activationConstraint: { distance: 5 } })
6113
6113
  ), m = new Set(Array.isArray(e.foreign_key) ? e.foreign_key : [e.foreign_key]), p = u.filter((_) => {
6114
6114
  if (m.has(_) || _ === o) return !1;
6115
6115
  const T = t.fields[_];
@@ -6134,8 +6134,8 @@ function il({
6134
6134
  ), x = z(() => {
6135
6135
  var F;
6136
6136
  const _ = s.filter((M) => !M._deleted).reduce((M, q) => {
6137
- const O = typeof q[o] == "number" ? q[o] : -1;
6138
- return Math.max(M, O);
6137
+ const E = typeof q[o] == "number" ? q[o] : -1;
6138
+ return Math.max(M, E);
6139
6139
  }, -1), T = {
6140
6140
  _key: crypto.randomUUID(),
6141
6141
  _dirty: !0,
@@ -6166,10 +6166,10 @@ function il({
6166
6166
  (_) => {
6167
6167
  const { active: T, over: $ } = _;
6168
6168
  if (!$ || T.id === $.id) return;
6169
- const F = s.filter((Y) => !Y._deleted), M = s.filter((Y) => Y._deleted), q = F.findIndex((Y) => Y._key === String(T.id)), O = F.findIndex((Y) => Y._key === String($.id));
6170
- if (q === -1 || O === -1) return;
6169
+ const F = s.filter((Y) => !Y._deleted), M = s.filter((Y) => Y._deleted), q = F.findIndex((Y) => Y._key === String(T.id)), E = F.findIndex((Y) => Y._key === String($.id));
6170
+ if (q === -1 || E === -1) return;
6171
6171
  const U = [...F], [B] = U.splice(q, 1);
6172
- U.splice(O, 0, B);
6172
+ U.splice(E, 0, B);
6173
6173
  const re = U.map((Y, R) => ({
6174
6174
  ...Y,
6175
6175
  [o]: R,
@@ -6187,15 +6187,15 @@ function il({
6187
6187
  if (!F) return;
6188
6188
  const M = F.closest("tbody");
6189
6189
  if (!M) return;
6190
- const q = Array.from(F.cells).indexOf($), O = Array.from(M.rows).indexOf(F);
6190
+ const q = Array.from(F.cells).indexOf($), E = Array.from(M.rows).indexOf(F);
6191
6191
  if (_.key === "Tab") {
6192
6192
  const re = _.shiftKey ? -1 : 1, Y = Array.from(M.rows);
6193
- let R = O, C = q + re;
6193
+ let R = E, C = q + re;
6194
6194
  for (; R >= 0 && R < Y.length; )
6195
6195
  if (C >= 0 && C < Y[R].cells.length) {
6196
- const K = Y[R].cells[C].querySelector("input, select, textarea, [tabindex]");
6197
- if (K) {
6198
- _.preventDefault(), K.focus();
6196
+ const V = Y[R].cells[C].querySelector("input, select, textarea, [tabindex]");
6197
+ if (V) {
6198
+ _.preventDefault(), V.focus();
6199
6199
  return;
6200
6200
  }
6201
6201
  C += re;
@@ -6204,8 +6204,8 @@ function il({
6204
6204
  } else if (_.key === "Enter") {
6205
6205
  _.preventDefault();
6206
6206
  const re = Array.from(M.rows);
6207
- if (O < re.length - 1) {
6208
- const Y = re[O + 1].cells[q], R = Y == null ? void 0 : Y.querySelector("input, select, textarea, [tabindex]");
6207
+ if (E < re.length - 1) {
6208
+ const Y = re[E + 1].cells[q], R = Y == null ? void 0 : Y.querySelector("input, select, textarea, [tabindex]");
6209
6209
  R && R.focus();
6210
6210
  } else
6211
6211
  x(), requestAnimationFrame(() => {
@@ -6221,10 +6221,10 @@ function il({
6221
6221
  );
6222
6222
  return /* @__PURE__ */ d("div", { children: [
6223
6223
  /* @__PURE__ */ n("div", { className: "overflow-x-auto", children: /* @__PURE__ */ n(
6224
- En,
6224
+ Rn,
6225
6225
  {
6226
6226
  sensors: f,
6227
- collisionDetection: On,
6227
+ collisionDetection: En,
6228
6228
  onDragEnd: v,
6229
6229
  children: /* @__PURE__ */ d("table", { ref: c, className: "w-full text-sm", onKeyDown: k, children: [
6230
6230
  /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ d("tr", { className: "border-b", children: [
@@ -6242,7 +6242,7 @@ function il({
6242
6242
  }),
6243
6243
  /* @__PURE__ */ n("th", { className: "h-8 w-10 px-2" })
6244
6244
  ] }) }),
6245
- /* @__PURE__ */ n(Fn, { items: b, strategy: mi, children: /* @__PURE__ */ n("tbody", { children: s.map((_) => /* @__PURE__ */ n(
6245
+ /* @__PURE__ */ n(On, { items: b, strategy: mi, children: /* @__PURE__ */ n("tbody", { children: s.map((_) => /* @__PURE__ */ n(
6246
6246
  al,
6247
6247
  {
6248
6248
  row: _,
@@ -6295,8 +6295,8 @@ function al({
6295
6295
  transform: b,
6296
6296
  transition: w,
6297
6297
  isDragging: x
6298
- } = Ln({ id: e._key, disabled: f }), N = {
6299
- transform: qn.Translate.toString(b),
6298
+ } = Fn({ id: e._key, disabled: f }), N = {
6299
+ transform: Ln.Translate.toString(b),
6300
6300
  transition: w,
6301
6301
  zIndex: x ? 10 : void 0,
6302
6302
  opacity: x ? 0.5 : void 0
@@ -6360,7 +6360,7 @@ function al({
6360
6360
  className: "h-7 w-7",
6361
6361
  onClick: () => u(e._key),
6362
6362
  title: "Undo delete",
6363
- children: /* @__PURE__ */ n(Dn, { className: "h-4 w-4" })
6363
+ children: /* @__PURE__ */ n(An, { className: "h-4 w-4" })
6364
6364
  }
6365
6365
  ) : /* @__PURE__ */ n(
6366
6366
  j,
@@ -6418,7 +6418,7 @@ function ol({ node: e, ctx: t }) {
6418
6418
  };
6419
6419
  switch (a.mode) {
6420
6420
  case "table":
6421
- return /* @__PURE__ */ n(xn, { ...l });
6421
+ return /* @__PURE__ */ n(yn, { ...l });
6422
6422
  case "list":
6423
6423
  return /* @__PURE__ */ n(Qo, { ...l });
6424
6424
  case "cards":
@@ -6426,7 +6426,7 @@ function ol({ node: e, ctx: t }) {
6426
6426
  case "timeline":
6427
6427
  return /* @__PURE__ */ n(el, { ...l });
6428
6428
  default:
6429
- return /* @__PURE__ */ n(xn, { ...l });
6429
+ return /* @__PURE__ */ n(yn, { ...l });
6430
6430
  }
6431
6431
  }
6432
6432
  function ll(e, t, r, s, i, a, l, c) {
@@ -6474,7 +6474,7 @@ function cl({
6474
6474
  const o = t === !0, u = r && r.length > 0;
6475
6475
  return !o && !u ? null : /* @__PURE__ */ d("div", { className: "flex items-center gap-2 mb-2", children: [
6476
6476
  o && /* @__PURE__ */ d("div", { className: "relative flex-1 max-w-[200px]", children: [
6477
- /* @__PURE__ */ n(Fr, { className: "absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-[var(--muted-foreground)]" }),
6477
+ /* @__PURE__ */ n(Or, { className: "absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-[var(--muted-foreground)]" }),
6478
6478
  /* @__PURE__ */ n(
6479
6479
  he,
6480
6480
  {
@@ -6527,7 +6527,7 @@ function dl({
6527
6527
  onChange: s
6528
6528
  }) {
6529
6529
  var f, m, p, g;
6530
- const i = Zn((f = e.ref) == null ? void 0 : f.entity), a = ((m = e.display) == null ? void 0 : m.ref_display_field) ?? ((p = i == null ? void 0 : i.display) == null ? void 0 : p.display_field), l = ee(
6530
+ const i = Bn((f = e.ref) == null ? void 0 : f.entity), a = ((m = e.display) == null ? void 0 : m.ref_display_field) ?? ((p = i == null ? void 0 : i.display) == null ? void 0 : p.display_field), l = ee(
6531
6531
  () => {
6532
6532
  var y;
6533
6533
  return i ? ((y = Object.entries(i.fields).find(([, b]) => b.primary)) == null ? void 0 : y[0]) ?? "id" : "id";
@@ -6675,7 +6675,7 @@ function ml({
6675
6675
  filterFields: u,
6676
6676
  sort: f
6677
6677
  }) {
6678
- const m = Fe(), [p, g] = V(""), [y, b] = V(""), [w, x] = V({}), N = me(void 0);
6678
+ const m = Fe(), [p, g] = I(""), [y, b] = I(""), [w, x] = I({}), N = me(void 0);
6679
6679
  le(() => (N.current && clearTimeout(N.current), N.current = setTimeout(() => {
6680
6680
  b(p);
6681
6681
  }, 300), () => {
@@ -6718,7 +6718,7 @@ function ml({
6718
6718
  for (const [Y, R] of Object.entries(re.$refs))
6719
6719
  B[Y] = { ...B[Y], ...R };
6720
6720
  return { rows: U, refs: B };
6721
- }, [k]), O = z(() => {
6721
+ }, [k]), E = z(() => {
6722
6722
  m.invalidateQueries({
6723
6723
  predicate: (U) => {
6724
6724
  const B = U.queryKey;
@@ -6754,7 +6754,7 @@ function ml({
6754
6754
  refs: q,
6755
6755
  isLoading: A,
6756
6756
  isError: _,
6757
- invalidateQuery: O
6757
+ invalidateQuery: E
6758
6758
  }
6759
6759
  ),
6760
6760
  T && /* @__PURE__ */ d(
@@ -6793,7 +6793,7 @@ function ws({
6793
6793
  const L = t.fields[C];
6794
6794
  return !(!L || L.auto || L.primary);
6795
6795
  })
6796
- ) : /* @__PURE__ */ new Set(), [i, s, t.fields, a]), [g, y] = V(null), [b, w] = V({}), x = me(b);
6796
+ ) : /* @__PURE__ */ new Set(), [i, s, t.fields, a]), [g, y] = I(null), [b, w] = I({}), x = me(b);
6797
6797
  x.current = b;
6798
6798
  const N = me({});
6799
6799
  le(() => {
@@ -6802,17 +6802,17 @@ function ws({
6802
6802
  for (const L of Object.values(C)) clearTimeout(L);
6803
6803
  };
6804
6804
  }, []);
6805
- const [h, v] = V(null), [k, A] = V([]), [_, T] = V(!1), [$, F] = V(null), [M, q] = V(/* @__PURE__ */ new Set()), O = z(
6806
- async (C, L, K) => {
6805
+ const [h, v] = I(null), [k, A] = I([]), [_, T] = I(!1), [$, F] = I(null), [M, q] = I(/* @__PURE__ */ new Set()), E = z(
6806
+ async (C, L, V) => {
6807
6807
  w((Q) => ({
6808
6808
  ...Q,
6809
6809
  [C]: { ...Q[C], saving: !0, error: void 0 }
6810
6810
  }));
6811
6811
  try {
6812
- await Kr(e, C, L), w((Q) => {
6812
+ await Vr(e, C, L), w((Q) => {
6813
6813
  const Z = Q[C];
6814
6814
  if (!Z) return Q;
6815
- if (Z.ver > K)
6815
+ if (Z.ver > V)
6816
6816
  return { ...Q, [C]: { ...Z, saving: !1 } };
6817
6817
  const { [C]: fe, ...Te } = Q;
6818
6818
  return Te;
@@ -6827,37 +6827,37 @@ function ws({
6827
6827
  },
6828
6828
  [e, m]
6829
6829
  ), U = z(
6830
- (C, L, K) => {
6830
+ (C, L, V) => {
6831
6831
  w((Q) => {
6832
6832
  const Z = Q[C] ?? { buffer: {}, ver: 0, saving: !1 }, fe = Z.ver + 1;
6833
6833
  return {
6834
6834
  ...Q,
6835
6835
  [C]: {
6836
6836
  ...Z,
6837
- buffer: { ...Z.buffer, [L]: K },
6837
+ buffer: { ...Z.buffer, [L]: V },
6838
6838
  ver: fe
6839
6839
  }
6840
6840
  };
6841
6841
  }), N.current[C] && clearTimeout(N.current[C]), N.current[C] = setTimeout(() => {
6842
6842
  const Q = x.current[C];
6843
- Q && Object.keys(Q.buffer).length > 0 && O(C, { ...Q.buffer }, Q.ver);
6843
+ Q && Object.keys(Q.buffer).length > 0 && E(C, { ...Q.buffer }, Q.ver);
6844
6844
  }, 500);
6845
6845
  },
6846
- [O]
6846
+ [E]
6847
6847
  ), B = z(() => {
6848
6848
  const C = {};
6849
6849
  C[s] = r;
6850
6850
  for (const L of i) {
6851
- const K = t.fields[L];
6852
- K && (K.default !== void 0 ? C[L] = K.default : K.type === "bool" && (C[L] = !1));
6851
+ const V = t.fields[L];
6852
+ V && (V.default !== void 0 ? C[L] = V.default : V.type === "bool" && (C[L] = !1));
6853
6853
  }
6854
6854
  v(C), A([]);
6855
6855
  }, [s, r, i, t.fields]), re = z(async () => {
6856
6856
  if (!h) return;
6857
6857
  const C = [];
6858
6858
  for (const L of i) {
6859
- const K = t.fields[L];
6860
- if (!K || !K.required || K.auto || K.primary || L === s) continue;
6859
+ const V = t.fields[L];
6860
+ if (!V || !V.required || V.auto || V.primary || L === s) continue;
6861
6861
  const Q = h[L];
6862
6862
  (Q == null || Q === "") && C.push(L);
6863
6863
  }
@@ -6867,10 +6867,10 @@ function ws({
6867
6867
  }
6868
6868
  T(!0);
6869
6869
  try {
6870
- await Vr(e, h), v(null), A([]), m();
6870
+ await Ir(e, h), v(null), A([]), m();
6871
6871
  } catch (L) {
6872
- const K = L instanceof Error ? L.message : "Create failed";
6873
- A([`_error:${K}`]);
6872
+ const V = L instanceof Error ? L.message : "Create failed";
6873
+ A([`_error:${V}`]);
6874
6874
  } finally {
6875
6875
  T(!1);
6876
6876
  }
@@ -6878,12 +6878,12 @@ function ws({
6878
6878
  async (C) => {
6879
6879
  F(null), q((L) => new Set(L).add(C));
6880
6880
  try {
6881
- await Wr(e, C), m();
6881
+ await Kr(e, C), m();
6882
6882
  } catch {
6883
6883
  } finally {
6884
6884
  q((L) => {
6885
- const K = new Set(L);
6886
- return K.delete(C), K;
6885
+ const V = new Set(L);
6886
+ return V.delete(C), V;
6887
6887
  });
6888
6888
  }
6889
6889
  },
@@ -6916,7 +6916,7 @@ function ws({
6916
6916
  ] }) }),
6917
6917
  /* @__PURE__ */ d("tbody", { children: [
6918
6918
  c.map((C) => {
6919
- const L = String(C.id ?? ""), K = M.has(L), Q = b[L];
6919
+ const L = String(C.id ?? ""), V = M.has(L), Q = b[L];
6920
6920
  return /* @__PURE__ */ n(
6921
6921
  pl,
6922
6922
  {
@@ -6926,7 +6926,7 @@ function ws({
6926
6926
  columns: i,
6927
6927
  editableColumns: p,
6928
6928
  editable: a,
6929
- isDeleting: K,
6929
+ isDeleting: V,
6930
6930
  activeCell: g,
6931
6931
  setActiveCell: y,
6932
6932
  rowState: Q,
@@ -6951,7 +6951,7 @@ function ws({
6951
6951
  foreignKey: s,
6952
6952
  draftErrors: k,
6953
6953
  draftSaving: _,
6954
- onChange: (C, L) => v((K) => K && { ...K, [C]: L }),
6954
+ onChange: (C, L) => v((V) => V && { ...V, [C]: L }),
6955
6955
  onConfirm: re,
6956
6956
  onCancel: () => {
6957
6957
  v(null), A([]);
@@ -6976,7 +6976,7 @@ function ws({
6976
6976
  }
6977
6977
  ),
6978
6978
  $ && /* @__PURE__ */ n(
6979
- en,
6979
+ Zr,
6980
6980
  {
6981
6981
  open: $.show,
6982
6982
  onOpenChange: (C) => !C && F(null),
@@ -7157,7 +7157,7 @@ function gl({ fields: e, ctx: t }) {
7157
7157
  refs: t.refs
7158
7158
  }) }),
7159
7159
  y && /* @__PURE__ */ n("div", { className: "flex items-center gap-1 shrink-0", children: f.actions.map((b, w) => /* @__PURE__ */ n(
7160
- sn,
7160
+ nn,
7161
7161
  {
7162
7162
  actionCode: `${m}.action[${w}]`,
7163
7163
  action: b,
@@ -7363,36 +7363,36 @@ function Sl(e, t) {
7363
7363
  }
7364
7364
  return r;
7365
7365
  }
7366
- const wn = () => {
7366
+ const Nn = () => {
7367
7367
  };
7368
7368
  function kl(e, t) {
7369
7369
  return e.length !== t.length ? !1 : JSON.stringify(e) === JSON.stringify(t);
7370
7370
  }
7371
7371
  function Cl({ screenCode: e }) {
7372
7372
  var we, de, ge, Me, Ae, He, nt;
7373
- const { id: t } = Ls(), r = Xe(), [s, i] = yt(), { data: a } = qe(), l = ct((E) => E.user), c = a == null ? void 0 : a.screens[e], o = c != null && c.entity ? a == null ? void 0 : a.entities[c.entity] : void 0, u = c == null ? void 0 : c.entity, f = (c == null ? void 0 : c.self) === !0, m = f ? l == null ? void 0 : l.id : t, p = !f && m === "new", g = ee(() => {
7373
+ const { id: t } = Ls(), r = Xe(), [s, i] = yt(), { data: a } = qe(), l = ct((O) => O.user), c = a == null ? void 0 : a.screens[e], o = c != null && c.entity ? a == null ? void 0 : a.entities[c.entity] : void 0, u = c == null ? void 0 : c.entity, f = (c == null ? void 0 : c.self) === !0, m = f ? l == null ? void 0 : l.id : t, p = !f && m === "new", g = ee(() => {
7374
7374
  if (!m || p) return;
7375
7375
  if (!o) return m;
7376
- const E = jr(o);
7377
- if (E.length === 1)
7378
- return { [E[0]]: m };
7379
- const W = m.split("|"), I = {};
7380
- for (let se = 0; se < E.length; se++)
7381
- I[E[se]] = W[se] ?? "";
7382
- return I;
7376
+ const O = qr(o);
7377
+ if (O.length === 1)
7378
+ return { [O[0]]: m };
7379
+ const W = m.split("|"), K = {};
7380
+ for (let se = 0; se < O.length; se++)
7381
+ K[O[se]] = W[se] ?? "";
7382
+ return K;
7383
7383
  }, [m, p, o]), y = ee(() => {
7384
7384
  if (g)
7385
- return typeof g == "string" ? g : cn(g);
7386
- }, [g]), { data: b, isLoading: w } = bs(u, g), x = ua(u ?? ""), N = Jn(u ?? ""), h = Qn(u ?? ""), v = fa(u ?? ""), k = Object.keys((o == null ? void 0 : o.status_groups) ?? {}).length > 0, A = b == null ? void 0 : b.data, _ = A == null ? void 0 : A.$statuses, T = A == null ? void 0 : A.$properties, $ = s.get("edit") === "true", [F, M] = V(p || $), [q, O] = V({}), [U, B] = V({}), [re, Y] = V({}), [R, C] = V(void 0), [L, K] = V(void 0), [Q, Z] = V({ show: !1 }), [fe, Te] = V(() => {
7387
- const E = parseInt((c == null ? void 0 : c.sidebar_width) || "380", 10);
7388
- return isNaN(E) ? 380 : E;
7385
+ return typeof g == "string" ? g : ln(g);
7386
+ }, [g]), { data: b, isLoading: w } = bs(u, g), x = ua(u ?? ""), N = Hn(u ?? ""), h = Jn(u ?? ""), v = fa(u ?? ""), k = Object.keys((o == null ? void 0 : o.status_groups) ?? {}).length > 0, A = b == null ? void 0 : b.data, _ = A == null ? void 0 : A.$statuses, T = A == null ? void 0 : A.$properties, $ = s.get("edit") === "true", [F, M] = I(p || $), [q, E] = I({}), [U, B] = I({}), [re, Y] = I({}), [R, C] = I(void 0), [L, V] = I(void 0), [Q, Z] = I({ show: !1 }), [fe, Te] = I(() => {
7387
+ const O = parseInt((c == null ? void 0 : c.sidebar_width) || "380", 10);
7388
+ return isNaN(O) ? 380 : O;
7389
7389
  }), Ne = me(null), be = me(null), je = z(
7390
- (E) => {
7391
- E.preventDefault();
7390
+ (O) => {
7391
+ O.preventDefault();
7392
7392
  const W = Ne.current;
7393
7393
  if (!W) return;
7394
- const I = W.offsetWidth;
7395
- be.current = { startX: E.clientX, startW: I };
7394
+ const K = W.offsetWidth;
7395
+ be.current = { startX: O.clientX, startW: K };
7396
7396
  const se = (Re) => {
7397
7397
  if (!be.current) return;
7398
7398
  const kt = be.current.startX - Re.clientX, Ot = Math.max(280, Math.min(800, be.current.startW + kt));
@@ -7403,125 +7403,125 @@ function Cl({ screenCode: e }) {
7403
7403
  document.addEventListener("mousemove", se), document.addEventListener("mouseup", ce);
7404
7404
  },
7405
7405
  []
7406
- ), X = b == null ? void 0 : b.data, dt = X == null ? void 0 : X.$refs, Ze = !!(o != null && o.soft_delete), Ye = Ze && X != null && X[o.soft_delete] != null, Se = Pr(), { openTab: ut, updateTabTitle: wt, findTabByPathname: At } = ht();
7406
+ ), X = b == null ? void 0 : b.data, dt = X == null ? void 0 : X.$refs, Ze = !!(o != null && o.soft_delete), Ye = Ze && X != null && X[o.soft_delete] != null, Se = Dr(), { openTab: ut, updateTabTitle: wt, findTabByPathname: At } = ht();
7407
7407
  le(() => {
7408
7408
  var ce, Re;
7409
7409
  if (!o || f) return;
7410
- const E = Se.pathname, W = P((ce = c == null ? void 0 : c.display) == null ? void 0 : ce.name) || P(o.display.name), I = ((Re = c == null ? void 0 : c.display) == null ? void 0 : Re.icon) || o.display.icon;
7411
- At(E) || ut({
7412
- pathname: E,
7410
+ const O = Se.pathname, W = P((ce = c == null ? void 0 : c.display) == null ? void 0 : ce.name) || P(o.display.name), K = ((Re = c == null ? void 0 : c.display) == null ? void 0 : Re.icon) || o.display.icon;
7411
+ At(O) || ut({
7412
+ pathname: O,
7413
7413
  search: "",
7414
7414
  title: p ? `New ${W}` : W,
7415
- icon: I,
7415
+ icon: K,
7416
7416
  closable: !0
7417
7417
  });
7418
7418
  }, [Se.pathname, (de = (we = c == null ? void 0 : c.display) == null ? void 0 : we.name) == null ? void 0 : de.en, (ge = o == null ? void 0 : o.display.name) == null ? void 0 : ge.en, (Me = c == null ? void 0 : c.display) == null ? void 0 : Me.icon, o == null ? void 0 : o.display.icon, p, f]), le(() => {
7419
- var W, I;
7419
+ var W, K;
7420
7420
  if (!X || !o || f) return;
7421
- const E = At(Se.pathname);
7422
- if (E) {
7423
- const se = (W = o.display) == null ? void 0 : W.display_field, ce = se ? X[se] : void 0, Re = ce && typeof ce == "object" && !Array.isArray(ce) ? P(ce) : ce, kt = Re ? String(Re) : P((I = c == null ? void 0 : c.display) == null ? void 0 : I.name) || P(o.display.name);
7424
- wt(E.id, kt);
7421
+ const O = At(Se.pathname);
7422
+ if (O) {
7423
+ const se = (W = o.display) == null ? void 0 : W.display_field, ce = se ? X[se] : void 0, Re = ce && typeof ce == "object" && !Array.isArray(ce) ? P(ce) : ce, kt = Re ? String(Re) : P((K = c == null ? void 0 : c.display) == null ? void 0 : K.name) || P(o.display.name);
7424
+ wt(O.id, kt);
7425
7425
  }
7426
7426
  }, [X, (Ae = o == null ? void 0 : o.display.name) == null ? void 0 : Ae.en, o == null ? void 0 : o.display.display_field, Se.pathname, f]);
7427
7427
  const et = ee(() => {
7428
7428
  if (!o) return /* @__PURE__ */ new Set();
7429
- const E = /* @__PURE__ */ new Set();
7430
- for (const [W, I] of Object.entries(o.fields))
7431
- !I.auto && !I.primary && E.add(W);
7432
- return E;
7429
+ const O = /* @__PURE__ */ new Set();
7430
+ for (const [W, K] of Object.entries(o.fields))
7431
+ !K.auto && !K.primary && O.add(W);
7432
+ return O;
7433
7433
  }, [o]);
7434
7434
  le(() => {
7435
7435
  if (!(!$ || !X || et.size === 0)) {
7436
7436
  if (F || M(!0), Object.keys(q).length === 0) {
7437
- const E = {};
7437
+ const O = {};
7438
7438
  et.forEach((W) => {
7439
- E[W] = X[W] ?? "";
7440
- }), O(E);
7439
+ O[W] = X[W] ?? "";
7440
+ }), E(O);
7441
7441
  }
7442
- i((E) => {
7443
- const W = new URLSearchParams(E);
7442
+ i((O) => {
7443
+ const W = new URLSearchParams(O);
7444
7444
  return W.delete("edit"), W;
7445
7445
  }, { replace: !0 });
7446
7446
  }
7447
7447
  }, [$, X, et]), le(() => {
7448
- !p || !(o != null && o.children) || o.children.length === 0 || R === void 0 && (C({}), K({}));
7448
+ !p || !(o != null && o.children) || o.children.length === 0 || R === void 0 && (C({}), V({}));
7449
7449
  }, [p, o == null ? void 0 : o.children]);
7450
7450
  const We = z(() => {
7451
7451
  if (X) {
7452
7452
  const W = {};
7453
- et.forEach((I) => {
7454
- W[I] = X[I] ?? "";
7455
- }), O(W);
7453
+ et.forEach((K) => {
7454
+ W[K] = X[K] ?? "";
7455
+ }), E(W);
7456
7456
  }
7457
- const E = X == null ? void 0 : X.$children;
7458
- if (E && Object.keys(E).length > 0) {
7457
+ const O = X == null ? void 0 : X.$children;
7458
+ if (O && Object.keys(O).length > 0) {
7459
7459
  const W = {};
7460
- for (const [I, se] of Object.entries(E))
7461
- W[I] = se.map((ce) => ({
7460
+ for (const [K, se] of Object.entries(O))
7461
+ W[K] = se.map((ce) => ({
7462
7462
  ...ce,
7463
7463
  _key: String(ce.id ?? crypto.randomUUID())
7464
7464
  }));
7465
- C(W), K(E);
7466
- } else o != null && o.children && o.children.length > 0 && (C({}), K({}));
7465
+ C(W), V(O);
7466
+ } else o != null && o.children && o.children.length > 0 && (C({}), V({}));
7467
7467
  M(!0);
7468
7468
  }, [X, et, o == null ? void 0 : o.children]), ar = z(() => {
7469
- var E;
7469
+ var O;
7470
7470
  if (p) {
7471
- const W = ((E = c == null ? void 0 : c.route) == null ? void 0 : E.replace("/:id", "")) ?? "/";
7471
+ const W = ((O = c == null ? void 0 : c.route) == null ? void 0 : O.replace("/:id", "")) ?? "/";
7472
7472
  r(W);
7473
7473
  } else
7474
- M(!1), O({}), B({}), Y({}), C(void 0), K(void 0);
7475
- }, [p, c, r]), or = z((E, W) => {
7476
- O((I) => ({ ...I, [E]: W }));
7474
+ M(!1), E({}), B({}), Y({}), C(void 0), V(void 0);
7475
+ }, [p, c, r]), or = z((O, W) => {
7476
+ E((K) => ({ ...K, [O]: W }));
7477
7477
  }, []), Pe = ee(() => {
7478
7478
  if (!(c != null && c.route)) return "/";
7479
- const E = c.route.split("/");
7480
- return E.pop(), E.join("/") || "/";
7481
- }, [c]), Dt = ee(() => !(a != null && a.screens) || !Pe || Pe === "/" ? !1 : Object.values(a.screens).some((E) => E.route === Pe), [a, Pe]), lr = z(() => {
7479
+ const O = c.route.split("/");
7480
+ return O.pop(), O.join("/") || "/";
7481
+ }, [c]), Dt = ee(() => !(a != null && a.screens) || !Pe || Pe === "/" ? !1 : Object.values(a.screens).some((O) => O.route === Pe), [a, Pe]), lr = z(() => {
7482
7482
  if (!u) return;
7483
- const E = {};
7483
+ const O = {};
7484
7484
  if (p)
7485
- for (const [I, se] of Object.entries(q))
7486
- se !== "" && se !== null && se !== void 0 && (E[I] = se);
7485
+ for (const [K, se] of Object.entries(q))
7486
+ se !== "" && se !== null && se !== void 0 && (O[K] = se);
7487
7487
  else
7488
- for (const [I, se] of Object.entries(q)) {
7489
- const ce = X == null ? void 0 : X[I];
7490
- (se === "" ? null : se) !== (ce === "" || ce === void 0 ? null : ce) && (E[I] = se);
7488
+ for (const [K, se] of Object.entries(q)) {
7489
+ const ce = X == null ? void 0 : X[K];
7490
+ (se === "" ? null : se) !== (ce === "" || ce === void 0 ? null : ce) && (O[K] = se);
7491
7491
  }
7492
- if (Object.keys(U).length > 0 && (E.$statuses = Object.entries(U).map(
7493
- ([I, se]) => ({ status_group_code: I, status_code: se })
7494
- )), Object.keys(re).length > 0 && (E.$properties = Object.entries(re).map(
7495
- ([I, se]) => ({ property_code: I, value: se })
7492
+ if (Object.keys(U).length > 0 && (O.$statuses = Object.entries(U).map(
7493
+ ([K, se]) => ({ status_group_code: K, status_code: se })
7494
+ )), Object.keys(re).length > 0 && (O.$properties = Object.entries(re).map(
7495
+ ([K, se]) => ({ property_code: K, value: se })
7496
7496
  )), R) {
7497
- const I = {};
7497
+ const K = {};
7498
7498
  for (const [se, ce] of Object.entries(R)) {
7499
7499
  const Re = ce.filter((Ot) => !Ot._deleted).map((Ot) => {
7500
7500
  const { _key: Xl, _deleted: Bl, _dirty: Zl, ...$s } = Ot;
7501
7501
  return $s;
7502
7502
  }), kt = (L == null ? void 0 : L[se]) ?? [];
7503
- (p || !kl(Re, kt)) && (I[se] = Re);
7503
+ (p || !kl(Re, kt)) && (K[se] = Re);
7504
7504
  }
7505
- Object.keys(I).length > 0 && (E.$children = I);
7505
+ Object.keys(K).length > 0 && (O.$children = K);
7506
7506
  }
7507
- if (!p && Object.keys(E).length === 0) {
7508
- M(!1), B({}), Y({}), C(void 0), K(void 0);
7507
+ if (!p && Object.keys(O).length === 0) {
7508
+ M(!1), B({}), Y({}), C(void 0), V(void 0);
7509
7509
  return;
7510
7510
  }
7511
7511
  const W = () => {
7512
- M(!1), B({}), Y({}), C(void 0), K(void 0);
7512
+ M(!1), B({}), Y({}), C(void 0), V(void 0);
7513
7513
  };
7514
- p ? x.mutate(E, {
7515
- onSuccess: (I) => {
7516
- const se = I.data, ce = o ? Ci(o, se) : {}, Re = cn(ce);
7514
+ p ? x.mutate(O, {
7515
+ onSuccess: (K) => {
7516
+ const se = K.data, ce = o ? Ci(o, se) : {}, Re = ln(ce);
7517
7517
  Re ? r(`${Pe}/${encodeURIComponent(Re)}`, { replace: !0 }) : r(Pe, { replace: !0 }), W();
7518
7518
  }
7519
7519
  }) : g && N.mutate(
7520
- { pkValues: g, data: E },
7520
+ { pkValues: g, data: O },
7521
7521
  { onSuccess: W }
7522
7522
  );
7523
- }, [p, m, u, q, U, re, R, L, x, N, o, r, Pe, X]), cr = z((E, W) => {
7524
- C((I) => ({ ...I ?? {}, [E]: W }));
7523
+ }, [p, m, u, q, U, re, R, L, x, N, o, r, Pe, X]), cr = z((O, W) => {
7524
+ C((K) => ({ ...K ?? {}, [O]: W }));
7525
7525
  }, []), $e = z(() => {
7526
7526
  !g || p || h.mutate(g, {
7527
7527
  onSuccess: () => r(Pe, { replace: !0 })
@@ -7533,18 +7533,13 @@ function Cl({ screenCode: e }) {
7533
7533
  [R, a]
7534
7534
  ), $t = Object.keys(ft).length > 0;
7535
7535
  if (!c || !o) return null;
7536
- if (!p && w) return /* @__PURE__ */ n(ts, {});
7536
+ if (!p && w) return /* @__PURE__ */ n(es, {});
7537
7537
  if (!p && !X)
7538
7538
  return /* @__PURE__ */ d("div", { className: "p-6", children: [
7539
7539
  /* @__PURE__ */ n(Bt, { title: "Not Found", backTo: Dt ? Pe : void 0 }),
7540
7540
  /* @__PURE__ */ n("p", { className: "text-[var(--muted-foreground)]", children: "Record not found." })
7541
7541
  ] });
7542
- const Wt = o.display, tt = P((He = c.display) == null ? void 0 : He.name) || P(Wt.name), Rt = (nt = o.display) == null ? void 0 : nt.display_field, rt = Rt ? X == null ? void 0 : X[Rt] : void 0, Et = rt && typeof rt == "object" && !Array.isArray(rt) ? P(rt) : rt, Ht = p ? `New ${tt}` : Et ? String(Et) : tt, _t = x.isPending || N.isPending, St = c.actions !== void 0, S = St ? Cr(o.actions, c.actions, "detail", a == null ? void 0 : a.actions) : (() => {
7543
- const E = kr(o.actions, "detail"), W = kr(o.actions, "toolbar").filter((I) => I.action.scope === "single" || I.action.scope === "global");
7544
- return [...E, ...W.filter(
7545
- (I) => !E.some((se) => se.code === I.code)
7546
- )];
7547
- })(), D = {
7542
+ const Wt = o.display, tt = P((He = c.display) == null ? void 0 : He.name) || P(Wt.name), Rt = (nt = o.display) == null ? void 0 : nt.display_field, rt = Rt ? X == null ? void 0 : X[Rt] : void 0, Et = rt && typeof rt == "object" && !Array.isArray(rt) ? P(rt) : rt, Ht = p ? `New ${tt}` : Et ? String(Et) : tt, _t = x.isPending || N.isPending, St = c.actions !== void 0, S = St ? kr(o.actions, c.actions, "detail", a == null ? void 0 : a.actions) : us(o.actions, "detail"), D = {
7548
7543
  schema: a,
7549
7544
  entity: o,
7550
7545
  entityCode: u,
@@ -7555,30 +7550,30 @@ function Cl({ screenCode: e }) {
7555
7550
  onFieldChange: F ? or : void 0,
7556
7551
  refs: dt,
7557
7552
  objectProperties: (() => {
7558
- const E = T ?? [];
7559
- if (!F || Object.keys(re).length === 0) return E.length > 0 ? E : void 0;
7560
- const W = E.map(
7561
- (I) => re[I.property_code] !== void 0 ? { ...I, value: re[I.property_code] } : I
7553
+ const O = T ?? [];
7554
+ if (!F || Object.keys(re).length === 0) return O.length > 0 ? O : void 0;
7555
+ const W = O.map(
7556
+ (K) => re[K.property_code] !== void 0 ? { ...K, value: re[K.property_code] } : K
7562
7557
  );
7563
- for (const [I, se] of Object.entries(re))
7564
- E.some((ce) => ce.property_code === I) || W.push({ property_code: I, name: {}, type: "string", value: se });
7558
+ for (const [K, se] of Object.entries(re))
7559
+ O.some((ce) => ce.property_code === K) || W.push({ property_code: K, name: {}, type: "string", value: se });
7565
7560
  return W;
7566
7561
  })(),
7567
- onSetProperty: p || o != null && o.readonly ? void 0 : F ? (E, W) => Y((I) => ({ ...I, [E]: W })) : void 0,
7562
+ onSetProperty: p || o != null && o.readonly ? void 0 : F ? (O, W) => Y((K) => ({ ...K, [O]: W })) : void 0,
7568
7563
  isPropertyPending: !1,
7569
7564
  // In edit mode, merge pending status changes into displayed statuses and
7570
7565
  // store changes locally (saved atomically on Save, discarded on Cancel).
7571
7566
  objectStatuses: (() => {
7572
- const E = _ ?? [];
7573
- if (!F || Object.keys(U).length === 0) return E.length > 0 ? E : void 0;
7574
- const W = E.map(
7575
- (I) => U[I.group_code] !== void 0 ? { ...I, status_code: U[I.group_code] } : I
7567
+ const O = _ ?? [];
7568
+ if (!F || Object.keys(U).length === 0) return O.length > 0 ? O : void 0;
7569
+ const W = O.map(
7570
+ (K) => U[K.group_code] !== void 0 ? { ...K, status_code: U[K.group_code] } : K
7576
7571
  );
7577
- for (const [I, se] of Object.entries(U))
7578
- E.some((ce) => ce.group_code === I) || W.push({ group_code: I, status_code: se, status_name: {}, set_at: (/* @__PURE__ */ new Date()).toISOString() });
7572
+ for (const [K, se] of Object.entries(U))
7573
+ O.some((ce) => ce.group_code === K) || W.push({ group_code: K, status_code: se, status_name: {}, set_at: (/* @__PURE__ */ new Date()).toISOString() });
7579
7574
  return W;
7580
7575
  })(),
7581
- onSetStatus: p || o != null && o.readonly ? void 0 : F ? (E, W) => B((I) => ({ ...I, [E]: W })) : void 0,
7576
+ onSetStatus: p || o != null && o.readonly ? void 0 : F ? (O, W) => B((K) => ({ ...K, [O]: W })) : void 0,
7582
7577
  isStatusPending: !1,
7583
7578
  // Children editing context for direct (aggregate) children.
7584
7579
  pendingChildren: F ? R : void 0,
@@ -7590,7 +7585,7 @@ function Cl({ screenCode: e }) {
7590
7585
  title: Ht,
7591
7586
  backTo: f || !Dt ? void 0 : Pe,
7592
7587
  actions: Ye ? /* @__PURE__ */ d(j, { onClick: Pt, disabled: v.isPending, children: [
7593
- /* @__PURE__ */ n(An, { className: "w-4 h-4" }),
7588
+ /* @__PURE__ */ n(Tn, { className: "w-4 h-4" }),
7594
7589
  v.isPending ? "Restoring..." : "Restore"
7595
7590
  ] }) : F ? /* @__PURE__ */ d(pe, { children: [
7596
7591
  /* @__PURE__ */ d(j, { variant: "outline", onClick: ar, disabled: _t, children: [
@@ -7604,17 +7599,17 @@ function Cl({ screenCode: e }) {
7604
7599
  disabled: _t || $t,
7605
7600
  title: $t ? "Fix errors in child rows" : void 0,
7606
7601
  children: [
7607
- /* @__PURE__ */ n(Or, { className: "w-4 h-4" }),
7602
+ /* @__PURE__ */ n(Er, { className: "w-4 h-4" }),
7608
7603
  _t ? "Saving..." : "Save"
7609
7604
  ]
7610
7605
  }
7611
7606
  )
7612
7607
  ] }) : /* @__PURE__ */ d(pe, { children: [
7613
- !p && m && S.map(({ code: E, action: W }) => {
7614
- var I, se;
7608
+ !p && m && S.map(({ code: O, action: W }) => {
7609
+ var K, se;
7615
7610
  if (W.type === "edit") {
7616
7611
  const ce = X ? pt(W.conditions, X) : !0;
7617
- return /* @__PURE__ */ n(j, { variant: "outline", onClick: We, disabled: !ce, children: P((I = W.display) == null ? void 0 : I.name) || "Edit" }, E);
7612
+ return /* @__PURE__ */ n(j, { variant: "outline", onClick: We, disabled: !ce, children: P((K = W.display) == null ? void 0 : K.name) || "Edit" }, O);
7618
7613
  }
7619
7614
  if (W.type === "delete" && !f) {
7620
7615
  const ce = X ? pt(W.conditions, X) : !0;
@@ -7630,20 +7625,20 @@ function Cl({ screenCode: e }) {
7630
7625
  P((se = W.display) == null ? void 0 : se.name) || "Delete"
7631
7626
  ]
7632
7627
  },
7633
- E
7628
+ O
7634
7629
  );
7635
7630
  }
7636
7631
  return /* @__PURE__ */ n(
7637
- sn,
7632
+ nn,
7638
7633
  {
7639
- actionCode: E,
7634
+ actionCode: O,
7640
7635
  action: W,
7641
7636
  entityCode: u,
7642
7637
  objectIds: W.scope !== "global" ? [m] : void 0,
7643
7638
  row: X,
7644
7639
  variant: "outline"
7645
7640
  },
7646
- E
7641
+ O
7647
7642
  );
7648
7643
  }),
7649
7644
  !St && !(o != null && o.readonly) && /* @__PURE__ */ n(j, { variant: "outline", onClick: We, children: "Edit" }),
@@ -7662,7 +7657,7 @@ function Cl({ screenCode: e }) {
7662
7657
  ] })
7663
7658
  }
7664
7659
  ), te = Ye && /* @__PURE__ */ d("div", { className: "flex items-center gap-2 px-4 py-3 mb-4 rounded-md border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 text-sm text-[var(--destructive)]", children: [
7665
- /* @__PURE__ */ n(Cn, { className: "w-4 h-4 shrink-0" }),
7660
+ /* @__PURE__ */ n(kn, { className: "w-4 h-4 shrink-0" }),
7666
7661
  /* @__PURE__ */ d("span", { children: [
7667
7662
  "This record was deleted on",
7668
7663
  " ",
@@ -7673,7 +7668,7 @@ function Cl({ screenCode: e }) {
7673
7668
  {
7674
7669
  statusGroups: o.status_groups ?? {},
7675
7670
  objectStatuses: D.objectStatuses,
7676
- onSetStatus: o != null && o.readonly ? wn : F ? (E, W) => B((I) => ({ ...I, [E]: W })) : wn,
7671
+ onSetStatus: o != null && o.readonly ? Nn : F ? (O, W) => B((K) => ({ ...K, [O]: W })) : Nn,
7677
7672
  isPending: !1,
7678
7673
  mode: F && !(o != null && o.readonly) ? "edit" : "display"
7679
7674
  }
@@ -7691,10 +7686,10 @@ function Cl({ screenCode: e }) {
7691
7686
  ] })
7692
7687
  ] })
7693
7688
  ] }), Ce = /* @__PURE__ */ n(
7694
- en,
7689
+ Zr,
7695
7690
  {
7696
7691
  open: Q.show,
7697
- onOpenChange: (E) => !E && Z({ show: !1 }),
7692
+ onOpenChange: (O) => !O && Z({ show: !1 }),
7698
7693
  title: `Delete ${tt}`,
7699
7694
  description: Q.confirmation ? Q.confirmation : Ze ? `Are you sure you want to delete this ${tt.toLowerCase()}? It can be restored later by an admin.` : `Are you sure you want to delete this ${tt.toLowerCase()}? This action cannot be undone.`,
7700
7695
  confirmLabel: "Delete",
@@ -7812,17 +7807,17 @@ function Rl({ screenCode: e }) {
7812
7807
  le(() => {
7813
7808
  var R, C;
7814
7809
  if (i != null && i.route && a) {
7815
- const L = P((R = i.display) == null ? void 0 : R.name) || P(a.display.name_plural), K = ((C = i.display) == null ? void 0 : C.icon) || a.display.icon;
7810
+ const L = P((R = i.display) == null ? void 0 : R.name) || P(a.display.name_plural), V = ((C = i.display) == null ? void 0 : C.icon) || a.display.icon;
7816
7811
  c({
7817
7812
  pathname: i.route,
7818
7813
  search: t.toString(),
7819
7814
  title: L,
7820
- icon: K,
7815
+ icon: V,
7821
7816
  closable: !0
7822
7817
  });
7823
7818
  }
7824
7819
  }, [i == null ? void 0 : i.route, (re = (B = i == null ? void 0 : i.display) == null ? void 0 : B.name) == null ? void 0 : re.en, (Y = a == null ? void 0 : a.display.name_plural) == null ? void 0 : Y.en]);
7825
- const o = t.get("selected") ?? null, u = t.get("search") ?? "", f = Yn(u, 300), m = t.get("sort") ?? (i == null ? void 0 : i.sort_default) ?? "", p = ee(() => {
7820
+ const o = t.get("selected") ?? null, u = t.get("search") ?? "", f = Gn(u, 300), m = t.get("sort") ?? (i == null ? void 0 : i.sort_default) ?? "", p = ee(() => {
7826
7821
  const R = t.get("filters");
7827
7822
  if (R)
7828
7823
  try {
@@ -7872,15 +7867,15 @@ function Rl({ screenCode: e }) {
7872
7867
  (R, C) => {
7873
7868
  r(
7874
7869
  (L) => {
7875
- const K = new URLSearchParams(L), Q = gs(L);
7870
+ const V = new URLSearchParams(L), Q = gs(L);
7876
7871
  let Z;
7877
- return C && C !== "__all__" ? Z = [...zt(Q, R), uo(R, C)] : Z = zt(Q, R), vs(Z, K), K;
7872
+ return C && C !== "__all__" ? Z = [...zt(Q, R), uo(R, C)] : Z = zt(Q, R), vs(Z, V), V;
7878
7873
  },
7879
7874
  { replace: !0 }
7880
7875
  );
7881
7876
  },
7882
7877
  [r]
7883
- ), k = (i == null ? void 0 : i.list_resizable) ?? !1, A = me(null), [_, T] = V(null), $ = me(!1), F = i == null ? void 0 : i.list_width;
7878
+ ), k = (i == null ? void 0 : i.list_resizable) ?? !1, A = me(null), [_, T] = I(null), $ = me(!1), F = i == null ? void 0 : i.list_width;
7884
7879
  le(() => {
7885
7880
  if (!k || _ !== null) return;
7886
7881
  const R = A.current;
@@ -7897,21 +7892,21 @@ function Rl({ screenCode: e }) {
7897
7892
  }, []);
7898
7893
  const q = z((R) => {
7899
7894
  R.preventDefault(), $.current = !0;
7900
- const C = R.clientX, L = _ ?? 320, K = (Z) => {
7895
+ const C = R.clientX, L = _ ?? 320, V = (Z) => {
7901
7896
  var je;
7902
7897
  if (!$.current) return;
7903
7898
  const fe = ((je = A.current) == null ? void 0 : je.getBoundingClientRect().width) ?? window.innerWidth, Te = 200, Ne = fe - 300, be = Math.max(Te, Math.min(Ne, L + Z.clientX - C));
7904
7899
  T(be);
7905
7900
  }, Q = () => {
7906
- $.current = !1, document.removeEventListener("mousemove", K), document.removeEventListener("mouseup", Q), document.body.style.cursor = "", document.body.style.userSelect = "", M.current = null;
7901
+ $.current = !1, document.removeEventListener("mousemove", V), document.removeEventListener("mouseup", Q), document.body.style.cursor = "", document.body.style.userSelect = "", M.current = null;
7907
7902
  };
7908
- document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", K), document.addEventListener("mouseup", Q), M.current = Q;
7903
+ document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", V), document.addEventListener("mouseup", Q), M.current = Q;
7909
7904
  }, [_]);
7910
7905
  if (!s || !i || !a) return null;
7911
- const O = i.columns ?? a.field_order.filter(
7906
+ const E = i.columns ?? a.field_order.filter(
7912
7907
  (R) => {
7913
- var C, L, K, Q;
7914
- return !((C = a.fields[R]) != null && C.primary) && !((L = a.fields[R]) != null && L.auto) && ((Q = (K = a.fields[R]) == null ? void 0 : K.display) == null ? void 0 : Q.is_listable) !== !1;
7908
+ var C, L, V, Q;
7909
+ return !((C = a.fields[R]) != null && C.primary) && !((L = a.fields[R]) != null && L.auto) && ((Q = (V = a.fields[R]) == null ? void 0 : V.display) == null ? void 0 : Q.is_listable) !== !1;
7915
7910
  }
7916
7911
  ).slice(0, 4), U = (p == null ? void 0 : p.length) ?? 0;
7917
7912
  return /* @__PURE__ */ d("div", { ref: A, className: "flex h-full overflow-hidden", children: [
@@ -7923,7 +7918,7 @@ function Rl({ screenCode: e }) {
7923
7918
  children: [
7924
7919
  /* @__PURE__ */ d("div", { className: "p-3 space-y-2 border-b", children: [
7925
7920
  /* @__PURE__ */ d("div", { className: "relative", children: [
7926
- /* @__PURE__ */ n(Fr, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }),
7921
+ /* @__PURE__ */ n(Or, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }),
7927
7922
  /* @__PURE__ */ n(
7928
7923
  he,
7929
7924
  {
@@ -7939,11 +7934,11 @@ function Rl({ screenCode: e }) {
7939
7934
  if (!(C != null && C.values)) return null;
7940
7935
  const L = p == null ? void 0 : p.find(
7941
7936
  (Q) => Q.field === R && Q.op === "eq"
7942
- ), K = (L == null ? void 0 : L.value) ?? "__all__";
7937
+ ), V = (L == null ? void 0 : L.value) ?? "__all__";
7943
7938
  return /* @__PURE__ */ d(
7944
7939
  gt,
7945
7940
  {
7946
- value: K,
7941
+ value: V,
7947
7942
  onValueChange: (Q) => v(R, Q),
7948
7943
  children: [
7949
7944
  /* @__PURE__ */ n(at, { className: "h-7 text-xs px-2 w-auto min-w-[90px]", children: /* @__PURE__ */ n(
@@ -7987,7 +7982,7 @@ function Rl({ screenCode: e }) {
7987
7982
  {
7988
7983
  record: R,
7989
7984
  entity: a,
7990
- columns: O,
7985
+ columns: E,
7991
7986
  pkField: x,
7992
7987
  refs: w,
7993
7988
  isSelected: R[x] === o,
@@ -8081,16 +8076,16 @@ function Ol({
8081
8076
  entity: i
8082
8077
  }) {
8083
8078
  var M;
8084
- const { data: a, isLoading: l } = bs(e, t), c = Jn(e), [o, u] = V(!1), [f, m] = V({}), p = a == null ? void 0 : a.data, g = p == null ? void 0 : p.$statuses, y = p == null ? void 0 : p.$properties, b = Al(e, t), w = $l(e, t), x = ee(() => {
8079
+ const { data: a, isLoading: l } = bs(e, t), c = Hn(e), [o, u] = I(!1), [f, m] = I({}), p = a == null ? void 0 : a.data, g = p == null ? void 0 : p.$statuses, y = p == null ? void 0 : p.$properties, b = Al(e, t), w = $l(e, t), x = ee(() => {
8085
8080
  const q = /* @__PURE__ */ new Set();
8086
- for (const [O, U] of Object.entries(i.fields))
8087
- !U.auto && !U.primary && q.add(O);
8081
+ for (const [E, U] of Object.entries(i.fields))
8082
+ !U.auto && !U.primary && q.add(E);
8088
8083
  return q;
8089
8084
  }, [i]), N = z(() => {
8090
8085
  if (p) {
8091
8086
  const q = {};
8092
- x.forEach((O) => {
8093
- q[O] = p[O] ?? "";
8087
+ x.forEach((E) => {
8088
+ q[E] = p[E] ?? "";
8094
8089
  }), m(q);
8095
8090
  }
8096
8091
  u(!0);
@@ -8106,10 +8101,10 @@ function Ol({
8106
8101
  onError: () => ie.error("Failed to save")
8107
8102
  }
8108
8103
  );
8109
- }, [c, t, f]), k = z((q, O) => {
8110
- m((U) => ({ ...U, [q]: O }));
8104
+ }, [c, t, f]), k = z((q, E) => {
8105
+ m((U) => ({ ...U, [q]: E }));
8111
8106
  }, []);
8112
- if (l) return /* @__PURE__ */ n(ts, {});
8107
+ if (l) return /* @__PURE__ */ n(es, {});
8113
8108
  if (!p) return null;
8114
8109
  const A = (M = i.display) == null ? void 0 : M.display_field, _ = A ? p[A] : p[i.field_order[0]], T = _ != null && typeof _ != "object" ? String(_) : P(i.display.name), $ = p == null ? void 0 : p.$refs, F = {
8115
8110
  schema: s,
@@ -8122,10 +8117,10 @@ function Ol({
8122
8117
  onFieldChange: o ? k : void 0,
8123
8118
  refs: $,
8124
8119
  objectProperties: y ?? void 0,
8125
- onSetProperty: i.readonly ? void 0 : (q, O) => w.mutate({ propertyCode: q, value: O }),
8120
+ onSetProperty: i.readonly ? void 0 : (q, E) => w.mutate({ propertyCode: q, value: E }),
8126
8121
  isPropertyPending: w.isPending,
8127
8122
  objectStatuses: g ?? void 0,
8128
- onSetStatus: i.readonly ? void 0 : (q, O) => b.mutate({ groupCode: q, statusCode: O }),
8123
+ onSetStatus: i.readonly ? void 0 : (q, E) => b.mutate({ groupCode: q, statusCode: E }),
8129
8124
  isStatusPending: b.isPending
8130
8125
  };
8131
8126
  return /* @__PURE__ */ d("div", { className: "flex flex-col h-full", children: [
@@ -8153,7 +8148,7 @@ function Ol({
8153
8148
  disabled: c.isPending,
8154
8149
  className: "h-7 text-xs gap-1",
8155
8150
  children: [
8156
- /* @__PURE__ */ n(Or, { className: "h-3 w-3" }),
8151
+ /* @__PURE__ */ n(Er, { className: "h-3 w-3" }),
8157
8152
  c.isPending ? "Saving..." : "Save"
8158
8153
  ]
8159
8154
  }
@@ -8263,7 +8258,7 @@ function jl() {
8263
8258
  }
8264
8259
  const As = jl(), Ds = Ts(As);
8265
8260
  typeof window < "u" && nr(Ds, {});
8266
- const Dr = Lr((e, t) => ({
8261
+ const Ar = Fr((e, t) => ({
8267
8262
  selectedTheme: As,
8268
8263
  effectiveTheme: Ds,
8269
8264
  availableThemes: {},
@@ -8278,10 +8273,10 @@ const Dr = Lr((e, t) => ({
8278
8273
  }
8279
8274
  }));
8280
8275
  typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
8281
- const e = Dr.getState();
8276
+ const e = Ar.getState();
8282
8277
  if (e.selectedTheme === "system") {
8283
8278
  const t = Cs();
8284
- nr(t, e.availableThemes), Dr.setState({ effectiveTheme: t });
8279
+ nr(t, e.availableThemes), Ar.setState({ effectiveTheme: t });
8285
8280
  }
8286
8281
  });
8287
8282
  const Ps = /* @__PURE__ */ new Map();
@@ -8378,7 +8373,7 @@ function Ul() {
8378
8373
  return { routes: t, defaultRoute: r };
8379
8374
  }
8380
8375
  function Il() {
8381
- const e = ct((l) => l.initialize), { data: t } = qe(), r = Dr((l) => l.setAvailableThemes), { routes: s, defaultRoute: i } = Ul();
8376
+ const e = ct((l) => l.initialize), { data: t } = qe(), r = Ar((l) => l.setAvailableThemes), { routes: s, defaultRoute: i } = Ul();
8382
8377
  le(() => {
8383
8378
  e();
8384
8379
  }, [e]);
@@ -8607,10 +8602,10 @@ function Yl(e, t) {
8607
8602
  export {
8608
8603
  wc as App,
8609
8604
  vo as ColumnPicker,
8610
- en as ConfirmDialog,
8605
+ Zr as ConfirmDialog,
8611
8606
  wc as Declarion,
8612
8607
  Ge as DynamicIcon,
8613
- mn as EmptyState,
8608
+ fn as EmptyState,
8614
8609
  Jl as EntityClient,
8615
8610
  mo as FilterChips,
8616
8611
  po as FilterDrawer,
@@ -8630,13 +8625,13 @@ export {
8630
8625
  gs as parseFiltersFromURL,
8631
8626
  Nc as registerScreen,
8632
8627
  vs as setFiltersInURL,
8633
- zr as useAuth,
8628
+ jr as useAuth,
8634
8629
  Cc as useColumns,
8635
8630
  ua as useCreateEntity,
8636
- Yn as useDebounce,
8637
- Qn as useDeleteEntity,
8631
+ Gn as useDebounce,
8632
+ Jn as useDeleteEntity,
8638
8633
  bc as useDeleteProperty,
8639
- Zn as useEntity,
8634
+ Bn as useEntity,
8640
8635
  Kt as useEntityData,
8641
8636
  bs as useEntityItem,
8642
8637
  fo as useFilters,
@@ -8648,7 +8643,7 @@ export {
8648
8643
  Al as useSetStatus,
8649
8644
  Ut as useTabNavigate,
8650
8645
  ht as useTabStore,
8651
- Jn as useUpdateEntity,
8646
+ Hn as useUpdateEntity,
8652
8647
  bo as useViews
8653
8648
  };
8654
8649
  //# sourceMappingURL=index.js.map