@declarion/react 0.40.0 → 0.40.2

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.
@@ -1,13 +1,13 @@
1
1
  import { s as e } from "./DynamicIcon-DeRpAaXm.js";
2
- import { Ct as t, In as n, Jn as r, Kt as i, Mt as a, Tn as o, Yn as s, ar as c, ht as l, i as u, mt as d, or as f, rr as p, sr as m, xt as h } from "./useCurrentScreen-mw8TfE8q.js";
2
+ import { Ct as t, In as n, Kt as r, Mt as i, Tn as a, Xn as o, Yn as s, cr as c, ht as l, i as u, ir as d, mt as f, or as p, sr as m, xt as h } from "./useCurrentScreen-C33VZcNn.js";
3
3
  import { useCallback as g, useEffect as _, useId as v, useMemo as y, useRef as b, useState as x } from "react";
4
4
  import { useLocation as S } from "react-router-dom";
5
5
  import { useQuery as C, useQueryClient as w } from "@tanstack/react-query";
6
6
  import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
7
- import { createPortal as O } from "react-dom";
8
- import { create as k } from "zustand";
7
+ import { createPortal as ee } from "react-dom";
8
+ import { create as O } from "zustand";
9
9
  //#region src/components/primitives/Avatar.tsx
10
- function A({ name: e, size: t = 22, color: n }) {
10
+ function k({ name: e, size: t = 22, color: n }) {
11
11
  let r = e.split(/\s+/).map((e) => e[0]).slice(0, 2).join("").toUpperCase(), i = e.split("").reduce((e, t) => e + t.charCodeAt(0), 0), a = [
12
12
  "#DCE4F6",
13
13
  "#E4DCF6",
@@ -37,24 +37,24 @@ function A({ name: e, size: t = 22, color: n }) {
37
37
  }
38
38
  //#endregion
39
39
  //#region src/components/primitives/Tooltip.tsx
40
- var j = 350, M = 80, N = 260, P = 6, F = 4;
41
- function I(e, t) {
40
+ var A = 350, j = 80, M = 260, N = 6, P = 4;
41
+ function F(e, t) {
42
42
  let [n, r] = x(!1), [i, a] = x(null), o = b(null), s = b(null), c = b(null), l = v(), u = g(() => {
43
43
  s.current && clearTimeout(s.current), c.current && clearTimeout(c.current), s.current = null, c.current = null;
44
44
  }, []), d = g(() => {
45
45
  let t = e.current;
46
46
  if (!t) return;
47
- let n = t.getBoundingClientRect(), r = o.current, i = r?.offsetWidth ?? N, s = r?.offsetHeight ?? 0, c = n.left + n.width / 2 - i / 2;
48
- c = Math.max(F, Math.min(c, window.innerWidth - i - F));
49
- let l = n.top - P - s < F ? n.bottom + P : n.top - P - s;
47
+ let n = t.getBoundingClientRect(), r = o.current, i = r?.offsetWidth ?? M, s = r?.offsetHeight ?? 0, c = n.left + n.width / 2 - i / 2;
48
+ c = Math.max(P, Math.min(c, window.innerWidth - i - P));
49
+ let l = n.top - N - s < P ? n.bottom + N : n.top - N - s;
50
50
  a({
51
51
  left: c,
52
52
  top: l
53
53
  });
54
54
  }, [e]), f = g((e) => {
55
- t && (u(), e ? r(!0) : s.current = setTimeout(() => r(!0), j));
55
+ t && (u(), e ? r(!0) : s.current = setTimeout(() => r(!0), A));
56
56
  }, [u, t]), p = g(() => {
57
- u(), c.current = setTimeout(() => r(!1), M);
57
+ u(), c.current = setTimeout(() => r(!1), j);
58
58
  }, [u]);
59
59
  _(() => {
60
60
  if (!n) {
@@ -72,7 +72,7 @@ function I(e, t) {
72
72
  left: i?.left ?? 0,
73
73
  top: i?.top ?? 0,
74
74
  zIndex: 1e3,
75
- maxWidth: N,
75
+ maxWidth: M,
76
76
  padding: "5px 8px",
77
77
  borderRadius: 6,
78
78
  background: "var(--surface-inverse, #1f2430)",
@@ -83,7 +83,7 @@ function I(e, t) {
83
83
  pointerEvents: "none",
84
84
  visibility: i ? "visible" : "hidden",
85
85
  whiteSpace: "normal"
86
- }, h = n && t ? O(/* @__PURE__ */ E("div", {
86
+ }, h = n && t ? ee(/* @__PURE__ */ E("div", {
87
87
  ref: o,
88
88
  id: l,
89
89
  role: "tooltip",
@@ -102,8 +102,8 @@ function I(e, t) {
102
102
  portal: h
103
103
  };
104
104
  }
105
- function ee({ content: e, children: t, triggerProps: n }) {
106
- let r = b(null), { triggerHandlers: i, describedBy: a, portal: o } = I(r, e);
105
+ function te({ content: e, children: t, triggerProps: n }) {
106
+ let r = b(null), { triggerHandlers: i, describedBy: a, portal: o } = F(r, e);
107
107
  return e ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("span", {
108
108
  ...n,
109
109
  ref: r,
@@ -117,8 +117,8 @@ function ee({ content: e, children: t, triggerProps: n }) {
117
117
  children: t
118
118
  }), o] }) : /* @__PURE__ */ E(T, { children: t });
119
119
  }
120
- function te({ label: t, size: n = 14, ...r }) {
121
- return /* @__PURE__ */ E(ee, {
120
+ function ne({ label: t, size: n = 14, ...r }) {
121
+ return /* @__PURE__ */ E(te, {
122
122
  content: t,
123
123
  children: /* @__PURE__ */ E("span", {
124
124
  tabIndex: 0,
@@ -137,14 +137,14 @@ function te({ label: t, size: n = 14, ...r }) {
137
137
  }
138
138
  //#endregion
139
139
  //#region src/components/primitives/RecordIdBadge.tsx
140
- var ne = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, re = 1200;
141
- function ie({ value: t }) {
142
- let [n, r] = x(!1), i = ne.test(t) ? `${t.slice(0, 8)}…` : t;
140
+ var re = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, ie = 1200;
141
+ function ae({ value: t }) {
142
+ let [n, r] = x(!1), i = re.test(t) ? `${t.slice(0, 8)}…` : t;
143
143
  return /* @__PURE__ */ D("button", {
144
144
  type: "button",
145
145
  onClick: g(async () => {
146
146
  try {
147
- await navigator.clipboard.writeText(t), r(!0), window.setTimeout(() => r(!1), re);
147
+ await navigator.clipboard.writeText(t), r(!0), window.setTimeout(() => r(!1), ie);
148
148
  } catch {}
149
149
  }, [t]),
150
150
  title: n ? "Copied" : `Copy ${t}`,
@@ -157,32 +157,32 @@ function ie({ value: t }) {
157
157
  }
158
158
  //#endregion
159
159
  //#region src/lib/branding.ts
160
- var L = "branding";
161
- function ae(e, t) {
160
+ var I = "branding";
161
+ function oe(e, t) {
162
162
  return e?.parameters.find((e) => e.code === t)?.value;
163
163
  }
164
- function oe(e) {
165
- return R(ae(e, L));
164
+ function se(e) {
165
+ return L(oe(e, I));
166
166
  }
167
- function R(e) {
168
- if (z(e)) return e;
167
+ function L(e) {
168
+ if (R(e)) return e;
169
169
  }
170
- function se(e) {
171
- let t = oe(e)?.identity;
172
- return z(t) ? t : void 0;
170
+ function ce(e) {
171
+ let t = se(e)?.identity;
172
+ return R(t) ? t : void 0;
173
173
  }
174
- function z(e) {
174
+ function R(e) {
175
175
  return !!e && typeof e == "object" && !Array.isArray(e);
176
176
  }
177
- function ce(e) {
177
+ function le(e) {
178
178
  if (!e) return !1;
179
179
  let t = e.trim();
180
180
  return t ? t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("data:image/") : !1;
181
181
  }
182
182
  //#endregion
183
183
  //#region src/api/params.ts
184
- async function le() {
185
- let e = (await i("/api/params/public")).data;
184
+ async function ue() {
185
+ let e = (await r("/api/params/public")).data;
186
186
  if (Array.isArray(e)) return { parameters: e };
187
187
  let t = e ?? {};
188
188
  return {
@@ -192,16 +192,16 @@ async function le() {
192
192
  meta: t.meta
193
193
  };
194
194
  }
195
- async function B(e) {
196
- return (await i(`/api/params/${encodeURIComponent(e)}`)).data;
195
+ async function z(e) {
196
+ return (await r(`/api/params/${encodeURIComponent(e)}`)).data;
197
197
  }
198
- async function ue(e) {
199
- return (await i(`/api/params${e === "tenant" ? "?resolution=tenant" : ""}`)).data ?? [];
198
+ async function de(e) {
199
+ return (await r(`/api/params${e === "tenant" ? "?resolution=tenant" : ""}`)).data ?? [];
200
200
  }
201
201
  //#endregion
202
202
  //#region src/hooks/useParams.ts
203
- var V = "$params";
204
- function de({ carrierEntityCode: e, rowId: n, enabled: r = !0, onWritten: i }) {
203
+ var B = "$params";
204
+ function fe({ carrierEntityCode: e, rowId: n, enabled: r = !0, onWritten: i }) {
205
205
  let a = w(), [o, s] = x(null), c = C({
206
206
  queryKey: [
207
207
  "params-carrier-detail",
@@ -211,13 +211,13 @@ function de({ carrierEntityCode: e, rowId: n, enabled: r = !0, onWritten: i }) {
211
211
  queryFn: () => t(e, n),
212
212
  enabled: r && !!n,
213
213
  staleTime: 30 * 1e3
214
- }), l = c.data?.data, u = !!l && !("$params" in l), d = y(() => Array.isArray(l?.$params) ? l[V] : [], [l]), f = y(() => new Map(d.map((e) => [e.param_code, e])), [d]), p = g(async (t) => {
214
+ }), l = c.data?.data, u = !!l && !("$params" in l), d = y(() => Array.isArray(l?.$params) ? l[B] : [], [l]), f = y(() => new Map(d.map((e) => [e.param_code, e])), [d]), p = g(async (t) => {
215
215
  s(null);
216
216
  try {
217
217
  await h(`${e}.__update`, {
218
218
  object_ids: [n],
219
219
  entity: e,
220
- fields: { [V]: t }
220
+ fields: { [B]: t }
221
221
  }), await a.invalidateQueries({ queryKey: ["params-all"] }), await a.invalidateQueries({ queryKey: [
222
222
  "params-carrier-detail",
223
223
  e,
@@ -249,17 +249,17 @@ function de({ carrierEntityCode: e, rowId: n, enabled: r = !0, onWritten: i }) {
249
249
  reset: _
250
250
  };
251
251
  }
252
- function fe(e) {
252
+ function pe(e) {
253
253
  return C({
254
254
  queryKey: ["params-all", e ?? "full"],
255
- queryFn: () => ue(e),
255
+ queryFn: () => de(e),
256
256
  staleTime: 30 * 1e3
257
257
  });
258
258
  }
259
- function pe() {
259
+ function V() {
260
260
  return C({
261
261
  queryKey: ["params-public"],
262
- queryFn: le,
262
+ queryFn: ue,
263
263
  staleTime: 300 * 1e3
264
264
  });
265
265
  }
@@ -267,13 +267,13 @@ function me(e, t = {}) {
267
267
  let n = t.enabled ?? !0;
268
268
  return C({
269
269
  queryKey: ["params", e],
270
- queryFn: () => B(e),
270
+ queryFn: () => z(e),
271
271
  enabled: !!e && n,
272
272
  staleTime: 60 * 1e3
273
273
  });
274
274
  }
275
- function he(e) {
276
- let t = a((e) => e.isAuthenticated), n = pe(), r = me(e, { enabled: t }), i = ge(n.data?.parameters, e);
275
+ function H(e) {
276
+ let t = i((e) => e.isAuthenticated), n = V(), r = me(e, { enabled: t }), a = he(n.data?.parameters, e);
277
277
  if (t && r.data?.found) return {
278
278
  value: r.data.value,
279
279
  found: !0,
@@ -281,22 +281,22 @@ function he(e) {
281
281
  loading: !1,
282
282
  error: null
283
283
  };
284
- let o = i !== void 0;
284
+ let o = a !== void 0;
285
285
  return {
286
- value: i?.value,
286
+ value: a?.value,
287
287
  found: o,
288
288
  source: o ? "public" : void 0,
289
289
  loading: n.isLoading || t && r.isLoading && !r.data && !r.error,
290
290
  error: r.error ?? n.error ?? null
291
291
  };
292
292
  }
293
- function ge(e, t) {
293
+ function he(e, t) {
294
294
  return e?.find((e) => e.code === t);
295
295
  }
296
- function _e(e, t) {
296
+ function U(e, t) {
297
297
  let n = C({
298
298
  queryKey: ["params", e],
299
- queryFn: () => B(e),
299
+ queryFn: () => z(e),
300
300
  enabled: !!e,
301
301
  staleTime: 60 * 1e3
302
302
  }), r = n.data, i = !!r?.found;
@@ -310,55 +310,55 @@ function _e(e, t) {
310
310
  }
311
311
  //#endregion
312
312
  //#region src/hooks/useBranding.ts
313
- function H() {
314
- let e = he(L);
313
+ function W() {
314
+ let e = H(I);
315
315
  return {
316
- branding: R(e.value),
316
+ branding: L(e.value),
317
317
  isLoading: e.loading
318
318
  };
319
319
  }
320
- function ve() {
321
- return H().branding?.identity;
320
+ function ge() {
321
+ return W().branding?.identity;
322
322
  }
323
- function U() {
324
- return H().branding?.chrome;
323
+ function G() {
324
+ return W().branding?.chrome;
325
325
  }
326
326
  //#endregion
327
327
  //#region src/stores/page-state.ts
328
- var W = 1800 * 1e3, G = null;
329
- function K(e) {
330
- G = e;
328
+ var K = 1800 * 1e3, q = null;
329
+ function J(e) {
330
+ q = e;
331
331
  }
332
- function q(e) {
333
- if (!(!e || !G)) for (let t of e.queryKeys) G.removeQueries({
332
+ function Y(e) {
333
+ if (!(!e || !q)) for (let t of e.queryKeys) q.removeQueries({
334
334
  queryKey: t,
335
335
  exact: !0
336
336
  });
337
337
  }
338
- function J(e, t) {
338
+ function X(e, t) {
339
339
  let n = e[t];
340
340
  if (!n) return e;
341
- q(n);
341
+ Y(n);
342
342
  let r = { ...e };
343
343
  return delete r[t], r;
344
344
  }
345
- function Y(e, t) {
345
+ function _e(e, t) {
346
346
  let n = e;
347
347
  for (; Object.keys(n).length > 64;) {
348
348
  let e = null, r = Infinity;
349
349
  for (let [i, a] of Object.entries(n)) i !== t && a.lastActiveAt < r && (r = a.lastActiveAt, e = i);
350
350
  if (e === null) break;
351
- n = J(n, e);
351
+ n = X(n, e);
352
352
  }
353
353
  return n;
354
354
  }
355
- var X = k((e, t) => ({
355
+ var Z = O((e, t) => ({
356
356
  entries: {},
357
- ttlMs: W,
357
+ ttlMs: K,
358
358
  setTtl: (n) => {
359
359
  if (n <= 0) {
360
360
  let { entries: r } = t();
361
- for (let e of Object.keys(r)) q(r[e]);
361
+ for (let e of Object.keys(r)) Y(r[e]);
362
362
  e({
363
363
  ttlMs: n,
364
364
  entries: {}
@@ -382,7 +382,7 @@ var X = k((e, t) => ({
382
382
  lastActiveAt: o,
383
383
  queryKeys: []
384
384
  };
385
- e({ entries: Y({
385
+ e({ entries: _e({
386
386
  ...a.entries,
387
387
  [n]: c
388
388
  }, n) });
@@ -406,7 +406,7 @@ var X = k((e, t) => ({
406
406
  registerQueryKey: (n, r) => {
407
407
  let i = t();
408
408
  if (i.ttlMs <= 0) return;
409
- let a = Date.now(), o = i.entries[n], s = o?.queryKeys.some((e) => ye(e, r));
409
+ let a = Date.now(), o = i.entries[n], s = o?.queryKeys.some((e) => ve(e, r));
410
410
  if (o && s) return;
411
411
  let c = o ? {
412
412
  ...o,
@@ -417,29 +417,29 @@ var X = k((e, t) => ({
417
417
  lastActiveAt: a,
418
418
  queryKeys: [r]
419
419
  };
420
- e({ entries: Y({
420
+ e({ entries: _e({
421
421
  ...i.entries,
422
422
  [n]: c
423
423
  }, n) });
424
424
  },
425
425
  kill: (n) => {
426
- let r = t(), i = J(r.entries, n);
426
+ let r = t(), i = X(r.entries, n);
427
427
  i !== r.entries && e({ entries: i });
428
428
  },
429
429
  sweep: (n) => {
430
430
  let { ttlMs: r, entries: i } = t(), a = i;
431
- for (let [e, t] of Object.entries(i)) (r <= 0 || n - t.lastActiveAt > r) && (a = J(a, e));
431
+ for (let [e, t] of Object.entries(i)) (r <= 0 || n - t.lastActiveAt > r) && (a = X(a, e));
432
432
  a !== i && e({ entries: a });
433
433
  },
434
434
  clear: () => {
435
435
  let { entries: n } = t();
436
436
  if (Object.keys(n).length !== 0) {
437
- for (let e of Object.keys(n)) q(n[e]);
437
+ for (let e of Object.keys(n)) Y(n[e]);
438
438
  e({ entries: {} });
439
439
  }
440
440
  }
441
441
  }));
442
- function ye(e, t) {
442
+ function ve(e, t) {
443
443
  if (e === t) return !0;
444
444
  try {
445
445
  return JSON.stringify(e) === JSON.stringify(t);
@@ -449,29 +449,29 @@ function ye(e, t) {
449
449
  }
450
450
  //#endregion
451
451
  //#region src/lib/canonical-url.ts
452
- function be(e) {
452
+ function ye(e) {
453
453
  return e.length > 1 && e.endsWith("/") ? e.replace(/\/+$/, "") || "/" : e;
454
454
  }
455
- function Z(e) {
456
- let t = be(e.pathname), n = e.search ?? "", r = n.startsWith("?") ? n.slice(1) : n, i = new URLSearchParams(r);
455
+ function Q(e) {
456
+ let t = ye(e.pathname), n = e.search ?? "", r = n.startsWith("?") ? n.slice(1) : n, i = new URLSearchParams(r);
457
457
  for (let e of l) i.delete(e);
458
458
  i.sort();
459
459
  let a = i.toString();
460
460
  return a ? `${t}?${a}` : t;
461
461
  }
462
- function xe(e) {
463
- return be(e.pathname);
462
+ function be(e) {
463
+ return ye(e.pathname);
464
464
  }
465
465
  //#endregion
466
466
  //#region src/hooks/usePageStateTtl.ts
467
- var Se = "ui_page_state_ttl_ms";
468
- function Ce() {
469
- let { value: e } = _e(Se, W);
470
- return typeof e != "number" || !Number.isFinite(e) || e < 0 ? W : e;
467
+ var xe = "ui_page_state_ttl_ms";
468
+ function Se() {
469
+ let { value: e } = U(xe, K);
470
+ return typeof e != "number" || !Number.isFinite(e) || e < 0 ? K : e;
471
471
  }
472
472
  //#endregion
473
473
  //#region src/hooks/usePageStateRuntime.ts
474
- var we = [
474
+ var Ce = [
475
475
  ["entity-data"],
476
476
  ["entity-count"],
477
477
  ["entity-item"],
@@ -479,27 +479,27 @@ var we = [
479
479
  ["entity-data-all"],
480
480
  ["action-data"],
481
481
  ["action-data-cursor"]
482
- ], Te = 6e4;
483
- function Ee(e, t) {
484
- for (let n of we) e.setQueryDefaults(n, { gcTime: t });
485
- }
486
- function De() {
487
- let e = w(), t = Ce(), n = S(), r = b(n);
488
- r.current = n, _(() => (K(e), () => K(null)), [e]), _(() => {
489
- if (X.getState().setTtl(t), Ee(e, t), t <= 0) for (let t of we) e.removeQueries({ queryKey: t });
482
+ ], we = 6e4;
483
+ function Te(e, t) {
484
+ for (let n of Ce) e.setQueryDefaults(n, { gcTime: t });
485
+ }
486
+ function Ee() {
487
+ let e = w(), t = Se(), n = S(), r = b(n);
488
+ r.current = n, _(() => (J(e), () => J(null)), [e]), _(() => {
489
+ if (Z.getState().setTtl(t), Te(e, t), t <= 0) for (let t of Ce) e.removeQueries({ queryKey: t });
490
490
  }, [e, t]), _(() => {
491
491
  if (t <= 0) return;
492
492
  let e = setInterval(() => {
493
- let e = X.getState(), t = r.current;
494
- e.touch(Z(t)), e.touch(xe(t)), e.sweep(Date.now());
495
- }, Te);
493
+ let e = Z.getState(), t = r.current;
494
+ e.touch(Q(t)), e.touch(be(t)), e.sweep(Date.now());
495
+ }, we);
496
496
  return () => clearInterval(e);
497
497
  }, [t]);
498
498
  }
499
- function Oe(e, t = !0) {
500
- let n = Z(S());
499
+ function De(e, t = !0) {
500
+ let n = Q(S());
501
501
  _(() => {
502
- !t || !e || X.getState().registerQueryKey(n, e);
502
+ !t || !e || Z.getState().registerQueryKey(n, e);
503
503
  }, [
504
504
  n,
505
505
  e ? JSON.stringify(e) : "",
@@ -508,15 +508,15 @@ function Oe(e, t = !0) {
508
508
  }
509
509
  //#endregion
510
510
  //#region src/lib/record-documents-key.ts
511
- var ke = "record-documents";
511
+ var Oe = "record-documents";
512
512
  //#endregion
513
513
  //#region src/hooks/useBrandingChrome.ts
514
- function Ae() {
515
- let e = d(), t = U();
514
+ function ke() {
515
+ let e = f(), t = G();
516
516
  return (e.enabled ? t?.embed?.viewport : t?.full?.viewport) ?? "auto";
517
517
  }
518
- function je(e) {
519
- let t = d(), n = U();
518
+ function Ae(e) {
519
+ let t = f(), n = G();
520
520
  return y(() => {
521
521
  let r = { ...t.enabled ? n?.embed?.surfaces?.[e] : n?.full?.surfaces?.[e] };
522
522
  return {
@@ -529,8 +529,8 @@ function je(e) {
529
529
  e
530
530
  ]);
531
531
  }
532
- function Me() {
533
- let e = U();
532
+ function je() {
533
+ let e = G();
534
534
  return y(() => {
535
535
  let t = { ...e?.full?.shell };
536
536
  return {
@@ -541,34 +541,34 @@ function Me() {
541
541
  }
542
542
  //#endregion
543
543
  //#region src/components/pages/exportRequest.ts
544
- var Ne = /* @__PURE__ */ new Set(["_select", "_actions"]);
545
- function Pe(e) {
544
+ var Me = /* @__PURE__ */ new Set(["_select", "_actions"]);
545
+ function Ne(e) {
546
546
  let t = {};
547
547
  return e.screenCode && (t.screen = e.screenCode), e.jsonFilters && e.jsonFilters.length > 0 && (t.filters = e.jsonFilters), e.search && (t.search = e.search), e.sort && (t.sort = e.sort), e.includeDeleted && (t.include_deleted = !0), e.page && (t.page = e.page), e.perPage && (t.per_page = e.perPage), t;
548
548
  }
549
- function Fe(e, t) {
550
- let n = t.visibleColumns.filter((e) => !Ne.has(e)), r = {
549
+ function Pe(e, t) {
550
+ let n = t.visibleColumns.filter((e) => !Me.has(e)), r = {
551
551
  format: "csv",
552
552
  scope: t.scope,
553
- query: Pe(e),
553
+ query: Ne(e),
554
554
  columns: n
555
555
  };
556
556
  return t.scope === "selected_rows" && t.selectedRowPKs && t.selectedRowPKs.length > 0 && (r.selection = t.selectedRowPKs), t.locale && (r.locale = t.locale), t.filename && (r.filename = t.filename), r;
557
557
  }
558
558
  //#endregion
559
559
  //#region src/components/pages/DocumentsMenu.tsx
560
- var Ie = "document-templates-available";
561
- function Le({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selectedIds: a = [], capability: c, canManageTemplates: l = !1 }) {
562
- let { run: d } = u(), f = b(null), [g, _] = x(!1), v = n === "detail" ? !!c?.generate_one : !!c?.generate_many, S = l && !v, { data: w, isLoading: O, error: k } = C({
563
- queryKey: [Ie, t],
560
+ var Fe = "document-templates-available";
561
+ function Ie({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selectedIds: s = [], capability: l, canManageTemplates: f = !1 }) {
562
+ let { run: p } = u(), m = b(null), [g, _] = x(!1), v = n === "detail" ? !!l?.generate_one : !!l?.generate_many, S = f && !v, { data: w, isLoading: ee, error: O } = C({
563
+ queryKey: [Fe, t],
564
564
  queryFn: async () => (await h("document.templates.available", { entity: t })).result?.templates ?? [],
565
565
  enabled: g || S,
566
566
  staleTime: 6e4
567
- }), A = O, j = y(() => (w ?? []).filter((e) => n === "detail" ? e.input_mode === "one" || e.input_mode === "global" : e.input_mode === "many" || e.input_mode === "global"), [n, w]), M = S && j.length > 0, N = v || M;
568
- function P() {
567
+ }), k = ee, A = y(() => (w ?? []).filter((e) => n === "detail" ? e.input_mode === "one" || e.input_mode === "global" : e.input_mode === "many" || e.input_mode === "global"), [n, w]), j = S && A.length > 0, M = v || j;
568
+ function N() {
569
569
  _((e) => !e);
570
570
  }
571
- function F(e) {
571
+ function P(e) {
572
572
  if (e.input_mode === "global") return [{ kind: "global" }];
573
573
  if (n === "detail") return e.input_mode === "one" && r.length === 1 ? [{
574
574
  kind: "one",
@@ -578,17 +578,17 @@ function Le({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selected
578
578
  let e = [];
579
579
  return i && e.push({
580
580
  kind: "current_view",
581
- query: Pe(i)
582
- }), a.length > 0 && e.push({
581
+ query: Ne(i)
582
+ }), s.length > 0 && e.push({
583
583
  kind: "selected",
584
- objectIds: a
584
+ objectIds: s
585
585
  }), e;
586
586
  }
587
587
  return [];
588
588
  }
589
- function I(e, t, n) {
590
- let r = Re(e), i = o(e.name) || e.code;
591
- _(!1), d({
589
+ function F(e, t, n) {
590
+ let r = Le(e), i = a(e.name) || e.code;
591
+ _(!1), p({
592
592
  action: r,
593
593
  title: i,
594
594
  execute: (r) => {
@@ -604,49 +604,49 @@ function Le({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selected
604
604
  }
605
605
  });
606
606
  }
607
- return N ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(m, {
608
- ref: f,
607
+ return M ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(c, {
608
+ ref: m,
609
609
  kind: "ghost",
610
610
  size: "sm",
611
- icon: E(A ? e.loader : e.filePlus, { size: 12 }),
612
- onClick: P,
613
- disabled: A,
611
+ icon: E(k ? e.loader : e.filePlus, { size: 12 }),
612
+ onClick: N,
613
+ disabled: k,
614
614
  children: "Generate"
615
- }), /* @__PURE__ */ D(p, {
615
+ }), /* @__PURE__ */ D(d, {
616
616
  open: g,
617
- anchor: f.current,
617
+ anchor: m.current,
618
618
  onClose: () => _(!1),
619
619
  align: "end",
620
620
  width: 300,
621
621
  children: [
622
- A && /* @__PURE__ */ E(s, {
622
+ k && /* @__PURE__ */ E(o, {
623
623
  disabled: !0,
624
624
  icon: /* @__PURE__ */ E(e.loader, { size: 12 }),
625
625
  children: "Loading templates..."
626
626
  }),
627
- k && /* @__PURE__ */ E(s, {
627
+ O && /* @__PURE__ */ E(o, {
628
628
  disabled: !0,
629
629
  icon: /* @__PURE__ */ E(e.warning, { size: 12 }),
630
- children: k instanceof Error ? k.message : String(k)
630
+ children: O instanceof Error ? O.message : String(O)
631
631
  }),
632
- !A && !k && j.length === 0 && /* @__PURE__ */ E(s, {
632
+ !k && !O && A.length === 0 && /* @__PURE__ */ E(o, {
633
633
  disabled: !0,
634
634
  icon: /* @__PURE__ */ E(e.file, { size: 12 }),
635
635
  children: "No document templates"
636
636
  }),
637
- !A && !k && j.map((t) => {
638
- let n = F(t);
639
- return n.length === 0 ? null : ze(t).flatMap((r) => n.map((n) => r.available ? /* @__PURE__ */ E(s, {
637
+ !k && !O && A.map((t) => {
638
+ let n = P(t);
639
+ return n.length === 0 ? null : Re(t).flatMap((r) => n.map((n) => r.available ? /* @__PURE__ */ E(o, {
640
640
  icon: /* @__PURE__ */ E(e.file, { size: 12 }),
641
- onClick: () => I(t, n, r.format),
642
- title: o(t.description),
643
- children: Be(t, n, r.format)
644
- }, `${t.source}:${t.code}:${n.kind}:${r.format}`) : /* @__PURE__ */ D(s, {
641
+ onClick: () => F(t, n, r.format),
642
+ title: a(t.description),
643
+ children: ze(t, n, r.format)
644
+ }, `${t.source}:${t.code}:${n.kind}:${r.format}`) : /* @__PURE__ */ D(o, {
645
645
  disabled: !0,
646
646
  icon: /* @__PURE__ */ E(e.file, { size: 12 }),
647
647
  title: r.disabled_reason,
648
648
  children: [
649
- Be(t, n, r.format),
649
+ ze(t, n, r.format),
650
650
  " - ",
651
651
  r.disabled_reason || "Unavailable"
652
652
  ]
@@ -655,7 +655,7 @@ function Le({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selected
655
655
  ]
656
656
  })] }) : null;
657
657
  }
658
- function Re(e) {
658
+ function Le(e) {
659
659
  let t = new n((e.params ?? []).map((e) => ({
660
660
  ...e,
661
661
  name: e.name ?? ""
@@ -670,14 +670,14 @@ function Re(e) {
670
670
  resolved_params: t
671
671
  };
672
672
  }
673
- function ze(e) {
673
+ function Re(e) {
674
674
  return e.outputs && e.outputs.length > 0 ? e.outputs : (e.allowed_outputs && e.allowed_outputs.length > 0 ? e.allowed_outputs : [e.output_format || "xlsx"]).map((e) => ({
675
675
  format: e,
676
676
  available: !0
677
677
  }));
678
678
  }
679
- function Be(e, t, n) {
680
- let r = o(e.name) || e.code, i = n ? ` (${n.toUpperCase()})` : "";
679
+ function ze(e, t, n) {
680
+ let r = a(e.name) || e.code, i = n ? ` (${n.toUpperCase()})` : "";
681
681
  switch (t.kind) {
682
682
  case "one": return `${r}${i}`;
683
683
  case "selected": return `${r}${i} - selected rows`;
@@ -687,12 +687,12 @@ function Be(e, t, n) {
687
687
  }
688
688
  //#endregion
689
689
  //#region src/lib/document-templates.ts
690
- function Ve(e) {
690
+ function Be(e) {
691
691
  return !!e?.entities?.document_template;
692
692
  }
693
693
  //#endregion
694
694
  //#region src/lib/scroll-restoration.ts
695
- var Q = "scroll", He = 120, Ue = 24, We = 600;
695
+ var Ve = "scroll", He = 120, Ue = 24, We = 600;
696
696
  function Ge(e, t) {
697
697
  return Number.isFinite(e) ? Math.max(0, Math.min(e, Number.isFinite(t) && t > 0 ? t : 0)) : 0;
698
698
  }
@@ -723,10 +723,10 @@ function qe(e, t, n, r) {
723
723
  }
724
724
  return Ge(e.offset, r);
725
725
  }
726
- function Je(e = Q) {
726
+ function Je(e = Ve) {
727
727
  let t = S(), n = b(null);
728
728
  if (n.current === null) {
729
- let r = Z(t), i = X.getState().read(r, e);
729
+ let r = Q(t), i = Z.getState().read(r, e);
730
730
  n.current = i && Number.isFinite(i.offset) ? Math.max(0, i.offset) : 0;
731
731
  }
732
732
  return n.current;
@@ -749,7 +749,7 @@ function Ye(e) {
749
749
  };
750
750
  }
751
751
  function Xe(e) {
752
- let { virtualizer: t, scrollElementRef: n, rowKeys: r } = e, i = e.stateKey ?? "scroll", a = e.enabled ?? !0, o = Z(S()), s = b(t);
752
+ let { virtualizer: t, scrollElementRef: n, rowKeys: r } = e, i = e.stateKey ?? "scroll", a = e.enabled ?? !0, o = Q(S()), s = b(t);
753
753
  s.current = t;
754
754
  let c = b(r);
755
755
  c.current = r;
@@ -760,7 +760,7 @@ function Xe(e) {
760
760
  if (!a) return;
761
761
  let e = s.current;
762
762
  if (!e || r.length === 0) return;
763
- let t = X.getState().read(o, i), n = l.current !== o;
763
+ let t = Z.getState().read(o, i), n = l.current !== o;
764
764
  if (l.current = o, !t) {
765
765
  n && e.scrollToOffset(0, {
766
766
  align: "start",
@@ -798,7 +798,7 @@ function Ze(e, t, n, r, i) {
798
798
  if (!t) return;
799
799
  let i = 0, o = We, s = null, c = null, l = (e) => {
800
800
  let t = a.current(e);
801
- t && X.getState().set(n, r, t);
801
+ t && Z.getState().set(n, r, t);
802
802
  }, u = () => c?.trigger(), d = () => {
803
803
  let t = e.current;
804
804
  if (!t) {
@@ -818,7 +818,7 @@ function Ze(e, t, n, r, i) {
818
818
  ]);
819
819
  }
820
820
  function Qe(e) {
821
- let { scrollElementRef: t } = e, n = e.stateKey ?? "scroll", r = e.enabled ?? !0, i = Z(S()), a = b(null);
821
+ let { scrollElementRef: t } = e, n = e.stateKey ?? "scroll", r = e.enabled ?? !0, i = Q(S()), a = b(null);
822
822
  _(() => {
823
823
  if (!r || a.current === i) return;
824
824
  let e = 0, o = We, s = () => {
@@ -828,7 +828,7 @@ function Qe(e) {
828
828
  return;
829
829
  }
830
830
  a.current = i;
831
- let c = X.getState().read(i, n);
831
+ let c = Z.getState().read(i, n);
832
832
  c && (r.scrollTop = Number.isFinite(c.offset) ? Math.max(0, c.offset) : 0);
833
833
  };
834
834
  return s(), () => {
@@ -890,11 +890,11 @@ function ot({ liveObject: t, realtime: n = !0 }) {
890
890
  alignItems: "center",
891
891
  gap: 8
892
892
  },
893
- children: [/* @__PURE__ */ E(f, {
893
+ children: [/* @__PURE__ */ E(m, {
894
894
  icon: t.isFetching ? /* @__PURE__ */ E("span", {
895
895
  "data-testid": "refresh-spinner",
896
896
  style: { display: "inline-flex" },
897
- children: /* @__PURE__ */ E(r, { size: 14 })
897
+ children: /* @__PURE__ */ E(s, { size: 14 })
898
898
  }) : /* @__PURE__ */ E(e.refresh, { size: 14 }),
899
899
  title: "Refresh",
900
900
  disabled: t.isLoading || t.isFetching,
@@ -904,7 +904,7 @@ function ot({ liveObject: t, realtime: n = !0 }) {
904
904
  }), n && /* @__PURE__ */ E("span", {
905
905
  "data-testid": "live-indicator",
906
906
  title: t.isLive ? "This view updates automatically in realtime." : "Realtime updates are paused. Refresh manually to load the latest data.",
907
- children: /* @__PURE__ */ E(c, {
907
+ children: /* @__PURE__ */ E(p, {
908
908
  tone: t.isLive ? "emerald" : "amber",
909
909
  size: "xs",
910
910
  dot: !0,
@@ -914,4 +914,4 @@ function ot({ liveObject: t, realtime: n = !0 }) {
914
914
  });
915
915
  }
916
916
  //#endregion
917
- export { de as A, I as B, xe as C, H as D, X as E, se as F, ce as I, ie as L, _e as M, pe as N, ve as O, me as P, te as R, Ce as S, W as T, A as V, ke as _, $e as a, Oe as b, Qe as c, Ve as d, Le as f, Ae as g, Me as h, tt as i, he as j, fe as k, Je as l, je as m, it as n, et as o, Fe as p, at as r, Q as s, ot as t, Xe as u, Ee as v, Z as w, Se as x, De as y, ee as z };
917
+ export { fe as A, F as B, be as C, W as D, Z as E, ce as F, le as I, ae as L, U as M, V as N, ge as O, me as P, ne as R, Se as S, K as T, k as V, Oe as _, $e as a, De as b, Qe as c, Be as d, Ie as f, ke as g, je as h, tt as i, H as j, pe as k, Je as l, Ae as m, it as n, et as o, Pe as p, at as r, Ve as s, ot as t, Xe as u, Te as v, Q as w, xe as x, Ee as y, te as z };