@object-ui/fields 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,21 +1,21 @@
1
1
  import e, { Suspense as t, lazy as n, useCallback as r, useContext as i, useEffect as a, useId as o, useMemo as s, useRef as c, useState as l } from "react";
2
2
  import { ComponentRegistry as u } from "@object-ui/core";
3
- import { Avatar as d, AvatarFallback as f, AvatarImage as p, Badge as m, Button as h, Checkbox as g, Dialog as _, DialogContent as v, DialogDescription as y, DialogFooter as b, DialogHeader as ee, DialogTitle as x, EmptyValue as S, Input as C, Label as w, Popover as T, PopoverContent as E, PopoverTrigger as te, Select as D, SelectContent as ne, SelectItem as re, SelectTrigger as ie, SelectValue as ae, Skeleton as O, Slider as k, Switch as oe, Table as se, TableBody as ce, TableCell as A, TableHead as le, TableHeader as j, TableRow as M, Textarea as N, cn as P } from "@object-ui/components";
4
- import { AlertCircle as ue, ArrowDown as de, ArrowUp as fe, ArrowUpDown as pe, Camera as F, Check as I, ChevronLeft as me, ChevronRight as he, Copy as L, Crop as ge, Crosshair as R, Eraser as z, ExternalLink as B, Eye as V, EyeOff as _e, File as ve, Image as ye, ImageIcon as H, Loader2 as be, MapPin as U, Maximize2 as W, Phone as xe, Plus as Se, QrCode as G, RotateCw as K, Search as Ce, SlidersHorizontal as we, Star as Te, TableProperties as Ee, Upload as De, X as Oe } from "lucide-react";
5
- import { Fragment as ke, jsx as q, jsxs as J } from "react/jsx-runtime";
6
- import { createSafeTranslation as Y } from "@object-ui/i18n";
7
- import { SchemaRendererContext as Ae } from "@object-ui/react";
8
- import { useUpload as je } from "@object-ui/providers";
3
+ import { Avatar as d, AvatarFallback as f, AvatarImage as p, Badge as m, Button as h, Checkbox as g, Dialog as _, DialogContent as v, DialogDescription as y, DialogFooter as b, DialogHeader as ee, DialogTitle as x, EmptyValue as S, Input as C, Label as w, Popover as te, PopoverContent as ne, PopoverTrigger as T, Select as E, SelectContent as re, SelectItem as ie, SelectTrigger as ae, SelectValue as oe, Skeleton as D, Slider as O, Switch as k, Table as se, TableBody as ce, TableCell as A, TableHead as le, TableHeader as j, TableRow as M, Textarea as N, cn as P } from "@object-ui/components";
4
+ import { AlertCircle as ue, ArrowDown as F, ArrowUp as de, ArrowUpDown as fe, Camera as pe, Check as I, ChevronLeft as me, ChevronRight as he, Copy as L, Crop as ge, Crosshair as R, Eraser as _e, ExternalLink as z, Eye as B, EyeOff as ve, File as ye, Image as V, ImageIcon as be, Loader2 as xe, MapPin as H, Maximize2 as U, Phone as Se, Plus as Ce, QrCode as W, RotateCw as G, Search as we, SlidersHorizontal as Te, Star as Ee, TableProperties as De, Upload as K, X as Oe } from "lucide-react";
5
+ import { SchemaRendererContext as ke, useObjectTranslation as Ae } from "@object-ui/react";
6
+ import { Fragment as je, jsx as q, jsxs as J } from "react/jsx-runtime";
7
+ import { createSafeTranslation as Me } from "@object-ui/i18n";
8
+ import { useUpload as Ne } from "@object-ui/providers";
9
9
  //#region \0rolldown/runtime.js
10
- var Me = Object.defineProperty, X = (e, t) => () => (e && (t = e(e = 0)), t), Z = (e, t) => {
10
+ var Pe = Object.defineProperty, Y = (e, t) => () => (e && (t = e(e = 0)), t), X = (e, t) => {
11
11
  let n = {};
12
- for (var r in e) Me(n, r, {
12
+ for (var r in e) Pe(n, r, {
13
13
  get: e[r],
14
14
  enumerable: !0
15
15
  });
16
- return t || Me(n, Symbol.toStringTag, { value: "Module" }), n;
17
- }, Ne = /* @__PURE__ */ Z({ TextField: () => Pe });
18
- function Pe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
16
+ return t || Pe(n, Symbol.toStringTag, { value: "Module" }), n;
17
+ }, Fe = /* @__PURE__ */ X({ TextField: () => Ie });
18
+ function Ie({ value: e, onChange: t, field: n, readonly: r, ...i }) {
19
19
  let a = n || i.schema;
20
20
  if (r) return /* @__PURE__ */ q("span", {
21
21
  className: "text-sm",
@@ -37,8 +37,8 @@ function Pe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
37
37
  disabled: r || c.disabled
38
38
  });
39
39
  }
40
- var Fe = X((() => {})), Ie = /* @__PURE__ */ Z({ NumberField: () => Le });
41
- function Le({ value: e, onChange: t, field: n, readonly: r, ...i }) {
40
+ var Le = Y((() => {})), Re = /* @__PURE__ */ X({ NumberField: () => ze });
41
+ function ze({ value: e, onChange: t, field: n, readonly: r, ...i }) {
42
42
  if (r) return e == null ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ q("span", {
43
43
  className: "text-sm",
44
44
  children: e
@@ -57,8 +57,8 @@ function Le({ value: e, onChange: t, field: n, readonly: r, ...i }) {
57
57
  step: o ? 10 ** -o : "any"
58
58
  });
59
59
  }
60
- var Re = X((() => {})), ze = /* @__PURE__ */ Z({ BooleanField: () => Be });
61
- function Be({ value: e, onChange: t, field: n, readonly: r, ...i }) {
60
+ var Be = Y((() => {})), Ve = /* @__PURE__ */ X({ BooleanField: () => Z });
61
+ function Z({ value: e, onChange: t, field: n, readonly: r, ...i }) {
62
62
  let a = n || i.schema, s = a?.widget, c = o(), l = a?.name || c, u = a?.label || "Checkbox";
63
63
  if (r) return /* @__PURE__ */ q("span", {
64
64
  className: "text-sm",
@@ -79,7 +79,7 @@ function Be({ value: e, onChange: t, field: n, readonly: r, ...i }) {
79
79
  })]
80
80
  }) : /* @__PURE__ */ J("div", {
81
81
  className: "flex items-center space-x-2",
82
- children: [/* @__PURE__ */ q(oe, {
82
+ children: [/* @__PURE__ */ q(k, {
83
83
  ...f,
84
84
  id: l,
85
85
  checked: !!e,
@@ -91,16 +91,16 @@ function Be({ value: e, onChange: t, field: n, readonly: r, ...i }) {
91
91
  })]
92
92
  });
93
93
  }
94
- var Ve = X((() => {})), He, Ue, We = X((() => {
95
- He = {
94
+ var He = Y((() => {})), Ue, We, Ge = Y((() => {
95
+ Ue = {
96
96
  "common.selectOption": "Select an option",
97
97
  "common.select": "Select...",
98
98
  "common.search": "Search",
99
99
  "table.selected": "{{count}} selected"
100
- }, Ue = Y(He, "common.selectOption");
101
- })), Ge = /* @__PURE__ */ Z({ SelectField: () => Ke });
102
- function Ke({ value: e, onChange: t, field: n, readonly: r, ...i }) {
103
- let a = n || i.schema, o = a?.options || [], { t: s } = Ue();
100
+ }, We = Me(Ue, "common.selectOption");
101
+ })), Ke = /* @__PURE__ */ X({ SelectField: () => qe });
102
+ function qe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
103
+ let a = n || i.schema, o = a?.options || [], { t: s } = We();
104
104
  if (r) {
105
105
  let t = o.find((t) => t.value === e)?.label || e;
106
106
  return t ? /* @__PURE__ */ q("span", {
@@ -108,28 +108,28 @@ function Ke({ value: e, onChange: t, field: n, readonly: r, ...i }) {
108
108
  children: t
109
109
  }) : /* @__PURE__ */ q(S, {});
110
110
  }
111
- return /* @__PURE__ */ J(D, {
111
+ return /* @__PURE__ */ J(E, {
112
112
  ...i,
113
113
  value: e,
114
114
  onValueChange: t,
115
115
  disabled: r || i.disabled,
116
- children: [/* @__PURE__ */ q(ie, {
116
+ children: [/* @__PURE__ */ q(ae, {
117
117
  className: i.className,
118
118
  id: i.id,
119
- children: /* @__PURE__ */ q(ae, { placeholder: a?.placeholder || s("common.selectOption") })
120
- }), /* @__PURE__ */ q(ne, {
119
+ children: /* @__PURE__ */ q(oe, { placeholder: a?.placeholder || s("common.selectOption") })
120
+ }), /* @__PURE__ */ q(re, {
121
121
  position: "popper",
122
- children: o.map((e) => /* @__PURE__ */ q(re, {
122
+ children: o.map((e) => /* @__PURE__ */ q(ie, {
123
123
  value: e.value,
124
124
  children: e.label
125
125
  }, e.value))
126
126
  })]
127
127
  });
128
128
  }
129
- var qe = X((() => {
130
- We();
131
- })), Je = /* @__PURE__ */ Z({ DateField: () => Ye });
132
- function Ye({ value: e, onChange: t, field: n, readonly: r, ...i }) {
129
+ var Je = Y((() => {
130
+ Ge();
131
+ })), Ye = /* @__PURE__ */ X({ DateField: () => Xe });
132
+ function Xe({ value: e, onChange: t, field: n, readonly: r, ...i }) {
133
133
  if (r) return e ? /* @__PURE__ */ q("span", {
134
134
  className: "text-sm",
135
135
  children: new Date(e).toLocaleDateString()
@@ -143,8 +143,8 @@ function Ye({ value: e, onChange: t, field: n, readonly: r, ...i }) {
143
143
  disabled: r || o.disabled
144
144
  });
145
145
  }
146
- var Xe = X((() => {})), Ze = /* @__PURE__ */ Z({ EmailField: () => Qe });
147
- function Qe({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
146
+ var Ze = Y((() => {})), Qe = /* @__PURE__ */ X({ EmailField: () => $e });
147
+ function $e({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
148
148
  let o = n || a.schema;
149
149
  if (r) return e ? /* @__PURE__ */ q("a", {
150
150
  href: `mailto:${e}`,
@@ -162,8 +162,8 @@ function Qe({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
162
162
  "aria-invalid": !!i
163
163
  });
164
164
  }
165
- var $e = X((() => {})), et = /* @__PURE__ */ Z({ PhoneField: () => tt });
166
- function tt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
165
+ var et = Y((() => {})), tt = /* @__PURE__ */ X({ PhoneField: () => nt });
166
+ function nt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
167
167
  let o = n || a.schema;
168
168
  if (r) return e ? /* @__PURE__ */ q("a", {
169
169
  href: `tel:${e}`,
@@ -181,8 +181,8 @@ function tt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
181
181
  "aria-invalid": !!i
182
182
  });
183
183
  }
184
- var nt = X((() => {})), rt = /* @__PURE__ */ Z({ UrlField: () => it });
185
- function it({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
184
+ var rt = Y((() => {})), it = /* @__PURE__ */ X({ UrlField: () => at });
185
+ function at({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
186
186
  let o = n || a.schema;
187
187
  if (r) return e ? e.startsWith("http://") || e.startsWith("https://") ? /* @__PURE__ */ q("a", {
188
188
  href: e,
@@ -205,32 +205,42 @@ function it({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
205
205
  "aria-invalid": !!i
206
206
  });
207
207
  }
208
- var at = X((() => {})), ot = /* @__PURE__ */ Z({ CurrencyField: () => ct });
209
- function st(e, t = "USD") {
210
- try {
208
+ var ot = Y((() => {})), st = /* @__PURE__ */ X({ CurrencyField: () => lt });
209
+ function ct(e, t, n) {
210
+ if (t) try {
211
211
  return new Intl.NumberFormat("en-US", {
212
212
  style: "currency",
213
- currency: t
213
+ currency: t,
214
+ minimumFractionDigits: n,
215
+ maximumFractionDigits: n
214
216
  }).format(e);
215
217
  } catch {
216
- return `${t} ${e.toFixed(2)}`;
218
+ return `${t} ${e.toFixed(n)}`;
219
+ }
220
+ try {
221
+ return new Intl.NumberFormat("en-US", {
222
+ minimumFractionDigits: n,
223
+ maximumFractionDigits: n
224
+ }).format(e);
225
+ } catch {
226
+ return e.toFixed(n);
217
227
  }
218
228
  }
219
- function ct({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
220
- let s = n || o.schema, c = s?.currency || "USD", l = s?.precision ?? 2;
229
+ function lt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
230
+ let s = n || o.schema, c = s?.currency, l = s?.precision ?? 2;
221
231
  if (r) return e == null ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ q("span", {
222
232
  className: "text-sm font-medium tabular-nums",
223
- children: st(Number(e), c)
233
+ children: ct(Number(e), c, l)
224
234
  });
225
235
  let u = (e) => {
226
236
  let n = parseFloat(e.target.value);
227
237
  isNaN(n) || t(parseFloat(n.toFixed(l)));
228
- };
238
+ }, d = c ? c === "USD" ? "$" : c : "";
229
239
  return /* @__PURE__ */ J("div", {
230
240
  className: "relative",
231
- children: [/* @__PURE__ */ q("span", {
241
+ children: [d && /* @__PURE__ */ q("span", {
232
242
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
233
- children: c === "USD" ? "$" : c
243
+ children: d
234
244
  }), /* @__PURE__ */ q(C, {
235
245
  ...o,
236
246
  type: "number",
@@ -241,14 +251,14 @@ function ct({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
241
251
  onBlur: u,
242
252
  placeholder: s?.placeholder || "0.00",
243
253
  disabled: r || o.disabled,
244
- className: `pl-8 ${a || ""}`,
254
+ className: `${d ? "pl-8" : ""} ${a || ""}`,
245
255
  step: (10 ** -l).toFixed(l),
246
256
  "aria-invalid": !!i
247
257
  })]
248
258
  });
249
259
  }
250
- var lt = X((() => {})), ut = /* @__PURE__ */ Z({ TextAreaField: () => dt });
251
- function dt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
260
+ var ut = Y((() => {})), dt = /* @__PURE__ */ X({ TextAreaField: () => ft });
261
+ function ft({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
252
262
  if (r) return /* @__PURE__ */ q("div", {
253
263
  className: "text-sm whitespace-pre-wrap",
254
264
  children: e || /* @__PURE__ */ q(S, {})
@@ -257,20 +267,20 @@ function dt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
257
267
  m(e ?? ""), f(!0);
258
268
  }, y = () => f(!1), C = () => {
259
269
  t(p), f(!1);
260
- }, { inputType: w, mobileFullscreen: T, ...E } = a;
270
+ }, { inputType: w, mobileFullscreen: te, ...ne } = a;
261
271
  return /* @__PURE__ */ J("div", {
262
272
  className: "relative",
263
273
  children: [
264
274
  /* @__PURE__ */ q(N, {
265
- ...E,
275
+ ...ne,
266
276
  value: e || "",
267
277
  onChange: (e) => t(e.target.value),
268
278
  placeholder: o?.placeholder,
269
- disabled: r || E.disabled,
279
+ disabled: r || ne.disabled,
270
280
  rows: s,
271
281
  maxLength: c,
272
282
  "aria-invalid": !!i,
273
- className: E.className
283
+ className: ne.className
274
284
  }),
275
285
  u && /* @__PURE__ */ q("button", {
276
286
  type: "button",
@@ -278,7 +288,7 @@ function dt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
278
288
  className: "absolute top-1.5 right-1.5 inline-flex items-center justify-center size-7 rounded-md bg-background/80 text-muted-foreground hover:text-foreground hover:bg-background border shadow-sm transition-colors",
279
289
  "aria-label": `Edit ${o?.label ?? "text"} fullscreen`,
280
290
  "data-testid": "textarea-fullscreen-toggle",
281
- children: /* @__PURE__ */ q(W, { className: "size-3.5" })
291
+ children: /* @__PURE__ */ q(U, { className: "size-3.5" })
282
292
  }),
283
293
  c && /* @__PURE__ */ J("div", {
284
294
  className: "absolute bottom-2 right-2 text-xs text-gray-400",
@@ -346,8 +356,8 @@ function dt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
346
356
  ]
347
357
  });
348
358
  }
349
- var ft = X((() => {})), pt = /* @__PURE__ */ Z({ RichTextField: () => mt });
350
- function mt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
359
+ var pt = Y((() => {})), mt = /* @__PURE__ */ X({ RichTextField: () => ht });
360
+ function ht({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...a }) {
351
361
  if (r) return /* @__PURE__ */ q("div", {
352
362
  className: "text-sm prose prose-sm max-w-none",
353
363
  children: e || /* @__PURE__ */ q(S, {})
@@ -372,16 +382,16 @@ function mt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, ...
372
382
  })]
373
383
  });
374
384
  }
375
- var ht = X((() => {}));
385
+ var gt = Y((() => {}));
376
386
  //#endregion
377
387
  //#region src/widgets/RecordPickerDialog.tsx
378
- function gt(e) {
388
+ function _t(e) {
379
389
  return typeof e == "string" ? { field: e } : e;
380
390
  }
381
- function _t(e) {
391
+ function vt(e) {
382
392
  return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
383
393
  }
384
- function vt(e) {
394
+ function yt(e) {
385
395
  let t = {};
386
396
  for (let n of e) switch (n.operator) {
387
397
  case "eq":
@@ -414,7 +424,7 @@ function vt(e) {
414
424
  }
415
425
  return t;
416
426
  }
417
- function yt(e, t) {
427
+ function bt(e, t) {
418
428
  let n = {};
419
429
  for (let r of t) {
420
430
  let t = e[r.field];
@@ -422,17 +432,17 @@ function yt(e, t) {
422
432
  }
423
433
  return n;
424
434
  }
425
- function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i = !1, dataSource: o, objectName: u, columns: d, displayField: f = "name", idField: p = "id", pageSize: m = xt, value: y, onSelect: S, onSelectRecords: T, lookupFilters: E, cellRenderer: te, filterColumns: k, renderFilterBar: oe, renderGrid: N }) {
426
- let [F, L] = l([]), [ge, R] = l(!1), [z, B] = l(null), [V, _e] = l(0), [ve, ye] = l(""), [H, U] = l(1), W = c(null), [xe, Se] = l(null), [G, K] = l("asc"), [Te, Ee] = l(/* @__PURE__ */ new Set()), De = c(/* @__PURE__ */ new Map()), [Y, Ae] = l(-1), je = c(null), [Me, X] = l(!1), [Z, Ne] = l({}), [Pe, Fe] = l({}), Ie = c(null), [Le, Re] = l(""), ze = s(() => d && d.length > 0 ? d.map(gt) : [{
435
+ function xt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i = !1, dataSource: o, objectName: u, columns: d, displayField: f = "name", titleFormat: p, idField: m = "id", pageSize: y = St, value: S, onSelect: te, onSelectRecords: ne, lookupFilters: T, cellRenderer: O, filterColumns: k, renderFilterBar: N, renderGrid: pe }) {
436
+ let [L, ge] = l([]), [R, _e] = l(!1), [z, B] = l(null), [ve, ye] = l(0), [V, be] = l(""), [H, U] = l(1), Se = c(null), [Ce, W] = l(null), [G, Ee] = l("asc"), [De, K] = l(/* @__PURE__ */ new Set()), ke = c(/* @__PURE__ */ new Map()), [Ae, Me] = l(-1), Ne = c(null), [Pe, Y] = l(!1), [X, Fe] = l({}), [Ie, Le] = l({}), Re = c(null), [ze, Be] = l(""), Ve = s(() => d && d.length > 0 ? d.map(_t) : [{
427
437
  field: f,
428
- label: _t(f)
429
- }], [d, f]), Be = s(() => {
438
+ label: vt(f)
439
+ }], [d, f]), Z = s(() => {
430
440
  if (k && k.length > 0) return k;
431
- if (E && E.length > 0) return E.map((e) => {
441
+ if (T && T.length > 0) return T.map((e) => {
432
442
  let t = "text";
433
443
  return typeof e.value == "boolean" ? t = "boolean" : Array.isArray(e.value) ? t = "select" : typeof e.value == "number" || e.operator === "gt" || e.operator === "lt" || e.operator === "gte" || e.operator === "lte" ? t = "number" : (e.operator === "in" || e.operator === "notIn") && (t = "select"), {
434
444
  field: e.field,
435
- label: _t(e.field),
445
+ label: vt(e.field),
436
446
  type: t,
437
447
  ...Array.isArray(e.value) ? { options: e.value.map((e) => {
438
448
  if (typeof e == "object" && e) {
@@ -449,125 +459,135 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
449
459
  }) } : {}
450
460
  };
451
461
  });
452
- }, [k, E]), Ve = s(() => {
453
- let e = E?.length ? vt(E) : {}, t = Be?.length ? yt(Z, Be) : {}, n = {
462
+ }, [k, T]), He = s(() => {
463
+ let e = T?.length ? yt(T) : {}, t = Z?.length ? bt(X, Z) : {}, n = {
454
464
  ...e,
455
465
  ...t
456
466
  };
457
467
  return Object.keys(n).length > 0 ? n : void 0;
458
468
  }, [
459
- E,
460
- Be,
461
- Z
462
- ]), He = Math.max(1, Math.ceil(V / m)), Ue = r(async (e, t = 1, n, r) => {
469
+ T,
470
+ Z,
471
+ X
472
+ ]), Ue = Math.max(1, Math.ceil(ve / y)), We = r(async (e, t = 1, n, r) => {
463
473
  if (!(!o || !u)) {
464
- R(!0), B(null);
474
+ _e(!0), B(null);
465
475
  try {
466
476
  let i = {
467
- $top: m,
468
- $skip: (t - 1) * m
477
+ $top: y,
478
+ $skip: (t - 1) * y
469
479
  };
470
480
  e && e.trim() && (i.$search = e.trim()), n && (i.$orderby = { [n.field]: n.direction });
471
- let a = r === void 0 ? Ve : r;
481
+ let a = r === void 0 ? He : r;
472
482
  a && Object.keys(a).length > 0 && (i.$filter = a);
473
483
  let s = await o.find(u, i), c = s?.data ?? s ?? [];
474
- L(c), _e(s?.total ?? c.length), Ae(-1);
484
+ ge(c), ye(s?.total ?? c.length), Me(-1);
475
485
  } catch (e) {
476
- B(e instanceof Error ? e.message : String(e)), L([]);
486
+ B(e instanceof Error ? e.message : String(e)), ge([]);
477
487
  } finally {
478
- R(!1);
488
+ _e(!1);
479
489
  }
480
490
  }
481
491
  }, [
482
492
  o,
483
493
  u,
484
- m,
485
- Ve
486
- ]), We = s(() => xe ? {
487
- field: xe,
494
+ y,
495
+ He
496
+ ]), Ge = s(() => Ce ? {
497
+ field: Ce,
488
498
  direction: G
489
- } : null, [xe, G]);
499
+ } : null, [Ce, G]);
490
500
  a(() => {
491
- e || (ye(""), U(1), B(null), L([]), Se(null), K("asc"), Ae(-1), X(!1), Ne({}), Fe({}), Re(""), Ee(new Set(i && Array.isArray(y) ? y : [])), De.current.clear());
501
+ e || (be(""), U(1), B(null), ge([]), W(null), Ee("asc"), Me(-1), Y(!1), Fe({}), Le({}), Be(""), K(new Set(i && Array.isArray(S) ? S : [])), ke.current.clear());
492
502
  }, [e]), a(() => {
493
- e && Ue(ve || void 0, H, We);
503
+ e && We(V || void 0, H, Ge);
494
504
  }, [
495
505
  e,
496
506
  H,
497
- We,
498
- Ve
507
+ Ge,
508
+ He
499
509
  ]), a(() => {
500
- e && i && Ee(new Set(Array.isArray(y) ? y : []));
510
+ e && i && K(new Set(Array.isArray(S) ? S : []));
501
511
  }, [
502
512
  e,
503
513
  i,
504
- y
514
+ S
505
515
  ]);
506
- let Ge = r((e) => {
507
- ye(e), U(1), W.current && clearTimeout(W.current), W.current = setTimeout(() => {
508
- Ue(e || void 0, 1, We);
516
+ let Ke = r((e) => {
517
+ be(e), U(1), Se.current && clearTimeout(Se.current), Se.current = setTimeout(() => {
518
+ We(e || void 0, 1, Ge);
509
519
  }, 300);
510
- }, [Ue, We]);
520
+ }, [We, Ge]);
511
521
  a(() => () => {
512
- W.current && clearTimeout(W.current);
522
+ Se.current && clearTimeout(Se.current);
513
523
  }, []);
514
- let Ke = r((e) => {
515
- Se((t) => t === e ? (K((e) => e === "asc" ? "desc" : "asc"), e) : (K("asc"), e)), U(1);
516
- }, []), qe = r((e) => e[p] ?? e.id ?? e._id, [p]), Je = r((e) => {
517
- let t = qe(e);
518
- return i ? Te.has(t) : y === t;
524
+ let qe = r((e) => {
525
+ W((t) => t === e ? (Ee((e) => e === "asc" ? "desc" : "asc"), e) : (Ee("asc"), e)), U(1);
526
+ }, []), Je = r((e) => e[m] ?? e.id ?? e._id, [m]), Ye = r((e) => {
527
+ let t = Je(e);
528
+ return i ? De.has(t) : S === t;
519
529
  }, [
520
530
  i,
521
- y,
522
- Te,
523
- qe
524
- ]), Ye = r((e) => {
525
- let n = qe(e);
526
- i ? Ee((t) => {
531
+ S,
532
+ De,
533
+ Je
534
+ ]), Xe = r((e) => {
535
+ let n = Je(e);
536
+ i ? K((t) => {
527
537
  let r = new Set(t);
528
- return r.has(n) ? (r.delete(n), De.current.delete(n)) : (r.add(n), De.current.set(n, e)), r;
529
- }) : (S(n), T?.([e]), t(!1));
538
+ return r.has(n) ? (r.delete(n), ke.current.delete(n)) : (r.add(n), ke.current.set(n, e)), r;
539
+ }) : (te(n), ne?.([e]), t(!1));
530
540
  }, [
531
541
  i,
532
- qe,
533
- S,
534
- T,
542
+ Je,
543
+ te,
544
+ ne,
535
545
  t
536
- ]), Xe = r(() => {
537
- let e = Array.from(Te);
538
- S(e);
539
- let n = e.map((e) => De.current.get(e)).filter(Boolean);
540
- T?.(n), t(!1);
546
+ ]), Ze = r(() => {
547
+ let e = Array.from(De);
548
+ te(e);
549
+ let n = e.map((e) => ke.current.get(e)).filter(Boolean);
550
+ ne?.(n), t(!1);
541
551
  }, [
542
- Te,
543
- S,
544
- T,
552
+ De,
553
+ te,
554
+ ne,
545
555
  t
546
- ]), Ze = r(() => {
556
+ ]), Qe = r(() => {
547
557
  U((e) => Math.max(1, e - 1));
548
- }, []), Qe = r(() => {
549
- U((e) => Math.min(He, e + 1));
550
- }, [He]), $e = r((e) => {
558
+ }, []), $e = r(() => {
559
+ U((e) => Math.min(Ue, e + 1));
560
+ }, [Ue]), et = r((e) => {
551
561
  if (e.key !== "Enter") return;
552
- let t = parseInt(Le, 10);
553
- !isNaN(t) && t >= 1 && t <= He && U(t), Re("");
554
- }, [Le, He]), et = r((e) => {
555
- F.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Ae((e) => Math.min(e + 1, F.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Ae((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Y >= 0 && Y < F.length && Ye(F[Y])));
562
+ let t = parseInt(ze, 10);
563
+ !isNaN(t) && t >= 1 && t <= Ue && U(t), Be("");
564
+ }, [ze, Ue]), tt = r((e) => {
565
+ L.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Me((e) => Math.min(e + 1, L.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Me((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Ae >= 0 && Ae < L.length && Xe(L[Ae])));
556
566
  }, [
557
- F,
558
- Y,
559
- Ye
567
+ L,
568
+ Ae,
569
+ Xe
560
570
  ]);
561
571
  a(() => {
562
- if (Y >= 0 && je.current) {
563
- let e = je.current.querySelector(`[data-row-index="${Y}"]`);
572
+ if (Ae >= 0 && Ne.current) {
573
+ let e = Ne.current.querySelector(`[data-row-index="${Ae}"]`);
564
574
  e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
565
575
  }
566
- }, [Y]);
567
- let tt = r((e, t) => {
576
+ }, [Ae]);
577
+ let nt = r((e, t) => {
578
+ if (p && t.field === f) {
579
+ let t = "[-\\u2013\\u2014|/·,:]", n = !1, r = p.replace(/\{([^{}]+)\}/g, (t, r) => {
580
+ let i = e[r.trim()];
581
+ return i != null && i !== "" ? (n = !0, String(i)) : "\0";
582
+ });
583
+ if (n) {
584
+ let e = r.replace(RegExp(`\\s*${t}\\s*`, "g"), "").replace(RegExp(`\\s*${t}\\s*`, "g"), "").replace(RegExp("\0", "g"), "").replace(/\s+/g, " ").trim();
585
+ if (e) return e;
586
+ }
587
+ }
568
588
  let n = e[t.field];
569
- if (t.type && te) {
570
- let e = te(t.type);
589
+ if (t.type && O) {
590
+ let e = O(t.type);
571
591
  if (e) return /* @__PURE__ */ q(e, {
572
592
  value: n,
573
593
  field: {
@@ -577,45 +597,49 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
577
597
  });
578
598
  }
579
599
  return n == null ? "" : typeof n == "object" ? n.$numberDecimal ? String(Number(n.$numberDecimal)) : n.$oid ? String(n.$oid) : n.$date ? new Date(n.$date).toLocaleDateString() : n.name || n.label ? String(n.name || n.label) : JSON.stringify(n) : typeof n == "boolean" ? n ? "Yes" : "No" : String(n);
580
- }, [te]), nt = r((e) => xe === e ? q(G === "asc" ? fe : de, { className: "ml-1 size-3" }) : /* @__PURE__ */ q(pe, { className: "ml-1 size-3 opacity-40" }), [xe, G]), rt = r((e, t, n) => {
581
- e.preventDefault(), e.stopPropagation(), Ie.current = {
600
+ }, [
601
+ O,
602
+ p,
603
+ f
604
+ ]), rt = r((e) => Ce === e ? q(G === "asc" ? de : F, { className: "ml-1 size-3" }) : /* @__PURE__ */ q(fe, { className: "ml-1 size-3 opacity-40" }), [Ce, G]), it = r((e, t, n) => {
605
+ e.preventDefault(), e.stopPropagation(), Re.current = {
582
606
  field: t,
583
607
  startX: e.clientX,
584
608
  startWidth: n
585
609
  };
586
610
  let r = (e) => {
587
- if (!Ie.current) return;
588
- let t = e.clientX - Ie.current.startX, n = Math.max(St, Ie.current.startWidth + t);
589
- Fe((e) => ({
611
+ if (!Re.current) return;
612
+ let t = e.clientX - Re.current.startX, n = Math.max(Ct, Re.current.startWidth + t);
613
+ Le((e) => ({
590
614
  ...e,
591
- [Ie.current.field]: n
615
+ [Re.current.field]: n
592
616
  }));
593
617
  }, i = () => {
594
- Ie.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
618
+ Re.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
595
619
  };
596
620
  document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
597
- }, []), it = r((e, t) => {
598
- Ne((n) => ({
621
+ }, []), at = r((e, t) => {
622
+ Fe((n) => ({
599
623
  ...n,
600
624
  [e]: t
601
625
  })), U(1);
602
- }, []), at = r(() => {
603
- Ne({}), U(1);
604
- }, []), ot = s(() => Object.values(Z).filter((e) => e != null && e !== "").length, [Z]), st = r((e) => {
605
- let t = Z[e.field], n = e.label || _t(e.field);
626
+ }, []), ot = r(() => {
627
+ Fe({}), U(1);
628
+ }, []), st = s(() => Object.values(X).filter((e) => e != null && e !== "").length, [X]), ct = r((e) => {
629
+ let t = X[e.field], n = e.label || vt(e.field);
606
630
  switch (e.type) {
607
631
  case "select": return /* @__PURE__ */ J("div", {
608
632
  className: "space-y-1",
609
633
  children: [/* @__PURE__ */ q(w, {
610
634
  className: "text-xs text-muted-foreground",
611
635
  children: n
612
- }), /* @__PURE__ */ J(D, {
636
+ }), /* @__PURE__ */ J(E, {
613
637
  value: t == null ? "" : String(t),
614
- onValueChange: (t) => it(e.field, t),
615
- children: [/* @__PURE__ */ q(ie, {
638
+ onValueChange: (t) => at(e.field, t),
639
+ children: [/* @__PURE__ */ q(ae, {
616
640
  className: "h-8 text-xs",
617
- children: /* @__PURE__ */ q(ae, { placeholder: `Filter ${n}` })
618
- }), /* @__PURE__ */ q(ne, { children: e.options?.map((e) => /* @__PURE__ */ q(re, {
641
+ children: /* @__PURE__ */ q(oe, { placeholder: `Filter ${n}` })
642
+ }), /* @__PURE__ */ q(re, { children: e.options?.map((e) => /* @__PURE__ */ q(ie, {
619
643
  value: String(e.value),
620
644
  children: e.label
621
645
  }, String(e.value))) })]
@@ -633,7 +657,7 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
633
657
  placeholder: `Filter ${n}`,
634
658
  onChange: (t) => {
635
659
  let n = t.target.value;
636
- it(e.field, n === "" ? "" : Number(n));
660
+ at(e.field, n === "" ? "" : Number(n));
637
661
  }
638
662
  })]
639
663
  });
@@ -646,7 +670,7 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
646
670
  type: "date",
647
671
  className: "h-8 text-xs",
648
672
  value: t ?? "",
649
- onChange: (t) => it(e.field, t.target.value)
673
+ onChange: (t) => at(e.field, t.target.value)
650
674
  })]
651
675
  });
652
676
  case "boolean": return /* @__PURE__ */ J("div", {
@@ -658,7 +682,7 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
658
682
  className: "flex items-center gap-2 h-8",
659
683
  children: [/* @__PURE__ */ q(g, {
660
684
  checked: !!t,
661
- onCheckedChange: (t) => it(e.field, !!t)
685
+ onCheckedChange: (t) => at(e.field, !!t)
662
686
  }), /* @__PURE__ */ q("span", {
663
687
  className: "text-xs text-muted-foreground",
664
688
  children: "Yes"
@@ -674,11 +698,11 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
674
698
  className: "h-8 text-xs",
675
699
  value: t ?? "",
676
700
  placeholder: `Filter ${n}`,
677
- onChange: (t) => it(e.field, t.target.value)
701
+ onChange: (t) => at(e.field, t.target.value)
678
702
  })]
679
703
  });
680
704
  }
681
- }, [Z, it]), ct = r((e, t) => e ? "bg-primary/5 hover:bg-primary/10" : t % 2 == 1 ? "bg-muted/20 hover:bg-accent/30" : "hover:bg-accent/30", []);
705
+ }, [X, at]), lt = r((e, t) => e ? "bg-primary/5 hover:bg-primary/10" : t % 2 == 1 ? "bg-muted/20 hover:bg-accent/30" : "hover:bg-accent/30", []);
682
706
  return /* @__PURE__ */ q(_, {
683
707
  open: e,
684
708
  onOpenChange: t,
@@ -693,60 +717,60 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
693
717
  /* @__PURE__ */ J("div", {
694
718
  className: "relative rounded-md border bg-muted/30 mb-3",
695
719
  children: [
696
- /* @__PURE__ */ q(Ce, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
720
+ /* @__PURE__ */ q(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
697
721
  /* @__PURE__ */ q(C, {
698
722
  placeholder: "Search...",
699
- value: ve,
700
- onChange: (e) => Ge(e.target.value),
723
+ value: V,
724
+ onChange: (e) => Ke(e.target.value),
701
725
  className: "pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0",
702
726
  "data-testid": "record-picker-search"
703
727
  }),
704
- ge && /* @__PURE__ */ q(be, {
728
+ R && /* @__PURE__ */ q(xe, {
705
729
  className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
706
730
  "data-testid": "record-picker-loading-indicator"
707
731
  })
708
732
  ]
709
733
  }),
710
- Be && Be.length > 0 && /* @__PURE__ */ q("div", {
734
+ Z && Z.length > 0 && /* @__PURE__ */ q("div", {
711
735
  className: "py-2",
712
- children: oe ? /* @__PURE__ */ q("div", {
736
+ children: N ? /* @__PURE__ */ q("div", {
713
737
  "data-testid": "record-picker-filter-bar",
714
- children: oe({
715
- filterColumns: Be,
716
- values: Z,
717
- onChange: it,
718
- onClear: at,
719
- activeCount: ot
738
+ children: N({
739
+ filterColumns: Z,
740
+ values: X,
741
+ onChange: at,
742
+ onClear: ot,
743
+ activeCount: st
720
744
  })
721
- }) : /* @__PURE__ */ J(ke, { children: [/* @__PURE__ */ J("div", {
745
+ }) : /* @__PURE__ */ J(je, { children: [/* @__PURE__ */ J("div", {
722
746
  className: "flex items-center gap-2",
723
747
  "data-testid": "record-picker-filter-bar",
724
748
  children: [/* @__PURE__ */ J(h, {
725
749
  type: "button",
726
- variant: ot > 0 ? "secondary" : "outline",
750
+ variant: st > 0 ? "secondary" : "outline",
727
751
  size: "sm",
728
752
  className: "gap-1.5 shrink-0",
729
- onClick: () => X((e) => !e),
753
+ onClick: () => Y((e) => !e),
730
754
  children: [
731
- /* @__PURE__ */ q(we, { className: "size-3.5" }),
755
+ /* @__PURE__ */ q(Te, { className: "size-3.5" }),
732
756
  "Filters",
733
- ot > 0 && /* @__PURE__ */ q("span", {
757
+ st > 0 && /* @__PURE__ */ q("span", {
734
758
  className: "inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary",
735
- children: ot
759
+ children: st
736
760
  })
737
761
  ]
738
- }), ot > 0 && /* @__PURE__ */ J(h, {
762
+ }), st > 0 && /* @__PURE__ */ J(h, {
739
763
  type: "button",
740
764
  variant: "ghost",
741
765
  size: "sm",
742
766
  className: "gap-1 text-xs",
743
- onClick: at,
767
+ onClick: ot,
744
768
  children: [/* @__PURE__ */ q(Oe, { className: "size-3" }), "Clear"]
745
769
  })]
746
- }), Me && /* @__PURE__ */ q("div", {
770
+ }), Pe && /* @__PURE__ */ q("div", {
747
771
  className: "mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30",
748
772
  "data-testid": "record-picker-filter-panel",
749
- children: Be.map((e) => /* @__PURE__ */ q("div", { children: st(e) }, e.field))
773
+ children: Z.map((e) => /* @__PURE__ */ q("div", { children: ct(e) }, e.field))
750
774
  })] })
751
775
  }),
752
776
  z && /* @__PURE__ */ J("div", {
@@ -761,88 +785,88 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
761
785
  /* @__PURE__ */ q(h, {
762
786
  variant: "outline",
763
787
  size: "sm",
764
- onClick: () => Ue(ve || void 0, H, We),
788
+ onClick: () => We(V || void 0, H, Ge),
765
789
  type: "button",
766
790
  children: "Retry"
767
791
  })
768
792
  ]
769
793
  }),
770
- N ? /* @__PURE__ */ q("div", {
794
+ pe ? /* @__PURE__ */ q("div", {
771
795
  className: "flex-1 min-h-0",
772
796
  "data-testid": "record-picker-grid-slot",
773
- children: N({
774
- columns: ze,
775
- records: F,
776
- loading: ge,
777
- totalCount: V,
797
+ children: pe({
798
+ columns: Ve,
799
+ records: L,
800
+ loading: R,
801
+ totalCount: ve,
778
802
  currentPage: H,
779
- pageSize: m,
780
- sortField: xe,
803
+ pageSize: y,
804
+ sortField: Ce,
781
805
  sortDirection: G,
782
- onSort: Ke,
806
+ onSort: qe,
783
807
  onPageChange: U,
784
- onRowClick: Ye,
785
- isSelected: Je,
808
+ onRowClick: Xe,
809
+ isSelected: Ye,
786
810
  multiple: i,
787
- idField: p,
788
- cellRenderer: te
811
+ idField: m,
812
+ cellRenderer: O
789
813
  })
790
- }) : /* @__PURE__ */ J(ke, { children: [
791
- ge && F.length === 0 && !z && /* @__PURE__ */ q("div", {
814
+ }) : /* @__PURE__ */ J(je, { children: [
815
+ R && L.length === 0 && !z && /* @__PURE__ */ q("div", {
792
816
  className: "flex-1 overflow-hidden min-h-0 border rounded-md",
793
817
  role: "status",
794
818
  "aria-live": "polite",
795
819
  "data-testid": "record-picker-skeleton",
796
820
  children: /* @__PURE__ */ J(se, { children: [/* @__PURE__ */ q(j, { children: /* @__PURE__ */ J(M, {
797
821
  className: "bg-muted/40",
798
- children: [i && /* @__PURE__ */ q(le, { className: "w-10" }), ze.map((e) => /* @__PURE__ */ q(le, { children: /* @__PURE__ */ q(O, { className: "h-4 w-20" }) }, e.field))]
799
- }) }), /* @__PURE__ */ q(ce, { children: Array.from({ length: Ct }, (e, t) => /* @__PURE__ */ J(M, { children: [i && /* @__PURE__ */ q(A, {
822
+ children: [i && /* @__PURE__ */ q(le, { className: "w-10" }), Ve.map((e) => /* @__PURE__ */ q(le, { children: /* @__PURE__ */ q(D, { className: "h-4 w-20" }) }, e.field))]
823
+ }) }), /* @__PURE__ */ q(ce, { children: Array.from({ length: wt }, (e, t) => /* @__PURE__ */ J(M, { children: [i && /* @__PURE__ */ q(A, {
800
824
  className: "w-10",
801
- children: /* @__PURE__ */ q(O, { className: "size-4 rounded" })
802
- }), ze.map((e) => /* @__PURE__ */ q(A, { children: /* @__PURE__ */ q(O, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
825
+ children: /* @__PURE__ */ q(D, { className: "size-4 rounded" })
826
+ }), Ve.map((e) => /* @__PURE__ */ q(A, { children: /* @__PURE__ */ q(D, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
803
827
  }),
804
- !ge && !z && F.length === 0 && /* @__PURE__ */ q("div", {
828
+ !R && !z && L.length === 0 && /* @__PURE__ */ q("div", {
805
829
  className: "py-8 text-center",
806
830
  children: /* @__PURE__ */ q("p", {
807
831
  className: "text-sm text-muted-foreground",
808
832
  children: "No records found"
809
833
  })
810
834
  }),
811
- !z && F.length > 0 && /* @__PURE__ */ J("div", {
835
+ !z && L.length > 0 && /* @__PURE__ */ J("div", {
812
836
  className: "relative flex-1 overflow-auto min-h-0 border rounded-md",
813
837
  tabIndex: 0,
814
- onKeyDown: et,
838
+ onKeyDown: tt,
815
839
  role: "grid",
816
840
  "aria-label": "Records",
817
- children: [ge && /* @__PURE__ */ q("div", {
841
+ children: [R && /* @__PURE__ */ q("div", {
818
842
  className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60",
819
843
  "data-testid": "record-picker-loading-overlay",
820
- children: /* @__PURE__ */ q(be, { className: "size-6 animate-spin text-muted-foreground" })
844
+ children: /* @__PURE__ */ q(xe, { className: "size-6 animate-spin text-muted-foreground" })
821
845
  }), /* @__PURE__ */ J(se, {
822
- style: Object.keys(Pe).length > 0 ? { tableLayout: "fixed" } : void 0,
846
+ style: Object.keys(Ie).length > 0 ? { tableLayout: "fixed" } : void 0,
823
847
  children: [/* @__PURE__ */ q(j, {
824
848
  className: "sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b",
825
849
  "data-testid": "record-picker-sticky-header",
826
- children: /* @__PURE__ */ J(M, { children: [i && /* @__PURE__ */ q(le, { className: "w-10" }), ze.map((e) => {
827
- let t = Pe[e.field];
850
+ children: /* @__PURE__ */ J(M, { children: [i && /* @__PURE__ */ q(le, { className: "w-10" }), Ve.map((e) => {
851
+ let t = Ie[e.field];
828
852
  return /* @__PURE__ */ J(le, {
829
853
  style: t ? {
830
854
  width: `${t}px`,
831
855
  minWidth: `${t}px`
832
856
  } : e.width ? { width: e.width } : void 0,
833
857
  className: "cursor-pointer select-none relative group text-xs font-semibold uppercase tracking-wider",
834
- onClick: () => Ke(e.field),
835
- "aria-sort": xe === e.field ? G === "asc" ? "ascending" : "descending" : "none",
858
+ onClick: () => qe(e.field),
859
+ "aria-sort": Ce === e.field ? G === "asc" ? "ascending" : "descending" : "none",
836
860
  children: [/* @__PURE__ */ J("span", {
837
861
  className: "inline-flex items-center",
838
- children: [e.label || _t(e.field), nt(e.field)]
862
+ children: [e.label || vt(e.field), rt(e.field)]
839
863
  }), /* @__PURE__ */ q("span", {
840
864
  role: "separator",
841
865
  "aria-orientation": "vertical",
842
866
  className: "absolute right-0 top-0 bottom-0 w-1 cursor-col-resize opacity-0 group-hover:opacity-100 bg-border hover:bg-primary/50 transition-opacity",
843
867
  onMouseDown: (t) => {
844
868
  let n = t.currentTarget.parentElement?.getBoundingClientRect();
845
- rt(t, e.field, n?.width ?? 100);
869
+ it(t, e.field, n?.width ?? 100);
846
870
  },
847
871
  onClick: (e) => e.stopPropagation(),
848
872
  "data-testid": `resize-handle-${e.field}`
@@ -850,43 +874,43 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
850
874
  }, e.field);
851
875
  })] })
852
876
  }), /* @__PURE__ */ q(ce, {
853
- ref: je,
854
- children: F.map((e, t) => {
855
- let n = qe(e), r = Je(e), a = t === Y;
877
+ ref: Ne,
878
+ children: L.map((e, t) => {
879
+ let n = Je(e), r = Ye(e), a = t === Ae;
856
880
  return /* @__PURE__ */ J(M, {
857
881
  "data-row-index": t,
858
- className: P("cursor-pointer transition-colors", ct(r, t), a && "ring-2 ring-primary ring-inset"),
859
- onClick: () => Ye(e),
882
+ className: P("cursor-pointer transition-colors", lt(r, t), a && "ring-2 ring-primary ring-inset"),
883
+ onClick: () => Xe(e),
860
884
  "data-testid": `record-row-${n}`,
861
885
  "aria-selected": r,
862
886
  children: [i && /* @__PURE__ */ q(A, {
863
887
  className: "w-10",
864
888
  children: r && /* @__PURE__ */ q(I, { className: "size-4 text-primary" })
865
- }), ze.map((t) => /* @__PURE__ */ q(A, {
889
+ }), Ve.map((t) => /* @__PURE__ */ q(A, {
866
890
  className: "py-2.5",
867
- children: tt(e, t)
891
+ children: nt(e, t)
868
892
  }, t.field))]
869
893
  }, n ?? t);
870
894
  })
871
895
  })]
872
896
  })]
873
897
  }),
874
- !z && V > 0 && /* @__PURE__ */ J("div", {
898
+ !z && ve > 0 && /* @__PURE__ */ J("div", {
875
899
  className: "flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1",
876
900
  "data-testid": "record-picker-pagination",
877
901
  children: [/* @__PURE__ */ J("span", { children: [
878
- V,
902
+ ve,
879
903
  " ",
880
- V === 1 ? "record" : "records",
881
- He > 1 && ` · Page ${H} of ${He}`
882
- ] }), He > 1 && /* @__PURE__ */ J("div", {
904
+ ve === 1 ? "record" : "records",
905
+ Ue > 1 && ` · Page ${H} of ${Ue}`
906
+ ] }), Ue > 1 && /* @__PURE__ */ J("div", {
883
907
  className: "flex items-center gap-1.5",
884
908
  children: [
885
909
  /* @__PURE__ */ q(h, {
886
910
  variant: "outline",
887
911
  size: "icon",
888
912
  className: "size-7",
889
- onClick: Ze,
913
+ onClick: Qe,
890
914
  disabled: H <= 1,
891
915
  type: "button",
892
916
  "aria-label": "Previous page",
@@ -895,9 +919,9 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
895
919
  /* @__PURE__ */ q(C, {
896
920
  className: "h-7 w-12 text-center text-xs px-1",
897
921
  placeholder: String(H),
898
- value: Le,
899
- onChange: (e) => Re(e.target.value),
900
- onKeyDown: $e,
922
+ value: ze,
923
+ onChange: (e) => Be(e.target.value),
924
+ onKeyDown: et,
901
925
  "aria-label": "Jump to page",
902
926
  "data-testid": "record-picker-page-jump"
903
927
  }),
@@ -905,8 +929,8 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
905
929
  variant: "outline",
906
930
  size: "icon",
907
931
  className: "size-7",
908
- onClick: Qe,
909
- disabled: H >= He,
932
+ onClick: $e,
933
+ disabled: H >= Ue,
910
934
  type: "button",
911
935
  "aria-label": "Next page",
912
936
  children: /* @__PURE__ */ q(he, { className: "size-4" })
@@ -919,7 +943,7 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
919
943
  className: "flex items-center gap-2 w-full justify-between",
920
944
  children: [/* @__PURE__ */ J("span", {
921
945
  className: "text-sm text-muted-foreground",
922
- children: [Te.size, " selected"]
946
+ children: [De.size, " selected"]
923
947
  }), /* @__PURE__ */ J("div", {
924
948
  className: "flex gap-2",
925
949
  children: [/* @__PURE__ */ q(h, {
@@ -929,7 +953,7 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
929
953
  children: "Cancel"
930
954
  }), /* @__PURE__ */ q(h, {
931
955
  type: "button",
932
- onClick: Xe,
956
+ onClick: Ze,
933
957
  children: "Confirm"
934
958
  })]
935
959
  })]
@@ -938,28 +962,36 @@ function bt({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i
938
962
  })
939
963
  });
940
964
  }
941
- var xt, St, Ct, wt = X((() => {
942
- xt = 10, St = 60, Ct = 5;
965
+ var St, Ct, wt, Tt = Y((() => {
966
+ St = 10, Ct = 60, wt = 5;
943
967
  }));
944
968
  //#endregion
945
969
  //#region src/widgets/_cell-renderer-bridge.ts
946
- function Tt(e) {
947
- Dt = e;
970
+ function Et(e) {
971
+ Ot = e;
948
972
  }
949
- function Et() {
950
- return Dt;
973
+ function Dt() {
974
+ return Ot;
951
975
  }
952
- var Dt, Ot = X((() => {})), kt = /* @__PURE__ */ Z({ LookupField: () => Mt });
953
- function At(e, t, n, r) {
954
- let i = e[n] ?? e.id ?? e._id, a = e[t] ?? e.label ?? e.name ?? String(i), o = r ? e[r] : void 0;
976
+ var Ot, kt = Y((() => {})), At = /* @__PURE__ */ X({ LookupField: () => Pt });
977
+ function jt(e, t) {
978
+ if (!e || typeof e != "object" || !t) return null;
979
+ let n = "[-\\u2013\\u2014|/·,:]", r = !1, i = t.replace(/\{([^{}]+)\}/g, (t, n) => {
980
+ let i = e[n.trim()];
981
+ return i != null && i !== "" ? (r = !0, String(i)) : "\0";
982
+ });
983
+ return r && i.replace(RegExp(`\\s*${n}\\s*`, "g"), "").replace(RegExp(`\\s*${n}\\s*`, "g"), "").replace(RegExp("\0", "g"), "").replace(/\s+/g, " ").trim() || null;
984
+ }
985
+ function Mt(e, t, n, r, i) {
986
+ let a = e[n] ?? e.id ?? e._id, o = (i ? jt(e, i) : null) ?? e[t] ?? e.label ?? e.name ?? e.full_name ?? e.title ?? e.subject ?? String(a), s = r ? e[r] : void 0;
955
987
  return {
956
- value: i,
957
- label: String(a),
958
- description: o,
988
+ value: a,
989
+ label: String(o),
990
+ description: s,
959
991
  ...e
960
992
  };
961
993
  }
962
- function jt(e) {
994
+ function Nt(e) {
963
995
  return {
964
996
  text: "text",
965
997
  number: "number",
@@ -972,8 +1004,8 @@ function jt(e) {
972
1004
  boolean: "boolean"
973
1005
  }[e];
974
1006
  }
975
- function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
976
- let [d, f] = l(!1), [p, g] = l(""), { t: _ } = Ue(), [v, y] = l([]), [b, ee] = l(!1), [x, w] = l(null), [D, ne] = l(0), re = c(null), [ie, ae] = l([]), [O, k] = l(-1), oe = c(null), se = n || u.schema, ce = se?.field, A = ce && typeof ce == "object" && ("reference_to" in ce || "reference" in ce || "type" in ce) ? ce : se, le = A?.options || [], j = A?.multiple || !1, M = A?.display_field || A?.reference_field || "name", N = A?.description_field, P = A?.id_field || "id", de = A?.reference_to || A?.reference, fe = A?.lookup_columns, pe = A?.lookup_page_size, F = A?.lookup_filters, I = s(() => {
1007
+ function Pt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
1008
+ let [d, f] = l(!1), [p, g] = l(""), { t: _ } = We(), [v, y] = l([]), [b, ee] = l(!1), [x, w] = l(null), [E, re] = l(0), ie = c(null), [ae, oe] = l([]), [D, O] = l(-1), k = c(null), se = n || u.schema, ce = se?.field, A = ce && typeof ce == "object" && ("reference_to" in ce || "reference" in ce || "type" in ce) ? ce : se, le = A?.options || [], j = A?.multiple || !1, M = A?.display_field || A?.reference_field || "name", N = A?.description_field, P = A?.id_field || "id", F = A?.reference_to || A?.reference, de = A?.lookup_columns, fe = A?.lookup_page_size, pe = A?.lookup_filters, I = s(() => {
977
1009
  let e = A?.depends_on ?? A?.dependsOn;
978
1010
  return e && Array.isArray(e) ? e.map((e) => typeof e == "string" ? {
979
1011
  field: e,
@@ -983,10 +1015,10 @@ function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
983
1015
  param: e.param ?? e.field
984
1016
  }) : [];
985
1017
  }, [A?.depends_on, A?.dependsOn]), me = u.dependentValues, he = s(() => {
986
- if (!fe) return;
1018
+ if (!de) return;
987
1019
  let e = [];
988
- for (let t of fe) if (typeof t == "object" && t.type) {
989
- let n = jt(t.type);
1020
+ for (let t of de) if (typeof t == "object" && t.type) {
1021
+ let n = Nt(t.type);
990
1022
  n && e.push({
991
1023
  field: t.field,
992
1024
  label: t.label,
@@ -994,44 +1026,59 @@ function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
994
1026
  });
995
1027
  }
996
1028
  return e.length > 0 ? e : void 0;
997
- }, [fe]), L = i(Pt), ge = L?.dataSource ?? null, R = u.dataSource ?? se?.dataSource ?? A?.dataSource ?? ge, z = s(() => me || (L?.formValues ?? L?.data ?? {}), [
1029
+ }, [de]), L = i(It), ge = L?.dataSource ?? null, R = u.dataSource ?? se?.dataSource ?? A?.dataSource ?? ge, _e = s(() => me || (L?.formValues ?? L?.data ?? {}), [
998
1030
  me,
999
1031
  L?.formValues,
1000
1032
  L?.data
1001
- ]), B = s(() => I.length === 0 ? !1 : I.some(({ field: e }) => {
1002
- let t = z[e];
1033
+ ]), z = s(() => I.length === 0 ? !1 : I.some(({ field: e }) => {
1034
+ let t = _e[e];
1003
1035
  return t == null || t === "" || Array.isArray(t) && t.length === 0;
1004
- }), [I, z]), V = R != null && typeof R.find == "function" && !!de, _e = u.onCreateNew ?? se?.onCreateNew, [ve, ye] = l(!1), H = V ? v : le, U = s(() => {
1005
- if (V || !p) return H;
1036
+ }), [I, _e]), B = R != null && typeof R.find == "function" && !!F, [ve, ye] = l(null);
1037
+ a(() => {
1038
+ if (!R || !F) return;
1039
+ let e = R.getObjectSchema;
1040
+ if (typeof e != "function") return;
1041
+ let t = !0;
1042
+ return Promise.resolve(e.call(R, F)).then((e) => {
1043
+ t && ye(e);
1044
+ }).catch(() => {}), () => {
1045
+ t = !1;
1046
+ };
1047
+ }, [R, F]);
1048
+ let V = s(() => {
1049
+ let e = ve?.titleFormat;
1050
+ return typeof e == "string" ? e : e && typeof e == "object" && typeof e.source == "string" ? e.source : null;
1051
+ }, [ve]), be = u.onCreateNew ?? se?.onCreateNew, [H, U] = l(!1), Se = B ? v : le, W = s(() => {
1052
+ if (B || !p) return Se;
1006
1053
  let e = p.toLowerCase();
1007
- return H.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
1054
+ return Se.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
1008
1055
  }, [
1009
- V,
1010
- H,
1056
+ B,
1057
+ Se,
1011
1058
  p
1012
1059
  ]);
1013
1060
  a(() => {
1014
- k(-1);
1015
- }, [U.length]);
1016
- let W = r(async (e) => {
1017
- if (!(!R || !de)) {
1018
- if (B) {
1019
- y([]), ne(0);
1061
+ O(-1);
1062
+ }, [W.length]);
1063
+ let G = r(async (e) => {
1064
+ if (!(!R || !F)) {
1065
+ if (z) {
1066
+ y([]), re(0);
1020
1067
  return;
1021
1068
  }
1022
1069
  ee(!0), w(null);
1023
1070
  try {
1024
- let t = { $top: Nt };
1071
+ let t = { $top: Ft };
1025
1072
  if (e && e.trim() && (t.$search = e.trim()), I.length > 0) {
1026
1073
  let e = {};
1027
1074
  for (let { field: t, param: n } of I) {
1028
- let r = z[t];
1075
+ let r = _e[t];
1029
1076
  r == null || r === "" || (e[n] = typeof r == "number" ? r : String(r));
1030
1077
  }
1031
1078
  Object.keys(e).length > 0 && (t.$filter = e);
1032
1079
  }
1033
- let n = await R.find(de, t), r = n?.data ?? n ?? [];
1034
- y(r.map((e) => At(e, M, P, N))), ne(n?.total ?? r.length);
1080
+ let n = await R.find(F, t), r = n?.data ?? n ?? [];
1081
+ y(r.map((e) => Mt(e, M, P, N, V))), re(n?.total ?? r.length);
1035
1082
  } catch (e) {
1036
1083
  w(e instanceof Error ? e.message : String(e)), y([]);
1037
1084
  } finally {
@@ -1040,32 +1087,70 @@ function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
1040
1087
  }
1041
1088
  }, [
1042
1089
  R,
1043
- de,
1090
+ F,
1044
1091
  M,
1045
1092
  P,
1046
1093
  N,
1047
- B,
1094
+ V,
1095
+ z,
1048
1096
  I,
1049
- z
1097
+ _e
1050
1098
  ]);
1051
1099
  a(() => {
1052
- d && V && I.length > 0 && W(p || void 0);
1053
- }, [s(() => I.map((e) => `${e.param}=${z[e.field] ?? ""}`).join("|"), [I, z])]), a(() => {
1054
- d && V && W(p || void 0), d || (g(""), w(null), k(-1));
1100
+ d && B && I.length > 0 && G(p || void 0);
1101
+ }, [s(() => I.map((e) => `${e.param}=${_e[e.field] ?? ""}`).join("|"), [I, _e])]), a(() => {
1102
+ d && B && G(p || void 0), d || (g(""), w(null), O(-1));
1055
1103
  }, [d]);
1056
- let xe = r((e) => {
1057
- g(e), V && (re.current && clearTimeout(re.current), re.current = setTimeout(() => {
1058
- W(e || void 0);
1104
+ let Te = r((e) => {
1105
+ g(e), B && (ie.current && clearTimeout(ie.current), ie.current = setTimeout(() => {
1106
+ G(e || void 0);
1059
1107
  }, 300));
1060
- }, [V, W]);
1108
+ }, [B, G]);
1061
1109
  a(() => () => {
1062
- re.current && clearTimeout(re.current);
1063
- }, []);
1064
- let G = r((e) => le.find((t) => t.value === e) ?? v.find((t) => t.value === e) ?? ie.find((t) => t.value === e), [
1110
+ ie.current && clearTimeout(ie.current);
1111
+ }, []), a(() => {
1112
+ if (!B || !R || !F) return;
1113
+ let t = j ? Array.isArray(e) ? e : [] : e != null && e !== "" ? [e] : [];
1114
+ if (!t.length) return;
1115
+ let n = t.filter((e) => !Ee(e));
1116
+ if (!n.length) return;
1117
+ let r = !1;
1118
+ return (async () => {
1119
+ try {
1120
+ let e = [];
1121
+ for (let t of n) if (typeof R.findOne == "function") {
1122
+ let n = await R.findOne(F, t);
1123
+ n && e.push(Mt(n, M, P, N, V));
1124
+ } else {
1125
+ let n = await R.find(F, {
1126
+ $filter: { [P]: t },
1127
+ $top: 1
1128
+ }), r = n?.data ?? n ?? [];
1129
+ r[0] && e.push(Mt(r[0], M, P, N, V));
1130
+ }
1131
+ !r && e.length && oe((t) => {
1132
+ let n = new Map(t.map((e) => [e.value, e]));
1133
+ for (let t of e) n.set(t.value, t);
1134
+ return Array.from(n.values());
1135
+ });
1136
+ } catch {}
1137
+ })(), () => {
1138
+ r = !0;
1139
+ };
1140
+ }, [
1141
+ e,
1142
+ B,
1143
+ F,
1144
+ M,
1145
+ P,
1146
+ N,
1147
+ j
1148
+ ]);
1149
+ let Ee = r((e) => le.find((t) => t.value === e) ?? v.find((t) => t.value === e) ?? ae.find((t) => t.value === e), [
1065
1150
  le,
1066
1151
  v,
1067
- ie
1068
- ]), K = j ? (Array.isArray(e) ? e : []).map(G).filter(Boolean) : e ? [G(e)].filter(Boolean) : [], we = r((n) => {
1152
+ ae
1153
+ ]), K = j ? (Array.isArray(e) ? e : []).map(Ee).filter(Boolean) : e ? [Ee(e)].filter(Boolean) : [], ke = r((n) => {
1069
1154
  if (j) {
1070
1155
  let r = Array.isArray(e) ? e : [];
1071
1156
  r.includes(n.value) ? t(r.filter((e) => e !== n.value)) : t([...r, n.value]);
@@ -1074,32 +1159,33 @@ function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
1074
1159
  j,
1075
1160
  e,
1076
1161
  t
1077
- ]), Te = (n) => {
1162
+ ]), Ae = (n) => {
1078
1163
  t(j ? (Array.isArray(e) ? e : []).filter((e) => e !== n) : null);
1079
- }, De = r((e) => {
1080
- ae(e.map((e) => At(e, M, P, N)));
1164
+ }, Me = r((e) => {
1165
+ oe(e.map((e) => Mt(e, M, P, N, V)));
1081
1166
  }, [
1082
1167
  M,
1083
1168
  P,
1084
- N
1085
- ]), Y = r((e) => {
1086
- e.key === "ArrowDown" ? (e.preventDefault(), k((e) => e < U.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), k((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), O >= 0 && O < U.length && we(U[O]));
1169
+ N,
1170
+ V
1171
+ ]), Ne = r((e) => {
1172
+ e.key === "ArrowDown" ? (e.preventDefault(), O((e) => e < W.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), O((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), D >= 0 && D < W.length && ke(W[D]));
1087
1173
  }, [
1088
- U,
1089
- O,
1090
- we
1174
+ W,
1175
+ D,
1176
+ ke
1091
1177
  ]);
1092
1178
  return a(() => {
1093
- O >= 0 && oe.current && oe.current.querySelector(`[data-lookup-index="${O}"]`)?.scrollIntoView({ block: "nearest" });
1094
- }, [O]), o ? K.length ? j ? /* @__PURE__ */ q("div", {
1179
+ D >= 0 && k.current && k.current.querySelector(`[data-lookup-index="${D}"]`)?.scrollIntoView({ block: "nearest" });
1180
+ }, [D]), o ? K.length ? j ? /* @__PURE__ */ q("div", {
1095
1181
  className: "flex flex-wrap gap-1",
1096
1182
  children: K.map((e, t) => /* @__PURE__ */ q(m, {
1097
1183
  variant: "outline",
1098
- children: e?.[M] || e?.label
1184
+ children: e?.label || e?.[M]
1099
1185
  }, t))
1100
1186
  }) : /* @__PURE__ */ q("span", {
1101
1187
  className: "text-sm",
1102
- children: K[0]?.[M] || K[0]?.label
1188
+ children: K[0]?.label || K[0]?.[M]
1103
1189
  }) : /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ J("div", {
1104
1190
  className: "space-y-2",
1105
1191
  children: [
@@ -1108,32 +1194,32 @@ function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
1108
1194
  children: K.map((e, t) => /* @__PURE__ */ J(m, {
1109
1195
  variant: "outline",
1110
1196
  className: "gap-1",
1111
- children: [e?.[M] || e?.label, /* @__PURE__ */ q("button", {
1112
- onClick: () => Te(e?.value),
1197
+ children: [e?.label || e?.[M], /* @__PURE__ */ q("button", {
1198
+ onClick: () => Ae(e?.value),
1113
1199
  className: "ml-1 hover:text-destructive",
1114
1200
  type: "button",
1115
- "aria-label": `Remove ${e?.[M] || e?.label}`,
1201
+ "aria-label": `Remove ${e?.label || e?.[M]}`,
1116
1202
  children: /* @__PURE__ */ q(Oe, { className: "size-3" })
1117
1203
  })]
1118
1204
  }, t))
1119
1205
  }),
1120
1206
  /* @__PURE__ */ J("div", {
1121
1207
  className: "flex items-center gap-1.5",
1122
- children: [/* @__PURE__ */ J(T, {
1208
+ children: [/* @__PURE__ */ J(te, {
1123
1209
  open: d,
1124
- onOpenChange: (e) => !B && f(e),
1125
- children: [/* @__PURE__ */ q(te, {
1210
+ onOpenChange: (e) => !z && f(e),
1211
+ children: [/* @__PURE__ */ q(T, {
1126
1212
  asChild: !0,
1127
1213
  children: /* @__PURE__ */ J(h, {
1128
1214
  variant: "outline",
1129
1215
  className: "min-w-0 flex-1 justify-start text-left font-normal",
1130
1216
  type: "button",
1131
- disabled: B || u.disabled,
1132
- "data-testid": B ? "lookup-trigger-gated" : void 0,
1133
- title: B ? `Select ${I.map((e) => e.field).join(", ")} first` : void 0,
1134
- children: [/* @__PURE__ */ q(Ce, { className: "mr-2 size-4" }), B ? `Select ${I.map((e) => e.field).join(", ")} first` : K.length === 0 ? se?.placeholder || _("common.select") : j ? _("table.selected", { count: K.length }) : _("common.select")]
1217
+ disabled: z || u.disabled,
1218
+ "data-testid": z ? "lookup-trigger-gated" : void 0,
1219
+ title: z ? `Select ${I.map((e) => e.field).join(", ")} first` : void 0,
1220
+ children: [/* @__PURE__ */ q(we, { className: "mr-2 size-4" }), z ? `Select ${I.map((e) => e.field).join(", ")} first` : K.length === 0 ? se?.placeholder || _("common.select") : j ? _("table.selected", { count: K.length }) : _("common.select")]
1135
1221
  })
1136
- }), /* @__PURE__ */ J(E, {
1222
+ }), /* @__PURE__ */ J(ne, {
1137
1223
  className: "w-[var(--radix-popover-trigger-width)] p-0",
1138
1224
  align: "start",
1139
1225
  children: [
@@ -1142,15 +1228,15 @@ function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
1142
1228
  children: /* @__PURE__ */ J("div", {
1143
1229
  className: "relative",
1144
1230
  children: [
1145
- /* @__PURE__ */ q(Ce, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
1231
+ /* @__PURE__ */ q(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
1146
1232
  /* @__PURE__ */ q(C, {
1147
1233
  placeholder: _("common.search") + "...",
1148
1234
  value: p,
1149
- onChange: (e) => xe(e.target.value),
1150
- onKeyDown: Y,
1235
+ onChange: (e) => Te(e.target.value),
1236
+ onKeyDown: Ne,
1151
1237
  className: "w-full pl-9 h-8 text-sm"
1152
1238
  }),
1153
- b && /* @__PURE__ */ q(be, {
1239
+ b && /* @__PURE__ */ q(xe, {
1154
1240
  className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
1155
1241
  "data-testid": "lookup-loading"
1156
1242
  })
@@ -1169,49 +1255,49 @@ function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
1169
1255
  /* @__PURE__ */ q(h, {
1170
1256
  variant: "outline",
1171
1257
  size: "sm",
1172
- onClick: () => W(p || void 0),
1258
+ onClick: () => G(p || void 0),
1173
1259
  type: "button",
1174
1260
  children: "Retry"
1175
1261
  })
1176
1262
  ]
1177
1263
  }),
1178
- b && U.length === 0 && !x && /* @__PURE__ */ J("div", {
1264
+ b && W.length === 0 && !x && /* @__PURE__ */ J("div", {
1179
1265
  className: "flex flex-col items-center gap-2 py-6",
1180
1266
  role: "status",
1181
1267
  "aria-live": "polite",
1182
- children: [/* @__PURE__ */ q(be, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ q("p", {
1268
+ children: [/* @__PURE__ */ q(xe, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ q("p", {
1183
1269
  className: "text-sm text-muted-foreground",
1184
1270
  children: "Loading…"
1185
1271
  })]
1186
1272
  }),
1187
- !x && !(b && U.length === 0) && /* @__PURE__ */ q("div", {
1188
- ref: oe,
1273
+ !x && !(b && W.length === 0) && /* @__PURE__ */ q("div", {
1274
+ ref: k,
1189
1275
  className: "max-h-64 overflow-y-auto px-1 pb-1",
1190
1276
  role: "listbox",
1191
- children: U.length === 0 ? /* @__PURE__ */ J("div", {
1277
+ children: W.length === 0 ? /* @__PURE__ */ J("div", {
1192
1278
  className: "py-4 text-center",
1193
1279
  children: [/* @__PURE__ */ q("p", {
1194
1280
  className: "text-sm text-muted-foreground",
1195
1281
  children: "No options found"
1196
- }), _e && /* @__PURE__ */ J(h, {
1282
+ }), be && /* @__PURE__ */ J(h, {
1197
1283
  variant: "ghost",
1198
1284
  size: "sm",
1199
1285
  className: "mt-2 gap-1",
1200
1286
  type: "button",
1201
1287
  onClick: () => {
1202
- _e(p), f(!1);
1288
+ be(p), f(!1);
1203
1289
  },
1204
- children: [/* @__PURE__ */ q(Se, { className: "size-4" }), "Create new"]
1290
+ children: [/* @__PURE__ */ q(Ce, { className: "size-4" }), "Create new"]
1205
1291
  })]
1206
- }) : /* @__PURE__ */ J(ke, { children: [
1207
- U.map((t, n) => {
1292
+ }) : /* @__PURE__ */ J(je, { children: [
1293
+ W.map((t, n) => {
1208
1294
  let r = j ? (Array.isArray(e) ? e : []).includes(t.value) : e === t.value;
1209
1295
  return /* @__PURE__ */ J("button", {
1210
1296
  "data-lookup-index": n,
1211
1297
  role: "option",
1212
1298
  "aria-selected": r,
1213
- onClick: () => we(t),
1214
- className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${n === O ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
1299
+ onClick: () => ke(t),
1300
+ className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${n === D ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
1215
1301
  type: "button",
1216
1302
  children: [/* @__PURE__ */ J("div", {
1217
1303
  className: "min-w-0 flex-1",
@@ -1229,38 +1315,38 @@ function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
1229
1315
  })]
1230
1316
  }, t.value);
1231
1317
  }),
1232
- V && D > U.length && /* @__PURE__ */ J("p", {
1318
+ B && E > W.length && /* @__PURE__ */ J("p", {
1233
1319
  className: "text-xs text-muted-foreground text-center py-2",
1234
1320
  children: [
1235
1321
  "Showing ",
1236
- U.length,
1322
+ W.length,
1237
1323
  " of ",
1238
- D,
1324
+ E,
1239
1325
  " results."
1240
1326
  ]
1241
1327
  }),
1242
- V && D > U.length && /* @__PURE__ */ J("button", {
1328
+ B && E > W.length && /* @__PURE__ */ J("button", {
1243
1329
  type: "button",
1244
1330
  className: "w-full text-center px-3 py-2 rounded-md text-sm font-medium text-primary hover:bg-accent flex items-center justify-center gap-1.5",
1245
1331
  onClick: () => {
1246
- f(!1), ye(!0);
1332
+ f(!1), U(!0);
1247
1333
  },
1248
1334
  "data-testid": "show-all-results",
1249
1335
  children: [
1250
- /* @__PURE__ */ q(Ee, { className: "size-3.5" }),
1336
+ /* @__PURE__ */ q(De, { className: "size-3.5" }),
1251
1337
  "Show All Results (",
1252
- D,
1338
+ E,
1253
1339
  ")"
1254
1340
  ]
1255
1341
  }),
1256
- _e && /* @__PURE__ */ J("button", {
1342
+ be && /* @__PURE__ */ J("button", {
1257
1343
  type: "button",
1258
1344
  className: "w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center gap-1.5 text-muted-foreground",
1259
1345
  onClick: () => {
1260
- _e(p), f(!1);
1346
+ be(p), f(!1);
1261
1347
  },
1262
1348
  children: [
1263
- /* @__PURE__ */ q(Se, { className: "size-3.5" }),
1349
+ /* @__PURE__ */ q(Ce, { className: "size-3.5" }),
1264
1350
  "Create new",
1265
1351
  p ? ` "${p}"` : ""
1266
1352
  ]
@@ -1269,43 +1355,44 @@ function Mt({ value: e, onChange: t, field: n, readonly: o, ...u }) {
1269
1355
  })
1270
1356
  ]
1271
1357
  })]
1272
- }), V && /* @__PURE__ */ q(h, {
1358
+ }), B && /* @__PURE__ */ q(h, {
1273
1359
  variant: "outline",
1274
1360
  size: "icon",
1275
1361
  className: "shrink-0",
1276
1362
  type: "button",
1277
- onClick: () => ye(!0),
1363
+ onClick: () => U(!0),
1278
1364
  "aria-label": "Browse all records",
1279
1365
  title: "Browse all records",
1280
1366
  "data-testid": "browse-all-records",
1281
- children: /* @__PURE__ */ q(Ee, { className: "size-4" })
1367
+ children: /* @__PURE__ */ q(De, { className: "size-4" })
1282
1368
  })]
1283
1369
  }),
1284
- V && R && de && /* @__PURE__ */ q(bt, {
1285
- open: ve,
1286
- onOpenChange: ye,
1370
+ B && R && F && /* @__PURE__ */ q(xt, {
1371
+ open: H,
1372
+ onOpenChange: U,
1287
1373
  title: se?.label || "Select",
1288
1374
  multiple: j,
1289
1375
  dataSource: R,
1290
- objectName: de,
1291
- columns: fe,
1376
+ objectName: F,
1377
+ columns: de,
1292
1378
  displayField: M,
1379
+ titleFormat: V,
1293
1380
  idField: P,
1294
- pageSize: pe,
1381
+ pageSize: fe,
1295
1382
  value: e,
1296
1383
  onSelect: t,
1297
- onSelectRecords: De,
1298
- lookupFilters: F,
1299
- cellRenderer: Et(),
1384
+ onSelectRecords: Me,
1385
+ lookupFilters: pe,
1386
+ cellRenderer: Dt(),
1300
1387
  filterColumns: he
1301
1388
  })
1302
1389
  ]
1303
1390
  });
1304
1391
  }
1305
- var Nt, Pt, Ft = X((() => {
1306
- wt(), Ot(), We(), Nt = 50, Pt = Ae;
1307
- })), It = /* @__PURE__ */ Z({ DateTimeField: () => Lt });
1308
- function Lt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1392
+ var Ft, It, Lt = Y((() => {
1393
+ Tt(), kt(), Ge(), Ft = 50, It = ke;
1394
+ })), Rt = /* @__PURE__ */ X({ DateTimeField: () => zt });
1395
+ function zt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1309
1396
  if (r) {
1310
1397
  if (!e) return /* @__PURE__ */ q(S, {});
1311
1398
  let t = new Date(e);
@@ -1327,8 +1414,8 @@ function Lt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1327
1414
  disabled: r || o.disabled
1328
1415
  });
1329
1416
  }
1330
- var Rt = X((() => {})), zt = /* @__PURE__ */ Z({ TimeField: () => Bt });
1331
- function Bt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1417
+ var Bt = Y((() => {})), Vt = /* @__PURE__ */ X({ TimeField: () => Ht });
1418
+ function Ht({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1332
1419
  if (r) return /* @__PURE__ */ q("span", {
1333
1420
  className: "text-sm",
1334
1421
  children: e || /* @__PURE__ */ q(S, {})
@@ -1342,8 +1429,8 @@ function Bt({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1342
1429
  disabled: r || o.disabled
1343
1430
  });
1344
1431
  }
1345
- var Vt = X((() => {})), Ht = /* @__PURE__ */ Z({ PercentField: () => Ut });
1346
- function Ut({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
1432
+ var Ut = Y((() => {})), Wt = /* @__PURE__ */ X({ PercentField: () => Gt });
1433
+ function Gt({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, className: a, ...o }) {
1347
1434
  let s = n || o.schema, c = s?.precision ?? 2;
1348
1435
  if (r) return e == null ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ J("span", {
1349
1436
  className: "text-sm font-medium tabular-nums",
@@ -1383,7 +1470,7 @@ function Ut({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
1383
1470
  className: "absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
1384
1471
  children: "%"
1385
1472
  })]
1386
- }), /* @__PURE__ */ q(k, {
1473
+ }), /* @__PURE__ */ q(O, {
1387
1474
  value: [u],
1388
1475
  onValueChange: f,
1389
1476
  min: 0,
@@ -1396,8 +1483,8 @@ function Ut({ value: e, onChange: t, field: n, readonly: r, errorMessage: i, cla
1396
1483
  })]
1397
1484
  });
1398
1485
  }
1399
- var Wt = X((() => {})), Gt = /* @__PURE__ */ Z({ PasswordField: () => Kt });
1400
- function Kt({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
1486
+ var Kt = Y((() => {})), qt = /* @__PURE__ */ X({ PasswordField: () => Jt });
1487
+ function Jt({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
1401
1488
  let [o, s] = l(!1), c = n || a.schema;
1402
1489
  if (r) return /* @__PURE__ */ q("span", {
1403
1490
  className: "text-sm",
@@ -1421,13 +1508,13 @@ function Kt({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
1421
1508
  className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
1422
1509
  onClick: () => s(!o),
1423
1510
  tabIndex: -1,
1424
- children: q(o ? _e : V, { className: "size-4 text-gray-500" })
1511
+ children: q(o ? ve : B, { className: "size-4 text-gray-500" })
1425
1512
  })]
1426
1513
  });
1427
1514
  }
1428
- var qt = X((() => {})), Jt = /* @__PURE__ */ Z({ FileField: () => Yt });
1429
- function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1430
- let o = c(null), s = c(null), u = n || a.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : void 0, p = u?.maxSize, m = u?.capture ?? null, g = !f || f.split(",").some((e) => e.trim().startsWith("image/") || e.trim() === "image/*" || e.trim().startsWith(".jp") || e.trim().startsWith(".png") || e.trim().startsWith(".gif") || e.trim().startsWith(".webp")), _ = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || /Mobi|Android/i.test(navigator.userAgent)), v = m === !1 ? !1 : m ?? (g && _ ? "environment" : null), [y, b] = l(!1), [ee, x] = l([]), { upload: C } = je(), [w, T] = l({}), [E, te] = l(!1), D = e ? Array.isArray(e) ? e : [e] : [], ne = r(async (e) => {
1515
+ var Yt = Y((() => {})), Xt = /* @__PURE__ */ X({ FileField: () => Zt });
1516
+ function Zt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1517
+ let o = c(null), s = c(null), u = n || a.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : void 0, p = u?.maxSize, m = u?.capture ?? null, g = !f || f.split(",").some((e) => e.trim().startsWith("image/") || e.trim() === "image/*" || e.trim().startsWith(".jp") || e.trim().startsWith(".png") || e.trim().startsWith(".gif") || e.trim().startsWith(".webp")), _ = typeof navigator < "u" && (navigator.maxTouchPoints > 0 || /Mobi|Android/i.test(navigator.userAgent)), v = m === !1 ? !1 : m ?? (g && _ ? "environment" : null), [y, b] = l(!1), [ee, x] = l([]), { upload: C } = Ne(), [w, te] = l({}), [ne, T] = l(!1), E = e ? Array.isArray(e) ? e : [e] : [], re = r(async (e) => {
1431
1518
  if (e.length === 0) return;
1432
1519
  let n = [], r = e.filter((e) => {
1433
1520
  if (p && e.size > p) {
@@ -1437,11 +1524,11 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1437
1524
  return !0;
1438
1525
  });
1439
1526
  if (x(n), r.length !== 0) {
1440
- te(!0);
1527
+ T(!0);
1441
1528
  try {
1442
1529
  let e = (await Promise.all(r.map(async (e) => {
1443
1530
  try {
1444
- let t = await C(e, { onProgress: (t) => T((n) => ({
1531
+ let t = await C(e, { onProgress: (t) => te((n) => ({
1445
1532
  ...n,
1446
1533
  [e.name]: t
1447
1534
  })) });
@@ -1457,32 +1544,32 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1457
1544
  }
1458
1545
  }))).filter(Boolean);
1459
1546
  if (e.length === 0) return;
1460
- t(d ? [...D, ...e] : e[0]);
1547
+ t(d ? [...E, ...e] : e[0]);
1461
1548
  } finally {
1462
- te(!1), T({});
1549
+ T(!1), te({});
1463
1550
  }
1464
1551
  }
1465
1552
  }, [
1466
- D,
1553
+ E,
1467
1554
  d,
1468
1555
  t,
1469
1556
  p,
1470
1557
  C
1471
- ]), re = r((e) => {
1558
+ ]), ie = r((e) => {
1472
1559
  e.preventDefault(), e.stopPropagation(), b(!0);
1473
- }, []), ie = r((e) => {
1474
- e.preventDefault(), e.stopPropagation(), b(!1);
1475
1560
  }, []), ae = r((e) => {
1476
1561
  e.preventDefault(), e.stopPropagation(), b(!1);
1562
+ }, []), oe = r((e) => {
1563
+ e.preventDefault(), e.stopPropagation(), b(!1);
1477
1564
  let t = Array.from(e.dataTransfer.files);
1478
1565
  if (f) {
1479
1566
  let e = f.split(",").map((e) => e.trim().toLowerCase());
1480
- ne(t.filter((t) => {
1567
+ re(t.filter((t) => {
1481
1568
  let n = t.name.split("."), r = n.length > 1 ? "." + n.pop()?.toLowerCase() : "";
1482
1569
  return e.some((e) => e === t.type || r && e === r || e.endsWith("/*") && t.type.startsWith(e.replace("/*", "/")));
1483
1570
  }));
1484
- } else ne(t);
1485
- }, [f, ne]);
1571
+ } else re(t);
1572
+ }, [f, re]);
1486
1573
  if (i) return e ? /* @__PURE__ */ q("div", {
1487
1574
  className: "flex flex-wrap gap-2",
1488
1575
  children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ q("span", {
@@ -1490,14 +1577,14 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1490
1577
  children: e.name || e.original_name || "File"
1491
1578
  }, t))
1492
1579
  }) : /* @__PURE__ */ q(S, {});
1493
- let O = (e) => {
1494
- ne(Array.from(e.target.files || []));
1495
- }, k = (e) => {
1580
+ let D = (e) => {
1581
+ re(Array.from(e.target.files || []));
1582
+ }, O = (e) => {
1496
1583
  if (d) {
1497
- let n = D.filter((t, n) => n !== e);
1584
+ let n = E.filter((t, n) => n !== e);
1498
1585
  t(n.length > 0 ? n : null);
1499
1586
  } else t(null);
1500
- }, oe = (e) => (e.mime_type || "").startsWith("image/");
1587
+ }, k = (e) => (e.mime_type || "").startsWith("image/");
1501
1588
  return /* @__PURE__ */ J("div", {
1502
1589
  className: a.className,
1503
1590
  children: [
@@ -1506,7 +1593,7 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1506
1593
  type: "file",
1507
1594
  multiple: d,
1508
1595
  accept: f,
1509
- onChange: O,
1596
+ onChange: D,
1510
1597
  className: "hidden"
1511
1598
  }),
1512
1599
  v && /* @__PURE__ */ q("input", {
@@ -1514,7 +1601,7 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1514
1601
  type: "file",
1515
1602
  accept: "image/*",
1516
1603
  capture: v,
1517
- onChange: O,
1604
+ onChange: D,
1518
1605
  className: "hidden",
1519
1606
  "aria-label": "Camera capture",
1520
1607
  "data-testid": "file-field-camera-input"
@@ -1523,9 +1610,9 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1523
1610
  className: "space-y-2",
1524
1611
  children: [
1525
1612
  /* @__PURE__ */ J("div", {
1526
- onDragOver: re,
1527
- onDragLeave: ie,
1528
- onDrop: ae,
1613
+ onDragOver: ie,
1614
+ onDragLeave: ae,
1615
+ onDrop: oe,
1529
1616
  onClick: () => o.current?.click(),
1530
1617
  className: `
1531
1618
  flex flex-col items-center justify-center gap-2 p-6
@@ -1538,7 +1625,7 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1538
1625
  onKeyDown: (e) => {
1539
1626
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o.current?.click());
1540
1627
  },
1541
- children: [/* @__PURE__ */ q(De, { className: `size-8 ${y ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ J("div", {
1628
+ children: [/* @__PURE__ */ q(K, { className: `size-8 ${y ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ J("div", {
1542
1629
  className: "text-center",
1543
1630
  children: [/* @__PURE__ */ q("p", {
1544
1631
  className: "text-sm font-medium",
@@ -1558,12 +1645,12 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1558
1645
  e.stopPropagation(), s.current?.click();
1559
1646
  },
1560
1647
  "data-testid": "file-field-camera-button",
1561
- children: [/* @__PURE__ */ q(F, { className: "size-4 mr-2" }), v === "user" ? "Take selfie" : "Take photo"]
1648
+ children: [/* @__PURE__ */ q(pe, { className: "size-4 mr-2" }), v === "user" ? "Take selfie" : "Take photo"]
1562
1649
  }),
1563
- E && /* @__PURE__ */ J("div", {
1650
+ ne && /* @__PURE__ */ J("div", {
1564
1651
  className: "flex items-center gap-2 text-xs text-muted-foreground",
1565
1652
  "data-testid": "file-field-uploading",
1566
- children: [/* @__PURE__ */ q(be, { className: "size-3 animate-spin" }), /* @__PURE__ */ J("span", { children: ["Uploading…", Object.keys(w).length > 0 && ` (${Math.round(Object.values(w).reduce((e, t) => e + t, 0) / Object.keys(w).length * 100)}%)`] })]
1653
+ children: [/* @__PURE__ */ q(xe, { className: "size-3 animate-spin" }), /* @__PURE__ */ J("span", { children: ["Uploading…", Object.keys(w).length > 0 && ` (${Math.round(Object.values(w).reduce((e, t) => e + t, 0) / Object.keys(w).length * 100)}%)`] })]
1567
1654
  }),
1568
1655
  ee.length > 0 && /* @__PURE__ */ q("div", {
1569
1656
  className: "space-y-0.5",
@@ -1572,18 +1659,18 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1572
1659
  children: e
1573
1660
  }, t))
1574
1661
  }),
1575
- D.length > 0 && /* @__PURE__ */ q("div", {
1662
+ E.length > 0 && /* @__PURE__ */ q("div", {
1576
1663
  className: "space-y-1",
1577
- children: D.map((e, t) => /* @__PURE__ */ J("div", {
1664
+ children: E.map((e, t) => /* @__PURE__ */ J("div", {
1578
1665
  className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
1579
1666
  children: [/* @__PURE__ */ J("div", {
1580
1667
  className: "flex items-center gap-2 flex-1 min-w-0",
1581
1668
  children: [
1582
- oe(e) && e.url ? /* @__PURE__ */ q("img", {
1669
+ k(e) && e.url ? /* @__PURE__ */ q("img", {
1583
1670
  src: e.url,
1584
1671
  alt: e.name,
1585
1672
  className: "size-8 object-cover rounded shrink-0"
1586
- }) : oe(e) ? /* @__PURE__ */ q(H, { className: "size-4 text-muted-foreground shrink-0" }) : /* @__PURE__ */ q(ve, { className: "size-4 text-muted-foreground shrink-0" }),
1673
+ }) : k(e) ? /* @__PURE__ */ q(be, { className: "size-4 text-muted-foreground shrink-0" }) : /* @__PURE__ */ q(ye, { className: "size-4 text-muted-foreground shrink-0" }),
1587
1674
  /* @__PURE__ */ q("span", {
1588
1675
  className: "text-sm truncate",
1589
1676
  children: e.name || e.original_name || "File"
@@ -1602,7 +1689,7 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1602
1689
  variant: "ghost",
1603
1690
  size: "sm",
1604
1691
  onClick: (e) => {
1605
- e.stopPropagation(), k(t);
1692
+ e.stopPropagation(), O(t);
1606
1693
  },
1607
1694
  className: "h-6 w-6 p-0",
1608
1695
  children: /* @__PURE__ */ q(Oe, { className: "size-3" })
@@ -1614,17 +1701,17 @@ function Yt({ value: e, onChange: t, field: n, readonly: i, ...a }) {
1614
1701
  ]
1615
1702
  });
1616
1703
  }
1617
- var Xt = X((() => {})), Zt = /* @__PURE__ */ Z({ ImageCropperDialog: () => Qt }), Qt, $t = X((() => {
1618
- Qt = ({ open: e, onOpenChange: t, src: n, outputType: i = "image/png", outputName: o = "cropped.png", onConfirm: s }) => {
1704
+ var Qt = Y((() => {})), $t = /* @__PURE__ */ X({ ImageCropperDialog: () => en }), en, tn = Y((() => {
1705
+ en = ({ open: e, onOpenChange: t, src: n, outputType: i = "image/png", outputName: o = "cropped.png", onConfirm: s }) => {
1619
1706
  let u = c(null), d = c(null), [f, p] = l(0), [m, g] = l({
1620
1707
  x: 0,
1621
1708
  y: 0,
1622
1709
  width: 100,
1623
1710
  height: 100
1624
- }), [S, C] = l(null), [w, T] = l(!1);
1711
+ }), [S, C] = l(null), [w, te] = l(!1);
1625
1712
  a(() => {
1626
1713
  if (!e || !n) return;
1627
- T(!1);
1714
+ te(!1);
1628
1715
  let t = new Image();
1629
1716
  t.crossOrigin = "anonymous", t.onload = () => {
1630
1717
  d.current = t;
@@ -1634,8 +1721,8 @@ var Xt = X((() => {})), Zt = /* @__PURE__ */ Z({ ImageCropperDialog: () => Qt })
1634
1721
  y: (t.naturalHeight - n) / 2,
1635
1722
  width: e,
1636
1723
  height: n
1637
- }), p(0), T(!0);
1638
- }, t.onerror = () => T(!1), t.src = n;
1724
+ }), p(0), te(!0);
1725
+ }, t.onerror = () => te(!1), t.src = n;
1639
1726
  }, [e, n]), a(() => {
1640
1727
  if (!w || !d.current || !u.current) return;
1641
1728
  let e = d.current, t = u.current, n = t.getContext("2d");
@@ -1651,7 +1738,7 @@ var Xt = X((() => {})), Zt = /* @__PURE__ */ Z({ ImageCropperDialog: () => Qt })
1651
1738
  m,
1652
1739
  f
1653
1740
  ]);
1654
- let E = r((e) => {
1741
+ let ne = r((e) => {
1655
1742
  if (!d.current || !u.current) return;
1656
1743
  let t = u.current.getBoundingClientRect(), n = d.current.naturalWidth / t.width;
1657
1744
  C({
@@ -1660,7 +1747,7 @@ var Xt = X((() => {})), Zt = /* @__PURE__ */ Z({ ImageCropperDialog: () => Qt })
1660
1747
  cx: m.x,
1661
1748
  cy: m.y
1662
1749
  }), e.target.setPointerCapture(e.pointerId);
1663
- }, [m]), te = r((e) => {
1750
+ }, [m]), T = r((e) => {
1664
1751
  if (!S || !d.current || !u.current) return;
1665
1752
  let t = u.current.getBoundingClientRect(), n = d.current.naturalWidth / t.width, r = (e.clientX - t.left) * n - S.ox, i = (e.clientY - t.top) * n - S.oy, a = Math.max(0, Math.min(S.cx + r, d.current.naturalWidth - m.width)), o = Math.max(0, Math.min(S.cy + i, d.current.naturalHeight - m.height));
1666
1753
  g((e) => ({
@@ -1672,7 +1759,7 @@ var Xt = X((() => {})), Zt = /* @__PURE__ */ Z({ ImageCropperDialog: () => Qt })
1672
1759
  S,
1673
1760
  m.width,
1674
1761
  m.height
1675
- ]), D = r(() => C(null), []), ne = r(() => p((e) => (e + 90) % 360), []), re = r(async () => {
1762
+ ]), E = r(() => C(null), []), re = r(() => p((e) => (e + 90) % 360), []), ie = r(async () => {
1676
1763
  if (!d.current) return;
1677
1764
  let e = d.current, n = document.createElement("canvas"), r = m.width, a = m.height;
1678
1765
  n.width = f % 180 == 0 ? r : a, n.height = f % 180 == 0 ? a : r;
@@ -1704,10 +1791,10 @@ var Xt = X((() => {})), Zt = /* @__PURE__ */ Z({ ImageCropperDialog: () => Qt })
1704
1791
  role: "img",
1705
1792
  "aria-label": "Image crop preview",
1706
1793
  className: "border rounded-md cursor-move touch-none max-w-full",
1707
- onPointerDown: E,
1708
- onPointerMove: te,
1709
- onPointerUp: D,
1710
- onPointerCancel: D
1794
+ onPointerDown: ne,
1795
+ onPointerMove: T,
1796
+ onPointerUp: E,
1797
+ onPointerCancel: E
1711
1798
  }) : /* @__PURE__ */ q("div", {
1712
1799
  className: "flex h-[270px] w-full items-center justify-center text-sm text-muted-foreground",
1713
1800
  children: "Loading image…"
@@ -1731,9 +1818,9 @@ var Xt = X((() => {})), Zt = /* @__PURE__ */ Z({ ImageCropperDialog: () => Qt })
1731
1818
  children: [/* @__PURE__ */ J(h, {
1732
1819
  type: "button",
1733
1820
  variant: "outline",
1734
- onClick: ne,
1821
+ onClick: re,
1735
1822
  "data-testid": "image-cropper-rotate",
1736
- children: [/* @__PURE__ */ q(K, { className: "size-4 mr-2" }), "Rotate 90°"]
1823
+ children: [/* @__PURE__ */ q(G, { className: "size-4 mr-2" }), "Rotate 90°"]
1737
1824
  }), /* @__PURE__ */ J("div", {
1738
1825
  className: "flex gap-2",
1739
1826
  children: [/* @__PURE__ */ q(h, {
@@ -1743,7 +1830,7 @@ var Xt = X((() => {})), Zt = /* @__PURE__ */ Z({ ImageCropperDialog: () => Qt })
1743
1830
  children: "Cancel"
1744
1831
  }), /* @__PURE__ */ J(h, {
1745
1832
  type: "button",
1746
- onClick: re,
1833
+ onClick: ie,
1747
1834
  disabled: !w,
1748
1835
  "data-testid": "image-cropper-confirm",
1749
1836
  children: [/* @__PURE__ */ q(ge, { className: "size-4 mr-2" }), "Apply crop"]
@@ -1754,9 +1841,9 @@ var Xt = X((() => {})), Zt = /* @__PURE__ */ Z({ ImageCropperDialog: () => Qt })
1754
1841
  })
1755
1842
  });
1756
1843
  };
1757
- })), en = /* @__PURE__ */ Z({ ImageField: () => tn });
1758
- function tn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
1759
- let s = c(null), u = i || o.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : "image/*", p = u?.crop !== !1, [m, g] = l(null), { upload: _ } = je(), [v, y] = l(!1);
1844
+ })), nn = /* @__PURE__ */ X({ ImageField: () => rn });
1845
+ function rn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
1846
+ let s = c(null), u = i || o.schema, d = u?.multiple || !1, f = u?.accept ? u.accept.join(",") : "image/*", p = u?.crop !== !1, [m, g] = l(null), { upload: _ } = Ne(), [v, y] = l(!1);
1760
1847
  if (a) return e ? /* @__PURE__ */ q("div", {
1761
1848
  className: "flex flex-wrap gap-2",
1762
1849
  children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ q("img", {
@@ -1872,12 +1959,12 @@ function tn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
1872
1959
  className: "w-full",
1873
1960
  disabled: v,
1874
1961
  "data-testid": "image-field-upload-button",
1875
- children: [v ? /* @__PURE__ */ q(be, { className: "size-4 mr-2 animate-spin" }) : /* @__PURE__ */ q(ye, { className: "size-4 mr-2" }), v ? "Uploading…" : b.length > 0 ? "Add More Images" : "Upload Image"]
1962
+ children: [v ? /* @__PURE__ */ q(xe, { className: "size-4 mr-2 animate-spin" }) : /* @__PURE__ */ q(V, { className: "size-4 mr-2" }), v ? "Uploading…" : b.length > 0 ? "Add More Images" : "Upload Image"]
1876
1963
  })]
1877
1964
  }),
1878
1965
  p && m && /* @__PURE__ */ q(t, {
1879
1966
  fallback: null,
1880
- children: /* @__PURE__ */ q(nn, {
1967
+ children: /* @__PURE__ */ q(an, {
1881
1968
  open: !0,
1882
1969
  onOpenChange: (e) => !e && g(null),
1883
1970
  src: m.src,
@@ -1888,10 +1975,10 @@ function tn({ value: e, onChange: n, field: i, readonly: a, ...o }) {
1888
1975
  ]
1889
1976
  });
1890
1977
  }
1891
- var nn, rn = X((() => {
1892
- nn = n(() => Promise.resolve().then(() => ($t(), Zt)).then((e) => ({ default: e.ImageCropperDialog })));
1893
- })), an = /* @__PURE__ */ Z({ LocationField: () => on });
1894
- function on({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1978
+ var an, on = Y((() => {
1979
+ an = n(() => Promise.resolve().then(() => (tn(), $t)).then((e) => ({ default: e.ImageCropperDialog })));
1980
+ })), sn = /* @__PURE__ */ X({ LocationField: () => cn });
1981
+ function cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1895
1982
  let a = n || i.schema, o = e && typeof e == "object" ? `${e.latitude || 0}, ${e.longitude || 0}` : "";
1896
1983
  return r ? /* @__PURE__ */ q("span", {
1897
1984
  className: "text-sm",
@@ -1919,8 +2006,8 @@ function on({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1919
2006
  className: i.className
1920
2007
  });
1921
2008
  }
1922
- var sn = X((() => {})), cn = /* @__PURE__ */ Z({ FormulaField: () => ln });
1923
- function ln({ value: e, field: t, ...n }) {
2009
+ var ln = Y((() => {})), un = /* @__PURE__ */ X({ FormulaField: () => dn });
2010
+ function dn({ value: e, field: t, ...n }) {
1924
2011
  let r = (t || n.schema)?.return_type || "text";
1925
2012
  if (e == null) return /* @__PURE__ */ q(S, { className: n.className });
1926
2013
  let i;
@@ -1929,8 +2016,8 @@ function ln({ value: e, field: t, ...n }) {
1929
2016
  children: i
1930
2017
  });
1931
2018
  }
1932
- var un = X((() => {})), dn = /* @__PURE__ */ Z({ SummaryField: () => fn });
1933
- function fn({ value: e, field: t, ...n }) {
2019
+ var fn = Y((() => {})), pn = /* @__PURE__ */ X({ SummaryField: () => mn });
2020
+ function mn({ value: e, field: t, ...n }) {
1934
2021
  let r = (t || n.schema)?.summary_type || "count";
1935
2022
  if (e == null) return /* @__PURE__ */ q(S, { className: n.className });
1936
2023
  let i;
@@ -1944,15 +2031,15 @@ function fn({ value: e, field: t, ...n }) {
1944
2031
  children: i
1945
2032
  });
1946
2033
  }
1947
- var pn = X((() => {})), mn = /* @__PURE__ */ Z({ AutoNumberField: () => hn });
1948
- function hn({ value: e, field: t, ...n }) {
2034
+ var hn = Y((() => {})), gn = /* @__PURE__ */ X({ AutoNumberField: () => _n });
2035
+ function _n({ value: e, field: t, ...n }) {
1949
2036
  return e == null ? /* @__PURE__ */ q(S, { className: n.className }) : /* @__PURE__ */ q("span", {
1950
2037
  className: `text-sm font-mono text-gray-700 ${n.className || ""}`,
1951
2038
  children: String(e)
1952
2039
  });
1953
2040
  }
1954
- var gn = X((() => {})), _n = /* @__PURE__ */ Z({ UserField: () => vn });
1955
- function vn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2041
+ var vn = Y((() => {})), yn = /* @__PURE__ */ X({ UserField: () => bn });
2042
+ function bn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
1956
2043
  let a = (n || i.schema)?.multiple || !1;
1957
2044
  if (r) {
1958
2045
  if (!e) return /* @__PURE__ */ q(S, {});
@@ -2020,8 +2107,8 @@ function vn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2020
2107
  })]
2021
2108
  });
2022
2109
  }
2023
- var yn = X((() => {})), bn = /* @__PURE__ */ Z({ ObjectField: () => xn });
2024
- function xn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2110
+ var xn = Y((() => {})), Sn = /* @__PURE__ */ X({ ObjectField: () => Cn });
2111
+ function Cn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2025
2112
  let o = n || i.schema, [s, c] = l(() => e == null ? "" : JSON.stringify(e, null, 2)), [u, d] = l(null);
2026
2113
  return a(() => {
2027
2114
  try {
@@ -2063,8 +2150,8 @@ function xn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2063
2150
  })]
2064
2151
  });
2065
2152
  }
2066
- var Sn = X((() => {})), Cn = /* @__PURE__ */ Z({ VectorField: () => wn });
2067
- function wn({ value: e, field: t, ...n }) {
2153
+ var wn = Y((() => {})), Tn = /* @__PURE__ */ X({ VectorField: () => En });
2154
+ function En({ value: e, field: t, ...n }) {
2068
2155
  let r = (t || n.schema)?.dimensions || (Array.isArray(e) ? e.length : 0);
2069
2156
  if (!e || !Array.isArray(e)) return /* @__PURE__ */ q(S, {});
2070
2157
  let i = e.slice(0, 3).map((e) => {
@@ -2090,8 +2177,8 @@ function wn({ value: e, field: t, ...n }) {
2090
2177
  })]
2091
2178
  });
2092
2179
  }
2093
- var Tn = X((() => {})), En = /* @__PURE__ */ Z({ GridField: () => Dn });
2094
- function Dn({ value: e, field: t, readonly: n, ...r }) {
2180
+ var Dn = Y((() => {})), On = /* @__PURE__ */ X({ GridField: () => kn });
2181
+ function kn({ value: e, field: t, readonly: n, ...r }) {
2095
2182
  let i = (t || r.schema)?.columns || [];
2096
2183
  return !e || !Array.isArray(e) ? /* @__PURE__ */ q(S, {}) : n ? /* @__PURE__ */ q("div", {
2097
2184
  className: P("text-sm", r.className),
@@ -2132,8 +2219,8 @@ function Dn({ value: e, field: t, readonly: n, ...r }) {
2132
2219
  })]
2133
2220
  });
2134
2221
  }
2135
- var On = X((() => {})), kn = /* @__PURE__ */ Z({ ColorField: () => An });
2136
- function An({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2222
+ var An = Y((() => {})), jn = /* @__PURE__ */ X({ ColorField: () => Mn });
2223
+ function Mn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2137
2224
  let a = n || i.schema;
2138
2225
  return r ? /* @__PURE__ */ J("div", {
2139
2226
  className: "flex items-center gap-2",
@@ -2163,8 +2250,8 @@ function An({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2163
2250
  })]
2164
2251
  });
2165
2252
  }
2166
- var jn = X((() => {})), Mn = /* @__PURE__ */ Z({ SliderField: () => Nn });
2167
- function Nn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2253
+ var Nn = Y((() => {})), Pn = /* @__PURE__ */ X({ SliderField: () => Fn });
2254
+ function Fn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2168
2255
  let a = n || i.schema, o = a?.min ?? 0, s = a?.max ?? 100, c = a?.step ?? 1;
2169
2256
  return r ? /* @__PURE__ */ J("div", {
2170
2257
  className: "flex items-center gap-2",
@@ -2177,7 +2264,7 @@ function Nn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2177
2264
  })]
2178
2265
  }) : /* @__PURE__ */ J("div", {
2179
2266
  className: "flex items-center gap-4",
2180
- children: [/* @__PURE__ */ q(k, {
2267
+ children: [/* @__PURE__ */ q(O, {
2181
2268
  value: [e ?? o],
2182
2269
  onValueChange: (e) => t(e[0]),
2183
2270
  min: o,
@@ -2191,12 +2278,12 @@ function Nn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2191
2278
  })]
2192
2279
  });
2193
2280
  }
2194
- var Pn = X((() => {})), Fn = /* @__PURE__ */ Z({ RatingField: () => In });
2195
- function In({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }) {
2281
+ var In = Y((() => {})), Ln = /* @__PURE__ */ X({ RatingField: () => Rn });
2282
+ function Rn({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }) {
2196
2283
  let s = (r || o.schema)?.max ?? 5, c = t ?? 0, [l, u] = e.useState(null), d = l === null ? c : l;
2197
2284
  return i ? /* @__PURE__ */ J("div", {
2198
2285
  className: P("flex items-center gap-1", a),
2199
- children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ q(Te, { className: `w-5 h-5 ${t < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ J("span", {
2286
+ children: [Array.from({ length: s }, (e, t) => /* @__PURE__ */ q(Ee, { className: `w-5 h-5 ${t < c ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground"}` }, t)), /* @__PURE__ */ J("span", {
2200
2287
  className: "ml-2 text-sm text-muted-foreground",
2201
2288
  children: [
2202
2289
  c,
@@ -2213,7 +2300,7 @@ function In({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
2213
2300
  onMouseLeave: () => u(null),
2214
2301
  className: "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",
2215
2302
  disabled: i || o.disabled,
2216
- children: /* @__PURE__ */ q(Te, { className: `w-5 h-5 transition-colors ${t < d ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}` })
2303
+ children: /* @__PURE__ */ q(Ee, { className: `w-5 h-5 transition-colors ${t < d ? "fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500" : "text-muted-foreground hover:text-yellow-400"}` })
2217
2304
  }, t)), /* @__PURE__ */ J("span", {
2218
2305
  className: "ml-2 text-sm text-muted-foreground",
2219
2306
  children: [
@@ -2224,8 +2311,8 @@ function In({ value: t, onChange: n, field: r, readonly: i, className: a, ...o }
2224
2311
  })]
2225
2312
  });
2226
2313
  }
2227
- var Ln = X((() => {})), Rn = /* @__PURE__ */ Z({ CodeField: () => zn });
2228
- function zn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2314
+ var zn = Y((() => {})), Bn = /* @__PURE__ */ X({ CodeField: () => Vn });
2315
+ function Vn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2229
2316
  let a = n || i.schema, o = a?.language ?? "javascript";
2230
2317
  return r ? /* @__PURE__ */ q("pre", {
2231
2318
  className: P("text-sm bg-muted p-2 rounded overflow-x-auto border", i.className),
@@ -2240,8 +2327,8 @@ function zn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2240
2327
  spellCheck: !1
2241
2328
  });
2242
2329
  }
2243
- var Bn = X((() => {})), Vn = /* @__PURE__ */ Z({ AvatarField: () => Hn });
2244
- function Hn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2330
+ var Hn = Y((() => {})), Un = /* @__PURE__ */ X({ AvatarField: () => Wn });
2331
+ function Wn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2245
2332
  let [o, s] = e.useState(!1), c = e.useRef(null), l = r || a.schema, u = (e) => {
2246
2333
  let t = e.target.files?.[0];
2247
2334
  if (!t) return;
@@ -2301,7 +2388,7 @@ function Hn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2301
2388
  onClick: () => c.current?.click(),
2302
2389
  disabled: i || a.disabled,
2303
2390
  children: [
2304
- /* @__PURE__ */ q(De, { className: "w-4 h-4 mr-2" }),
2391
+ /* @__PURE__ */ q(K, { className: "w-4 h-4 mr-2" }),
2305
2392
  t ? "Change" : "Upload",
2306
2393
  " Avatar"
2307
2394
  ]
@@ -2314,8 +2401,8 @@ function Hn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2314
2401
  })]
2315
2402
  });
2316
2403
  }
2317
- var Un = X((() => {})), Wn = /* @__PURE__ */ Z({ AddressField: () => Gn });
2318
- function Gn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2404
+ var Gn = Y((() => {})), Kn = /* @__PURE__ */ X({ AddressField: () => qn });
2405
+ function qn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2319
2406
  let a = e || {}, o = (e, n) => {
2320
2407
  t({
2321
2408
  ...a,
@@ -2405,8 +2492,8 @@ function Gn({ value: e, onChange: t, field: n, readonly: r, ...i }) {
2405
2492
  ]
2406
2493
  });
2407
2494
  }
2408
- var Kn = X((() => {})), qn = /* @__PURE__ */ Z({ GeolocationField: () => Jn });
2409
- function Jn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2495
+ var Jn = Y((() => {})), Yn = /* @__PURE__ */ X({ GeolocationField: () => Xn });
2496
+ function Xn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2410
2497
  let [o, s] = e.useState(!1), c = t || {}, l = (e, t) => {
2411
2498
  n({
2412
2499
  ...c,
@@ -2440,7 +2527,7 @@ function Jn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2440
2527
  return /* @__PURE__ */ J("div", {
2441
2528
  className: "flex items-center gap-2",
2442
2529
  children: [
2443
- /* @__PURE__ */ q(U, { className: "w-4 h-4 text-muted-foreground" }),
2530
+ /* @__PURE__ */ q(H, { className: "w-4 h-4 text-muted-foreground" }),
2444
2531
  e ? /* @__PURE__ */ q("span", {
2445
2532
  className: "text-sm",
2446
2533
  children: e
@@ -2473,7 +2560,7 @@ function Jn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2473
2560
  variant: "link",
2474
2561
  size: "sm",
2475
2562
  onClick: f,
2476
- children: [/* @__PURE__ */ q(U, { className: "w-4 h-4 mr-2" }), "View on map"]
2563
+ children: [/* @__PURE__ */ q(H, { className: "w-4 h-4 mr-2" }), "View on map"]
2477
2564
  })]
2478
2565
  }),
2479
2566
  /* @__PURE__ */ J("div", {
@@ -2516,8 +2603,8 @@ function Jn({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2516
2603
  ]
2517
2604
  });
2518
2605
  }
2519
- var Yn = X((() => {})), Xn = /* @__PURE__ */ Z({ SignatureField: () => Zn });
2520
- function Zn({ value: t, onChange: n, readonly: r }) {
2606
+ var Zn = Y((() => {})), Qn = /* @__PURE__ */ X({ SignatureField: () => $n });
2607
+ function $n({ value: t, onChange: n, readonly: r }) {
2521
2608
  let i = c(null), [o, s] = e.useState(!1), [l, u] = e.useState(!t);
2522
2609
  a(() => {
2523
2610
  if (t && i.current) {
@@ -2597,13 +2684,13 @@ function Zn({ value: t, onChange: n, readonly: r }) {
2597
2684
  t && (t.clearRect(0, 0, e.width, e.height), u(!0), n(""));
2598
2685
  },
2599
2686
  disabled: r || l,
2600
- children: [/* @__PURE__ */ q(z, { className: "w-4 h-4 mr-2" }), "Clear"]
2687
+ children: [/* @__PURE__ */ q(_e, { className: "w-4 h-4 mr-2" }), "Clear"]
2601
2688
  })]
2602
2689
  })]
2603
2690
  });
2604
2691
  }
2605
- var Qn = X((() => {})), $n = /* @__PURE__ */ Z({ QRCodeField: () => er });
2606
- function er({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2692
+ var er = Y((() => {})), tr = /* @__PURE__ */ X({ QRCodeField: () => nr });
2693
+ function nr({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2607
2694
  let [o, s] = e.useState(!1), c = r || a.schema;
2608
2695
  return i ? /* @__PURE__ */ J("div", {
2609
2696
  className: "flex items-center gap-3",
@@ -2616,7 +2703,7 @@ function er({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2616
2703
  size: "sm",
2617
2704
  onClick: () => s(!o),
2618
2705
  children: [
2619
- /* @__PURE__ */ q(G, { className: "w-4 h-4 mr-2" }),
2706
+ /* @__PURE__ */ q(W, { className: "w-4 h-4 mr-2" }),
2620
2707
  o ? "Hide" : "Show",
2621
2708
  " QR"
2622
2709
  ]
@@ -2633,7 +2720,7 @@ function er({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2633
2720
  placeholder: c?.placeholder || "Enter text for QR code",
2634
2721
  disabled: i || a.disabled,
2635
2722
  className: a.className
2636
- }), t && /* @__PURE__ */ J(ke, { children: [/* @__PURE__ */ q(h, {
2723
+ }), t && /* @__PURE__ */ J(je, { children: [/* @__PURE__ */ q(h, {
2637
2724
  type: "button",
2638
2725
  variant: "outline",
2639
2726
  size: "sm",
@@ -2646,7 +2733,7 @@ function er({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2646
2733
  variant: "outline",
2647
2734
  size: "sm",
2648
2735
  onClick: () => s(!o),
2649
- children: /* @__PURE__ */ q(G, { className: "w-4 h-4" })
2736
+ children: /* @__PURE__ */ q(W, { className: "w-4 h-4" })
2650
2737
  })] })]
2651
2738
  }),
2652
2739
  o && t && /* @__PURE__ */ q("div", {
@@ -2668,11 +2755,11 @@ function er({ value: t, onChange: n, field: r, readonly: i, ...a }) {
2668
2755
  ]
2669
2756
  });
2670
2757
  }
2671
- var tr = X((() => {}));
2758
+ var rr = Y((() => {}));
2672
2759
  //#endregion
2673
2760
  //#region src/widgets/MasterDetailField.tsx
2674
- Fe(), Re(), Ve(), qe(), Xe(), $e(), nt(), at(), lt(), ft(), ht(), Ft(), Rt(), Vt(), Wt(), qt(), Xt(), rn(), sn(), un(), pn(), gn(), yn(), Sn(), Tn(), On(), jn(), Pn(), Ln(), Bn(), Un(), Kn(), Yn(), Qn(), tr(), $t();
2675
- function nr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
2761
+ Le(), Be(), He(), Je(), Ze(), et(), rt(), ot(), ut(), pt(), gt(), Lt(), Bt(), Ut(), Kt(), Yt(), Qt(), on(), ln(), fn(), hn(), vn(), xn(), wn(), Dn(), An(), Nn(), In(), zn(), Hn(), Gn(), Jn(), Zn(), er(), rr(), tn();
2762
+ function ir({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }) {
2676
2763
  let o = e || [], s = n || a.schema, c = () => {
2677
2764
  let e = {
2678
2765
  id: `new-${Date.now()}`,
@@ -2699,7 +2786,7 @@ function nr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
2699
2786
  variant: "ghost",
2700
2787
  size: "sm",
2701
2788
  onClick: () => u(e),
2702
- children: /* @__PURE__ */ q(B, { className: "w-4 h-4" })
2789
+ children: /* @__PURE__ */ q(z, { className: "w-4 h-4" })
2703
2790
  })]
2704
2791
  }, e.id)), /* @__PURE__ */ J("p", {
2705
2792
  className: "text-xs text-muted-foreground",
@@ -2731,7 +2818,7 @@ function nr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
2731
2818
  variant: "ghost",
2732
2819
  size: "sm",
2733
2820
  onClick: () => u(e),
2734
- children: /* @__PURE__ */ q(B, { className: "w-4 h-4" })
2821
+ children: /* @__PURE__ */ q(z, { className: "w-4 h-4" })
2735
2822
  }), /* @__PURE__ */ q(h, {
2736
2823
  type: "button",
2737
2824
  variant: "ghost",
@@ -2752,14 +2839,88 @@ function nr({ value: e, onChange: t, field: n, readonly: r, className: i, ...a }
2752
2839
  onClick: c,
2753
2840
  disabled: a.disabled,
2754
2841
  children: [
2755
- /* @__PURE__ */ q(Se, { className: "w-4 h-4 mr-2" }),
2842
+ /* @__PURE__ */ q(Ce, { className: "w-4 h-4 mr-2" }),
2756
2843
  "Add ",
2757
2844
  s?.label || "Record"
2758
2845
  ]
2759
2846
  })]
2760
2847
  });
2761
2848
  }
2762
- Ot(), Fe(), Re(), Ve(), qe(), Xe(), Rt(), Vt(), $e(), nt(), at(), lt(), Wt(), qt(), ft(), ht(), Ft(), wt(), Xt(), rn(), sn(), un(), pn(), gn(), yn(), Sn(), Tn(), On(), jn(), Pn(), Ln(), Bn(), Un(), Kn(), Yn(), Qn(), tr();
2849
+ kt(), Le(), Be(), He(), Je(), Ze(), Bt(), Ut(), et(), rt(), ot(), ut(), Kt(), Yt(), pt(), gt(), Lt(), Tt(), Qt(), on(), ln(), fn(), hn(), vn(), xn(), wn(), Dn(), An(), Nn(), In(), zn(), Hn(), Gn(), Jn(), Zn(), er(), rr();
2850
+ var ar = /* @__PURE__ */ new Map();
2851
+ function or(e) {
2852
+ if (!(!e || typeof e != "object")) for (let t of [
2853
+ "name",
2854
+ "full_name",
2855
+ "display_name",
2856
+ "label",
2857
+ "title",
2858
+ "subject",
2859
+ "username",
2860
+ "email"
2861
+ ]) {
2862
+ let n = e[t];
2863
+ if (typeof n == "string" && n.trim()) return n.trim();
2864
+ if (typeof n == "number") return String(n);
2865
+ }
2866
+ }
2867
+ function sr(e) {
2868
+ if (typeof e != "string" || !/^[A-Za-z0-9_-]{12,32}$/.test(e)) return !1;
2869
+ let t = /[A-Z]/.test(e), n = /[a-z]/.test(e), r = /[0-9_-]/.test(e);
2870
+ return t && n || t && r || n && r;
2871
+ }
2872
+ function cr(t, n) {
2873
+ let r = e.useContext(ke)?.dataSource, [, i] = e.useState(0), a = !!t && !!r && typeof r.find == "function" && (typeof n == "string" || typeof n == "number") && n !== "", o = a ? `${t}:${String(n)}` : "";
2874
+ if (e.useEffect(() => {
2875
+ if (!a) return;
2876
+ let e = ar.get(o);
2877
+ if (e && e.state !== "pending" && e.promise == null || e?.state === "pending") return;
2878
+ let s = (async () => {
2879
+ try {
2880
+ let e;
2881
+ if (typeof r.findOne == "function") e = await r.findOne(t, n);
2882
+ else {
2883
+ let i = await r.find(t, {
2884
+ $filter: { id: n },
2885
+ options: { $top: 1 }
2886
+ });
2887
+ e = (Array.isArray(i) ? i : i?.value || i?.data || [])[0];
2888
+ }
2889
+ let i = or(e);
2890
+ ar.set(o, {
2891
+ state: "ok",
2892
+ name: i
2893
+ });
2894
+ } catch {
2895
+ ar.set(o, { state: "err" });
2896
+ }
2897
+ i((e) => e + 1);
2898
+ })();
2899
+ ar.set(o, {
2900
+ state: "pending",
2901
+ promise: s
2902
+ });
2903
+ }, [
2904
+ o,
2905
+ a,
2906
+ t,
2907
+ n,
2908
+ r
2909
+ ]), !a) return;
2910
+ let s = ar.get(o);
2911
+ return s?.state === "ok" ? s.name : void 0;
2912
+ }
2913
+ function lr() {
2914
+ try {
2915
+ let { t: e } = Ae();
2916
+ return (t, n) => {
2917
+ let r = e(t);
2918
+ return !r || r === t ? n : r;
2919
+ };
2920
+ } catch {
2921
+ return (e, t) => t;
2922
+ }
2923
+ }
2763
2924
  function Q(e) {
2764
2925
  if (e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") return e;
2765
2926
  if (e instanceof Date) return e.toISOString();
@@ -2776,7 +2937,7 @@ function Q(e) {
2776
2937
  }
2777
2938
  return String(e);
2778
2939
  }
2779
- function rr(e, t = "USD") {
2940
+ function ur(e, t = "USD") {
2780
2941
  try {
2781
2942
  return new Intl.NumberFormat("en-US", {
2782
2943
  style: "currency",
@@ -2786,7 +2947,7 @@ function rr(e, t = "USD") {
2786
2947
  return `${t} ${e.toFixed(2)}`;
2787
2948
  }
2788
2949
  }
2789
- function ir(e, t = "USD") {
2950
+ function dr(e, t = "USD") {
2790
2951
  try {
2791
2952
  return new Intl.NumberFormat("en-US", {
2792
2953
  style: "currency",
@@ -2798,39 +2959,49 @@ function ir(e, t = "USD") {
2798
2959
  return `${t} ${e}`;
2799
2960
  }
2800
2961
  }
2801
- function ar(e, t = 0) {
2962
+ function fr(e, t = 2) {
2963
+ try {
2964
+ return new Intl.NumberFormat("en-US", {
2965
+ minimumFractionDigits: t,
2966
+ maximumFractionDigits: t
2967
+ }).format(e);
2968
+ } catch {
2969
+ return e.toFixed(t);
2970
+ }
2971
+ }
2972
+ function pr(e, t = 0) {
2802
2973
  return `${(e > -1 && e < 1 ? e * 100 : e).toFixed(t)}%`;
2803
2974
  }
2804
- function or(e) {
2975
+ function mr(e) {
2805
2976
  return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
2806
2977
  }
2807
- function sr(e) {
2808
- if (!e) return "—";
2809
- let t = typeof e == "string" ? new Date(e) : e;
2810
- if (isNaN(t.getTime())) return "—";
2978
+ function hr(e) {
2979
+ if (e == null || e === "") return "—";
2980
+ let t = e instanceof Date ? e : new Date(e);
2981
+ if (!(t instanceof Date) || isNaN(t.getTime())) return "—";
2811
2982
  let n = /* @__PURE__ */ new Date(), r = new Date(n.getFullYear(), n.getMonth(), n.getDate()), i = new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime() - r.getTime(), a = Math.round(i / (1e3 * 60 * 60 * 24));
2812
2983
  if (a === 0) return "Today";
2813
2984
  if (a === 1) return "Tomorrow";
2814
2985
  if (a === -1) return "Yesterday";
2815
2986
  if (a < -1) {
2816
2987
  let e = Math.abs(a);
2817
- return e <= 7 ? `Overdue ${e}d` : cr(t);
2988
+ return e <= 7 ? `Overdue ${e}d` : gr(t);
2818
2989
  }
2819
- return a > 1 && a <= 7 ? `In ${a} days` : cr(t);
2990
+ return a > 1 && a <= 7 ? `In ${a} days` : gr(t);
2820
2991
  }
2821
- function cr(e, t) {
2822
- if (!e) return "—";
2823
- let n = typeof e == "string" ? new Date(e) : e;
2824
- return isNaN(n.getTime()) ? "—" : t === "short" ? `${n.toLocaleDateString("en-US", { month: "short" })} ${n.getDate()}, '${String(n.getFullYear()).slice(-2)}` : t === "relative" ? sr(n) : n.toLocaleDateString(void 0, {
2992
+ function gr(e, t) {
2993
+ if (e == null || e === "") return "—";
2994
+ let n = e instanceof Date ? e : new Date(e);
2995
+ return !(n instanceof Date) || isNaN(n.getTime()) ? "—" : t === "short" ? `${n.toLocaleDateString("en-US", { month: "short" })} ${n.getDate()}, '${String(n.getFullYear()).slice(-2)}` : t === "relative" ? hr(n) : n.toLocaleDateString(void 0, {
2825
2996
  year: "numeric",
2826
2997
  month: "short",
2827
2998
  day: "numeric"
2828
2999
  });
2829
3000
  }
2830
- function lr(e) {
2831
- if (!e) return "—";
2832
- let t = typeof e == "string" ? new Date(e) : e;
2833
- return isNaN(t.getTime()) ? "—" : t.toLocaleDateString(void 0, {
3001
+ function _r(e) {
3002
+ if (e == null || e === "") return "—";
3003
+ let t = e instanceof Date ? e : new Date(e);
3004
+ return !(t instanceof Date) || isNaN(t.getTime()) ? "—" : t.toLocaleDateString(void 0, {
2834
3005
  year: "numeric",
2835
3006
  month: "short",
2836
3007
  day: "numeric",
@@ -2838,14 +3009,14 @@ function lr(e) {
2838
3009
  minute: "2-digit"
2839
3010
  });
2840
3011
  }
2841
- function ur({ value: e }) {
3012
+ function vr({ value: e }) {
2842
3013
  let t = Q(e);
2843
3014
  return t == null || t === "" ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ q("span", {
2844
3015
  className: "truncate",
2845
3016
  children: String(t)
2846
3017
  });
2847
3018
  }
2848
- function dr({ value: e, field: t }) {
3019
+ function yr({ value: e, field: t }) {
2849
3020
  if (e == null) return /* @__PURE__ */ q(S, {});
2850
3021
  let n = Q(e), r = t.precision ?? 0, i = Number(n);
2851
3022
  return /* @__PURE__ */ q("span", {
@@ -2856,27 +3027,27 @@ function dr({ value: e, field: t }) {
2856
3027
  }).format(i)
2857
3028
  });
2858
3029
  }
2859
- function fr({ value: e, field: t }) {
3030
+ function br({ value: e, field: t }) {
2860
3031
  if (e == null) return /* @__PURE__ */ q(S, {});
2861
- let n = Q(e), r = t.currency || "USD", i = Number(n);
3032
+ let n = Q(e), r = t, i = r.currency || r.defaultCurrency, a = Number(n), o = r.precision ?? r.scale ?? r.decimals ?? 2;
2862
3033
  return /* @__PURE__ */ q("span", {
2863
3034
  className: "tabular-nums font-medium whitespace-nowrap",
2864
- children: isNaN(i) ? String(n) : rr(i, r)
3035
+ children: isNaN(a) ? String(n) : i ? ur(a, i) : fr(a, o)
2865
3036
  });
2866
3037
  }
2867
- var pr = /progress|completion/;
2868
- function mr({ value: e, field: t }) {
3038
+ var xr = /progress|completion/;
3039
+ function Sr({ value: e, field: t }) {
2869
3040
  if (e == null) return /* @__PURE__ */ q(S, {});
2870
3041
  let n = Q(e), r = t.precision ?? 0, i = Number(n);
2871
3042
  if (isNaN(i)) return /* @__PURE__ */ q("span", {
2872
3043
  className: "tabular-nums whitespace-nowrap",
2873
3044
  children: String(n)
2874
3045
  });
2875
- let a = pr.test(t?.name?.toLowerCase() || ""), o = a ? i : i > -1 && i < 1 ? i * 100 : i, s = a ? `${i.toFixed(r)}%` : ar(i, r), c = Math.max(0, Math.min(100, o));
3046
+ let a = xr.test(t?.name?.toLowerCase() || ""), o = a ? i : i > -1 && i < 1 ? i * 100 : i, s = a ? `${i.toFixed(r)}%` : pr(i, r), c = Math.max(0, Math.min(100, o));
2876
3047
  return /* @__PURE__ */ J("div", {
2877
3048
  className: "flex items-center gap-2",
2878
3049
  children: [/* @__PURE__ */ q("div", {
2879
- className: "h-1.5 w-16 rounded-full bg-muted overflow-hidden shrink-0",
3050
+ className: "h-1.5 w-16 rounded-full bg-muted ring-1 ring-inset ring-border/60 overflow-hidden shrink-0",
2880
3051
  role: "progressbar",
2881
3052
  "aria-valuenow": c,
2882
3053
  "aria-valuemin": 0,
@@ -2891,7 +3062,7 @@ function mr({ value: e, field: t }) {
2891
3062
  })]
2892
3063
  });
2893
3064
  }
2894
- var hr = new Set([
3065
+ var Cr = new Set([
2895
3066
  "active",
2896
3067
  "is_active",
2897
3068
  "enabled",
@@ -2899,7 +3070,7 @@ var hr = new Set([
2899
3070
  "verified",
2900
3071
  "is_verified"
2901
3072
  ]);
2902
- function gr({ value: e, field: t }) {
3073
+ function wr({ value: e, field: t }) {
2903
3074
  if (e == null) return /* @__PURE__ */ q("span", {
2904
3075
  className: "flex items-center justify-center",
2905
3076
  children: /* @__PURE__ */ q(S, {})
@@ -2919,13 +3090,13 @@ function gr({ value: e, field: t }) {
2919
3090
  "aria-label": "Not completed",
2920
3091
  "data-testid": "completion-indicator"
2921
3092
  })
2922
- }) : hr.has(n) && !e ? /* @__PURE__ */ J(m, {
3093
+ }) : Cr.has(n) && !e ? /* @__PURE__ */ J(m, {
2923
3094
  variant: "destructive",
2924
3095
  className: "text-xs",
2925
3096
  "data-testid": "boolean-warning-badge",
2926
- children: [t?.label || or(n), " — Off"]
3097
+ children: [t?.label || mr(n), " — Off"]
2927
3098
  }) : /* @__PURE__ */ q("div", {
2928
- className: "flex items-center justify-center",
3099
+ className: "flex items-center justify-start",
2929
3100
  children: /* @__PURE__ */ q(g, {
2930
3101
  checked: !!e,
2931
3102
  disabled: !0,
@@ -2933,9 +3104,9 @@ function gr({ value: e, field: t }) {
2933
3104
  })
2934
3105
  });
2935
3106
  }
2936
- function _r({ value: e, field: t }) {
3107
+ function Tr({ value: e, field: t }) {
2937
3108
  if (!e) return /* @__PURE__ */ q(S, {});
2938
- let n = Q(e), r = t, i = cr(n, r.format || "relative"), a = typeof n == "string" ? new Date(n) : n, o = a instanceof Date && !isNaN(a.getTime()), s = /* @__PURE__ */ new Date();
3109
+ let n = Q(e), r = t, i = gr(n, r.format || "relative"), a = n == null ? null : new Date(n), o = a !== null && !isNaN(a.getTime()), s = /* @__PURE__ */ new Date();
2939
3110
  s.setHours(0, 0, 0, 0);
2940
3111
  let c = String(r?.name || r?.accessorKey || r?.key || "").toLowerCase(), l = (r?.dueLike === !0 || /(^|_)(due|deadline|expires?|expiry|expiration|expected_close|target_close|sla|return_by|renewal|next_action)(_|$)/.test(c)) && o && a < s, u = o ? a.toISOString() : String(n);
2941
3112
  return /* @__PURE__ */ q("span", {
@@ -2944,10 +3115,10 @@ function _r({ value: e, field: t }) {
2944
3115
  children: i
2945
3116
  });
2946
3117
  }
2947
- function vr({ value: e }) {
3118
+ function Er({ value: e }) {
2948
3119
  if (!e) return /* @__PURE__ */ q(S, {});
2949
- let t = Q(e), n = typeof t == "string" ? new Date(t) : t;
2950
- if (!(n instanceof Date) || isNaN(n.getTime())) return /* @__PURE__ */ q(S, {});
3120
+ let t = Q(e), n = t == null ? null : new Date(t);
3121
+ if (n === null || isNaN(n.getTime())) return /* @__PURE__ */ q(S, {});
2951
3122
  let r = n.toLocaleDateString(void 0, {
2952
3123
  month: "numeric",
2953
3124
  day: "numeric",
@@ -2965,7 +3136,7 @@ function vr({ value: e }) {
2965
3136
  })]
2966
3137
  });
2967
3138
  }
2968
- var yr = {
3139
+ var Dr = {
2969
3140
  critical: "red",
2970
3141
  urgent: "red",
2971
3142
  high: "orange",
@@ -2996,8 +3167,51 @@ var yr = {
2996
3167
  failed: "red",
2997
3168
  overdue: "red",
2998
3169
  delivered: "purple",
2999
- archived: "indigo"
3000
- }, br = {
3170
+ archived: "indigo",
3171
+ contacted: "blue",
3172
+ qualified: "purple",
3173
+ converted: "green",
3174
+ won: "green",
3175
+ lost: "red",
3176
+ 紧急: "red",
3177
+ 严重: "red",
3178
+ 高: "orange",
3179
+ 中: "yellow",
3180
+ 普通: "blue",
3181
+ 低: "gray",
3182
+ 无: "gray",
3183
+ 新建: "gray",
3184
+ 草稿: "gray",
3185
+ 待处理: "yellow",
3186
+ 待审核: "yellow",
3187
+ 待联系: "yellow",
3188
+ 挂起: "yellow",
3189
+ 进行中: "blue",
3190
+ 处理中: "blue",
3191
+ 已联系: "blue",
3192
+ 跟进中: "blue",
3193
+ 已发货: "blue",
3194
+ 打开: "blue",
3195
+ 已确认: "green",
3196
+ 已审核: "green",
3197
+ 已通过: "green",
3198
+ 已完成: "green",
3199
+ 已支付: "green",
3200
+ 已签收: "green",
3201
+ 已转化: "green",
3202
+ 成单: "green",
3203
+ 赢得: "green",
3204
+ 已签约: "green",
3205
+ 已交付: "purple",
3206
+ 已归档: "indigo",
3207
+ 已关闭: "gray",
3208
+ 已取消: "red",
3209
+ 已拒绝: "red",
3210
+ 失败: "red",
3211
+ 逾期: "red",
3212
+ 流失: "red",
3213
+ 丢失: "red"
3214
+ }, Or = {
3001
3215
  gray: "bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800/50 dark:text-gray-200 dark:border-gray-700/60",
3002
3216
  red: "bg-red-50 text-red-700 border-red-200 dark:bg-red-950/40 dark:text-red-300 dark:border-red-900/60",
3003
3217
  orange: "bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-950/40 dark:text-orange-300 dark:border-orange-900/60",
@@ -3007,7 +3221,17 @@ var yr = {
3007
3221
  indigo: "bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-950/40 dark:text-indigo-300 dark:border-indigo-900/60",
3008
3222
  purple: "bg-purple-50 text-purple-700 border-purple-200 dark:bg-purple-950/40 dark:text-purple-300 dark:border-purple-900/60",
3009
3223
  pink: "bg-pink-50 text-pink-700 border-pink-200 dark:bg-pink-950/40 dark:text-pink-300 dark:border-pink-900/60"
3010
- }, xr = [
3224
+ }, kr = {
3225
+ gray: "bg-gray-400 dark:bg-gray-500",
3226
+ red: "bg-red-500",
3227
+ orange: "bg-orange-500",
3228
+ yellow: "bg-yellow-500",
3229
+ green: "bg-green-500",
3230
+ blue: "bg-blue-500",
3231
+ indigo: "bg-indigo-500",
3232
+ purple: "bg-purple-500",
3233
+ pink: "bg-pink-500"
3234
+ }, Ar = [
3011
3235
  "blue",
3012
3236
  "green",
3013
3237
  "purple",
@@ -3017,41 +3241,70 @@ var yr = {
3017
3241
  "yellow",
3018
3242
  "red"
3019
3243
  ];
3020
- function Sr(e) {
3244
+ function jr(e) {
3021
3245
  let t = 5381;
3022
3246
  for (let n = 0; n < e.length; n++) t = (t << 5) + t ^ e.charCodeAt(n);
3023
- return xr[Math.abs(t) % xr.length];
3247
+ return Ar[Math.abs(t) % Ar.length];
3024
3248
  }
3025
- function Cr(e, t) {
3026
- if (e && br[e]) return br[e];
3249
+ function Mr(e, t) {
3250
+ if (e && Or[e]) return Or[e];
3027
3251
  if (t == null || t === "") return "bg-muted text-muted-foreground border-border";
3028
- let n = String(t).toLowerCase().replace(/[\s-]/g, "_"), r = yr[n];
3029
- return r && br[r] ? br[r] : br[Sr(n)];
3252
+ let n = String(t).toLowerCase().replace(/[\s-]/g, "_"), r = Dr[n];
3253
+ return r && Or[r] ? Or[r] : Or[jr(n)];
3254
+ }
3255
+ function Nr(e, t) {
3256
+ if (e && Or[e]) return e;
3257
+ if (t == null || t === "") return;
3258
+ let n = String(t).toLowerCase().replace(/[\s-]/g, "_");
3259
+ return Dr[n] || jr(n);
3260
+ }
3261
+ var Pr = {
3262
+ gray: "#6b7280",
3263
+ red: "#ef4444",
3264
+ orange: "#f97316",
3265
+ yellow: "#eab308",
3266
+ green: "#22c55e",
3267
+ blue: "#3b82f6",
3268
+ indigo: "#6366f1",
3269
+ purple: "#a855f7",
3270
+ pink: "#ec4899"
3271
+ };
3272
+ function Fr(e, t = "#3b82f6") {
3273
+ return e ? Pr[e] ?? t : t;
3030
3274
  }
3031
- function wr({ value: e, field: t }) {
3032
- let n = t.options || [];
3275
+ function Ir({ value: e, field: t }) {
3276
+ let n = t, r = n.options || [], i = n.appearance === "dot" ? "dot" : "badge";
3033
3277
  if (e == null || e === "") return /* @__PURE__ */ q(S, {});
3034
- if (Array.isArray(e)) return /* @__PURE__ */ q("div", {
3035
- className: "flex flex-wrap gap-1",
3036
- children: e.map((e, t) => {
3037
- let r = n.find((t) => t.value === e), i = r?.label || or(String(e));
3038
- return /* @__PURE__ */ q(m, {
3039
- variant: "outline",
3040
- className: Cr(r?.color, e),
3041
- children: i
3042
- }, t);
3043
- })
3044
- });
3045
- let r = n.find((t) => t.value === e), i = r?.label || or(String(e));
3046
- return /* @__PURE__ */ q(m, {
3047
- variant: "outline",
3048
- className: Cr(r?.color, e),
3049
- children: i
3050
- });
3278
+ let a = (e) => {
3279
+ let t = r.find((t) => t.value === e);
3280
+ if (t) return t;
3281
+ let n = String(e).toLowerCase();
3282
+ return r.find((e) => String(e.value).toLowerCase() === n);
3283
+ }, o = (e, t) => {
3284
+ let n = a(e), r = n?.label || mr(String(e));
3285
+ return i === "dot" ? /* @__PURE__ */ J("span", {
3286
+ className: "inline-flex items-center gap-1.5 text-sm",
3287
+ children: [/* @__PURE__ */ q("span", {
3288
+ className: P("h-1.5 w-1.5 rounded-full shrink-0", kr[n?.color || Dr[String(e).toLowerCase().replace(/[\s-]/g, "_")] || jr(String(e).toLowerCase().replace(/[\s-]/g, "_"))] || kr.gray),
3289
+ "aria-hidden": "true"
3290
+ }), /* @__PURE__ */ q("span", {
3291
+ className: "truncate",
3292
+ children: r
3293
+ })]
3294
+ }, t) : /* @__PURE__ */ q(m, {
3295
+ variant: "outline",
3296
+ className: Mr(n?.color, e),
3297
+ children: r
3298
+ }, t);
3299
+ };
3300
+ return Array.isArray(e) ? /* @__PURE__ */ q("div", {
3301
+ className: P("flex flex-wrap", i === "dot" ? "gap-x-3 gap-y-1" : "gap-1"),
3302
+ children: e.map((e, t) => o(e, t))
3303
+ }) : o(e);
3051
3304
  }
3052
- function Tr({ value: t }) {
3305
+ function Lr({ value: t }) {
3053
3306
  if (!t) return /* @__PURE__ */ q(S, {});
3054
- let n = String(Q(t) ?? ""), [r, i] = e.useState(!1);
3307
+ let n = lr(), r = String(Q(t) ?? ""), [i, a] = e.useState(!1);
3055
3308
  return /* @__PURE__ */ J("span", {
3056
3309
  className: "inline-flex items-center gap-1 group/email",
3057
3310
  children: [/* @__PURE__ */ q(h, {
@@ -3059,24 +3312,24 @@ function Tr({ value: t }) {
3059
3312
  className: "p-0 h-auto font-normal text-blue-600 hover:text-blue-800",
3060
3313
  asChild: !0,
3061
3314
  children: /* @__PURE__ */ q("a", {
3062
- href: `mailto:${n}`,
3315
+ href: `mailto:${r}`,
3063
3316
  onClick: (e) => e.stopPropagation(),
3064
- children: n
3317
+ children: r
3065
3318
  })
3066
3319
  }), /* @__PURE__ */ q("button", {
3067
3320
  type: "button",
3068
3321
  className: "opacity-0 group-hover/email:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
3069
3322
  onClick: (e) => {
3070
- e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(n).then(() => {
3071
- i(!0), setTimeout(() => i(!1), 2e3);
3323
+ e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(r).then(() => {
3324
+ a(!0), setTimeout(() => a(!1), 2e3);
3072
3325
  }).catch(() => {});
3073
3326
  },
3074
- "aria-label": "Copy email",
3075
- children: r ? /* @__PURE__ */ q(I, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ q(L, { className: "h-3 w-3 text-muted-foreground" })
3327
+ "aria-label": n("detail.copyEmail", "Copy email"),
3328
+ children: i ? /* @__PURE__ */ q(I, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ q(L, { className: "h-3 w-3 text-muted-foreground" })
3076
3329
  })]
3077
3330
  });
3078
3331
  }
3079
- function Er({ value: e }) {
3332
+ function Rr({ value: e }) {
3080
3333
  if (!e) return /* @__PURE__ */ q(S, {});
3081
3334
  let t = String(Q(e) ?? "");
3082
3335
  return /* @__PURE__ */ q(h, {
@@ -3092,30 +3345,30 @@ function Er({ value: e }) {
3092
3345
  })
3093
3346
  });
3094
3347
  }
3095
- function Dr({ value: t }) {
3348
+ function zr({ value: t }) {
3096
3349
  if (!t) return /* @__PURE__ */ q(S, {});
3097
- let n = String(Q(t) ?? ""), [r, i] = e.useState(!1);
3350
+ let n = lr(), r = String(Q(t) ?? ""), [i, a] = e.useState(!1);
3098
3351
  return /* @__PURE__ */ J("span", {
3099
3352
  className: "inline-flex items-center gap-1 group/phone",
3100
3353
  children: [/* @__PURE__ */ J("a", {
3101
- href: `tel:${n}`,
3354
+ href: `tel:${r}`,
3102
3355
  className: "inline-flex items-center gap-1 text-blue-600 hover:text-blue-800",
3103
3356
  onClick: (e) => e.stopPropagation(),
3104
- children: [/* @__PURE__ */ q(xe, { className: "h-3 w-3" }), n]
3357
+ children: [/* @__PURE__ */ q(Se, { className: "h-3 w-3" }), r]
3105
3358
  }), /* @__PURE__ */ q("button", {
3106
3359
  type: "button",
3107
3360
  className: "opacity-0 group-hover/phone:opacity-100 transition-opacity p-0.5 rounded hover:bg-muted",
3108
3361
  onClick: (e) => {
3109
- e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(n).then(() => {
3110
- i(!0), setTimeout(() => i(!1), 2e3);
3362
+ e.stopPropagation(), e.preventDefault(), navigator.clipboard.writeText(r).then(() => {
3363
+ a(!0), setTimeout(() => a(!1), 2e3);
3111
3364
  }).catch(() => {});
3112
3365
  },
3113
- "aria-label": "Copy phone number",
3114
- children: r ? /* @__PURE__ */ q(I, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ q(L, { className: "h-3 w-3 text-muted-foreground" })
3366
+ "aria-label": n("detail.copyPhone", "Copy phone number"),
3367
+ children: i ? /* @__PURE__ */ q(I, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ q(L, { className: "h-3 w-3 text-muted-foreground" })
3115
3368
  })]
3116
3369
  });
3117
3370
  }
3118
- function Or({ value: e, field: t }) {
3371
+ function Br({ value: e, field: t }) {
3119
3372
  if (!e) return /* @__PURE__ */ q(S, {});
3120
3373
  if (t.multiple, Array.isArray(e)) {
3121
3374
  let t = e.length;
@@ -3133,7 +3386,7 @@ function Or({ value: e, field: t }) {
3133
3386
  children: e.name || e.original_name || "File"
3134
3387
  });
3135
3388
  }
3136
- function kr({ value: e }) {
3389
+ function Vr({ value: e }) {
3137
3390
  return e ? Array.isArray(e) ? /* @__PURE__ */ J("div", {
3138
3391
  className: "flex -space-x-2",
3139
3392
  children: [e.slice(0, 3).map((e, t) => /* @__PURE__ */ q("img", {
@@ -3150,40 +3403,64 @@ function kr({ value: e }) {
3150
3403
  className: "size-10 rounded-md object-cover"
3151
3404
  }) : /* @__PURE__ */ q(S, {});
3152
3405
  }
3153
- function Ar({ value: e, field: t }) {
3406
+ function Hr({ value: e, field: t }) {
3407
+ let n = t.reference_to, r = (() => {
3408
+ if (Array.isArray(e)) return e.find((e) => e != null && (typeof e == "string" || typeof e == "number") && e !== "");
3409
+ if (e != null && e !== "" && (typeof e == "string" || typeof e == "number") && typeof e != "object") return e;
3410
+ })(), i = cr(n, r);
3154
3411
  if (e == null || e === "") return /* @__PURE__ */ q(S, {});
3155
- let n = t.options || [], r = (e) => {
3156
- if (n.length > 0) {
3157
- let t = n.find((t) => String(t.value) === String(e));
3158
- if (t) return t.label;
3412
+ let a = t.options || [], o = (e) => {
3413
+ if (a.length > 0) {
3414
+ let t = a.find((t) => String(t.value) === String(e));
3415
+ if (t) return {
3416
+ text: t.label,
3417
+ muted: !1
3418
+ };
3159
3419
  }
3160
- return String(e);
3420
+ return e === r && i ? {
3421
+ text: i,
3422
+ muted: !1
3423
+ } : sr(e) ? {
3424
+ text: "—",
3425
+ muted: !0
3426
+ } : {
3427
+ text: String(e),
3428
+ muted: !1
3429
+ };
3161
3430
  };
3162
- return Array.isArray(e) ? /* @__PURE__ */ q("div", {
3431
+ if (Array.isArray(e)) return /* @__PURE__ */ q("div", {
3163
3432
  className: "flex flex-wrap gap-1",
3164
3433
  children: e.map((e, t) => {
3165
- let n;
3166
- return n = typeof e == "object" && e ? e.name || e.label || e.id || e._id || String(e) : r(e), /* @__PURE__ */ q("span", {
3167
- className: "inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-50 text-gray-700 dark:bg-gray-800/50 dark:text-gray-200",
3434
+ let n, r = !1;
3435
+ if (typeof e == "object" && e) n = or(e) || String(e.id || e._id || "[Object]");
3436
+ else {
3437
+ let t = o(e);
3438
+ n = t.text, r = t.muted;
3439
+ }
3440
+ return /* @__PURE__ */ q("span", {
3441
+ className: P("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium", r ? "bg-muted/40 text-muted-foreground" : "bg-gray-50 text-gray-700 dark:bg-gray-800/50 dark:text-gray-200"),
3168
3442
  children: n
3169
3443
  }, t);
3170
3444
  })
3171
- }) : typeof e == "object" && e ? /* @__PURE__ */ q("span", {
3172
- className: "truncate",
3173
- children: e.name || e.label || e.id || e._id || "[Object]"
3174
- }) : /* @__PURE__ */ q("span", {
3445
+ });
3446
+ if (typeof e == "object" && e) return /* @__PURE__ */ q("span", {
3175
3447
  className: "truncate",
3176
- children: r(e)
3448
+ children: or(e) || String(e.id || e._id || "[Object]")
3449
+ });
3450
+ let { text: s, muted: c } = o(e);
3451
+ return /* @__PURE__ */ q("span", {
3452
+ className: P("truncate", c && "text-muted-foreground"),
3453
+ children: s
3177
3454
  });
3178
3455
  }
3179
- function jr({ value: e }) {
3456
+ function Ur({ value: e }) {
3180
3457
  let t = Q(e);
3181
3458
  return t == null || t === "" ? /* @__PURE__ */ q(S, {}) : /* @__PURE__ */ q("span", {
3182
3459
  className: "text-gray-700 font-mono text-sm",
3183
3460
  children: String(t)
3184
3461
  });
3185
3462
  }
3186
- function Mr({ value: e }) {
3463
+ function Wr({ value: e }) {
3187
3464
  if (!e) return /* @__PURE__ */ q(S, {});
3188
3465
  if (typeof e != "object") return /* @__PURE__ */ q("span", {
3189
3466
  className: "truncate",
@@ -3228,39 +3505,64 @@ function Mr({ value: e }) {
3228
3505
  })]
3229
3506
  });
3230
3507
  }
3231
- var Nr = /* @__PURE__ */ new Map();
3232
- function Pr(e, t) {
3233
- Nr.set(e, t);
3234
- }
3235
- function Fr(e) {
3236
- return Nr.has(e) ? Nr.get(e) : {
3237
- text: ur,
3238
- textarea: ur,
3239
- markdown: ur,
3240
- html: ur,
3241
- number: dr,
3242
- currency: fr,
3243
- percent: mr,
3244
- boolean: gr,
3245
- date: _r,
3246
- datetime: vr,
3247
- time: ur,
3248
- select: wr,
3249
- status: wr,
3250
- lookup: Ar,
3251
- master_detail: Ar,
3252
- email: Tr,
3253
- url: Er,
3254
- phone: Dr,
3255
- file: Or,
3256
- image: kr,
3257
- formula: jr,
3258
- summary: jr,
3259
- auto_number: ur,
3260
- user: Mr,
3261
- owner: Mr,
3508
+ var Gr = /* @__PURE__ */ new Map();
3509
+ function Kr(e, t) {
3510
+ Gr.set(e, t);
3511
+ }
3512
+ var qr = {
3513
+ phone: "phone",
3514
+ tel: "phone",
3515
+ telephone: "phone",
3516
+ email: "email",
3517
+ url: "url",
3518
+ uri: "url",
3519
+ link: "url",
3520
+ currency: "currency",
3521
+ money: "currency",
3522
+ percent: "percent",
3523
+ percentage: "percent"
3524
+ }, Jr = new Set([
3525
+ "text",
3526
+ "textarea",
3527
+ "string",
3528
+ "longtext",
3529
+ ""
3530
+ ]);
3531
+ function Yr(e) {
3532
+ if (!e) return "text";
3533
+ if (typeof e == "string") return e;
3534
+ let t = (e.type || "").toLowerCase(), n = e.format, r = typeof n == "string" ? n.toLowerCase() : "";
3535
+ return r && qr[r] && Jr.has(t) ? qr[r] : e.type || "text";
3536
+ }
3537
+ function Xr(e) {
3538
+ return Gr.has(e) ? Gr.get(e) : {
3539
+ text: vr,
3540
+ textarea: vr,
3541
+ markdown: vr,
3542
+ html: vr,
3543
+ number: yr,
3544
+ currency: br,
3545
+ percent: Sr,
3546
+ boolean: wr,
3547
+ date: Tr,
3548
+ datetime: Er,
3549
+ time: vr,
3550
+ select: Ir,
3551
+ status: Ir,
3552
+ lookup: Hr,
3553
+ master_detail: Hr,
3554
+ email: Lr,
3555
+ url: Rr,
3556
+ phone: zr,
3557
+ file: Br,
3558
+ image: Vr,
3559
+ formula: Ur,
3560
+ summary: Ur,
3561
+ auto_number: vr,
3562
+ user: Wr,
3563
+ owner: Wr,
3262
3564
  password: () => /* @__PURE__ */ q("span", { children: "••••••" }),
3263
- location: ur,
3565
+ location: vr,
3264
3566
  object: () => /* @__PURE__ */ q("span", {
3265
3567
  className: "text-gray-500 italic",
3266
3568
  children: "[Object]"
@@ -3273,10 +3575,10 @@ function Fr(e) {
3273
3575
  className: "text-gray-500 italic",
3274
3576
  children: "[Grid]"
3275
3577
  })
3276
- }[e] || ur;
3578
+ }[e] || vr;
3277
3579
  }
3278
- Pr("lookup", Ar), Pr("master_detail", Ar), Pr("select", wr), Pr("status", wr), Pr("user", Mr), Pr("owner", Mr), Tt(Fr);
3279
- function Ir(e) {
3580
+ Kr("lookup", Hr), Kr("master_detail", Hr), Kr("select", Ir), Kr("status", Ir), Kr("user", Wr), Kr("owner", Wr), Et(Xr);
3581
+ function Zr(e) {
3280
3582
  return {
3281
3583
  text: "field:text",
3282
3584
  textarea: "field:textarea",
@@ -3304,7 +3606,7 @@ function Ir(e) {
3304
3606
  auto_number: "field:auto_number"
3305
3607
  }[e] || "field:text";
3306
3608
  }
3307
- function Lr(e) {
3609
+ function Qr(e) {
3308
3610
  if (e < 0 || !Number.isFinite(e) || e === 0) return "0 B";
3309
3611
  let t = [
3310
3612
  "B",
@@ -3316,7 +3618,7 @@ function Lr(e) {
3316
3618
  for (; n >= 1024 && r < t.length - 1;) n /= 1024, r++;
3317
3619
  return `${n.toFixed(+(r > 0))} ${t[r]}`;
3318
3620
  }
3319
- function Rr(e) {
3621
+ function $r(e) {
3320
3622
  let t = {};
3321
3623
  return e.required && (t.required = typeof e.required_message == "string" ? e.required_message : `${e.label || e.name} is required`), e.min_length && (t.minLength = {
3322
3624
  value: e.min_length,
@@ -3341,7 +3643,7 @@ function Rr(e) {
3341
3643
  message: "Please enter a valid URL"
3342
3644
  }), e.validate && (t.validate = e.validate), Object.keys(t).length > 0 ? t : void 0;
3343
3645
  }
3344
- function zr(e, t) {
3646
+ function ei(e, t) {
3345
3647
  if (!e) return !0;
3346
3648
  if (e.field && e.value !== void 0) {
3347
3649
  let n = t[e.field];
@@ -3353,7 +3655,7 @@ function zr(e, t) {
3353
3655
  if (e.operator === "<=") return n <= e.value;
3354
3656
  if (e.operator === "in") return Array.isArray(e.value) && e.value.includes(n);
3355
3657
  }
3356
- return e.and && Array.isArray(e.and) ? e.and.every((e) => zr(e, t)) : e.or && Array.isArray(e.or) ? e.or.some((e) => zr(e, t)) : !0;
3658
+ return e.and && Array.isArray(e.and) ? e.and.every((e) => ei(e, t)) : e.or && Array.isArray(e.or) ? e.or.some((e) => ei(e, t)) : !0;
3357
3659
  }
3358
3660
  function $(t) {
3359
3661
  let n = ({ schema: n, className: r, value: i, ...a }) => {
@@ -3397,48 +3699,48 @@ function $(t) {
3397
3699
  };
3398
3700
  return n.displayName = `FieldRenderer(${t.displayName || t.name || "Component"})`, n;
3399
3701
  }
3400
- var Br = {
3401
- text: () => Promise.resolve().then(() => (Fe(), Ne)).then((e) => ({ default: e.TextField })),
3402
- textarea: () => Promise.resolve().then(() => (ft(), ut)).then((e) => ({ default: e.TextAreaField })),
3403
- number: () => Promise.resolve().then(() => (Re(), Ie)).then((e) => ({ default: e.NumberField })),
3404
- boolean: () => Promise.resolve().then(() => (Ve(), ze)).then((e) => ({ default: e.BooleanField })),
3405
- select: () => Promise.resolve().then(() => (qe(), Ge)).then((e) => ({ default: e.SelectField })),
3406
- date: () => Promise.resolve().then(() => (Xe(), Je)).then((e) => ({ default: e.DateField })),
3407
- datetime: () => Promise.resolve().then(() => (Rt(), It)).then((e) => ({ default: e.DateTimeField })),
3408
- time: () => Promise.resolve().then(() => (Vt(), zt)).then((e) => ({ default: e.TimeField })),
3409
- email: () => Promise.resolve().then(() => ($e(), Ze)).then((e) => ({ default: e.EmailField })),
3410
- phone: () => Promise.resolve().then(() => (nt(), et)).then((e) => ({ default: e.PhoneField })),
3411
- url: () => Promise.resolve().then(() => (at(), rt)).then((e) => ({ default: e.UrlField })),
3412
- currency: () => Promise.resolve().then(() => (lt(), ot)).then((e) => ({ default: e.CurrencyField })),
3413
- percent: () => Promise.resolve().then(() => (Wt(), Ht)).then((e) => ({ default: e.PercentField })),
3414
- password: () => Promise.resolve().then(() => (qt(), Gt)).then((e) => ({ default: e.PasswordField })),
3415
- markdown: () => Promise.resolve().then(() => (ht(), pt)).then((e) => ({ default: e.RichTextField })),
3416
- html: () => Promise.resolve().then(() => (ht(), pt)).then((e) => ({ default: e.RichTextField })),
3417
- lookup: () => Promise.resolve().then(() => (Ft(), kt)).then((e) => ({ default: e.LookupField })),
3418
- master_detail: () => Promise.resolve().then(() => (Ft(), kt)).then((e) => ({ default: e.LookupField })),
3419
- file: () => Promise.resolve().then(() => (Xt(), Jt)).then((e) => ({ default: e.FileField })),
3420
- image: () => Promise.resolve().then(() => (rn(), en)).then((e) => ({ default: e.ImageField })),
3421
- location: () => Promise.resolve().then(() => (sn(), an)).then((e) => ({ default: e.LocationField })),
3422
- formula: () => Promise.resolve().then(() => (un(), cn)).then((e) => ({ default: e.FormulaField })),
3423
- summary: () => Promise.resolve().then(() => (pn(), dn)).then((e) => ({ default: e.SummaryField })),
3424
- auto_number: () => Promise.resolve().then(() => (gn(), mn)).then((e) => ({ default: e.AutoNumberField })),
3425
- user: () => Promise.resolve().then(() => (yn(), _n)).then((e) => ({ default: e.UserField })),
3426
- owner: () => Promise.resolve().then(() => (yn(), _n)).then((e) => ({ default: e.UserField })),
3427
- object: () => Promise.resolve().then(() => (Sn(), bn)).then((e) => ({ default: e.ObjectField })),
3428
- vector: () => Promise.resolve().then(() => (Tn(), Cn)).then((e) => ({ default: e.VectorField })),
3429
- grid: () => Promise.resolve().then(() => (On(), En)).then((e) => ({ default: e.GridField })),
3430
- color: () => Promise.resolve().then(() => (jn(), kn)).then((e) => ({ default: e.ColorField })),
3431
- slider: () => Promise.resolve().then(() => (Pn(), Mn)).then((e) => ({ default: e.SliderField })),
3432
- rating: () => Promise.resolve().then(() => (Ln(), Fn)).then((e) => ({ default: e.RatingField })),
3433
- code: () => Promise.resolve().then(() => (Bn(), Rn)).then((e) => ({ default: e.CodeField })),
3434
- avatar: () => Promise.resolve().then(() => (Un(), Vn)).then((e) => ({ default: e.AvatarField })),
3435
- address: () => Promise.resolve().then(() => (Kn(), Wn)).then((e) => ({ default: e.AddressField })),
3436
- geolocation: () => Promise.resolve().then(() => (Yn(), qn)).then((e) => ({ default: e.GeolocationField })),
3437
- signature: () => Promise.resolve().then(() => (Qn(), Xn)).then((e) => ({ default: e.SignatureField })),
3438
- qrcode: () => Promise.resolve().then(() => (tr(), $n)).then((e) => ({ default: e.QRCodeField }))
3702
+ var ti = {
3703
+ text: () => Promise.resolve().then(() => (Le(), Fe)).then((e) => ({ default: e.TextField })),
3704
+ textarea: () => Promise.resolve().then(() => (pt(), dt)).then((e) => ({ default: e.TextAreaField })),
3705
+ number: () => Promise.resolve().then(() => (Be(), Re)).then((e) => ({ default: e.NumberField })),
3706
+ boolean: () => Promise.resolve().then(() => (He(), Ve)).then((e) => ({ default: e.BooleanField })),
3707
+ select: () => Promise.resolve().then(() => (Je(), Ke)).then((e) => ({ default: e.SelectField })),
3708
+ date: () => Promise.resolve().then(() => (Ze(), Ye)).then((e) => ({ default: e.DateField })),
3709
+ datetime: () => Promise.resolve().then(() => (Bt(), Rt)).then((e) => ({ default: e.DateTimeField })),
3710
+ time: () => Promise.resolve().then(() => (Ut(), Vt)).then((e) => ({ default: e.TimeField })),
3711
+ email: () => Promise.resolve().then(() => (et(), Qe)).then((e) => ({ default: e.EmailField })),
3712
+ phone: () => Promise.resolve().then(() => (rt(), tt)).then((e) => ({ default: e.PhoneField })),
3713
+ url: () => Promise.resolve().then(() => (ot(), it)).then((e) => ({ default: e.UrlField })),
3714
+ currency: () => Promise.resolve().then(() => (ut(), st)).then((e) => ({ default: e.CurrencyField })),
3715
+ percent: () => Promise.resolve().then(() => (Kt(), Wt)).then((e) => ({ default: e.PercentField })),
3716
+ password: () => Promise.resolve().then(() => (Yt(), qt)).then((e) => ({ default: e.PasswordField })),
3717
+ markdown: () => Promise.resolve().then(() => (gt(), mt)).then((e) => ({ default: e.RichTextField })),
3718
+ html: () => Promise.resolve().then(() => (gt(), mt)).then((e) => ({ default: e.RichTextField })),
3719
+ lookup: () => Promise.resolve().then(() => (Lt(), At)).then((e) => ({ default: e.LookupField })),
3720
+ master_detail: () => Promise.resolve().then(() => (Lt(), At)).then((e) => ({ default: e.LookupField })),
3721
+ file: () => Promise.resolve().then(() => (Qt(), Xt)).then((e) => ({ default: e.FileField })),
3722
+ image: () => Promise.resolve().then(() => (on(), nn)).then((e) => ({ default: e.ImageField })),
3723
+ location: () => Promise.resolve().then(() => (ln(), sn)).then((e) => ({ default: e.LocationField })),
3724
+ formula: () => Promise.resolve().then(() => (fn(), un)).then((e) => ({ default: e.FormulaField })),
3725
+ summary: () => Promise.resolve().then(() => (hn(), pn)).then((e) => ({ default: e.SummaryField })),
3726
+ auto_number: () => Promise.resolve().then(() => (vn(), gn)).then((e) => ({ default: e.AutoNumberField })),
3727
+ user: () => Promise.resolve().then(() => (xn(), yn)).then((e) => ({ default: e.UserField })),
3728
+ owner: () => Promise.resolve().then(() => (xn(), yn)).then((e) => ({ default: e.UserField })),
3729
+ object: () => Promise.resolve().then(() => (wn(), Sn)).then((e) => ({ default: e.ObjectField })),
3730
+ vector: () => Promise.resolve().then(() => (Dn(), Tn)).then((e) => ({ default: e.VectorField })),
3731
+ grid: () => Promise.resolve().then(() => (An(), On)).then((e) => ({ default: e.GridField })),
3732
+ color: () => Promise.resolve().then(() => (Nn(), jn)).then((e) => ({ default: e.ColorField })),
3733
+ slider: () => Promise.resolve().then(() => (In(), Pn)).then((e) => ({ default: e.SliderField })),
3734
+ rating: () => Promise.resolve().then(() => (zn(), Ln)).then((e) => ({ default: e.RatingField })),
3735
+ code: () => Promise.resolve().then(() => (Hn(), Bn)).then((e) => ({ default: e.CodeField })),
3736
+ avatar: () => Promise.resolve().then(() => (Gn(), Un)).then((e) => ({ default: e.AvatarField })),
3737
+ address: () => Promise.resolve().then(() => (Jn(), Kn)).then((e) => ({ default: e.AddressField })),
3738
+ geolocation: () => Promise.resolve().then(() => (Zn(), Yn)).then((e) => ({ default: e.GeolocationField })),
3739
+ signature: () => Promise.resolve().then(() => (er(), Qn)).then((e) => ({ default: e.SignatureField })),
3740
+ qrcode: () => Promise.resolve().then(() => (rr(), tr)).then((e) => ({ default: e.QRCodeField }))
3439
3741
  };
3440
- function Vr(t) {
3441
- let n = Br[t];
3742
+ function ni(t) {
3743
+ let n = ti[t];
3442
3744
  if (!n) {
3443
3745
  console.warn(`Unknown field type: ${t}`);
3444
3746
  return;
@@ -3446,14 +3748,14 @@ function Vr(t) {
3446
3748
  let r = e.lazy(n);
3447
3749
  u.register(t, r, { namespace: "field" });
3448
3750
  }
3449
- function Hr() {
3450
- Object.keys(Br).forEach((e) => {
3451
- Vr(e);
3751
+ function ri() {
3752
+ Object.keys(ti).forEach((e) => {
3753
+ ni(e);
3452
3754
  });
3453
3755
  }
3454
- function Ur() {
3455
- u.register("text", $(Pe), { namespace: "field" }), u.register("textarea", $(dt), { namespace: "field" }), u.register("number", $(Le), { namespace: "field" }), u.register("boolean", $(Be), { namespace: "field" }), u.register("select", $(Ke), { namespace: "field" }), u.register("date", $(Ye), { namespace: "field" }), u.register("datetime", $(Lt), { namespace: "field" }), u.register("time", $(Bt), { namespace: "field" }), u.register("email", $(Qe), { namespace: "field" }), u.register("phone", $(tt), { namespace: "field" }), u.register("url", $(it), { namespace: "field" }), u.register("currency", $(ct), { namespace: "field" }), u.register("percent", $(Ut), { namespace: "field" }), u.register("password", $(Kt), { namespace: "field" }), u.register("markdown", $(mt), { namespace: "field" }), u.register("html", $(mt), { namespace: "field" }), u.register("lookup", $(Mt), { namespace: "field" }), u.register("master_detail", $(Mt), { namespace: "field" }), u.register("file", $(Yt), { namespace: "field" }), u.register("image", $(tn), { namespace: "field" }), u.register("location", $(on), { namespace: "field" }), u.register("formula", $(ln), { namespace: "field" }), u.register("summary", $(fn), { namespace: "field" }), u.register("auto_number", $(hn), { namespace: "field" }), u.register("user", $(vn), { namespace: "field" }), u.register("owner", $(vn), { namespace: "field" }), u.register("object", $(xn), { namespace: "field" }), u.register("vector", $(wn), { namespace: "field" }), u.register("grid", $(Dn), { namespace: "field" }), u.register("color", $(An), { namespace: "field" }), u.register("slider", $(Nn), { namespace: "field" }), u.register("rating", $(In), { namespace: "field" }), u.register("code", $(zn), { namespace: "field" }), u.register("avatar", $(Hn), { namespace: "field" }), u.register("address", $(Gn), { namespace: "field" }), u.register("geolocation", $(Jn), { namespace: "field" }), u.register("signature", $(Zn), { namespace: "field" }), u.register("qrcode", $(er), { namespace: "field" });
3756
+ function ii() {
3757
+ u.register("text", $(Ie), { namespace: "field" }), u.register("textarea", $(ft), { namespace: "field" }), u.register("number", $(ze), { namespace: "field" }), u.register("boolean", $(Z), { namespace: "field" }), u.register("select", $(qe), { namespace: "field" }), u.register("date", $(Xe), { namespace: "field" }), u.register("datetime", $(zt), { namespace: "field" }), u.register("time", $(Ht), { namespace: "field" }), u.register("email", $($e), { namespace: "field" }), u.register("phone", $(nt), { namespace: "field" }), u.register("url", $(at), { namespace: "field" }), u.register("currency", $(lt), { namespace: "field" }), u.register("percent", $(Gt), { namespace: "field" }), u.register("password", $(Jt), { namespace: "field" }), u.register("markdown", $(ht), { namespace: "field" }), u.register("html", $(ht), { namespace: "field" }), u.register("lookup", $(Pt), { namespace: "field" }), u.register("master_detail", $(Pt), { namespace: "field" }), u.register("file", $(Zt), { namespace: "field" }), u.register("image", $(rn), { namespace: "field" }), u.register("location", $(cn), { namespace: "field" }), u.register("formula", $(dn), { namespace: "field" }), u.register("summary", $(mn), { namespace: "field" }), u.register("auto_number", $(_n), { namespace: "field" }), u.register("user", $(bn), { namespace: "field" }), u.register("owner", $(bn), { namespace: "field" }), u.register("object", $(Cn), { namespace: "field" }), u.register("vector", $(En), { namespace: "field" }), u.register("grid", $(kn), { namespace: "field" }), u.register("color", $(Mn), { namespace: "field" }), u.register("slider", $(Fn), { namespace: "field" }), u.register("rating", $(Rn), { namespace: "field" }), u.register("code", $(Vn), { namespace: "field" }), u.register("avatar", $(Wn), { namespace: "field" }), u.register("address", $(qn), { namespace: "field" }), u.register("geolocation", $(Xn), { namespace: "field" }), u.register("signature", $($n), { namespace: "field" }), u.register("qrcode", $(nr), { namespace: "field" });
3456
3758
  }
3457
- Hr();
3759
+ ri();
3458
3760
  //#endregion
3459
- export { Gn as AddressField, hn as AutoNumberField, Hn as AvatarField, gr as BooleanCellRenderer, Be as BooleanField, zn as CodeField, An as ColorField, fr as CurrencyCellRenderer, ct as CurrencyField, _r as DateCellRenderer, Ye as DateField, vr as DateTimeCellRenderer, Lt as DateTimeField, Tr as EmailCellRenderer, Qe as EmailField, Or as FileCellRenderer, Yt as FileField, jr as FormulaCellRenderer, ln as FormulaField, Jn as GeolocationField, Dn as GridField, kr as ImageCellRenderer, Qt as ImageCropperDialog, tn as ImageField, on as LocationField, Ar as LookupCellRenderer, Mt as LookupField, nr as MasterDetailField, dr as NumberCellRenderer, Le as NumberField, xn as ObjectField, Kt as PasswordField, mr as PercentCellRenderer, Ut as PercentField, Dr as PhoneCellRenderer, tt as PhoneField, er as QRCodeField, In as RatingField, bt as RecordPickerDialog, mt as RichTextField, wr as SelectCellRenderer, Ke as SelectField, Zn as SignatureField, Nn as SliderField, fn as SummaryField, dt as TextAreaField, ur as TextCellRenderer, Pe as TextField, Bt as TimeField, Er as UrlCellRenderer, it as UrlField, Mr as UserCellRenderer, vn as UserField, wn as VectorField, Rr as buildValidationRules, Q as coerceToSafeValue, zr as evaluateCondition, ir as formatCompactCurrency, rr as formatCurrency, cr as formatDate, lr as formatDateTime, Lr as formatFileSize, ar as formatPercent, sr as formatRelativeDate, Fr as getCellRenderer, or as humanizeLabel, Ir as mapFieldTypeToFormType, Hr as registerAllFields, Vr as registerField, Pr as registerFieldRenderer, Ur as registerFields };
3761
+ export { qn as AddressField, _n as AutoNumberField, Wn as AvatarField, wr as BooleanCellRenderer, Z as BooleanField, Vn as CodeField, Mn as ColorField, br as CurrencyCellRenderer, lt as CurrencyField, Tr as DateCellRenderer, Xe as DateField, Er as DateTimeCellRenderer, zt as DateTimeField, Lr as EmailCellRenderer, $e as EmailField, Br as FileCellRenderer, Zt as FileField, Ur as FormulaCellRenderer, dn as FormulaField, Xn as GeolocationField, kn as GridField, Vr as ImageCellRenderer, en as ImageCropperDialog, rn as ImageField, cn as LocationField, Hr as LookupCellRenderer, Pt as LookupField, ir as MasterDetailField, yr as NumberCellRenderer, ze as NumberField, Cn as ObjectField, Jt as PasswordField, Sr as PercentCellRenderer, Gt as PercentField, zr as PhoneCellRenderer, nt as PhoneField, nr as QRCodeField, Rn as RatingField, xt as RecordPickerDialog, ht as RichTextField, Ir as SelectCellRenderer, qe as SelectField, $n as SignatureField, Fn as SliderField, mn as SummaryField, ft as TextAreaField, vr as TextCellRenderer, Ie as TextField, Ht as TimeField, Rr as UrlCellRenderer, at as UrlField, Wr as UserCellRenderer, bn as UserField, En as VectorField, $r as buildValidationRules, Q as coerceToSafeValue, ei as evaluateCondition, dr as formatCompactCurrency, ur as formatCurrency, gr as formatDate, _r as formatDateTime, Qr as formatFileSize, fr as formatNumber, pr as formatPercent, hr as formatRelativeDate, Mr as getBadgeColorClasses, Xr as getCellRenderer, Nr as getSemanticColorName, Fr as getSemanticHex, mr as humanizeLabel, sr as isLikelyOpaqueId, Zr as mapFieldTypeToFormType, ri as registerAllFields, ni as registerField, Kr as registerFieldRenderer, ii as registerFields, Yr as resolveCellRendererType };