@object-ui/plugin-detail 4.0.7 → 4.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { ComponentRegistry as e, buildExpandFields as t } from "@object-ui/core";
2
2
  import * as n from "react";
3
- import { Badge as r, Button as i, Card as a, CardContent as o, CardHeader as s, CardTitle as c, Collapsible as l, CollapsibleContent as u, CollapsibleTrigger as d, Input as f, Skeleton as p, Tabs as m, TabsContent as h, TabsList as g, TabsTrigger as _, Tooltip as v, TooltipContent as y, TooltipProvider as b, TooltipTrigger as x, cn as S, useIsMobile as C } from "@object-ui/components";
4
- import { Activity as w, ArrowLeft as T, ArrowRight as E, ArrowRightLeft as D, ArrowUpDown as O, AtSign as k, Bell as A, BellOff as j, Bold as M, Calendar as N, Check as P, CheckSquare as F, ChevronDown as I, ChevronLeft as ee, ChevronRight as L, ChevronsLeft as R, ChevronsRight as z, Code as B, Columns2 as V, Copy as te, Edit as H, ExternalLink as ne, Eye as U, EyeOff as re, File as ie, FileArchive as ae, FileText as oe, History as W, Image as se, Inbox as G, Italic as ce, Link as K, List as q, Loader2 as J, Mail as le, MessageSquare as Y, Network as ue, PanelRightClose as de, PanelRightOpen as fe, Paperclip as pe, Phone as me, Pin as he, Plus as ge, PlusCircle as _e, RotateCcw as ve, Rows3 as ye, Search as be, Send as xe, SmilePlus as Se, Star as Ce, StarOff as we, Trash2 as Te, Upload as Ee, X as De, Zap as Oe, icons as ke } from "lucide-react";
5
- import { SchemaRenderer as Ae, useObjectTranslation as je, useSafeFieldLabel as Me } from "@object-ui/react";
6
- import { getCellRenderer as Ne } from "@object-ui/fields";
3
+ import r from "react";
4
+ import { AlertDialog as i, AlertDialogAction as a, AlertDialogCancel as o, AlertDialogContent as s, AlertDialogDescription as c, AlertDialogFooter as l, AlertDialogHeader as u, AlertDialogTitle as d, Badge as f, Button as p, Card as m, CardContent as h, CardHeader as g, CardTitle as _, Collapsible as v, CollapsibleContent as y, CollapsibleTrigger as b, Input as x, Sheet as S, SheetContent as C, SheetHeader as w, SheetTitle as T, Skeleton as E, Tabs as D, TabsContent as O, TabsList as k, TabsTrigger as A, Tooltip as j, TooltipContent as M, TooltipProvider as N, TooltipTrigger as P, cn as F, useIsMobile as I } from "@object-ui/components";
5
+ import { Activity as L, ArrowLeft as ee, ArrowRight as R, ArrowRightLeft as te, ArrowUpDown as z, AtSign as B, Bell as ne, BellOff as re, Bold as V, Calendar as H, Check as ie, CheckSquare as U, ChevronDown as ae, ChevronLeft as oe, ChevronRight as W, ChevronsLeft as se, ChevronsRight as ce, Code as le, Columns2 as ue, Copy as de, Edit as G, ExternalLink as fe, Eye as K, EyeOff as pe, File as me, FileArchive as he, FileText as ge, History as q, Image as _e, Inbox as ve, Italic as ye, Link as J, List as be, Loader2 as xe, Mail as Se, MessageSquare as Y, Network as Ce, PanelRightClose as we, PanelRightOpen as Te, Paperclip as Ee, Phone as De, Pin as Oe, Plus as ke, PlusCircle as Ae, RotateCcw as je, Rows3 as Me, Search as Ne, Send as Pe, SmilePlus as Fe, Star as Ie, Trash2 as Le, Upload as Re, X as ze, Zap as Be, icons as Ve } from "lucide-react";
6
+ import { SchemaRenderer as He, useObjectTranslation as Ue, useSafeFieldLabel as We } from "@object-ui/react";
7
+ import { BooleanField as Ge, SelectField as Ke, getCellRenderer as qe, resolveCellRendererType as Je } from "@object-ui/fields";
7
8
  import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
8
9
  //#region src/autoLayout.ts
9
- var Pe = new Set([
10
+ var Ye = new Set([
10
11
  "textarea",
11
12
  "markdown",
12
13
  "html",
@@ -18,10 +19,10 @@ var Pe = new Set([
18
19
  "field:grid",
19
20
  "field:rich-text"
20
21
  ]);
21
- function Fe(e) {
22
- return Pe.has(e);
22
+ function Xe(e) {
23
+ return Ye.has(e);
23
24
  }
24
- function Ie(e, t) {
25
+ function Ze(e, t) {
25
26
  let n;
26
27
  if (n = e <= 3 ? 1 : e <= 10 ? 2 : 3, t !== void 0) {
27
28
  if (t < 640) return Math.min(n, 1);
@@ -29,29 +30,29 @@ function Ie(e, t) {
29
30
  }
30
31
  return n;
31
32
  }
32
- function Le(e, t) {
33
- return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && Fe(e.type) ? {
33
+ function Qe(e, t) {
34
+ return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && Xe(e.type) ? {
34
35
  ...e,
35
36
  span: t
36
37
  } : e);
37
38
  }
38
- function Re(e, t, n) {
39
+ function $e(e, t, n) {
39
40
  if (t !== void 0) return {
40
- fields: Le(e, t),
41
+ fields: Qe(e, t),
41
42
  columns: t
42
43
  };
43
- let r = Ie(e.length, n);
44
+ let r = Ze(e.length, n);
44
45
  return {
45
- fields: Le(e, r),
46
+ fields: Qe(e, r),
46
47
  columns: r
47
48
  };
48
49
  }
49
50
  //#endregion
50
51
  //#region src/useDetailTranslation.ts
51
- function ze(e, t) {
52
+ function et(e, t) {
52
53
  return function() {
53
54
  try {
54
- let n = je();
55
+ let n = Ue();
55
56
  return n.t(t) === t ? { t: (t, n) => {
56
57
  let r = e[t] || t;
57
58
  if (n) for (let [e, t] of Object.entries(n)) r = r.replace(`{{${e}}}`, String(t));
@@ -66,13 +67,16 @@ function ze(e, t) {
66
67
  }
67
68
  };
68
69
  }
69
- var Be = {
70
+ var tt = {
70
71
  "detail.back": "Back",
71
72
  "detail.edit": "Edit",
72
- "detail.editInline": "Edit inline",
73
+ "detail.editInline": "Edit",
73
74
  "detail.save": "Save",
74
75
  "detail.saveChanges": "Save changes",
75
76
  "detail.editFieldsInline": "Edit fields inline",
77
+ "detail.cancel": "Cancel",
78
+ "detail.cancelEdit": "Discard changes",
79
+ "detail.openInNewTab": "Open in new tab",
76
80
  "detail.share": "Share",
77
81
  "detail.duplicate": "Duplicate",
78
82
  "detail.export": "Export",
@@ -173,137 +177,164 @@ var Be = {
173
177
  "detail.subscribeAriaLabel": "Subscribe to notifications",
174
178
  "detail.unsubscribeAriaLabel": "Unsubscribe from notifications",
175
179
  "detail.clearSearch": "Clear search"
176
- }, $ = ze(Be, "detail.back");
180
+ }, $ = et(tt, "detail.back");
177
181
  //#endregion
178
182
  //#region src/DetailSection.tsx
179
- function Ve(e, t) {
183
+ function nt(e, t) {
180
184
  return !e || e <= 1 || t <= 1 ? "" : t === 2 ? e >= 2 ? "md:col-span-2" : "" : e === 2 ? "md:col-span-2" : e >= 3 ? "md:col-span-2 lg:col-span-3" : "";
181
185
  }
182
- var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, isEditing: h = !1, onFieldChange: g, virtualScroll: _ }) => {
183
- let [w, T] = n.useState(e.defaultCollapsed ?? !1), [E, D] = n.useState(null), [O, k] = n.useState(void 0), [A, j] = n.useState(!1), { t: M } = $(), { fieldLabel: N } = Me(), F = n.useCallback((e, t) => {
186
+ var rt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s, virtualScroll: c }) => {
187
+ let [l, u] = n.useState(e.defaultCollapsed ?? !1), [d, x] = n.useState(null), [S, C] = n.useState(void 0), [w, T] = n.useState(!1), { t: E } = $(), { fieldLabel: D, translateOptions: O } = We(), k = n.useCallback((e, t) => {
184
188
  let n = t == null ? "" : String(t);
185
189
  navigator.clipboard.writeText(n).then(() => {
186
- D(e), setTimeout(() => D(null), 2e3);
190
+ x(e), setTimeout(() => x(null), 2e3);
187
191
  });
188
- }, []), ee = n.useCallback((e) => {
192
+ }, []), A = n.useCallback((e) => {
189
193
  let n = t?.[e.name] ?? e.value;
190
194
  return n == null || n === "";
191
- }, [t]), R = n.useMemo(() => e.fields.filter(ee).length, [e.fields, ee]), z = C(), B = z ? 3 : 6, V = z ? .2 : .5, H = e.fields.length - R, ne = !e.hideEmpty && !h && e.fields.length >= B && R / e.fields.length >= V && H > 0, ie = !A && (e.hideEmpty || ne) ? e.fields.filter((e) => !ee(e)) : e.fields;
192
- if (ie.length === 0 && R === e.fields.length) return null;
193
- let { fields: ae, columns: oe } = Re(ie, e.columns), W = (e) => {
195
+ }, [t]), L = n.useMemo(() => e.fields.filter(A).length, [e.fields, A]), ee = I(), R = ee ? 3 : 6, te = ee ? .2 : .5, z = e.fields.length - L, B = !e.hideEmpty && !o && e.fields.length >= R && L / e.fields.length >= te && z > 0, ne = !w && (e.hideEmpty || B) ? e.fields.filter((e) => !A(e)) : e.fields;
196
+ if (ne.length === 0 && L === e.fields.length) return null;
197
+ let { fields: re, columns: V } = $e(ne, e.columns), H = (e) => {
194
198
  let n = t?.[e.name] ?? e.value;
195
- if (e.render) return /* @__PURE__ */ Z(Ae, {
199
+ if (e.render) return /* @__PURE__ */ Z(He, {
196
200
  schema: e.render,
197
201
  data: {
198
202
  ...t,
199
203
  value: n
200
204
  }
201
205
  });
202
- let r = Ve(e.span, oe), a = (() => {
206
+ let r = nt(e.span, V), c = i?.fields?.[e.name], l = { ...e };
207
+ if (c) {
208
+ !e.type && c.type && (l.type = c.type), c.options && !l.options && (l.options = c.options), c.currency && !l.currency && (l.currency = c.currency), c.precision !== void 0 && l.precision === void 0 && (l.precision = c.precision), c.format && !l.format && (l.format = c.format);
209
+ let t = c.reference_to || c.reference;
210
+ t && !l.reference_to && (l.reference_to = t), c.reference_field && !l.reference_field && (l.reference_field = c.reference_field);
211
+ }
212
+ a && Array.isArray(l.options) && l.options.length > 0 && (l.options = O(a, e.name, l.options));
213
+ let u = (() => {
203
214
  if (n == null) return /* @__PURE__ */ Z("span", {
204
215
  className: "text-muted-foreground/50 text-xs italic",
205
216
  children: "—"
206
217
  });
207
- let t = p?.fields?.[e.name], r = e.type || t?.type, i = { ...e };
218
+ let t = Je(l) || e.type;
208
219
  if (t) {
209
- !e.type && t.type && (i.type = t.type), t.options && !i.options && (i.options = t.options), t.currency && !i.currency && (i.currency = t.currency), t.precision !== void 0 && i.precision === void 0 && (i.precision = t.precision), t.format && !i.format && (i.format = t.format);
210
- let n = t.reference_to || t.reference;
211
- n && !i.reference_to && (i.reference_to = n), t.reference_field && !i.reference_field && (i.reference_field = t.reference_field);
212
- }
213
- if (r) {
214
- let e = Ne(r);
220
+ let e = qe(t);
215
221
  if (e) return /* @__PURE__ */ Z(e, {
216
222
  value: n,
217
- field: i
223
+ field: l
218
224
  });
219
225
  }
220
226
  return String(n);
221
- })(), o = n != null && n !== "", s = E === e.name;
227
+ })(), f = n != null && n !== "", m = d === e.name;
222
228
  return /* @__PURE__ */ Q("div", {
223
- className: S("space-y-1.5 group", r),
229
+ className: F("space-y-1.5 group", r),
224
230
  children: [/* @__PURE__ */ Z("div", {
225
231
  className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
226
- children: N(m || "", e.name, e.label || e.name)
227
- }), h && !e.readonly ? /* @__PURE__ */ Z("div", {
232
+ children: D(a || "", e.name, e.label || e.name)
233
+ }), o && !e.readonly ? /* @__PURE__ */ Z("div", {
228
234
  className: "min-h-[44px] sm:min-h-0",
229
- children: /* @__PURE__ */ Z("input", {
230
- type: e.type === "number" ? "number" : e.type === "date" ? "date" : "text",
231
- className: "w-full px-2 py-1.5 text-sm border rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-ring",
232
- value: n == null ? "" : String(n),
233
- onChange: (t) => g?.(e.name, t.target.value)
234
- })
235
+ children: (() => {
236
+ let t = l.type || e.type;
237
+ if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z(Ke, {
238
+ field: l,
239
+ value: n == null ? "" : String(n),
240
+ onChange: (t) => s?.(e.name, t)
241
+ });
242
+ if (t === "boolean") return /* @__PURE__ */ Z(Ge, {
243
+ field: l,
244
+ value: !!n,
245
+ onChange: (t) => s?.(e.name, t)
246
+ });
247
+ let r = t === "date" || t === "datetime";
248
+ return /* @__PURE__ */ Z("input", {
249
+ type: t === "number" ? "number" : r ? "date" : "text",
250
+ className: "w-full px-2 py-1.5 text-sm border rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-ring",
251
+ value: n == null ? "" : r ? (() => {
252
+ let e = String(n);
253
+ if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
254
+ let t = new Date(e);
255
+ return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
256
+ })() : String(n),
257
+ onChange: (t) => {
258
+ let n = t.target.value;
259
+ if (r && n) {
260
+ let t = (/* @__PURE__ */ new Date(n + "T00:00:00")).toISOString();
261
+ s?.(e.name, t);
262
+ } else s?.(e.name, n);
263
+ }
264
+ });
265
+ })()
235
266
  }) : /* @__PURE__ */ Q("div", {
236
- className: S("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", o && "cursor-pointer active:bg-muted/60 transition-colors"),
237
- onClick: o ? () => F(e.name, n) : void 0,
238
- onKeyDown: o ? (t) => {
239
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), F(e.name, n));
267
+ className: F("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", f && "cursor-pointer active:bg-muted/60 transition-colors"),
268
+ onClick: f ? () => k(e.name, n) : void 0,
269
+ onKeyDown: f ? (t) => {
270
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
240
271
  } : void 0,
241
- role: o ? "button" : void 0,
242
- tabIndex: o ? 0 : void 0,
272
+ role: f ? "button" : void 0,
273
+ tabIndex: f ? 0 : void 0,
243
274
  children: [/* @__PURE__ */ Z("div", {
244
275
  className: "text-sm flex-1 break-words py-1",
245
- children: a
246
- }), o && /* @__PURE__ */ Z(b, { children: /* @__PURE__ */ Q(v, { children: [/* @__PURE__ */ Z(x, {
276
+ children: u
277
+ }), f && /* @__PURE__ */ Z(N, { children: /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
247
278
  asChild: !0,
248
- children: /* @__PURE__ */ Z(i, {
279
+ children: /* @__PURE__ */ Z(p, {
249
280
  variant: "ghost",
250
281
  size: "icon",
251
282
  className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",
252
283
  onClick: (t) => {
253
- t.stopPropagation(), F(e.name, n);
284
+ t.stopPropagation(), k(e.name, n);
254
285
  },
255
- children: s ? /* @__PURE__ */ Z(P, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(te, { className: "h-3 w-3" })
286
+ children: m ? /* @__PURE__ */ Z(ie, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(de, { className: "h-3 w-3" })
256
287
  })
257
- }), /* @__PURE__ */ Z(y, { children: M(s ? "detail.copied" : "detail.copyToClipboard") })] }) })]
288
+ }), /* @__PURE__ */ Z(M, { children: E(m ? "detail.copied" : "detail.copyToClipboard") })] }) })]
258
289
  })]
259
290
  }, e.name);
260
- }, se = _?.enabled === !0, G = _?.batchSize ?? 20;
291
+ }, U = c?.enabled === !0, oe = c?.batchSize ?? 20;
261
292
  n.useEffect(() => {
262
- if (!se) {
263
- k(void 0);
293
+ if (!U) {
294
+ C(void 0);
264
295
  return;
265
296
  }
266
- if (ae.length <= G) {
267
- k(void 0);
297
+ if (re.length <= oe) {
298
+ C(void 0);
268
299
  return;
269
300
  }
270
- k(G);
271
- let e = setTimeout(() => k(void 0), 100);
301
+ C(oe);
302
+ let e = setTimeout(() => C(void 0), 100);
272
303
  return () => clearTimeout(e);
273
304
  }, [
274
- se,
275
- ae.length,
276
- G
305
+ U,
306
+ re.length,
307
+ oe
277
308
  ]);
278
- let ce = O === void 0 ? ae : ae.slice(0, O), K = R > 0 && (e.hideEmpty || ne), q = /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
279
- className: S("grid gap-3 sm:gap-4", oe === 1 ? "grid-cols-1" : oe === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
280
- children: ce.map(W)
281
- }), K && /* @__PURE__ */ Z("div", {
309
+ let se = S === void 0 ? re : re.slice(0, S), ce = L > 0 && (e.hideEmpty || B), le = /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
310
+ className: F("grid gap-3 sm:gap-4", V === 1 ? "grid-cols-1" : V === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
311
+ children: se.map(H)
312
+ }), ce && /* @__PURE__ */ Z("div", {
282
313
  className: "mt-3 -ml-2",
283
- children: /* @__PURE__ */ Q(i, {
314
+ children: /* @__PURE__ */ Q(p, {
284
315
  type: "button",
285
316
  variant: "ghost",
286
317
  size: "sm",
287
- onClick: () => j((e) => !e),
318
+ onClick: () => T((e) => !e),
288
319
  className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
289
- children: [Z(A ? re : U, { className: "h-3.5 w-3.5 mr-1.5" }), A ? M("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : M("detail.showEmptyFields", {
290
- count: R,
291
- defaultValue: `Show ${R} empty field${R === 1 ? "" : "s"}`
320
+ children: [Z(w ? pe : K, { className: "h-3.5 w-3.5 mr-1.5" }), w ? E("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : E("detail.showEmptyFields", {
321
+ count: L,
322
+ defaultValue: `Show ${L} empty field${L === 1 ? "" : "s"}`
292
323
  })]
293
324
  })
294
325
  })] });
295
326
  return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
296
- className: S(f),
297
- children: q
298
- }) : e.collapsible ? /* @__PURE__ */ Z(l, {
299
- open: !w,
300
- onOpenChange: (e) => T(!e),
301
- className: f,
302
- children: /* @__PURE__ */ Q(a, { children: [/* @__PURE__ */ Z(d, {
327
+ className: F(r),
328
+ children: le
329
+ }) : e.collapsible ? /* @__PURE__ */ Z(v, {
330
+ open: !l,
331
+ onOpenChange: (e) => u(!e),
332
+ className: r,
333
+ children: /* @__PURE__ */ Q(m, { children: [/* @__PURE__ */ Z(b, {
303
334
  asChild: !0,
304
- children: /* @__PURE__ */ Q(s, {
305
- className: S("cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
306
- children: [/* @__PURE__ */ Q(c, {
335
+ children: /* @__PURE__ */ Q(g, {
336
+ className: F("cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
337
+ children: [/* @__PURE__ */ Q(_, {
307
338
  className: "flex items-center justify-between",
308
339
  children: [/* @__PURE__ */ Q("div", {
309
340
  className: "flex items-center gap-2",
@@ -313,7 +344,7 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
313
344
  children: e.icon
314
345
  }),
315
346
  /* @__PURE__ */ Z("span", { children: e.title }),
316
- e.fields && /* @__PURE__ */ Z(r, {
347
+ e.fields && /* @__PURE__ */ Z(f, {
317
348
  variant: "secondary",
318
349
  className: "ml-2 text-xs",
319
350
  children: e.fields.length
@@ -321,22 +352,22 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
321
352
  ]
322
353
  }), /* @__PURE__ */ Z("div", {
323
354
  className: "flex items-center gap-2",
324
- children: Z(w ? L : I, { className: "h-4 w-4 text-muted-foreground" })
355
+ children: Z(l ? W : ae, { className: "h-4 w-4 text-muted-foreground" })
325
356
  })]
326
- }), e.description && !w && /* @__PURE__ */ Z("p", {
357
+ }), e.description && !l && /* @__PURE__ */ Z("p", {
327
358
  className: "text-sm text-muted-foreground mt-1.5",
328
359
  children: e.description
329
360
  })]
330
361
  })
331
- }), /* @__PURE__ */ Z(u, { children: /* @__PURE__ */ Z(o, {
362
+ }), /* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Z(h, {
332
363
  className: "pt-4 sm:pt-6 px-3 sm:px-6",
333
- children: q
364
+ children: le
334
365
  }) })] })
335
- }) : /* @__PURE__ */ Q(a, {
336
- className: S(e.showBorder === !1 ? "border-none shadow-none" : "", f),
337
- children: [e.title && /* @__PURE__ */ Q(s, {
338
- className: S(e.headerColor && `bg-${e.headerColor}`),
339
- children: [/* @__PURE__ */ Z(c, {
366
+ }) : /* @__PURE__ */ Q(m, {
367
+ className: F(e.showBorder === !1 ? "border-none shadow-none" : "", r),
368
+ children: [e.title && /* @__PURE__ */ Q(g, {
369
+ className: F(e.headerColor && `bg-${e.headerColor}`),
370
+ children: [/* @__PURE__ */ Z(_, {
340
371
  className: "flex items-center justify-between",
341
372
  children: /* @__PURE__ */ Q("div", {
342
373
  className: "flex items-center gap-2",
@@ -349,20 +380,20 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
349
380
  className: "text-sm text-muted-foreground mt-1.5",
350
381
  children: e.description
351
382
  })]
352
- }), /* @__PURE__ */ Z(o, {
383
+ }), /* @__PURE__ */ Z(h, {
353
384
  className: "pt-4 sm:pt-6 px-3 sm:px-6",
354
- children: q
385
+ children: le
355
386
  })]
356
387
  });
357
- }, Ue = ({ tabs: e, data: t, className: i }) => {
358
- let [a, o] = n.useState(e[0]?.key), s = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
359
- return /* @__PURE__ */ Q(m, {
360
- value: a,
361
- onValueChange: o,
362
- className: i,
363
- children: [/* @__PURE__ */ Z(g, {
388
+ }, it = ({ tabs: e, data: t, className: r }) => {
389
+ let [i, a] = n.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
390
+ return /* @__PURE__ */ Q(D, {
391
+ value: i,
392
+ onValueChange: a,
393
+ className: r,
394
+ children: [/* @__PURE__ */ Z(k, {
364
395
  className: "w-full justify-start border-b rounded-none bg-transparent p-0",
365
- children: s.map((e) => /* @__PURE__ */ Z(_, {
396
+ children: o.map((e) => /* @__PURE__ */ Z(A, {
366
397
  value: e.key,
367
398
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
368
399
  children: /* @__PURE__ */ Q("div", {
@@ -370,7 +401,7 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
370
401
  children: [
371
402
  e.icon && /* @__PURE__ */ Z("span", { children: e.icon }),
372
403
  /* @__PURE__ */ Z("span", { children: e.label }),
373
- e.badge && /* @__PURE__ */ Z(r, {
404
+ e.badge && /* @__PURE__ */ Z(f, {
374
405
  variant: "secondary",
375
406
  className: "ml-1",
376
407
  children: e.badge
@@ -378,18 +409,18 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
378
409
  ]
379
410
  })
380
411
  }, e.key))
381
- }), s.map((e) => /* @__PURE__ */ Z(h, {
412
+ }), o.map((e) => /* @__PURE__ */ Z(O, {
382
413
  value: e.key,
383
414
  className: "mt-4",
384
415
  children: /* @__PURE__ */ Z(n.Suspense, {
385
416
  fallback: null,
386
417
  children: Array.isArray(e.content) ? /* @__PURE__ */ Z("div", {
387
418
  className: "space-y-4",
388
- children: e.content.map((e, n) => /* @__PURE__ */ Z(Ae, {
419
+ children: e.content.map((e, n) => /* @__PURE__ */ Z(He, {
389
420
  schema: e,
390
421
  data: t
391
422
  }, n))
392
- }) : /* @__PURE__ */ Z(Ae, {
423
+ }) : /* @__PURE__ */ Z(He, {
393
424
  schema: e.content,
394
425
  data: t
395
426
  })
@@ -399,118 +430,210 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
399
430
  };
400
431
  //#endregion
401
432
  //#region src/RelatedList.tsx
402
- function We(e) {
403
- return e && ke[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || G;
433
+ function at(e) {
434
+ return e && Ve[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || ve;
404
435
  }
405
- var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, className: m, dataSource: h, objectName: g, onNew: _, onViewAll: v, onRowEdit: y, onRowDelete: b, pageSize: x, sortable: C = !1, filterable: w = !1, collapsible: T = !1, defaultCollapsed: E = !1, referenceField: D, icon: k }) => {
406
- let [A, j] = n.useState(u), [M, N] = n.useState(!1), [P, F] = n.useState(0), [R, z] = n.useState(null), [B, V] = n.useState("asc"), [te, U] = n.useState(""), [re, ie] = n.useState(null), [ae, oe] = n.useState(E), { t: W } = $(), { fieldLabel: se } = Me();
436
+ var ot = ({ title: e, type: t, api: r, data: v, schema: y, columns: b, className: S, dataSource: C, objectName: w, onNew: T, onViewAll: E, onRowEdit: D, onRowDelete: O, onRowClick: k, maxColumns: A = 6, pageSize: j, sortable: M = !1, filterable: N = !1, collapsible: P = !1, defaultCollapsed: I = !1, referenceField: L, icon: ee }) => {
437
+ let R = v !== void 0, te = v ?? [], [B, ne] = n.useState(te), [re, V] = n.useState(!1), [H, ie] = n.useState(0), [U, se] = n.useState(null), [ce, le] = n.useState("asc"), [ue, de] = n.useState(""), [G, K] = n.useState(null), [pe, me] = n.useState(I), [he, ge] = n.useState({}), { t: q } = $(), { fieldLabel: _e } = We();
407
438
  n.useEffect(() => {
408
- j(u);
409
- }, [u]), n.useEffect(() => {
410
- l && h?.getObjectSchema && !p?.length && h.getObjectSchema(l).then(ie).catch((e) => {
411
- console.warn(`[RelatedList] Failed to fetch schema for ${l}:`, e);
439
+ R && ne(v ?? []);
440
+ }, [v, R]), n.useEffect(() => {
441
+ r && C?.getObjectSchema && !b?.length && C.getObjectSchema(r).then(K).catch((e) => {
442
+ console.warn(`[RelatedList] Failed to fetch schema for ${r}:`, e);
412
443
  });
413
444
  }, [
414
- l,
415
- h,
416
- p
445
+ r,
446
+ C,
447
+ b
417
448
  ]), n.useEffect(() => {
418
- l && !u.length && (N(!0), h && typeof h.find == "function" ? h.find(l).then((e) => {
419
- j(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), N(!1);
449
+ r && !R && (V(!0), C && typeof C.find == "function" ? C.find(r).then((e) => {
450
+ ne(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), V(!1);
420
451
  }).catch((e) => {
421
- console.error("Failed to fetch related data:", e), N(!1);
422
- }) : fetch(l).then((e) => e.json()).then((e) => {
423
- j(Array.isArray(e) ? e : e?.data || []);
452
+ console.error("Failed to fetch related data:", e), V(!1);
453
+ }) : fetch(r).then((e) => e.json()).then((e) => {
454
+ ne(Array.isArray(e) ? e : e?.data || []);
424
455
  }).catch((e) => {
425
456
  console.error("Failed to fetch related data:", e);
426
- }).finally(() => N(!1)));
457
+ }).finally(() => V(!1)));
427
458
  }, [
428
- l,
429
- u,
430
- h
459
+ r,
460
+ R,
461
+ C
462
+ ]), n.useEffect(() => {
463
+ if (!C?.find || !G?.fields || !B.length) return;
464
+ let e = G.fields, t = [];
465
+ for (let [n, r] of Object.entries(e)) {
466
+ if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
467
+ let e = r.reference_to || r.reference;
468
+ if (!e) continue;
469
+ let i = /* @__PURE__ */ new Set();
470
+ for (let e of B) {
471
+ let t = e?.[n];
472
+ t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
473
+ }
474
+ let a = he[n] || {}, o = Array.from(i).filter((e) => !(e in a));
475
+ o.length > 0 && t.push({
476
+ fieldName: n,
477
+ target: e,
478
+ ids: o
479
+ });
480
+ }
481
+ if (t.length === 0) return;
482
+ let n = !1;
483
+ return Promise.all(t.map(({ fieldName: e, target: t, ids: n }) => C.find(t, {
484
+ $filter: { id: { $in: n } },
485
+ $top: n.length
486
+ }).then((t) => {
487
+ let n = Array.isArray(t) ? t : t?.data || [], r = {};
488
+ for (let e of n) {
489
+ let t = e?.id || e?._id;
490
+ t && (r[String(t)] = e?.full_name || e?.fullname || e?.display_name || e?.name || e?.subject || e?.title || e?.label || e?.code || String(t));
491
+ }
492
+ return {
493
+ fieldName: e,
494
+ map: r
495
+ };
496
+ }).catch((t) => (console.warn(`[RelatedList] Failed to resolve lookups for ${e}:`, t), {
497
+ fieldName: e,
498
+ map: {}
499
+ })))).then((e) => {
500
+ n || ge((t) => {
501
+ let n = { ...t };
502
+ for (let { fieldName: t, map: r } of e) n[t] = {
503
+ ...n[t] || {},
504
+ ...r
505
+ };
506
+ return n;
507
+ });
508
+ }), () => {
509
+ n = !0;
510
+ };
511
+ }, [
512
+ C,
513
+ G,
514
+ B
431
515
  ]);
432
- let G = n.useMemo(() => {
433
- if (!te) return A;
434
- let e = te.toLowerCase();
435
- return A.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
436
- }, [A, te]), ce = n.useMemo(() => R ? [...G].sort((e, t) => {
437
- let n = e[R], r = t[R];
516
+ let ve = n.useMemo(() => {
517
+ if (!ue) return B;
518
+ let e = ue.toLowerCase();
519
+ return B.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
520
+ }, [B, ue]), ye = n.useMemo(() => U ? [...ve].sort((e, t) => {
521
+ let n = e[U], r = t[U];
438
522
  if (n == null && r == null) return 0;
439
523
  if (n == null) return 1;
440
524
  if (r == null) return -1;
441
525
  let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
442
- return B === "asc" ? i : -i;
443
- }) : G, [
444
- G,
445
- R,
446
- B
447
- ]), K = x && x > 0 ? x : 0, q = K ? Math.max(1, Math.ceil(ce.length / K)) : 1, J = K ? ce.slice(P * K, (P + 1) * K) : ce;
526
+ return ce === "asc" ? i : -i;
527
+ }) : ve, [
528
+ ve,
529
+ U,
530
+ ce
531
+ ]), J = j && j > 0 ? j : 0, be = J ? Math.max(1, Math.ceil(ye.length / J)) : 1, xe = J ? ye.slice(H * J, (H + 1) * J) : ye;
448
532
  n.useEffect(() => {
449
- F(0);
533
+ ie(0);
450
534
  }, [
451
- te,
452
- R,
453
- B
535
+ ue,
536
+ U,
537
+ ce
454
538
  ]);
455
- let le = n.useCallback((e) => {
456
- R === e ? V((e) => e === "asc" ? "desc" : "asc") : (z(e), V("asc"));
457
- }, [R]), Y = n.useCallback((e) => {
458
- window.confirm(W("detail.deleteRowConfirmation")) && b?.(e);
459
- }, [b, W]), ue = n.useMemo(() => {
460
- let e = (e) => D ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== D) : e;
461
- if (p && p.length > 0) return e(p);
462
- if (!re?.fields) return [];
463
- let t = g || l || "";
464
- return Object.entries(re.fields).filter(([e]) => !e.startsWith("_") && e !== "id" && e !== D).map(([e, r]) => {
465
- let i = {
539
+ let Se = n.useCallback((e) => {
540
+ U === e ? le((e) => e === "asc" ? "desc" : "asc") : (se(e), le("asc"));
541
+ }, [U]), [Y, Ce] = n.useState(null), we = n.useCallback((e) => {
542
+ Ce(e);
543
+ }, []), Te = n.useCallback(() => {
544
+ Y && O?.(Y), Ce(null);
545
+ }, [Y, O]), Ee = n.useMemo(() => {
546
+ let e = (e) => L ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== L) : e, t = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, i = (e) => B.length ? e.filter((e) => {
547
+ let n = e?.accessorKey || e?.field || e?.name;
548
+ return n ? B.some((e) => !t(e?.[n])) : !0;
549
+ }) : e;
550
+ if (b && b.length > 0) return i(e(b));
551
+ if (!G?.fields) return [];
552
+ let a = w || r || "", o = new Set([
553
+ "image",
554
+ "file",
555
+ "attachment",
556
+ "rich_text",
557
+ "html",
558
+ "json"
559
+ ]), s = [
560
+ "name",
561
+ "full_name",
562
+ "fullname",
563
+ "title",
564
+ "subject",
565
+ "label",
566
+ "code",
567
+ "number"
568
+ ], c = Object.entries(G.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === L || t?.hidden || t?.type && o.has(t.type)));
569
+ return c.sort(([e, t], [n, r]) => {
570
+ let i = s.indexOf(e), a = s.indexOf(n), o = i >= 0 ? i : 100, c = a >= 0 ? a : 100;
571
+ if (o !== c) return o - c;
572
+ let l = t?.type === "select" || e.includes("status");
573
+ return l === (r?.type === "select" || n.includes("status")) ? 0 : l ? -1 : 1;
574
+ }), i(c.map(([e, t]) => {
575
+ let r = {
466
576
  accessorKey: e,
467
- header: se(t, e, r.label || e)
577
+ header: _e(a, e, t.label || e)
468
578
  };
469
- if (r.type) {
470
- let t = Ne(r.type);
471
- if (t) {
472
- let a = {
579
+ if (t.type) {
580
+ let i = qe(Je({
581
+ type: t.type,
582
+ format: t.format
583
+ }) || t.type);
584
+ if (i) {
585
+ let a = t.type === "lookup" || t.type === "master_detail" ? he[e] : void 0, o = a && Object.keys(a).length > 0 ? Object.entries(a).map(([e, t]) => ({
586
+ value: e,
587
+ label: t
588
+ })) : void 0, s = {
473
589
  name: e,
474
- label: r.label || e,
475
- type: r.type,
476
- ...r.options && { options: r.options },
477
- ...r.currency && { currency: r.currency },
478
- ...r.precision !== void 0 && { precision: r.precision },
479
- ...r.format && { format: r.format },
480
- ...(r.reference_to || r.reference) && { reference_to: r.reference_to || r.reference },
481
- ...r.reference_field && { reference_field: r.reference_field }
590
+ label: t.label || e,
591
+ type: t.type,
592
+ ...(o || t.options) && { options: o || t.options },
593
+ ...t.currency && { currency: t.currency },
594
+ ...t.precision !== void 0 && { precision: t.precision },
595
+ ...t.format && { format: t.format },
596
+ ...(t.reference_to || t.reference) && { reference_to: t.reference_to || t.reference },
597
+ ...t.reference_field && { reference_field: t.reference_field }
482
598
  };
483
- i.cell = (e) => e == null ? n.createElement("span", { className: "text-muted-foreground/50 text-xs italic" }, "—") : n.createElement(t, {
599
+ r.cell = (e) => e == null ? n.createElement("span", { className: "text-muted-foreground/50 text-xs italic" }, "—") : n.createElement(i, {
484
600
  value: e,
485
- field: a
601
+ field: s
486
602
  });
487
603
  }
488
604
  }
489
- return i;
490
- });
605
+ return r;
606
+ })).slice(0, Math.max(1, A));
491
607
  }, [
492
- p,
493
- re,
494
- g,
495
- l,
496
- se,
497
- D
498
- ]), de = n.useMemo(() => {
499
- if (d) return d;
608
+ b,
609
+ G,
610
+ w,
611
+ r,
612
+ _e,
613
+ L,
614
+ B,
615
+ A,
616
+ he
617
+ ]), De = !!D || !!O, Oe = n.useMemo(() => {
618
+ if (y) return y;
500
619
  switch (t) {
501
620
  case "grid":
502
621
  case "table": return {
503
622
  type: "data-table",
504
- data: J,
505
- columns: ue,
623
+ data: xe,
624
+ columns: Ee,
506
625
  pagination: !1,
507
- pageSize: K || 10,
626
+ pageSize: J || 10,
508
627
  searchable: !1,
509
- exportable: !1
628
+ exportable: !1,
629
+ rowActions: De,
630
+ onRowEdit: D,
631
+ onRowDelete: O ? we : void 0,
632
+ onRowClick: k
510
633
  };
511
634
  case "list": return {
512
635
  type: "data-list",
513
- data: J
636
+ data: xe
514
637
  };
515
638
  default: return {
516
639
  type: "div",
@@ -519,159 +642,169 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
519
642
  }
520
643
  }, [
521
644
  t,
645
+ xe,
646
+ Ee,
647
+ y,
522
648
  J,
523
- ue,
524
- d,
525
- K
526
- ]), fe = !!y || !!b, pe = T ? "cursor-pointer select-none" : void 0, me = T ? () => oe((e) => !e) : void 0, he = We(k), _e = !M && A.length === 0, ve = w;
527
- return /* @__PURE__ */ Q(a, {
528
- className: S("shadow-none", _e && "bg-muted/20", m),
529
- children: [/* @__PURE__ */ Z(s, {
530
- className: S("py-3 px-4", pe),
531
- onClick: me,
532
- children: /* @__PURE__ */ Q(c, {
533
- className: "flex items-center justify-between gap-2 text-sm font-semibold",
534
- children: [/* @__PURE__ */ Q("div", {
535
- className: "flex items-center gap-2 min-w-0",
536
- children: [
537
- T && Z(ae ? L : I, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
538
- /* @__PURE__ */ Z(he, {
539
- className: "h-4 w-4 text-muted-foreground shrink-0",
540
- "aria-hidden": !0
541
- }),
542
- /* @__PURE__ */ Z("span", {
543
- className: "truncate",
544
- children: e
545
- }),
546
- /* @__PURE__ */ Z(r, {
547
- variant: "secondary",
548
- className: S("text-xs font-normal h-5 px-1.5", A.length === 0 && "bg-muted text-muted-foreground"),
549
- "aria-label": `${A.length} records`,
550
- children: A.length
649
+ De,
650
+ D,
651
+ O,
652
+ we,
653
+ k
654
+ ]), Ae = P ? "cursor-pointer select-none" : void 0, je = P ? () => me((e) => !e) : void 0, Me = at(ee), Ne = !re && B.length === 0, Pe = N;
655
+ return /* @__PURE__ */ Q(m, {
656
+ className: F("shadow-none", Ne && "bg-muted/20", S),
657
+ children: [
658
+ /* @__PURE__ */ Z(g, {
659
+ className: F("py-3 px-4", Ae),
660
+ onClick: je,
661
+ children: /* @__PURE__ */ Q(_, {
662
+ className: "flex items-center justify-between gap-2 text-sm font-semibold",
663
+ children: [/* @__PURE__ */ Q("div", {
664
+ className: "flex items-center gap-2 min-w-0",
665
+ children: [
666
+ P && Z(pe ? W : ae, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
667
+ /* @__PURE__ */ Z(Me, {
668
+ className: "h-4 w-4 text-muted-foreground shrink-0",
669
+ "aria-hidden": !0
670
+ }),
671
+ /* @__PURE__ */ Z("span", {
672
+ className: "truncate",
673
+ children: e
674
+ }),
675
+ /* @__PURE__ */ Z(f, {
676
+ variant: "secondary",
677
+ className: F("text-xs font-normal h-5 px-1.5", B.length === 0 && "bg-muted text-muted-foreground"),
678
+ "aria-label": `${B.length} records`,
679
+ children: B.length
680
+ })
681
+ ]
682
+ }), /* @__PURE__ */ Z("div", {
683
+ className: "flex items-center gap-1 shrink-0",
684
+ children: T && /* @__PURE__ */ Q(p, {
685
+ variant: "outline",
686
+ size: "sm",
687
+ onClick: (e) => {
688
+ e.stopPropagation(), T();
689
+ },
690
+ className: "gap-1 h-7 text-xs shadow-none",
691
+ children: [/* @__PURE__ */ Z(ke, { className: "h-3.5 w-3.5" }), q("detail.new")]
551
692
  })
552
- ]
553
- }), /* @__PURE__ */ Q("div", {
554
- className: "flex items-center gap-1 shrink-0",
555
- children: [_ && /* @__PURE__ */ Q(i, {
556
- variant: "ghost",
557
- size: "sm",
558
- onClick: (e) => {
559
- e.stopPropagation(), _();
560
- },
561
- className: "gap-1 h-7 text-xs",
562
- children: [/* @__PURE__ */ Z(ge, { className: "h-3.5 w-3.5" }), W("detail.new")]
563
- }), v && /* @__PURE__ */ Q(i, {
564
- variant: "ghost",
565
- size: "sm",
566
- onClick: (e) => {
567
- e.stopPropagation(), v();
568
- },
569
- className: "gap-1 h-7 text-xs",
570
- children: [W("detail.viewAll"), /* @__PURE__ */ Z(ne, { className: "h-3 w-3" })]
571
693
  })]
572
- })]
573
- })
574
- }), !ae && /* @__PURE__ */ Q(o, {
575
- className: S("pt-0", _e ? "pb-3 px-4" : "pb-4 px-4"),
576
- children: [
577
- ve && /* @__PURE__ */ Z("div", {
578
- className: "mb-3",
579
- children: /* @__PURE__ */ Z(f, {
580
- placeholder: W("detail.filterPlaceholder"),
581
- value: te,
582
- onChange: (e) => U(e.target.value),
583
- className: "h-8 text-sm"
584
- })
585
- }),
586
- C && ue && ue.length > 0 && A.length > 0 && /* @__PURE__ */ Z("div", {
587
- className: "flex flex-wrap gap-1 mb-3",
588
- children: ue.map((e) => {
589
- let t = e.accessorKey || e.field || e.name;
590
- if (!t) return null;
591
- let n = e.header || e.label || t, r = R === t;
592
- return /* @__PURE__ */ Q(i, {
593
- variant: r ? "secondary" : "ghost",
594
- size: "sm",
595
- className: "gap-1 h-7 text-xs",
596
- onClick: () => le(t),
597
- children: [
598
- /* @__PURE__ */ Z(O, { className: "h-3 w-3" }),
599
- n,
600
- r && (B === "asc" ? " ↑" : " ↓")
601
- ]
602
- }, t);
603
- })
604
- }),
605
- M ? /* @__PURE__ */ Z("div", {
606
- className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
607
- children: W("detail.loading")
608
- }) : _e ? /* @__PURE__ */ Q("div", {
609
- className: "flex items-center justify-between gap-2 py-2 text-sm",
610
- children: [/* @__PURE__ */ Z("span", {
611
- className: "text-muted-foreground italic",
612
- children: W("detail.noRelatedRecords")
613
- }), _ === void 0 && /* @__PURE__ */ Z("span", { className: "text-xs text-muted-foreground/70" })]
614
- }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(Ae, { schema: de }), fe && J.length > 0 && /* @__PURE__ */ Z("div", {
615
- className: "mt-2 space-y-1",
616
- "data-testid": "row-actions",
617
- children: J.map((e, t) => /* @__PURE__ */ Q("div", {
618
- className: "flex items-center justify-between px-2 py-1 text-xs border-b last:border-b-0",
619
- children: [/* @__PURE__ */ Z("span", {
620
- className: "truncate text-muted-foreground",
621
- children: e.name || e.title || e.id || `Row ${t + 1}`
622
- }), /* @__PURE__ */ Q("div", {
623
- className: "flex items-center gap-1",
624
- children: [y && /* @__PURE__ */ Q(i, {
625
- variant: "ghost",
694
+ })
695
+ }),
696
+ !pe && /* @__PURE__ */ Q(h, {
697
+ className: F("pt-0", Ne ? "pb-3 px-4" : "pb-4 px-4"),
698
+ children: [
699
+ Pe && /* @__PURE__ */ Z("div", {
700
+ className: "mb-3",
701
+ children: /* @__PURE__ */ Z(x, {
702
+ placeholder: q("detail.filterPlaceholder"),
703
+ value: ue,
704
+ onChange: (e) => de(e.target.value),
705
+ className: "h-8 text-sm"
706
+ })
707
+ }),
708
+ M && Ee && Ee.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
709
+ className: "flex flex-wrap gap-1 mb-3",
710
+ children: Ee.map((e) => {
711
+ let t = e.accessorKey || e.field || e.name;
712
+ if (!t) return null;
713
+ let n = e.header || e.label || t, r = U === t;
714
+ return /* @__PURE__ */ Q(p, {
715
+ variant: r ? "secondary" : "ghost",
626
716
  size: "sm",
627
- className: "h-6 text-xs gap-1 px-2",
628
- onClick: () => y(e),
629
- children: [/* @__PURE__ */ Z(H, { className: "h-3 w-3" }), W("detail.editRow")]
630
- }), b && /* @__PURE__ */ Q(i, {
631
- variant: "ghost",
717
+ className: "gap-1 h-7 text-xs",
718
+ onClick: () => Se(t),
719
+ children: [
720
+ /* @__PURE__ */ Z(z, { className: "h-3 w-3" }),
721
+ n,
722
+ r && (ce === "asc" ? " ↑" : " ↓")
723
+ ]
724
+ }, t);
725
+ })
726
+ }),
727
+ re ? /* @__PURE__ */ Z("div", {
728
+ className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
729
+ children: q("detail.loading")
730
+ }) : Ne ? /* @__PURE__ */ Q("div", {
731
+ className: "flex flex-col items-center justify-center gap-2 py-6 text-sm",
732
+ children: [
733
+ /* @__PURE__ */ Z(Me, {
734
+ className: "h-8 w-8 text-muted-foreground/40",
735
+ "aria-hidden": !0
736
+ }),
737
+ /* @__PURE__ */ Z("span", {
738
+ className: "text-muted-foreground italic",
739
+ children: q("detail.noRelatedRecords")
740
+ }),
741
+ T && /* @__PURE__ */ Q(p, {
742
+ variant: "outline",
632
743
  size: "sm",
633
- className: "h-6 text-xs gap-1 px-2 text-destructive hover:text-destructive",
634
- onClick: () => Y(e),
635
- children: [/* @__PURE__ */ Z(Te, { className: "h-3 w-3" }), W("detail.deleteRow")]
636
- })]
637
- })]
638
- }, e.id || t))
639
- })] }),
640
- K > 0 && ce.length > K && /* @__PURE__ */ Q("div", {
641
- className: "flex items-center justify-between mt-3 pt-3 border-t",
642
- children: [
643
- /* @__PURE__ */ Q(i, {
644
- variant: "outline",
645
- size: "sm",
646
- className: "h-7 text-xs gap-1",
647
- disabled: P === 0,
648
- onClick: () => F((e) => Math.max(0, e - 1)),
649
- children: [/* @__PURE__ */ Z(ee, { className: "h-3 w-3" }), W("detail.previousPage")]
650
- }),
651
- /* @__PURE__ */ Z("span", {
652
- className: "text-xs text-muted-foreground",
653
- children: W("detail.pageOf", {
654
- current: P + 1,
655
- total: q
744
+ onClick: T,
745
+ className: "gap-1 h-7 text-xs mt-1",
746
+ children: [/* @__PURE__ */ Z(ke, { className: "h-3.5 w-3.5" }), q("detail.new")]
656
747
  })
657
- }),
658
- /* @__PURE__ */ Q(i, {
659
- variant: "outline",
660
- size: "sm",
661
- className: "h-7 text-xs gap-1",
662
- disabled: P >= q - 1,
663
- onClick: () => F((e) => Math.min(q - 1, e + 1)),
664
- children: [W("detail.nextPage"), /* @__PURE__ */ Z(L, { className: "h-3 w-3" })]
748
+ ]
749
+ }) : /* @__PURE__ */ Z(He, { schema: Oe }),
750
+ J > 0 && ye.length > J && /* @__PURE__ */ Q("div", {
751
+ className: "flex items-center justify-between mt-3 pt-3 border-t",
752
+ children: [
753
+ /* @__PURE__ */ Q(p, {
754
+ variant: "outline",
755
+ size: "sm",
756
+ className: "h-7 text-xs gap-1",
757
+ disabled: H === 0,
758
+ onClick: () => ie((e) => Math.max(0, e - 1)),
759
+ children: [/* @__PURE__ */ Z(oe, { className: "h-3 w-3" }), q("detail.previousPage")]
760
+ }),
761
+ /* @__PURE__ */ Z("span", {
762
+ className: "text-xs text-muted-foreground",
763
+ children: q("detail.pageOf", {
764
+ current: H + 1,
765
+ total: be
766
+ })
767
+ }),
768
+ /* @__PURE__ */ Q(p, {
769
+ variant: "outline",
770
+ size: "sm",
771
+ className: "h-7 text-xs gap-1",
772
+ disabled: H >= be - 1,
773
+ onClick: () => ie((e) => Math.min(be - 1, e + 1)),
774
+ children: [q("detail.nextPage"), /* @__PURE__ */ Z(W, { className: "h-3 w-3" })]
775
+ })
776
+ ]
777
+ }),
778
+ E && !Ne && J > 0 && ye.length > J && /* @__PURE__ */ Z("div", {
779
+ className: "mt-3 pt-3 border-t flex justify-center",
780
+ children: /* @__PURE__ */ Q("button", {
781
+ type: "button",
782
+ onClick: (e) => {
783
+ e.stopPropagation(), E();
784
+ },
785
+ className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
786
+ children: [q("detail.viewAll"), /* @__PURE__ */ Z(fe, { className: "h-3 w-3" })]
665
787
  })
666
- ]
667
- })
668
- ]
669
- })]
788
+ })
789
+ ]
790
+ }),
791
+ /* @__PURE__ */ Z(i, {
792
+ open: Y !== null,
793
+ onOpenChange: (e) => {
794
+ e || Ce(null);
795
+ },
796
+ children: /* @__PURE__ */ Q(s, { children: [/* @__PURE__ */ Q(u, { children: [/* @__PURE__ */ Z(d, { children: q("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(c, { children: q("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Z(o, { children: q("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(a, {
797
+ onClick: Te,
798
+ className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
799
+ children: q("detail.delete", { defaultValue: "Delete" })
800
+ })] })] })
801
+ })
802
+ ]
670
803
  });
671
- }, Ke = ({ group: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s }) => {
672
- let c = e.collapsible ?? !0, [f, p] = n.useState(e.defaultCollapsed ?? !1), m = /* @__PURE__ */ Z("div", {
804
+ }, st = ({ group: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s }) => {
805
+ let c = e.collapsible ?? !0, [l, u] = n.useState(e.defaultCollapsed ?? !1), d = /* @__PURE__ */ Z("div", {
673
806
  className: "space-y-3 sm:space-y-4",
674
- children: e.sections.map((e, n) => /* @__PURE__ */ Z(He, {
807
+ children: e.sections.map((e, n) => /* @__PURE__ */ Z(rt, {
675
808
  section: e,
676
809
  data: t,
677
810
  objectSchema: i,
@@ -680,17 +813,17 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
680
813
  onFieldChange: s
681
814
  }, n))
682
815
  });
683
- return c ? /* @__PURE__ */ Q(l, {
684
- open: !f,
685
- onOpenChange: (e) => p(!e),
816
+ return c ? /* @__PURE__ */ Q(v, {
817
+ open: !l,
818
+ onOpenChange: (e) => u(!e),
686
819
  className: r,
687
820
  children: [
688
- /* @__PURE__ */ Z(d, {
821
+ /* @__PURE__ */ Z(b, {
689
822
  asChild: !0,
690
823
  children: /* @__PURE__ */ Q("div", {
691
824
  className: "flex items-center gap-2 pb-2 border-b cursor-pointer hover:bg-muted/50 transition-colors rounded-t-md px-2 py-1.5",
692
825
  children: [
693
- Z(f ? L : I, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
826
+ Z(l ? W : ae, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
694
827
  e.icon && /* @__PURE__ */ Z("span", {
695
828
  className: "text-muted-foreground",
696
829
  children: e.icon
@@ -702,17 +835,17 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
702
835
  ]
703
836
  })
704
837
  }),
705
- e.description && !f && /* @__PURE__ */ Z("p", {
838
+ e.description && !l && /* @__PURE__ */ Z("p", {
706
839
  className: "text-sm text-muted-foreground mt-1",
707
840
  children: e.description
708
841
  }),
709
- /* @__PURE__ */ Z(u, { children: /* @__PURE__ */ Z("div", {
842
+ /* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Z("div", {
710
843
  className: "mt-3",
711
- children: m
844
+ children: d
712
845
  }) })
713
846
  ]
714
847
  }) : /* @__PURE__ */ Q("div", {
715
- className: S("space-y-3", r),
848
+ className: F("space-y-3", r),
716
849
  children: [
717
850
  /* @__PURE__ */ Q("div", {
718
851
  className: "flex items-center gap-2 pb-2 border-b",
@@ -728,32 +861,32 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
728
861
  className: "text-sm text-muted-foreground",
729
862
  children: e.description
730
863
  }),
731
- m
864
+ d
732
865
  ]
733
866
  });
734
- }, qe = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
735
- let { fieldLabel: s } = Me();
867
+ }, ct = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
868
+ let { fieldLabel: a } = We();
736
869
  if (!e.length || !t) return null;
737
- let c = e.filter((e) => {
870
+ let o = e.filter((e) => {
738
871
  let n = t?.[e.name];
739
872
  return n != null && n !== "";
740
873
  });
741
- return c.length === 0 ? null : /* @__PURE__ */ Z(a, {
742
- className: S("bg-muted/30 border-dashed", n),
743
- children: /* @__PURE__ */ Z(o, {
874
+ return o.length === 0 ? null : /* @__PURE__ */ Z(m, {
875
+ className: F("bg-muted/30 border-dashed", n),
876
+ children: /* @__PURE__ */ Z(h, {
744
877
  className: "py-3 px-4",
745
878
  children: /* @__PURE__ */ Z("div", {
746
- className: S("grid gap-4", c.length === 1 ? "grid-cols-1" : c.length === 2 ? "grid-cols-2" : c.length === 3 ? "grid-cols-3" : "grid-cols-2 md:grid-cols-4"),
747
- children: c.map((e) => {
748
- let n = t[e.name], a = i?.fields?.[e.name], o = e.type || a?.type, c = {
879
+ className: F("grid gap-4", o.length === 1 ? "grid-cols-1" : o.length === 2 ? "grid-cols-2" : o.length === 3 ? "grid-cols-3" : "grid-cols-2 md:grid-cols-4"),
880
+ children: o.map((e) => {
881
+ let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
749
882
  name: e.name,
750
883
  label: e.label,
751
- type: o || "text",
752
- ...a?.options && { options: a.options },
753
- ...a?.currency && { currency: a.currency },
754
- ...a?.precision !== void 0 && { precision: a.precision },
755
- ...a?.format && { format: a.format }
756
- }, l = Ne(o || "text");
884
+ type: s || "text",
885
+ ...o?.options && { options: o.options },
886
+ ...o?.currency && { currency: o.currency },
887
+ ...o?.precision !== void 0 && { precision: o.precision },
888
+ ...o?.format && { format: o.format }
889
+ }, l = qe(Je(c) || s || "text");
757
890
  return /* @__PURE__ */ Q("div", {
758
891
  className: "flex flex-col gap-0.5",
759
892
  children: [/* @__PURE__ */ Q("span", {
@@ -761,7 +894,7 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
761
894
  children: [e.icon && /* @__PURE__ */ Z("span", {
762
895
  className: "mr-1",
763
896
  children: e.icon
764
- }), s(r || "", e.name, e.label)]
897
+ }), a(r || "", e.name, e.label)]
765
898
  }), /* @__PURE__ */ Z("span", {
766
899
  className: "text-sm font-semibold truncate",
767
900
  children: /* @__PURE__ */ Z(l, {
@@ -777,7 +910,7 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
777
910
  };
778
911
  //#endregion
779
912
  //#region src/RecordComments.tsx
780
- function Je(e) {
913
+ function lt(e) {
781
914
  try {
782
915
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
783
916
  if (r < 1) return "just now";
@@ -790,30 +923,30 @@ function Je(e) {
790
923
  return e;
791
924
  }
792
925
  }
793
- var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, className: u }) => {
794
- let { t: d } = $(), [f, p] = n.useState(""), [m, h] = n.useState(!1), [g, _] = n.useState(""), v = n.useCallback(async () => {
795
- let e = f.trim();
926
+ var ut = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, className: a }) => {
927
+ let { t: o } = $(), [s, c] = n.useState(""), [l, u] = n.useState(!1), [d, f] = n.useState(""), v = n.useCallback(async () => {
928
+ let e = s.trim();
796
929
  if (!(!e || !t)) {
797
- h(!0);
930
+ u(!0);
798
931
  try {
799
- await t(e), p("");
932
+ await t(e), c("");
800
933
  } finally {
801
- h(!1);
934
+ u(!1);
802
935
  }
803
936
  }
804
- }, [f, t]), y = n.useCallback((e) => {
937
+ }, [s, t]), y = n.useCallback((e) => {
805
938
  e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), v());
806
- }, [v]), b = n.useMemo(() => [...g.trim() ? e.filter((e) => {
807
- let t = g.trim().toLowerCase();
939
+ }, [v]), b = n.useMemo(() => [...d.trim() ? e.filter((e) => {
940
+ let t = d.trim().toLowerCase();
808
941
  return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
809
- }) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, g]);
810
- return /* @__PURE__ */ Q(a, {
811
- className: S("", u),
812
- children: [/* @__PURE__ */ Z(s, { children: /* @__PURE__ */ Q(c, {
942
+ }) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
943
+ return /* @__PURE__ */ Q(m, {
944
+ className: F("", a),
945
+ children: [/* @__PURE__ */ Z(g, { children: /* @__PURE__ */ Q(_, {
813
946
  className: "flex items-center gap-2 text-base",
814
947
  children: [
815
948
  /* @__PURE__ */ Z(Y, { className: "h-4 w-4" }),
816
- d("detail.comments"),
949
+ o("detail.comments"),
817
950
  /* @__PURE__ */ Q("span", {
818
951
  className: "text-sm font-normal text-muted-foreground",
819
952
  children: [
@@ -823,28 +956,28 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
823
956
  ]
824
957
  })
825
958
  ]
826
- }) }), /* @__PURE__ */ Q(o, {
959
+ }) }), /* @__PURE__ */ Q(h, {
827
960
  className: "space-y-4",
828
961
  children: [
829
- l && /* @__PURE__ */ Z("div", {
962
+ i && /* @__PURE__ */ Z("div", {
830
963
  className: "flex items-center gap-2",
831
964
  children: /* @__PURE__ */ Q("div", {
832
965
  className: "relative flex-1",
833
966
  children: [
834
- /* @__PURE__ */ Z(be, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
967
+ /* @__PURE__ */ Z(Ne, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
835
968
  /* @__PURE__ */ Z("input", {
836
969
  className: "w-full rounded-md border border-input bg-background pl-8 pr-8 py-1.5 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
837
- placeholder: d("detail.searchComments"),
838
- value: g,
839
- onChange: (e) => _(e.target.value),
840
- "aria-label": d("detail.searchComments")
970
+ placeholder: o("detail.searchComments"),
971
+ value: d,
972
+ onChange: (e) => f(e.target.value),
973
+ "aria-label": o("detail.searchComments")
841
974
  }),
842
- g && /* @__PURE__ */ Z("button", {
975
+ d && /* @__PURE__ */ Z("button", {
843
976
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
844
- onClick: () => _(""),
845
- "aria-label": d("detail.clearSearch"),
977
+ onClick: () => f(""),
978
+ "aria-label": o("detail.clearSearch"),
846
979
  type: "button",
847
- children: /* @__PURE__ */ Z(De, { className: "h-3.5 w-3.5" })
980
+ children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
848
981
  })
849
982
  ]
850
983
  })
@@ -853,27 +986,27 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
853
986
  className: "flex gap-2",
854
987
  children: [/* @__PURE__ */ Z("textarea", {
855
988
  className: "flex-1 min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none",
856
- placeholder: d("detail.addCommentPlaceholder"),
857
- value: f,
858
- onChange: (e) => p(e.target.value),
989
+ placeholder: o("detail.addCommentPlaceholder"),
990
+ value: s,
991
+ onChange: (e) => c(e.target.value),
859
992
  onKeyDown: y,
860
- disabled: m
861
- }), /* @__PURE__ */ Z(i, {
993
+ disabled: l
994
+ }), /* @__PURE__ */ Z(p, {
862
995
  size: "icon",
863
996
  variant: "default",
864
997
  onClick: v,
865
- disabled: !f.trim() || m,
998
+ disabled: !s.trim() || l,
866
999
  className: "shrink-0 self-end",
867
- children: /* @__PURE__ */ Z(xe, { className: "h-4 w-4" })
1000
+ children: /* @__PURE__ */ Z(Pe, { className: "h-4 w-4" })
868
1001
  })]
869
1002
  }),
870
1003
  b.length === 0 ? /* @__PURE__ */ Z("p", {
871
1004
  className: "text-sm text-muted-foreground text-center py-4",
872
- children: g.trim() ? d("detail.noMatchingComments") : d("detail.noCommentsYet")
1005
+ children: d.trim() ? o("detail.noMatchingComments") : o("detail.noCommentsYet")
873
1006
  }) : /* @__PURE__ */ Z("div", {
874
1007
  className: "space-y-3",
875
1008
  children: b.map((e) => /* @__PURE__ */ Q("div", {
876
- className: S("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
1009
+ className: F("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
877
1010
  children: [/* @__PURE__ */ Z("div", {
878
1011
  className: "shrink-0",
879
1012
  children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
@@ -896,11 +1029,11 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
896
1029
  }),
897
1030
  /* @__PURE__ */ Z("span", {
898
1031
  className: "text-xs text-muted-foreground",
899
- children: Je(e.createdAt)
1032
+ children: lt(e.createdAt)
900
1033
  }),
901
1034
  e.pinned && /* @__PURE__ */ Q("span", {
902
1035
  className: "text-xs text-amber-600 flex items-center gap-0.5",
903
- children: [/* @__PURE__ */ Z(he, { className: "h-3 w-3" }), d("detail.pinned")]
1036
+ children: [/* @__PURE__ */ Z(Oe, { className: "h-3 w-3" }), o("detail.pinned")]
904
1037
  })
905
1038
  ]
906
1039
  }),
@@ -912,8 +1045,8 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
912
1045
  type: "button",
913
1046
  className: "mt-1 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",
914
1047
  onClick: () => r(e.id),
915
- "aria-label": e.pinned ? d("detail.unpin") : d("detail.pin"),
916
- children: [/* @__PURE__ */ Z(he, { className: "h-3 w-3" }), e.pinned ? d("detail.unpin") : d("detail.pin")]
1048
+ "aria-label": e.pinned ? o("detail.unpin") : o("detail.pin"),
1049
+ children: [/* @__PURE__ */ Z(Oe, { className: "h-3 w-3" }), e.pinned ? o("detail.unpin") : o("detail.pin")]
917
1050
  })
918
1051
  ]
919
1052
  })]
@@ -922,20 +1055,20 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
922
1055
  ]
923
1056
  })]
924
1057
  });
925
- }, Xe = {
926
- field_change: H,
927
- create: _e,
928
- delete: Te,
1058
+ }, dt = {
1059
+ field_change: G,
1060
+ create: Ae,
1061
+ delete: Le,
929
1062
  comment: Y,
930
- status_change: D
931
- }, Ze = {
1063
+ status_change: te
1064
+ }, ft = {
932
1065
  field_change: "bg-blue-100 text-blue-600",
933
1066
  create: "bg-green-100 text-green-600",
934
1067
  delete: "bg-red-100 text-red-600",
935
1068
  comment: "bg-purple-100 text-purple-600",
936
1069
  status_change: "bg-amber-100 text-amber-600"
937
1070
  };
938
- function Qe(e) {
1071
+ function pt(e) {
939
1072
  try {
940
1073
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
941
1074
  if (r < 1) return "just now";
@@ -948,58 +1081,58 @@ function Qe(e) {
948
1081
  return e;
949
1082
  }
950
1083
  }
951
- function $e(e) {
1084
+ function mt(e) {
952
1085
  return e.description ? e.description : e.type === "field_change" && e.field ? `Changed ${e.field.charAt(0).toUpperCase() + e.field.slice(1).replace(/_/g, " ")} from "${e.oldValue == null ? "(empty)" : String(e.oldValue)}" to "${e.newValue == null ? "(empty)" : String(e.newValue)}"` : e.type === "create" ? "Created this record" : e.type === "delete" ? "Deleted this record" : e.type === "status_change" && e.field ? `Changed status to "${e.newValue == null ? "(empty)" : String(e.newValue)}"` : "Updated record";
953
1086
  }
954
- var et = {
1087
+ var ht = {
955
1088
  all: "All",
956
1089
  field_change: "Field Changes",
957
1090
  create: "Creates",
958
1091
  delete: "Deletes",
959
1092
  comment: "Comments",
960
1093
  status_change: "Status Changes"
961
- }, tt = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
962
- let [l, u] = n.useState(r), d = n.useMemo(() => l === "all" ? e : e.filter((e) => e.type === l), [e, l]);
963
- return /* @__PURE__ */ Q(a, {
964
- className: S("", i),
965
- children: [/* @__PURE__ */ Z(s, { children: /* @__PURE__ */ Q(c, {
1094
+ }, gt = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
1095
+ let [a, o] = n.useState(r), s = n.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
1096
+ return /* @__PURE__ */ Q(m, {
1097
+ className: F("", i),
1098
+ children: [/* @__PURE__ */ Z(g, { children: /* @__PURE__ */ Q(_, {
966
1099
  className: "flex items-center gap-2 text-base",
967
1100
  children: [
968
- /* @__PURE__ */ Z(w, { className: "h-4 w-4" }),
1101
+ /* @__PURE__ */ Z(L, { className: "h-4 w-4" }),
969
1102
  "Activity",
970
1103
  /* @__PURE__ */ Q("span", {
971
1104
  className: "text-sm font-normal text-muted-foreground",
972
1105
  children: [
973
1106
  "(",
974
- d.length,
1107
+ s.length,
975
1108
  ")"
976
1109
  ]
977
1110
  })
978
1111
  ]
979
- }) }), /* @__PURE__ */ Q(o, { children: [t && /* @__PURE__ */ Z("div", {
1112
+ }) }), /* @__PURE__ */ Q(h, { children: [t && /* @__PURE__ */ Z("div", {
980
1113
  className: "flex flex-wrap gap-1.5 mb-4",
981
1114
  role: "group",
982
1115
  "aria-label": "Activity type filter",
983
- children: Object.keys(et).map((e) => /* @__PURE__ */ Q("button", {
1116
+ children: Object.keys(ht).map((e) => /* @__PURE__ */ Q("button", {
984
1117
  type: "button",
985
- className: S("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors", l === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"),
986
- onClick: () => u(e),
987
- "aria-pressed": l === e,
988
- children: [e !== "all" && n.createElement(Xe[e] || H, { className: "h-3 w-3" }), et[e]]
1118
+ className: F("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors", a === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"),
1119
+ onClick: () => o(e),
1120
+ "aria-pressed": a === e,
1121
+ children: [e !== "all" && n.createElement(dt[e] || G, { className: "h-3 w-3" }), ht[e]]
989
1122
  }, e))
990
- }), d.length === 0 ? /* @__PURE__ */ Z("p", {
1123
+ }), s.length === 0 ? /* @__PURE__ */ Z("p", {
991
1124
  className: "text-sm text-muted-foreground text-center py-4",
992
1125
  children: "No activity recorded"
993
1126
  }) : /* @__PURE__ */ Q("div", {
994
1127
  className: "relative",
995
1128
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
996
1129
  className: "space-y-4",
997
- children: d.map((e) => {
998
- let t = Xe[e.type] || H;
1130
+ children: s.map((e) => {
1131
+ let t = dt[e.type] || G;
999
1132
  return /* @__PURE__ */ Q("div", {
1000
1133
  className: "flex gap-3 relative",
1001
1134
  children: [/* @__PURE__ */ Z("div", {
1002
- className: S("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", Ze[e.type] || "bg-gray-100 text-gray-600"),
1135
+ className: F("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", ft[e.type] || "bg-gray-100 text-gray-600"),
1003
1136
  children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
1004
1137
  }), /* @__PURE__ */ Q("div", {
1005
1138
  className: "flex-1 min-w-0 pt-1",
@@ -1013,12 +1146,12 @@ var et = {
1013
1146
  " ",
1014
1147
  /* @__PURE__ */ Z("span", {
1015
1148
  className: "text-muted-foreground",
1016
- children: $e(e)
1149
+ children: mt(e)
1017
1150
  })
1018
1151
  ]
1019
1152
  }), /* @__PURE__ */ Z("p", {
1020
1153
  className: "text-xs text-muted-foreground mt-0.5",
1021
- children: Qe(e.timestamp)
1154
+ children: pt(e.timestamp)
1022
1155
  })]
1023
1156
  })]
1024
1157
  }, e.id);
@@ -1026,8 +1159,8 @@ var et = {
1026
1159
  })]
1027
1160
  })] })]
1028
1161
  });
1029
- }, nt = 5;
1030
- function rt(e, t, n, r) {
1162
+ }, _t = 5;
1163
+ function vt(e, t, n, r) {
1031
1164
  if (e && typeof e == "object") {
1032
1165
  if (t.primaryField) {
1033
1166
  let n = e[t.primaryField];
@@ -1062,21 +1195,21 @@ function rt(e, t, n, r) {
1062
1195
  }
1063
1196
  return r;
1064
1197
  }
1065
- var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBack: l, inlineEdit: u = !1, onFieldSave: d, discussionSlot: f, rightRail: C, objectLabel: w, onDataLoaded: E }) => {
1066
- let [D, O] = n.useState(e.data), [k, A] = n.useState(!e.data && !!(e.api && e.resourceId || a && e.objectName && e.resourceId)), [j, M] = n.useState(!1), [N, F] = n.useState(!1), [I, R] = n.useState({}), [z, B] = n.useState(null), [V, ne] = n.useState(!1), { t: U } = $();
1198
+ var yt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: m, onDataLoaded: h }) => {
1199
+ let [g, _] = n.useState(e.data), [v, y] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [b, x] = n.useState(!1), [S, C] = n.useState(!1), [w, T] = n.useState({}), [I, L] = n.useState(null), [R, te] = n.useState(!1), { t: z } = $(), { fieldOptionLabel: B } = We();
1067
1200
  n.useEffect(() => {
1068
- D && E && E(D);
1069
- }, [D, E]);
1070
- let re = n.useMemo(() => {
1201
+ g && h && h(g);
1202
+ }, [g, h]);
1203
+ let ne = n.useMemo(() => {
1071
1204
  if (e.summaryFields && e.summaryFields.length > 0) return [];
1072
1205
  let t = [...e.sections?.flatMap((e) => e.fields) || [], ...e.fields || []], n = {};
1073
1206
  for (let e of t) n[e.name] || (n[e.name] = e);
1074
- if (z?.fields) for (let [e, t] of Object.entries(z.fields)) n[e] = {
1207
+ if (I?.fields) for (let [e, t] of Object.entries(I.fields)) n[e] = {
1075
1208
  ...n[e] || {},
1076
1209
  ...t,
1077
1210
  name: e
1078
1211
  };
1079
- let r = (e) => D?.[e] !== void 0 && D?.[e] !== null && D?.[e] !== "", i = [], a = [
1212
+ let r = (e) => g?.[e] !== void 0 && g?.[e] !== null && g?.[e] !== "", i = [], a = [
1080
1213
  "status",
1081
1214
  "stage",
1082
1215
  "state",
@@ -1091,51 +1224,51 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1091
1224
  e.summaryFields,
1092
1225
  e.sections,
1093
1226
  e.fields,
1094
- z,
1095
- D
1096
- ]), ie = e.summaryFields && e.summaryFields.length > 0 ? e.summaryFields : re, ae = n.useCallback(() => {
1227
+ I,
1228
+ g
1229
+ ]), re = e.summaryFields && e.summaryFields.length > 0 ? e.summaryFields : ne, V = n.useCallback(() => {
1097
1230
  e.resourceId && navigator.clipboard.writeText(String(e.resourceId)).then(() => {
1098
- ne(!0), setTimeout(() => ne(!1), 1500);
1231
+ te(!0), setTimeout(() => te(!1), 1500);
1099
1232
  });
1100
1233
  }, [e.resourceId]);
1101
1234
  n.useEffect(() => {
1102
1235
  let n = !0;
1103
1236
  if (e.data) {
1104
- O(e.data), A(!1);
1237
+ _(e.data), y(!1);
1105
1238
  return;
1106
1239
  }
1107
- if (a && e.objectName && e.resourceId) {
1108
- A(!0), B(null), O(null);
1109
- let r = e.objectName, i = e.resourceId, o = `${r}-`, s = [...e.sections?.flatMap((e) => e.fields) || [], ...e.fields || []];
1110
- (a.getObjectSchema ? a.getObjectSchema(r).catch(() => null) : Promise.resolve(null)).then((e) => {
1240
+ if (r && e.objectName && e.resourceId) {
1241
+ y(!0), L(null), _(null);
1242
+ let i = e.objectName, a = e.resourceId, o = `${i}-`, s = [...e.sections?.flatMap((e) => e.fields) || [], ...e.fields || []];
1243
+ (r.getObjectSchema ? r.getObjectSchema(i).catch(() => null) : Promise.resolve(null)).then((e) => {
1111
1244
  if (!n) return;
1112
- B(e);
1113
- let c = t(e?.fields, s), l = c.length > 0 ? { $expand: c } : void 0, u = l ? a.findOne(r, i, l) : a.findOne(r, i), d = () => {
1114
- let e = String(i), t = e.startsWith(o) ? e.slice(o.length) : `${o}${e}`;
1115
- return (l ? a.findOne(r, t, l) : a.findOne(r, t)).then((e) => {
1116
- n && (O(e), A(!1));
1245
+ L(e);
1246
+ let c = t(e?.fields, s), l = c.length > 0 ? { $expand: c } : void 0, u = l ? r.findOne(i, a, l) : r.findOne(i, a), d = () => {
1247
+ let e = String(a), t = e.startsWith(o) ? e.slice(o.length) : `${o}${e}`;
1248
+ return (l ? r.findOne(i, t, l) : r.findOne(i, t)).then((e) => {
1249
+ n && (_(e), y(!1));
1117
1250
  }).catch(() => {
1118
- n && (O(null), A(!1));
1251
+ n && (_(null), y(!1));
1119
1252
  });
1120
1253
  };
1121
1254
  return u.catch(() => null).then((e) => {
1122
1255
  if (n) {
1123
1256
  if (e) {
1124
- O(e), A(!1);
1257
+ _(e), y(!1);
1125
1258
  return;
1126
1259
  }
1127
1260
  return d();
1128
1261
  }
1129
1262
  });
1130
1263
  }).catch((e) => {
1131
- n && (console.error("Failed to fetch detail data:", e), A(!1));
1264
+ n && (console.error("Failed to fetch detail data:", e), y(!1));
1132
1265
  });
1133
- } else e.api && e.resourceId && (A(!0), fetch(`${e.api}/${e.resourceId}`).then((e) => e.json()).then((e) => {
1134
- n && O(e?.data || e);
1266
+ } else e.api && e.resourceId && (y(!0), fetch(`${e.api}/${e.resourceId}`).then((e) => e.json()).then((e) => {
1267
+ n && _(e?.data || e);
1135
1268
  }).catch((e) => {
1136
1269
  console.error("Failed to fetch detail data:", e);
1137
1270
  }).finally(() => {
1138
- n && A(!1);
1271
+ n && y(!1);
1139
1272
  }));
1140
1273
  return () => {
1141
1274
  n = !1;
@@ -1144,53 +1277,55 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1144
1277
  e.api,
1145
1278
  e.resourceId,
1146
1279
  e.objectName,
1147
- a,
1280
+ r,
1148
1281
  e.sections,
1149
1282
  e.fields
1150
1283
  ]);
1151
- let oe = n.useCallback(() => {
1152
- if (l) l();
1284
+ let H = n.useCallback(() => {
1285
+ if (s) s();
1153
1286
  else if (e.onNavigate) {
1154
1287
  let t = e.backUrl || (e.objectName ? `/${e.objectName}` : "/");
1155
1288
  e.onNavigate(t, { replace: !0 });
1156
1289
  } else e.backUrl ? window.location.href = e.backUrl : window.history.back();
1157
- }, [l, e]), W = n.useCallback(() => {
1158
- s ? s() : e.onNavigate && e.editUrl ? e.onNavigate(e.editUrl) : e.onNavigate && e.objectName && e.resourceId ? e.onNavigate(`/${e.objectName}/${e.resourceId}/edit`) : e.editUrl && (window.location.href = e.editUrl);
1159
- }, [s, e]), se = n.useCallback(() => {
1160
- let t = e.deleteConfirmation || U("detail.deleteConfirmation");
1161
- window.confirm(t) && (c?.(), e.onNavigate && e.objectName && e.onNavigate(`/${e.objectName}`, { replace: !0 }));
1162
- }, [c, e]), G = n.useCallback(() => {
1290
+ }, [s, e]), U = n.useCallback(() => {
1291
+ a ? a() : e.onNavigate && e.editUrl ? e.onNavigate(e.editUrl) : e.onNavigate && e.objectName && e.resourceId ? e.onNavigate(`/${e.objectName}/${e.resourceId}/edit`) : e.editUrl && (window.location.href = e.editUrl);
1292
+ }, [a, e]), ae = n.useCallback(() => {
1293
+ let t = e.deleteConfirmation || z("detail.deleteConfirmation");
1294
+ window.confirm(t) && (o?.(), e.onNavigate && e.objectName && e.onNavigate(`/${e.objectName}`, { replace: !0 }));
1295
+ }, [o, e]), se = n.useCallback(() => {
1163
1296
  navigator.share && e.objectName && e.resourceId ? navigator.share({
1164
- title: e.title || U("detail.details"),
1297
+ title: e.title || z("detail.details"),
1165
1298
  text: `${e.objectName} #${e.resourceId}`,
1166
1299
  url: window.location.href
1167
1300
  }).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
1168
1301
  console.log("Link copied to clipboard");
1169
1302
  });
1170
1303
  }, [e]), ce = n.useCallback(() => {
1171
- M(!j);
1172
- }, [j]), K = n.useCallback(() => {
1173
- if (N) {
1174
- let e = Object.entries(I);
1304
+ x(!b);
1305
+ }, [b]), le = n.useCallback(() => {
1306
+ if (S) {
1307
+ let e = Object.entries(w);
1175
1308
  if (e.length > 0) {
1176
1309
  let t = {
1177
- ...D,
1178
- ...I
1310
+ ...g,
1311
+ ...w
1179
1312
  };
1180
- O(t), e.forEach(([e, n]) => {
1181
- d?.(e, n, t);
1313
+ _(t), e.forEach(([e, n]) => {
1314
+ l?.(e, n, t);
1182
1315
  });
1183
1316
  }
1184
- R({});
1317
+ T({});
1185
1318
  }
1186
- F(!N);
1319
+ C(!S);
1187
1320
  }, [
1188
- N,
1189
- I,
1190
- D,
1191
- d
1192
- ]), q = n.useCallback((e, t) => {
1193
- R((n) => ({
1321
+ S,
1322
+ w,
1323
+ g,
1324
+ l
1325
+ ]), ue = n.useCallback(() => {
1326
+ T({}), C(!1);
1327
+ }, []), fe = n.useCallback((e, t) => {
1328
+ T((n) => ({
1194
1329
  ...n,
1195
1330
  [e]: t
1196
1331
  }));
@@ -1203,73 +1338,50 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1203
1338
  };
1204
1339
  return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
1205
1340
  }, [e.recordNavigation]);
1206
- let J = n.useMemo(() => {
1207
- if (!e.autoDiscoverRelated || !z?.fields || e.related && e.related.length > 0) return [];
1208
- let t = [], n = z.fields;
1209
- for (let [e, r] of Object.entries(n)) {
1210
- let n = r?.reference_to || r?.reference;
1211
- r && (r.type === "lookup" || r.type === "master_detail") && n && t.push({
1212
- title: r.label || e.charAt(0).toUpperCase() + e.slice(1),
1213
- type: "table",
1214
- objectName: n,
1215
- referenceField: e
1216
- });
1217
- }
1218
- return t;
1219
- }, [
1220
- e.autoDiscoverRelated,
1221
- e.related,
1222
- z
1223
- ]), le = n.useMemo(() => e.related && e.related.length > 0 ? e.related : J.map((e) => ({
1224
- title: e.title,
1225
- type: e.type,
1226
- api: e.objectName,
1227
- data: [],
1228
- referenceField: e.referenceField
1229
- })), [e.related, J]), Y = n.useMemo(() => {
1341
+ let K = n.useMemo(() => e.related ?? [], [e.related]), pe = n.useMemo(() => {
1230
1342
  let t = [];
1231
1343
  return t.push({
1232
1344
  name: "sys_share",
1233
- label: U("detail.share"),
1345
+ label: z("detail.share"),
1234
1346
  icon: "share-2",
1235
1347
  type: "script",
1236
- onClick: G
1348
+ onClick: se
1237
1349
  }), e.showEdit && t.push({
1238
1350
  name: "sys_edit_mobile",
1239
- label: U("detail.edit"),
1351
+ label: z("detail.edit"),
1240
1352
  icon: "edit",
1241
1353
  type: "script",
1242
1354
  className: "sm:hidden",
1243
- onClick: W
1244
- }), u && t.push({
1355
+ onClick: U
1356
+ }), c && t.push({
1245
1357
  name: "sys_toggle_inline_edit_mobile",
1246
- label: U(N ? "detail.save" : "detail.editInline"),
1358
+ label: z(S ? "detail.save" : "detail.editInline"),
1247
1359
  icon: "edit",
1248
1360
  type: "script",
1249
1361
  className: "sm:hidden",
1250
- onClick: K
1362
+ onClick: le
1251
1363
  }), e.showDelete && t.push({
1252
1364
  name: "sys_delete",
1253
- label: U("detail.delete"),
1365
+ label: z("detail.delete"),
1254
1366
  icon: "trash-2",
1255
1367
  type: "script",
1256
1368
  variant: "destructive",
1257
1369
  tags: ["separator-before"],
1258
- onClick: se
1370
+ onClick: ae
1259
1371
  }), t;
1260
1372
  }, [
1261
- U,
1373
+ z,
1262
1374
  e.showEdit,
1263
1375
  e.showDelete,
1264
- u,
1265
- N,
1266
- G,
1267
- W,
1268
- K,
1269
- se
1270
- ]), ue = n.useMemo(() => {
1376
+ c,
1377
+ S,
1378
+ se,
1379
+ U,
1380
+ le,
1381
+ ae
1382
+ ]), me = n.useMemo(() => {
1271
1383
  let t = e.actions ?? [];
1272
- if (Y.length === 0) return t;
1384
+ if (pe.length === 0) return t;
1273
1385
  let n = !1, r = t.map((e) => {
1274
1386
  let t = e;
1275
1387
  if (t && typeof t == "object" && t.type === "action:bar" && (!t.location || t.location === "record_header")) {
@@ -1277,7 +1389,7 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1277
1389
  let e = Array.isArray(t.systemActions) ? t.systemActions : [];
1278
1390
  return {
1279
1391
  ...t,
1280
- systemActions: [...e, ...Y]
1392
+ systemActions: [...e, ...pe]
1281
1393
  };
1282
1394
  }
1283
1395
  return e;
@@ -1285,134 +1397,144 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1285
1397
  return n || r.push({
1286
1398
  type: "action:bar",
1287
1399
  location: "record_header",
1288
- systemActions: Y
1400
+ systemActions: pe
1289
1401
  }), r;
1290
- }, [e.actions, Y]);
1291
- return k || e.loading ? /* @__PURE__ */ Q("div", {
1292
- className: S("space-y-4", o),
1402
+ }, [e.actions, pe]);
1403
+ return v || e.loading ? /* @__PURE__ */ Q("div", {
1404
+ className: F("space-y-4", i),
1293
1405
  children: [
1294
- /* @__PURE__ */ Z(p, { className: "h-10 w-full" }),
1295
- /* @__PURE__ */ Z(p, { className: "h-64 w-full" }),
1296
- /* @__PURE__ */ Z(p, { className: "h-48 w-full" })
1406
+ /* @__PURE__ */ Z(E, { className: "h-10 w-full" }),
1407
+ /* @__PURE__ */ Z(E, { className: "h-64 w-full" }),
1408
+ /* @__PURE__ */ Z(E, { className: "h-48 w-full" })
1297
1409
  ]
1298
- }) : !D && !e.data ? /* @__PURE__ */ Q("div", {
1299
- className: S("flex flex-col items-center justify-center py-16 text-center", o),
1410
+ }) : !g && !e.data ? /* @__PURE__ */ Q("div", {
1411
+ className: F("flex flex-col items-center justify-center py-16 text-center", i),
1300
1412
  children: [
1301
1413
  /* @__PURE__ */ Z("p", {
1302
1414
  className: "text-lg font-semibold",
1303
- children: U("detail.recordNotFound")
1415
+ children: z("detail.recordNotFound")
1304
1416
  }),
1305
1417
  /* @__PURE__ */ Z("p", {
1306
1418
  className: "text-sm text-muted-foreground mt-1",
1307
- children: U("detail.recordNotFoundDescription")
1419
+ children: z("detail.recordNotFoundDescription")
1308
1420
  }),
1309
- (e.showBack ?? !0) && /* @__PURE__ */ Q(i, {
1421
+ (e.showBack ?? !0) && /* @__PURE__ */ Q(p, {
1310
1422
  variant: "outline",
1311
1423
  size: "sm",
1312
- onClick: oe,
1424
+ onClick: H,
1313
1425
  className: "mt-4 gap-2",
1314
- children: [/* @__PURE__ */ Z(T, { className: "h-4 w-4" }), U("detail.goBack")]
1426
+ children: [/* @__PURE__ */ Z(ee, { className: "h-4 w-4" }), z("detail.goBack")]
1315
1427
  })
1316
1428
  ]
1317
- }) : /* @__PURE__ */ Z(b, { children: /* @__PURE__ */ Q("div", {
1318
- className: S("space-y-6", o),
1429
+ }) : /* @__PURE__ */ Z(N, { children: /* @__PURE__ */ Q("div", {
1430
+ className: F("space-y-6", i),
1319
1431
  children: [
1320
1432
  /* @__PURE__ */ Q("div", {
1321
1433
  className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
1322
1434
  children: [/* @__PURE__ */ Q("div", {
1323
1435
  className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
1324
- children: [(e.showBack ?? !0) && /* @__PURE__ */ Q(v, { children: [/* @__PURE__ */ Z(x, {
1436
+ children: [(e.showBack ?? !0) && /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
1325
1437
  asChild: !0,
1326
- children: /* @__PURE__ */ Z(i, {
1438
+ children: /* @__PURE__ */ Z(p, {
1327
1439
  variant: "ghost",
1328
1440
  size: "icon",
1329
- onClick: oe,
1441
+ onClick: H,
1330
1442
  className: "shrink-0 mt-1",
1331
- children: /* @__PURE__ */ Z(T, { className: "h-4 w-4" })
1443
+ children: /* @__PURE__ */ Z(ee, { className: "h-4 w-4" })
1332
1444
  })
1333
- }), /* @__PURE__ */ Z(y, { children: U("detail.back") })] }), /* @__PURE__ */ Q("div", {
1445
+ }), /* @__PURE__ */ Z(M, { children: z("detail.back") })] }), /* @__PURE__ */ Q("div", {
1334
1446
  className: "flex-1 min-w-0",
1335
1447
  children: [/* @__PURE__ */ Q("div", {
1336
1448
  className: "flex items-center gap-2 flex-wrap",
1337
1449
  children: [
1338
1450
  /* @__PURE__ */ Z("h1", {
1339
1451
  className: "text-xl sm:text-2xl font-bold truncate",
1340
- children: rt(D, e, z, U("detail.details"))
1452
+ children: vt(g, e, I, z("detail.details"))
1341
1453
  }),
1342
- ie.map((t) => {
1343
- let n = D?.[t];
1454
+ re.map((t) => {
1455
+ let n = g?.[t];
1344
1456
  if (n == null || n === "") return null;
1345
- let i = (e.sections || []).flatMap((e) => e.fields).concat(e.fields || []).find((e) => e.name === t), a = z?.fields?.[t], o = i?.type || a?.type, s = String(n), c = null;
1457
+ let r = (e.sections || []).flatMap((e) => e.fields).concat(e.fields || []).find((e) => e.name === t), i = I?.fields?.[t], a = r?.type || i?.type, o = String(n), s = null;
1346
1458
  try {
1347
- if (o === "currency") {
1459
+ if (a === "currency") {
1348
1460
  let e = Number(n);
1349
- Number.isNaN(e) || (s = new Intl.NumberFormat(void 0, {
1461
+ Number.isNaN(e) || (o = new Intl.NumberFormat(void 0, {
1350
1462
  style: "currency",
1351
- currency: i?.currency || a?.currency || "USD",
1463
+ currency: r?.currency || i?.currency || "USD",
1352
1464
  maximumFractionDigits: 0
1353
1465
  }).format(e));
1354
- } else if (o === "date" || o === "datetime") {
1466
+ } else if (a === "date" || a === "datetime") {
1355
1467
  let e = new Date(n);
1356
- Number.isNaN(e.getTime()) || (s = o === "datetime" ? e.toLocaleString(void 0, {
1468
+ Number.isNaN(e.getTime()) || (o = a === "datetime" ? e.toLocaleString(void 0, {
1357
1469
  dateStyle: "medium",
1358
1470
  timeStyle: "short"
1359
1471
  }) : e.toLocaleDateString(void 0, { dateStyle: "medium" }));
1360
- } else if (o === "percent") {
1472
+ } else if (a === "percent") {
1361
1473
  let e = Number(n);
1362
1474
  if (!Number.isNaN(e)) {
1363
- s = `${e}%`;
1475
+ o = `${e}%`;
1364
1476
  let t = e <= 1 ? e * 100 : e;
1365
- c = Math.max(0, Math.min(100, t));
1477
+ s = Math.max(0, Math.min(100, t));
1478
+ }
1479
+ } else if (a === "select" || a === "status" || a === "multiselect") {
1480
+ let a = r?.options || i?.options, s = String(n);
1481
+ if (Array.isArray(a)) {
1482
+ let e = a.find((e) => String(e?.value ?? e) === String(n));
1483
+ e?.label && (s = e.label);
1484
+ } else if (a && typeof a == "object") {
1485
+ let e = a[String(n)];
1486
+ e?.label && (s = e.label);
1366
1487
  }
1488
+ o = e.objectName ? B(e.objectName, t, String(n), s) : s;
1367
1489
  }
1368
1490
  } catch {}
1369
- return c === null ? /* @__PURE__ */ Z(r, {
1491
+ return s === null ? /* @__PURE__ */ Z(f, {
1370
1492
  variant: "secondary",
1371
1493
  className: "text-xs bg-primary/10 text-primary border-transparent hover:bg-primary/15",
1372
- "aria-label": `${t}: ${s}`,
1373
- children: s
1374
- }, t) : /* @__PURE__ */ Q(r, {
1494
+ "aria-label": `${t}: ${o}`,
1495
+ children: o
1496
+ }, t) : /* @__PURE__ */ Q(f, {
1375
1497
  variant: "secondary",
1376
1498
  className: "text-xs bg-primary/10 text-primary border-transparent hover:bg-primary/15 gap-1.5 pl-2 pr-2",
1377
- "aria-label": `${t}: ${s}`,
1499
+ "aria-label": `${t}: ${o}`,
1378
1500
  children: [/* @__PURE__ */ Z("span", {
1379
1501
  className: "relative inline-block h-1.5 w-12 rounded-full bg-primary/20 overflow-hidden",
1380
1502
  "aria-hidden": !0,
1381
1503
  children: /* @__PURE__ */ Z("span", {
1382
1504
  className: "absolute inset-y-0 left-0 rounded-full bg-primary",
1383
- style: { width: `${c}%` }
1505
+ style: { width: `${s}%` }
1384
1506
  })
1385
- }), s]
1507
+ }), o]
1386
1508
  }, t);
1387
1509
  }),
1388
- /* @__PURE__ */ Q(v, { children: [/* @__PURE__ */ Z(x, {
1510
+ /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
1389
1511
  asChild: !0,
1390
- children: /* @__PURE__ */ Z(i, {
1512
+ children: /* @__PURE__ */ Z(p, {
1391
1513
  variant: "ghost",
1392
1514
  size: "icon",
1393
1515
  className: "h-6 w-6 shrink-0",
1394
1516
  onClick: ce,
1395
- "aria-label": U(j ? "detail.removeFromFavorites" : "detail.addToFavorites"),
1396
- children: j ? /* @__PURE__ */ Z(Ce, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(we, { className: "h-4 w-4 text-muted-foreground" })
1517
+ "aria-label": z(b ? "detail.removeFromFavorites" : "detail.addToFavorites"),
1518
+ children: b ? /* @__PURE__ */ Z(Ie, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(Ie, { className: "h-4 w-4 text-muted-foreground" })
1397
1519
  })
1398
- }), /* @__PURE__ */ Z(y, { children: U(j ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
1520
+ }), /* @__PURE__ */ Z(M, { children: z(b ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
1399
1521
  ]
1400
1522
  }), e.objectName && /* @__PURE__ */ Q("p", {
1401
1523
  className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
1402
1524
  children: [/* @__PURE__ */ Z("span", {
1403
1525
  className: "font-medium",
1404
- children: w || e.objectName
1405
- }), e.resourceId && /* @__PURE__ */ Q(v, { children: [/* @__PURE__ */ Z(x, {
1526
+ children: m || e.objectName
1527
+ }), e.resourceId && /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
1406
1528
  asChild: !0,
1407
- children: /* @__PURE__ */ Z(i, {
1529
+ children: /* @__PURE__ */ Z(p, {
1408
1530
  variant: "ghost",
1409
1531
  size: "icon",
1410
1532
  className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
1411
- onClick: ae,
1412
- "aria-label": U("detail.copyRecordId", { defaultValue: "Copy record ID" }),
1413
- children: V ? /* @__PURE__ */ Z(P, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(te, { className: "h-3 w-3" })
1533
+ onClick: V,
1534
+ "aria-label": z("detail.copyRecordId", { defaultValue: "Copy record ID" }),
1535
+ children: R ? /* @__PURE__ */ Z(ie, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(de, { className: "h-3 w-3" })
1414
1536
  })
1415
- }), /* @__PURE__ */ Z(y, { children: V ? U("detail.copied", { defaultValue: "Copied" }) : U("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
1537
+ }), /* @__PURE__ */ Z(M, { children: R ? z("detail.copied", { defaultValue: "Copied" }) : z("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
1416
1538
  })]
1417
1539
  })]
1418
1540
  }), /* @__PURE__ */ Q("div", {
@@ -1421,9 +1543,9 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1421
1543
  e.recordNavigation && /* @__PURE__ */ Q("div", {
1422
1544
  className: "flex items-center gap-1 mr-2",
1423
1545
  children: [
1424
- /* @__PURE__ */ Q(v, { children: [/* @__PURE__ */ Z(x, {
1546
+ /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
1425
1547
  asChild: !0,
1426
- children: /* @__PURE__ */ Z(i, {
1548
+ children: /* @__PURE__ */ Z(p, {
1427
1549
  variant: "outline",
1428
1550
  size: "icon",
1429
1551
  className: "h-8 w-8",
@@ -1432,19 +1554,19 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1432
1554
  let t = e.recordNavigation;
1433
1555
  t.currentIndex > 0 && t.onNavigate(t.recordIds[t.currentIndex - 1]);
1434
1556
  },
1435
- children: /* @__PURE__ */ Z(ee, { className: "h-4 w-4" })
1557
+ children: /* @__PURE__ */ Z(oe, { className: "h-4 w-4" })
1436
1558
  })
1437
- }), /* @__PURE__ */ Z(y, { children: U("detail.previousRecord") })] }),
1559
+ }), /* @__PURE__ */ Z(M, { children: z("detail.previousRecord") })] }),
1438
1560
  /* @__PURE__ */ Z("span", {
1439
1561
  className: "text-xs text-muted-foreground whitespace-nowrap px-1",
1440
- children: U("detail.recordOf", {
1562
+ children: z("detail.recordOf", {
1441
1563
  current: e.recordNavigation.currentIndex + 1,
1442
1564
  total: e.recordNavigation.recordIds.length
1443
1565
  })
1444
1566
  }),
1445
- /* @__PURE__ */ Q(v, { children: [/* @__PURE__ */ Z(x, {
1567
+ /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
1446
1568
  asChild: !0,
1447
- children: /* @__PURE__ */ Z(i, {
1569
+ children: /* @__PURE__ */ Z(p, {
1448
1570
  variant: "outline",
1449
1571
  size: "icon",
1450
1572
  className: "h-8 w-8",
@@ -1453,97 +1575,109 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1453
1575
  let t = e.recordNavigation;
1454
1576
  t.currentIndex < t.recordIds.length - 1 && t.onNavigate(t.recordIds[t.currentIndex + 1]);
1455
1577
  },
1456
- children: /* @__PURE__ */ Z(L, { className: "h-4 w-4" })
1578
+ children: /* @__PURE__ */ Z(W, { className: "h-4 w-4" })
1457
1579
  })
1458
- }), /* @__PURE__ */ Z(y, { children: U("detail.nextRecord") })] })
1580
+ }), /* @__PURE__ */ Z(M, { children: z("detail.nextRecord") })] })
1459
1581
  ]
1460
1582
  }),
1461
- ue.map((e, t) => /* @__PURE__ */ Z(Ae, {
1462
- schema: e,
1463
- data: D
1464
- }, t)),
1465
- u && /* @__PURE__ */ Q(v, { children: [/* @__PURE__ */ Z(x, {
1583
+ c && /* @__PURE__ */ Q(X, { children: [S && /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
1584
+ asChild: !0,
1585
+ children: /* @__PURE__ */ Q(p, {
1586
+ variant: "ghost",
1587
+ size: "sm",
1588
+ onClick: ue,
1589
+ className: "gap-2 hidden sm:inline-flex",
1590
+ children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1591
+ className: "hidden sm:inline",
1592
+ children: z("detail.cancel")
1593
+ })]
1594
+ })
1595
+ }), /* @__PURE__ */ Z(M, { children: z("detail.cancelEdit") })] }), /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
1466
1596
  asChild: !0,
1467
- children: /* @__PURE__ */ Z(i, {
1468
- variant: N ? "default" : "outline",
1597
+ children: /* @__PURE__ */ Z(p, {
1598
+ variant: S ? "default" : "outline",
1469
1599
  size: "sm",
1470
- onClick: K,
1600
+ onClick: le,
1471
1601
  className: "gap-2 hidden sm:inline-flex",
1472
- children: N ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(P, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1602
+ children: S ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(ie, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1473
1603
  className: "hidden sm:inline",
1474
- children: U("detail.save")
1475
- })] }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(H, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1604
+ children: z("detail.save")
1605
+ })] }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1476
1606
  className: "hidden sm:inline",
1477
- children: U("detail.editInline")
1607
+ children: z("detail.editInline")
1478
1608
  })] })
1479
1609
  })
1480
- }), /* @__PURE__ */ Z(y, { children: U(N ? "detail.saveChanges" : "detail.editFieldsInline") })] }),
1481
- e.showEdit && /* @__PURE__ */ Q(v, { children: [/* @__PURE__ */ Z(x, {
1610
+ }), /* @__PURE__ */ Z(M, { children: z(S ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
1611
+ e.showEdit && /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
1482
1612
  asChild: !0,
1483
- children: /* @__PURE__ */ Q(i, {
1613
+ children: /* @__PURE__ */ Q(p, {
1484
1614
  variant: "default",
1485
- onClick: W,
1615
+ onClick: U,
1486
1616
  className: "gap-2 hidden sm:inline-flex",
1487
- children: [/* @__PURE__ */ Z(H, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1617
+ children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
1488
1618
  className: "hidden sm:inline",
1489
- children: U("detail.edit")
1619
+ children: z("detail.edit")
1490
1620
  })]
1491
1621
  })
1492
- }), /* @__PURE__ */ Z(y, { children: U("detail.editRecord") })] })
1622
+ }), /* @__PURE__ */ Z(M, { children: z("detail.editRecord") })] }),
1623
+ me.map((e, t) => /* @__PURE__ */ Z(He, {
1624
+ schema: e,
1625
+ data: g
1626
+ }, `header-action-${t}`))
1493
1627
  ]
1494
1628
  })]
1495
1629
  }),
1496
- e.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(Ae, {
1630
+ e.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(He, {
1497
1631
  schema: e.header,
1498
- data: D
1632
+ data: g
1499
1633
  }) }),
1500
- e.highlightFields && e.highlightFields.length > 0 && /* @__PURE__ */ Z(qe, {
1634
+ e.highlightFields && e.highlightFields.length > 0 && /* @__PURE__ */ Z(ct, {
1501
1635
  fields: e.highlightFields,
1502
- data: D,
1636
+ data: g,
1503
1637
  objectName: e.objectName,
1504
- objectSchema: z
1638
+ objectSchema: I
1505
1639
  }),
1506
1640
  e.autoTabs && !e.tabs?.length ? (() => {
1507
- let t = le.length > 0, n = !!e.activities && e.activities.length > 0, i = !!f, o = /* @__PURE__ */ Q("div", {
1641
+ let t = K.length > 0, n = !!e.activities && e.activities.length > 0, i = !!u, a = /* @__PURE__ */ Q("div", {
1508
1642
  className: "space-y-3 sm:space-y-4",
1509
1643
  children: [
1510
- e.sectionGroups && e.sectionGroups.length > 0 && e.sectionGroups.map((t, n) => /* @__PURE__ */ Z(Ke, {
1644
+ e.sectionGroups && e.sectionGroups.length > 0 && e.sectionGroups.map((t, n) => /* @__PURE__ */ Z(st, {
1511
1645
  group: t,
1512
1646
  data: {
1513
- ...D,
1514
- ...I
1647
+ ...g,
1648
+ ...w
1515
1649
  },
1516
- objectSchema: z,
1650
+ objectSchema: I,
1517
1651
  objectName: e.objectName,
1518
- isEditing: N,
1519
- onFieldChange: q
1652
+ isEditing: S,
1653
+ onFieldChange: fe
1520
1654
  }, n)),
1521
- e.sections && e.sections.length > 0 && e.sections.map((t, n) => /* @__PURE__ */ Z(He, {
1655
+ e.sections && e.sections.length > 0 && e.sections.map((t, n) => /* @__PURE__ */ Z(rt, {
1522
1656
  section: t,
1523
1657
  data: {
1524
- ...D,
1525
- ...I
1658
+ ...g,
1659
+ ...w
1526
1660
  },
1527
- objectSchema: z,
1661
+ objectSchema: I,
1528
1662
  objectName: e.objectName,
1529
- isEditing: N,
1530
- onFieldChange: q
1663
+ isEditing: S,
1664
+ onFieldChange: fe
1531
1665
  }, n)),
1532
- e.fields && e.fields.length > 0 && !e.sections?.length && /* @__PURE__ */ Z(He, {
1666
+ e.fields && e.fields.length > 0 && !e.sections?.length && /* @__PURE__ */ Z(rt, {
1533
1667
  section: {
1534
1668
  fields: e.fields,
1535
1669
  columns: e.columns
1536
1670
  },
1537
1671
  data: {
1538
- ...D,
1539
- ...I
1672
+ ...g,
1673
+ ...w
1540
1674
  },
1541
- objectSchema: z,
1675
+ objectSchema: I,
1542
1676
  objectName: e.objectName,
1543
- isEditing: N,
1544
- onFieldChange: q
1677
+ isEditing: S,
1678
+ onFieldChange: fe
1545
1679
  }),
1546
- e.comments && /* @__PURE__ */ Z(Ye, {
1680
+ e.comments && /* @__PURE__ */ Z(ut, {
1547
1681
  comments: e.comments,
1548
1682
  onAddComment: e.onAddComment
1549
1683
  })
@@ -1551,245 +1685,406 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1551
1685
  });
1552
1686
  return !t && !n && !i ? /* @__PURE__ */ Z("div", {
1553
1687
  className: "mt-2",
1554
- children: o
1555
- }) : /* @__PURE__ */ Q(m, {
1688
+ children: a
1689
+ }) : /* @__PURE__ */ Q(D, {
1556
1690
  defaultValue: "details",
1557
1691
  className: "w-full",
1558
1692
  children: [
1559
- /* @__PURE__ */ Q(g, {
1693
+ /* @__PURE__ */ Q(k, {
1560
1694
  className: "w-full justify-start border-b rounded-none bg-transparent p-0",
1561
1695
  children: [
1562
- /* @__PURE__ */ Z(_, {
1696
+ /* @__PURE__ */ Z(A, {
1563
1697
  value: "details",
1564
1698
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
1565
- children: U("detail.details")
1699
+ children: z("detail.details")
1566
1700
  }),
1567
- t && /* @__PURE__ */ Z(_, {
1701
+ t && /* @__PURE__ */ Z(A, {
1568
1702
  value: "related",
1569
1703
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
1570
1704
  children: /* @__PURE__ */ Q("span", {
1571
1705
  className: "flex items-center gap-1.5",
1572
- children: [U("detail.related"), /* @__PURE__ */ Z(r, {
1706
+ children: [z("detail.related"), /* @__PURE__ */ Z(f, {
1573
1707
  variant: "secondary",
1574
1708
  className: "text-xs bg-primary/10 text-primary border-transparent",
1575
- children: le.length
1709
+ children: K.length
1576
1710
  })]
1577
1711
  })
1578
1712
  }),
1579
- n && /* @__PURE__ */ Z(_, {
1713
+ n && /* @__PURE__ */ Z(A, {
1580
1714
  value: "activity",
1581
1715
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
1582
1716
  children: /* @__PURE__ */ Q("span", {
1583
1717
  className: "flex items-center gap-1.5",
1584
- children: [U("detail.activity"), /* @__PURE__ */ Z(r, {
1718
+ children: [z("detail.activity"), /* @__PURE__ */ Z(f, {
1585
1719
  variant: "secondary",
1586
1720
  className: "text-xs bg-primary/10 text-primary border-transparent",
1587
1721
  children: e.activities.length
1588
1722
  })]
1589
1723
  })
1590
1724
  }),
1591
- i && /* @__PURE__ */ Z(_, {
1725
+ i && /* @__PURE__ */ Z(A, {
1592
1726
  value: "discussion",
1593
1727
  className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
1594
- children: U("detail.discussion", { defaultValue: "Discussion" })
1728
+ children: z("detail.discussion", { defaultValue: "Discussion" })
1595
1729
  })
1596
1730
  ]
1597
1731
  }),
1598
- /* @__PURE__ */ Z(h, {
1732
+ /* @__PURE__ */ Z(O, {
1599
1733
  value: "details",
1600
1734
  className: "mt-4",
1601
- children: o
1735
+ children: a
1602
1736
  }),
1603
- t && /* @__PURE__ */ Z(h, {
1737
+ t && /* @__PURE__ */ Z(O, {
1604
1738
  value: "related",
1605
1739
  className: "mt-4",
1606
1740
  children: /* @__PURE__ */ Z("div", {
1607
1741
  className: "space-y-3",
1608
- children: le.map((e, t) => /* @__PURE__ */ Z(Ge, {
1742
+ children: K.map((e, t) => /* @__PURE__ */ Z(ot, {
1609
1743
  title: e.title,
1610
1744
  type: e.type,
1611
1745
  api: e.api,
1612
1746
  data: e.data,
1613
1747
  columns: e.columns,
1614
- dataSource: a,
1748
+ dataSource: r,
1615
1749
  objectName: e.api,
1616
1750
  referenceField: e.referenceField,
1617
1751
  icon: e.icon,
1752
+ onNew: e.onNew,
1753
+ onViewAll: e.onViewAll,
1754
+ onRowClick: e.onRowClick,
1755
+ onRowEdit: e.onRowEdit,
1756
+ onRowDelete: e.onRowDelete,
1618
1757
  collapsible: !0,
1619
- pageSize: nt
1758
+ pageSize: _t
1620
1759
  }, t))
1621
1760
  })
1622
1761
  }),
1623
- n && /* @__PURE__ */ Z(h, {
1762
+ n && /* @__PURE__ */ Z(O, {
1624
1763
  value: "activity",
1625
1764
  className: "mt-4",
1626
- children: /* @__PURE__ */ Z(tt, { activities: e.activities })
1765
+ children: /* @__PURE__ */ Z(gt, { activities: e.activities })
1627
1766
  }),
1628
- i && /* @__PURE__ */ Z(h, {
1767
+ i && /* @__PURE__ */ Z(O, {
1629
1768
  value: "discussion",
1630
1769
  className: "mt-4",
1631
- children: f
1770
+ children: u
1632
1771
  })
1633
1772
  ]
1634
1773
  });
1635
1774
  })() : /* @__PURE__ */ Q(X, { children: [
1636
1775
  e.sectionGroups && e.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
1637
1776
  className: "space-y-3 sm:space-y-4",
1638
- children: e.sectionGroups.map((t, n) => /* @__PURE__ */ Z(Ke, {
1777
+ children: e.sectionGroups.map((t, n) => /* @__PURE__ */ Z(st, {
1639
1778
  group: t,
1640
1779
  data: {
1641
- ...D,
1642
- ...I
1780
+ ...g,
1781
+ ...w
1643
1782
  },
1644
- objectSchema: z,
1783
+ objectSchema: I,
1645
1784
  objectName: e.objectName,
1646
- isEditing: N,
1647
- onFieldChange: q
1785
+ isEditing: S,
1786
+ onFieldChange: fe
1648
1787
  }, n))
1649
1788
  }),
1650
1789
  e.sections && e.sections.length > 0 && /* @__PURE__ */ Z("div", {
1651
1790
  className: "space-y-3 sm:space-y-4",
1652
- children: e.sections.map((t, n) => /* @__PURE__ */ Z(He, {
1791
+ children: e.sections.map((t, n) => /* @__PURE__ */ Z(rt, {
1653
1792
  section: t,
1654
1793
  data: {
1655
- ...D,
1656
- ...I
1794
+ ...g,
1795
+ ...w
1657
1796
  },
1658
- objectSchema: z,
1797
+ objectSchema: I,
1659
1798
  objectName: e.objectName,
1660
- isEditing: N,
1661
- onFieldChange: q
1799
+ isEditing: S,
1800
+ onFieldChange: fe
1662
1801
  }, n))
1663
1802
  }),
1664
- e.fields && e.fields.length > 0 && !e.sections?.length && /* @__PURE__ */ Z(He, {
1803
+ e.fields && e.fields.length > 0 && !e.sections?.length && /* @__PURE__ */ Z(rt, {
1665
1804
  section: {
1666
1805
  fields: e.fields,
1667
1806
  columns: e.columns
1668
1807
  },
1669
1808
  data: {
1670
- ...D,
1671
- ...I
1809
+ ...g,
1810
+ ...w
1672
1811
  },
1673
- objectSchema: z,
1812
+ objectSchema: I,
1674
1813
  objectName: e.objectName,
1675
- isEditing: N,
1676
- onFieldChange: q
1814
+ isEditing: S,
1815
+ onFieldChange: fe
1677
1816
  }),
1678
- e.tabs && e.tabs.length > 0 && /* @__PURE__ */ Z(Ue, {
1817
+ e.tabs && e.tabs.length > 0 && /* @__PURE__ */ Z(it, {
1679
1818
  tabs: e.tabs,
1680
- data: D
1819
+ data: g
1681
1820
  }),
1682
- le.length > 0 && /* @__PURE__ */ Q("div", {
1821
+ K.length > 0 && /* @__PURE__ */ Q("div", {
1683
1822
  className: "space-y-3",
1684
1823
  children: [/* @__PURE__ */ Z("h2", {
1685
1824
  className: "text-lg font-semibold",
1686
- children: U("detail.related")
1687
- }), le.map((e, t) => /* @__PURE__ */ Z(Ge, {
1825
+ children: z("detail.related")
1826
+ }), K.map((e, t) => /* @__PURE__ */ Z(ot, {
1688
1827
  title: e.title,
1689
1828
  type: e.type,
1690
1829
  api: e.api,
1691
1830
  data: e.data,
1692
1831
  columns: e.columns,
1693
- dataSource: a,
1832
+ dataSource: r,
1694
1833
  objectName: e.api,
1695
1834
  referenceField: e.referenceField,
1696
1835
  icon: e.icon,
1836
+ onNew: e.onNew,
1837
+ onViewAll: e.onViewAll,
1838
+ onRowClick: e.onRowClick,
1839
+ onRowEdit: e.onRowEdit,
1840
+ onRowDelete: e.onRowDelete,
1697
1841
  collapsible: !0,
1698
- pageSize: nt
1842
+ pageSize: _t
1699
1843
  }, t))]
1700
1844
  }),
1701
- e.comments && /* @__PURE__ */ Z(Ye, {
1845
+ e.comments && /* @__PURE__ */ Z(ut, {
1702
1846
  comments: e.comments,
1703
1847
  onAddComment: e.onAddComment
1704
1848
  }),
1705
- e.activities && e.activities.length > 0 && /* @__PURE__ */ Z(tt, { activities: e.activities })
1849
+ e.activities && e.activities.length > 0 && /* @__PURE__ */ Z(gt, { activities: e.activities })
1706
1850
  ] }),
1707
- e.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(Ae, {
1851
+ e.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(He, {
1708
1852
  schema: e.footer,
1709
- data: D
1853
+ data: g
1710
1854
  }) })
1711
1855
  ]
1712
1856
  }) });
1713
- }, at = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: l, onLinkRecord: u, onSearch: d, existingRecords: p = [], className: v }) => {
1714
- let [y, b] = n.useState(!1), [x, C] = n.useState("create"), [w, T] = n.useState({}), [E, D] = n.useState(""), [O, k] = n.useState(p), [A, j] = n.useState(!1), [M, N] = n.useState(!1), P = n.useMemo(() => {
1715
- if (!E.trim()) return O;
1716
- let e = E.toLowerCase();
1717
- return O.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
1718
- }, [E, O]), F = n.useCallback(async (e) => {
1719
- if (D(e), d && e.trim().length >= 2) {
1720
- N(!0);
1857
+ }, bt = new Set([
1858
+ "id",
1859
+ "_id",
1860
+ "__v",
1861
+ "created_at",
1862
+ "updated_at",
1863
+ "createdAt",
1864
+ "updatedAt",
1865
+ "created_by",
1866
+ "updated_by",
1867
+ "organization_id",
1868
+ "tenant_id",
1869
+ "owner_id",
1870
+ "deleted_at",
1871
+ "is_deleted"
1872
+ ]), xt = 480, St = 95;
1873
+ function Ct({ open: e, onClose: t, title: n, record: i, objectName: a, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = bt, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
1874
+ let { t: g } = $(), _ = `objectui.drawerWidth.${a}`, [v, y] = r.useState(() => {
1875
+ if (typeof window > "u" || !m) return null;
1876
+ try {
1877
+ let e = window.localStorage.getItem(_);
1878
+ if (e) {
1879
+ let t = parseInt(e, 10);
1880
+ if (Number.isFinite(t) && t >= xt) return t;
1881
+ }
1882
+ } catch {}
1883
+ return null;
1884
+ }), b = r.useMemo(() => m && v != null ? `${v}px` : typeof l == "number" ? `${l}px` : l, [
1885
+ m,
1886
+ v,
1887
+ l
1888
+ ]), x = b ? {
1889
+ width: b,
1890
+ maxWidth: b
1891
+ } : void 0, E = r.useRef(null), D = r.useCallback((e) => {
1892
+ if (!m) return;
1893
+ e.preventDefault();
1894
+ let t = v ?? (typeof window < "u" ? Math.min(window.innerWidth * .6, 960) : 720);
1895
+ E.current = {
1896
+ startX: e.clientX,
1897
+ startWidth: t
1898
+ };
1899
+ let n = (e) => {
1900
+ let t = E.current;
1901
+ if (!t) return;
1902
+ let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * St / 100 : 1600, i = Math.min(r, Math.max(xt, t.startWidth + n));
1903
+ y(Math.round(i));
1904
+ }, r = () => {
1905
+ E.current, E.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
1906
+ try {
1907
+ y((e) => (e != null && window.localStorage.setItem(_, String(e)), e));
1908
+ } catch {}
1909
+ };
1910
+ window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r);
1911
+ }, [
1912
+ m,
1913
+ v,
1914
+ _
1915
+ ]), O = c?.fields ?? {}, k = (Object.keys(O).length ? Object.keys(O) : Object.keys(i)).filter((e) => !d.has(e) && !e.startsWith("__")).filter((e) => e in i).map((e) => {
1916
+ let t = O[e] || {}, n = t.type === "lookup" || t.type === "master_detail" || t.type === "reference";
1917
+ return {
1918
+ name: e,
1919
+ label: t.label,
1920
+ type: t.type,
1921
+ readonly: !!t.readonly || n,
1922
+ options: t.options,
1923
+ currency: t.currency,
1924
+ precision: t.precision,
1925
+ format: t.format,
1926
+ reference_to: t.reference_to ?? t.referenceTo ?? t.target,
1927
+ reference_field: t.reference_field ?? t.referenceField,
1928
+ required: t.required,
1929
+ validation: t.validation,
1930
+ placeholder: t.placeholder,
1931
+ description: t.description
1932
+ };
1933
+ });
1934
+ return /* @__PURE__ */ Z(S, {
1935
+ open: e,
1936
+ onOpenChange: (e) => {
1937
+ e || t();
1938
+ },
1939
+ children: /* @__PURE__ */ Q(C, {
1940
+ side: "right",
1941
+ className: "w-full overflow-y-auto p-0 sm:!max-w-none",
1942
+ style: x,
1943
+ onOpenAutoFocus: (e) => e.preventDefault(),
1944
+ children: [
1945
+ m && /* @__PURE__ */ Z("div", {
1946
+ role: "separator",
1947
+ "aria-orientation": "vertical",
1948
+ "aria-label": "Resize drawer",
1949
+ onPointerDown: D,
1950
+ className: "hidden sm:block absolute left-0 top-0 h-full w-1.5 cursor-col-resize select-none bg-transparent hover:bg-primary/30 active:bg-primary/50 transition-colors z-10"
1951
+ }),
1952
+ /* @__PURE__ */ Z(w, {
1953
+ className: "sr-only",
1954
+ children: /* @__PURE__ */ Z(T, { children: n })
1955
+ }),
1956
+ /* @__PURE__ */ Z("div", {
1957
+ className: "px-6 pt-6 pb-6",
1958
+ children: /* @__PURE__ */ Z(yt, {
1959
+ dataSource: s,
1960
+ inlineEdit: !0,
1961
+ schema: {
1962
+ type: "detail-view",
1963
+ objectName: a,
1964
+ resourceId: String(o),
1965
+ data: i,
1966
+ showDelete: !0,
1967
+ columns: u,
1968
+ fields: k,
1969
+ actions: h ? [{
1970
+ type: "action:bar",
1971
+ location: "record_header",
1972
+ systemActions: [{
1973
+ name: "sys_open_new_tab",
1974
+ label: g("detail.openInNewTab"),
1975
+ icon: "external-link",
1976
+ type: "script",
1977
+ onClick: () => window.open(h, "_blank", "noopener")
1978
+ }]
1979
+ }] : void 0
1980
+ },
1981
+ onFieldSave: async (e, t) => {
1982
+ try {
1983
+ await f?.(e, t);
1984
+ } catch (e) {
1985
+ console.error("[RecordDetailDrawer] inline field save failed:", e);
1986
+ }
1987
+ },
1988
+ onDelete: async () => {
1989
+ try {
1990
+ await p?.(), t();
1991
+ } catch (e) {
1992
+ console.error("[RecordDetailDrawer] delete failed:", e);
1993
+ }
1994
+ }
1995
+ })
1996
+ })
1997
+ ]
1998
+ })
1999
+ });
2000
+ }
2001
+ function wt(e, t) {
2002
+ if (typeof window > "u") return null;
2003
+ let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
2004
+ return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
2005
+ }
2006
+ //#endregion
2007
+ //#region src/InlineCreateRelated.tsx
2008
+ var Tt = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
2009
+ let [l, u] = n.useState(!1), [d, f] = n.useState("create"), [v, y] = n.useState({}), [b, S] = n.useState(""), [C, w] = n.useState(s), [T, E] = n.useState(!1), [j, M] = n.useState(!1), N = n.useMemo(() => {
2010
+ if (!b.trim()) return C;
2011
+ let e = b.toLowerCase();
2012
+ return C.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
2013
+ }, [b, C]), P = n.useCallback(async (e) => {
2014
+ if (S(e), o && e.trim().length >= 2) {
2015
+ M(!0);
1721
2016
  try {
1722
- k(await d(e));
2017
+ w(await o(e));
1723
2018
  } finally {
1724
- N(!1);
2019
+ M(!1);
1725
2020
  }
1726
2021
  }
1727
- }, [d]), I = n.useCallback((e, t) => {
1728
- T((n) => ({
2022
+ }, [o]), I = n.useCallback((e, t) => {
2023
+ y((n) => ({
1729
2024
  ...n,
1730
2025
  [e]: t
1731
2026
  }));
1732
- }, []), ee = n.useCallback(async () => {
1733
- if (l) {
1734
- j(!0);
2027
+ }, []), L = n.useCallback(async () => {
2028
+ if (i) {
2029
+ E(!0);
1735
2030
  try {
1736
- await l({
1737
- ...w,
2031
+ await i({
2032
+ ...v,
1738
2033
  [t]: !0
1739
- }), T({}), b(!1);
2034
+ }), y({}), u(!1);
1740
2035
  } finally {
1741
- j(!1);
2036
+ E(!1);
1742
2037
  }
1743
2038
  }
1744
2039
  }, [
1745
- l,
1746
- w,
2040
+ i,
2041
+ v,
1747
2042
  t
1748
- ]), L = n.useCallback(async (e) => {
1749
- if (u) {
1750
- j(!0);
2043
+ ]), ee = n.useCallback(async (e) => {
2044
+ if (a) {
2045
+ E(!0);
1751
2046
  try {
1752
- await u(e), D(""), b(!1);
2047
+ await a(e), S(""), u(!1);
1753
2048
  } finally {
1754
- j(!1);
2049
+ E(!1);
1755
2050
  }
1756
2051
  }
1757
- }, [u]), R = n.useMemo(() => r.filter((e) => e.required).every((e) => w[e.name]?.toString().trim()), [r, w]);
1758
- return y ? /* @__PURE__ */ Q(a, {
1759
- className: S("", v),
1760
- children: [/* @__PURE__ */ Z(s, {
2052
+ }, [a]), R = n.useMemo(() => r.filter((e) => e.required).every((e) => v[e.name]?.toString().trim()), [r, v]);
2053
+ return l ? /* @__PURE__ */ Q(m, {
2054
+ className: F("", c),
2055
+ children: [/* @__PURE__ */ Z(g, {
1761
2056
  className: "pb-3",
1762
- children: /* @__PURE__ */ Q(c, {
2057
+ children: /* @__PURE__ */ Q(_, {
1763
2058
  className: "flex items-center justify-between text-sm",
1764
2059
  children: [/* @__PURE__ */ Q("span", { children: [
1765
- x === "create" ? "Create" : "Link",
2060
+ d === "create" ? "Create" : "Link",
1766
2061
  " ",
1767
2062
  e
1768
- ] }), /* @__PURE__ */ Z(i, {
2063
+ ] }), /* @__PURE__ */ Z(p, {
1769
2064
  variant: "ghost",
1770
2065
  size: "icon",
1771
2066
  className: "h-6 w-6",
1772
- onClick: () => b(!1),
1773
- children: /* @__PURE__ */ Z(De, { className: "h-3.5 w-3.5" })
2067
+ onClick: () => u(!1),
2068
+ children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
1774
2069
  })]
1775
2070
  })
1776
- }), /* @__PURE__ */ Z(o, { children: /* @__PURE__ */ Q(m, {
1777
- value: x,
1778
- onValueChange: C,
2071
+ }), /* @__PURE__ */ Z(h, { children: /* @__PURE__ */ Q(D, {
2072
+ value: d,
2073
+ onValueChange: f,
1779
2074
  children: [
1780
- /* @__PURE__ */ Q(g, {
2075
+ /* @__PURE__ */ Q(k, {
1781
2076
  className: "mb-3 w-full",
1782
- children: [l && /* @__PURE__ */ Q(_, {
2077
+ children: [i && /* @__PURE__ */ Q(A, {
1783
2078
  value: "create",
1784
2079
  className: "flex-1 gap-1.5",
1785
- children: [/* @__PURE__ */ Z(ge, { className: "h-3.5 w-3.5" }), "Create New"]
1786
- }), u && /* @__PURE__ */ Q(_, {
2080
+ children: [/* @__PURE__ */ Z(ke, { className: "h-3.5 w-3.5" }), "Create New"]
2081
+ }), a && /* @__PURE__ */ Q(A, {
1787
2082
  value: "link",
1788
2083
  className: "flex-1 gap-1.5",
1789
- children: [/* @__PURE__ */ Z(K, { className: "h-3.5 w-3.5" }), "Link Existing"]
2084
+ children: [/* @__PURE__ */ Z(J, { className: "h-3.5 w-3.5" }), "Link Existing"]
1790
2085
  })]
1791
2086
  }),
1792
- l && /* @__PURE__ */ Q(h, {
2087
+ i && /* @__PURE__ */ Q(O, {
1793
2088
  value: "create",
1794
2089
  className: "space-y-3 mt-0",
1795
2090
  children: [r.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
@@ -1798,52 +2093,52 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1798
2093
  className: "text-destructive ml-0.5",
1799
2094
  children: "*"
1800
2095
  })]
1801
- }), /* @__PURE__ */ Z(f, {
2096
+ }), /* @__PURE__ */ Z(x, {
1802
2097
  type: e.type === "number" ? "number" : e.type === "date" ? "date" : "text",
1803
2098
  placeholder: e.placeholder || `Enter ${e.label.toLowerCase()}`,
1804
- value: w[e.name] || "",
2099
+ value: v[e.name] || "",
1805
2100
  onChange: (t) => I(e.name, t.target.value),
1806
2101
  className: "h-8 text-sm"
1807
2102
  })] }, e.name)), /* @__PURE__ */ Q("div", {
1808
2103
  className: "flex justify-end gap-2 pt-1",
1809
- children: [/* @__PURE__ */ Z(i, {
2104
+ children: [/* @__PURE__ */ Z(p, {
1810
2105
  variant: "ghost",
1811
2106
  size: "sm",
1812
- onClick: () => b(!1),
2107
+ onClick: () => u(!1),
1813
2108
  children: "Cancel"
1814
- }), /* @__PURE__ */ Q(i, {
2109
+ }), /* @__PURE__ */ Q(p, {
1815
2110
  size: "sm",
1816
- onClick: ee,
1817
- disabled: !R || A,
2111
+ onClick: L,
2112
+ disabled: !R || T,
1818
2113
  className: "gap-1.5",
1819
- children: [A && /* @__PURE__ */ Z(J, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
2114
+ children: [T && /* @__PURE__ */ Z(xe, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
1820
2115
  })]
1821
2116
  })]
1822
2117
  }),
1823
- u && /* @__PURE__ */ Q(h, {
2118
+ a && /* @__PURE__ */ Q(O, {
1824
2119
  value: "link",
1825
2120
  className: "space-y-3 mt-0",
1826
2121
  children: [/* @__PURE__ */ Q("div", {
1827
2122
  className: "relative",
1828
- children: [/* @__PURE__ */ Z(be, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(f, {
2123
+ children: [/* @__PURE__ */ Z(Ne, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(x, {
1829
2124
  placeholder: `Search ${e}…`,
1830
- value: E,
1831
- onChange: (e) => F(e.target.value),
2125
+ value: b,
2126
+ onChange: (e) => P(e.target.value),
1832
2127
  className: "h-8 text-sm pl-8"
1833
2128
  })]
1834
2129
  }), /* @__PURE__ */ Z("div", {
1835
2130
  className: "max-h-48 overflow-y-auto space-y-1",
1836
- children: M ? /* @__PURE__ */ Q("div", {
2131
+ children: j ? /* @__PURE__ */ Q("div", {
1837
2132
  className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
1838
- children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
1839
- }) : P.length === 0 ? /* @__PURE__ */ Z("p", {
2133
+ children: [/* @__PURE__ */ Z(xe, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
2134
+ }) : N.length === 0 ? /* @__PURE__ */ Z("p", {
1840
2135
  className: "text-sm text-muted-foreground text-center py-4",
1841
- children: E ? "No records found" : "Type to search records"
1842
- }) : P.map((e) => /* @__PURE__ */ Q("button", {
2136
+ children: b ? "No records found" : "Type to search records"
2137
+ }) : N.map((e) => /* @__PURE__ */ Q("button", {
1843
2138
  type: "button",
1844
2139
  className: "w-full text-left px-3 py-2 rounded-md hover:bg-accent text-sm transition-colors",
1845
- onClick: () => L(e.id),
1846
- disabled: A,
2140
+ onClick: () => ee(e.id),
2141
+ disabled: T,
1847
2142
  children: [/* @__PURE__ */ Z("span", {
1848
2143
  className: "font-medium",
1849
2144
  children: e.label
@@ -1857,42 +2152,42 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
1857
2152
  ]
1858
2153
  }) })]
1859
2154
  }) : /* @__PURE__ */ Q("div", {
1860
- className: S("flex gap-2", v),
1861
- children: [l && /* @__PURE__ */ Q(i, {
2155
+ className: F("flex gap-2", c),
2156
+ children: [i && /* @__PURE__ */ Q(p, {
1862
2157
  variant: "outline",
1863
2158
  size: "sm",
1864
2159
  onClick: () => {
1865
- C("create"), b(!0);
2160
+ f("create"), u(!0);
1866
2161
  },
1867
2162
  className: "gap-1.5",
1868
2163
  children: [
1869
- /* @__PURE__ */ Z(ge, { className: "h-3.5 w-3.5" }),
2164
+ /* @__PURE__ */ Z(ke, { className: "h-3.5 w-3.5" }),
1870
2165
  "New ",
1871
2166
  e
1872
2167
  ]
1873
- }), u && /* @__PURE__ */ Q(i, {
2168
+ }), a && /* @__PURE__ */ Q(p, {
1874
2169
  variant: "outline",
1875
2170
  size: "sm",
1876
2171
  onClick: () => {
1877
- C("link"), b(!0);
2172
+ f("link"), u(!0);
1878
2173
  },
1879
2174
  className: "gap-1.5",
1880
- children: [/* @__PURE__ */ Z(K, { className: "h-3.5 w-3.5" }), "Link Existing"]
2175
+ children: [/* @__PURE__ */ Z(J, { className: "h-3.5 w-3.5" }), "Link Existing"]
1881
2176
  })]
1882
2177
  });
1883
2178
  };
1884
2179
  //#endregion
1885
2180
  //#region src/RichTextCommentInput.tsx
1886
- function ot(e) {
2181
+ function Et(e) {
1887
2182
  let t = e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/```([\s\S]*?)```/g, "<pre class=\"bg-muted rounded p-2 text-xs font-mono my-1 overflow-x-auto\">$1</pre>").replace(/`([^`]+)`/g, "<code class=\"bg-muted rounded px-1 py-0.5 text-xs font-mono\">$1</code>").replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/@(\w+)/g, "<span class=\"text-primary font-medium\">@$1</span>").replace(/^- (.+)$/gm, "<li class=\"ml-4 list-disc\">$1</li>").replace(/\n/g, "<br/>");
1888
2183
  return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
1889
2184
  }
1890
- var st = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: a = [], placeholder: o, className: s, disabled: c = !1 }) => {
1891
- let { t: l } = $(), [u, d] = n.useState(!1), [f, p] = n.useState(!1), [m, h] = n.useState(""), [g, _] = n.useState(0), v = n.useRef(null), y = n.useMemo(() => {
1892
- if (!m) return a;
2185
+ var Dt = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], placeholder: a, className: o, disabled: s = !1 }) => {
2186
+ let { t: c } = $(), [l, u] = n.useState(!1), [d, f] = n.useState(!1), [m, h] = n.useState(""), [g, _] = n.useState(0), v = n.useRef(null), y = n.useMemo(() => {
2187
+ if (!m) return i;
1893
2188
  let e = m.toLowerCase();
1894
- return a.filter((t) => t.label.toLowerCase().includes(e));
1895
- }, [m, a]), b = n.useCallback((n, r = "") => {
2189
+ return i.filter((t) => t.label.toLowerCase().includes(e));
2190
+ }, [m, i]), b = n.useCallback((n, r = "") => {
1896
2191
  let i = v.current;
1897
2192
  if (!i) return;
1898
2193
  let a = i.selectionStart, o = i.selectionEnd, s = e.slice(a, o);
@@ -1901,27 +2196,27 @@ var st = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: a = [], plac
1901
2196
  let e = a + n.length + s.length;
1902
2197
  i.setSelectionRange(e, e);
1903
2198
  });
1904
- }, [e, t]), x = n.useCallback(() => b("**", "**"), [b]), C = n.useCallback(() => b("*", "*"), [b]), w = n.useCallback(() => b("\n- ", ""), [b]), T = n.useCallback(() => b("`", "`"), [b]), E = n.useCallback(() => {
1905
- b("@", ""), p(!0), h(""), _(0);
1906
- }, [b]), D = n.useCallback((n) => {
2199
+ }, [e, t]), x = n.useCallback(() => b("**", "**"), [b]), S = n.useCallback(() => b("*", "*"), [b]), C = n.useCallback(() => b("\n- ", ""), [b]), w = n.useCallback(() => b("`", "`"), [b]), T = n.useCallback(() => {
2200
+ b("@", ""), f(!0), h(""), _(0);
2201
+ }, [b]), E = n.useCallback((n) => {
1907
2202
  let r = v.current;
1908
2203
  if (!r) return;
1909
2204
  let i = r.selectionStart, a = e.slice(0, i).lastIndexOf("@");
1910
- a !== -1 && t(e.slice(0, a) + `@${n.label} ` + e.slice(i)), p(!1), h(""), requestAnimationFrame(() => r.focus());
1911
- }, [e, t]), O = n.useCallback((e) => {
2205
+ a !== -1 && t(e.slice(0, a) + `@${n.label} ` + e.slice(i)), f(!1), h(""), requestAnimationFrame(() => r.focus());
2206
+ }, [e, t]), D = n.useCallback((e) => {
1912
2207
  let n = e.target.value;
1913
2208
  t(n);
1914
2209
  let r = e.target.selectionStart, i = n.slice(0, r), a = i.lastIndexOf("@");
1915
2210
  if (a !== -1) {
1916
2211
  let e = i.slice(a + 1), t = a > 0 ? i[a - 1] : " ";
1917
2212
  if (/\s/.test(t) && !/\s/.test(e)) {
1918
- p(!0), h(e), _(0);
2213
+ f(!0), h(e), _(0);
1919
2214
  return;
1920
2215
  }
1921
2216
  }
1922
- p(!1);
1923
- }, [t]), A = n.useCallback((e) => {
1924
- if (f && y.length > 0) {
2217
+ f(!1);
2218
+ }, [t]), O = n.useCallback((e) => {
2219
+ if (d && y.length > 0) {
1925
2220
  if (e.key === "ArrowDown") {
1926
2221
  e.preventDefault(), _((e) => e < y.length - 1 ? e + 1 : 0);
1927
2222
  return;
@@ -1931,111 +2226,111 @@ var st = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: a = [], plac
1931
2226
  return;
1932
2227
  }
1933
2228
  if (e.key === "Enter" || e.key === "Tab") {
1934
- e.preventDefault(), D(y[g]);
2229
+ e.preventDefault(), E(y[g]);
1935
2230
  return;
1936
2231
  }
1937
2232
  if (e.key === "Escape") {
1938
- p(!1);
2233
+ f(!1);
1939
2234
  return;
1940
2235
  }
1941
2236
  }
1942
2237
  e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), r?.());
1943
2238
  }, [
1944
- f,
2239
+ d,
1945
2240
  y,
1946
2241
  g,
1947
- D,
2242
+ E,
1948
2243
  r
1949
2244
  ]);
1950
2245
  return /* @__PURE__ */ Q("div", {
1951
- className: S("border rounded-md", s),
2246
+ className: F("border rounded-md", o),
1952
2247
  children: [/* @__PURE__ */ Q("div", {
1953
2248
  className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
1954
2249
  children: [
1955
- /* @__PURE__ */ Z(i, {
2250
+ /* @__PURE__ */ Z(p, {
1956
2251
  variant: "ghost",
1957
2252
  size: "icon",
1958
2253
  className: "h-7 w-7",
1959
2254
  onClick: x,
1960
- disabled: c || u,
1961
- title: l("detail.bold"),
1962
- children: /* @__PURE__ */ Z(M, { className: "h-3.5 w-3.5" })
2255
+ disabled: s || l,
2256
+ title: c("detail.bold"),
2257
+ children: /* @__PURE__ */ Z(V, { className: "h-3.5 w-3.5" })
1963
2258
  }),
1964
- /* @__PURE__ */ Z(i, {
2259
+ /* @__PURE__ */ Z(p, {
1965
2260
  variant: "ghost",
1966
2261
  size: "icon",
1967
2262
  className: "h-7 w-7",
1968
- onClick: C,
1969
- disabled: c || u,
1970
- title: l("detail.italic"),
1971
- children: /* @__PURE__ */ Z(ce, { className: "h-3.5 w-3.5" })
2263
+ onClick: S,
2264
+ disabled: s || l,
2265
+ title: c("detail.italic"),
2266
+ children: /* @__PURE__ */ Z(ye, { className: "h-3.5 w-3.5" })
1972
2267
  }),
1973
- /* @__PURE__ */ Z(i, {
2268
+ /* @__PURE__ */ Z(p, {
1974
2269
  variant: "ghost",
1975
2270
  size: "icon",
1976
2271
  className: "h-7 w-7",
1977
- onClick: w,
1978
- disabled: c || u,
1979
- title: l("detail.listFormat"),
1980
- children: /* @__PURE__ */ Z(q, { className: "h-3.5 w-3.5" })
2272
+ onClick: C,
2273
+ disabled: s || l,
2274
+ title: c("detail.listFormat"),
2275
+ children: /* @__PURE__ */ Z(be, { className: "h-3.5 w-3.5" })
1981
2276
  }),
1982
- /* @__PURE__ */ Z(i, {
2277
+ /* @__PURE__ */ Z(p, {
1983
2278
  variant: "ghost",
1984
2279
  size: "icon",
1985
2280
  className: "h-7 w-7",
1986
- onClick: T,
1987
- disabled: c || u,
1988
- title: l("detail.inlineCode"),
1989
- children: /* @__PURE__ */ Z(B, { className: "h-3.5 w-3.5" })
2281
+ onClick: w,
2282
+ disabled: s || l,
2283
+ title: c("detail.inlineCode"),
2284
+ children: /* @__PURE__ */ Z(le, { className: "h-3.5 w-3.5" })
1990
2285
  }),
1991
- /* @__PURE__ */ Z(i, {
2286
+ /* @__PURE__ */ Z(p, {
1992
2287
  variant: "ghost",
1993
2288
  size: "icon",
1994
2289
  className: "h-7 w-7",
1995
- onClick: E,
1996
- disabled: c || u,
1997
- title: l("detail.mentionSomeone"),
1998
- children: /* @__PURE__ */ Z(k, { className: "h-3.5 w-3.5" })
2290
+ onClick: T,
2291
+ disabled: s || l,
2292
+ title: c("detail.mentionSomeone"),
2293
+ children: /* @__PURE__ */ Z(B, { className: "h-3.5 w-3.5" })
1999
2294
  }),
2000
2295
  /* @__PURE__ */ Z("div", { className: "flex-1" }),
2001
- /* @__PURE__ */ Z(i, {
2296
+ /* @__PURE__ */ Z(p, {
2002
2297
  variant: "ghost",
2003
2298
  size: "icon",
2004
2299
  className: "h-7 w-7",
2005
- onClick: () => d(!u),
2006
- title: l(u ? "detail.edit" : "detail.preview"),
2007
- children: Z(u ? H : U, { className: "h-3.5 w-3.5" })
2300
+ onClick: () => u(!l),
2301
+ title: c(l ? "detail.edit" : "detail.preview"),
2302
+ children: Z(l ? G : K, { className: "h-3.5 w-3.5" })
2008
2303
  }),
2009
- r && /* @__PURE__ */ Z(i, {
2304
+ r && /* @__PURE__ */ Z(p, {
2010
2305
  variant: "ghost",
2011
2306
  size: "icon",
2012
2307
  className: "h-7 w-7",
2013
2308
  onClick: r,
2014
- disabled: c || !e.trim(),
2015
- title: l("detail.submitComment"),
2016
- children: /* @__PURE__ */ Z(xe, { className: "h-3.5 w-3.5" })
2309
+ disabled: s || !e.trim(),
2310
+ title: c("detail.submitComment"),
2311
+ children: /* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" })
2017
2312
  })
2018
2313
  ]
2019
2314
  }), /* @__PURE__ */ Z("div", {
2020
2315
  className: "relative",
2021
- children: u ? /* @__PURE__ */ Z("div", {
2316
+ children: l ? /* @__PURE__ */ Z("div", {
2022
2317
  className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
2023
- dangerouslySetInnerHTML: { __html: ot(e) }
2318
+ dangerouslySetInnerHTML: { __html: Et(e) }
2024
2319
  }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("textarea", {
2025
2320
  ref: v,
2026
2321
  className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
2027
- placeholder: o ?? l("detail.writeComment"),
2322
+ placeholder: a ?? c("detail.writeComment"),
2028
2323
  value: e,
2029
- onChange: O,
2030
- onKeyDown: A,
2031
- disabled: c
2032
- }), f && y.length > 0 && /* @__PURE__ */ Z("div", {
2324
+ onChange: D,
2325
+ onKeyDown: O,
2326
+ disabled: s
2327
+ }), d && y.length > 0 && /* @__PURE__ */ Z("div", {
2033
2328
  className: "absolute left-2 bottom-full mb-1 w-56 bg-popover border rounded-md shadow-md z-50 max-h-40 overflow-y-auto",
2034
2329
  children: y.map((e, t) => /* @__PURE__ */ Q("button", {
2035
2330
  type: "button",
2036
- className: S("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === g && "bg-accent"),
2331
+ className: F("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === g && "bg-accent"),
2037
2332
  onMouseDown: (t) => {
2038
- t.preventDefault(), D(e);
2333
+ t.preventDefault(), E(e);
2039
2334
  },
2040
2335
  children: [e.avatarUrl ? /* @__PURE__ */ Z("img", {
2041
2336
  src: e.avatarUrl,
@@ -2052,7 +2347,7 @@ var st = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: a = [], plac
2052
2347
  };
2053
2348
  //#endregion
2054
2349
  //#region src/DiffView.tsx
2055
- function ct(e, t) {
2350
+ function Ot(e, t) {
2056
2351
  if (e == null) return ["(empty)"];
2057
2352
  switch (t) {
2058
2353
  case "json": try {
@@ -2071,7 +2366,7 @@ function ct(e, t) {
2071
2366
  default: return String(e).split("\n");
2072
2367
  }
2073
2368
  }
2074
- function lt(e, t) {
2369
+ function kt(e, t) {
2075
2370
  let n = [], r = Math.max(e.length, t.length);
2076
2371
  for (let i = 0; i < r; i++) {
2077
2372
  let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
@@ -2088,26 +2383,26 @@ function lt(e, t) {
2088
2383
  }
2089
2384
  return n;
2090
2385
  }
2091
- var ut = {
2386
+ var At = {
2092
2387
  added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
2093
2388
  removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
2094
2389
  unchanged: "text-muted-foreground"
2095
- }, dt = {
2390
+ }, jt = {
2096
2391
  added: "+",
2097
2392
  removed: "-",
2098
2393
  unchanged: " "
2099
- }, ft = ({ oldValue: e, newValue: t, fieldName: r, fieldType: l = "string", mode: u = "unified", className: d }) => {
2100
- let { t: f } = $(), [p, m] = n.useState(u), h = n.useMemo(() => ct(e, l), [e, l]), g = n.useMemo(() => ct(t, l), [t, l]), _ = n.useMemo(() => lt(h, g), [h, g]), v = _.some((e) => e.type !== "unchanged"), y = n.useMemo(() => {
2101
- if (p !== "side-by-side") return [];
2394
+ }, Mt = ({ oldValue: e, newValue: t, fieldName: r, fieldType: i = "string", mode: a = "unified", className: o }) => {
2395
+ let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() => Ot(e, i), [e, i]), d = n.useMemo(() => Ot(t, i), [t, i]), f = n.useMemo(() => kt(u, d), [u, d]), v = f.some((e) => e.type !== "unchanged"), y = n.useMemo(() => {
2396
+ if (c !== "side-by-side") return [];
2102
2397
  let e = [], t = 0;
2103
- for (; t < _.length;) {
2104
- let n = _[t];
2398
+ for (; t < f.length;) {
2399
+ let n = f[t];
2105
2400
  if (n.type === "unchanged") e.push({
2106
2401
  left: n,
2107
2402
  right: n
2108
2403
  }), t++;
2109
2404
  else if (n.type === "removed") {
2110
- let r = t + 1 < _.length ? _[t + 1] : null;
2405
+ let r = t + 1 < f.length ? f[t + 1] : null;
2111
2406
  r && r.type === "added" ? (e.push({
2112
2407
  left: n,
2113
2408
  right: r
@@ -2121,44 +2416,44 @@ var ut = {
2121
2416
  }), t++;
2122
2417
  }
2123
2418
  return e;
2124
- }, [p, _]);
2125
- return /* @__PURE__ */ Q(a, {
2126
- className: S("overflow-hidden", d),
2127
- children: [/* @__PURE__ */ Z(s, {
2419
+ }, [c, f]);
2420
+ return /* @__PURE__ */ Q(m, {
2421
+ className: F("overflow-hidden", o),
2422
+ children: [/* @__PURE__ */ Z(g, {
2128
2423
  className: "pb-2",
2129
- children: /* @__PURE__ */ Q(c, {
2424
+ children: /* @__PURE__ */ Q(_, {
2130
2425
  className: "flex items-center justify-between text-sm",
2131
2426
  children: [/* @__PURE__ */ Z("span", {
2132
2427
  className: "font-medium",
2133
2428
  children: r
2134
2429
  }), /* @__PURE__ */ Q("div", {
2135
2430
  className: "flex items-center gap-1",
2136
- children: [/* @__PURE__ */ Z(i, {
2137
- variant: p === "unified" ? "secondary" : "ghost",
2431
+ children: [/* @__PURE__ */ Z(p, {
2432
+ variant: c === "unified" ? "secondary" : "ghost",
2138
2433
  size: "icon",
2139
2434
  className: "h-7 w-7",
2140
- onClick: () => m("unified"),
2141
- title: f("detail.unifiedDiff"),
2142
- children: /* @__PURE__ */ Z(ye, { className: "h-3.5 w-3.5" })
2143
- }), /* @__PURE__ */ Z(i, {
2144
- variant: p === "side-by-side" ? "secondary" : "ghost",
2435
+ onClick: () => l("unified"),
2436
+ title: s("detail.unifiedDiff"),
2437
+ children: /* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" })
2438
+ }), /* @__PURE__ */ Z(p, {
2439
+ variant: c === "side-by-side" ? "secondary" : "ghost",
2145
2440
  size: "icon",
2146
2441
  className: "h-7 w-7",
2147
- onClick: () => m("side-by-side"),
2148
- title: f("detail.sideBySideDiff"),
2149
- children: /* @__PURE__ */ Z(V, { className: "h-3.5 w-3.5" })
2442
+ onClick: () => l("side-by-side"),
2443
+ title: s("detail.sideBySideDiff"),
2444
+ children: /* @__PURE__ */ Z(ue, { className: "h-3.5 w-3.5" })
2150
2445
  })]
2151
2446
  })]
2152
2447
  })
2153
- }), /* @__PURE__ */ Z(o, {
2448
+ }), /* @__PURE__ */ Z(h, {
2154
2449
  className: "p-0",
2155
- children: v ? p === "unified" ? /* @__PURE__ */ Z("div", {
2450
+ children: v ? c === "unified" ? /* @__PURE__ */ Z("div", {
2156
2451
  className: "font-mono text-xs overflow-x-auto",
2157
- children: _.map((e, t) => /* @__PURE__ */ Q("div", {
2158
- className: S("px-4 py-0.5 whitespace-pre-wrap border-l-2", ut[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
2452
+ children: f.map((e, t) => /* @__PURE__ */ Q("div", {
2453
+ className: F("px-4 py-0.5 whitespace-pre-wrap border-l-2", At[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
2159
2454
  children: [/* @__PURE__ */ Z("span", {
2160
2455
  className: "select-none mr-2 inline-block w-3 text-center opacity-60",
2161
- children: dt[e.type]
2456
+ children: jt[e.type]
2162
2457
  }), e.value]
2163
2458
  }, t))
2164
2459
  }) : /* @__PURE__ */ Z("div", {
@@ -2168,80 +2463,80 @@ var ut = {
2168
2463
  children: [
2169
2464
  /* @__PURE__ */ Z("div", {
2170
2465
  className: "px-3 py-1.5 text-xs font-medium text-muted-foreground bg-muted/50",
2171
- children: f("detail.previousVersion")
2466
+ children: s("detail.previousVersion")
2172
2467
  }),
2173
2468
  /* @__PURE__ */ Z("div", {
2174
2469
  className: "px-3 py-1.5 text-xs font-medium text-muted-foreground bg-muted/50",
2175
- children: f("detail.currentVersion")
2470
+ children: s("detail.currentVersion")
2176
2471
  }),
2177
2472
  y.map((e, t) => /* @__PURE__ */ Q(n.Fragment, { children: [/* @__PURE__ */ Z("div", {
2178
- className: S("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? ut[e.left.type] : "bg-muted/20"),
2473
+ className: F("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? At[e.left.type] : "bg-muted/20"),
2179
2474
  children: e.left?.value ?? ""
2180
2475
  }), /* @__PURE__ */ Z("div", {
2181
- className: S("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? ut[e.right.type] : "bg-muted/20"),
2476
+ className: F("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? At[e.right.type] : "bg-muted/20"),
2182
2477
  children: e.right?.value ?? ""
2183
2478
  })] }, t))
2184
2479
  ]
2185
2480
  })
2186
2481
  }) : /* @__PURE__ */ Z("p", {
2187
2482
  className: "px-4 py-3 text-sm text-muted-foreground",
2188
- children: f("detail.noChanges")
2483
+ children: s("detail.noChanges")
2189
2484
  })
2190
2485
  })]
2191
2486
  });
2192
- }, pt = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: a, onSearch: o, className: s }) => {
2193
- let { t: c } = $(), [l, u] = n.useState(""), [d, p] = n.useState(!1), m = n.useRef(null), h = e > 0, g = e > 0, _ = e < t - 1, v = e < t - 1, y = n.useCallback(() => {
2194
- h && a(r[0]);
2487
+ }, Nt = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: i, onSearch: a, className: o }) => {
2488
+ let { t: s } = $(), [c, l] = n.useState(""), [u, d] = n.useState(!1), f = n.useRef(null), m = e > 0, h = e > 0, g = e < t - 1, _ = e < t - 1, v = n.useCallback(() => {
2489
+ m && i(r[0]);
2195
2490
  }, [
2196
- h,
2197
- a,
2491
+ m,
2492
+ i,
2198
2493
  r
2199
- ]), b = n.useCallback(() => {
2200
- g && a(r[e - 1]);
2494
+ ]), y = n.useCallback(() => {
2495
+ h && i(r[e - 1]);
2201
2496
  }, [
2202
- g,
2203
- a,
2497
+ h,
2498
+ i,
2204
2499
  r,
2205
2500
  e
2206
- ]), x = n.useCallback(() => {
2207
- _ && a(r[e + 1]);
2501
+ ]), b = n.useCallback(() => {
2502
+ g && i(r[e + 1]);
2208
2503
  }, [
2209
- _,
2210
- a,
2504
+ g,
2505
+ i,
2211
2506
  r,
2212
2507
  e
2213
- ]), C = n.useCallback(() => {
2214
- v && a(r[r.length - 1]);
2508
+ ]), S = n.useCallback(() => {
2509
+ _ && i(r[r.length - 1]);
2215
2510
  }, [
2216
- v,
2217
- a,
2511
+ _,
2512
+ i,
2218
2513
  r
2219
- ]), w = n.useCallback((e) => {
2514
+ ]), C = n.useCallback((e) => {
2220
2515
  let t = e.target.value;
2221
- u(t), o?.(t);
2222
- }, [o]), T = n.useCallback(() => {
2223
- p((e) => (e ? (u(""), o?.("")) : requestAnimationFrame(() => m.current?.focus()), !e));
2224
- }, [o]);
2516
+ l(t), a?.(t);
2517
+ }, [a]), w = n.useCallback(() => {
2518
+ d((e) => (e ? (l(""), a?.("")) : requestAnimationFrame(() => f.current?.focus()), !e));
2519
+ }, [a]);
2225
2520
  return n.useEffect(() => {
2226
2521
  let t = (t) => {
2227
2522
  let n = t.target?.tagName;
2228
- if (!((n === "INPUT" || n === "TEXTAREA" || t.target?.isContentEditable) && t.target !== m.current)) {
2229
- if (t.target === m.current) {
2230
- t.key === "Escape" && (t.preventDefault(), p(!1), u(""), o?.(""), t.target.blur());
2523
+ if (!((n === "INPUT" || n === "TEXTAREA" || t.target?.isContentEditable) && t.target !== f.current)) {
2524
+ if (t.target === f.current) {
2525
+ t.key === "Escape" && (t.preventDefault(), d(!1), l(""), a?.(""), t.target.blur());
2231
2526
  return;
2232
2527
  }
2233
2528
  switch (t.key) {
2234
2529
  case "Home":
2235
- t.preventDefault(), h && a(r[0]);
2530
+ t.preventDefault(), m && i(r[0]);
2236
2531
  break;
2237
2532
  case "End":
2238
- t.preventDefault(), v && a(r[r.length - 1]);
2533
+ t.preventDefault(), _ && i(r[r.length - 1]);
2239
2534
  break;
2240
2535
  case "ArrowLeft":
2241
- t.preventDefault(), g && a(r[e - 1]);
2536
+ t.preventDefault(), h && i(r[e - 1]);
2242
2537
  break;
2243
2538
  case "ArrowRight":
2244
- t.preventDefault(), _ && a(r[e + 1]);
2539
+ t.preventDefault(), g && i(r[e + 1]);
2245
2540
  break;
2246
2541
  }
2247
2542
  }
@@ -2250,90 +2545,90 @@ var ut = {
2250
2545
  }, [
2251
2546
  e,
2252
2547
  r,
2548
+ m,
2253
2549
  h,
2254
2550
  g,
2255
2551
  _,
2256
- v,
2257
- a,
2258
- o
2552
+ i,
2553
+ a
2259
2554
  ]), /* @__PURE__ */ Q("div", {
2260
- className: S("flex items-center gap-1.5", s),
2555
+ className: F("flex items-center gap-1.5", o),
2261
2556
  children: [
2262
- /* @__PURE__ */ Z(i, {
2557
+ /* @__PURE__ */ Z(p, {
2263
2558
  variant: "outline",
2264
2559
  size: "icon",
2265
2560
  className: "h-8 w-8",
2266
- disabled: !h,
2267
- onClick: y,
2268
- title: c("detail.firstRecord"),
2269
- children: /* @__PURE__ */ Z(R, { className: "h-4 w-4" })
2561
+ disabled: !m,
2562
+ onClick: v,
2563
+ title: s("detail.firstRecord"),
2564
+ children: /* @__PURE__ */ Z(se, { className: "h-4 w-4" })
2270
2565
  }),
2271
- /* @__PURE__ */ Z(i, {
2566
+ /* @__PURE__ */ Z(p, {
2272
2567
  variant: "outline",
2273
2568
  size: "icon",
2274
2569
  className: "h-8 w-8",
2275
- disabled: !g,
2276
- onClick: b,
2277
- title: c("detail.previousRecordKey"),
2278
- children: /* @__PURE__ */ Z(ee, { className: "h-4 w-4" })
2570
+ disabled: !h,
2571
+ onClick: y,
2572
+ title: s("detail.previousRecordKey"),
2573
+ children: /* @__PURE__ */ Z(oe, { className: "h-4 w-4" })
2279
2574
  }),
2280
2575
  /* @__PURE__ */ Z("span", {
2281
2576
  className: "text-xs text-muted-foreground whitespace-nowrap px-1.5 tabular-nums",
2282
- children: t > 0 ? c("detail.recordOf", {
2577
+ children: t > 0 ? s("detail.recordOf", {
2283
2578
  current: e + 1,
2284
2579
  total: t
2285
- }) : c("detail.noRecords")
2580
+ }) : s("detail.noRecords")
2286
2581
  }),
2287
- /* @__PURE__ */ Z(i, {
2582
+ /* @__PURE__ */ Z(p, {
2288
2583
  variant: "outline",
2289
2584
  size: "icon",
2290
2585
  className: "h-8 w-8",
2291
- disabled: !_,
2292
- onClick: x,
2293
- title: c("detail.nextRecordKey"),
2294
- children: /* @__PURE__ */ Z(L, { className: "h-4 w-4" })
2586
+ disabled: !g,
2587
+ onClick: b,
2588
+ title: s("detail.nextRecordKey"),
2589
+ children: /* @__PURE__ */ Z(W, { className: "h-4 w-4" })
2295
2590
  }),
2296
- /* @__PURE__ */ Z(i, {
2591
+ /* @__PURE__ */ Z(p, {
2297
2592
  variant: "outline",
2298
2593
  size: "icon",
2299
2594
  className: "h-8 w-8",
2300
- disabled: !v,
2301
- onClick: C,
2302
- title: c("detail.lastRecord"),
2303
- children: /* @__PURE__ */ Z(z, { className: "h-4 w-4" })
2595
+ disabled: !_,
2596
+ onClick: S,
2597
+ title: s("detail.lastRecord"),
2598
+ children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
2304
2599
  }),
2305
- o && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(i, {
2306
- variant: d ? "secondary" : "ghost",
2600
+ a && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(p, {
2601
+ variant: u ? "secondary" : "ghost",
2307
2602
  size: "icon",
2308
2603
  className: "h-8 w-8",
2309
- onClick: T,
2310
- title: c("detail.searchWhileNavigating"),
2311
- children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
2312
- }), d && /* @__PURE__ */ Z("div", {
2604
+ onClick: w,
2605
+ title: s("detail.searchWhileNavigating"),
2606
+ children: /* @__PURE__ */ Z(Ne, { className: "h-4 w-4" })
2607
+ }), u && /* @__PURE__ */ Z("div", {
2313
2608
  className: "relative",
2314
- children: /* @__PURE__ */ Z(f, {
2315
- ref: m,
2609
+ children: /* @__PURE__ */ Z(x, {
2610
+ ref: f,
2316
2611
  type: "text",
2317
- placeholder: c("detail.searchRecords"),
2318
- value: l,
2319
- onChange: w,
2612
+ placeholder: s("detail.searchRecords"),
2613
+ value: c,
2614
+ onChange: C,
2320
2615
  className: "h-8 w-48 text-sm"
2321
2616
  })
2322
2617
  })] })
2323
2618
  ]
2324
2619
  });
2325
- }, mt = 28, ht = [
2620
+ }, Pt = 28, Ft = [
2326
2621
  "fill-primary stroke-primary",
2327
2622
  "fill-blue-500 stroke-blue-500",
2328
2623
  "fill-emerald-500 stroke-emerald-500",
2329
2624
  "fill-amber-500 stroke-amber-500"
2330
- ], gt = [
2625
+ ], It = [
2331
2626
  "fill-primary-foreground",
2332
2627
  "fill-white",
2333
2628
  "fill-white",
2334
2629
  "fill-white"
2335
2630
  ];
2336
- function _t(e, t, n, r, i) {
2631
+ function Lt(e, t, n, r, i) {
2337
2632
  let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
2338
2633
  a.push({
2339
2634
  id: e.id,
@@ -2397,23 +2692,23 @@ function _t(e, t, n, r, i) {
2397
2692
  edges: o
2398
2693
  };
2399
2694
  }
2400
- function vt(e, t = 6) {
2695
+ function Rt(e, t = 6) {
2401
2696
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
2402
2697
  }
2403
- var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: l }) => {
2404
- let u = n.useRef(null), [d, f] = n.useState({
2698
+ var zt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: a }) => {
2699
+ let o = n.useRef(null), [s, c] = n.useState({
2405
2700
  width: 500,
2406
2701
  height: 400
2407
- }), [p, m] = n.useState(null);
2702
+ }), [l, u] = n.useState(null);
2408
2703
  n.useEffect(() => {
2409
- let e = u.current;
2704
+ let e = o.current;
2410
2705
  if (!e) return;
2411
2706
  let t = e.parentElement;
2412
2707
  if (!t) return;
2413
2708
  let n = new ResizeObserver((e) => {
2414
2709
  for (let t of e) {
2415
2710
  let { width: e } = t.contentRect;
2416
- e > 0 && f({
2711
+ e > 0 && c({
2417
2712
  width: e,
2418
2713
  height: Math.max(300, e * .7)
2419
2714
  });
@@ -2421,20 +2716,20 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
2421
2716
  });
2422
2717
  return n.observe(t), () => n.disconnect();
2423
2718
  }, []);
2424
- let { nodes: h, edges: g } = n.useMemo(() => _t(e, t, r, d.width, d.height), [
2719
+ let { nodes: d, edges: f } = n.useMemo(() => Lt(e, t, r, s.width, s.height), [
2425
2720
  e,
2426
2721
  t,
2427
2722
  r,
2428
- d
2723
+ s
2429
2724
  ]);
2430
- return /* @__PURE__ */ Q(a, {
2431
- className: S("overflow-hidden", l),
2432
- children: [/* @__PURE__ */ Z(s, {
2725
+ return /* @__PURE__ */ Q(m, {
2726
+ className: F("overflow-hidden", a),
2727
+ children: [/* @__PURE__ */ Z(g, {
2433
2728
  className: "pb-2",
2434
- children: /* @__PURE__ */ Q(c, {
2729
+ children: /* @__PURE__ */ Q(_, {
2435
2730
  className: "flex items-center gap-2 text-base",
2436
2731
  children: [
2437
- /* @__PURE__ */ Z(ue, { className: "h-4 w-4" }),
2732
+ /* @__PURE__ */ Z(Ce, { className: "h-4 w-4" }),
2438
2733
  "Relationships",
2439
2734
  /* @__PURE__ */ Q("span", {
2440
2735
  className: "text-sm font-normal text-muted-foreground",
@@ -2446,15 +2741,15 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
2446
2741
  })
2447
2742
  ]
2448
2743
  })
2449
- }), /* @__PURE__ */ Z(o, {
2744
+ }), /* @__PURE__ */ Z(h, {
2450
2745
  className: "p-0",
2451
2746
  children: /* @__PURE__ */ Q("svg", {
2452
- ref: u,
2747
+ ref: o,
2453
2748
  width: "100%",
2454
- height: d.height,
2455
- viewBox: `0 0 ${d.width} ${d.height}`,
2749
+ height: s.height,
2750
+ viewBox: `0 0 ${s.width} ${s.height}`,
2456
2751
  className: "select-none",
2457
- children: [g.map((e, t) => /* @__PURE__ */ Z("line", {
2752
+ children: [f.map((e, t) => /* @__PURE__ */ Z("line", {
2458
2753
  x1: e.fromX,
2459
2754
  y1: e.fromY,
2460
2755
  x2: e.toX,
@@ -2462,13 +2757,13 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
2462
2757
  className: "stroke-border",
2463
2758
  strokeWidth: 1.5,
2464
2759
  strokeOpacity: .5
2465
- }, `edge-${t}`)), h.map((e) => {
2466
- let t = p === e.id, n = ht[Math.min(e.level, ht.length - 1)], r = gt[Math.min(e.level, gt.length - 1)], a = e.level === 0 ? mt + 6 : mt;
2760
+ }, `edge-${t}`)), d.map((e) => {
2761
+ let t = l === e.id, n = Ft[Math.min(e.level, Ft.length - 1)], r = It[Math.min(e.level, It.length - 1)], a = e.level === 0 ? Pt + 6 : Pt;
2467
2762
  return /* @__PURE__ */ Q("g", {
2468
- className: S("cursor-pointer transition-transform", i && "hover:opacity-80"),
2763
+ className: F("cursor-pointer transition-transform", i && "hover:opacity-80"),
2469
2764
  onClick: () => i?.(e.id),
2470
- onMouseEnter: () => m(e.id),
2471
- onMouseLeave: () => m(null),
2765
+ onMouseEnter: () => u(e.id),
2766
+ onMouseLeave: () => u(null),
2472
2767
  children: [
2473
2768
  /* @__PURE__ */ Z("circle", {
2474
2769
  cx: e.x,
@@ -2484,8 +2779,8 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
2484
2779
  y: e.y,
2485
2780
  textAnchor: "middle",
2486
2781
  dominantBaseline: "central",
2487
- className: S("text-[10px] font-medium pointer-events-none", r),
2488
- children: vt(e.label)
2782
+ className: F("text-[10px] font-medium pointer-events-none", r),
2783
+ children: Rt(e.label)
2489
2784
  }),
2490
2785
  e.type && /* @__PURE__ */ Z("text", {
2491
2786
  x: e.x,
@@ -2519,46 +2814,46 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
2519
2814
  };
2520
2815
  //#endregion
2521
2816
  //#region src/CommentAttachment.tsx
2522
- function bt(e) {
2817
+ function Bt(e) {
2523
2818
  return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
2524
2819
  }
2525
- function xt(e) {
2820
+ function Vt(e) {
2526
2821
  return e.startsWith("image/");
2527
2822
  }
2528
- function St(e) {
2529
- return xt(e) ? se : e.includes("pdf") || e.includes("document") || e.includes("text") ? oe : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? ae : ie;
2823
+ function Ht(e) {
2824
+ return Vt(e) ? _e : e.includes("pdf") || e.includes("document") || e.includes("text") ? ge : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? he : me;
2530
2825
  }
2531
- var Ct = ({ attachments: e, onUpload: t, onRemove: r, className: a, readOnly: o = !1 }) => {
2532
- let { t: s } = $(), [c, l] = n.useState(!1), u = n.useRef(null), d = n.useCallback((e) => {
2533
- e.preventDefault(), e.stopPropagation(), l(!0);
2826
+ var Ut = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
2827
+ let { t: o } = $(), [s, c] = n.useState(!1), l = n.useRef(null), u = n.useCallback((e) => {
2828
+ e.preventDefault(), e.stopPropagation(), c(!0);
2829
+ }, []), d = n.useCallback((e) => {
2830
+ e.preventDefault(), e.stopPropagation(), c(!1);
2534
2831
  }, []), f = n.useCallback((e) => {
2535
- e.preventDefault(), e.stopPropagation(), l(!1);
2536
- }, []), p = n.useCallback((e) => {
2537
- e.preventDefault(), e.stopPropagation(), l(!1), t && e.dataTransfer.files.length > 0 && t(e.dataTransfer.files);
2832
+ e.preventDefault(), e.stopPropagation(), c(!1), t && e.dataTransfer.files.length > 0 && t(e.dataTransfer.files);
2538
2833
  }, [t]), m = n.useCallback((e) => {
2539
2834
  t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
2540
2835
  }, [t]);
2541
2836
  return /* @__PURE__ */ Q("div", {
2542
- className: S("space-y-2", a),
2543
- children: [t && !o && /* @__PURE__ */ Q("div", {
2544
- className: S("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", c ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
2545
- onDragOver: d,
2546
- onDragLeave: f,
2547
- onDrop: p,
2548
- onClick: () => u.current?.click(),
2837
+ className: F("space-y-2", i),
2838
+ children: [t && !a && /* @__PURE__ */ Q("div", {
2839
+ className: F("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", s ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
2840
+ onDragOver: u,
2841
+ onDragLeave: d,
2842
+ onDrop: f,
2843
+ onClick: () => l.current?.click(),
2549
2844
  role: "button",
2550
2845
  tabIndex: 0,
2551
2846
  onKeyDown: (e) => {
2552
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), u.current?.click());
2847
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l.current?.click());
2553
2848
  },
2554
2849
  children: [
2555
- /* @__PURE__ */ Z(Ee, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
2850
+ /* @__PURE__ */ Z(Re, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
2556
2851
  /* @__PURE__ */ Z("p", {
2557
2852
  className: "text-xs text-muted-foreground",
2558
- children: s("detail.dropFilesToUpload")
2853
+ children: o("detail.dropFilesToUpload")
2559
2854
  }),
2560
2855
  /* @__PURE__ */ Z("input", {
2561
- ref: u,
2856
+ ref: l,
2562
2857
  type: "file",
2563
2858
  multiple: !0,
2564
2859
  className: "hidden",
@@ -2569,11 +2864,11 @@ var Ct = ({ attachments: e, onUpload: t, onRemove: r, className: a, readOnly: o
2569
2864
  className: "space-y-1.5",
2570
2865
  children: [/* @__PURE__ */ Q("div", {
2571
2866
  className: "flex items-center gap-1.5 text-xs text-muted-foreground",
2572
- children: [/* @__PURE__ */ Z(pe, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: e.length === 1 ? s("detail.attachmentCount", { count: e.length }) : s("detail.attachmentCountPlural", { count: e.length }) })]
2867
+ children: [/* @__PURE__ */ Z(Ee, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: e.length === 1 ? o("detail.attachmentCount", { count: e.length }) : o("detail.attachmentCountPlural", { count: e.length }) })]
2573
2868
  }), /* @__PURE__ */ Z("div", {
2574
2869
  className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
2575
2870
  children: e.map((e) => {
2576
- let t = xt(e.type), n = St(e.type);
2871
+ let t = Vt(e.type), n = Ht(e.type);
2577
2872
  return /* @__PURE__ */ Q("div", {
2578
2873
  className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
2579
2874
  children: [
@@ -2592,16 +2887,16 @@ var Ct = ({ attachments: e, onUpload: t, onRemove: r, className: a, readOnly: o
2592
2887
  children: e.name
2593
2888
  }), /* @__PURE__ */ Z("p", {
2594
2889
  className: "text-[10px] text-muted-foreground",
2595
- children: bt(e.size)
2890
+ children: Bt(e.size)
2596
2891
  })]
2597
2892
  }),
2598
- r && !o && /* @__PURE__ */ Z(i, {
2893
+ r && !a && /* @__PURE__ */ Z(p, {
2599
2894
  variant: "ghost",
2600
2895
  size: "icon",
2601
2896
  className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
2602
2897
  onClick: () => r(e.id),
2603
- title: s("detail.removeAttachment"),
2604
- children: /* @__PURE__ */ Z(De, { className: "h-3.5 w-3.5" })
2898
+ title: o("detail.removeAttachment"),
2899
+ children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
2605
2900
  })
2606
2901
  ]
2607
2902
  }, e.id);
@@ -2612,7 +2907,7 @@ var Ct = ({ attachments: e, onUpload: t, onRemove: r, className: a, readOnly: o
2612
2907
  };
2613
2908
  //#endregion
2614
2909
  //#region src/PointInTimeRestore.tsx
2615
- function wt(e) {
2910
+ function Wt(e) {
2616
2911
  try {
2617
2912
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
2618
2913
  if (r < 1) return "just now";
@@ -2623,36 +2918,36 @@ function wt(e) {
2623
2918
  return e;
2624
2919
  }
2625
2920
  }
2626
- var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2627
- let [u, d] = n.useState(null), [f, p] = n.useState(!1), [m, h] = n.useState(!1), g = n.useMemo(() => t.find((e) => e.id === u) ?? null, [t, u]), _ = n.useCallback(async () => {
2628
- if (!(!g || !r)) {
2629
- if (!f) {
2630
- p(!0);
2921
+ var Gt = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
2922
+ let [a, o] = n.useState(null), [s, c] = n.useState(!1), [l, u] = n.useState(!1), d = n.useMemo(() => t.find((e) => e.id === a) ?? null, [t, a]), f = n.useCallback(async () => {
2923
+ if (!(!d || !r)) {
2924
+ if (!s) {
2925
+ c(!0);
2631
2926
  return;
2632
2927
  }
2633
- h(!0);
2928
+ u(!0);
2634
2929
  try {
2635
- let e = g.snapshot ?? {};
2636
- await r(g.id, e), p(!1), d(null);
2930
+ let e = d.snapshot ?? {};
2931
+ await r(d.id, e), c(!1), o(null);
2637
2932
  } finally {
2638
- h(!1);
2933
+ u(!1);
2639
2934
  }
2640
2935
  }
2641
2936
  }, [
2642
- g,
2937
+ d,
2643
2938
  r,
2644
- f
2939
+ s
2645
2940
  ]), v = n.useCallback(() => {
2646
- p(!1);
2941
+ c(!1);
2647
2942
  }, []);
2648
- return /* @__PURE__ */ Q(a, {
2649
- className: S("", l),
2650
- children: [/* @__PURE__ */ Z(s, {
2943
+ return /* @__PURE__ */ Q(m, {
2944
+ className: F("", i),
2945
+ children: [/* @__PURE__ */ Z(g, {
2651
2946
  className: "pb-3",
2652
- children: /* @__PURE__ */ Q(c, {
2947
+ children: /* @__PURE__ */ Q(_, {
2653
2948
  className: "flex items-center gap-2 text-base",
2654
2949
  children: [
2655
- /* @__PURE__ */ Z(W, { className: "h-4 w-4" }),
2950
+ /* @__PURE__ */ Z(q, { className: "h-4 w-4" }),
2656
2951
  "Revision History",
2657
2952
  /* @__PURE__ */ Q("span", {
2658
2953
  className: "text-sm font-normal text-muted-foreground",
@@ -2664,7 +2959,7 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2664
2959
  })
2665
2960
  ]
2666
2961
  })
2667
- }), /* @__PURE__ */ Z(o, { children: t.length === 0 ? /* @__PURE__ */ Z("p", {
2962
+ }), /* @__PURE__ */ Z(h, { children: t.length === 0 ? /* @__PURE__ */ Z("p", {
2668
2963
  className: "text-sm text-muted-foreground text-center py-4",
2669
2964
  children: "No revisions recorded"
2670
2965
  }) : /* @__PURE__ */ Q("div", {
@@ -2676,16 +2971,16 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2676
2971
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-3 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
2677
2972
  className: "space-y-1",
2678
2973
  children: t.map((e) => {
2679
- let t = e.id === u;
2974
+ let t = e.id === a;
2680
2975
  return /* @__PURE__ */ Q("button", {
2681
2976
  type: "button",
2682
- className: S("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
2977
+ className: F("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
2683
2978
  onClick: () => {
2684
- d(e.id), p(!1);
2979
+ o(e.id), c(!1);
2685
2980
  },
2686
2981
  children: [/* @__PURE__ */ Z("div", {
2687
- className: S("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
2688
- children: t && /* @__PURE__ */ Z(L, { className: "h-3 w-3 text-primary-foreground" })
2982
+ className: F("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
2983
+ children: t && /* @__PURE__ */ Z(W, { className: "h-3 w-3 text-primary-foreground" })
2689
2984
  }), /* @__PURE__ */ Q("div", {
2690
2985
  className: "flex-1 min-w-0",
2691
2986
  children: [/* @__PURE__ */ Q("div", {
@@ -2695,7 +2990,7 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2695
2990
  children: e.user
2696
2991
  }), /* @__PURE__ */ Z("span", {
2697
2992
  className: "text-xs text-muted-foreground",
2698
- children: wt(e.timestamp)
2993
+ children: Wt(e.timestamp)
2699
2994
  })]
2700
2995
  }), /* @__PURE__ */ Q("p", {
2701
2996
  className: "text-xs text-muted-foreground mt-0.5",
@@ -2712,16 +3007,16 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2712
3007
  })
2713
3008
  })]
2714
3009
  })
2715
- }), g && /* @__PURE__ */ Q("div", {
3010
+ }), d && /* @__PURE__ */ Q("div", {
2716
3011
  className: "lg:w-80 border rounded-md p-3 space-y-3",
2717
3012
  children: [
2718
3013
  /* @__PURE__ */ Q("div", {
2719
3014
  className: "flex items-center gap-2 text-sm font-medium",
2720
- children: [/* @__PURE__ */ Z(U, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
3015
+ children: [/* @__PURE__ */ Z(K, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
2721
3016
  }),
2722
3017
  /* @__PURE__ */ Z("div", {
2723
3018
  className: "space-y-2",
2724
- children: g.changes.map((e, t) => /* @__PURE__ */ Q("div", {
3019
+ children: d.changes.map((e, t) => /* @__PURE__ */ Q("div", {
2725
3020
  className: "text-xs",
2726
3021
  children: [/* @__PURE__ */ Z("span", {
2727
3022
  className: "font-medium text-muted-foreground",
@@ -2733,7 +3028,7 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2733
3028
  className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
2734
3029
  children: e.oldValue == null ? "(empty)" : String(e.oldValue)
2735
3030
  }),
2736
- /* @__PURE__ */ Z(L, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
3031
+ /* @__PURE__ */ Z(W, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
2737
3032
  /* @__PURE__ */ Z("span", {
2738
3033
  className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
2739
3034
  children: e.newValue == null ? "(empty)" : String(e.newValue)
@@ -2742,14 +3037,14 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2742
3037
  })]
2743
3038
  }, t))
2744
3039
  }),
2745
- g.snapshot && /* @__PURE__ */ Q("div", {
3040
+ d.snapshot && /* @__PURE__ */ Q("div", {
2746
3041
  className: "border-t pt-2 space-y-1",
2747
3042
  children: [/* @__PURE__ */ Z("p", {
2748
3043
  className: "text-xs font-medium text-muted-foreground",
2749
3044
  children: "Record state at this point"
2750
3045
  }), /* @__PURE__ */ Z("div", {
2751
3046
  className: "max-h-40 overflow-y-auto space-y-1",
2752
- children: Object.entries(g.snapshot).map(([e, t]) => /* @__PURE__ */ Q("div", {
3047
+ children: Object.entries(d.snapshot).map(([e, t]) => /* @__PURE__ */ Q("div", {
2753
3048
  className: "flex justify-between text-xs gap-2",
2754
3049
  children: [/* @__PURE__ */ Z("span", {
2755
3050
  className: "text-muted-foreground truncate",
@@ -2763,46 +3058,46 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2763
3058
  }),
2764
3059
  r && /* @__PURE__ */ Z("div", {
2765
3060
  className: "pt-1 space-y-2",
2766
- children: f ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Q("p", {
3061
+ children: s ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Q("p", {
2767
3062
  className: "text-xs text-amber-600 dark:text-amber-400",
2768
3063
  children: [
2769
3064
  "This will restore the record to its state at",
2770
3065
  " ",
2771
- wt(g.timestamp),
3066
+ Wt(d.timestamp),
2772
3067
  ". Continue?"
2773
3068
  ]
2774
3069
  }), /* @__PURE__ */ Q("div", {
2775
3070
  className: "flex gap-2",
2776
- children: [/* @__PURE__ */ Q(i, {
3071
+ children: [/* @__PURE__ */ Q(p, {
2777
3072
  variant: "destructive",
2778
3073
  size: "sm",
2779
3074
  className: "gap-1.5 flex-1",
2780
- onClick: _,
2781
- disabled: m,
2782
- children: [/* @__PURE__ */ Z(ve, { className: "h-3.5 w-3.5" }), m ? "Restoring…" : "Confirm Restore"]
2783
- }), /* @__PURE__ */ Z(i, {
3075
+ onClick: f,
3076
+ disabled: l,
3077
+ children: [/* @__PURE__ */ Z(je, { className: "h-3.5 w-3.5" }), l ? "Restoring…" : "Confirm Restore"]
3078
+ }), /* @__PURE__ */ Z(p, {
2784
3079
  variant: "ghost",
2785
3080
  size: "sm",
2786
3081
  onClick: v,
2787
- disabled: m,
3082
+ disabled: l,
2788
3083
  children: "Cancel"
2789
3084
  })]
2790
- })] }) : /* @__PURE__ */ Q(i, {
3085
+ })] }) : /* @__PURE__ */ Q(p, {
2791
3086
  variant: "outline",
2792
3087
  size: "sm",
2793
3088
  className: "w-full gap-1.5",
2794
- onClick: _,
2795
- children: [/* @__PURE__ */ Z(ve, { className: "h-3.5 w-3.5" }), "Restore to this point"]
3089
+ onClick: f,
3090
+ children: [/* @__PURE__ */ Z(je, { className: "h-3.5 w-3.5" }), "Restore to this point"]
2796
3091
  })
2797
3092
  })
2798
3093
  ]
2799
3094
  })]
2800
3095
  }) })]
2801
3096
  });
2802
- }, Et = ({ change: e, className: t }) => {
3097
+ }, Kt = ({ change: e, className: t }) => {
2803
3098
  let n = e.fieldLabel ?? e.field.charAt(0).toUpperCase() + e.field.slice(1).replace(/_/g, " "), r = e.oldDisplayValue ?? (e.oldValue == null ? "(empty)" : String(e.oldValue)), i = e.newDisplayValue ?? (e.newValue == null ? "(empty)" : String(e.newValue));
2804
3099
  return /* @__PURE__ */ Q("div", {
2805
- className: S("flex items-center gap-1.5 text-sm flex-wrap", t),
3100
+ className: F("flex items-center gap-1.5 text-sm flex-wrap", t),
2806
3101
  children: [
2807
3102
  /* @__PURE__ */ Z("span", {
2808
3103
  className: "font-medium text-foreground",
@@ -2812,50 +3107,50 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2812
3107
  className: "text-muted-foreground line-through",
2813
3108
  children: r
2814
3109
  }),
2815
- /* @__PURE__ */ Z(E, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
3110
+ /* @__PURE__ */ Z(R, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
2816
3111
  /* @__PURE__ */ Z("span", {
2817
3112
  className: "text-foreground",
2818
3113
  children: i
2819
3114
  })
2820
3115
  ]
2821
3116
  });
2822
- }, Dt = [
3117
+ }, qt = [
2823
3118
  "👍",
2824
3119
  "❤️",
2825
3120
  "🎉",
2826
3121
  "😂",
2827
3122
  "😮",
2828
3123
  "😢"
2829
- ], Ot = ({ reactions: e, onToggleReaction: t, emojiOptions: r = Dt, className: a }) => {
2830
- let [o, s] = n.useState(!1), c = n.useCallback((e) => {
2831
- t?.(e), s(!1);
3124
+ ], Jt = ({ reactions: e, onToggleReaction: t, emojiOptions: r = qt, className: i }) => {
3125
+ let [a, o] = n.useState(!1), s = n.useCallback((e) => {
3126
+ t?.(e), o(!1);
2832
3127
  }, [t]);
2833
3128
  return /* @__PURE__ */ Q("div", {
2834
- className: S("flex items-center gap-1 flex-wrap", a),
3129
+ className: F("flex items-center gap-1 flex-wrap", i),
2835
3130
  children: [e.map((e) => /* @__PURE__ */ Q("button", {
2836
3131
  type: "button",
2837
- className: S("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
2838
- onClick: () => c(e.emoji),
3132
+ className: F("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
3133
+ onClick: () => s(e.emoji),
2839
3134
  disabled: !t,
2840
3135
  "aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
2841
3136
  children: [/* @__PURE__ */ Z("span", { children: e.emoji }), /* @__PURE__ */ Z("span", { children: e.count })]
2842
3137
  }, e.emoji)), t && /* @__PURE__ */ Q("div", {
2843
3138
  className: "relative",
2844
- children: [/* @__PURE__ */ Z(i, {
3139
+ children: [/* @__PURE__ */ Z(p, {
2845
3140
  variant: "ghost",
2846
3141
  size: "icon",
2847
3142
  className: "h-6 w-6",
2848
- onClick: () => s(!o),
3143
+ onClick: () => o(!a),
2849
3144
  "aria-label": "Add reaction",
2850
- children: /* @__PURE__ */ Z(Se, { className: "h-3.5 w-3.5" })
2851
- }), o && /* @__PURE__ */ Z("div", {
3145
+ children: /* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" })
3146
+ }), a && /* @__PURE__ */ Z("div", {
2852
3147
  className: "absolute bottom-full mb-1 left-0 bg-popover border rounded-md shadow-md z-50 p-1.5 flex gap-1",
2853
3148
  role: "listbox",
2854
3149
  "aria-label": "Emoji picker",
2855
3150
  children: r.map((t) => /* @__PURE__ */ Z("button", {
2856
3151
  type: "button",
2857
3152
  className: "hover:bg-accent rounded p-1 text-base transition-colors",
2858
- onClick: () => c(t),
3153
+ onClick: () => s(t),
2859
3154
  role: "option",
2860
3155
  "aria-selected": e.some((e) => e.emoji === t && e.reacted),
2861
3156
  children: t
@@ -2866,7 +3161,7 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
2866
3161
  };
2867
3162
  //#endregion
2868
3163
  //#region src/ThreadedReplies.tsx
2869
- function kt(e) {
3164
+ function Yt(e) {
2870
3165
  try {
2871
3166
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
2872
3167
  if (r < 1) return "just now";
@@ -2879,39 +3174,39 @@ function kt(e) {
2879
3174
  return e;
2880
3175
  }
2881
3176
  }
2882
- var At = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: a = !0, className: o }) => {
2883
- let { t: s } = $(), [c, l] = n.useState(!1), [u, d] = n.useState(""), [f, p] = n.useState(!1), m = n.useCallback(async () => {
2884
- let t = u.trim();
3177
+ var Xt = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, className: a }) => {
3178
+ let { t: o } = $(), [s, c] = n.useState(!1), [l, u] = n.useState(""), [d, f] = n.useState(!1), m = n.useCallback(async () => {
3179
+ let t = l.trim();
2885
3180
  if (!(!t || !r)) {
2886
- p(!0);
3181
+ f(!0);
2887
3182
  try {
2888
- await r(e.id, t), d("");
3183
+ await r(e.id, t), u("");
2889
3184
  } finally {
2890
- p(!1);
3185
+ f(!1);
2891
3186
  }
2892
3187
  }
2893
3188
  }, [
2894
- u,
3189
+ l,
2895
3190
  r,
2896
3191
  e.id
2897
3192
  ]), h = n.useCallback((e) => {
2898
3193
  e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), m());
2899
3194
  }, [m]);
2900
- return t.length === 0 && !a ? null : /* @__PURE__ */ Q("div", {
2901
- className: S("ml-10 mt-1", o),
3195
+ return t.length === 0 && !i ? null : /* @__PURE__ */ Q("div", {
3196
+ className: F("ml-10 mt-1", a),
2902
3197
  children: [
2903
3198
  t.length > 0 && /* @__PURE__ */ Q("button", {
2904
3199
  type: "button",
2905
3200
  className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors mb-1",
2906
- onClick: () => l(!c),
2907
- "aria-expanded": c,
3201
+ onClick: () => c(!s),
3202
+ "aria-expanded": s,
2908
3203
  children: [
2909
- Z(c ? I : L, { className: "h-3 w-3" }),
3204
+ Z(s ? ae : W, { className: "h-3 w-3" }),
2910
3205
  /* @__PURE__ */ Z(Y, { className: "h-3 w-3" }),
2911
- /* @__PURE__ */ Z("span", { children: t.length === 1 ? s("detail.replyCount", { count: t.length }) : s("detail.replyCountPlural", { count: t.length }) })
3206
+ /* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
2912
3207
  ]
2913
3208
  }),
2914
- c && /* @__PURE__ */ Z("div", {
3209
+ s && /* @__PURE__ */ Z("div", {
2915
3210
  className: "space-y-2 border-l-2 border-border pl-3",
2916
3211
  children: t.map((e) => /* @__PURE__ */ Q("div", {
2917
3212
  className: "flex gap-2",
@@ -2934,7 +3229,7 @@ var At = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: a = !0, cl
2934
3229
  children: e.actor
2935
3230
  }), /* @__PURE__ */ Z("span", {
2936
3231
  className: "text-[10px] text-muted-foreground",
2937
- children: kt(e.createdAt)
3232
+ children: Yt(e.createdAt)
2938
3233
  })]
2939
3234
  }), /* @__PURE__ */ Z("p", {
2940
3235
  className: "text-xs whitespace-pre-wrap break-words",
@@ -2943,57 +3238,57 @@ var At = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: a = !0, cl
2943
3238
  })]
2944
3239
  }, e.id))
2945
3240
  }),
2946
- a && r && /* @__PURE__ */ Q("div", {
3241
+ i && r && /* @__PURE__ */ Q("div", {
2947
3242
  className: "flex gap-1.5 mt-1.5",
2948
3243
  children: [/* @__PURE__ */ Z("input", {
2949
3244
  className: "flex-1 rounded-md border border-input bg-background px-2 py-1 text-xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
2950
- placeholder: s("detail.replyPlaceholder"),
2951
- value: u,
2952
- onChange: (e) => d(e.target.value),
3245
+ placeholder: o("detail.replyPlaceholder"),
3246
+ value: l,
3247
+ onChange: (e) => u(e.target.value),
2953
3248
  onKeyDown: h,
2954
- disabled: f
2955
- }), /* @__PURE__ */ Z(i, {
3249
+ disabled: d
3250
+ }), /* @__PURE__ */ Z(p, {
2956
3251
  variant: "ghost",
2957
3252
  size: "icon",
2958
3253
  className: "h-6 w-6 shrink-0",
2959
3254
  onClick: m,
2960
- disabled: !u.trim() || f,
3255
+ disabled: !l.trim() || d,
2961
3256
  "aria-label": "Send reply",
2962
- children: /* @__PURE__ */ Z(xe, { className: "h-3 w-3" })
3257
+ children: /* @__PURE__ */ Z(Pe, { className: "h-3 w-3" })
2963
3258
  })]
2964
3259
  })
2965
3260
  ]
2966
3261
  });
2967
- }, jt = ({ subscription: e, onToggle: t, className: r }) => {
2968
- let { t: a } = $(), [o, s] = n.useState(!1), c = n.useCallback(async () => {
3262
+ }, Zt = ({ subscription: e, onToggle: t, className: r }) => {
3263
+ let { t: i } = $(), [a, o] = n.useState(!1), s = n.useCallback(async () => {
2969
3264
  if (t) {
2970
- s(!0);
3265
+ o(!0);
2971
3266
  try {
2972
3267
  await t(!e.subscribed);
2973
3268
  } finally {
2974
- s(!1);
3269
+ o(!1);
2975
3270
  }
2976
3271
  }
2977
3272
  }, [t, e.subscribed]);
2978
- return /* @__PURE__ */ Z(i, {
3273
+ return /* @__PURE__ */ Z(p, {
2979
3274
  variant: "ghost",
2980
3275
  size: "icon",
2981
- className: S("h-8 w-8", r),
2982
- onClick: c,
2983
- disabled: o || !t,
2984
- "aria-label": e.subscribed ? a("detail.unsubscribeAriaLabel") : a("detail.subscribeAriaLabel"),
2985
- title: e.subscribed ? a("detail.subscribedTooltip") : a("detail.unsubscribedTooltip"),
2986
- children: e.subscribed ? /* @__PURE__ */ Z(A, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(j, { className: "h-4 w-4 text-muted-foreground" })
3276
+ className: F("h-8 w-8", r),
3277
+ onClick: s,
3278
+ disabled: a || !t,
3279
+ "aria-label": e.subscribed ? i("detail.unsubscribeAriaLabel") : i("detail.subscribeAriaLabel"),
3280
+ title: e.subscribed ? i("detail.subscribedTooltip") : i("detail.unsubscribedTooltip"),
3281
+ children: e.subscribed ? /* @__PURE__ */ Z(ne, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(re, { className: "h-4 w-4 text-muted-foreground" })
2987
3282
  });
2988
- }, Mt = {
3283
+ }, Qt = {
2989
3284
  comment: Y,
2990
- field_change: H,
2991
- task: F,
2992
- event: N,
2993
- system: Oe,
2994
- email: le,
2995
- call: me
2996
- }, Nt = {
3285
+ field_change: G,
3286
+ task: U,
3287
+ event: H,
3288
+ system: Be,
3289
+ email: Se,
3290
+ call: De
3291
+ }, $t = {
2997
3292
  comment: "bg-purple-100 text-purple-600",
2998
3293
  field_change: "bg-blue-100 text-blue-600",
2999
3294
  task: "bg-green-100 text-green-600",
@@ -3002,7 +3297,7 @@ var At = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: a = !0, cl
3002
3297
  email: "bg-indigo-100 text-indigo-600",
3003
3298
  call: "bg-teal-100 text-teal-600"
3004
3299
  };
3005
- function Pt(e) {
3300
+ function en(e) {
3006
3301
  return [
3007
3302
  {
3008
3303
  value: "all",
@@ -3022,7 +3317,7 @@ function Pt(e) {
3022
3317
  }
3023
3318
  ];
3024
3319
  }
3025
- function Ft(e) {
3320
+ function tn(e) {
3026
3321
  try {
3027
3322
  let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
3028
3323
  if (r < 1) return "just now";
@@ -3035,7 +3330,7 @@ function Ft(e) {
3035
3330
  return e;
3036
3331
  }
3037
3332
  }
3038
- function It(e, t) {
3333
+ function nn(e, t) {
3039
3334
  switch (t) {
3040
3335
  case "comments_only": return e.filter((e) => e.type === "comment");
3041
3336
  case "changes_only": return e.filter((e) => e.type === "field_change");
@@ -3043,112 +3338,112 @@ function It(e, t) {
3043
3338
  default: return e;
3044
3339
  }
3045
3340
  }
3046
- var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u = !1, onLoadMore: d, loading: f = !1, onAddComment: p, onAddReply: m, onToggleReaction: h, subscription: g, onToggleSubscription: _, collapseWhenEmpty: v = !1, className: y }) => {
3047
- let { t: b } = $(), [x, C] = n.useState("all"), [T, E] = n.useState(""), [D, O] = n.useState(!1), [k, A] = n.useState(!1), j = r ?? x, M = t?.showFilterToggle !== !1, N = t?.showCommentInput !== !1 && !!p, P = t?.enableReactions ?? !1, F = t?.enableThreading ?? !1, ee = t?.showSubscriptionToggle ?? !1, L = n.useMemo(() => It(e, j), [e, j]), R = n.useMemo(() => F ? L.filter((e) => !e.parentId) : L, [L, F]), z = n.useMemo(() => {
3048
- if (!F) return /* @__PURE__ */ new Map();
3341
+ var rn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: v = !1, className: y }) => {
3342
+ let { t: b } = $(), [x, S] = n.useState("all"), [C, w] = n.useState(""), [T, E] = n.useState(!1), [D, O] = n.useState(!1), k = r ?? x, A = t?.showFilterToggle !== !1, j = t?.showCommentInput !== !1 && !!c, M = t?.enableReactions ?? !1, N = t?.enableThreading ?? !1, P = t?.showSubscriptionToggle ?? !1, I = n.useMemo(() => nn(e, k), [e, k]), ee = n.useMemo(() => N ? I.filter((e) => !e.parentId) : I, [I, N]), R = n.useMemo(() => {
3343
+ if (!N) return /* @__PURE__ */ new Map();
3049
3344
  let e = /* @__PURE__ */ new Map();
3050
- for (let t of L) if (t.parentId) {
3345
+ for (let t of I) if (t.parentId) {
3051
3346
  let n = e.get(t.parentId) ?? [];
3052
3347
  n.push(t), e.set(t.parentId, n);
3053
3348
  }
3054
3349
  return e;
3055
- }, [L, F]), B = n.useCallback((e) => {
3056
- l ? l(e) : C(e);
3057
- }, [l]), V = n.useCallback(async () => {
3058
- let e = T.trim();
3059
- if (!(!e || !p)) {
3060
- O(!0);
3350
+ }, [I, N]), te = n.useCallback((e) => {
3351
+ i ? i(e) : S(e);
3352
+ }, [i]), z = n.useCallback(async () => {
3353
+ let e = C.trim();
3354
+ if (!(!e || !c)) {
3355
+ E(!0);
3061
3356
  try {
3062
- await p(e), E("");
3357
+ await c(e), w("");
3063
3358
  } finally {
3064
- O(!1);
3359
+ E(!1);
3065
3360
  }
3066
3361
  }
3067
- }, [T, p]), te = n.useCallback((e) => {
3068
- e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), V());
3069
- }, [V]), H = n.useCallback(async () => {
3070
- if (d) {
3071
- A(!0);
3362
+ }, [C, c]), B = n.useCallback((e) => {
3363
+ e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), z());
3364
+ }, [z]), ne = n.useCallback(async () => {
3365
+ if (o) {
3366
+ O(!0);
3072
3367
  try {
3073
- await d();
3368
+ await o();
3074
3369
  } finally {
3075
- A(!1);
3370
+ O(!1);
3076
3371
  }
3077
3372
  }
3078
- }, [d]);
3079
- return /* @__PURE__ */ Q(a, {
3080
- className: S("", y),
3081
- children: [/* @__PURE__ */ Z(s, { children: /* @__PURE__ */ Q("div", {
3373
+ }, [o]);
3374
+ return /* @__PURE__ */ Q(m, {
3375
+ className: F("", y),
3376
+ children: [/* @__PURE__ */ Z(g, { children: /* @__PURE__ */ Q("div", {
3082
3377
  className: "flex items-center justify-between",
3083
- children: [/* @__PURE__ */ Q(c, {
3378
+ children: [/* @__PURE__ */ Q(_, {
3084
3379
  className: "flex items-center gap-2 text-base",
3085
3380
  children: [
3086
- /* @__PURE__ */ Z(w, { className: "h-4 w-4" }),
3381
+ /* @__PURE__ */ Z(L, { className: "h-4 w-4" }),
3087
3382
  b("detail.activity"),
3088
3383
  /* @__PURE__ */ Q("span", {
3089
3384
  className: "text-sm font-normal text-muted-foreground",
3090
3385
  children: [
3091
3386
  "(",
3092
- L.length,
3387
+ I.length,
3093
3388
  ")"
3094
3389
  ]
3095
3390
  })
3096
3391
  ]
3097
3392
  }), /* @__PURE__ */ Z("div", {
3098
3393
  className: "flex items-center gap-1",
3099
- children: ee && g && /* @__PURE__ */ Z(jt, {
3100
- subscription: g,
3101
- onToggle: _
3394
+ children: P && d && /* @__PURE__ */ Z(Zt, {
3395
+ subscription: d,
3396
+ onToggle: f
3102
3397
  })
3103
3398
  })]
3104
- }) }), /* @__PURE__ */ Q(o, {
3399
+ }) }), /* @__PURE__ */ Q(h, {
3105
3400
  className: "space-y-4",
3106
3401
  children: [
3107
- M && /* @__PURE__ */ Z("div", {
3402
+ A && /* @__PURE__ */ Z("div", {
3108
3403
  className: "flex items-center gap-2",
3109
3404
  children: /* @__PURE__ */ Z("select", {
3110
3405
  className: "rounded-md border border-input bg-background px-2.5 py-1.5 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
3111
- value: j,
3112
- onChange: (e) => B(e.target.value),
3406
+ value: k,
3407
+ onChange: (e) => te(e.target.value),
3113
3408
  "aria-label": b("detail.filterActivity"),
3114
- children: Pt(b).map((e) => /* @__PURE__ */ Z("option", {
3409
+ children: en(b).map((e) => /* @__PURE__ */ Z("option", {
3115
3410
  value: e.value,
3116
3411
  children: e.label
3117
3412
  }, e.value))
3118
3413
  })
3119
3414
  }),
3120
- N && /* @__PURE__ */ Q("div", {
3415
+ j && /* @__PURE__ */ Q("div", {
3121
3416
  className: "flex gap-2",
3122
3417
  children: [/* @__PURE__ */ Z("textarea", {
3123
3418
  className: "flex-1 min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none",
3124
3419
  placeholder: b("detail.leaveCommentPlaceholder"),
3125
- value: T,
3126
- onChange: (e) => E(e.target.value),
3127
- onKeyDown: te,
3128
- disabled: D
3129
- }), /* @__PURE__ */ Z(i, {
3420
+ value: C,
3421
+ onChange: (e) => w(e.target.value),
3422
+ onKeyDown: B,
3423
+ disabled: T
3424
+ }), /* @__PURE__ */ Z(p, {
3130
3425
  size: "icon",
3131
3426
  variant: "default",
3132
- onClick: V,
3133
- disabled: !T.trim() || D,
3427
+ onClick: z,
3428
+ disabled: !C.trim() || T,
3134
3429
  className: "shrink-0 self-end",
3135
3430
  "aria-label": b("detail.submitComment"),
3136
3431
  children: /* @__PURE__ */ Z(Y, { className: "h-4 w-4" })
3137
3432
  })]
3138
3433
  }),
3139
- L.length === 0 ? v ? null : /* @__PURE__ */ Z("p", {
3434
+ I.length === 0 ? v ? null : /* @__PURE__ */ Z("p", {
3140
3435
  className: "text-sm text-muted-foreground text-center py-4",
3141
3436
  children: b("detail.noActivity")
3142
3437
  }) : /* @__PURE__ */ Q("div", {
3143
3438
  className: "relative",
3144
3439
  children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
3145
3440
  className: "space-y-4",
3146
- children: R.map((e) => {
3147
- let t = Mt[e.type] || Oe, n = Nt[e.type] || "bg-gray-100 text-gray-600", r = z.get(e.id) ?? [];
3441
+ children: ee.map((e) => {
3442
+ let t = Qt[e.type] || Be, n = $t[e.type] || "bg-gray-100 text-gray-600", r = R.get(e.id) ?? [];
3148
3443
  return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
3149
3444
  className: "flex gap-3 relative",
3150
3445
  children: [/* @__PURE__ */ Z("div", {
3151
- className: S("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
3446
+ className: F("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
3152
3447
  children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
3153
3448
  src: e.actorAvatarUrl,
3154
3449
  alt: e.actor,
@@ -3170,7 +3465,7 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
3170
3465
  }),
3171
3466
  /* @__PURE__ */ Z("span", {
3172
3467
  className: "text-xs text-muted-foreground",
3173
- children: Ft(e.createdAt)
3468
+ children: tn(e.createdAt)
3174
3469
  }),
3175
3470
  e.edited && /* @__PURE__ */ Z("span", {
3176
3471
  className: "text-xs text-muted-foreground italic",
@@ -3188,61 +3483,61 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
3188
3483
  }),
3189
3484
  e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
3190
3485
  className: "space-y-1 mt-1",
3191
- children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Et, { change: e }, t))
3486
+ children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Kt, { change: e }, t))
3192
3487
  }),
3193
- P && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
3488
+ M && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
3194
3489
  className: "mt-1.5",
3195
- children: /* @__PURE__ */ Z(Ot, {
3490
+ children: /* @__PURE__ */ Z(Jt, {
3196
3491
  reactions: e.reactions,
3197
- onToggleReaction: h ? (t) => h(e.id, t) : void 0
3492
+ onToggleReaction: u ? (t) => u(e.id, t) : void 0
3198
3493
  })
3199
3494
  }),
3200
- P && (!e.reactions || e.reactions.length === 0) && h && /* @__PURE__ */ Z("div", {
3495
+ M && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
3201
3496
  className: "mt-1.5",
3202
- children: /* @__PURE__ */ Z(Ot, {
3497
+ children: /* @__PURE__ */ Z(Jt, {
3203
3498
  reactions: [],
3204
- onToggleReaction: (t) => h(e.id, t)
3499
+ onToggleReaction: (t) => u(e.id, t)
3205
3500
  })
3206
3501
  })
3207
3502
  ]
3208
3503
  })]
3209
- }), F && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(At, {
3504
+ }), N && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Xt, {
3210
3505
  parentItem: e,
3211
3506
  replies: r,
3212
- onAddReply: m,
3213
- showReplyInput: !!m
3507
+ onAddReply: l,
3508
+ showReplyInput: !!l
3214
3509
  })] }, e.id);
3215
3510
  })
3216
3511
  })]
3217
3512
  }),
3218
- u && /* @__PURE__ */ Z("div", {
3513
+ a && /* @__PURE__ */ Z("div", {
3219
3514
  className: "text-center pt-2",
3220
- children: /* @__PURE__ */ Q(i, {
3515
+ children: /* @__PURE__ */ Q(p, {
3221
3516
  variant: "ghost",
3222
3517
  size: "sm",
3223
- onClick: H,
3224
- disabled: k,
3518
+ onClick: ne,
3519
+ disabled: D,
3225
3520
  "aria-label": b("detail.loadMore"),
3226
- children: [k ? /* @__PURE__ */ Z(J, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(I, { className: "h-4 w-4 mr-1" }), b("detail.loadMore")]
3521
+ children: [D ? /* @__PURE__ */ Z(xe, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(ae, { className: "h-4 w-4 mr-1" }), b("detail.loadMore")]
3227
3522
  })
3228
3523
  })
3229
3524
  ]
3230
3525
  })]
3231
3526
  });
3232
- }, Rt = ({ config: e, items: t, hasMore: r, onLoadMore: a, loading: o, onAddComment: s, onAddReply: c, onToggleReaction: l, subscription: u, onToggleSubscription: d, filterMode: f, onFilterChange: p, collapseWhenEmpty: m = !1, className: h }) => {
3233
- let g = e?.position ?? "right", _ = e?.width ?? "360px", v = e?.collapsible ?? !0, y = m && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: b } = $(), [x, C] = n.useState(y);
3527
+ }, an = ({ config: e, items: t, hasMore: r, onLoadMore: i, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: m = !1, className: h }) => {
3528
+ let g = e?.position ?? "right", _ = e?.width ?? "360px", v = e?.collapsible ?? !0, y = m && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: b } = $(), [x, S] = n.useState(y);
3234
3529
  return g === "right" || g === "left" ? x && v ? /* @__PURE__ */ Z("div", {
3235
- className: S("flex items-start pt-4", g === "right" ? "border-l" : "border-r", h),
3236
- children: /* @__PURE__ */ Z(i, {
3530
+ className: F("flex items-start pt-4", g === "right" ? "border-l" : "border-r", h),
3531
+ children: /* @__PURE__ */ Z(p, {
3237
3532
  variant: "ghost",
3238
3533
  size: "icon",
3239
3534
  className: "h-8 w-8 mx-1",
3240
- onClick: () => C(!1),
3535
+ onClick: () => S(!1),
3241
3536
  "aria-label": b("detail.openDiscussion"),
3242
- children: /* @__PURE__ */ Z(fe, { className: "h-4 w-4" })
3537
+ children: /* @__PURE__ */ Z(Te, { className: "h-4 w-4" })
3243
3538
  })
3244
3539
  }) : /* @__PURE__ */ Q("div", {
3245
- className: S("flex flex-col overflow-hidden", g === "right" ? "border-l" : "border-r", h),
3540
+ className: F("flex flex-col overflow-hidden", g === "right" ? "border-l" : "border-r", h),
3246
3541
  style: {
3247
3542
  width: _,
3248
3543
  minWidth: _
@@ -3255,39 +3550,39 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
3255
3550
  className: "text-sm font-medium",
3256
3551
  children: b("detail.discussion")
3257
3552
  })]
3258
- }), v && /* @__PURE__ */ Z(i, {
3553
+ }), v && /* @__PURE__ */ Z(p, {
3259
3554
  variant: "ghost",
3260
3555
  size: "icon",
3261
3556
  className: "h-7 w-7",
3262
- onClick: () => C(!0),
3557
+ onClick: () => S(!0),
3263
3558
  "aria-label": b("detail.closeDiscussion"),
3264
- children: /* @__PURE__ */ Z(De, { className: "h-3.5 w-3.5" })
3559
+ children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
3265
3560
  })]
3266
3561
  }), /* @__PURE__ */ Z("div", {
3267
3562
  className: "flex-1 overflow-y-auto",
3268
- children: /* @__PURE__ */ Z(Lt, {
3563
+ children: /* @__PURE__ */ Z(rn, {
3269
3564
  items: t,
3270
3565
  config: e?.feed,
3271
3566
  hasMore: r,
3272
- onLoadMore: a,
3273
- loading: o,
3274
- onAddComment: s,
3275
- onAddReply: c,
3276
- onToggleReaction: l,
3277
- subscription: u,
3278
- onToggleSubscription: d,
3279
- filterMode: f,
3280
- onFilterChange: p,
3567
+ onLoadMore: i,
3568
+ loading: a,
3569
+ onAddComment: o,
3570
+ onAddReply: s,
3571
+ onToggleReaction: c,
3572
+ subscription: l,
3573
+ onToggleSubscription: u,
3574
+ filterMode: d,
3575
+ onFilterChange: f,
3281
3576
  collapseWhenEmpty: m,
3282
3577
  className: "border-0 shadow-none"
3283
3578
  })
3284
3579
  })]
3285
3580
  }) : /* @__PURE__ */ Z("div", {
3286
- className: S("", h),
3287
- children: v && x ? /* @__PURE__ */ Q(i, {
3581
+ className: F("", h),
3582
+ children: v && x ? /* @__PURE__ */ Q(p, {
3288
3583
  variant: "ghost",
3289
3584
  className: "w-full justify-start gap-2 text-muted-foreground",
3290
- onClick: () => C(!1),
3585
+ onClick: () => S(!1),
3291
3586
  "aria-label": b("detail.showDiscussion", { count: t.length }),
3292
3587
  children: [/* @__PURE__ */ Z(Y, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: b("detail.showDiscussion", { count: t.length }) })]
3293
3588
  }) : /* @__PURE__ */ Q("div", { children: [v && /* @__PURE__ */ Q("div", {
@@ -3295,78 +3590,78 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
3295
3590
  children: [/* @__PURE__ */ Q("div", {
3296
3591
  className: "flex items-center gap-2 text-sm font-medium",
3297
3592
  children: [/* @__PURE__ */ Z(Y, { className: "h-4 w-4" }), b("detail.discussion")]
3298
- }), /* @__PURE__ */ Z(i, {
3593
+ }), /* @__PURE__ */ Z(p, {
3299
3594
  variant: "ghost",
3300
3595
  size: "icon",
3301
3596
  className: "h-7 w-7",
3302
- onClick: () => C(!0),
3597
+ onClick: () => S(!0),
3303
3598
  "aria-label": b("detail.hideDiscussion"),
3304
- children: /* @__PURE__ */ Z(de, { className: "h-3.5 w-3.5" })
3599
+ children: /* @__PURE__ */ Z(we, { className: "h-3.5 w-3.5" })
3305
3600
  })]
3306
- }), /* @__PURE__ */ Z(Lt, {
3601
+ }), /* @__PURE__ */ Z(rn, {
3307
3602
  items: t,
3308
3603
  config: e?.feed,
3309
3604
  hasMore: r,
3310
- onLoadMore: a,
3311
- loading: o,
3312
- onAddComment: s,
3313
- onAddReply: c,
3314
- onToggleReaction: l,
3315
- subscription: u,
3316
- onToggleSubscription: d,
3317
- filterMode: f,
3318
- onFilterChange: p,
3605
+ onLoadMore: i,
3606
+ loading: a,
3607
+ onAddComment: o,
3608
+ onAddReply: s,
3609
+ onToggleReaction: c,
3610
+ subscription: l,
3611
+ onToggleSubscription: u,
3612
+ filterMode: d,
3613
+ onFilterChange: f,
3319
3614
  collapseWhenEmpty: m
3320
3615
  })] })
3321
3616
  });
3322
- }, zt = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: a }) => {
3323
- let [o, s] = n.useState(""), [c, l] = n.useState(!1), u = n.useCallback(async () => {
3324
- let t = o.trim();
3617
+ }, on = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: i }) => {
3618
+ let [a, o] = n.useState(""), [s, c] = n.useState(!1), l = n.useCallback(async () => {
3619
+ let t = a.trim();
3325
3620
  if (t) {
3326
- l(!0);
3621
+ c(!0);
3327
3622
  try {
3328
- await e(t), s("");
3623
+ await e(t), o("");
3329
3624
  } finally {
3330
- l(!1);
3625
+ c(!1);
3331
3626
  }
3332
3627
  }
3333
- }, [o, e]), d = n.useCallback((e) => {
3334
- e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), u());
3335
- }, [u]);
3628
+ }, [a, e]), u = n.useCallback((e) => {
3629
+ e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
3630
+ }, [l]);
3336
3631
  return /* @__PURE__ */ Q("div", {
3337
- className: S("flex gap-2", a),
3632
+ className: F("flex gap-2", i),
3338
3633
  children: [/* @__PURE__ */ Z("textarea", {
3339
3634
  className: "flex-1 min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none",
3340
3635
  placeholder: t,
3341
- value: o,
3342
- onChange: (e) => s(e.target.value),
3343
- onKeyDown: d,
3344
- disabled: r || c
3345
- }), /* @__PURE__ */ Z(i, {
3636
+ value: a,
3637
+ onChange: (e) => o(e.target.value),
3638
+ onKeyDown: u,
3639
+ disabled: r || s
3640
+ }), /* @__PURE__ */ Z(p, {
3346
3641
  size: "icon",
3347
3642
  variant: "default",
3348
- onClick: u,
3349
- disabled: !o.trim() || c || r,
3643
+ onClick: l,
3644
+ disabled: !a.trim() || s || r,
3350
3645
  className: "shrink-0 self-end",
3351
3646
  "aria-label": "Submit comment",
3352
- children: /* @__PURE__ */ Z(xe, { className: "h-4 w-4" })
3647
+ children: /* @__PURE__ */ Z(Pe, { className: "h-4 w-4" })
3353
3648
  })]
3354
3649
  });
3355
- }, Bt = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
3650
+ }, sn = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
3356
3651
  let s = n.useMemo(() => {
3357
3652
  if (!e) return t;
3358
3653
  let n = e.toLowerCase();
3359
3654
  return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
3360
3655
  }, [e, t]);
3361
3656
  return !i || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
3362
- className: S("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
3657
+ className: F("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
3363
3658
  role: "listbox",
3364
3659
  "aria-label": "Mention suggestions",
3365
3660
  children: s.map((e, t) => /* @__PURE__ */ Q("button", {
3366
3661
  type: "button",
3367
3662
  role: "option",
3368
3663
  "aria-selected": t === a,
3369
- className: S("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === a && "bg-accent"),
3664
+ className: F("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === a && "bg-accent"),
3370
3665
  onMouseDown: (t) => {
3371
3666
  t.preventDefault(), r(e);
3372
3667
  },
@@ -3394,7 +3689,7 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
3394
3689
  }, e.id))
3395
3690
  });
3396
3691
  };
3397
- function Vt(e, t, n) {
3692
+ function cn(e, t, n) {
3398
3693
  return {
3399
3694
  type: e.type,
3400
3695
  id: e.id,
@@ -3403,7 +3698,7 @@ function Vt(e, t, n) {
3403
3698
  length: n
3404
3699
  };
3405
3700
  }
3406
- e.register("detail-view", it, {
3701
+ e.register("detail-view", yt, {
3407
3702
  namespace: "plugin-detail",
3408
3703
  label: "Detail View",
3409
3704
  category: "Views",
@@ -3533,7 +3828,7 @@ e.register("detail-view", it, {
3533
3828
  tabs: [],
3534
3829
  related: []
3535
3830
  }
3536
- }), e.register("detail-section", He, {
3831
+ }), e.register("detail-section", rt, {
3537
3832
  namespace: "plugin-detail",
3538
3833
  label: "Detail Section",
3539
3834
  category: "Detail Components",
@@ -3584,7 +3879,7 @@ e.register("detail-view", it, {
3584
3879
  label: "Header Color"
3585
3880
  }
3586
3881
  ]
3587
- }), e.register("related-list", Ge, {
3882
+ }), e.register("related-list", ot, {
3588
3883
  namespace: "plugin-detail",
3589
3884
  label: "Related List",
3590
3885
  category: "Detail Components",
@@ -3631,7 +3926,7 @@ e.register("detail-view", it, {
3631
3926
  label: "Columns"
3632
3927
  }
3633
3928
  ]
3634
- }), e.register("detail", it, {
3929
+ }), e.register("detail", yt, {
3635
3930
  namespace: "view",
3636
3931
  category: "view",
3637
3932
  label: "Detail",
@@ -3656,4 +3951,4 @@ e.register("detail-view", it, {
3656
3951
  ]
3657
3952
  });
3658
3953
  //#endregion
3659
- export { tt as ActivityTimeline, Ct as CommentAttachment, zt as CommentInput, Be as DETAIL_DEFAULT_TRANSLATIONS, He as DetailSection, Ue as DetailTabs, it as DetailView, ft as DiffView, Et as FieldChangeItem, qe as HeaderHighlight, at as InlineCreateRelated, Bt as MentionAutocomplete, Tt as PointInTimeRestore, Ot as ReactionPicker, Lt as RecordActivityTimeline, Rt as RecordChatterPanel, Ye as RecordComments, pt as RecordNavigationEnhanced, Ge as RelatedList, yt as RelationshipGraph, st as RichTextCommentInput, Ke as SectionGroup, jt as SubscriptionToggle, At as ThreadedReplies, Le as applyAutoSpan, Re as applyDetailAutoLayout, Vt as createMentionFromSuggestion, ze as createSafeTranslationHook, Ie as inferDetailColumns, Fe as isWideFieldType, $ as useDetailTranslation };
3954
+ export { gt as ActivityTimeline, Ut as CommentAttachment, on as CommentInput, tt as DETAIL_DEFAULT_TRANSLATIONS, rt as DetailSection, it as DetailTabs, yt as DetailView, Mt as DiffView, Kt as FieldChangeItem, ct as HeaderHighlight, Tt as InlineCreateRelated, sn as MentionAutocomplete, Gt as PointInTimeRestore, Jt as ReactionPicker, rn as RecordActivityTimeline, an as RecordChatterPanel, ut as RecordComments, Ct as RecordDetailDrawer, Nt as RecordNavigationEnhanced, ot as RelatedList, zt as RelationshipGraph, Dt as RichTextCommentInput, st as SectionGroup, Zt as SubscriptionToggle, Xt as ThreadedReplies, Qe as applyAutoSpan, $e as applyDetailAutoLayout, cn as createMentionFromSuggestion, et as createSafeTranslationHook, wt as deriveRecordPageHref, Ze as inferDetailColumns, Xe as isWideFieldType, $ as useDetailTranslation };