@declarion/react 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/{DraggableChildrenTable-BDnJK0AU.js → DraggableChildrenTable-B6KjWkwD.js} +2 -2
- package/dist-lib/{DynamicIcon-DeRpAaXm.js → DynamicIcon-Dc2j-rg_.js} +19 -17
- package/dist-lib/{Grid-CcCveEE7.js → Grid-OdquWJNX.js} +2 -2
- package/dist-lib/{LayoutRenderer-BReuhVdX.js → LayoutRenderer-CzAdhjNT.js} +525 -518
- package/dist-lib/{MarkdownRenderer-DPKDFR60.js → MarkdownRenderer-C6bhrAIe.js} +10 -10
- package/dist-lib/{RefreshControl-KddgOhUG.js → RefreshControl-F9Ib9asP.js} +18 -18
- package/dist-lib/{SmartDetailPage.impl-D_hMxiHy.js → SmartDetailPage.impl-DdSu3kmW.js} +305 -294
- package/dist-lib/{SmartRecordListPage.impl-GIo_mPIJ.js → SmartRecordListPage.impl-SkIp0_Rd.js} +165 -154
- package/dist-lib/api/agents.d.ts +39 -7
- package/dist-lib/components/agents/AgentChatPanel.d.ts +6 -1
- package/dist-lib/components/agents/transcript-runs.d.ts +29 -0
- package/dist-lib/components/file-widgets/host.d.ts +1 -0
- package/dist-lib/components/list/QuickPeek.d.ts +1 -1
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +4 -2
- package/dist-lib/components/pages/list/cardProjection.d.ts +2 -1
- package/dist-lib/components/shared/RowActionsKebab.d.ts +3 -2
- package/dist-lib/components/views/ViewSwitcher.d.ts +2 -1
- package/dist-lib/hooks/useAgentConversation.d.ts +7 -19
- package/dist-lib/hooks/useFilters.d.ts +1 -0
- package/dist-lib/icons.js +1 -1
- package/dist-lib/index.d.ts +8 -1
- package/dist-lib/index.js +3031 -2674
- package/dist-lib/lib/actions.d.ts +1 -1
- package/dist-lib/lib/filter-evaluator.d.ts +16 -0
- package/dist-lib/lib/filters.d.ts +10 -4
- package/dist-lib/lib/messages.d.ts +1 -0
- package/dist-lib/lib/variants.d.ts +7 -0
- package/dist-lib/{registry-DJKp0yaV.js → registry-C2VD-5MD.js} +571 -347
- package/dist-lib/testing.js +1 -1
- package/dist-lib/types/schema.d.ts +26 -0
- package/dist-lib/{useCurrentScreen-A3xZDs7U.js → useCurrentScreen-ow4r-nWa.js} +721 -693
- package/dist-lib/{useProperties-TlltWwLv.js → useProperties-lEKfzm2X.js} +92 -61
- package/dist-lib/{value-CHY7LgZ-.js → value-CXohNH6a.js} +1 -1
- package/dist-lib/vite/index.js +23 -22
- package/package.json +12 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, s as t, t as n } from "./DynamicIcon-
|
|
1
|
+
import { c as e, s as t, t as n } from "./DynamicIcon-Dc2j-rg_.js";
|
|
2
2
|
import { Suspense as r, createContext as i, forwardRef as a, lazy as o, useCallback as s, useContext as c, useEffect as l, useLayoutEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
3
3
|
import { useLocation as m, useNavigate as h } from "react-router";
|
|
4
4
|
import { useQuery as g, useQueryClient as _ } from "@tanstack/react-query";
|
|
@@ -237,14 +237,14 @@ function ee(e) {
|
|
|
237
237
|
}
|
|
238
238
|
//#endregion
|
|
239
239
|
//#region src/components/primitives/HoverCard.tsx
|
|
240
|
-
var
|
|
241
|
-
function
|
|
240
|
+
var N = 400, te = 150, ne = 320, re = 240, ie = 4, ae = 4;
|
|
241
|
+
function oe({ content: e, children: t, width: n = ne, align: r = "center", style: i }) {
|
|
242
242
|
let a = f(null), o = f(null), c = f(null), u = f(null), [d, m] = p(!1), [h, g] = p(null), [_, v] = p(!1), C = s(() => {
|
|
243
243
|
let e = a.current;
|
|
244
244
|
if (!e) return;
|
|
245
|
-
let t = e.getBoundingClientRect(), i = typeof window < "u" ? window.visualViewport : void 0, s = i?.width ?? (typeof window < "u" ? window.innerWidth : 0), c = i?.height ?? (typeof window < "u" ? window.innerHeight : 0), l = i?.offsetLeft ?? 0, u = i?.offsetTop ?? 0, d = Math.min(n, Math.max(160, s -
|
|
245
|
+
let t = e.getBoundingClientRect(), i = typeof window < "u" ? window.visualViewport : void 0, s = i?.width ?? (typeof window < "u" ? window.innerWidth : 0), c = i?.height ?? (typeof window < "u" ? window.innerHeight : 0), l = i?.offsetLeft ?? 0, u = i?.offsetTop ?? 0, d = Math.min(n, Math.max(160, s - 8)), f = o.current?.offsetHeight ?? re, p = u + c - t.bottom < f + 8 && t.top > f + 8 ? "above" : "below", m = p === "below" ? t.bottom + ae : t.top - ae - f, h;
|
|
246
246
|
h = r === "start" ? t.left : r === "end" ? t.right - d : t.left + t.width / 2 - d / 2;
|
|
247
|
-
let _ = l +
|
|
247
|
+
let _ = l + ie, v = l + s - ie;
|
|
248
248
|
h + d > v && (h = Math.max(_, t.right - d)), h < _ && (h = _), g((e) => e && e.top === m && e.left === h && e.width === d && e.placement === p ? e : {
|
|
249
249
|
top: m,
|
|
250
250
|
left: h,
|
|
@@ -252,18 +252,20 @@ function se({ content: e, children: t, width: n = re, align: r = "center", style
|
|
|
252
252
|
placement: p
|
|
253
253
|
});
|
|
254
254
|
}, [r, n]), w = f(null), T = s((e) => {
|
|
255
|
-
if (o.current = e, w.current &&= (w.current.disconnect(), null), e)
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
255
|
+
if (o.current = e, w.current &&= (w.current.disconnect(), null), e) {
|
|
256
|
+
if (typeof ResizeObserver < "u") {
|
|
257
|
+
let t = new ResizeObserver(() => {
|
|
258
|
+
C(), v(!0);
|
|
259
|
+
});
|
|
260
|
+
t.observe(e), w.current = t;
|
|
261
|
+
} else v(!0);
|
|
262
|
+
}
|
|
261
263
|
}, [C]), E = s(() => {
|
|
262
264
|
c.current !== null && (window.clearTimeout(c.current), c.current = null), u.current !== null && (window.clearTimeout(u.current), u.current = null);
|
|
263
265
|
}, []), D = () => {
|
|
264
266
|
u.current !== null && (window.clearTimeout(u.current), u.current = null), !(d || c.current !== null) && (c.current = window.setTimeout(() => {
|
|
265
267
|
c.current = null, m(!0);
|
|
266
|
-
},
|
|
268
|
+
}, N));
|
|
267
269
|
}, O = s(() => {
|
|
268
270
|
E(), m(!0);
|
|
269
271
|
}, [E]), k = s(() => {
|
|
@@ -271,7 +273,7 @@ function se({ content: e, children: t, width: n = re, align: r = "center", style
|
|
|
271
273
|
}, [E]), A = () => {
|
|
272
274
|
c.current !== null && (window.clearTimeout(c.current), c.current = null), u.current === null && (u.current = window.setTimeout(() => {
|
|
273
275
|
u.current = null, m(!1);
|
|
274
|
-
},
|
|
276
|
+
}, te));
|
|
275
277
|
};
|
|
276
278
|
l(() => () => {
|
|
277
279
|
E(), w.current &&= (w.current.disconnect(), null);
|
|
@@ -303,7 +305,7 @@ function se({ content: e, children: t, width: n = re, align: r = "center", style
|
|
|
303
305
|
top: h.top,
|
|
304
306
|
left: h.left,
|
|
305
307
|
width: h.width,
|
|
306
|
-
maxHeight:
|
|
308
|
+
maxHeight: re,
|
|
307
309
|
overflowY: "auto",
|
|
308
310
|
zIndex: 250,
|
|
309
311
|
background: "var(--surface)",
|
|
@@ -334,7 +336,7 @@ function se({ content: e, children: t, width: n = re, align: r = "center", style
|
|
|
334
336
|
}, 0);
|
|
335
337
|
},
|
|
336
338
|
onPointerDown: (e) => {
|
|
337
|
-
e.pointerType
|
|
339
|
+
(e.pointerType === "touch" || e.pointerType === "pen") && (e.preventDefault(), d ? k() : O());
|
|
338
340
|
},
|
|
339
341
|
onKeyDown: (e) => {
|
|
340
342
|
e.key === "Escape" && (e.stopPropagation(), k());
|
|
@@ -349,7 +351,7 @@ function se({ content: e, children: t, width: n = re, align: r = "center", style
|
|
|
349
351
|
}
|
|
350
352
|
//#endregion
|
|
351
353
|
//#region src/components/primitives/Chip.tsx
|
|
352
|
-
function
|
|
354
|
+
function P({ icon: e, children: n, onRemove: r, onClick: i }) {
|
|
353
355
|
return /* @__PURE__ */ x("span", {
|
|
354
356
|
onClick: i,
|
|
355
357
|
style: {
|
|
@@ -389,76 +391,76 @@ function N({ icon: e, children: n, onRemove: r, onClick: i }) {
|
|
|
389
391
|
}
|
|
390
392
|
//#endregion
|
|
391
393
|
//#region src/lib/html-state.ts
|
|
392
|
-
function
|
|
394
|
+
function se(e) {
|
|
393
395
|
typeof document > "u" || (document.documentElement.dataset.viewport = e);
|
|
394
396
|
}
|
|
395
|
-
function
|
|
397
|
+
function ce(e) {
|
|
396
398
|
typeof document > "u" || (document.documentElement.dataset.embed = e ? "true" : "false");
|
|
397
399
|
}
|
|
398
400
|
//#endregion
|
|
399
401
|
//#region src/hooks/useResponsiveMode.tsx
|
|
400
|
-
var
|
|
402
|
+
var le = {
|
|
401
403
|
phoneMax: 639,
|
|
402
404
|
tabletMax: 1023
|
|
403
|
-
},
|
|
405
|
+
}, ue = {
|
|
404
406
|
width: 1280,
|
|
405
407
|
height: 720
|
|
406
|
-
},
|
|
407
|
-
...
|
|
408
|
+
}, de = i({
|
|
409
|
+
...ue,
|
|
408
410
|
category: "desktop",
|
|
409
411
|
isPhone: !1,
|
|
410
412
|
isTablet: !1,
|
|
411
413
|
isDesktop: !0,
|
|
412
414
|
touch: !1
|
|
413
415
|
});
|
|
414
|
-
function
|
|
416
|
+
function fe(e, t = le) {
|
|
415
417
|
return !Number.isFinite(e) || e <= 0 ? "desktop" : e <= t.phoneMax ? "phone" : e <= t.tabletMax ? "tablet" : "desktop";
|
|
416
418
|
}
|
|
417
|
-
function
|
|
419
|
+
function pe(e) {
|
|
418
420
|
return {
|
|
419
|
-
width: Number.isFinite(e.width) && e.width > 0 ? e.width :
|
|
420
|
-
height: Number.isFinite(e.height) && e.height > 0 ? e.height :
|
|
421
|
+
width: Number.isFinite(e.width) && e.width > 0 ? e.width : ue.width,
|
|
422
|
+
height: Number.isFinite(e.height) && e.height > 0 ? e.height : ue.height,
|
|
421
423
|
touch: e.touch ?? !1
|
|
422
424
|
};
|
|
423
425
|
}
|
|
424
|
-
function
|
|
426
|
+
function me() {
|
|
425
427
|
if (typeof window > "u") return !1;
|
|
426
428
|
let e = window.matchMedia?.("(pointer: coarse)")?.matches ?? !1, t = window.navigator?.maxTouchPoints ?? 0;
|
|
427
429
|
return e || t > 0;
|
|
428
430
|
}
|
|
429
|
-
function
|
|
430
|
-
if (typeof window > "u") return
|
|
431
|
+
function he() {
|
|
432
|
+
if (typeof window > "u") return ue;
|
|
431
433
|
let e = window.visualViewport;
|
|
432
|
-
return
|
|
434
|
+
return pe({
|
|
433
435
|
width: e?.width ?? window.innerWidth,
|
|
434
436
|
height: e?.height ?? window.innerHeight,
|
|
435
|
-
touch:
|
|
437
|
+
touch: me()
|
|
436
438
|
});
|
|
437
439
|
}
|
|
438
|
-
function
|
|
440
|
+
function ge(e, t) {
|
|
439
441
|
if (typeof document > "u") return;
|
|
440
442
|
let n = document.documentElement;
|
|
441
443
|
n.style.setProperty("--app-viewport-width", `${Math.round(e.width)}px`), n.style.setProperty("--app-viewport-height", `${Math.round(e.height)}px`), n.style.setProperty("--app-height", `${Math.round(e.height)}px`);
|
|
442
444
|
let r = t === "phone" || e.height <= 520;
|
|
443
445
|
n.style.setProperty("--control-height", r ? "38px" : "30px"), n.style.setProperty("--control-line-height", r ? "36px" : "28px"), n.style.setProperty("--control-font-size", r ? "16px" : "12.5px");
|
|
444
446
|
}
|
|
445
|
-
function
|
|
446
|
-
let [i, a] = p(() =>
|
|
447
|
+
function _e({ children: e, breakpoints: t = le, viewportOverride: n, viewport: r = "auto" }) {
|
|
448
|
+
let [i, a] = p(() => pe(n ?? he())), o = r === "auto" ? fe(i.width, t) : r;
|
|
447
449
|
l(() => {
|
|
448
450
|
if (n) {
|
|
449
|
-
let e =
|
|
450
|
-
a(e),
|
|
451
|
+
let e = pe(n);
|
|
452
|
+
a(e), ge(e, o);
|
|
451
453
|
return;
|
|
452
454
|
}
|
|
453
455
|
let e = () => {
|
|
454
|
-
let e =
|
|
455
|
-
a(e),
|
|
456
|
+
let e = he();
|
|
457
|
+
a(e), ge(e, o);
|
|
456
458
|
};
|
|
457
459
|
return e(), window.addEventListener("resize", e), window.addEventListener("orientationchange", e), window.visualViewport?.addEventListener("resize", e), window.visualViewport?.addEventListener("scroll", e), () => {
|
|
458
460
|
window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e), window.visualViewport?.removeEventListener("resize", e), window.visualViewport?.removeEventListener("scroll", e);
|
|
459
461
|
};
|
|
460
462
|
}, [n, o]), l(() => {
|
|
461
|
-
|
|
463
|
+
se(o);
|
|
462
464
|
}, [o]);
|
|
463
465
|
let s = d(() => ({
|
|
464
466
|
...i,
|
|
@@ -468,17 +470,17 @@ function ve({ children: e, breakpoints: t = ue, viewportOverride: n, viewport: r
|
|
|
468
470
|
isDesktop: o === "desktop",
|
|
469
471
|
touch: i.touch ?? !1
|
|
470
472
|
}), [o, i]);
|
|
471
|
-
return /* @__PURE__ */ b(
|
|
473
|
+
return /* @__PURE__ */ b(de.Provider, {
|
|
472
474
|
value: s,
|
|
473
475
|
children: e
|
|
474
476
|
});
|
|
475
477
|
}
|
|
476
|
-
function
|
|
477
|
-
return c(
|
|
478
|
+
function ve() {
|
|
479
|
+
return c(de);
|
|
478
480
|
}
|
|
479
481
|
//#endregion
|
|
480
482
|
//#region src/components/primitives/BoolToggle.tsx
|
|
481
|
-
function
|
|
483
|
+
function ye({ value: e, onChange: t, id: n, ariaLabelledby: r }) {
|
|
482
484
|
return /* @__PURE__ */ b("button", {
|
|
483
485
|
type: "button",
|
|
484
486
|
id: n,
|
|
@@ -511,7 +513,7 @@ function be({ value: e, onChange: t, id: n, ariaLabelledby: r }) {
|
|
|
511
513
|
}
|
|
512
514
|
//#endregion
|
|
513
515
|
//#region src/components/primitives/MenuItem.tsx
|
|
514
|
-
function
|
|
516
|
+
function be({ icon: e, children: t, onClick: n, danger: r, kbd: i, active: a, divider: o, disabled: s, title: c, "data-testid": l }) {
|
|
515
517
|
return o ? /* @__PURE__ */ b("div", {
|
|
516
518
|
role: "separator",
|
|
517
519
|
style: {
|
|
@@ -565,7 +567,7 @@ function xe({ icon: e, children: t, onClick: n, danger: r, kbd: i, active: a, di
|
|
|
565
567
|
}
|
|
566
568
|
//#endregion
|
|
567
569
|
//#region src/components/primitives/Spinner.tsx
|
|
568
|
-
function
|
|
570
|
+
function xe({ size: e = 14 }) {
|
|
569
571
|
return /* @__PURE__ */ x("svg", {
|
|
570
572
|
width: e,
|
|
571
573
|
height: e,
|
|
@@ -593,7 +595,7 @@ function Se({ size: e = 14 }) {
|
|
|
593
595
|
}
|
|
594
596
|
//#endregion
|
|
595
597
|
//#region src/components/primitives/Fields.tsx
|
|
596
|
-
var
|
|
598
|
+
var Se = ({ children: e, required: n, hint: r }) => /* @__PURE__ */ x("div", {
|
|
597
599
|
style: {
|
|
598
600
|
display: "flex",
|
|
599
601
|
alignItems: "center",
|
|
@@ -621,7 +623,7 @@ var Ce = ({ children: e, required: n, hint: r }) => /* @__PURE__ */ x("div", {
|
|
|
621
623
|
children: /* @__PURE__ */ b(t.info, { size: 11 })
|
|
622
624
|
})
|
|
623
625
|
]
|
|
624
|
-
}),
|
|
626
|
+
}), Ce = {
|
|
625
627
|
width: "100%",
|
|
626
628
|
height: "var(--control-height)",
|
|
627
629
|
padding: "0 10px",
|
|
@@ -634,14 +636,14 @@ var Ce = ({ children: e, required: n, hint: r }) => /* @__PURE__ */ x("div", {
|
|
|
634
636
|
outline: "none",
|
|
635
637
|
transition: "border-color .12s, box-shadow .12s"
|
|
636
638
|
};
|
|
637
|
-
function
|
|
639
|
+
function F({ value: e, onChange: t, placeholder: n, prefix: r, suffix: i, style: a, ...o }) {
|
|
638
640
|
let [s, c] = p(!1);
|
|
639
641
|
return /* @__PURE__ */ x("div", {
|
|
640
642
|
style: {
|
|
641
643
|
display: "flex",
|
|
642
644
|
alignItems: "center",
|
|
643
645
|
gap: 6,
|
|
644
|
-
...
|
|
646
|
+
...Ce,
|
|
645
647
|
padding: r || i ? "0 8px" : "0 10px",
|
|
646
648
|
borderColor: s ? "var(--accent)" : "var(--border)",
|
|
647
649
|
boxShadow: s ? "0 0 0 3px var(--accent-ring)" : "none",
|
|
@@ -683,7 +685,7 @@ function P({ value: e, onChange: t, placeholder: n, prefix: r, suffix: i, style:
|
|
|
683
685
|
]
|
|
684
686
|
});
|
|
685
687
|
}
|
|
686
|
-
function
|
|
688
|
+
function we({ value: e, onChange: t, placeholder: n, rows: r = 4, fill: i, id: a, name: o, ariaRequired: s }) {
|
|
687
689
|
let [c, l] = p(!1), u = i ? {
|
|
688
690
|
flex: 1,
|
|
689
691
|
height: "100%",
|
|
@@ -704,7 +706,7 @@ function Te({ value: e, onChange: t, placeholder: n, rows: r = 4, fill: i, id: a
|
|
|
704
706
|
onFocus: () => l(!0),
|
|
705
707
|
onBlur: () => l(!1),
|
|
706
708
|
style: {
|
|
707
|
-
...
|
|
709
|
+
...Ce,
|
|
708
710
|
padding: "8px 10px",
|
|
709
711
|
lineHeight: 1.5,
|
|
710
712
|
...u,
|
|
@@ -714,17 +716,17 @@ function Te({ value: e, onChange: t, placeholder: n, rows: r = 4, fill: i, id: a
|
|
|
714
716
|
}
|
|
715
717
|
});
|
|
716
718
|
}
|
|
717
|
-
var
|
|
718
|
-
function
|
|
719
|
+
var Te = 20, Ee = 100;
|
|
720
|
+
function De(e) {
|
|
719
721
|
return typeof e.label == "string" || typeof e.label == "number" ? String(e.label) : e.value;
|
|
720
722
|
}
|
|
721
|
-
function
|
|
722
|
-
let [s, c] = p(!1), [l, u] = p(""), m = f(null), h = n.find((t) => !t.heading && !t.divider && t.value === e), g = n.filter((e) => !e.heading && !e.divider).length, _ = !!a, v = _ || g >
|
|
723
|
+
function I({ value: e, options: n, onChange: r, placeholder: i = "Select...", onSearchChange: a, ...o }) {
|
|
724
|
+
let [s, c] = p(!1), [l, u] = p(""), m = f(null), h = n.find((t) => !t.heading && !t.divider && t.value === e), g = n.filter((e) => !e.heading && !e.divider).length, _ = !!a, v = _ || g > Te, S = (e) => {
|
|
723
725
|
u(e), a?.(e);
|
|
724
726
|
}, C = d(() => {
|
|
725
|
-
if (_) return n.slice(0,
|
|
727
|
+
if (_) return n.slice(0, Ee);
|
|
726
728
|
let e = l.trim().toLowerCase();
|
|
727
|
-
return e ? n.filter((t) => !t.heading && !t.divider &&
|
|
729
|
+
return e ? n.filter((t) => !t.heading && !t.divider && De(t).toLowerCase().includes(e)).slice(0, Ee) : n.slice(0, Ee);
|
|
728
730
|
}, [
|
|
729
731
|
n,
|
|
730
732
|
l,
|
|
@@ -743,7 +745,7 @@ function F({ value: e, options: n, onChange: r, placeholder: i = "Select...", on
|
|
|
743
745
|
});
|
|
744
746
|
},
|
|
745
747
|
style: {
|
|
746
|
-
...
|
|
748
|
+
...Ce,
|
|
747
749
|
display: "flex",
|
|
748
750
|
alignItems: "center",
|
|
749
751
|
justifyContent: "space-between",
|
|
@@ -788,7 +790,7 @@ function F({ value: e, options: n, onChange: r, placeholder: i = "Select...", on
|
|
|
788
790
|
background: "var(--surface)",
|
|
789
791
|
zIndex: 1
|
|
790
792
|
},
|
|
791
|
-
children: /* @__PURE__ */ b(
|
|
793
|
+
children: /* @__PURE__ */ b(F, {
|
|
792
794
|
value: l,
|
|
793
795
|
onChange: S,
|
|
794
796
|
placeholder: "Search…",
|
|
@@ -809,7 +811,7 @@ function F({ value: e, options: n, onChange: r, placeholder: i = "Select...", on
|
|
|
809
811
|
letterSpacing: "0.06em"
|
|
810
812
|
},
|
|
811
813
|
children: t.label
|
|
812
|
-
}, `heading-${n}`) : /* @__PURE__ */ b(
|
|
814
|
+
}, `heading-${n}`) : /* @__PURE__ */ b(be, {
|
|
813
815
|
onClick: () => {
|
|
814
816
|
r(t.value), c(!1);
|
|
815
817
|
},
|
|
@@ -827,13 +829,13 @@ function F({ value: e, options: n, onChange: r, placeholder: i = "Select...", on
|
|
|
827
829
|
]
|
|
828
830
|
})] });
|
|
829
831
|
}
|
|
830
|
-
function
|
|
831
|
-
let [o, s] = p(!1), [c, l] = p(""), u = f(null), m = n.filter((e) => !e.heading && !e.divider), h = m.length >
|
|
832
|
+
function Oe({ value: e = [], options: n, onChange: r, placeholder: i = "Select…", ...a }) {
|
|
833
|
+
let [o, s] = p(!1), [c, l] = p(""), u = f(null), m = n.filter((e) => !e.heading && !e.divider), h = m.length > Te, g = e.map((e) => m.find((t) => t.value === e) ?? {
|
|
832
834
|
value: e,
|
|
833
835
|
label: e
|
|
834
836
|
}), _ = d(() => {
|
|
835
837
|
let e = c.trim().toLowerCase();
|
|
836
|
-
return e ? n.filter((t) => !t.heading && !t.divider &&
|
|
838
|
+
return e ? n.filter((t) => !t.heading && !t.divider && De(t).toLowerCase().includes(e)).slice(0, Ee) : n.slice(0, Ee);
|
|
837
839
|
}, [n, c]), v = (t) => r(e.includes(t) ? e.filter((e) => e !== t) : [...e, t]);
|
|
838
840
|
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ x("button", {
|
|
839
841
|
...a,
|
|
@@ -848,7 +850,7 @@ function ke({ value: e = [], options: n, onChange: r, placeholder: i = "Select
|
|
|
848
850
|
});
|
|
849
851
|
},
|
|
850
852
|
style: {
|
|
851
|
-
...
|
|
853
|
+
...Ce,
|
|
852
854
|
height: "auto",
|
|
853
855
|
minHeight: "var(--control-height)",
|
|
854
856
|
display: "flex",
|
|
@@ -889,7 +891,7 @@ function ke({ value: e = [], options: n, onChange: r, placeholder: i = "Select
|
|
|
889
891
|
children: e.label
|
|
890
892
|
}), /* @__PURE__ */ b("span", {
|
|
891
893
|
role: "button",
|
|
892
|
-
"aria-label": `Remove ${
|
|
894
|
+
"aria-label": `Remove ${De(e)}`,
|
|
893
895
|
onClick: (t) => {
|
|
894
896
|
t.stopPropagation(), v(e.value);
|
|
895
897
|
},
|
|
@@ -928,7 +930,7 @@ function ke({ value: e = [], options: n, onChange: r, placeholder: i = "Select
|
|
|
928
930
|
background: "var(--surface)",
|
|
929
931
|
zIndex: 1
|
|
930
932
|
},
|
|
931
|
-
children: /* @__PURE__ */ b(
|
|
933
|
+
children: /* @__PURE__ */ b(F, {
|
|
932
934
|
value: c,
|
|
933
935
|
onChange: l,
|
|
934
936
|
placeholder: "Search…",
|
|
@@ -953,7 +955,7 @@ function ke({ value: e = [], options: n, onChange: r, placeholder: i = "Select
|
|
|
953
955
|
children: n.label
|
|
954
956
|
}, `heading-${r}`);
|
|
955
957
|
let i = e.includes(n.value);
|
|
956
|
-
return /* @__PURE__ */ b(
|
|
958
|
+
return /* @__PURE__ */ b(be, {
|
|
957
959
|
active: i,
|
|
958
960
|
icon: i ? /* @__PURE__ */ b(t.check, { size: 13 }) : /* @__PURE__ */ b("span", { style: {
|
|
959
961
|
display: "inline-block",
|
|
@@ -974,35 +976,35 @@ function ke({ value: e = [], options: n, onChange: r, placeholder: i = "Select
|
|
|
974
976
|
]
|
|
975
977
|
})] });
|
|
976
978
|
}
|
|
977
|
-
function
|
|
978
|
-
return /* @__PURE__ */ b(
|
|
979
|
+
function ke({ value: e, onChange: n }) {
|
|
980
|
+
return /* @__PURE__ */ b(F, {
|
|
979
981
|
value: e || "",
|
|
980
982
|
onChange: n,
|
|
981
983
|
placeholder: "YYYY-MM-DD HH:mm",
|
|
982
984
|
prefix: /* @__PURE__ */ b(t.calendar, { size: 13 })
|
|
983
985
|
});
|
|
984
986
|
}
|
|
985
|
-
function
|
|
987
|
+
function Ae(e) {
|
|
986
988
|
if (!e) return 0;
|
|
987
989
|
let t = 0;
|
|
988
990
|
return e.length >= 8 && t++, e.length >= 12 && t++, /[A-Z]/.test(e) && /[a-z]/.test(e) && t++, /\d/.test(e) && t++, /[^A-Za-z0-9]/.test(e) && t++, Math.min(4, t);
|
|
989
991
|
}
|
|
990
|
-
var
|
|
992
|
+
var je = [
|
|
991
993
|
"Too short",
|
|
992
994
|
"Weak",
|
|
993
995
|
"Fair",
|
|
994
996
|
"Good",
|
|
995
997
|
"Strong"
|
|
996
|
-
],
|
|
998
|
+
], Me = [
|
|
997
999
|
"var(--danger)",
|
|
998
1000
|
"var(--danger)",
|
|
999
1001
|
"var(--warning, #B45309)",
|
|
1000
1002
|
"var(--accent)",
|
|
1001
1003
|
"var(--success, #3FBF8F)"
|
|
1002
1004
|
];
|
|
1003
|
-
function
|
|
1004
|
-
let [c, l] = p(!1), u = e || "", d =
|
|
1005
|
-
return /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b(
|
|
1005
|
+
function Ne({ value: e, onChange: n, placeholder: r = "Enter password", showStrength: i, id: a, name: o, ariaRequired: s }) {
|
|
1006
|
+
let [c, l] = p(!1), u = e || "", d = Ae(u);
|
|
1007
|
+
return /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b(F, {
|
|
1006
1008
|
id: a,
|
|
1007
1009
|
name: o,
|
|
1008
1010
|
"aria-required": s || void 0,
|
|
@@ -1046,7 +1048,7 @@ function Pe({ value: e, onChange: n, placeholder: r = "Enter password", showStre
|
|
|
1046
1048
|
flex: 1,
|
|
1047
1049
|
height: 3,
|
|
1048
1050
|
borderRadius: 999,
|
|
1049
|
-
background: e < d ?
|
|
1051
|
+
background: e < d ? Me[d] : "var(--surface-3)",
|
|
1050
1052
|
transition: "background .15s"
|
|
1051
1053
|
} }, e))
|
|
1052
1054
|
}), /* @__PURE__ */ b("span", {
|
|
@@ -1056,15 +1058,15 @@ function Pe({ value: e, onChange: n, placeholder: r = "Enter password", showStre
|
|
|
1056
1058
|
minWidth: 54,
|
|
1057
1059
|
textAlign: "right"
|
|
1058
1060
|
},
|
|
1059
|
-
children: u ?
|
|
1061
|
+
children: u ? je[d] : ""
|
|
1060
1062
|
})]
|
|
1061
1063
|
})] });
|
|
1062
1064
|
}
|
|
1063
|
-
function
|
|
1065
|
+
function Pe({ value: e = [], onChange: t }) {
|
|
1064
1066
|
let [n, r] = p("");
|
|
1065
1067
|
return /* @__PURE__ */ x("div", {
|
|
1066
1068
|
style: {
|
|
1067
|
-
...
|
|
1069
|
+
...Ce,
|
|
1068
1070
|
height: "auto",
|
|
1069
1071
|
minHeight: "var(--control-height)",
|
|
1070
1072
|
display: "flex",
|
|
@@ -1073,7 +1075,7 @@ function Fe({ value: e = [], onChange: t }) {
|
|
|
1073
1075
|
padding: "4px 6px",
|
|
1074
1076
|
alignItems: "center"
|
|
1075
1077
|
},
|
|
1076
|
-
children: [e.map((n, r) => /* @__PURE__ */ b(
|
|
1078
|
+
children: [e.map((n, r) => /* @__PURE__ */ b(P, {
|
|
1077
1079
|
tone: "slate",
|
|
1078
1080
|
onRemove: () => t(e.filter((e, t) => t !== r)),
|
|
1079
1081
|
children: n
|
|
@@ -1096,7 +1098,7 @@ function Fe({ value: e = [], onChange: t }) {
|
|
|
1096
1098
|
})]
|
|
1097
1099
|
});
|
|
1098
1100
|
}
|
|
1099
|
-
function
|
|
1101
|
+
function Fe({ value: e, onChange: t }) {
|
|
1100
1102
|
return /* @__PURE__ */ x("div", {
|
|
1101
1103
|
style: {
|
|
1102
1104
|
border: "1px solid var(--border)",
|
|
@@ -1155,7 +1157,7 @@ function Ie({ value: e, onChange: t }) {
|
|
|
1155
1157
|
})]
|
|
1156
1158
|
});
|
|
1157
1159
|
}
|
|
1158
|
-
function
|
|
1160
|
+
function Ie({ value: e, entity: n = "company", onChange: r, items: i = [], id: a, ariaLabelledby: o, ariaRequired: s }) {
|
|
1159
1161
|
let [c, l] = p(!1), u = f(null);
|
|
1160
1162
|
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ x("button", {
|
|
1161
1163
|
type: "button",
|
|
@@ -1165,7 +1167,7 @@ function Le({ value: e, entity: n = "company", onChange: r, items: i = [], id: a
|
|
|
1165
1167
|
ref: u,
|
|
1166
1168
|
onClick: () => l(!0),
|
|
1167
1169
|
style: {
|
|
1168
|
-
...
|
|
1170
|
+
...Ce,
|
|
1169
1171
|
display: "flex",
|
|
1170
1172
|
alignItems: "center",
|
|
1171
1173
|
justifyContent: "space-between",
|
|
@@ -1207,12 +1209,12 @@ function Le({ value: e, entity: n = "company", onChange: r, items: i = [], id: a
|
|
|
1207
1209
|
width: u.current?.offsetWidth,
|
|
1208
1210
|
children: [/* @__PURE__ */ b("div", {
|
|
1209
1211
|
style: { padding: 4 },
|
|
1210
|
-
children: /* @__PURE__ */ b(
|
|
1212
|
+
children: /* @__PURE__ */ b(F, {
|
|
1211
1213
|
placeholder: `Search ${n}…`,
|
|
1212
1214
|
prefix: /* @__PURE__ */ b(t.search, { size: 12 }),
|
|
1213
1215
|
style: { marginBottom: 4 }
|
|
1214
1216
|
})
|
|
1215
|
-
}), i.slice(0, 6).map((e) => /* @__PURE__ */ b(
|
|
1217
|
+
}), i.slice(0, 6).map((e) => /* @__PURE__ */ b(be, {
|
|
1216
1218
|
icon: /* @__PURE__ */ b(t.building, { size: 13 }),
|
|
1217
1219
|
onClick: () => {
|
|
1218
1220
|
r?.(e.name), l(!1);
|
|
@@ -1221,7 +1223,7 @@ function Le({ value: e, entity: n = "company", onChange: r, items: i = [], id: a
|
|
|
1221
1223
|
}, e.id))]
|
|
1222
1224
|
})] });
|
|
1223
1225
|
}
|
|
1224
|
-
function
|
|
1226
|
+
function Le({ label: e, children: t, mono: n, wide: r, empty: i }) {
|
|
1225
1227
|
return /* @__PURE__ */ x("div", {
|
|
1226
1228
|
style: {
|
|
1227
1229
|
display: "flex",
|
|
@@ -1254,7 +1256,7 @@ function Re({ label: e, children: t, mono: n, wide: r, empty: i }) {
|
|
|
1254
1256
|
})]
|
|
1255
1257
|
});
|
|
1256
1258
|
}
|
|
1257
|
-
function
|
|
1259
|
+
function Re({ value: e, onChange: n, type: r = "text", options: i }) {
|
|
1258
1260
|
let [a, o] = p(!1), [s, c] = p(e), l = () => {
|
|
1259
1261
|
s !== void 0 && n?.(s), o(!1);
|
|
1260
1262
|
}, u = () => {
|
|
@@ -1269,19 +1271,19 @@ function ze({ value: e, onChange: n, type: r = "text", options: i }) {
|
|
|
1269
1271
|
onKeyDown: (e) => {
|
|
1270
1272
|
e.key === "Enter" && l(), e.key === "Escape" && u();
|
|
1271
1273
|
},
|
|
1272
|
-
children: [r === "select" ? /* @__PURE__ */ b(
|
|
1274
|
+
children: [r === "select" ? /* @__PURE__ */ b(I, {
|
|
1273
1275
|
value: s,
|
|
1274
1276
|
options: i || [],
|
|
1275
1277
|
onChange: (e) => {
|
|
1276
1278
|
c(e), n?.(e), o(!1);
|
|
1277
1279
|
}
|
|
1278
|
-
}) : r === "bool" ? /* @__PURE__ */ b(
|
|
1280
|
+
}) : r === "bool" ? /* @__PURE__ */ b(ye, {
|
|
1279
1281
|
value: s === "true",
|
|
1280
1282
|
onChange: (e) => {
|
|
1281
1283
|
let t = String(e);
|
|
1282
1284
|
c(t), n?.(t), o(!1);
|
|
1283
1285
|
}
|
|
1284
|
-
}) : /* @__PURE__ */ b(
|
|
1286
|
+
}) : /* @__PURE__ */ b(F, {
|
|
1285
1287
|
value: s ?? "",
|
|
1286
1288
|
onChange: c,
|
|
1287
1289
|
autoFocus: !0
|
|
@@ -1323,7 +1325,7 @@ function ze({ value: e, onChange: n, type: r = "text", options: i }) {
|
|
|
1323
1325
|
}
|
|
1324
1326
|
//#endregion
|
|
1325
1327
|
//#region src/types/ordmap.ts
|
|
1326
|
-
var
|
|
1328
|
+
var L = class e {
|
|
1327
1329
|
#e;
|
|
1328
1330
|
#t;
|
|
1329
1331
|
constructor(e) {
|
|
@@ -1366,7 +1368,7 @@ var Be = class e {
|
|
|
1366
1368
|
};
|
|
1367
1369
|
//#endregion
|
|
1368
1370
|
//#region src/lib/display-value.ts
|
|
1369
|
-
function
|
|
1371
|
+
function R(e) {
|
|
1370
1372
|
if (e == null) return "";
|
|
1371
1373
|
switch (typeof e) {
|
|
1372
1374
|
case "string": return e;
|
|
@@ -1384,10 +1386,10 @@ function I(e) {
|
|
|
1384
1386
|
}
|
|
1385
1387
|
//#endregion
|
|
1386
1388
|
//#region src/lib/timestamp.ts
|
|
1387
|
-
function
|
|
1389
|
+
function ze(e = /* @__PURE__ */ new Date()) {
|
|
1388
1390
|
return T(e);
|
|
1389
1391
|
}
|
|
1390
|
-
function
|
|
1392
|
+
function Be(e, t) {
|
|
1391
1393
|
let n = e.match(/([+-]\d{2}:\d{2})$/), r = e.endsWith("Z"), i = new Date(e);
|
|
1392
1394
|
if (isNaN(i.getTime())) return e;
|
|
1393
1395
|
if (n || r) {
|
|
@@ -1413,13 +1415,13 @@ function He(e, t) {
|
|
|
1413
1415
|
}
|
|
1414
1416
|
return new Intl.DateTimeFormat(void 0, t).format(i);
|
|
1415
1417
|
}
|
|
1416
|
-
function
|
|
1417
|
-
return
|
|
1418
|
+
function Ve(e) {
|
|
1419
|
+
return Be(e, {
|
|
1418
1420
|
dateStyle: "medium",
|
|
1419
1421
|
timeStyle: "short"
|
|
1420
1422
|
});
|
|
1421
1423
|
}
|
|
1422
|
-
function
|
|
1424
|
+
function He(e, t = /* @__PURE__ */ new Date()) {
|
|
1423
1425
|
if (e == null || e === "") return {
|
|
1424
1426
|
text: "—",
|
|
1425
1427
|
absolute: ""
|
|
@@ -1432,8 +1434,8 @@ function We(e, t = /* @__PURE__ */ new Date()) {
|
|
|
1432
1434
|
absolute: t
|
|
1433
1435
|
};
|
|
1434
1436
|
}
|
|
1435
|
-
let r =
|
|
1436
|
-
return Math.abs(i) >
|
|
1437
|
+
let r = Ve(typeof e == "string" ? e : n.toISOString()), i = t.getTime() - n.getTime();
|
|
1438
|
+
return Math.abs(i) > 2592e6 ? {
|
|
1437
1439
|
text: T(n, { representation: "date" }),
|
|
1438
1440
|
absolute: r
|
|
1439
1441
|
} : {
|
|
@@ -1441,40 +1443,40 @@ function We(e, t = /* @__PURE__ */ new Date()) {
|
|
|
1441
1443
|
absolute: r
|
|
1442
1444
|
};
|
|
1443
1445
|
}
|
|
1444
|
-
function
|
|
1446
|
+
function z(e, t = "en") {
|
|
1445
1447
|
return e ? e[t] ?? Object.values(e)[0] ?? "" : "";
|
|
1446
1448
|
}
|
|
1447
|
-
var
|
|
1448
|
-
function
|
|
1449
|
+
var Ue = "$display";
|
|
1450
|
+
function We(e, t) {
|
|
1449
1451
|
if (!e) return;
|
|
1450
|
-
let n = e[
|
|
1452
|
+
let n = e[Ue];
|
|
1451
1453
|
if (typeof n == "string" && n !== "") return n;
|
|
1452
1454
|
let r = t?.display?.display_field;
|
|
1453
1455
|
if (!r) return;
|
|
1454
1456
|
let i = e[r];
|
|
1455
1457
|
if (i == null) return;
|
|
1456
1458
|
let a = t?.fields?.get(r);
|
|
1457
|
-
if (a?.type === "timestamp" && typeof i == "string" && i !== "") return
|
|
1459
|
+
if (a?.type === "timestamp" && typeof i == "string" && i !== "") return Ve(i);
|
|
1458
1460
|
let o = a?.values;
|
|
1459
1461
|
if (o && (typeof i == "string" || typeof i == "number")) {
|
|
1460
1462
|
let e = o.find((e) => e.code === String(i));
|
|
1461
1463
|
if (e) {
|
|
1462
|
-
let t =
|
|
1464
|
+
let t = z(e.name);
|
|
1463
1465
|
if (t) return t;
|
|
1464
1466
|
}
|
|
1465
1467
|
}
|
|
1466
|
-
return typeof i == "object" && !Array.isArray(i) ?
|
|
1468
|
+
return typeof i == "object" && !Array.isArray(i) ? z(i) || void 0 : R(i);
|
|
1467
1469
|
}
|
|
1468
|
-
function
|
|
1470
|
+
function Ge(e, t, n) {
|
|
1469
1471
|
if (!t) return n;
|
|
1470
1472
|
let r = e[t];
|
|
1471
|
-
return r == null ? n : typeof r == "object" && !Array.isArray(r) ?
|
|
1473
|
+
return r == null ? n : typeof r == "object" && !Array.isArray(r) ? z(r) || n : R(r);
|
|
1472
1474
|
}
|
|
1473
|
-
function
|
|
1475
|
+
function Ke(e) {
|
|
1474
1476
|
let t = e.replace(/\/+$/, "").split("/").map((e) => e.startsWith(":") ? "[^/]+" : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
1475
1477
|
return RegExp("^" + t.join("/") + "$");
|
|
1476
1478
|
}
|
|
1477
|
-
function
|
|
1479
|
+
function qe(e) {
|
|
1478
1480
|
let t = (() => {
|
|
1479
1481
|
try {
|
|
1480
1482
|
return decodeURIComponent(e);
|
|
@@ -1484,17 +1486,17 @@ function Je(e) {
|
|
|
1484
1486
|
})().split("-")[0];
|
|
1485
1487
|
return t.length > 8 ? t.slice(0, 8) : t;
|
|
1486
1488
|
}
|
|
1487
|
-
function
|
|
1489
|
+
function Je(e, t, n) {
|
|
1488
1490
|
if (!t) return;
|
|
1489
1491
|
let r = e.replace(/\/+$/, "") || "/", i;
|
|
1490
1492
|
for (let e of Object.values(t)) {
|
|
1491
|
-
if (!e.route || !
|
|
1492
|
-
let t = e.route.includes("/:"), a =
|
|
1493
|
+
if (!e.route || !Ke(e.route).test(r)) continue;
|
|
1494
|
+
let t = e.route.includes("/:"), a = z(e.display?.name);
|
|
1493
1495
|
if (!a && t && n && e.entity) {
|
|
1494
|
-
let t =
|
|
1496
|
+
let t = z(n[e.entity]?.display?.name);
|
|
1495
1497
|
if (t) {
|
|
1496
1498
|
let e = r.slice(r.lastIndexOf("/") + 1);
|
|
1497
|
-
a = e ? `${t} ${
|
|
1499
|
+
a = e ? `${t} ${qe(e)}` : t;
|
|
1498
1500
|
}
|
|
1499
1501
|
}
|
|
1500
1502
|
if (!a) continue;
|
|
@@ -1507,22 +1509,22 @@ function Ye(e, t, n) {
|
|
|
1507
1509
|
}
|
|
1508
1510
|
return i;
|
|
1509
1511
|
}
|
|
1510
|
-
function
|
|
1511
|
-
let r =
|
|
1512
|
+
function Ye(e, t, n) {
|
|
1513
|
+
let r = z(e.display?.name);
|
|
1512
1514
|
if (r) return r;
|
|
1513
1515
|
if (e.type === "ref" && e.ref?.entity && n) {
|
|
1514
1516
|
let t = n[e.ref.entity];
|
|
1515
1517
|
if (t) {
|
|
1516
|
-
let e =
|
|
1518
|
+
let e = z(t.display?.name);
|
|
1517
1519
|
if (e) return e;
|
|
1518
1520
|
}
|
|
1519
1521
|
}
|
|
1520
1522
|
return t;
|
|
1521
1523
|
}
|
|
1522
|
-
function
|
|
1524
|
+
function Xe(e) {
|
|
1523
1525
|
if (e != null) return typeof e == "string" ? { entity: e } : e;
|
|
1524
1526
|
}
|
|
1525
|
-
function
|
|
1527
|
+
function Ze(e, t) {
|
|
1526
1528
|
let n = e ?? [];
|
|
1527
1529
|
if (!t) return n;
|
|
1528
1530
|
switch (t.mode ?? "append") {
|
|
@@ -1531,7 +1533,7 @@ function Qe(e, t) {
|
|
|
1531
1533
|
default: return [...n, ...t.values ?? []];
|
|
1532
1534
|
}
|
|
1533
1535
|
}
|
|
1534
|
-
function
|
|
1536
|
+
function Qe(e) {
|
|
1535
1537
|
let t = e.name, n = e.display ? {
|
|
1536
1538
|
...e.display,
|
|
1537
1539
|
name: e.display.name ?? t
|
|
@@ -1544,36 +1546,36 @@ function $e(e) {
|
|
|
1544
1546
|
structure: e.structure
|
|
1545
1547
|
};
|
|
1546
1548
|
}
|
|
1547
|
-
function
|
|
1549
|
+
function $e(e, t) {
|
|
1548
1550
|
return !e || e.readonly ? !1 : e.mutations?.[t] ?? !0;
|
|
1549
1551
|
}
|
|
1550
|
-
function
|
|
1552
|
+
function et(e) {
|
|
1551
1553
|
return !e?.disable_defaults?.includes("__new");
|
|
1552
1554
|
}
|
|
1553
|
-
function
|
|
1555
|
+
function B(e) {
|
|
1554
1556
|
if (e.primary_key && e.primary_key.length > 0) return e.primary_key;
|
|
1555
1557
|
for (let [t, n] of e.fields) if (n.primary) return [t];
|
|
1556
1558
|
return ["id"];
|
|
1557
1559
|
}
|
|
1558
|
-
function
|
|
1559
|
-
let n =
|
|
1560
|
-
for (let e of n) r[e] =
|
|
1560
|
+
function tt(e, t) {
|
|
1561
|
+
let n = B(e), r = {};
|
|
1562
|
+
for (let e of n) r[e] = R(t[e]);
|
|
1561
1563
|
return r;
|
|
1562
1564
|
}
|
|
1563
|
-
function
|
|
1565
|
+
function nt(e) {
|
|
1564
1566
|
return e.length === 1 ? e[0] : JSON.stringify(e);
|
|
1565
1567
|
}
|
|
1566
|
-
function
|
|
1567
|
-
return
|
|
1568
|
+
function rt(e) {
|
|
1569
|
+
return nt(Object.values(e));
|
|
1568
1570
|
}
|
|
1569
|
-
function
|
|
1570
|
-
return
|
|
1571
|
+
function it(e, t) {
|
|
1572
|
+
return nt(B(e).map((e) => t[e] ?? ""));
|
|
1571
1573
|
}
|
|
1572
|
-
function
|
|
1573
|
-
let n =
|
|
1574
|
+
function at(e, t) {
|
|
1575
|
+
let n = B(e);
|
|
1574
1576
|
if (n.length === 1) return { [n[0]]: t };
|
|
1575
1577
|
}
|
|
1576
|
-
function
|
|
1578
|
+
function ot(e, t) {
|
|
1577
1579
|
if (t <= 1) return [e];
|
|
1578
1580
|
try {
|
|
1579
1581
|
let n = JSON.parse(e);
|
|
@@ -1583,28 +1585,28 @@ function st(e, t) {
|
|
|
1583
1585
|
}
|
|
1584
1586
|
return null;
|
|
1585
1587
|
}
|
|
1586
|
-
function
|
|
1588
|
+
function st(e, t, n) {
|
|
1587
1589
|
if (e?.detail_screen === "none") return null;
|
|
1588
1590
|
let r = e?.detail_screen ?? t?.detail_screen;
|
|
1589
1591
|
return r ? n?.[r]?.route ?? null : null;
|
|
1590
1592
|
}
|
|
1591
|
-
function
|
|
1593
|
+
function ct(e, t, n, r) {
|
|
1592
1594
|
if (!t) return null;
|
|
1593
|
-
let i =
|
|
1595
|
+
let i = st(e, n, r);
|
|
1594
1596
|
return i ? i.replace(":id", encodeURIComponent(t)) : null;
|
|
1595
1597
|
}
|
|
1596
|
-
function
|
|
1597
|
-
return !t ||
|
|
1598
|
+
function lt(e, t, n, r) {
|
|
1599
|
+
return !t || B(t).some((e) => !r[e]) ? null : ct(e, it(t, r), t, n);
|
|
1598
1600
|
}
|
|
1599
|
-
function
|
|
1600
|
-
return t ?
|
|
1601
|
+
function ut(e, t, n, r) {
|
|
1602
|
+
return t ? lt(e, t, n, tt(t, r)) : null;
|
|
1601
1603
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return
|
|
1604
|
+
function dt(e) {
|
|
1605
|
+
return B(e).length > 1;
|
|
1604
1606
|
}
|
|
1605
1607
|
//#endregion
|
|
1606
1608
|
//#region src/types/api.ts
|
|
1607
|
-
var
|
|
1609
|
+
var V = class extends Error {
|
|
1608
1610
|
status;
|
|
1609
1611
|
code;
|
|
1610
1612
|
index;
|
|
@@ -1612,42 +1614,42 @@ var B = class extends Error {
|
|
|
1612
1614
|
constructor(e, t, n, r, i) {
|
|
1613
1615
|
super(t), this.name = "ApiError", this.status = e, this.code = n, this.index = r, this.raw = i;
|
|
1614
1616
|
}
|
|
1615
|
-
},
|
|
1616
|
-
function
|
|
1617
|
-
return e instanceof
|
|
1617
|
+
}, ft = "cursor_semantics_mismatch", pt = "cursor_locale_changed";
|
|
1618
|
+
function mt(e) {
|
|
1619
|
+
return e instanceof V && (e.code === "cursor_semantics_mismatch" || e.code === "cursor_locale_changed" || e.code === "archive_cursor_invalid");
|
|
1618
1620
|
}
|
|
1619
1621
|
//#endregion
|
|
1620
1622
|
//#region src/api/auth-redirect.ts
|
|
1621
|
-
var
|
|
1622
|
-
function
|
|
1623
|
+
var H = "/", ht = "/login", gt = "/signup", _t = "https://declarion.local";
|
|
1624
|
+
function vt(e) {
|
|
1623
1625
|
let t = e.split(/[?#]/, 1)[0];
|
|
1624
|
-
return t ===
|
|
1626
|
+
return t === ht || t.startsWith(`${ht}/`) || t === gt || t.startsWith(`${gt}/`);
|
|
1625
1627
|
}
|
|
1626
|
-
function
|
|
1627
|
-
if (!e) return
|
|
1628
|
+
function yt(e) {
|
|
1629
|
+
if (!e) return H;
|
|
1628
1630
|
let t = e.toLowerCase();
|
|
1629
|
-
if (!e.startsWith("/") || e.startsWith("//") || e.includes("\\") || t.includes("%5c")) return
|
|
1631
|
+
if (!e.startsWith("/") || e.startsWith("//") || e.includes("\\") || t.includes("%5c")) return H;
|
|
1630
1632
|
try {
|
|
1631
|
-
let t = new URL(e,
|
|
1632
|
-
if (t.origin !==
|
|
1633
|
+
let t = new URL(e, _t);
|
|
1634
|
+
if (t.origin !== _t) return H;
|
|
1633
1635
|
let n = `${t.pathname}${t.search}${t.hash}`;
|
|
1634
|
-
return !n.startsWith("/") || n.startsWith("//") || n.includes("\\") ?
|
|
1636
|
+
return !n.startsWith("/") || n.startsWith("//") || n.includes("\\") ? H : n || H;
|
|
1635
1637
|
} catch {
|
|
1636
|
-
return
|
|
1638
|
+
return H;
|
|
1637
1639
|
}
|
|
1638
1640
|
}
|
|
1639
|
-
function
|
|
1640
|
-
let t =
|
|
1641
|
-
return t ===
|
|
1641
|
+
function bt(e) {
|
|
1642
|
+
let t = yt(e);
|
|
1643
|
+
return t === H || vt(t) ? ht : `${ht}?next=${encodeURIComponent(t)}`;
|
|
1642
1644
|
}
|
|
1643
|
-
function
|
|
1644
|
-
if (typeof window > "u") return
|
|
1645
|
+
function xt() {
|
|
1646
|
+
if (typeof window > "u") return ht;
|
|
1645
1647
|
let { pathname: e, search: t, hash: n } = window.location;
|
|
1646
|
-
return
|
|
1648
|
+
return bt(`${e}${t}${n}`);
|
|
1647
1649
|
}
|
|
1648
1650
|
//#endregion
|
|
1649
1651
|
//#region src/embed/protocol.ts
|
|
1650
|
-
var
|
|
1652
|
+
var St = "declarion-embed", Ct = {
|
|
1651
1653
|
ready: "ready",
|
|
1652
1654
|
setToken: "set-token",
|
|
1653
1655
|
tokenExpired: "token-expired",
|
|
@@ -1660,10 +1662,10 @@ var Ct = "declarion-embed", wt = {
|
|
|
1660
1662
|
navigate: "navigate",
|
|
1661
1663
|
setTheme: "set-theme"
|
|
1662
1664
|
};
|
|
1663
|
-
function
|
|
1665
|
+
function wt(e, t, n) {
|
|
1664
1666
|
if (!e || typeof window > "u" || window.parent === window) return !1;
|
|
1665
1667
|
let r = {
|
|
1666
|
-
source:
|
|
1668
|
+
source: St,
|
|
1667
1669
|
protocol: 1,
|
|
1668
1670
|
type: t,
|
|
1669
1671
|
payload: n
|
|
@@ -1672,68 +1674,68 @@ function Tt(e, t, n) {
|
|
|
1672
1674
|
}
|
|
1673
1675
|
//#endregion
|
|
1674
1676
|
//#region src/embed/token.ts
|
|
1675
|
-
var
|
|
1677
|
+
var Tt = 15e3, Et = 5e3, U = {
|
|
1676
1678
|
active: !1,
|
|
1677
1679
|
parentOrigin: null,
|
|
1678
1680
|
current: null,
|
|
1679
1681
|
pending: null
|
|
1680
1682
|
};
|
|
1681
|
-
function
|
|
1682
|
-
|
|
1683
|
+
function Dt(e) {
|
|
1684
|
+
U.active = !0, U.parentOrigin = e;
|
|
1685
|
+
}
|
|
1686
|
+
function Ot() {
|
|
1687
|
+
return U.active;
|
|
1683
1688
|
}
|
|
1684
1689
|
function kt() {
|
|
1685
|
-
return
|
|
1690
|
+
return U.current?.token ?? null;
|
|
1686
1691
|
}
|
|
1687
1692
|
function At() {
|
|
1688
|
-
return
|
|
1693
|
+
return U.parentOrigin;
|
|
1689
1694
|
}
|
|
1690
1695
|
function jt() {
|
|
1691
|
-
return
|
|
1692
|
-
}
|
|
1693
|
-
function Mt() {
|
|
1694
|
-
return !H.current || Date.now() >= H.current.expiresAt - Dt;
|
|
1696
|
+
return !U.current || Date.now() >= U.current.expiresAt - Et;
|
|
1695
1697
|
}
|
|
1696
|
-
function
|
|
1698
|
+
function Mt(e) {
|
|
1697
1699
|
if (!e.token || typeof e.token != "string") return;
|
|
1698
1700
|
let t = Date.parse(e.expires_at);
|
|
1699
|
-
if (!Number.isNaN(t) && (
|
|
1701
|
+
if (!Number.isNaN(t) && (U.current = {
|
|
1700
1702
|
token: e.token,
|
|
1701
1703
|
expiresAt: t
|
|
1702
|
-
},
|
|
1703
|
-
let t =
|
|
1704
|
-
|
|
1704
|
+
}, U.pending)) {
|
|
1705
|
+
let t = U.pending;
|
|
1706
|
+
U.pending = null, clearTimeout(t.timer), t.resolve(e.token);
|
|
1705
1707
|
}
|
|
1706
1708
|
}
|
|
1707
|
-
function
|
|
1708
|
-
|
|
1709
|
+
function Nt() {
|
|
1710
|
+
U.current = null;
|
|
1709
1711
|
}
|
|
1710
|
-
function
|
|
1711
|
-
if (!
|
|
1712
|
-
if (
|
|
1712
|
+
function Pt() {
|
|
1713
|
+
if (!jt() && U.current) return Promise.resolve(U.current.token);
|
|
1714
|
+
if (U.pending) return U.pending.promise;
|
|
1713
1715
|
let e, t, n = new Promise((n, r) => {
|
|
1714
1716
|
e = n, t = r;
|
|
1715
1717
|
}), r = setTimeout(() => {
|
|
1716
|
-
|
|
1717
|
-
},
|
|
1718
|
-
return
|
|
1718
|
+
U.pending && U.pending.promise === n && (U.pending = null), t(/* @__PURE__ */ Error(`embed token wait timed out after ${Tt}ms`));
|
|
1719
|
+
}, Tt);
|
|
1720
|
+
return U.pending = {
|
|
1719
1721
|
promise: n,
|
|
1720
1722
|
resolve: e,
|
|
1721
1723
|
reject: t,
|
|
1722
1724
|
timer: r
|
|
1723
|
-
},
|
|
1725
|
+
}, wt(U.parentOrigin, Ct.tokenExpired, {}), n;
|
|
1724
1726
|
}
|
|
1725
1727
|
//#endregion
|
|
1726
1728
|
//#region src/lib/versionTracker.ts
|
|
1727
|
-
var
|
|
1728
|
-
function
|
|
1729
|
+
var Ft = "X-Declarion-Version", It = "declarion-version";
|
|
1730
|
+
function Lt() {
|
|
1729
1731
|
if (typeof BroadcastChannel > "u") return null;
|
|
1730
1732
|
try {
|
|
1731
|
-
return new BroadcastChannel(
|
|
1733
|
+
return new BroadcastChannel(It);
|
|
1732
1734
|
} catch {
|
|
1733
1735
|
return null;
|
|
1734
1736
|
}
|
|
1735
1737
|
}
|
|
1736
|
-
var
|
|
1738
|
+
var W = {
|
|
1737
1739
|
firstSeen: null,
|
|
1738
1740
|
firstComponents: null,
|
|
1739
1741
|
hasReportedDrift: !1,
|
|
@@ -1741,39 +1743,39 @@ var U = {
|
|
|
1741
1743
|
listeners: /* @__PURE__ */ new Set(),
|
|
1742
1744
|
channel: null
|
|
1743
1745
|
};
|
|
1744
|
-
function
|
|
1745
|
-
|
|
1746
|
+
function Rt() {
|
|
1747
|
+
W.channel || typeof BroadcastChannel > "u" || (W.channel = Lt(), W.channel && W.channel.addEventListener("message", (e) => {
|
|
1746
1748
|
let t = e.data;
|
|
1747
|
-
if (!(!t || t.type !== "drift" || !t.delta) && !
|
|
1748
|
-
|
|
1749
|
-
for (let e of
|
|
1749
|
+
if (!(!t || t.type !== "drift" || !t.delta) && !W.hasReportedDrift) {
|
|
1750
|
+
W.hasReportedDrift = !0;
|
|
1751
|
+
for (let e of W.listeners) e(t.delta);
|
|
1750
1752
|
}
|
|
1751
1753
|
}));
|
|
1752
1754
|
}
|
|
1753
|
-
function
|
|
1754
|
-
if (
|
|
1755
|
-
let t = e.get(
|
|
1755
|
+
function zt(e) {
|
|
1756
|
+
if (Rt(), !e) return;
|
|
1757
|
+
let t = e.get(Ft);
|
|
1756
1758
|
if (t) {
|
|
1757
|
-
if (!
|
|
1758
|
-
|
|
1759
|
+
if (!W.firstSeen) {
|
|
1760
|
+
W.firstSeen = t;
|
|
1759
1761
|
return;
|
|
1760
1762
|
}
|
|
1761
|
-
t !==
|
|
1762
|
-
|
|
1763
|
+
t !== W.firstSeen && (W.hasReportedDrift || Bt().catch(() => {
|
|
1764
|
+
Ht({
|
|
1763
1765
|
kind: "unknown",
|
|
1764
1766
|
observed: t
|
|
1765
1767
|
});
|
|
1766
1768
|
}));
|
|
1767
1769
|
}
|
|
1768
1770
|
}
|
|
1769
|
-
async function
|
|
1770
|
-
|
|
1771
|
+
async function Bt() {
|
|
1772
|
+
Rt();
|
|
1771
1773
|
let e;
|
|
1772
1774
|
try {
|
|
1773
1775
|
let t = {};
|
|
1774
|
-
|
|
1776
|
+
W.firstSeen && (t["If-None-Match"] = `"${W.firstSeen}"`), e = await fetch("/api/version", {
|
|
1775
1777
|
method: "GET",
|
|
1776
|
-
credentials:
|
|
1778
|
+
credentials: Ot() ? "omit" : "include",
|
|
1777
1779
|
headers: t
|
|
1778
1780
|
});
|
|
1779
1781
|
} catch {
|
|
@@ -1794,54 +1796,54 @@ async function Vt() {
|
|
|
1794
1796
|
asset: t.asset_fingerprint,
|
|
1795
1797
|
binary: t.binary_fingerprint
|
|
1796
1798
|
} : void 0;
|
|
1797
|
-
|
|
1798
|
-
kind:
|
|
1799
|
+
W.firstSeen ||= n, !W.firstComponents && r && n === W.firstSeen && (W.firstComponents = r), n !== W.firstSeen && Ht({
|
|
1800
|
+
kind: Vt(W.firstComponents, r),
|
|
1799
1801
|
observed: n,
|
|
1800
1802
|
components: r
|
|
1801
1803
|
});
|
|
1802
1804
|
}
|
|
1803
|
-
function
|
|
1805
|
+
function Vt(e, t) {
|
|
1804
1806
|
if (!e || !t) return "unknown";
|
|
1805
1807
|
let n = e.schema !== t.schema, r = e.asset !== t.asset, i = e.binary !== t.binary;
|
|
1806
1808
|
return n && !r && !i ? "schema-only" : r || i ? "asset-or-binary" : "unknown";
|
|
1807
1809
|
}
|
|
1808
|
-
function
|
|
1809
|
-
if (!
|
|
1810
|
-
|
|
1811
|
-
for (let t of
|
|
1812
|
-
if (
|
|
1813
|
-
|
|
1810
|
+
function Ht(e) {
|
|
1811
|
+
if (!W.hasReportedDrift) {
|
|
1812
|
+
W.hasReportedDrift = !0, e.kind !== "schema-only" && (W.pendingReload = e);
|
|
1813
|
+
for (let t of W.listeners) t(e);
|
|
1814
|
+
if (W.channel) try {
|
|
1815
|
+
W.channel.postMessage({
|
|
1814
1816
|
type: "drift",
|
|
1815
1817
|
delta: e
|
|
1816
1818
|
});
|
|
1817
1819
|
} catch {}
|
|
1818
|
-
|
|
1820
|
+
Ot() && e.kind !== "schema-only" && wt(At(), Ct.reloadRequired, { reason: `version drift: ${e.kind}` });
|
|
1819
1821
|
}
|
|
1820
1822
|
}
|
|
1821
|
-
function
|
|
1822
|
-
return
|
|
1823
|
+
function Ut() {
|
|
1824
|
+
return W.pendingReload;
|
|
1823
1825
|
}
|
|
1824
|
-
function
|
|
1825
|
-
return
|
|
1826
|
-
|
|
1826
|
+
function Wt(e) {
|
|
1827
|
+
return W.listeners.add(e), () => {
|
|
1828
|
+
W.listeners.delete(e);
|
|
1827
1829
|
};
|
|
1828
1830
|
}
|
|
1829
1831
|
//#endregion
|
|
1830
1832
|
//#region src/api/client.ts
|
|
1831
|
-
var
|
|
1832
|
-
function
|
|
1833
|
+
var Gt = (e) => JSON.stringify(e ?? {}), Kt = null, G = "declarion.auth.refresh.lock", qt = "declarion.auth.refresh.result", Jt = "declarion.auth.refresh", Yt = 3e4, Xt = 100, Zt = typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1834
|
+
function Qt() {
|
|
1833
1835
|
if (typeof window > "u") return !1;
|
|
1834
1836
|
try {
|
|
1835
|
-
let e = window.localStorage, t = `${
|
|
1837
|
+
let e = window.localStorage, t = `${G}.probe`;
|
|
1836
1838
|
return e.setItem(t, "1"), e.removeItem(t), !0;
|
|
1837
1839
|
} catch {
|
|
1838
1840
|
return !1;
|
|
1839
1841
|
}
|
|
1840
1842
|
}
|
|
1841
|
-
function
|
|
1843
|
+
function $t() {
|
|
1842
1844
|
return typeof navigator > "u" ? null : navigator.locks ?? null;
|
|
1843
1845
|
}
|
|
1844
|
-
function
|
|
1846
|
+
function en(e) {
|
|
1845
1847
|
if (!e) return null;
|
|
1846
1848
|
try {
|
|
1847
1849
|
let t = JSON.parse(e);
|
|
@@ -1853,7 +1855,7 @@ function tn(e) {
|
|
|
1853
1855
|
return null;
|
|
1854
1856
|
}
|
|
1855
1857
|
}
|
|
1856
|
-
function
|
|
1858
|
+
function tn(e) {
|
|
1857
1859
|
if (!e) return null;
|
|
1858
1860
|
try {
|
|
1859
1861
|
let t = JSON.parse(e);
|
|
@@ -1867,47 +1869,47 @@ function nn(e) {
|
|
|
1867
1869
|
return null;
|
|
1868
1870
|
}
|
|
1869
1871
|
}
|
|
1870
|
-
function
|
|
1871
|
-
if (
|
|
1872
|
-
let t =
|
|
1872
|
+
function nn(e) {
|
|
1873
|
+
if (!Qt()) return null;
|
|
1874
|
+
let t = tn(window.localStorage.getItem(qt));
|
|
1873
1875
|
return !t || t.updated_at < e ? null : t;
|
|
1874
1876
|
}
|
|
1875
|
-
function
|
|
1876
|
-
if (!e.ok) throw new
|
|
1877
|
+
function rn(e) {
|
|
1878
|
+
if (!e.ok) throw new K(e.status ?? 401);
|
|
1877
1879
|
}
|
|
1878
|
-
function
|
|
1879
|
-
let t =
|
|
1880
|
-
if (t && t.expires_at > e && t.owner !==
|
|
1880
|
+
function an(e = Date.now()) {
|
|
1881
|
+
let t = en(window.localStorage.getItem(G));
|
|
1882
|
+
if (t && t.expires_at > e && t.owner !== Zt) return !1;
|
|
1881
1883
|
let n = {
|
|
1882
|
-
owner:
|
|
1883
|
-
expires_at: e +
|
|
1884
|
+
owner: Zt,
|
|
1885
|
+
expires_at: e + Yt
|
|
1884
1886
|
};
|
|
1885
|
-
return window.localStorage.setItem(
|
|
1887
|
+
return window.localStorage.setItem(G, JSON.stringify(n)), en(window.localStorage.getItem(G))?.owner === Zt;
|
|
1886
1888
|
}
|
|
1887
|
-
function
|
|
1888
|
-
|
|
1889
|
+
function on() {
|
|
1890
|
+
en(window.localStorage.getItem(G))?.owner === Zt && window.localStorage.removeItem(G);
|
|
1889
1891
|
}
|
|
1890
|
-
function
|
|
1892
|
+
function sn(e) {
|
|
1891
1893
|
let t = {
|
|
1892
|
-
owner:
|
|
1894
|
+
owner: Zt,
|
|
1893
1895
|
updated_at: Date.now(),
|
|
1894
1896
|
...e
|
|
1895
1897
|
};
|
|
1896
|
-
window.localStorage.setItem(
|
|
1898
|
+
window.localStorage.setItem(qt, JSON.stringify(t));
|
|
1897
1899
|
}
|
|
1898
|
-
async function
|
|
1900
|
+
async function cn(e) {
|
|
1899
1901
|
return new Promise((t, n) => {
|
|
1900
1902
|
let r = !1, i = null, a = (e) => {
|
|
1901
1903
|
r || (r = !0, i && clearTimeout(i), window.removeEventListener("storage", c), t(e));
|
|
1902
1904
|
}, o = (e) => {
|
|
1903
|
-
r || (r = !0, i && clearTimeout(i), window.removeEventListener("storage", c), n(new
|
|
1905
|
+
r || (r = !0, i && clearTimeout(i), window.removeEventListener("storage", c), n(new K(e)));
|
|
1904
1906
|
}, s = () => {
|
|
1905
|
-
let t =
|
|
1907
|
+
let t = tn(window.localStorage.getItem(qt));
|
|
1906
1908
|
if (t && t.updated_at >= e) {
|
|
1907
1909
|
t.ok ? a("complete") : o(t.status ?? 401);
|
|
1908
1910
|
return;
|
|
1909
1911
|
}
|
|
1910
|
-
let n =
|
|
1912
|
+
let n = en(window.localStorage.getItem(G));
|
|
1911
1913
|
if (!n) {
|
|
1912
1914
|
a("complete");
|
|
1913
1915
|
return;
|
|
@@ -1916,134 +1918,134 @@ async function ln(e) {
|
|
|
1916
1918
|
a("expired");
|
|
1917
1919
|
return;
|
|
1918
1920
|
}
|
|
1919
|
-
i = setTimeout(s,
|
|
1921
|
+
i = setTimeout(s, Xt);
|
|
1920
1922
|
}, c = (e) => {
|
|
1921
|
-
(e.key ===
|
|
1923
|
+
(e.key === G || e.key === qt) && (i && clearTimeout(i), s());
|
|
1922
1924
|
};
|
|
1923
1925
|
window.addEventListener("storage", c), s();
|
|
1924
1926
|
});
|
|
1925
1927
|
}
|
|
1926
|
-
async function
|
|
1927
|
-
let t =
|
|
1928
|
-
return t ? (await t.request(
|
|
1929
|
-
let t =
|
|
1928
|
+
async function ln(e) {
|
|
1929
|
+
let t = $t();
|
|
1930
|
+
return t ? (await t.request(Jt, { mode: "exclusive" }, async () => {
|
|
1931
|
+
let t = nn(e);
|
|
1930
1932
|
if (t) {
|
|
1931
|
-
|
|
1933
|
+
rn(t);
|
|
1932
1934
|
return;
|
|
1933
1935
|
}
|
|
1934
1936
|
try {
|
|
1935
|
-
await
|
|
1937
|
+
await yn(), Qt() && sn({ ok: !0 });
|
|
1936
1938
|
} catch (e) {
|
|
1937
|
-
throw e instanceof
|
|
1939
|
+
throw e instanceof K && Qt() && sn({
|
|
1938
1940
|
ok: !1,
|
|
1939
1941
|
status: e.status
|
|
1940
1942
|
}), e;
|
|
1941
1943
|
}
|
|
1942
1944
|
}), !0) : !1;
|
|
1943
1945
|
}
|
|
1944
|
-
async function
|
|
1946
|
+
async function un() {
|
|
1945
1947
|
let e = Date.now();
|
|
1946
|
-
if (!await
|
|
1947
|
-
if (
|
|
1948
|
-
await
|
|
1948
|
+
if (!await ln(e)) {
|
|
1949
|
+
if (!Qt()) {
|
|
1950
|
+
await yn();
|
|
1949
1951
|
return;
|
|
1950
1952
|
}
|
|
1951
|
-
if (
|
|
1952
|
-
await
|
|
1953
|
+
if (an(e)) try {
|
|
1954
|
+
await yn(), sn({ ok: !0 });
|
|
1953
1955
|
return;
|
|
1954
1956
|
} catch (e) {
|
|
1955
|
-
throw e instanceof
|
|
1957
|
+
throw e instanceof K && sn({
|
|
1956
1958
|
ok: !1,
|
|
1957
1959
|
status: e.status
|
|
1958
1960
|
}), e;
|
|
1959
1961
|
} finally {
|
|
1960
|
-
|
|
1962
|
+
on();
|
|
1961
1963
|
}
|
|
1962
|
-
await
|
|
1964
|
+
await cn(e) === "expired" && await un();
|
|
1963
1965
|
}
|
|
1964
1966
|
}
|
|
1965
|
-
var
|
|
1967
|
+
var K = class extends Error {
|
|
1966
1968
|
status;
|
|
1967
1969
|
constructor(e) {
|
|
1968
1970
|
super(`refresh failed terminally (${e})`), this.status = e, this.name = "RefreshDeadError";
|
|
1969
1971
|
}
|
|
1970
|
-
},
|
|
1971
|
-
function
|
|
1972
|
-
|
|
1973
|
-
e instanceof
|
|
1972
|
+
}, dn = null, fn = null, pn = 3e4, mn = 5e3;
|
|
1973
|
+
function hn() {
|
|
1974
|
+
bn().catch((e) => {
|
|
1975
|
+
e instanceof K && q();
|
|
1974
1976
|
});
|
|
1975
1977
|
}
|
|
1976
|
-
function
|
|
1977
|
-
if (
|
|
1978
|
+
function gn(e) {
|
|
1979
|
+
if (dn &&= (clearTimeout(dn), null), fn = null, !e || typeof window > "u") return;
|
|
1978
1980
|
let t = Date.parse(e);
|
|
1979
1981
|
if (Number.isNaN(t)) return;
|
|
1980
|
-
|
|
1981
|
-
let n = Math.max(t - Date.now() -
|
|
1982
|
-
|
|
1983
|
-
|
|
1982
|
+
fn = t;
|
|
1983
|
+
let n = Math.max(t - Date.now() - pn, mn);
|
|
1984
|
+
dn = setTimeout(() => {
|
|
1985
|
+
dn = null, hn();
|
|
1984
1986
|
}, n);
|
|
1985
1987
|
}
|
|
1986
|
-
function
|
|
1987
|
-
|
|
1988
|
+
function _n() {
|
|
1989
|
+
dn &&= (clearTimeout(dn), null), fn = null;
|
|
1988
1990
|
}
|
|
1989
1991
|
typeof document < "u" && document.addEventListener("visibilitychange", () => {
|
|
1990
|
-
document.visibilityState === "visible" &&
|
|
1992
|
+
document.visibilityState === "visible" && fn !== null && Date.now() >= fn - pn && hn();
|
|
1991
1993
|
});
|
|
1992
|
-
async function
|
|
1994
|
+
async function vn(e) {
|
|
1993
1995
|
try {
|
|
1994
1996
|
let t = await e.json();
|
|
1995
|
-
|
|
1997
|
+
gn(t?.result?.expires_at ?? t?.expires_at);
|
|
1996
1998
|
} catch {}
|
|
1997
1999
|
}
|
|
1998
|
-
async function
|
|
2000
|
+
async function yn() {
|
|
1999
2001
|
let e = {
|
|
2000
2002
|
method: "POST",
|
|
2001
2003
|
credentials: "include",
|
|
2002
2004
|
headers: { "Content-Type": "application/json" },
|
|
2003
|
-
body:
|
|
2005
|
+
body: Gt({})
|
|
2004
2006
|
}, t = await fetch("/api/actions/auth.refresh", e);
|
|
2005
2007
|
if (t.status === 429) {
|
|
2006
2008
|
let n = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
2007
2009
|
await new Promise((e) => setTimeout(e, n * 1e3));
|
|
2008
2010
|
let r = await fetch("/api/actions/auth.refresh", e);
|
|
2009
|
-
if (!r.ok) throw new
|
|
2010
|
-
await
|
|
2011
|
+
if (!r.ok) throw new K(r.status);
|
|
2012
|
+
await vn(r);
|
|
2011
2013
|
return;
|
|
2012
2014
|
}
|
|
2013
|
-
if (!t.ok) throw new
|
|
2014
|
-
await
|
|
2015
|
+
if (!t.ok) throw new K(t.status);
|
|
2016
|
+
await vn(t);
|
|
2015
2017
|
}
|
|
2016
|
-
async function
|
|
2017
|
-
return
|
|
2018
|
-
|
|
2019
|
-
}),
|
|
2018
|
+
async function bn() {
|
|
2019
|
+
return Kt || (Kt = un().finally(() => {
|
|
2020
|
+
Kt = null;
|
|
2021
|
+
}), Kt);
|
|
2020
2022
|
}
|
|
2021
|
-
var
|
|
2023
|
+
var q = () => {
|
|
2022
2024
|
if (typeof window > "u") return;
|
|
2023
2025
|
let { pathname: e } = window.location;
|
|
2024
|
-
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href =
|
|
2026
|
+
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href = xt());
|
|
2025
2027
|
};
|
|
2026
|
-
function
|
|
2027
|
-
let t =
|
|
2028
|
-
return
|
|
2028
|
+
function xn(e) {
|
|
2029
|
+
let t = q;
|
|
2030
|
+
return q = e, t;
|
|
2029
2031
|
}
|
|
2030
|
-
function
|
|
2031
|
-
return
|
|
2032
|
+
function Sn() {
|
|
2033
|
+
return q;
|
|
2032
2034
|
}
|
|
2033
|
-
var
|
|
2035
|
+
var Cn = ({ status: e, code: t, message: n }) => {
|
|
2034
2036
|
console.error(`[API ${e}] ${t}: ${n}`);
|
|
2035
2037
|
};
|
|
2036
|
-
function
|
|
2038
|
+
function wn(e, t, n, r) {
|
|
2037
2039
|
let i = new Headers(e);
|
|
2038
2040
|
return !i.has("Content-Type") && t && i.set("Content-Type", "application/json"), n.setAccept && !i.has("Accept") && i.set("Accept", "*/*"), r && i.set("Authorization", `Bearer ${r}`), i;
|
|
2039
2041
|
}
|
|
2040
|
-
async function
|
|
2041
|
-
let i =
|
|
2042
|
+
async function Tn(e, t, n, r) {
|
|
2043
|
+
let i = Ot(), a = i ? "omit" : "include", o = wn(t.headers, !!t.body, n, i ? kt() : null), s = await fetch(e, {
|
|
2042
2044
|
...t,
|
|
2043
2045
|
headers: o,
|
|
2044
2046
|
credentials: a
|
|
2045
2047
|
});
|
|
2046
|
-
if (
|
|
2048
|
+
if (zt(s.headers), !s.ok) {
|
|
2047
2049
|
let o = "Request failed", c = "UNKNOWN", l, u;
|
|
2048
2050
|
try {
|
|
2049
2051
|
u = await s.json();
|
|
@@ -2052,49 +2054,49 @@ async function En(e, t, n, r) {
|
|
|
2052
2054
|
} catch {}
|
|
2053
2055
|
if (s.status === 401 && (c === "TOKEN_REFRESH_NEEDED" || c === "UNAUTHORIZED")) try {
|
|
2054
2056
|
let o = null;
|
|
2055
|
-
i ? (
|
|
2056
|
-
let s =
|
|
2057
|
+
i ? (Nt(), o = await Pt()) : await bn();
|
|
2058
|
+
let s = wn(t.headers, !!t.body, n, o), c = await fetch(e, {
|
|
2057
2059
|
...t,
|
|
2058
2060
|
headers: s,
|
|
2059
2061
|
credentials: a
|
|
2060
2062
|
});
|
|
2061
2063
|
if (!c.ok) {
|
|
2062
|
-
|
|
2064
|
+
q();
|
|
2063
2065
|
let e = await c.json().catch(() => ({ error: {
|
|
2064
2066
|
message: "Request failed",
|
|
2065
2067
|
code: "UNKNOWN"
|
|
2066
2068
|
} }));
|
|
2067
|
-
throw new
|
|
2069
|
+
throw new V(c.status, e.error.message, e.error.code, e.index);
|
|
2068
2070
|
}
|
|
2069
2071
|
return r(c);
|
|
2070
2072
|
} catch (e) {
|
|
2071
|
-
throw e instanceof
|
|
2073
|
+
throw e instanceof V ? e : (q(), new V(401, o, c, l));
|
|
2072
2074
|
}
|
|
2073
|
-
throw s.status === 401 &&
|
|
2075
|
+
throw s.status === 401 && q(), Cn({
|
|
2074
2076
|
status: s.status,
|
|
2075
2077
|
code: c,
|
|
2076
2078
|
message: o
|
|
2077
|
-
}), new
|
|
2079
|
+
}), new V(s.status, o, c, l, u);
|
|
2078
2080
|
}
|
|
2079
2081
|
return r(s);
|
|
2080
2082
|
}
|
|
2081
|
-
function
|
|
2083
|
+
function En(e) {
|
|
2082
2084
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
2083
2085
|
}
|
|
2084
|
-
async function
|
|
2085
|
-
return
|
|
2086
|
+
async function J(e, t = {}) {
|
|
2087
|
+
return Tn(e, t, { setAccept: !1 }, En);
|
|
2086
2088
|
}
|
|
2087
|
-
async function
|
|
2089
|
+
async function Dn(e) {
|
|
2088
2090
|
return {
|
|
2089
2091
|
blob: await e.blob(),
|
|
2090
|
-
filename:
|
|
2092
|
+
filename: kn(e.headers),
|
|
2091
2093
|
headers: e.headers
|
|
2092
2094
|
};
|
|
2093
2095
|
}
|
|
2094
|
-
async function
|
|
2095
|
-
return
|
|
2096
|
+
async function On(e, t = {}) {
|
|
2097
|
+
return Tn(e, t, { setAccept: !0 }, Dn);
|
|
2096
2098
|
}
|
|
2097
|
-
function
|
|
2099
|
+
function kn(e) {
|
|
2098
2100
|
let t = e.get("Content-Disposition");
|
|
2099
2101
|
if (!t) return "";
|
|
2100
2102
|
let n = t.match(/filename\*\s*=\s*([^']*)'([^']*)'([^;]+)/i);
|
|
@@ -2104,127 +2106,137 @@ function An(e) {
|
|
|
2104
2106
|
let r = t.match(/filename\s*=\s*("([^"]+)"|([^;]+))/i);
|
|
2105
2107
|
return r ? (r[2] ?? r[3] ?? "").trim() : "";
|
|
2106
2108
|
}
|
|
2107
|
-
async function
|
|
2108
|
-
return (await
|
|
2109
|
+
async function Y(e, t = {}) {
|
|
2110
|
+
return (await J(`/api/actions/${encodeURIComponent(e)}`, {
|
|
2109
2111
|
method: "POST",
|
|
2110
|
-
body:
|
|
2112
|
+
body: Gt(t)
|
|
2111
2113
|
})).result;
|
|
2112
2114
|
}
|
|
2113
2115
|
//#endregion
|
|
2114
2116
|
//#region src/api/schema.ts
|
|
2115
|
-
function
|
|
2117
|
+
function An(e) {
|
|
2116
2118
|
return {
|
|
2117
2119
|
...e,
|
|
2118
|
-
params: e.params ?
|
|
2120
|
+
params: e.params ? L.fromObject(e.params) : void 0
|
|
2119
2121
|
};
|
|
2120
2122
|
}
|
|
2121
|
-
function
|
|
2123
|
+
function jn(e) {
|
|
2122
2124
|
return {
|
|
2123
2125
|
...e,
|
|
2124
|
-
resolved_params: e.resolved_params ?
|
|
2126
|
+
resolved_params: e.resolved_params ? L.fromObject(e.resolved_params) : void 0
|
|
2125
2127
|
};
|
|
2126
2128
|
}
|
|
2127
|
-
function
|
|
2129
|
+
function Mn(e) {
|
|
2128
2130
|
let t = {};
|
|
2129
|
-
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] =
|
|
2131
|
+
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] = An(r);
|
|
2130
2132
|
let n = {};
|
|
2131
|
-
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] =
|
|
2133
|
+
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] = jn(r);
|
|
2132
2134
|
return {
|
|
2133
2135
|
...e,
|
|
2134
|
-
fields:
|
|
2135
|
-
files: e.files ?
|
|
2136
|
+
fields: L.fromObject(e.fields),
|
|
2137
|
+
files: e.files ? L.fromObject(e.files) : void 0,
|
|
2138
|
+
variants: e.variants ? L.fromObject(e.variants) : void 0,
|
|
2136
2139
|
handlers: e.handlers ? t : void 0,
|
|
2137
2140
|
actions: e.actions ? n : void 0
|
|
2138
2141
|
};
|
|
2139
2142
|
}
|
|
2140
|
-
function
|
|
2143
|
+
function Nn(e) {
|
|
2141
2144
|
let t = {};
|
|
2142
|
-
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] =
|
|
2145
|
+
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] = Mn(r);
|
|
2143
2146
|
let n = {};
|
|
2144
2147
|
if (e.structures) for (let [t, r] of Object.entries(e.structures)) n[t] = {
|
|
2145
2148
|
...r,
|
|
2146
|
-
fields:
|
|
2149
|
+
fields: L.fromObject(r.fields)
|
|
2147
2150
|
};
|
|
2148
2151
|
let r = {};
|
|
2149
|
-
if (e.handlers) for (let [t, n] of Object.entries(e.handlers)) r[t] =
|
|
2152
|
+
if (e.handlers) for (let [t, n] of Object.entries(e.handlers)) r[t] = An(n);
|
|
2150
2153
|
let i = {};
|
|
2151
|
-
if (e.actions) for (let [t, n] of Object.entries(e.actions)) i[t] =
|
|
2154
|
+
if (e.actions) for (let [t, n] of Object.entries(e.actions)) i[t] = jn(n);
|
|
2155
|
+
let a = { ...e.screens };
|
|
2156
|
+
for (let [e, t] of Object.entries(a)) {
|
|
2157
|
+
let n = t;
|
|
2158
|
+
a[e] = {
|
|
2159
|
+
...t,
|
|
2160
|
+
variants: n.variants ? L.fromObject(n.variants) : void 0
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2152
2163
|
return {
|
|
2153
2164
|
...e,
|
|
2154
2165
|
entities: t,
|
|
2155
2166
|
structures: n,
|
|
2156
2167
|
handlers: r,
|
|
2157
|
-
actions: i
|
|
2168
|
+
actions: i,
|
|
2169
|
+
screens: a
|
|
2158
2170
|
};
|
|
2159
2171
|
}
|
|
2160
|
-
async function
|
|
2161
|
-
return
|
|
2172
|
+
async function Pn() {
|
|
2173
|
+
return Nn(await J("/api/schema"));
|
|
2162
2174
|
}
|
|
2163
2175
|
//#endregion
|
|
2164
2176
|
//#region src/api/auth.ts
|
|
2165
|
-
async function
|
|
2166
|
-
return
|
|
2177
|
+
async function Fn() {
|
|
2178
|
+
return Y("auth.check_setup");
|
|
2167
2179
|
}
|
|
2168
|
-
async function
|
|
2169
|
-
let r = await
|
|
2180
|
+
async function In(e, t, n = !0) {
|
|
2181
|
+
let r = await Y("auth.login", {
|
|
2170
2182
|
email: e,
|
|
2171
2183
|
password: t,
|
|
2172
2184
|
remember: n
|
|
2173
2185
|
});
|
|
2174
|
-
return
|
|
2186
|
+
return gn(r.expires_at), r;
|
|
2175
2187
|
}
|
|
2176
|
-
async function
|
|
2177
|
-
let r = await
|
|
2188
|
+
async function Ln(e, t, n) {
|
|
2189
|
+
let r = await Y("auth.signup", {
|
|
2178
2190
|
email: e,
|
|
2179
2191
|
password: t,
|
|
2180
2192
|
display_name: n
|
|
2181
2193
|
});
|
|
2182
|
-
return
|
|
2194
|
+
return gn(r.expires_at), r;
|
|
2183
2195
|
}
|
|
2184
|
-
async function
|
|
2185
|
-
return
|
|
2196
|
+
async function Rn() {
|
|
2197
|
+
return Y("auth.me");
|
|
2186
2198
|
}
|
|
2187
|
-
async function
|
|
2188
|
-
return (await
|
|
2199
|
+
async function zn() {
|
|
2200
|
+
return (await Y("auth.list_tenants")).tenants;
|
|
2189
2201
|
}
|
|
2190
|
-
async function
|
|
2191
|
-
let t = await
|
|
2192
|
-
return
|
|
2202
|
+
async function Bn(e) {
|
|
2203
|
+
let t = await Y("auth.switch_tenant", { tenant_id: e });
|
|
2204
|
+
return gn(t.expires_at), t;
|
|
2193
2205
|
}
|
|
2194
|
-
async function
|
|
2195
|
-
await
|
|
2206
|
+
async function Vn() {
|
|
2207
|
+
await Y("auth.logout");
|
|
2196
2208
|
}
|
|
2197
|
-
async function
|
|
2198
|
-
return (await
|
|
2209
|
+
async function Hn(e) {
|
|
2210
|
+
return (await Y("sso_provider.list", e ? { tenant_code: e } : {})).providers;
|
|
2199
2211
|
}
|
|
2200
|
-
function
|
|
2212
|
+
function Un(e, t, n) {
|
|
2201
2213
|
let r = new URLSearchParams();
|
|
2202
2214
|
t && r.set("tenant", t), n && r.set("redirect", n);
|
|
2203
2215
|
let i = r.toString();
|
|
2204
2216
|
return `/api/auth/sso/authorize/${encodeURIComponent(e)}${i ? `?${i}` : ""}`;
|
|
2205
2217
|
}
|
|
2206
|
-
async function
|
|
2218
|
+
async function Wn(e, t, n) {
|
|
2207
2219
|
let r = {
|
|
2208
2220
|
target_user_id: e,
|
|
2209
2221
|
reason: t
|
|
2210
2222
|
};
|
|
2211
|
-
return n != null && (r.duration_minutes = n),
|
|
2223
|
+
return n != null && (r.duration_minutes = n), Y("impersonation.start", r);
|
|
2212
2224
|
}
|
|
2213
|
-
async function
|
|
2214
|
-
return
|
|
2225
|
+
async function Gn() {
|
|
2226
|
+
return Y("impersonation.stop");
|
|
2215
2227
|
}
|
|
2216
|
-
async function
|
|
2217
|
-
await
|
|
2228
|
+
async function Kn(e) {
|
|
2229
|
+
await Y("impersonation.revoke", { session_id: e });
|
|
2218
2230
|
}
|
|
2219
|
-
async function
|
|
2220
|
-
await
|
|
2231
|
+
async function qn(e, t) {
|
|
2232
|
+
await Y("auth.change_password", {
|
|
2221
2233
|
current_password: e,
|
|
2222
2234
|
new_password: t
|
|
2223
2235
|
});
|
|
2224
2236
|
}
|
|
2225
2237
|
//#endregion
|
|
2226
2238
|
//#region src/stores/auth.ts
|
|
2227
|
-
var
|
|
2239
|
+
var Jn = E((e) => ({
|
|
2228
2240
|
user: null,
|
|
2229
2241
|
isAuthenticated: !1,
|
|
2230
2242
|
isLoading: !0,
|
|
@@ -2232,9 +2244,9 @@ var Yn = E((e) => ({
|
|
|
2232
2244
|
tenants: [],
|
|
2233
2245
|
initialize: async () => {
|
|
2234
2246
|
try {
|
|
2235
|
-
let t = await
|
|
2247
|
+
let t = await Rn(), n = t.tenant ?? null, r = [];
|
|
2236
2248
|
try {
|
|
2237
|
-
r = await
|
|
2249
|
+
r = await zn();
|
|
2238
2250
|
} catch {}
|
|
2239
2251
|
e({
|
|
2240
2252
|
user: t,
|
|
@@ -2253,7 +2265,7 @@ var Yn = E((e) => ({
|
|
|
2253
2265
|
},
|
|
2254
2266
|
refreshMe: async () => {
|
|
2255
2267
|
try {
|
|
2256
|
-
let t = await
|
|
2268
|
+
let t = await Rn();
|
|
2257
2269
|
e({
|
|
2258
2270
|
user: t,
|
|
2259
2271
|
activeTenant: t.tenant ?? null
|
|
@@ -2275,9 +2287,9 @@ var Yn = E((e) => ({
|
|
|
2275
2287
|
e({ activeTenant: t });
|
|
2276
2288
|
},
|
|
2277
2289
|
logout: async () => {
|
|
2278
|
-
|
|
2290
|
+
_n();
|
|
2279
2291
|
try {
|
|
2280
|
-
await
|
|
2292
|
+
await Vn();
|
|
2281
2293
|
} catch {}
|
|
2282
2294
|
e({
|
|
2283
2295
|
user: null,
|
|
@@ -2289,73 +2301,73 @@ var Yn = E((e) => ({
|
|
|
2289
2301
|
}));
|
|
2290
2302
|
//#endregion
|
|
2291
2303
|
//#region src/hooks/useSchema.ts
|
|
2292
|
-
function
|
|
2293
|
-
let e =
|
|
2304
|
+
function X() {
|
|
2305
|
+
let e = Jn((e) => e.isAuthenticated);
|
|
2294
2306
|
return g({
|
|
2295
2307
|
queryKey: ["schema", e],
|
|
2296
|
-
queryFn:
|
|
2308
|
+
queryFn: Pn,
|
|
2297
2309
|
staleTime: Infinity,
|
|
2298
2310
|
enabled: e
|
|
2299
2311
|
});
|
|
2300
2312
|
}
|
|
2301
2313
|
//#endregion
|
|
2302
2314
|
//#region src/api/data.ts
|
|
2303
|
-
function
|
|
2315
|
+
function Yn(e, t) {
|
|
2304
2316
|
let n = new URL(`/api/data/${e}`, window.location.origin);
|
|
2305
2317
|
if (t.page && n.searchParams.set("page", String(t.page)), t.per_page && n.searchParams.set("per_page", String(t.per_page)), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.expand) for (let e of t.expand) n.searchParams.append("expand", e);
|
|
2306
2318
|
return t.select && t.select.length > 0 && n.searchParams.set("select", t.select.join(",")), t.screen && n.searchParams.set("screen", t.screen), t.preview && n.searchParams.set("preview", "true"), t.count && n.searchParams.set("count", t.count), n.pathname + n.search;
|
|
2307
2319
|
}
|
|
2308
|
-
async function
|
|
2309
|
-
if (
|
|
2310
|
-
let n =
|
|
2320
|
+
async function Xn(e, t = {}, n = {}) {
|
|
2321
|
+
if (lr) {
|
|
2322
|
+
let n = lr(e, t);
|
|
2311
2323
|
if (n !== void 0) return n;
|
|
2312
2324
|
}
|
|
2313
|
-
return
|
|
2325
|
+
return J(Yn(e, t), { signal: n.signal });
|
|
2314
2326
|
}
|
|
2315
|
-
async function
|
|
2316
|
-
if (
|
|
2317
|
-
let n =
|
|
2327
|
+
async function Zn(e, t) {
|
|
2328
|
+
if (ur) {
|
|
2329
|
+
let n = ur(e, t);
|
|
2318
2330
|
if (n !== void 0) return n;
|
|
2319
2331
|
}
|
|
2320
2332
|
let n = new URLSearchParams();
|
|
2321
2333
|
if (typeof t == "string") n.set("id", t);
|
|
2322
2334
|
else for (let [e, r] of Object.entries(t)) n.set(e, r);
|
|
2323
|
-
return
|
|
2335
|
+
return J(`/api/data/${e}?${n.toString()}`);
|
|
2324
2336
|
}
|
|
2325
|
-
async function
|
|
2326
|
-
return { data: ((await
|
|
2337
|
+
async function Qn(e, t) {
|
|
2338
|
+
return { data: ((await pr(`${e}.__create`, {
|
|
2327
2339
|
entity: e,
|
|
2328
2340
|
fields: t
|
|
2329
2341
|
})).result?.rows ?? [])[0] };
|
|
2330
2342
|
}
|
|
2331
|
-
async function
|
|
2332
|
-
let r = typeof t == "string" ? t :
|
|
2333
|
-
return { data: ((await
|
|
2343
|
+
async function $n(e, t, n) {
|
|
2344
|
+
let r = typeof t == "string" ? t : tr(t);
|
|
2345
|
+
return { data: ((await pr(`${e}.__update`, {
|
|
2334
2346
|
object_ids: [r],
|
|
2335
2347
|
entity: e,
|
|
2336
2348
|
fields: n
|
|
2337
2349
|
})).result?.rows ?? [])[0] };
|
|
2338
2350
|
}
|
|
2339
|
-
async function
|
|
2340
|
-
let n = typeof t == "string" ? t :
|
|
2341
|
-
await
|
|
2351
|
+
async function er(e, t) {
|
|
2352
|
+
let n = typeof t == "string" ? t : tr(t);
|
|
2353
|
+
await pr(`${e}.__delete`, {
|
|
2342
2354
|
object_ids: [n],
|
|
2343
2355
|
entity: e
|
|
2344
2356
|
});
|
|
2345
2357
|
}
|
|
2346
|
-
function
|
|
2358
|
+
function tr(e) {
|
|
2347
2359
|
let t = Object.values(e);
|
|
2348
2360
|
return t.length === 1 ? t[0] : t.join("");
|
|
2349
2361
|
}
|
|
2350
|
-
async function
|
|
2351
|
-
let n = typeof t == "string" ? t :
|
|
2352
|
-
await
|
|
2362
|
+
async function nr(e, t) {
|
|
2363
|
+
let n = typeof t == "string" ? t : tr(t);
|
|
2364
|
+
await pr(`${e}.__restore`, {
|
|
2353
2365
|
object_ids: [n],
|
|
2354
2366
|
entity: e
|
|
2355
2367
|
});
|
|
2356
2368
|
}
|
|
2357
|
-
async function
|
|
2358
|
-
let n = await
|
|
2369
|
+
async function rr(e, t) {
|
|
2370
|
+
let n = await On(`/api/data/${e}/export`, {
|
|
2359
2371
|
method: "POST",
|
|
2360
2372
|
body: JSON.stringify(t)
|
|
2361
2373
|
});
|
|
@@ -2364,7 +2376,7 @@ async function ir(e, t) {
|
|
|
2364
2376
|
filename: n.filename
|
|
2365
2377
|
};
|
|
2366
2378
|
}
|
|
2367
|
-
var
|
|
2379
|
+
var ir = class extends Error {
|
|
2368
2380
|
status;
|
|
2369
2381
|
response;
|
|
2370
2382
|
constructor(e, t) {
|
|
@@ -2372,55 +2384,55 @@ var ar = class extends Error {
|
|
|
2372
2384
|
super(n || "Action failed"), this.name = "ActionBatchError", this.status = e, this.response = t;
|
|
2373
2385
|
}
|
|
2374
2386
|
};
|
|
2375
|
-
function
|
|
2387
|
+
function ar(e) {
|
|
2376
2388
|
if (!e || typeof e != "object") return !1;
|
|
2377
2389
|
let t = e;
|
|
2378
2390
|
return typeof t.status == "string" && Array.isArray(t.errors);
|
|
2379
2391
|
}
|
|
2380
|
-
function
|
|
2392
|
+
function or(e, t) {
|
|
2381
2393
|
let n = { ...e ?? {} };
|
|
2382
2394
|
if ("object_ids" in n) throw Error("handler param \"object_ids\" collides with reserved key");
|
|
2383
2395
|
if ("_ids" in n) throw Error("handler param \"_ids\" is a removed legacy key; use object_ids");
|
|
2384
2396
|
return t !== void 0 && (n.object_ids = t), n;
|
|
2385
2397
|
}
|
|
2386
|
-
var
|
|
2387
|
-
function
|
|
2388
|
-
let t =
|
|
2389
|
-
return
|
|
2398
|
+
var sr = null;
|
|
2399
|
+
function cr(e) {
|
|
2400
|
+
let t = sr;
|
|
2401
|
+
return sr = e, t;
|
|
2402
|
+
}
|
|
2403
|
+
var lr = null, ur = null;
|
|
2404
|
+
function dr(e) {
|
|
2405
|
+
let t = lr;
|
|
2406
|
+
return lr = e, t;
|
|
2390
2407
|
}
|
|
2391
|
-
var ur = null, dr = null;
|
|
2392
2408
|
function fr(e) {
|
|
2393
2409
|
let t = ur;
|
|
2394
2410
|
return ur = e, t;
|
|
2395
2411
|
}
|
|
2396
|
-
function pr(e) {
|
|
2397
|
-
|
|
2398
|
-
return dr = e, t;
|
|
2399
|
-
}
|
|
2400
|
-
async function mr(e, t) {
|
|
2401
|
-
if (cr) return cr(e, t);
|
|
2412
|
+
async function pr(e, t) {
|
|
2413
|
+
if (sr) return sr(e, t);
|
|
2402
2414
|
try {
|
|
2403
|
-
return await
|
|
2415
|
+
return await J(`/api/actions/${e}`, {
|
|
2404
2416
|
method: "POST",
|
|
2405
2417
|
body: JSON.stringify(t)
|
|
2406
2418
|
});
|
|
2407
2419
|
} catch (e) {
|
|
2408
|
-
throw e instanceof
|
|
2420
|
+
throw e instanceof V && ar(e.raw) ? new ir(e.status, e.raw) : e;
|
|
2409
2421
|
}
|
|
2410
2422
|
}
|
|
2411
|
-
async function
|
|
2423
|
+
async function mr(e, t) {
|
|
2412
2424
|
let n = new URLSearchParams();
|
|
2413
|
-
return n.set("ids", t.join(",")),
|
|
2425
|
+
return n.set("ids", t.join(",")), J(`/api/associations/${e}?${n.toString()}`);
|
|
2414
2426
|
}
|
|
2415
2427
|
//#endregion
|
|
2416
2428
|
//#region src/embed/params.ts
|
|
2417
|
-
var
|
|
2429
|
+
var hr = "self", gr = "embed", _r = "parent_origin", vr = "theme", yr = [
|
|
2430
|
+
gr,
|
|
2418
2431
|
_r,
|
|
2419
2432
|
vr,
|
|
2420
|
-
yr,
|
|
2421
2433
|
"nav"
|
|
2422
2434
|
];
|
|
2423
|
-
function
|
|
2435
|
+
function br(e) {
|
|
2424
2436
|
if (!e) return null;
|
|
2425
2437
|
let t;
|
|
2426
2438
|
try {
|
|
@@ -2430,22 +2442,22 @@ function xr(e) {
|
|
|
2430
2442
|
}
|
|
2431
2443
|
return t.origin === "null" ? null : e === t.origin ? t.origin : null;
|
|
2432
2444
|
}
|
|
2433
|
-
function
|
|
2445
|
+
function xr(e) {
|
|
2434
2446
|
return e === "light" || e === "dark" ? e : null;
|
|
2435
2447
|
}
|
|
2436
|
-
function
|
|
2437
|
-
return e === "delegated" ? "delegated" :
|
|
2448
|
+
function Sr(e) {
|
|
2449
|
+
return e === "delegated" ? "delegated" : hr;
|
|
2438
2450
|
}
|
|
2439
|
-
function
|
|
2451
|
+
function Cr(e) {
|
|
2440
2452
|
let t = typeof e == "string" ? new URLSearchParams(e) : e;
|
|
2441
2453
|
return {
|
|
2442
|
-
enabled: t.get(
|
|
2443
|
-
parentOrigin:
|
|
2444
|
-
theme:
|
|
2445
|
-
navigationMode:
|
|
2454
|
+
enabled: t.get(gr) === "1",
|
|
2455
|
+
parentOrigin: br(t.get(_r)),
|
|
2456
|
+
theme: xr(t.get(vr)),
|
|
2457
|
+
navigationMode: Sr(t.get("nav"))
|
|
2446
2458
|
};
|
|
2447
2459
|
}
|
|
2448
|
-
function
|
|
2460
|
+
function wr(e, t) {
|
|
2449
2461
|
if (!t.enabled) return e;
|
|
2450
2462
|
let n = /^[a-z][a-z0-9+.-]*:/i.test(e), r;
|
|
2451
2463
|
try {
|
|
@@ -2454,46 +2466,46 @@ function Tr(e, t) {
|
|
|
2454
2466
|
return e;
|
|
2455
2467
|
}
|
|
2456
2468
|
let i = r.searchParams;
|
|
2457
|
-
return t.enabled && i.set(
|
|
2469
|
+
return t.enabled && i.set(gr, "1"), t.parentOrigin && i.set(_r, t.parentOrigin), t.theme && i.set(vr, t.theme), i.set("nav", t.navigationMode), n ? r.toString() : `${r.pathname}${r.search}${r.hash}`;
|
|
2458
2470
|
}
|
|
2459
2471
|
//#endregion
|
|
2460
2472
|
//#region src/embed/EmbedContext.tsx
|
|
2461
|
-
var
|
|
2473
|
+
var Tr = i({
|
|
2462
2474
|
enabled: !1,
|
|
2463
2475
|
parentOrigin: null,
|
|
2464
2476
|
theme: null,
|
|
2465
2477
|
navigationMode: "self",
|
|
2466
2478
|
appendEmbedParams: (e) => e
|
|
2467
2479
|
});
|
|
2468
|
-
function
|
|
2480
|
+
function Er(e) {
|
|
2469
2481
|
return {
|
|
2470
2482
|
enabled: e.enabled,
|
|
2471
2483
|
parentOrigin: e.parentOrigin,
|
|
2472
2484
|
theme: e.theme,
|
|
2473
2485
|
navigationMode: e.navigationMode,
|
|
2474
|
-
appendEmbedParams: (t) =>
|
|
2486
|
+
appendEmbedParams: (t) => wr(t, e)
|
|
2475
2487
|
};
|
|
2476
2488
|
}
|
|
2477
|
-
function
|
|
2478
|
-
let n = d(() =>
|
|
2489
|
+
function Dr({ children: e, query: t }) {
|
|
2490
|
+
let n = d(() => Er(Cr(t ?? (typeof window < "u" ? window.location.search : ""))), [t]);
|
|
2479
2491
|
return l(() => {
|
|
2480
|
-
|
|
2481
|
-
}, [n.enabled]), /* @__PURE__ */ b(
|
|
2492
|
+
ce(n.enabled);
|
|
2493
|
+
}, [n.enabled]), /* @__PURE__ */ b(Tr.Provider, {
|
|
2482
2494
|
value: n,
|
|
2483
2495
|
children: e
|
|
2484
2496
|
});
|
|
2485
2497
|
}
|
|
2486
|
-
function
|
|
2487
|
-
return c(
|
|
2498
|
+
function Or() {
|
|
2499
|
+
return c(Tr);
|
|
2488
2500
|
}
|
|
2489
2501
|
//#endregion
|
|
2490
2502
|
//#region src/embed/embed-dirty.ts
|
|
2491
|
-
var
|
|
2503
|
+
var kr = E((e) => ({
|
|
2492
2504
|
isDirty: !1,
|
|
2493
2505
|
setDirty: (t) => e((e) => e.isDirty === t ? e : { isDirty: t })
|
|
2494
2506
|
}));
|
|
2495
|
-
function
|
|
2496
|
-
let n =
|
|
2507
|
+
function Ar(e, t) {
|
|
2508
|
+
let n = kr((e) => e.setDirty);
|
|
2497
2509
|
l(() => {
|
|
2498
2510
|
t && n(e);
|
|
2499
2511
|
}, [
|
|
@@ -2506,7 +2518,7 @@ function jr(e, t) {
|
|
|
2506
2518
|
}
|
|
2507
2519
|
//#endregion
|
|
2508
2520
|
//#region src/embed/embed-nav-guard.ts
|
|
2509
|
-
var
|
|
2521
|
+
var jr = E((e, t) => ({
|
|
2510
2522
|
pendingNavigation: null,
|
|
2511
2523
|
requestNavigation: (t) => e({ pendingNavigation: t }),
|
|
2512
2524
|
confirmNavigation: () => {
|
|
@@ -2517,21 +2529,23 @@ var Mr = E((e, t) => ({
|
|
|
2517
2529
|
}));
|
|
2518
2530
|
//#endregion
|
|
2519
2531
|
//#region src/embed/screen-location.ts
|
|
2520
|
-
function
|
|
2532
|
+
function Mr(e) {
|
|
2521
2533
|
let t = e.replace(/\/+$/, "").split("/").map((e) => e.startsWith(":") ? "[^/]+" : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
2522
2534
|
return RegExp("^" + t.join("/") + "$");
|
|
2523
2535
|
}
|
|
2524
|
-
function
|
|
2536
|
+
function Nr(e, t) {
|
|
2525
2537
|
let n = e.replace(/\/+$/, "") || "/";
|
|
2526
2538
|
if (!t) return {
|
|
2527
2539
|
matched: !1,
|
|
2528
2540
|
payload: { route: e }
|
|
2529
2541
|
};
|
|
2530
2542
|
let r, i, a, o;
|
|
2531
|
-
for (let [e, s] of Object.entries(t)) if (s.route &&
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2543
|
+
for (let [e, s] of Object.entries(t)) if (s.route && Mr(s.route).test(n)) {
|
|
2544
|
+
if (s.route.includes("/:")) a || (a = s, o = e);
|
|
2545
|
+
else {
|
|
2546
|
+
r = s, i = e;
|
|
2547
|
+
break;
|
|
2548
|
+
}
|
|
2535
2549
|
}
|
|
2536
2550
|
let s = r ?? a, c = r ? i : o;
|
|
2537
2551
|
if (!s || !c) return {
|
|
@@ -2553,34 +2567,34 @@ function Pr(e, t) {
|
|
|
2553
2567
|
payload: l
|
|
2554
2568
|
};
|
|
2555
2569
|
}
|
|
2556
|
-
function
|
|
2557
|
-
return
|
|
2570
|
+
function Pr(e, t) {
|
|
2571
|
+
return Nr(e, t).payload;
|
|
2558
2572
|
}
|
|
2559
2573
|
//#endregion
|
|
2560
2574
|
//#region src/embed/useEmbedNavigate.ts
|
|
2561
|
-
function
|
|
2575
|
+
function Fr(e) {
|
|
2562
2576
|
let t = e.search(/[?#]/);
|
|
2563
2577
|
return t === -1 ? e : e.slice(0, t);
|
|
2564
2578
|
}
|
|
2565
|
-
function
|
|
2566
|
-
let e = h(), t = m(), n =
|
|
2579
|
+
function Ir() {
|
|
2580
|
+
let e = h(), t = m(), n = Or(), { data: r } = X();
|
|
2567
2581
|
return s((i, a) => {
|
|
2568
2582
|
if (!n.enabled) return e(i, a), !0;
|
|
2569
|
-
let o = r?.screens, s =
|
|
2570
|
-
if (o && !s.matched) return
|
|
2571
|
-
route:
|
|
2583
|
+
let o = r?.screens, s = Nr(Fr(i), o), c = kr.getState().isDirty && Fr(i) !== t.pathname;
|
|
2584
|
+
if (o && !s.matched) return wt(n.parentOrigin, Ct.navigationFailed, {
|
|
2585
|
+
route: Fr(i),
|
|
2572
2586
|
reason: "unresolved"
|
|
2573
2587
|
}), !1;
|
|
2574
2588
|
if (n.navigationMode === "delegated") {
|
|
2575
2589
|
let e = () => {
|
|
2576
|
-
|
|
2590
|
+
wt(n.parentOrigin, Ct.navigationRequested, s.payload);
|
|
2577
2591
|
};
|
|
2578
|
-
return c ? (
|
|
2592
|
+
return c ? (jr.getState().requestNavigation(e), !1) : (e(), !1);
|
|
2579
2593
|
}
|
|
2580
2594
|
let l = () => {
|
|
2581
2595
|
e(n.appendEmbedParams(i), a);
|
|
2582
2596
|
};
|
|
2583
|
-
return c ? (
|
|
2597
|
+
return c ? (jr.getState().requestNavigation(l), !1) : (l(), !0);
|
|
2584
2598
|
}, [
|
|
2585
2599
|
e,
|
|
2586
2600
|
t.pathname,
|
|
@@ -2588,29 +2602,29 @@ function Lr() {
|
|
|
2588
2602
|
r?.screens
|
|
2589
2603
|
]);
|
|
2590
2604
|
}
|
|
2591
|
-
function
|
|
2592
|
-
let e =
|
|
2605
|
+
function Lr() {
|
|
2606
|
+
let e = Ir();
|
|
2593
2607
|
return s((t, n) => {
|
|
2594
2608
|
e(t, n);
|
|
2595
2609
|
}, [e]);
|
|
2596
2610
|
}
|
|
2597
|
-
function
|
|
2611
|
+
function Rr() {
|
|
2598
2612
|
let e = h();
|
|
2599
2613
|
return s(() => {
|
|
2600
2614
|
let t = () => {
|
|
2601
2615
|
e(-1);
|
|
2602
2616
|
};
|
|
2603
|
-
if (
|
|
2604
|
-
|
|
2617
|
+
if (kr.getState().isDirty) {
|
|
2618
|
+
jr.getState().requestNavigation(t);
|
|
2605
2619
|
return;
|
|
2606
2620
|
}
|
|
2607
2621
|
t();
|
|
2608
2622
|
}, [e]);
|
|
2609
2623
|
}
|
|
2610
|
-
function
|
|
2611
|
-
let e =
|
|
2624
|
+
function zr() {
|
|
2625
|
+
let e = Or();
|
|
2612
2626
|
return s((t, n) => {
|
|
2613
|
-
e.enabled &&
|
|
2627
|
+
e.enabled && wt(e.parentOrigin, Ct.navigationFailed, {
|
|
2614
2628
|
route: t,
|
|
2615
2629
|
reason: n
|
|
2616
2630
|
});
|
|
@@ -2618,7 +2632,7 @@ function Br() {
|
|
|
2618
2632
|
}
|
|
2619
2633
|
//#endregion
|
|
2620
2634
|
//#region src/components/shared/toast/DeclarionToast.tsx
|
|
2621
|
-
var
|
|
2635
|
+
var Br = {
|
|
2622
2636
|
success: {
|
|
2623
2637
|
tone: "success",
|
|
2624
2638
|
defaultTitle: "Success"
|
|
@@ -2639,23 +2653,25 @@ var Vr = {
|
|
|
2639
2653
|
tone: "info",
|
|
2640
2654
|
defaultTitle: "Working…"
|
|
2641
2655
|
}
|
|
2642
|
-
},
|
|
2643
|
-
function
|
|
2656
|
+
}, Vr = 200;
|
|
2657
|
+
function Hr({ type: e }) {
|
|
2644
2658
|
let n = { display: "flex" };
|
|
2645
|
-
|
|
2659
|
+
if (e === "loading") return /* @__PURE__ */ b("span", {
|
|
2646
2660
|
style: {
|
|
2647
2661
|
...n,
|
|
2648
2662
|
animation: "dz-toast-spin 0.9s linear infinite"
|
|
2649
2663
|
},
|
|
2650
2664
|
children: /* @__PURE__ */ b(t.loader, { size: 11 })
|
|
2651
|
-
})
|
|
2665
|
+
});
|
|
2666
|
+
let r = e === "success" ? t.check : e === "error" ? t.x : e === "warning" ? t.warning : t.info;
|
|
2667
|
+
return /* @__PURE__ */ b("span", {
|
|
2652
2668
|
style: n,
|
|
2653
|
-
children: /* @__PURE__ */ b(
|
|
2669
|
+
children: /* @__PURE__ */ b(r, { size: 11 })
|
|
2654
2670
|
});
|
|
2655
2671
|
}
|
|
2656
|
-
function
|
|
2657
|
-
let r =
|
|
2658
|
-
S.current || (S.current = !0, g(!0), window.setTimeout(n,
|
|
2672
|
+
function Ur({ model: e, onClose: n }) {
|
|
2673
|
+
let r = Br[e.type] ?? Br.info, i = r.tone, [a, o] = p(!1), [c, u] = p(!1), [d, m] = p(!1), [h, g] = p(!1), [_, v] = p(1), y = f(e.duration), S = f(!1), C = !e.sticky && e.duration > 0, w = s(() => {
|
|
2674
|
+
S.current || (S.current = !0, g(!0), window.setTimeout(n, Vr));
|
|
2659
2675
|
}, [n]);
|
|
2660
2676
|
l(() => {
|
|
2661
2677
|
y.current = e.duration, v(1);
|
|
@@ -2704,7 +2720,7 @@ function Wr({ model: e, onClose: n }) {
|
|
|
2704
2720
|
boxShadow: "var(--shadow-toast)",
|
|
2705
2721
|
overflow: "hidden",
|
|
2706
2722
|
position: "relative",
|
|
2707
|
-
animation: h ? `dz-toast-out ${
|
|
2723
|
+
animation: h ? `dz-toast-out ${Vr}ms ease-in forwards` : "dz-toast-in 0.24s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
2708
2724
|
},
|
|
2709
2725
|
children: [/* @__PURE__ */ x("div", {
|
|
2710
2726
|
style: {
|
|
@@ -2726,7 +2742,7 @@ function Wr({ model: e, onClose: n }) {
|
|
|
2726
2742
|
justifyContent: "center",
|
|
2727
2743
|
color: E("")
|
|
2728
2744
|
},
|
|
2729
|
-
children: /* @__PURE__ */ b(
|
|
2745
|
+
children: /* @__PURE__ */ b(Hr, { type: e.type })
|
|
2730
2746
|
}),
|
|
2731
2747
|
/* @__PURE__ */ x("div", {
|
|
2732
2748
|
style: {
|
|
@@ -2919,40 +2935,40 @@ function Wr({ model: e, onClose: n }) {
|
|
|
2919
2935
|
}
|
|
2920
2936
|
//#endregion
|
|
2921
2937
|
//#region src/lib/toast.tsx
|
|
2922
|
-
var
|
|
2938
|
+
var Wr = {
|
|
2923
2939
|
success: 4e3,
|
|
2924
2940
|
info: 6e3,
|
|
2925
2941
|
warning: 8e3,
|
|
2926
2942
|
error: 0,
|
|
2927
2943
|
loading: 0
|
|
2928
|
-
},
|
|
2944
|
+
}, Gr = /* @__PURE__ */ new Map(), Kr = /* @__PURE__ */ new Map(), qr = 0, Jr = () => `dz-${++qr}`;
|
|
2929
2945
|
function Yr(e) {
|
|
2930
|
-
v.custom(() => /* @__PURE__ */ b(
|
|
2946
|
+
v.custom(() => /* @__PURE__ */ b(Ur, {
|
|
2931
2947
|
model: e,
|
|
2932
2948
|
onClose: () => v.dismiss(e.id)
|
|
2933
2949
|
}), {
|
|
2934
2950
|
id: e.id,
|
|
2935
2951
|
duration: Infinity,
|
|
2936
2952
|
onDismiss: () => {
|
|
2937
|
-
|
|
2953
|
+
Gr.delete(String(e.id)), e.group && Kr.get(e.group) === e.id && Kr.delete(e.group);
|
|
2938
2954
|
}
|
|
2939
2955
|
});
|
|
2940
2956
|
}
|
|
2941
2957
|
function Xr(e, t, n, r = {}) {
|
|
2942
2958
|
if (r.group) {
|
|
2943
2959
|
let e = Kr.get(r.group);
|
|
2944
|
-
if (e &&
|
|
2945
|
-
let r =
|
|
2960
|
+
if (e && Gr.has(e)) {
|
|
2961
|
+
let r = Gr.get(e), i = {
|
|
2946
2962
|
...r,
|
|
2947
2963
|
title: t,
|
|
2948
2964
|
message: n,
|
|
2949
2965
|
count: (r.count ?? 1) + 1,
|
|
2950
2966
|
createdAt: Date.now()
|
|
2951
2967
|
};
|
|
2952
|
-
return
|
|
2968
|
+
return Gr.set(e, i), Yr(i), e;
|
|
2953
2969
|
}
|
|
2954
2970
|
}
|
|
2955
|
-
let i = r.id ?? Jr(), a = r.duration ??
|
|
2971
|
+
let i = r.id ?? Jr(), a = r.duration ?? Wr[e], o = {
|
|
2956
2972
|
id: i,
|
|
2957
2973
|
type: e,
|
|
2958
2974
|
title: t,
|
|
@@ -2966,12 +2982,12 @@ function Xr(e, t, n, r = {}) {
|
|
|
2966
2982
|
createdAt: Date.now(),
|
|
2967
2983
|
group: r.group
|
|
2968
2984
|
};
|
|
2969
|
-
return
|
|
2985
|
+
return Gr.set(i, o), r.group && Kr.set(r.group, i), Yr(o), i;
|
|
2970
2986
|
}
|
|
2971
2987
|
function Zr(e, t) {
|
|
2972
|
-
let n =
|
|
2988
|
+
let n = Gr.get(e);
|
|
2973
2989
|
if (!n) return;
|
|
2974
|
-
let r = t.type ?? n.type, i = t.duration ?? (t.type ?
|
|
2990
|
+
let r = t.type ?? n.type, i = t.duration ?? (t.type ? Wr[r] : n.duration), a = {
|
|
2975
2991
|
...n,
|
|
2976
2992
|
...t,
|
|
2977
2993
|
type: r,
|
|
@@ -2979,7 +2995,7 @@ function Zr(e, t) {
|
|
|
2979
2995
|
sticky: t.sticky ?? i === 0,
|
|
2980
2996
|
createdAt: Date.now()
|
|
2981
2997
|
};
|
|
2982
|
-
|
|
2998
|
+
Gr.set(e, a), Yr(a);
|
|
2983
2999
|
}
|
|
2984
3000
|
var Z = {
|
|
2985
3001
|
success: (e, t, n) => Xr("success", e, t, n),
|
|
@@ -2990,7 +3006,7 @@ var Z = {
|
|
|
2990
3006
|
update: Zr,
|
|
2991
3007
|
dismiss: (e) => v.dismiss(e),
|
|
2992
3008
|
dismissAll: () => v.dismiss()
|
|
2993
|
-
}, Qr = o(() => import("./MarkdownRenderer-
|
|
3009
|
+
}, Qr = o(() => import("./MarkdownRenderer-C6bhrAIe.js").then((e) => ({ default: e.MarkdownRenderer })));
|
|
2994
3010
|
function $r() {
|
|
2995
3011
|
return /* @__PURE__ */ b("div", { className: "h-4 w-2/3 rounded bg-muted animate-pulse" });
|
|
2996
3012
|
}
|
|
@@ -3097,7 +3113,7 @@ function ui({ value: e, title: n, size: r = "icon" }) {
|
|
|
3097
3113
|
//#region src/components/fields/StringField.tsx
|
|
3098
3114
|
function di({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3099
3115
|
if (r === "display") {
|
|
3100
|
-
let t =
|
|
3116
|
+
let t = R(n);
|
|
3101
3117
|
return e.copyable && t ? /* @__PURE__ */ x("span", {
|
|
3102
3118
|
style: {
|
|
3103
3119
|
display: "inline-flex",
|
|
@@ -3119,11 +3135,11 @@ function di({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3119
3135
|
})
|
|
3120
3136
|
});
|
|
3121
3137
|
}
|
|
3122
|
-
return /* @__PURE__ */ b(
|
|
3138
|
+
return /* @__PURE__ */ b(F, {
|
|
3123
3139
|
id: a,
|
|
3124
3140
|
name: t,
|
|
3125
3141
|
"aria-required": e.required || void 0,
|
|
3126
|
-
value:
|
|
3142
|
+
value: R(n),
|
|
3127
3143
|
onChange: (e) => i?.(e)
|
|
3128
3144
|
});
|
|
3129
3145
|
}
|
|
@@ -3132,7 +3148,7 @@ function di({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3132
3148
|
function fi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, compact: o, fieldId: s }) {
|
|
3133
3149
|
let c = e.display?.widget;
|
|
3134
3150
|
if (r === "display") {
|
|
3135
|
-
let t =
|
|
3151
|
+
let t = R(n);
|
|
3136
3152
|
if (!t) return /* @__PURE__ */ b("span", {
|
|
3137
3153
|
style: {
|
|
3138
3154
|
fontSize: 12.5,
|
|
@@ -3179,19 +3195,19 @@ function fi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fill: a, c
|
|
|
3179
3195
|
})]
|
|
3180
3196
|
}) : r;
|
|
3181
3197
|
}
|
|
3182
|
-
if (o) return /* @__PURE__ */ b(
|
|
3198
|
+
if (o) return /* @__PURE__ */ b(F, {
|
|
3183
3199
|
id: s,
|
|
3184
3200
|
name: t,
|
|
3185
3201
|
"aria-required": e.required || void 0,
|
|
3186
|
-
value:
|
|
3202
|
+
value: R(n),
|
|
3187
3203
|
onChange: (e) => i?.(e)
|
|
3188
3204
|
});
|
|
3189
3205
|
let l = c === "markdown" || c === "code" ? 10 : 4;
|
|
3190
|
-
return /* @__PURE__ */ b(
|
|
3206
|
+
return /* @__PURE__ */ b(we, {
|
|
3191
3207
|
id: s,
|
|
3192
3208
|
name: t,
|
|
3193
3209
|
ariaRequired: e.required,
|
|
3194
|
-
value:
|
|
3210
|
+
value: R(n),
|
|
3195
3211
|
onChange: (e) => i?.(e),
|
|
3196
3212
|
rows: l,
|
|
3197
3213
|
fill: a
|
|
@@ -3205,7 +3221,7 @@ function mi({ field: e, value: t, mode: n, onChange: r, fieldId: i, labelId: a }
|
|
|
3205
3221
|
if (n === "display") return s ? /* @__PURE__ */ b(k, {
|
|
3206
3222
|
tone: s.color ?? "slate",
|
|
3207
3223
|
size: "xs",
|
|
3208
|
-
children:
|
|
3224
|
+
children: z(s.name)
|
|
3209
3225
|
}) : /* @__PURE__ */ b("span", {
|
|
3210
3226
|
style: {
|
|
3211
3227
|
fontSize: 12.5,
|
|
@@ -3213,14 +3229,14 @@ function mi({ field: e, value: t, mode: n, onChange: r, fieldId: i, labelId: a }
|
|
|
3213
3229
|
},
|
|
3214
3230
|
children: "—"
|
|
3215
3231
|
});
|
|
3216
|
-
let c = !e.required, l = t != null && t !== "" ?
|
|
3232
|
+
let c = !e.required, l = t != null && t !== "" ? R(t) : pi, u = [...c ? [{
|
|
3217
3233
|
value: pi,
|
|
3218
3234
|
label: "— None —"
|
|
3219
3235
|
}] : [], ...o.map((e) => ({
|
|
3220
3236
|
value: e.code,
|
|
3221
|
-
label:
|
|
3237
|
+
label: z(e.name) || e.code
|
|
3222
3238
|
}))];
|
|
3223
|
-
return /* @__PURE__ */ b(
|
|
3239
|
+
return /* @__PURE__ */ b(I, {
|
|
3224
3240
|
id: i,
|
|
3225
3241
|
"aria-labelledby": a,
|
|
3226
3242
|
"aria-required": e.required || void 0,
|
|
@@ -3233,24 +3249,24 @@ function mi({ field: e, value: t, mode: n, onChange: r, fieldId: i, labelId: a }
|
|
|
3233
3249
|
//#endregion
|
|
3234
3250
|
//#region src/components/fields/EmailField.tsx
|
|
3235
3251
|
function hi({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
3236
|
-
return /* @__PURE__ */ b(
|
|
3252
|
+
return /* @__PURE__ */ b(F, {
|
|
3237
3253
|
id: i,
|
|
3238
3254
|
name: t,
|
|
3239
3255
|
"aria-required": e.required || void 0,
|
|
3240
3256
|
type: "email",
|
|
3241
|
-
value:
|
|
3257
|
+
value: R(n),
|
|
3242
3258
|
onChange: (e) => r?.(e)
|
|
3243
3259
|
});
|
|
3244
3260
|
}
|
|
3245
3261
|
//#endregion
|
|
3246
3262
|
//#region src/components/fields/UrlField.tsx
|
|
3247
3263
|
function gi({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
3248
|
-
return /* @__PURE__ */ b(
|
|
3264
|
+
return /* @__PURE__ */ b(F, {
|
|
3249
3265
|
id: i,
|
|
3250
3266
|
name: t,
|
|
3251
3267
|
"aria-required": e.required || void 0,
|
|
3252
3268
|
type: "url",
|
|
3253
|
-
value:
|
|
3269
|
+
value: R(n),
|
|
3254
3270
|
onChange: (e) => r?.(e),
|
|
3255
3271
|
placeholder: "https://"
|
|
3256
3272
|
});
|
|
@@ -3258,12 +3274,12 @@ function gi({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
|
3258
3274
|
//#endregion
|
|
3259
3275
|
//#region src/components/fields/PhoneField.tsx
|
|
3260
3276
|
function _i({ field: e, fieldName: t, value: n, onChange: r, fieldId: i }) {
|
|
3261
|
-
return /* @__PURE__ */ b(
|
|
3277
|
+
return /* @__PURE__ */ b(F, {
|
|
3262
3278
|
id: i,
|
|
3263
3279
|
name: t,
|
|
3264
3280
|
"aria-required": e.required || void 0,
|
|
3265
3281
|
type: "tel",
|
|
3266
|
-
value:
|
|
3282
|
+
value: R(n),
|
|
3267
3283
|
onChange: (e) => r?.(e),
|
|
3268
3284
|
placeholder: "+1 555 555 5555"
|
|
3269
3285
|
});
|
|
@@ -3284,7 +3300,7 @@ function bi(e, t) {
|
|
|
3284
3300
|
let t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
3285
3301
|
return isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(void 0, vi).format(t);
|
|
3286
3302
|
}
|
|
3287
|
-
return
|
|
3303
|
+
return Be(e, yi);
|
|
3288
3304
|
}
|
|
3289
3305
|
function xi(e, t) {
|
|
3290
3306
|
if (t) {
|
|
@@ -3340,7 +3356,7 @@ function Ti({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3340
3356
|
},
|
|
3341
3357
|
children: "—"
|
|
3342
3358
|
});
|
|
3343
|
-
let e =
|
|
3359
|
+
let e = R(n), t = s ? bi(e, o) : xi(e, o), r = s && !o ? Si(e) : null;
|
|
3344
3360
|
return /* @__PURE__ */ x("span", {
|
|
3345
3361
|
style: { fontSize: 12.5 },
|
|
3346
3362
|
children: [t, r && /* @__PURE__ */ b("span", {
|
|
@@ -3352,8 +3368,8 @@ function Ti({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3352
3368
|
})]
|
|
3353
3369
|
});
|
|
3354
3370
|
}
|
|
3355
|
-
let c = n ? s ? Ci(
|
|
3356
|
-
return /* @__PURE__ */ b(
|
|
3371
|
+
let c = n ? s ? Ci(R(n), o) : wi(R(n), o) : "";
|
|
3372
|
+
return /* @__PURE__ */ b(F, {
|
|
3357
3373
|
id: a,
|
|
3358
3374
|
name: t,
|
|
3359
3375
|
"aria-required": e.required || void 0,
|
|
@@ -3373,7 +3389,7 @@ function Ti({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3373
3389
|
i?.(e);
|
|
3374
3390
|
return;
|
|
3375
3391
|
}
|
|
3376
|
-
i?.(
|
|
3392
|
+
i?.(ze(t));
|
|
3377
3393
|
}
|
|
3378
3394
|
});
|
|
3379
3395
|
}
|
|
@@ -3395,7 +3411,7 @@ function Ei({ value: e, mode: t, onChange: n, fieldId: r, labelId: i }) {
|
|
|
3395
3411
|
borderRadius: 999,
|
|
3396
3412
|
background: a ? "var(--success)" : "var(--text-4)"
|
|
3397
3413
|
} }), a ? "Yes" : "No"]
|
|
3398
|
-
}) : /* @__PURE__ */ b(
|
|
3414
|
+
}) : /* @__PURE__ */ b(ye, {
|
|
3399
3415
|
id: r,
|
|
3400
3416
|
ariaLabelledby: i,
|
|
3401
3417
|
value: a,
|
|
@@ -3451,24 +3467,24 @@ function ki({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
3451
3467
|
})]
|
|
3452
3468
|
});
|
|
3453
3469
|
}
|
|
3454
|
-
return c ? /* @__PURE__ */ b(
|
|
3470
|
+
return c ? /* @__PURE__ */ b(F, {
|
|
3455
3471
|
id: o,
|
|
3456
3472
|
name: t,
|
|
3457
3473
|
"aria-required": e.required || void 0,
|
|
3458
3474
|
type: "text",
|
|
3459
3475
|
inputMode: "decimal",
|
|
3460
3476
|
pattern: "-?\\d*\\.?\\d*",
|
|
3461
|
-
value: n == null ? "" :
|
|
3477
|
+
value: n == null ? "" : R(n),
|
|
3462
3478
|
onChange: (e) => {
|
|
3463
3479
|
e === "" ? i?.(null) : i?.(e);
|
|
3464
3480
|
}
|
|
3465
|
-
}) : /* @__PURE__ */ b(
|
|
3481
|
+
}) : /* @__PURE__ */ b(F, {
|
|
3466
3482
|
id: o,
|
|
3467
3483
|
name: t,
|
|
3468
3484
|
"aria-required": e.required || void 0,
|
|
3469
3485
|
type: "number",
|
|
3470
3486
|
step: e.type === "float" ? "0.01" : "1",
|
|
3471
|
-
value: n == null ? "" :
|
|
3487
|
+
value: n == null ? "" : R(n),
|
|
3472
3488
|
onChange: (t) => {
|
|
3473
3489
|
t === "" ? i?.(null) : i?.(e.type === "int" ? parseInt(t, 10) : parseFloat(t));
|
|
3474
3490
|
}
|
|
@@ -3490,7 +3506,7 @@ function ji(e, t, n = !0) {
|
|
|
3490
3506
|
let r = Ai(e, t), i = r[2];
|
|
3491
3507
|
return g({
|
|
3492
3508
|
queryKey: r,
|
|
3493
|
-
queryFn: ({ signal: t }) =>
|
|
3509
|
+
queryFn: ({ signal: t }) => Xn(e, i, { signal: t }),
|
|
3494
3510
|
enabled: !!e && n,
|
|
3495
3511
|
placeholderData: (t, n) => n?.queryKey?.[1] === e ? t : void 0
|
|
3496
3512
|
});
|
|
@@ -3511,7 +3527,7 @@ function Mi(e, t, n = !0) {
|
|
|
3511
3527
|
e,
|
|
3512
3528
|
r
|
|
3513
3529
|
],
|
|
3514
|
-
queryFn: ({ signal: t }) =>
|
|
3530
|
+
queryFn: ({ signal: t }) => Xn(e, r, { signal: t }),
|
|
3515
3531
|
enabled: !!e && n,
|
|
3516
3532
|
retry: 1,
|
|
3517
3533
|
staleTime: 3e4,
|
|
@@ -3530,19 +3546,19 @@ function Ni(e, t) {
|
|
|
3530
3546
|
//#endregion
|
|
3531
3547
|
//#region src/hooks/useEntity.ts
|
|
3532
3548
|
function Pi(e) {
|
|
3533
|
-
let { data: t } =
|
|
3549
|
+
let { data: t } = X();
|
|
3534
3550
|
if (!(!t || !e)) return t.entities[e];
|
|
3535
3551
|
}
|
|
3536
3552
|
//#endregion
|
|
3537
3553
|
//#region src/components/fields/RefCombobox.tsx
|
|
3538
3554
|
var Fi = 200;
|
|
3539
3555
|
function Ii({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, id: a, labelId: o, ariaLabel: s, required: c, placeholder: l = "Select…", specialValues: u }) {
|
|
3540
|
-
let m = e?.entity, h = Pi(m), g = i ?? e?.display?.field ?? h?.display?.display_field ?? "$display", _ = d(() => h ?
|
|
3556
|
+
let m = e?.entity, h = Pi(m), g = i ?? e?.display?.field ?? h?.display?.display_field ?? "$display", _ = d(() => h ? B(h)[0] ?? "id" : "id", [h]), v = e?.field || _, [y, x] = p(""), S = Ni(y, 300), { data: C, isLoading: w } = ji(m, {
|
|
3541
3557
|
per_page: Fi,
|
|
3542
3558
|
sort: g ? `${g}:asc` : void 0,
|
|
3543
3559
|
search: S || void 0,
|
|
3544
3560
|
filters: e?.options_filter
|
|
3545
|
-
}), T = d(() => C?.data ?? [], [C?.data]), E = t == null ? "" :
|
|
3561
|
+
}), T = d(() => C?.data ?? [], [C?.data]), E = t == null ? "" : R(t), D = d(() => T.some((e) => String(e[v]) === E), [
|
|
3546
3562
|
T,
|
|
3547
3563
|
v,
|
|
3548
3564
|
E
|
|
@@ -3556,13 +3572,13 @@ function Ii({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3556
3572
|
}), j = f(null), M = d(() => {
|
|
3557
3573
|
if (!E) return "";
|
|
3558
3574
|
let e;
|
|
3559
|
-
if (O) e =
|
|
3575
|
+
if (O) e = Ge(O, g, E);
|
|
3560
3576
|
else {
|
|
3561
3577
|
let t = T.find((e) => String(e[v]) === E);
|
|
3562
|
-
if (t) e =
|
|
3578
|
+
if (t) e = Ge(t, g, E);
|
|
3563
3579
|
else {
|
|
3564
3580
|
let t = A?.data?.find((e) => String(e[v]) === E);
|
|
3565
|
-
t && (e =
|
|
3581
|
+
t && (e = Ge(t, g, E));
|
|
3566
3582
|
}
|
|
3567
3583
|
}
|
|
3568
3584
|
return e === void 0 ? j.current?.value === E ? j.current.label : E : (j.current = {
|
|
@@ -3579,12 +3595,12 @@ function Ii({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3579
3595
|
]), ee = d(() => {
|
|
3580
3596
|
let e = (u ?? []).map((e) => ({
|
|
3581
3597
|
value: e.code,
|
|
3582
|
-
label:
|
|
3598
|
+
label: z(e.label) || e.code
|
|
3583
3599
|
})), t = T.map((e) => {
|
|
3584
|
-
let t =
|
|
3600
|
+
let t = R(e[v]);
|
|
3585
3601
|
return {
|
|
3586
3602
|
value: t,
|
|
3587
|
-
label:
|
|
3603
|
+
label: Ge(e, g, t)
|
|
3588
3604
|
};
|
|
3589
3605
|
}), n = E && !D && !k ? [{
|
|
3590
3606
|
value: E,
|
|
@@ -3619,7 +3635,7 @@ function Ii({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3619
3635
|
v,
|
|
3620
3636
|
g
|
|
3621
3637
|
]);
|
|
3622
|
-
return /* @__PURE__ */ b(
|
|
3638
|
+
return /* @__PURE__ */ b(I, {
|
|
3623
3639
|
id: a,
|
|
3624
3640
|
"aria-label": s,
|
|
3625
3641
|
"aria-labelledby": o,
|
|
@@ -3636,10 +3652,10 @@ function Ii({ ref: e, value: t, onChange: n, refs: r, displayFieldOverride: i, i
|
|
|
3636
3652
|
function Li({ field: e, value: t, mode: n, onChange: r, refs: i, fieldId: a, labelId: o }) {
|
|
3637
3653
|
let s = e.ref?.entity, c = e.display?.ref_display_field || "$display", l = d(() => {
|
|
3638
3654
|
if (t == null) return "—";
|
|
3639
|
-
let e =
|
|
3655
|
+
let e = R(t);
|
|
3640
3656
|
if (i && s) {
|
|
3641
3657
|
let t = i[s]?.[e];
|
|
3642
|
-
if (t) return
|
|
3658
|
+
if (t) return Ge(t, c, e);
|
|
3643
3659
|
}
|
|
3644
3660
|
return e;
|
|
3645
3661
|
}, [
|
|
@@ -3699,14 +3715,17 @@ function Hi(e) {
|
|
|
3699
3715
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
3700
3716
|
}
|
|
3701
3717
|
function Ui({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3702
|
-
let { data: o } =
|
|
3718
|
+
let { data: o } = X(), s = o?.languages?.length ? o.languages : [{
|
|
3703
3719
|
code: "en",
|
|
3704
3720
|
name: { en: "English" }
|
|
3705
3721
|
}], c = Hi(n);
|
|
3706
|
-
if (r === "display")
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3722
|
+
if (r === "display") {
|
|
3723
|
+
let e = Object.values(c)[0] ?? "—";
|
|
3724
|
+
return /* @__PURE__ */ b("span", {
|
|
3725
|
+
style: { fontSize: 12.5 },
|
|
3726
|
+
children: e
|
|
3727
|
+
});
|
|
3728
|
+
}
|
|
3710
3729
|
let l = (e, t) => {
|
|
3711
3730
|
let n = {
|
|
3712
3731
|
...c,
|
|
@@ -3743,7 +3762,7 @@ function Ui({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3743
3762
|
children: n.code
|
|
3744
3763
|
}), /* @__PURE__ */ b("div", {
|
|
3745
3764
|
style: { flex: 1 },
|
|
3746
|
-
children: /* @__PURE__ */ b(
|
|
3765
|
+
children: /* @__PURE__ */ b(F, {
|
|
3747
3766
|
id: i,
|
|
3748
3767
|
name: t ? `${t}.${n.code}` : void 0,
|
|
3749
3768
|
"aria-required": e.required && r === 0 ? !0 : void 0,
|
|
@@ -3762,18 +3781,21 @@ function Wi(e) {
|
|
|
3762
3781
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
3763
3782
|
}
|
|
3764
3783
|
function Gi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a }) {
|
|
3765
|
-
let { data: o } =
|
|
3784
|
+
let { data: o } = X(), s = o?.languages?.length ? o.languages : [{
|
|
3766
3785
|
code: "en",
|
|
3767
3786
|
name: { en: "English" }
|
|
3768
3787
|
}], c = Wi(n);
|
|
3769
|
-
if (r === "display")
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3788
|
+
if (r === "display") {
|
|
3789
|
+
let e = Object.values(c)[0] ?? "—";
|
|
3790
|
+
return /* @__PURE__ */ b("p", {
|
|
3791
|
+
style: {
|
|
3792
|
+
fontSize: 12.5,
|
|
3793
|
+
whiteSpace: "pre-wrap",
|
|
3794
|
+
margin: 0
|
|
3795
|
+
},
|
|
3796
|
+
children: e
|
|
3797
|
+
});
|
|
3798
|
+
}
|
|
3777
3799
|
let l = (e, t) => {
|
|
3778
3800
|
let n = {
|
|
3779
3801
|
...c,
|
|
@@ -3806,7 +3828,7 @@ function Gi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3806
3828
|
fontWeight: 500
|
|
3807
3829
|
},
|
|
3808
3830
|
children: n.code
|
|
3809
|
-
}), /* @__PURE__ */ b(
|
|
3831
|
+
}), /* @__PURE__ */ b(we, {
|
|
3810
3832
|
id: i,
|
|
3811
3833
|
name: t ? `${t}.${n.code}` : void 0,
|
|
3812
3834
|
ariaRequired: e.required && r === 0,
|
|
@@ -3822,7 +3844,7 @@ function Gi({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
3822
3844
|
//#endregion
|
|
3823
3845
|
//#region src/components/fields/StructureField.tsx
|
|
3824
3846
|
function Ki(e) {
|
|
3825
|
-
let { field: t, value: n, mode: r, onChange: i, locale: a, fieldId: o } = e, { data: s } =
|
|
3847
|
+
let { field: t, value: n, mode: r, onChange: i, locale: a, fieldId: o } = e, { data: s } = X(), c = t.structure ? s?.structures?.[t.structure] : void 0;
|
|
3826
3848
|
return c ? t.array ? /* @__PURE__ */ b(Ji, {
|
|
3827
3849
|
structDef: c,
|
|
3828
3850
|
value: n,
|
|
@@ -3869,7 +3891,7 @@ function qi({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId:
|
|
|
3869
3891
|
minWidth: 100,
|
|
3870
3892
|
flexShrink: 0
|
|
3871
3893
|
},
|
|
3872
|
-
children: n.display ?
|
|
3894
|
+
children: n.display ? z(n.display.name) : t
|
|
3873
3895
|
}), /* @__PURE__ */ b("div", {
|
|
3874
3896
|
style: {
|
|
3875
3897
|
minWidth: 0,
|
|
@@ -3916,9 +3938,9 @@ function qi({ structDef: e, value: t, mode: n, onChange: r, locale: i, fieldId:
|
|
|
3916
3938
|
flexDirection: "column",
|
|
3917
3939
|
gap: 2
|
|
3918
3940
|
},
|
|
3919
|
-
children: [/* @__PURE__ */ b(
|
|
3941
|
+
children: [/* @__PURE__ */ b(Se, {
|
|
3920
3942
|
required: n.required,
|
|
3921
|
-
children: n.display ?
|
|
3943
|
+
children: n.display ? z(n.display.name) : t
|
|
3922
3944
|
}), n.type === "structure" && n.structure ? /* @__PURE__ */ b(Ki, {
|
|
3923
3945
|
field: n,
|
|
3924
3946
|
fieldName: t,
|
|
@@ -4023,7 +4045,7 @@ function Xi({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
4023
4045
|
fontStyle: "italic"
|
|
4024
4046
|
},
|
|
4025
4047
|
children: "Not set"
|
|
4026
|
-
}) : /* @__PURE__ */ b(
|
|
4048
|
+
}) : /* @__PURE__ */ b(Ne, {
|
|
4027
4049
|
id: o,
|
|
4028
4050
|
name: t,
|
|
4029
4051
|
ariaRequired: e.required,
|
|
@@ -4053,7 +4075,7 @@ function Qi({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
4053
4075
|
fontStyle: "italic"
|
|
4054
4076
|
},
|
|
4055
4077
|
children: "Not set"
|
|
4056
|
-
}) : /* @__PURE__ */ b(
|
|
4078
|
+
}) : /* @__PURE__ */ b(Ne, {
|
|
4057
4079
|
id: o,
|
|
4058
4080
|
name: t,
|
|
4059
4081
|
ariaRequired: e.required,
|
|
@@ -4089,7 +4111,7 @@ function ea({ field: e, fieldName: t, value: n, mode: r, onChange: i, fieldId: a
|
|
|
4089
4111
|
function ta({ values: e, selected: n, mode: r, required: i, onChange: a }) {
|
|
4090
4112
|
let o = new Set(n), s = (t) => {
|
|
4091
4113
|
let n = e.find((e) => e.code === t);
|
|
4092
|
-
return n &&
|
|
4114
|
+
return n && z(n.name) || t;
|
|
4093
4115
|
}, c = n.filter((t) => !e.some((e) => e.code === t));
|
|
4094
4116
|
if (r === "display") return n.length === 0 ? /* @__PURE__ */ b("span", {
|
|
4095
4117
|
style: {
|
|
@@ -4103,10 +4125,10 @@ function ta({ values: e, selected: n, mode: r, required: i, onChange: a }) {
|
|
|
4103
4125
|
flexWrap: "wrap",
|
|
4104
4126
|
gap: 4
|
|
4105
4127
|
},
|
|
4106
|
-
children: [e.filter((e) => o.has(e.code)).map((e) => /* @__PURE__ */ b(
|
|
4128
|
+
children: [e.filter((e) => o.has(e.code)).map((e) => /* @__PURE__ */ b(P, {
|
|
4107
4129
|
tone: "slate",
|
|
4108
|
-
children:
|
|
4109
|
-
}, e.code)), c.map((e) => /* @__PURE__ */ b(
|
|
4130
|
+
children: z(e.name) || e.code
|
|
4131
|
+
}, e.code)), c.map((e) => /* @__PURE__ */ b(P, {
|
|
4110
4132
|
tone: "slate",
|
|
4111
4133
|
children: s(e)
|
|
4112
4134
|
}, e))]
|
|
@@ -4166,7 +4188,7 @@ function na({ items: e, fieldName: n, required: r, mode: i, onChange: a, fieldId
|
|
|
4166
4188
|
flexWrap: "wrap",
|
|
4167
4189
|
gap: 4
|
|
4168
4190
|
},
|
|
4169
|
-
children: e.map((e, t) => /* @__PURE__ */ b(
|
|
4191
|
+
children: e.map((e, t) => /* @__PURE__ */ b(P, {
|
|
4170
4192
|
tone: "slate",
|
|
4171
4193
|
children: e
|
|
4172
4194
|
}, t))
|
|
@@ -4189,7 +4211,7 @@ function na({ items: e, fieldName: n, required: r, mode: i, onChange: a, fieldId
|
|
|
4189
4211
|
flexWrap: "wrap",
|
|
4190
4212
|
gap: 4
|
|
4191
4213
|
},
|
|
4192
|
-
children: e.map((e, t) => /* @__PURE__ */ b(
|
|
4214
|
+
children: e.map((e, t) => /* @__PURE__ */ b(P, {
|
|
4193
4215
|
tone: "slate",
|
|
4194
4216
|
onRemove: () => u(t),
|
|
4195
4217
|
children: e
|
|
@@ -4201,7 +4223,7 @@ function na({ items: e, fieldName: n, required: r, mode: i, onChange: a, fieldId
|
|
|
4201
4223
|
},
|
|
4202
4224
|
children: [/* @__PURE__ */ b("div", {
|
|
4203
4225
|
style: { flex: 1 },
|
|
4204
|
-
children: /* @__PURE__ */ b(
|
|
4226
|
+
children: /* @__PURE__ */ b(F, {
|
|
4205
4227
|
id: o,
|
|
4206
4228
|
name: n,
|
|
4207
4229
|
"aria-required": r || void 0,
|
|
@@ -4239,7 +4261,7 @@ function ia({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
4239
4261
|
flexWrap: "wrap",
|
|
4240
4262
|
gap: 4
|
|
4241
4263
|
},
|
|
4242
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
4264
|
+
children: s.map((e, t) => /* @__PURE__ */ b(P, {
|
|
4243
4265
|
tone: "slate",
|
|
4244
4266
|
children: e
|
|
4245
4267
|
}, t))
|
|
@@ -4264,7 +4286,7 @@ function ia({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
4264
4286
|
flexWrap: "wrap",
|
|
4265
4287
|
gap: 4
|
|
4266
4288
|
},
|
|
4267
|
-
children: s.map((e, t) => /* @__PURE__ */ b(
|
|
4289
|
+
children: s.map((e, t) => /* @__PURE__ */ b(P, {
|
|
4268
4290
|
tone: "slate",
|
|
4269
4291
|
onRemove: () => d(t),
|
|
4270
4292
|
children: e
|
|
@@ -4276,7 +4298,7 @@ function ia({ field: e, fieldName: n, value: r, mode: i, onChange: a, fieldId: o
|
|
|
4276
4298
|
},
|
|
4277
4299
|
children: [/* @__PURE__ */ b("div", {
|
|
4278
4300
|
style: { flex: 1 },
|
|
4279
|
-
children: /* @__PURE__ */ b(
|
|
4301
|
+
children: /* @__PURE__ */ b(F, {
|
|
4280
4302
|
id: o,
|
|
4281
4303
|
name: n,
|
|
4282
4304
|
"aria-required": e.required || void 0,
|
|
@@ -4351,21 +4373,21 @@ var Q = class extends Error {
|
|
|
4351
4373
|
}
|
|
4352
4374
|
};
|
|
4353
4375
|
async function ha(e) {
|
|
4354
|
-
let t =
|
|
4376
|
+
let t = Ot();
|
|
4355
4377
|
try {
|
|
4356
|
-
return await ga(e, t ? await
|
|
4378
|
+
return await ga(e, t ? await Pt() : null);
|
|
4357
4379
|
} catch (n) {
|
|
4358
4380
|
if (!(n instanceof Q && n.status === 401 && (n.code === "TOKEN_REFRESH_NEEDED" || n.code === "UNAUTHORIZED"))) throw n;
|
|
4359
4381
|
let r = null;
|
|
4360
4382
|
try {
|
|
4361
|
-
t ? (
|
|
4383
|
+
t ? (Nt(), r = await Pt()) : await bn();
|
|
4362
4384
|
} catch {
|
|
4363
|
-
throw
|
|
4385
|
+
throw Sn()(), n;
|
|
4364
4386
|
}
|
|
4365
4387
|
try {
|
|
4366
4388
|
return await ga(e, r);
|
|
4367
4389
|
} catch (e) {
|
|
4368
|
-
throw e instanceof Q && e.status === 401 &&
|
|
4390
|
+
throw e instanceof Q && e.status === 401 && Sn()(), e;
|
|
4369
4391
|
}
|
|
4370
4392
|
}
|
|
4371
4393
|
}
|
|
@@ -4445,7 +4467,7 @@ function Ca(e) {
|
|
|
4445
4467
|
return typeof e == "boolean" ? e : void 0;
|
|
4446
4468
|
}
|
|
4447
4469
|
async function wa(e) {
|
|
4448
|
-
await
|
|
4470
|
+
await Y("files.discard", { file_id: e });
|
|
4449
4471
|
}
|
|
4450
4472
|
function Ta(e, t, n) {
|
|
4451
4473
|
if (n && e.size > n) return {
|
|
@@ -4564,7 +4586,7 @@ function Ma(e) {
|
|
|
4564
4586
|
let e = i + t.length;
|
|
4565
4587
|
r.focus(), r.setSelectionRange(e, e);
|
|
4566
4588
|
});
|
|
4567
|
-
},
|
|
4589
|
+
}, N = async (e) => {
|
|
4568
4590
|
if (!r || !n.files) return;
|
|
4569
4591
|
let t = Array.from(e);
|
|
4570
4592
|
if (t.length === 0) return;
|
|
@@ -4616,7 +4638,7 @@ function Ma(e) {
|
|
|
4616
4638
|
color: "var(--text-4)"
|
|
4617
4639
|
},
|
|
4618
4640
|
children: "—"
|
|
4619
|
-
}) : l ? /* @__PURE__ */ b(
|
|
4641
|
+
}) : l ? /* @__PURE__ */ b(F, {
|
|
4620
4642
|
id: u,
|
|
4621
4643
|
name: i,
|
|
4622
4644
|
"aria-required": n.required || void 0,
|
|
@@ -4640,7 +4662,7 @@ function Ma(e) {
|
|
|
4640
4662
|
/* @__PURE__ */ b(D, {
|
|
4641
4663
|
kind: "ghost",
|
|
4642
4664
|
size: "xs",
|
|
4643
|
-
icon: b(v > 0 ?
|
|
4665
|
+
icon: b(v > 0 ? xe : t.plus, { size: 12 }),
|
|
4644
4666
|
onClick: () => h.current?.click(),
|
|
4645
4667
|
disabled: !r || !n.files || v > 0,
|
|
4646
4668
|
children: v > 0 ? "Uploading…" : "Insert file"
|
|
@@ -4668,7 +4690,7 @@ function Ma(e) {
|
|
|
4668
4690
|
accept: A?.join(","),
|
|
4669
4691
|
multiple: !0,
|
|
4670
4692
|
onChange: (e) => {
|
|
4671
|
-
e.target.files &&
|
|
4693
|
+
e.target.files && N(e.target.files), e.target.value = "";
|
|
4672
4694
|
}
|
|
4673
4695
|
}),
|
|
4674
4696
|
/* @__PURE__ */ b("textarea", {
|
|
@@ -4680,11 +4702,11 @@ function Ma(e) {
|
|
|
4680
4702
|
onChange: (e) => M(e.target.value),
|
|
4681
4703
|
onPaste: (e) => {
|
|
4682
4704
|
let t = Array.from(e.clipboardData.files ?? []).filter((e) => e.size > 0);
|
|
4683
|
-
t.length !== 0 && (e.preventDefault(),
|
|
4705
|
+
t.length !== 0 && (e.preventDefault(), N(t));
|
|
4684
4706
|
},
|
|
4685
4707
|
onDrop: (e) => {
|
|
4686
4708
|
let t = Array.from(e.dataTransfer.files ?? []).filter((e) => e.size > 0);
|
|
4687
|
-
t.length !== 0 && (e.preventDefault(),
|
|
4709
|
+
t.length !== 0 && (e.preventDefault(), N(t));
|
|
4688
4710
|
},
|
|
4689
4711
|
onDragOver: (e) => e.preventDefault(),
|
|
4690
4712
|
rows: 12,
|
|
@@ -4755,7 +4777,7 @@ function Pa(e, t) {
|
|
|
4755
4777
|
}
|
|
4756
4778
|
//#endregion
|
|
4757
4779
|
//#region src/components/fields/cells/factories/text.ts
|
|
4758
|
-
var Fa = () => (e) => e == null || e === "" ? "—" :
|
|
4780
|
+
var Fa = () => (e) => e == null || e === "" ? "—" : R(e), Ia = (e) => {
|
|
4759
4781
|
let { field: t, fieldName: n, locale: r = "en" } = e, i = La(t, n, r);
|
|
4760
4782
|
return (e) => {
|
|
4761
4783
|
if (e == null) return "—";
|
|
@@ -4769,10 +4791,10 @@ var Fa = () => (e) => e == null || e === "" ? "—" : I(e), Ia = (e) => {
|
|
|
4769
4791
|
};
|
|
4770
4792
|
function La(e, t, n) {
|
|
4771
4793
|
if (e.display?.bool_labels) return {
|
|
4772
|
-
trueLabel:
|
|
4773
|
-
falseLabel:
|
|
4794
|
+
trueLabel: z(e.display.bool_labels.true, n) || "Yes",
|
|
4795
|
+
falseLabel: z(e.display.bool_labels.false, n) || "No"
|
|
4774
4796
|
};
|
|
4775
|
-
let r = e.display?.name ?
|
|
4797
|
+
let r = e.display?.name ? z(e.display.name, n) : "";
|
|
4776
4798
|
if (r.startsWith("Is ")) {
|
|
4777
4799
|
let e = r.slice(3).trim();
|
|
4778
4800
|
return {
|
|
@@ -4828,10 +4850,10 @@ var Va = (e) => {
|
|
|
4828
4850
|
let { field: t, locale: n = "en" } = e, r = /* @__PURE__ */ new Map();
|
|
4829
4851
|
if (t.values) for (let e of t.values) r.set(e.code, {
|
|
4830
4852
|
tone: Ba(e.color),
|
|
4831
|
-
label:
|
|
4853
|
+
label: z(e.name, n) || e.code
|
|
4832
4854
|
});
|
|
4833
4855
|
if (t.display?.value_map) for (let [e, i] of Object.entries(t.display.value_map)) {
|
|
4834
|
-
let t = r.get(e), a = i.color ? Ba(i.color) : t?.tone ?? "slate", o = (i.label ?
|
|
4856
|
+
let t = r.get(e), a = i.color ? Ba(i.color) : t?.tone ?? "slate", o = (i.label ? z(i.label, n) : "") || t?.label || e;
|
|
4835
4857
|
r.set(e, {
|
|
4836
4858
|
tone: a,
|
|
4837
4859
|
label: o
|
|
@@ -4839,7 +4861,7 @@ var Va = (e) => {
|
|
|
4839
4861
|
}
|
|
4840
4862
|
return (e) => {
|
|
4841
4863
|
if (e == null || e === "") return "—";
|
|
4842
|
-
let t =
|
|
4864
|
+
let t = R(e), n = r.get(t);
|
|
4843
4865
|
return /* @__PURE__ */ b(k, {
|
|
4844
4866
|
tone: n?.tone ?? "slate",
|
|
4845
4867
|
size: "xs",
|
|
@@ -4863,11 +4885,11 @@ var Wa = (e) => {
|
|
|
4863
4885
|
let { entity: t, locale: n = "en" } = e, r = /* @__PURE__ */ new Map();
|
|
4864
4886
|
if (t?.status_groups) for (let e of Object.values(t.status_groups)) for (let t of e.statuses) r.set(t.code, {
|
|
4865
4887
|
tone: Ua(t.color),
|
|
4866
|
-
label:
|
|
4888
|
+
label: z(t.name, n) || t.code
|
|
4867
4889
|
});
|
|
4868
4890
|
return (e) => {
|
|
4869
4891
|
if (e == null || e === "") return "—";
|
|
4870
|
-
let t =
|
|
4892
|
+
let t = R(e), n = r.get(t);
|
|
4871
4893
|
return /* @__PURE__ */ b(k, {
|
|
4872
4894
|
tone: n?.tone ?? "slate",
|
|
4873
4895
|
size: "xs",
|
|
@@ -4890,7 +4912,7 @@ function Ka(e) {
|
|
|
4890
4912
|
var qa = (e) => {
|
|
4891
4913
|
let { field: t, locale: n = "en" } = e, r = /* @__PURE__ */ new Map();
|
|
4892
4914
|
if (t.display?.value_map) for (let [e, i] of Object.entries(t.display.value_map)) r.set(e, {
|
|
4893
|
-
label: i.label &&
|
|
4915
|
+
label: i.label && z(i.label, n) || e,
|
|
4894
4916
|
tone: Ka(i.color)
|
|
4895
4917
|
});
|
|
4896
4918
|
return (e) => !Array.isArray(e) || e.length === 0 ? "—" : /* @__PURE__ */ b("span", {
|
|
@@ -4905,25 +4927,28 @@ var qa = (e) => {
|
|
|
4905
4927
|
tone: i.tone,
|
|
4906
4928
|
size: "xs",
|
|
4907
4929
|
children: i.label
|
|
4908
|
-
}, `${n}-${t}`) : /* @__PURE__ */ b(
|
|
4930
|
+
}, `${n}-${t}`) : /* @__PURE__ */ b(P, { children: i?.label ?? n }, `${n}-${t}`);
|
|
4909
4931
|
})
|
|
4910
4932
|
});
|
|
4911
4933
|
}, Ja = () => (e) => {
|
|
4912
4934
|
if (e == null || e === "") return "—";
|
|
4913
|
-
let { text: t, absolute: n } =
|
|
4935
|
+
let { text: t, absolute: n } = He(typeof e == "string" ? e : R(e));
|
|
4914
4936
|
return /* @__PURE__ */ b("span", {
|
|
4915
4937
|
title: n,
|
|
4916
4938
|
children: t
|
|
4917
4939
|
});
|
|
4918
|
-
}, Ya = () => (e) => e == null || e === "" ? "—" :
|
|
4940
|
+
}, Ya = () => (e) => e == null || e === "" ? "—" : Ve(typeof e == "string" ? e : R(e)), Xa = 6e4, Za = 3e5, Qa = () => (e) => {
|
|
4919
4941
|
if (e == null || e === "") return "—";
|
|
4920
|
-
let t = typeof e == "string" ? e :
|
|
4942
|
+
let t = typeof e == "string" ? e : R(e), n = new Date(t);
|
|
4921
4943
|
if (isNaN(n.getTime())) return t;
|
|
4922
|
-
let r =
|
|
4923
|
-
if (i <= 0)
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4944
|
+
let r = Ve(t), i = Date.now() - n.getTime();
|
|
4945
|
+
if (i <= 0) {
|
|
4946
|
+
let e = C(n, /* @__PURE__ */ new Date(), { addSuffix: !1 });
|
|
4947
|
+
return /* @__PURE__ */ x("span", {
|
|
4948
|
+
title: r,
|
|
4949
|
+
children: ["in ", e]
|
|
4950
|
+
});
|
|
4951
|
+
}
|
|
4927
4952
|
if (i <= Xa) return /* @__PURE__ */ b("span", {
|
|
4928
4953
|
title: r,
|
|
4929
4954
|
children: /* @__PURE__ */ b(k, {
|
|
@@ -4946,7 +4971,7 @@ var qa = (e) => {
|
|
|
4946
4971
|
return (e, t = {}) => {
|
|
4947
4972
|
if (e == null || e === "") return "—";
|
|
4948
4973
|
let c = typeof e == "number" ? e : Number(e);
|
|
4949
|
-
if (!Number.isFinite(c)) return
|
|
4974
|
+
if (!Number.isFinite(c)) return R(e);
|
|
4950
4975
|
let l = i ? t[i] : void 0, u = typeof l == "string" && l !== "" ? l : r, d = `${n}:${u}:${a}:${o}`, f = s.get(d);
|
|
4951
4976
|
return f || (f = new Intl.NumberFormat(n, {
|
|
4952
4977
|
style: "currency",
|
|
@@ -4975,7 +5000,7 @@ var no = (e) => {
|
|
|
4975
5000
|
let { field: t, entities: r, screens: i, refs: a, surface: o } = e, s = t.ref?.entity, c = s ? r?.[s] : void 0, l = typeof a == "function" ? a : () => a, u = o === "detail", d = c?.display?.icon, f = t.display?.ref_display_field || "$display", p = c?.detail_screen, m = (p ? i?.[p] : void 0)?.route;
|
|
4976
5001
|
return (e, t) => {
|
|
4977
5002
|
if (e == null || e === "") return "—";
|
|
4978
|
-
let r =
|
|
5003
|
+
let r = R(e), i = ro(r, s, l(), f), a = m ? m.replace(":id", encodeURIComponent(r)) : void 0;
|
|
4979
5004
|
if (u) {
|
|
4980
5005
|
let e = /* @__PURE__ */ x(y, { children: [d && /* @__PURE__ */ b("span", {
|
|
4981
5006
|
style: {
|
|
@@ -5019,7 +5044,7 @@ var no = (e) => {
|
|
|
5019
5044
|
};
|
|
5020
5045
|
function ro(e, t, n, r) {
|
|
5021
5046
|
let i = t && n ? n[t]?.[e] : void 0;
|
|
5022
|
-
return i ?
|
|
5047
|
+
return i ? Ge(i, r, e) : e;
|
|
5023
5048
|
}
|
|
5024
5049
|
//#endregion
|
|
5025
5050
|
//#region src/components/fields/cells/factories/url-helpers.ts
|
|
@@ -5227,7 +5252,7 @@ var $ = /* @__PURE__ */ b("span", {
|
|
|
5227
5252
|
}, Oo = { fontSize: 12.5 }, ko = (e) => {
|
|
5228
5253
|
let n = e.field.display?.favicon_source ?? "google";
|
|
5229
5254
|
return (e) => {
|
|
5230
|
-
let r = e == null ? "" :
|
|
5255
|
+
let r = e == null ? "" : R(e);
|
|
5231
5256
|
if (!r) return $;
|
|
5232
5257
|
let i = co(r);
|
|
5233
5258
|
if (i == null || !fo(i)) return /* @__PURE__ */ b("span", {
|
|
@@ -5257,7 +5282,7 @@ var $ = /* @__PURE__ */ b("span", {
|
|
|
5257
5282
|
color: "var(--accent)",
|
|
5258
5283
|
textDecoration: "none"
|
|
5259
5284
|
}, jo = () => (e) => {
|
|
5260
|
-
let t = e == null ? "" :
|
|
5285
|
+
let t = e == null ? "" : R(e);
|
|
5261
5286
|
return t ? /* @__PURE__ */ b("a", {
|
|
5262
5287
|
href: `mailto:${t}`,
|
|
5263
5288
|
className: "mono",
|
|
@@ -5269,17 +5294,19 @@ var $ = /* @__PURE__ */ b("span", {
|
|
|
5269
5294
|
color: "var(--accent)",
|
|
5270
5295
|
textDecoration: "none"
|
|
5271
5296
|
}, No = { fontSize: 12.5 }, Po = /^[+()\-.\s\d]+$/, Fo = () => (e) => {
|
|
5272
|
-
let t = e == null ? "" :
|
|
5297
|
+
let t = e == null ? "" : R(e);
|
|
5273
5298
|
if (!t) return $;
|
|
5274
5299
|
let n = t.trim();
|
|
5275
|
-
|
|
5276
|
-
|
|
5300
|
+
if (!Po.test(n)) return /* @__PURE__ */ b("span", {
|
|
5301
|
+
style: No,
|
|
5302
|
+
children: t
|
|
5303
|
+
});
|
|
5304
|
+
let r = n.replace(/\s+/g, "");
|
|
5305
|
+
return /* @__PURE__ */ b("a", {
|
|
5306
|
+
href: `tel:${r}`,
|
|
5277
5307
|
className: "mono",
|
|
5278
5308
|
style: Mo,
|
|
5279
5309
|
children: t
|
|
5280
|
-
}) : /* @__PURE__ */ b("span", {
|
|
5281
|
-
style: No,
|
|
5282
|
-
children: t
|
|
5283
5310
|
});
|
|
5284
5311
|
}, Io = {
|
|
5285
5312
|
fontSize: 12.5,
|
|
@@ -5325,7 +5352,7 @@ var Bo = (e) => {
|
|
|
5325
5352
|
}, Vo = { fontSize: 12.5 }, Ho = () => (e) => e == null || e === "" ? $ : /* @__PURE__ */ b("code", {
|
|
5326
5353
|
className: "mono",
|
|
5327
5354
|
style: Vo,
|
|
5328
|
-
children:
|
|
5355
|
+
children: R(e)
|
|
5329
5356
|
}), Uo = {
|
|
5330
5357
|
display: "inline-flex",
|
|
5331
5358
|
alignItems: "center",
|
|
@@ -5334,7 +5361,7 @@ var Bo = (e) => {
|
|
|
5334
5361
|
color: "var(--accent)",
|
|
5335
5362
|
textDecoration: "none"
|
|
5336
5363
|
}, Wo = { fontSize: 12.5 }, Go = () => (e) => {
|
|
5337
|
-
let n = e == null ? "" :
|
|
5364
|
+
let n = e == null ? "" : R(e);
|
|
5338
5365
|
if (!n) return $;
|
|
5339
5366
|
let r = co(n);
|
|
5340
5367
|
return r == null || !fo(r) ? /* @__PURE__ */ b("span", {
|
|
@@ -5360,7 +5387,7 @@ function Xo(e, t, n, r = 0) {
|
|
|
5360
5387
|
if (e == null || e === "") return "";
|
|
5361
5388
|
if (typeof e == "string") return Yo(e, t);
|
|
5362
5389
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
5363
|
-
if (typeof e != "object") return Yo(
|
|
5390
|
+
if (typeof e != "object") return Yo(R(e), t);
|
|
5364
5391
|
if (n.has(e)) return "[Circular]";
|
|
5365
5392
|
if (r >= 3) return Array.isArray(e) ? "[...]" : "{...}";
|
|
5366
5393
|
n.add(e);
|
|
@@ -5488,14 +5515,14 @@ function ts(e) {
|
|
|
5488
5515
|
var ns = (e) => {
|
|
5489
5516
|
let t = e.surface === "list";
|
|
5490
5517
|
return (e) => {
|
|
5491
|
-
let n = e == null ? "" :
|
|
5518
|
+
let n = e == null ? "" : R(e);
|
|
5492
5519
|
if (!n) return $;
|
|
5493
5520
|
if (!t) return ts(n);
|
|
5494
5521
|
let { text: r, isPlain: i } = es(n);
|
|
5495
5522
|
return i ? /* @__PURE__ */ b("span", {
|
|
5496
5523
|
title: r,
|
|
5497
5524
|
children: r
|
|
5498
|
-
}) : /* @__PURE__ */ b(
|
|
5525
|
+
}) : /* @__PURE__ */ b(oe, {
|
|
5499
5526
|
content: ts(n),
|
|
5500
5527
|
children: /* @__PURE__ */ b("span", {
|
|
5501
5528
|
title: r,
|
|
@@ -5536,7 +5563,7 @@ var cs = (e) => {
|
|
|
5536
5563
|
return s ? /* @__PURE__ */ b("span", {
|
|
5537
5564
|
title: o,
|
|
5538
5565
|
children: o
|
|
5539
|
-
}) : /* @__PURE__ */ b(
|
|
5566
|
+
}) : /* @__PURE__ */ b(oe, {
|
|
5540
5567
|
content: ss(a.markdown, a.files),
|
|
5541
5568
|
children: /* @__PURE__ */ b("span", {
|
|
5542
5569
|
title: o,
|
|
@@ -5672,7 +5699,7 @@ function vs() {
|
|
|
5672
5699
|
if (e) return e.split("-")[0] || void 0;
|
|
5673
5700
|
}
|
|
5674
5701
|
function ys() {
|
|
5675
|
-
let e =
|
|
5702
|
+
let e = Jn((e) => e.user), { data: t } = X(), n = e?.language;
|
|
5676
5703
|
if (n && n.trim()) return n;
|
|
5677
5704
|
let r = t?.languages?.[0]?.code;
|
|
5678
5705
|
return r && r.trim() ? r : vs() || _s;
|
|
@@ -5691,10 +5718,10 @@ function Cs(e) {
|
|
|
5691
5718
|
function ws(e, t) {
|
|
5692
5719
|
if (!e) return "";
|
|
5693
5720
|
if (t) try {
|
|
5694
|
-
return
|
|
5721
|
+
return it(t, tt(t, e));
|
|
5695
5722
|
} catch {}
|
|
5696
5723
|
let n = e.id;
|
|
5697
|
-
return typeof n == "string" ? n : n == null ? "" :
|
|
5724
|
+
return typeof n == "string" ? n : n == null ? "" : R(n);
|
|
5698
5725
|
}
|
|
5699
5726
|
function Ts(e, t) {
|
|
5700
5727
|
if (!e || e.length === 0) return !0;
|
|
@@ -5710,10 +5737,10 @@ function Ts(e, t) {
|
|
|
5710
5737
|
function Es(e, t) {
|
|
5711
5738
|
let n = Ds(t, e.field), r = e.op || "eq";
|
|
5712
5739
|
if (r === "in" || r === "not_in") {
|
|
5713
|
-
let t = Array.isArray(e.value) ? e.value : [e.value], i =
|
|
5740
|
+
let t = Array.isArray(e.value) ? e.value : [e.value], i = R(n), a = t.some((e) => R(e) === i);
|
|
5714
5741
|
return r === "in" ? a : !a;
|
|
5715
5742
|
}
|
|
5716
|
-
return typeof e.value == "boolean" && r === "eq" ? ks(n) === e.value : typeof n == "number" && typeof e.value == "number" ? As(n, e.value, r) : As(
|
|
5743
|
+
return typeof e.value == "boolean" && r === "eq" ? ks(n) === e.value : typeof n == "number" && typeof e.value == "number" ? As(n, e.value, r) : As(R(n), R(e.value), r);
|
|
5717
5744
|
}
|
|
5718
5745
|
function Ds(e, t) {
|
|
5719
5746
|
if (Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
@@ -5777,7 +5804,7 @@ function Ms(e, t, n, r) {
|
|
|
5777
5804
|
function Ns(e, t) {
|
|
5778
5805
|
return e.filter(({ code: e }) => {
|
|
5779
5806
|
let n = bs[e];
|
|
5780
|
-
return !n ||
|
|
5807
|
+
return !n || $e(t, n);
|
|
5781
5808
|
});
|
|
5782
5809
|
}
|
|
5783
5810
|
var Ps = {
|
|
@@ -5788,14 +5815,14 @@ function Fs(e) {
|
|
|
5788
5815
|
return !!e?.confirmation && Object.keys(e.confirmation).length > 0;
|
|
5789
5816
|
}
|
|
5790
5817
|
function Is(e, t) {
|
|
5791
|
-
return Fs(e) ?
|
|
5818
|
+
return Fs(e) ? z(e.confirmation, t) : e?.destructive ? z(Ps, t) : null;
|
|
5792
5819
|
}
|
|
5793
5820
|
function Ls(e) {
|
|
5794
5821
|
return Fs(e) || !!e?.destructive;
|
|
5795
5822
|
}
|
|
5796
5823
|
function Rs(e, t, n, r) {
|
|
5797
5824
|
if (n && r) return r;
|
|
5798
|
-
let i =
|
|
5825
|
+
let i = z(e?.display?.description);
|
|
5799
5826
|
return i ? e?.display?.icon_only === !0 ? `${t} - ${i}` : i : t;
|
|
5800
5827
|
}
|
|
5801
5828
|
function zs(e) {
|
|
@@ -5812,45 +5839,46 @@ function Bs(e, t) {
|
|
|
5812
5839
|
}
|
|
5813
5840
|
}
|
|
5814
5841
|
}
|
|
5815
|
-
function Vs(e, t, n, r, i) {
|
|
5816
|
-
let
|
|
5817
|
-
for (let
|
|
5818
|
-
let e = Hs(
|
|
5819
|
-
e !== null &&
|
|
5842
|
+
function Vs(e, t, n, r, i, a) {
|
|
5843
|
+
let o = [];
|
|
5844
|
+
for (let s of e) {
|
|
5845
|
+
let e = Hs(s, t, n, r, i, a);
|
|
5846
|
+
e !== null && o.push(e);
|
|
5820
5847
|
}
|
|
5821
|
-
return
|
|
5848
|
+
return o;
|
|
5822
5849
|
}
|
|
5823
|
-
function Hs(e, t, n, r, i) {
|
|
5824
|
-
return e.kind === "group" ? Us(e, t, n, r, i) : Ws(e, t, n, r, i);
|
|
5850
|
+
function Hs(e, t, n, r, i, a) {
|
|
5851
|
+
return e.kind === "group" ? Us(e, t, n, r, i, a) : Ws(e, t, n, r, i, a);
|
|
5825
5852
|
}
|
|
5826
|
-
function Us(e, t, n, r, i) {
|
|
5827
|
-
let
|
|
5828
|
-
for (let
|
|
5829
|
-
let e = Hs(
|
|
5830
|
-
e !== null &&
|
|
5853
|
+
function Us(e, t, n, r, i, a) {
|
|
5854
|
+
let o = [];
|
|
5855
|
+
for (let s of e.items) {
|
|
5856
|
+
let e = Hs(s, t, n, r, i, a);
|
|
5857
|
+
e !== null && o.push(e);
|
|
5831
5858
|
}
|
|
5832
|
-
return
|
|
5859
|
+
return o.length === 0 ? null : {
|
|
5833
5860
|
...e,
|
|
5834
|
-
items:
|
|
5861
|
+
items: o
|
|
5835
5862
|
};
|
|
5836
5863
|
}
|
|
5837
|
-
function Ws(e, t, n, r, i) {
|
|
5838
|
-
|
|
5839
|
-
|
|
5864
|
+
function Ws(e, t, n, r, i, a) {
|
|
5865
|
+
if (a && !e.code.startsWith("__") && !a.has(e.code)) return null;
|
|
5866
|
+
let o = qs(e.code, t, n);
|
|
5867
|
+
if (!o) return null;
|
|
5840
5868
|
if (i.length > 0) {
|
|
5841
|
-
let t = Gs(
|
|
5869
|
+
let t = Gs(o, i);
|
|
5842
5870
|
return t.visible ? {
|
|
5843
5871
|
...e,
|
|
5844
5872
|
enabled: t.enabled,
|
|
5845
5873
|
reason: t.reason
|
|
5846
5874
|
} : null;
|
|
5847
5875
|
}
|
|
5848
|
-
if (!Ts(
|
|
5849
|
-
let { enabled:
|
|
5876
|
+
if (!Ts(o.conditions, r) || !Ts(Js(o.visible_if), r)) return null;
|
|
5877
|
+
let { enabled: s, reason: c } = Ks(o, r);
|
|
5850
5878
|
return {
|
|
5851
5879
|
...e,
|
|
5852
|
-
enabled:
|
|
5853
|
-
reason:
|
|
5880
|
+
enabled: s,
|
|
5881
|
+
reason: c
|
|
5854
5882
|
};
|
|
5855
5883
|
}
|
|
5856
5884
|
function Gs(e, t) {
|
|
@@ -5918,7 +5946,7 @@ function Xs(e, t, n, r, i) {
|
|
|
5918
5946
|
continue;
|
|
5919
5947
|
}
|
|
5920
5948
|
let e = qs(o.code, t, n);
|
|
5921
|
-
e && e.visibility?.includes(r) && (i?.bulkRequired
|
|
5949
|
+
e && e.visibility?.includes(r) && (i?.bulkRequired === void 0 || (i.bulkRequiredPredicate ? i.bulkRequiredPredicate(e) : !1) === i.bulkRequired) && (i?.excludeIf && i.excludeIf(e) || a.push(o));
|
|
5922
5950
|
}
|
|
5923
5951
|
return a;
|
|
5924
5952
|
}
|
|
@@ -6021,13 +6049,13 @@ function yc(e, t) {
|
|
|
6021
6049
|
}
|
|
6022
6050
|
return e.replace(gc, (e, n) => {
|
|
6023
6051
|
let r = bc(n, t);
|
|
6024
|
-
return r === vc ? e :
|
|
6052
|
+
return r === vc ? e : R(r);
|
|
6025
6053
|
});
|
|
6026
6054
|
}
|
|
6027
6055
|
function bc(e, t) {
|
|
6028
6056
|
if (e.startsWith("now")) {
|
|
6029
6057
|
let t = hc(e);
|
|
6030
|
-
return t === null ? vc :
|
|
6058
|
+
return t === null ? vc : ze(new Date(Date.now() + t));
|
|
6031
6059
|
}
|
|
6032
6060
|
let [n, ...r] = e.split(".");
|
|
6033
6061
|
if (n === "row") return !t.row || r.length === 0 ? vc : xc(t.row, r);
|
|
@@ -6079,7 +6107,7 @@ function wc(e, t) {
|
|
|
6079
6107
|
return typeof e == "string" ? yc(e, t) : e;
|
|
6080
6108
|
}
|
|
6081
6109
|
function Tc(e, t) {
|
|
6082
|
-
return
|
|
6110
|
+
return R(yc(e, t));
|
|
6083
6111
|
}
|
|
6084
6112
|
function Ec(e) {
|
|
6085
6113
|
let t = e.indexOf(".");
|
|
@@ -6104,8 +6132,8 @@ function Oc(e) {
|
|
|
6104
6132
|
return n;
|
|
6105
6133
|
}
|
|
6106
6134
|
function kc(e, t) {
|
|
6107
|
-
if (!e ||
|
|
6108
|
-
let n = Array.isArray(t) ? t : Oc(t), r = n.length > 0 ? new Set(n) : null, i =
|
|
6135
|
+
if (!e || !$e(e, "update")) return [];
|
|
6136
|
+
let n = Array.isArray(t) ? t : Oc(t), r = n.length > 0 ? new Set(n) : null, i = dt(e), a = new Set(B(e)), o = r ? n : Ac(e, i, a), s = [];
|
|
6109
6137
|
for (let t of o) {
|
|
6110
6138
|
if (r && !r.has(t)) continue;
|
|
6111
6139
|
let n = jc(e, t, i, a);
|
|
@@ -6156,7 +6184,7 @@ function jc(e, t, n, r) {
|
|
|
6156
6184
|
};
|
|
6157
6185
|
}
|
|
6158
6186
|
function Mc(e, t) {
|
|
6159
|
-
return e &&
|
|
6187
|
+
return e && z(e) || t;
|
|
6160
6188
|
}
|
|
6161
6189
|
//#endregion
|
|
6162
6190
|
//#region src/components/mass-edit/PropertyGridEditor.tsx
|
|
@@ -6255,11 +6283,11 @@ function Ic({ row: e, onChange: t }) {
|
|
|
6255
6283
|
if (n.kind === "status" && n.statusGroup) {
|
|
6256
6284
|
let e = n.statusGroup.statuses.map((e) => ({
|
|
6257
6285
|
value: e.code,
|
|
6258
|
-
label:
|
|
6286
|
+
label: z(e.name) || e.code
|
|
6259
6287
|
}));
|
|
6260
6288
|
return /* @__PURE__ */ b("div", {
|
|
6261
6289
|
"data-testid": `value-${n.code}`,
|
|
6262
|
-
children: /* @__PURE__ */ b(
|
|
6290
|
+
children: /* @__PURE__ */ b(I, {
|
|
6263
6291
|
value: typeof o == "string" ? o : "",
|
|
6264
6292
|
options: e,
|
|
6265
6293
|
onChange: t,
|
|
@@ -6313,7 +6341,7 @@ function Rc({ targets: e, onPick: n }) {
|
|
|
6313
6341
|
alignSelf: "flex-start",
|
|
6314
6342
|
minWidth: 220
|
|
6315
6343
|
},
|
|
6316
|
-
children: /* @__PURE__ */ b(
|
|
6344
|
+
children: /* @__PURE__ */ b(I, {
|
|
6317
6345
|
value: "",
|
|
6318
6346
|
placeholder: "Select target...",
|
|
6319
6347
|
options: e.map((e) => ({
|
|
@@ -6375,13 +6403,13 @@ function Hc(e) {
|
|
|
6375
6403
|
enum: e.enum,
|
|
6376
6404
|
values: e.values,
|
|
6377
6405
|
structure: e.structure,
|
|
6378
|
-
ref:
|
|
6406
|
+
ref: Xe(e.ref)
|
|
6379
6407
|
};
|
|
6380
6408
|
}
|
|
6381
6409
|
function Uc(e, t) {
|
|
6382
6410
|
if (!e.includes("${")) return e;
|
|
6383
6411
|
let n = yc(e, { params: t });
|
|
6384
|
-
return n == null ? "" :
|
|
6412
|
+
return n == null ? "" : R(n);
|
|
6385
6413
|
}
|
|
6386
6414
|
var Wc = /\$\{\s*([^}]+?)\s*\}/g;
|
|
6387
6415
|
function Gc(e, t) {
|
|
@@ -6397,10 +6425,10 @@ function Kc({ param: e, value: t, onChange: n, statusGroups: r }) {
|
|
|
6397
6425
|
label: e.required ? "Select status group…" : "—"
|
|
6398
6426
|
}, ...t.map(([e, t]) => ({
|
|
6399
6427
|
value: e,
|
|
6400
|
-
label:
|
|
6428
|
+
label: z(t.name) || e
|
|
6401
6429
|
}))];
|
|
6402
6430
|
}, [r, e.required]);
|
|
6403
|
-
return /* @__PURE__ */ b(
|
|
6431
|
+
return /* @__PURE__ */ b(I, {
|
|
6404
6432
|
value: typeof t == "string" ? t : "",
|
|
6405
6433
|
options: i,
|
|
6406
6434
|
onChange: (e) => n(e),
|
|
@@ -6425,9 +6453,9 @@ function qc({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
|
6425
6453
|
label: a.length === 0 ? "Select status group first" : "Select status…"
|
|
6426
6454
|
}, ...a.map((e) => ({
|
|
6427
6455
|
value: e.code,
|
|
6428
|
-
label:
|
|
6456
|
+
label: z(e.name) || e.code
|
|
6429
6457
|
}))], [a]);
|
|
6430
|
-
return /* @__PURE__ */ b(
|
|
6458
|
+
return /* @__PURE__ */ b(I, {
|
|
6431
6459
|
value: typeof t == "string" ? t : "",
|
|
6432
6460
|
options: o,
|
|
6433
6461
|
onChange: (e) => n(e),
|
|
@@ -6435,7 +6463,7 @@ function qc({ param: e, value: t, onChange: n, statusGroups: r, formData: i }) {
|
|
|
6435
6463
|
});
|
|
6436
6464
|
}
|
|
6437
6465
|
function Jc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, isPending: o, row: c, bulkSelection: u }) {
|
|
6438
|
-
let { data: m } =
|
|
6466
|
+
let { data: m } = X(), h = ys(), g = r.resolved_params, _ = r.resolved_hidden_defaults ?? {}, v = !!r.destructive, S = Is(r, h), C = s(() => {
|
|
6439
6467
|
o || n(!1);
|
|
6440
6468
|
}, [o, n]), w = f(null);
|
|
6441
6469
|
l(() => {
|
|
@@ -6450,11 +6478,11 @@ function Jc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6450
6478
|
for (let [e, t] of k.fields) if (t.primary) return e;
|
|
6451
6479
|
return k.primary_key?.[0];
|
|
6452
6480
|
}
|
|
6453
|
-
}, [k]),
|
|
6481
|
+
}, [k]), j = s(() => {
|
|
6454
6482
|
let e = { ..._ };
|
|
6455
6483
|
for (let [t, n] of T) {
|
|
6456
6484
|
if (n.type === "id_array") {
|
|
6457
|
-
u && A ?
|
|
6485
|
+
e[t] = u && A ? u.map((e) => e[A]).filter((e) => e != null) : [];
|
|
6458
6486
|
continue;
|
|
6459
6487
|
}
|
|
6460
6488
|
if (n.type === "entity_patch") {
|
|
@@ -6474,8 +6502,8 @@ function Jc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6474
6502
|
c,
|
|
6475
6503
|
u,
|
|
6476
6504
|
A
|
|
6477
|
-
])
|
|
6478
|
-
|
|
6505
|
+
]), [M, ee] = p(j), N = s((e, t) => {
|
|
6506
|
+
ee((n) => {
|
|
6479
6507
|
let r = {
|
|
6480
6508
|
...n,
|
|
6481
6509
|
[e]: t
|
|
@@ -6489,15 +6517,15 @@ function Jc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6489
6517
|
return r;
|
|
6490
6518
|
});
|
|
6491
6519
|
}, [g]), te = s(() => {
|
|
6492
|
-
let e = { ...
|
|
6520
|
+
let e = { ...M };
|
|
6493
6521
|
for (let [t, n] of T) {
|
|
6494
|
-
let r =
|
|
6522
|
+
let r = M[t], i = r == null || r === "";
|
|
6495
6523
|
if (n.required && i) return;
|
|
6496
6524
|
i && delete e[t];
|
|
6497
6525
|
}
|
|
6498
6526
|
a(e);
|
|
6499
6527
|
}, [
|
|
6500
|
-
|
|
6528
|
+
M,
|
|
6501
6529
|
T,
|
|
6502
6530
|
a
|
|
6503
6531
|
]);
|
|
@@ -6581,7 +6609,7 @@ function Jc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6581
6609
|
color: "var(--text-3)",
|
|
6582
6610
|
marginTop: 2
|
|
6583
6611
|
},
|
|
6584
|
-
children:
|
|
6612
|
+
children: z(r.display?.description) || (T.length > 0 ? "Fill in the parameters below to execute this action." : "")
|
|
6585
6613
|
})]
|
|
6586
6614
|
}),
|
|
6587
6615
|
/* @__PURE__ */ b(O, {
|
|
@@ -6625,7 +6653,7 @@ function Jc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6625
6653
|
opacity: o ? .6 : 1
|
|
6626
6654
|
},
|
|
6627
6655
|
children: T.map(([e, t]) => {
|
|
6628
|
-
let n =
|
|
6656
|
+
let n = z(t.display?.name) || e;
|
|
6629
6657
|
if (t.type === "id_array") return null;
|
|
6630
6658
|
let r;
|
|
6631
6659
|
if (t.type === "entity_patch") {
|
|
@@ -6634,33 +6662,33 @@ function Jc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6634
6662
|
entity: k,
|
|
6635
6663
|
filterTargets: n,
|
|
6636
6664
|
selectedRows: u,
|
|
6637
|
-
value:
|
|
6638
|
-
onChange: (t) =>
|
|
6665
|
+
value: M[e] ?? {},
|
|
6666
|
+
onChange: (t) => N(e, t)
|
|
6639
6667
|
});
|
|
6640
6668
|
} else r = t.type === "status_group" ? /* @__PURE__ */ b(Kc, {
|
|
6641
6669
|
param: t,
|
|
6642
|
-
value:
|
|
6643
|
-
onChange: (t) =>
|
|
6670
|
+
value: M[e],
|
|
6671
|
+
onChange: (t) => N(e, t),
|
|
6644
6672
|
statusGroups: E,
|
|
6645
|
-
formData:
|
|
6673
|
+
formData: M
|
|
6646
6674
|
}) : t.type === "status" ? /* @__PURE__ */ b(qc, {
|
|
6647
6675
|
param: t,
|
|
6648
|
-
value:
|
|
6649
|
-
onChange: (t) =>
|
|
6676
|
+
value: M[e],
|
|
6677
|
+
onChange: (t) => N(e, t),
|
|
6650
6678
|
statusGroups: E,
|
|
6651
|
-
formData:
|
|
6679
|
+
formData: M
|
|
6652
6680
|
}) : gs({
|
|
6653
6681
|
field: Hc(t),
|
|
6654
6682
|
fieldName: e,
|
|
6655
|
-
value:
|
|
6683
|
+
value: M[e],
|
|
6656
6684
|
mode: "edit",
|
|
6657
|
-
onChange: (t) =>
|
|
6685
|
+
onChange: (t) => N(e, t),
|
|
6658
6686
|
locale: h
|
|
6659
6687
|
});
|
|
6660
6688
|
return /* @__PURE__ */ x("div", {
|
|
6661
6689
|
style: { minWidth: 0 },
|
|
6662
6690
|
children: [
|
|
6663
|
-
/* @__PURE__ */ b(
|
|
6691
|
+
/* @__PURE__ */ b(Se, {
|
|
6664
6692
|
required: t.required,
|
|
6665
6693
|
children: n
|
|
6666
6694
|
}),
|
|
@@ -6672,7 +6700,7 @@ function Jc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6672
6700
|
marginTop: 4,
|
|
6673
6701
|
marginBottom: 0
|
|
6674
6702
|
},
|
|
6675
|
-
children:
|
|
6703
|
+
children: z(t.display.description)
|
|
6676
6704
|
})
|
|
6677
6705
|
]
|
|
6678
6706
|
}, e);
|
|
@@ -6701,7 +6729,7 @@ function Jc({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
|
|
|
6701
6729
|
/* @__PURE__ */ b(D, {
|
|
6702
6730
|
kind: "primary",
|
|
6703
6731
|
danger: v,
|
|
6704
|
-
icon: b(o ?
|
|
6732
|
+
icon: b(o ? xe : v ? t.trash : t.bolt, { size: 13 }),
|
|
6705
6733
|
onClick: te,
|
|
6706
6734
|
disabled: o,
|
|
6707
6735
|
children: o ? "Executing…" : T.length > 0 ? "Execute" : "Confirm"
|
|
@@ -7021,7 +7049,7 @@ function el(e) {
|
|
|
7021
7049
|
!t || typeof t != "object" || "impersonation_session_id" in t && window.location.assign("/");
|
|
7022
7050
|
}
|
|
7023
7051
|
function tl(e) {
|
|
7024
|
-
if (e instanceof
|
|
7052
|
+
if (e instanceof ir) {
|
|
7025
7053
|
let t = e.response.errors ?? [];
|
|
7026
7054
|
if (t.length === 1) return {
|
|
7027
7055
|
kind: "error",
|
|
@@ -7033,7 +7061,7 @@ function tl(e) {
|
|
|
7033
7061
|
detail: n ? `${t.length} failed · ${n}` : `${t.length} failed`
|
|
7034
7062
|
};
|
|
7035
7063
|
}
|
|
7036
|
-
return e instanceof
|
|
7064
|
+
return e instanceof V ? {
|
|
7037
7065
|
kind: "error",
|
|
7038
7066
|
detail: e.message
|
|
7039
7067
|
} : {
|
|
@@ -7053,7 +7081,7 @@ function il(e) {
|
|
|
7053
7081
|
return t;
|
|
7054
7082
|
}
|
|
7055
7083
|
function al({ children: e }) {
|
|
7056
|
-
let t =
|
|
7084
|
+
let t = Lr(), { data: n } = X(), [r, i] = p(null), [a, o] = p(0), [c, l] = p(null), u = s((e) => {
|
|
7057
7085
|
if (e?.progress_screen) return n?.screens[e.progress_screen]?.route;
|
|
7058
7086
|
}, [n?.screens]), f = s((e, n, r, i, a) => {
|
|
7059
7087
|
let o = () => {
|
|
@@ -7103,7 +7131,7 @@ function al({ children: e }) {
|
|
|
7103
7131
|
let r = Qc(n);
|
|
7104
7132
|
r && l(r), el(n);
|
|
7105
7133
|
}, [m]), g = s((e) => {
|
|
7106
|
-
let t = e.action, n = e.longRunning ?? t?.long_running ?? !1, r = e.title ||
|
|
7134
|
+
let t = e.action, n = e.longRunning ?? t?.long_running ?? !1, r = e.title || z(t?.display?.name) || "Action", a = async (i) => {
|
|
7107
7135
|
o((e) => e + 1);
|
|
7108
7136
|
try {
|
|
7109
7137
|
let a = await e.execute(i), o = Zc(a);
|
|
@@ -7189,7 +7217,7 @@ function sl(e) {
|
|
|
7189
7217
|
//#region src/hooks/useCurrentScreen.tsx
|
|
7190
7218
|
var cl = i(void 0);
|
|
7191
7219
|
function ll({ code: e, children: t }) {
|
|
7192
|
-
let { data: n } =
|
|
7220
|
+
let { data: n } = X(), r = d(() => ({
|
|
7193
7221
|
code: e,
|
|
7194
7222
|
screen: n?.screens[e]
|
|
7195
7223
|
}), [e, n]);
|
|
@@ -7202,4 +7230,4 @@ function ul() {
|
|
|
7202
7230
|
return c(cl);
|
|
7203
7231
|
}
|
|
7204
7232
|
//#endregion
|
|
7205
|
-
export { oi as $,
|
|
7233
|
+
export { oi as $, ye as $n, Pt as $t, ys as A, Qe as An, X as At, Ta as B, Se as Bn, In as Bt, Bs as C, We as Cn, Xn as Ct, Zs as D, ot as Dn, fr as Dt, Cs as E, nt as En, cr as Et, Aa as F, Ve as Fn, Kn as Ft, Ii as G, Ie as Gn, J as Gt, fa as H, Oe as Hn, Un as Ht, Q as I, ze as In, Wn as It, Ai as J, we as Jn, Sn as Jt, Pi as K, I as Kn, Y as Kt, wa as L, R as Ln, Gn as Lt, ms as M, Ge as Mn, qn as Mt, ka as N, Je as Nn, Fn as Nt, ws as O, it as On, dr as Ot, ja as P, at as Pn, Rn as Pt, si as Q, be as Qn, Wt as Qt, Da as R, L as Rn, Hn as Rt, Ns as S, Ye as Sn, Zn as St, zs as T, z as Tn, nr as Tt, da as U, Ne as Un, Bn as Ut, sa as V, Fe as Vn, Ln as Vt, oa as W, Re as Wn, K as Wt, ji as X, Le as Xn, Bt as Xt, Mi as Y, F as Yn, xn as Yt, ui as Z, xe as Zn, Ut as Zt, Vs as _, ut as _n, Qn as _t, Nc as a, St as an, oe as ar, zr as at, Ts as b, $e as bn, pr as bt, kc as c, bt as cn, k as cr, Pr as ct, Dc as d, pt as dn, Ar as dt, Nt as en, le as er, ii as et, rc as f, ft as fn, Dr as ft, Rs as g, lt as gn, or as gt, Qs as h, ct as hn, ir as ht, rl as i, Mt as in, P as ir, Lr as it, gs as j, st as jn, Jn as jt, Os as k, rt as kn, $n as kt, Oc as l, yt as ln, O as lr, jr as lt, xs as m, Ue as mn, yr as mt, ul as n, Dt as nn, fe as nr, ei as nt, Pc as o, Ct as on, j as or, Rr as ot, Ss as p, mt as pn, Or as pt, Ni as q, Pe as qn, bn as qt, al as r, Ot as rn, ve as rr, Z as rt, zc as s, wt as sn, A as sr, Ir as st, ll as t, kt as tn, _e as tr, ri as tt, Sc as u, V as un, D as ur, kr as ut, tc as v, Ze as vn, er as vt, Ms as w, B as wn, mr as wt, Xs as x, tt as xn, rr as xt, ec as y, et as yn, tr as yt, ha as z, ke as zn, zn as zt };
|