@foris/avocado-not-front 4.6.0 → 4.6.1
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.
|
@@ -627,13 +627,13 @@ const P = (e) => {
|
|
|
627
627
|
i
|
|
628
628
|
), f = O(t, s, n), g = c ? O(t, s, c) : void 0, y = l ? O(t, s, l) : void 0, x = R(
|
|
629
629
|
async (b) => {
|
|
630
|
-
var
|
|
630
|
+
var j;
|
|
631
631
|
try {
|
|
632
|
-
const
|
|
633
|
-
h(
|
|
632
|
+
const N = b.target.checked;
|
|
633
|
+
h(N);
|
|
634
634
|
const C = {
|
|
635
|
-
...(
|
|
636
|
-
[r]:
|
|
635
|
+
...(j = v.getState()[t]) == null ? void 0 : j.entries,
|
|
636
|
+
[r]: N
|
|
637
637
|
};
|
|
638
638
|
if (q(t, C), d.actionType === "GO_TO_NEXT_UI") {
|
|
639
639
|
const w = await a(
|
|
@@ -644,8 +644,8 @@ const P = (e) => {
|
|
|
644
644
|
);
|
|
645
645
|
w != null && w.data && $(t, w == null ? void 0 : w.data);
|
|
646
646
|
}
|
|
647
|
-
} catch (
|
|
648
|
-
console.error("Error in accordion checkbox action:",
|
|
647
|
+
} catch (N) {
|
|
648
|
+
console.error("Error in accordion checkbox action:", N), alert(JSON.stringify(N));
|
|
649
649
|
}
|
|
650
650
|
},
|
|
651
651
|
[t, s, r, d.actionType, a]
|
|
@@ -655,9 +655,9 @@ const P = (e) => {
|
|
|
655
655
|
disabled: m,
|
|
656
656
|
checkboxChecked: u,
|
|
657
657
|
onChanceCheckbox: d.hasCheckbox ? x : void 0,
|
|
658
|
-
actionContent: g ? /* @__PURE__ */ o.jsx(o.Fragment, { children: g.map((b,
|
|
659
|
-
customContent: y ? /* @__PURE__ */ o.jsx(o.Fragment, { children: y.map((b,
|
|
660
|
-
children: f ? /* @__PURE__ */ o.jsx("section", { className: qe.accordionBody, children: f.map((b,
|
|
658
|
+
actionContent: g ? /* @__PURE__ */ o.jsx(o.Fragment, { children: g.map((b, j) => /* @__PURE__ */ o.jsx(k, { children: b }, `accordion-action-${j}`)) }) : void 0,
|
|
659
|
+
customContent: y ? /* @__PURE__ */ o.jsx(o.Fragment, { children: y.map((b, j) => /* @__PURE__ */ o.jsx(k, { children: b }, `accordion-custom-${j}`)) }) : void 0,
|
|
660
|
+
children: f ? /* @__PURE__ */ o.jsx("section", { className: qe.accordionBody, children: f.map((b, j) => /* @__PURE__ */ o.jsx(k, { children: b }, `accordion-child-${j}`)) }) : void 0
|
|
661
661
|
};
|
|
662
662
|
return /* @__PURE__ */ o.jsx(ot, { ...p });
|
|
663
663
|
}, wn = (e) => {
|
|
@@ -728,10 +728,10 @@ const P = (e) => {
|
|
|
728
728
|
body: n == null ? void 0 : n.data
|
|
729
729
|
}, p = (b) => {
|
|
730
730
|
f(b);
|
|
731
|
-
const
|
|
731
|
+
const j = {
|
|
732
732
|
[s]: b
|
|
733
733
|
};
|
|
734
|
-
q(t,
|
|
734
|
+
q(t, j);
|
|
735
735
|
};
|
|
736
736
|
return z(() => {
|
|
737
737
|
r !== void 0 && r !== _ && f(r);
|
|
@@ -866,30 +866,30 @@ const F = /* @__PURE__ */ dn(In), Bn = "_fieldset_1xrth_1", Kn = "_fieldsetColum
|
|
|
866
866
|
d
|
|
867
867
|
), g = v(
|
|
868
868
|
(b) => {
|
|
869
|
-
var
|
|
870
|
-
return (
|
|
869
|
+
var j, N;
|
|
870
|
+
return (N = (j = b[t]) == null ? void 0 : j.entries) == null ? void 0 : N[r];
|
|
871
871
|
}
|
|
872
872
|
), y = g != null ? String(g) : l ?? "", x = f, m = A(() => i ? c ? `${i} *` : i : null, [i, c]), p = R(
|
|
873
873
|
async (b) => {
|
|
874
|
-
var
|
|
874
|
+
var j;
|
|
875
875
|
if (!x)
|
|
876
876
|
try {
|
|
877
|
-
const
|
|
878
|
-
...(
|
|
877
|
+
const N = {
|
|
878
|
+
...(j = v.getState()[t]) == null ? void 0 : j.entries,
|
|
879
879
|
[r]: b
|
|
880
880
|
};
|
|
881
|
-
if (q(t,
|
|
881
|
+
if (q(t, N), n === "GO_TO_NEXT_UI" || n === "GO_TO_NEXT_UI_WITHOUT_LOADING") {
|
|
882
882
|
const E = await _(
|
|
883
883
|
t,
|
|
884
884
|
s,
|
|
885
|
-
|
|
885
|
+
N,
|
|
886
886
|
r,
|
|
887
887
|
n === "GO_TO_NEXT_UI"
|
|
888
888
|
);
|
|
889
889
|
E != null && E.data && $(t, E == null ? void 0 : E.data);
|
|
890
890
|
}
|
|
891
|
-
} catch (
|
|
892
|
-
alert(JSON.stringify(
|
|
891
|
+
} catch (N) {
|
|
892
|
+
alert(JSON.stringify(N));
|
|
893
893
|
}
|
|
894
894
|
},
|
|
895
895
|
[
|
|
@@ -1034,18 +1034,18 @@ function je(e, t) {
|
|
|
1034
1034
|
), p = (g = m == null ? void 0 : m.data) == null ? void 0 : g.content;
|
|
1035
1035
|
if ((p == null ? void 0 : p.type) !== "fetch")
|
|
1036
1036
|
break;
|
|
1037
|
-
const b = p == null ? void 0 : p.dataSource,
|
|
1037
|
+
const b = p == null ? void 0 : p.dataSource, j = await r(b, e, !1), N = {
|
|
1038
1038
|
...(y = v.getState()[e]) == null ? void 0 : y.entries,
|
|
1039
1039
|
[c]: {
|
|
1040
|
-
status:
|
|
1041
|
-
content:
|
|
1040
|
+
status: j == null ? void 0 : j.status,
|
|
1041
|
+
content: j == null ? void 0 : j.data
|
|
1042
1042
|
}
|
|
1043
1043
|
};
|
|
1044
|
-
q(e,
|
|
1044
|
+
q(e, N);
|
|
1045
1045
|
const C = await s(
|
|
1046
1046
|
e,
|
|
1047
1047
|
t,
|
|
1048
|
-
|
|
1048
|
+
N,
|
|
1049
1049
|
c
|
|
1050
1050
|
);
|
|
1051
1051
|
C != null && C.data && $(e, C == null ? void 0 : C.data);
|
|
@@ -1170,12 +1170,12 @@ const Hn = (e) => {
|
|
|
1170
1170
|
t,
|
|
1171
1171
|
s,
|
|
1172
1172
|
c && c.length > 0 ? c : null
|
|
1173
|
-
), b = p && p.length > 0 ? /* @__PURE__ */ o.jsx("div", { className: Zn.slotStack, children: p.map((
|
|
1174
|
-
var
|
|
1173
|
+
), b = p && p.length > 0 ? /* @__PURE__ */ o.jsx("div", { className: Zn.slotStack, children: p.map((N, C) => /* @__PURE__ */ o.jsx(k, { children: N }, `card-body-${i}-${C}`)) }) : null, j = R(async () => {
|
|
1174
|
+
var N, C, w;
|
|
1175
1175
|
if (!(!a || m))
|
|
1176
1176
|
try {
|
|
1177
1177
|
const E = {
|
|
1178
|
-
...(
|
|
1178
|
+
...(N = v.getState()[t]) == null ? void 0 : N.entries,
|
|
1179
1179
|
[l]: { status: 200 }
|
|
1180
1180
|
};
|
|
1181
1181
|
switch (q(t, E), a) {
|
|
@@ -1263,7 +1263,7 @@ const Hn = (e) => {
|
|
|
1263
1263
|
{
|
|
1264
1264
|
colorId: n,
|
|
1265
1265
|
disabled: m,
|
|
1266
|
-
onClick: a && !m ? () => void
|
|
1266
|
+
onClick: a && !m ? () => void j() : void 0,
|
|
1267
1267
|
children: b
|
|
1268
1268
|
}
|
|
1269
1269
|
);
|
|
@@ -1556,12 +1556,12 @@ const Hn = (e) => {
|
|
|
1556
1556
|
const { jsonPathData: m, mapperData: p } = l, b = Ne(
|
|
1557
1557
|
l,
|
|
1558
1558
|
1
|
|
1559
|
-
),
|
|
1559
|
+
), j = await d(
|
|
1560
1560
|
b,
|
|
1561
1561
|
s,
|
|
1562
1562
|
!1
|
|
1563
|
-
),
|
|
1564
|
-
_(
|
|
1563
|
+
), N = m ? (y = Ye(j == null ? void 0 : j.data, m, p)) == null ? void 0 : y.items : (x = j == null ? void 0 : j.data) == null ? void 0 : x.data;
|
|
1564
|
+
_(N), u(!1);
|
|
1565
1565
|
} catch (m) {
|
|
1566
1566
|
alert(JSON.stringify(m)), u(!1);
|
|
1567
1567
|
}
|
|
@@ -1595,17 +1595,17 @@ const Hn = (e) => {
|
|
|
1595
1595
|
try {
|
|
1596
1596
|
const b = !_;
|
|
1597
1597
|
f(b);
|
|
1598
|
-
const
|
|
1598
|
+
const j = {
|
|
1599
1599
|
...(p = v.getState()[t]) == null ? void 0 : p.entries,
|
|
1600
1600
|
[r]: b
|
|
1601
1601
|
};
|
|
1602
|
-
switch (q(t,
|
|
1602
|
+
switch (q(t, j), i) {
|
|
1603
1603
|
case "GO_TO_NEXT_UI":
|
|
1604
1604
|
case "GO_TO_NEXT_UI_WITHOUT_LOADING": {
|
|
1605
1605
|
const C = await h(
|
|
1606
1606
|
t,
|
|
1607
1607
|
s,
|
|
1608
|
-
|
|
1608
|
+
j,
|
|
1609
1609
|
r,
|
|
1610
1610
|
i === "GO_TO_NEXT_UI"
|
|
1611
1611
|
);
|
|
@@ -1651,7 +1651,7 @@ const Hn = (e) => {
|
|
|
1651
1651
|
disabled: a,
|
|
1652
1652
|
showPreview: u,
|
|
1653
1653
|
height: h = "400px"
|
|
1654
|
-
} = e, [_, f] = L(c ?? ""), g = ne.useThemeStore((
|
|
1654
|
+
} = e, [_, f] = L(c ?? ""), g = ne.useThemeStore((j) => j.theme.mode), { disabled: y } = I(
|
|
1655
1655
|
t,
|
|
1656
1656
|
d
|
|
1657
1657
|
), x = a ?? y, m = {
|
|
@@ -1659,12 +1659,12 @@ const Hn = (e) => {
|
|
|
1659
1659
|
markdown: Zt(),
|
|
1660
1660
|
sql: Ft(),
|
|
1661
1661
|
yaml: Pt()
|
|
1662
|
-
}, p = A(() => n && r ? `${r} *` : r ?? "", [r, n]), b = (
|
|
1663
|
-
f(
|
|
1664
|
-
const
|
|
1665
|
-
[s]:
|
|
1662
|
+
}, p = A(() => n && r ? `${r} *` : r ?? "", [r, n]), b = (j) => {
|
|
1663
|
+
f(j);
|
|
1664
|
+
const N = {
|
|
1665
|
+
[s]: j
|
|
1666
1666
|
};
|
|
1667
|
-
q(t,
|
|
1667
|
+
q(t, N);
|
|
1668
1668
|
};
|
|
1669
1669
|
return /* @__PURE__ */ o.jsxs("div", { className: Z.codeEditor, children: [
|
|
1670
1670
|
p && p !== "" && /* @__PURE__ */ o.jsx("label", { className: Z.codeEditor_label, children: p }),
|
|
@@ -1677,7 +1677,7 @@ const Hn = (e) => {
|
|
|
1677
1677
|
height: h,
|
|
1678
1678
|
placeholder: l,
|
|
1679
1679
|
extensions: [m[i] ?? ve()],
|
|
1680
|
-
onChange: (
|
|
1680
|
+
onChange: (j) => b(j),
|
|
1681
1681
|
theme: g,
|
|
1682
1682
|
editable: !x
|
|
1683
1683
|
}
|
|
@@ -1834,8 +1834,8 @@ const Hn = (e) => {
|
|
|
1834
1834
|
t,
|
|
1835
1835
|
d
|
|
1836
1836
|
), g = i && h ? (() => {
|
|
1837
|
-
const { href: m, target: p, download: b, ...
|
|
1838
|
-
return
|
|
1837
|
+
const { href: m, target: p, download: b, ...j } = h;
|
|
1838
|
+
return j;
|
|
1839
1839
|
})() : h, y = R(async () => {
|
|
1840
1840
|
var m;
|
|
1841
1841
|
if (i)
|
|
@@ -2283,8 +2283,8 @@ const zs = /\{([^}]+)\}/g, Vs = (e, t) => {
|
|
|
2283
2283
|
e,
|
|
2284
2284
|
c
|
|
2285
2285
|
), y = (a == null ? void 0 : a.disabled) ?? g, x = A(() => r && (a != null && a.label) ? `${a == null ? void 0 : a.label} *` : (a == null ? void 0 : a.label) ?? "", [a == null ? void 0 : a.label, r]), m = A(() => {
|
|
2286
|
-
const
|
|
2287
|
-
return Array.isArray(
|
|
2286
|
+
const N = a != null && a.isMulti ? _ : [_], C = {};
|
|
2287
|
+
return Array.isArray(N) && N.forEach((w) => {
|
|
2288
2288
|
if (!w) return;
|
|
2289
2289
|
const E = JSON.stringify(w.value), S = JSON.stringify(w.label);
|
|
2290
2290
|
C[E] = w, S in C || (C[S] = w);
|
|
@@ -2297,9 +2297,9 @@ const zs = /\{([^}]+)\}/g, Vs = (e, t) => {
|
|
|
2297
2297
|
getNextUI: u,
|
|
2298
2298
|
isMulti: a == null ? void 0 : a.isMulti,
|
|
2299
2299
|
debounceMs: n
|
|
2300
|
-
}), b = (
|
|
2301
|
-
f(
|
|
2302
|
-
},
|
|
2300
|
+
}), b = (N) => {
|
|
2301
|
+
f(N), p(N);
|
|
2302
|
+
}, j = async (N, C, { page: w }) => {
|
|
2303
2303
|
const {
|
|
2304
2304
|
jsonPathLabel: E,
|
|
2305
2305
|
jsonPathOptions: S,
|
|
@@ -2308,7 +2308,7 @@ const zs = /\{([^}]+)\}/g, Vs = (e, t) => {
|
|
|
2308
2308
|
} = i, U = Ne(
|
|
2309
2309
|
i,
|
|
2310
2310
|
w,
|
|
2311
|
-
|
|
2311
|
+
N
|
|
2312
2312
|
), J = await h(
|
|
2313
2313
|
U,
|
|
2314
2314
|
e,
|
|
@@ -2327,7 +2327,7 @@ const zs = /\{([^}]+)\}/g, Vs = (e, t) => {
|
|
|
2327
2327
|
options: ae,
|
|
2328
2328
|
hasMore: tt,
|
|
2329
2329
|
additional: {
|
|
2330
|
-
page:
|
|
2330
|
+
page: w + 1
|
|
2331
2331
|
}
|
|
2332
2332
|
};
|
|
2333
2333
|
};
|
|
@@ -2340,11 +2340,11 @@ const zs = /\{([^}]+)\}/g, Vs = (e, t) => {
|
|
|
2340
2340
|
value: _,
|
|
2341
2341
|
disabled: y,
|
|
2342
2342
|
noOptionsMessage: () => /* @__PURE__ */ o.jsx(o.Fragment, { children: "Sin opciones" }),
|
|
2343
|
-
onChange: (
|
|
2344
|
-
loadOptions:
|
|
2343
|
+
onChange: (N) => !y && b(N),
|
|
2344
|
+
loadOptions: j,
|
|
2345
2345
|
additional: { page: 1 },
|
|
2346
|
-
isOptionDisabled: (
|
|
2347
|
-
const C = JSON.stringify(
|
|
2346
|
+
isOptionDisabled: (N) => {
|
|
2347
|
+
const C = JSON.stringify(N == null ? void 0 : N.value), w = JSON.stringify(N == null ? void 0 : N.label);
|
|
2348
2348
|
return !!(m != null && m[C]) || !!(m != null && m[w]);
|
|
2349
2349
|
},
|
|
2350
2350
|
debounceTimeout: 350
|
|
@@ -2425,17 +2425,17 @@ const zs = /\{([^}]+)\}/g, Vs = (e, t) => {
|
|
|
2425
2425
|
try {
|
|
2426
2426
|
const b = !_;
|
|
2427
2427
|
f(b);
|
|
2428
|
-
const
|
|
2428
|
+
const j = {
|
|
2429
2429
|
...(p = v.getState()[t]) == null ? void 0 : p.entries,
|
|
2430
2430
|
[r]: b
|
|
2431
2431
|
};
|
|
2432
|
-
switch (q(t,
|
|
2432
|
+
switch (q(t, j), i) {
|
|
2433
2433
|
case "GO_TO_NEXT_UI":
|
|
2434
2434
|
case "GO_TO_NEXT_UI_WITHOUT_LOADING": {
|
|
2435
2435
|
const C = await h(
|
|
2436
2436
|
t,
|
|
2437
2437
|
s,
|
|
2438
|
-
|
|
2438
|
+
j,
|
|
2439
2439
|
r,
|
|
2440
2440
|
i === "GO_TO_NEXT_UI"
|
|
2441
2441
|
);
|
|
@@ -2524,16 +2524,16 @@ const zs = /\{([^}]+)\}/g, Vs = (e, t) => {
|
|
|
2524
2524
|
h
|
|
2525
2525
|
), b = (y = p == null ? void 0 : p.data) == null ? void 0 : y.content;
|
|
2526
2526
|
if ((b == null ? void 0 : b.type) !== "fetch") break;
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2527
|
+
const j = b == null ? void 0 : b.dataSource, N = await n(
|
|
2528
|
+
j,
|
|
2529
2529
|
e,
|
|
2530
2530
|
// Avoid to handle loading state until all the requests are done
|
|
2531
2531
|
!1
|
|
2532
2532
|
), C = {
|
|
2533
2533
|
...(x = v.getState()[e]) == null ? void 0 : x.entries,
|
|
2534
2534
|
[h]: {
|
|
2535
|
-
status:
|
|
2536
|
-
content:
|
|
2535
|
+
status: N == null ? void 0 : N.status,
|
|
2536
|
+
content: N == null ? void 0 : N.data
|
|
2537
2537
|
}
|
|
2538
2538
|
};
|
|
2539
2539
|
q(e, C);
|
|
@@ -2574,7 +2574,7 @@ const zs = /\{([^}]+)\}/g, Vs = (e, t) => {
|
|
|
2574
2574
|
rightActions: l,
|
|
2575
2575
|
...c
|
|
2576
2576
|
}) => {
|
|
2577
|
-
var
|
|
2577
|
+
var j, N, C;
|
|
2578
2578
|
const { fetchDataSource: n } = K(), [d, a] = L(!1), [u, h] = L(1), [_, f] = L(null), g = Me(
|
|
2579
2579
|
/* @__PURE__ */ new Map([[1, null]])
|
|
2580
2580
|
), y = A(() => {
|
|
@@ -2657,9 +2657,9 @@ const zs = /\{([^}]+)\}/g, Vs = (e, t) => {
|
|
|
2657
2657
|
columns: p,
|
|
2658
2658
|
rightActions: y
|
|
2659
2659
|
};
|
|
2660
|
-
return /* @__PURE__ */ o.jsx(o.Fragment, { children: d ? /* @__PURE__ */ o.jsx(ua, {}) : _ && ((
|
|
2660
|
+
return /* @__PURE__ */ o.jsx(o.Fragment, { children: d ? /* @__PURE__ */ o.jsx(ua, {}) : _ && ((j = _ == null ? void 0 : _.items) == null ? void 0 : j.length) > 0 ? /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
2661
2661
|
/* @__PURE__ */ o.jsx(St, { ...b }),
|
|
2662
|
-
(_ == null ? void 0 : _.pagination) && ((
|
|
2662
|
+
(_ == null ? void 0 : _.pagination) && ((N = _ == null ? void 0 : _.pagination) == null ? void 0 : N.totalPages) > 1 && /* @__PURE__ */ o.jsx(
|
|
2663
2663
|
Et,
|
|
2664
2664
|
{
|
|
2665
2665
|
classname: { global: "row__end" },
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Te;function it(){if(Te)return P;Te=1;var e=b,t=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(n,d,a){var u,h={},_=null,f=null;a!==void 0&&(_=""+a),d.key!==void 0&&(_=""+d.key),d.ref!==void 0&&(f=d.ref);for(u in d)o.call(d,u)&&!i.hasOwnProperty(u)&&(h[u]=d[u]);if(n&&n.defaultProps)for(u in d=n.defaultProps,d)h[u]===void 0&&(h[u]=d[u]);return{$$typeof:t,type:n,key:_,ref:f,props:h,_owner:l.current}}return P.Fragment=s,P.jsx=c,P.jsxs=c,P}var Oe;function dt(){return Oe||(Oe=1,_e.exports=it()),_e.exports}var r=dt();const Se=e=>{if(!(e!=null&&e.content))return null;const t={...e,children:e.content,type:e.variant};return r.jsx(k.Heading,{...t})},ve=e=>{if(!e)return null;const t={...e,children:e.content};return r.jsx(k.Text,{...t})},A=(e,t,s,o)=>{var c;const l={accordion:n=>r.jsx(yt,{...n,userFlow:e,pageId:t}),aiChatPanel:n=>r.jsx(gt,{...n,userFlow:e,pageId:t,onResolveProps:o==null?void 0:o.aiChatPanel}),aiSummaryCard:n=>r.jsx(jt,{...n,userFlow:e,pageId:t,onResolveProps:o==null?void 0:o.aiSummaryCard}),aiPromptCodeEditor:n=>r.jsx(bt,{...n,userFlow:e,pageId:t}),box:n=>r.jsx(Nt,{...n,userFlow:e,pageId:t}),breadcrumbs:n=>r.jsx(St,{...n,userFlow:e,pageId:t}),tooltip:n=>r.jsx(wn,{...n,userFlow:e,pageId:t}),textarea:n=>r.jsx(bn,{...n,userFlow:e,pageId:t}),card:n=>r.jsx(Dt,{...n,userFlow:e,pageId:t}),dropdownButton:n=>r.jsx(Xt,{...n,userFlow:e,pageId:t}),menu:n=>r.jsx(Qt,{...n,userFlow:e,pageId:t}),radioGroup:n=>r.jsx(Tt,{...n,userFlow:e,pageId:t}),stepper:n=>r.jsx(Ot,{...n,userFlow:e,pageId:t}),button:n=>r.jsx(vt,{...n,userFlow:e,pageId:t}),cardAccordion:n=>r.jsx(At,{...n,userFlow:e,pageId:t}),cardNotification:n=>r.jsx(Lt,{...n}),chart:n=>r.jsx(Ke,{...n,userFlow:e}),dataCard:n=>r.jsx(zt,{...n,userFlow:e,pageId:t}),checkbox:n=>r.jsx(Kt,{...n,userFlow:e,pageId:t}),code:n=>r.jsx(Ut,{...n,userFlow:e,pageId:t}),divider:n=>r.jsx(Vt,{...n}),drawer:n=>r.jsx(Jt,{...n,userFlow:e,pageId:t}),heading:n=>Se(n),link:n=>r.jsx(Wt,{...n,userFlow:e,pageId:t}),pill:n=>r.jsx(Pt,{...n}),previewerMarkdown:n=>r.jsx(en,{...n}),modal:n=>r.jsx(Zt,{...n,userFlow:e,pageId:t}),roundButton:n=>r.jsx(tn,{...n,userFlow:e,pageId:t}),row:n=>r.jsx(qe,{...n,userFlow:e,pageId:t}),select:n=>r.jsx(ln,{...n,userFlow:e,pageId:t}),switch:n=>r.jsx(_n,{...n,userFlow:e,pageId:t}),spacing:n=>r.jsx(dn,{...n,userFlow:e,pageId:t}),table:n=>r.jsx(mn,{...n,userFlow:e,pageId:t}),tabs:n=>r.jsx(xn,{...n,userFlow:e,pageId:t}),text:n=>ve(n),textField:n=>r.jsx(jn,{...n,userFlow:e,pageId:t}),toast:n=>r.jsx(Cn,{...n,userFlow:e,pageId:t})};return(c=s==null?void 0:s.filter(Boolean))==null?void 0:c.map(n=>{const d=l[n.component];return d?d({...n,userFlow:e,pageId:t}):null})};function _t(e){return!!(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}function Ae(e,t){if(!(t!=null&&t.length))return!1;for(const s of t)if(s.when==="empty"){const o=e==null?void 0:e[s.key];if(_t(o))return!0}return!1}function B(e,t){const s=T(o=>{var l;return(l=o[e])==null?void 0:l.entries});return b.useMemo(()=>({disabled:Ae(s,t)}),[t,s])}const Y=e=>{if(!e)return{"content-type":"application/json"};if(typeof e=="function")return e();if(typeof e=="string")try{return JSON.parse(e)}catch{return{"content-type":"application/json",Authorization:e}}return e},ee=()=>new AbortController,ut=(e,t={},s={},o=!1,l)=>{const i=ee();o&&i.abort();const c=Y(t);return{call:z.get(e,{headers:{...c},params:s,signal:i.signal,_userFlow:l}),controller:i}},ue=(e,t={},s={},o={},l=!1,i)=>{const c=ee();l&&c.abort();const n=Y(t);return{call:z.post(e,s,{headers:{...n},params:o,signal:c.signal,_userFlow:i}),controller:c}},ht=(e,t={},s={},o={},l=!1,i)=>{const c=ee();l&&c.abort();const n=Y(t);return{call:z.put(e,s,{headers:{...n},params:o,signal:c.signal,_userFlow:i}),controller:c}},ft=(e,t={},s={},o={},l=!1,i)=>{const c=ee();l&&c.abort();const n=Y(t);return{call:z.patch(e,s,{headers:{...n},params:o,signal:c.signal,_userFlow:i}),controller:c}},mt=(e,t={},s={},o={},l=!1,i)=>{const c=ee();l&&c.abort();const n=Y(t);return{call:z.delete(e,{headers:{...n},data:s,params:o,signal:c.signal,_userFlow:i}),controller:c}},Re=()=>{let e;return{callEndpoint:async o=>{o.controller&&(e=o.controller);let l={};try{l=await o.call}catch(i){throw i}return l},cancelEndpoint:()=>{e&&e.abort()}}},De=async(e,t,s="",o={},l={})=>{try{const{callEndpoint:i}=Re(),{api:c,headers:n}=e,d=sessionStorage.getItem("sessionId"),a=new URLSearchParams({session_name:t});s&&a.append("hash_code",s),d&&a.append("sessionId",d);const u=`${c}/not-front/next-ui/?${a.toString()}`,h=Y(n),_=ue(u,h,o,l,!1,t);return await i(_)}catch(i){return console.error(i),Promise.reject(i)}},K=()=>{const e=T(n=>n),{callEndpoint:t}=Re(),s=async(n,d,a,u,h=!0)=>{var _;try{const f=(_=e[n])==null?void 0:_.apiConfig,x={state:{...a},triggerKey:u};return h&&Q(n,!0),await De(f,n,d,x)}catch(f){throw h&&Q(n,!1),console.error("[getNextUI] Error fetching next UI:",f),f}},o=(n,d)=>{const{method:a,url:u,headers:h,data:_,params:f}=n;switch(a){case"post":return ue(u,h,_,{},!1,d);case"put":return ht(u,h,_,{},!1,d);case"patch":return ft(u,h,_,{},!1,d);case"delete":return mt(u,h,_,f,!1,d);case"get":default:return ut(u,h,f,!1,d)}},l=(n,d)=>{const{url:a,headers:u}=n,h={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return ue(a,{...u,"Content-Type":"application/json"},h,{},!1,d)},i=async(n,d,a=!0)=>{var u,h;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}a&&Q(d,!0);try{let _;switch(n==null?void 0:n.type){case"rest":_=o(n,d);break;case"graphql":_=l(n,d);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await t(_)}catch(_){const f=_;return console.error("[fetchDataSource] Error:",f),{status:((u=f==null?void 0:f.response)==null?void 0:u.status)??0,data:((h=f==null?void 0:f.response)==null?void 0:h.data)??{message:f==null?void 0:f.message,code:f==null?void 0:f.code,config:f==null?void 0:f.config}}}finally{a&&Q(d,!1)}};return{getNextUI:s,fetchDataSource:i,fetchAndGetNextUI:async(n,d,a,u,h)=>{try{Q(n,!0);const _=await i(h,n,!1);return _&&await s(n,d,a,u)}catch(_){throw Q(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",_),_}}}},Le={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},yt=e=>{const{userFlow:t,pageId:s,responseKey:o,dependencies:l,customContent:i,actionContent:c,components:n,...d}=e,{getNextUI:a}=K(),[u,h]=b.useState(d.checkboxChecked||!1),{disabled:_}=B(t,l),f=A(t,s,n),x=c?A(t,s,c):void 0,y=i?A(t,s,i):void 0,g=b.useCallback(async j=>{var w;try{const C=j.target.checked;h(C);const E={...(w=T.getState()[t])==null?void 0:w.entries,[o]:C};if(M(t,E),d.actionType==="GO_TO_NEXT_UI"){const N=await a(t,s,E,o);N!=null&&N.data&&L(t,N==null?void 0:N.data)}}catch(C){console.error("Error in accordion checkbox action:",C),alert(JSON.stringify(C))}},[t,s,o,d.actionType,a]),m=d.disabled||_,p={...d,className:Le.accordion,disabled:m,checkboxChecked:u,onChanceCheckbox:d.hasCheckbox?g:void 0,actionContent:x?r.jsx(r.Fragment,{children:x.map((j,w)=>r.jsx(b.Fragment,{children:j},`accordion-action-${w}`))}):void 0,customContent:y?r.jsx(r.Fragment,{children:y.map((j,w)=>r.jsx(b.Fragment,{children:j},`accordion-custom-${w}`))}):void 0,children:f?r.jsx("section",{className:Le.accordionBody,children:f.map((j,w)=>r.jsx(b.Fragment,{children:j},`accordion-child-${w}`))}):void 0};return r.jsx(k.Accordion,{...p})},gt=e=>{const t=k.ThemeStore.useThemeStore(c=>c.theme.mode),s=e.dataSource,o=b.useMemo(()=>({url:e.dataSource.url,method:e.dataSource.method,headers:e.dataSource.headers,params:s==null?void 0:s.data}),[e.dataSource.url,e.dataSource.method,e.dataSource.headers,s==null?void 0:s.data]),l=e.locale??"en",i=b.useMemo(()=>{var n,d,a,u,h;const c={title:(n=e==null?void 0:e.translations)==null?void 0:n.title,welcomeTitle:(d=e==null?void 0:e.translations)==null?void 0:d.welcomeTitle,welcomeDescription:(a=e==null?void 0:e.translations)==null?void 0:a.welcomeDescription,placeholder:(u=e==null?void 0:e.translations)==null?void 0:u.placeholder,disclaimer:(h=e==null?void 0:e.translations)==null?void 0:h.disclaimer};return Object.fromEntries(Object.entries(c).filter(([,_])=>!!_))},[e==null?void 0:e.translations]);return b.useEffect(()=>{e.onResolveProps&&e.onResolveProps({dataSource:o,locale:l,translations:i,initialSuggestions:e.initialSuggestions,theme:t})},[e.onResolveProps,o,l,i,e.initialSuggestions,t]),e.onResolveProps?null:r.jsx(ce.ChatPanel,{dataSource:o,locale:l,translations:i,initialSuggestions:e.initialSuggestions,theme:t})},xt={promptCodeEditor:"_promptCodeEditor_1d57s_1"},bt=e=>{const{userFlow:t,responseKey:s,codeBlockValue:o,language:l,disabled:i,dependencies:c,dataSource:n,inputLabel:d,inputPlaceholder:a,codeBlockLabel:u}=e,h=k.ThemeStore.useThemeStore(j=>j.theme.mode),[_,f]=b.useState(o||""),{disabled:x}=B(t,c),y=i??x,g=l??"json",m={url:(n==null?void 0:n.url)||"",method:(n==null?void 0:n.method)||"post",headers:n==null?void 0:n.headers,body:n==null?void 0:n.data},p=j=>{f(j);const w={[s]:j};M(t,w)};return b.useEffect(()=>{o!==void 0&&o!==_&&f(o)},[o]),r.jsx("section",{className:xt.promptCodeEditor,children:r.jsx(ce.PromptCodeEditor,{themeMode:h,requestConfig:m,language:g,disabled:y,inputLabel:d,inputPlaceholder:a,codeBlockLabel:u,codeBlockValue:_,onCodeChange:p})})},pt={summaryCard:"_summaryCard_jva4h_1"},jt=e=>{const t=e.dataSource,s=b.useMemo(()=>({url:e.dataSource.url,method:e.dataSource.method,headers:e.dataSource.headers,body:t==null?void 0:t.data}),[e.dataSource.url,e.dataSource.method,e.dataSource.headers,t==null?void 0:t.data]),o=e.locale??"en",l=b.useMemo(()=>{var c,n,d;const i={title:(c=e==null?void 0:e.translations)==null?void 0:c.title,loading:(n=e==null?void 0:e.translations)==null?void 0:n.loading,noData:(d=e==null?void 0:e.translations)==null?void 0:d.noData};return Object.fromEntries(Object.entries(i).filter(([,a])=>!!a))},[e==null?void 0:e.translations]);return b.useEffect(()=>{e.onResolveProps&&e.onResolveProps({dataSource:s,locale:o,translations:l})},[e.onResolveProps,s,o,l]),e.onResolveProps?null:r.jsx("section",{className:pt.summaryCard,children:r.jsx(ce.SummaryCard,{dataSource:s,locale:o,translations:l})})},Me={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},Ct=({inputs:e})=>r.jsx("section",{className:Me.body,children:r.jsx("div",{className:Me.body_content,children:e.map((t,s)=>r.jsx(b.Fragment,{children:t},s))})}),wt={slotStack:"_slotStack_1b4wy_1"},Nt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c}=e,n=k.ThemeStore.useThemeStore(u=>u.theme.mode)==="dark",d=A(t,s,c!=null&&c.length?c:null),a=d&&d.length>0?r.jsx("div",{className:wt.slotStack,children:d.map((u,h)=>r.jsx(b.Fragment,{children:u},`box-${l}-${h}`))}):null;return r.jsx(k.Box,{darkMode:n,children:a})};var he={exports:{}};/*!
|
|
9
|
+
*/var Te;function it(){if(Te)return P;Te=1;var e=b,t=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(n,d,a){var u,h={},_=null,f=null;a!==void 0&&(_=""+a),d.key!==void 0&&(_=""+d.key),d.ref!==void 0&&(f=d.ref);for(u in d)o.call(d,u)&&!i.hasOwnProperty(u)&&(h[u]=d[u]);if(n&&n.defaultProps)for(u in d=n.defaultProps,d)h[u]===void 0&&(h[u]=d[u]);return{$$typeof:t,type:n,key:_,ref:f,props:h,_owner:l.current}}return P.Fragment=s,P.jsx=c,P.jsxs=c,P}var Oe;function dt(){return Oe||(Oe=1,_e.exports=it()),_e.exports}var r=dt();const Se=e=>{if(!(e!=null&&e.content))return null;const t={...e,children:e.content,type:e.variant};return r.jsx(k.Heading,{...t})},ve=e=>{if(!e)return null;const t={...e,children:e.content};return r.jsx(k.Text,{...t})},A=(e,t,s,o)=>{var c;const l={accordion:n=>r.jsx(yt,{...n,userFlow:e,pageId:t}),aiChatPanel:n=>r.jsx(gt,{...n,userFlow:e,pageId:t,onResolveProps:o==null?void 0:o.aiChatPanel}),aiSummaryCard:n=>r.jsx(jt,{...n,userFlow:e,pageId:t,onResolveProps:o==null?void 0:o.aiSummaryCard}),aiPromptCodeEditor:n=>r.jsx(bt,{...n,userFlow:e,pageId:t}),box:n=>r.jsx(Nt,{...n,userFlow:e,pageId:t}),breadcrumbs:n=>r.jsx(St,{...n,userFlow:e,pageId:t}),tooltip:n=>r.jsx(wn,{...n,userFlow:e,pageId:t}),textarea:n=>r.jsx(bn,{...n,userFlow:e,pageId:t}),card:n=>r.jsx(Dt,{...n,userFlow:e,pageId:t}),dropdownButton:n=>r.jsx(Xt,{...n,userFlow:e,pageId:t}),menu:n=>r.jsx(Qt,{...n,userFlow:e,pageId:t}),radioGroup:n=>r.jsx(Tt,{...n,userFlow:e,pageId:t}),stepper:n=>r.jsx(Ot,{...n,userFlow:e,pageId:t}),button:n=>r.jsx(vt,{...n,userFlow:e,pageId:t}),cardAccordion:n=>r.jsx(At,{...n,userFlow:e,pageId:t}),cardNotification:n=>r.jsx(Lt,{...n}),chart:n=>r.jsx(Ke,{...n,userFlow:e}),dataCard:n=>r.jsx(zt,{...n,userFlow:e,pageId:t}),checkbox:n=>r.jsx(Kt,{...n,userFlow:e,pageId:t}),code:n=>r.jsx(Ut,{...n,userFlow:e,pageId:t}),divider:n=>r.jsx(Vt,{...n}),drawer:n=>r.jsx(Jt,{...n,userFlow:e,pageId:t}),heading:n=>Se(n),link:n=>r.jsx(Wt,{...n,userFlow:e,pageId:t}),pill:n=>r.jsx(Pt,{...n}),previewerMarkdown:n=>r.jsx(en,{...n}),modal:n=>r.jsx(Zt,{...n,userFlow:e,pageId:t}),roundButton:n=>r.jsx(tn,{...n,userFlow:e,pageId:t}),row:n=>r.jsx(qe,{...n,userFlow:e,pageId:t}),select:n=>r.jsx(ln,{...n,userFlow:e,pageId:t}),switch:n=>r.jsx(_n,{...n,userFlow:e,pageId:t}),spacing:n=>r.jsx(dn,{...n,userFlow:e,pageId:t}),table:n=>r.jsx(mn,{...n,userFlow:e,pageId:t}),tabs:n=>r.jsx(xn,{...n,userFlow:e,pageId:t}),text:n=>ve(n),textField:n=>r.jsx(jn,{...n,userFlow:e,pageId:t}),toast:n=>r.jsx(Cn,{...n,userFlow:e,pageId:t})};return(c=s==null?void 0:s.filter(Boolean))==null?void 0:c.map(n=>{const d=l[n.component];return d?d({...n,userFlow:e,pageId:t}):null})};function _t(e){return!!(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}function Ae(e,t){if(!(t!=null&&t.length))return!1;for(const s of t)if(s.when==="empty"){const o=e==null?void 0:e[s.key];if(_t(o))return!0}return!1}function B(e,t){const s=T(o=>{var l;return(l=o[e])==null?void 0:l.entries});return b.useMemo(()=>({disabled:Ae(s,t)}),[t,s])}const Y=e=>{if(!e)return{"content-type":"application/json"};if(typeof e=="function")return e();if(typeof e=="string")try{return JSON.parse(e)}catch{return{"content-type":"application/json",Authorization:e}}return e},ee=()=>new AbortController,ut=(e,t={},s={},o=!1,l)=>{const i=ee();o&&i.abort();const c=Y(t);return{call:z.get(e,{headers:{...c},params:s,signal:i.signal,_userFlow:l}),controller:i}},ue=(e,t={},s={},o={},l=!1,i)=>{const c=ee();l&&c.abort();const n=Y(t);return{call:z.post(e,s,{headers:{...n},params:o,signal:c.signal,_userFlow:i}),controller:c}},ht=(e,t={},s={},o={},l=!1,i)=>{const c=ee();l&&c.abort();const n=Y(t);return{call:z.put(e,s,{headers:{...n},params:o,signal:c.signal,_userFlow:i}),controller:c}},ft=(e,t={},s={},o={},l=!1,i)=>{const c=ee();l&&c.abort();const n=Y(t);return{call:z.patch(e,s,{headers:{...n},params:o,signal:c.signal,_userFlow:i}),controller:c}},mt=(e,t={},s={},o={},l=!1,i)=>{const c=ee();l&&c.abort();const n=Y(t);return{call:z.delete(e,{headers:{...n},data:s,params:o,signal:c.signal,_userFlow:i}),controller:c}},Re=()=>{let e;return{callEndpoint:async o=>{o.controller&&(e=o.controller);let l={};try{l=await o.call}catch(i){throw i}return l},cancelEndpoint:()=>{e&&e.abort()}}},De=async(e,t,s="",o={},l={})=>{try{const{callEndpoint:i}=Re(),{api:c,headers:n}=e,d=sessionStorage.getItem("sessionId"),a=new URLSearchParams({session_name:t});s&&a.append("hash_code",s),d&&a.append("sessionId",d);const u=`${c}/not-front/next-ui/?${a.toString()}`,h=Y(n),_=ue(u,h,o,l,!1,t);return await i(_)}catch(i){return console.error(i),Promise.reject(i)}},K=()=>{const e=T(n=>n),{callEndpoint:t}=Re(),s=async(n,d,a,u,h=!0)=>{var _;try{const f=(_=e[n])==null?void 0:_.apiConfig,x={state:{...a},triggerKey:u};return h&&Q(n,!0),await De(f,n,d,x)}catch(f){throw h&&Q(n,!1),console.error("[getNextUI] Error fetching next UI:",f),f}},o=(n,d)=>{const{method:a,url:u,headers:h,data:_,params:f}=n;switch(a){case"post":return ue(u,h,_,{},!1,d);case"put":return ht(u,h,_,{},!1,d);case"patch":return ft(u,h,_,{},!1,d);case"delete":return mt(u,h,_,f,!1,d);case"get":default:return ut(u,h,f,!1,d)}},l=(n,d)=>{const{url:a,headers:u}=n,h={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return ue(a,{...u,"Content-Type":"application/json"},h,{},!1,d)},i=async(n,d,a=!0)=>{var u,h;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}a&&Q(d,!0);try{let _;switch(n==null?void 0:n.type){case"rest":_=o(n,d);break;case"graphql":_=l(n,d);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await t(_)}catch(_){const f=_;return console.error("[fetchDataSource] Error:",f),{status:((u=f==null?void 0:f.response)==null?void 0:u.status)??0,data:((h=f==null?void 0:f.response)==null?void 0:h.data)??{message:f==null?void 0:f.message,code:f==null?void 0:f.code,config:f==null?void 0:f.config}}}finally{a&&Q(d,!1)}};return{getNextUI:s,fetchDataSource:i,fetchAndGetNextUI:async(n,d,a,u,h)=>{try{Q(n,!0);const _=await i(h,n,!1);return _&&await s(n,d,a,u)}catch(_){throw Q(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",_),_}}}},Le={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},yt=e=>{const{userFlow:t,pageId:s,responseKey:o,dependencies:l,customContent:i,actionContent:c,components:n,...d}=e,{getNextUI:a}=K(),[u,h]=b.useState(d.checkboxChecked||!1),{disabled:_}=B(t,l),f=A(t,s,n),x=c?A(t,s,c):void 0,y=i?A(t,s,i):void 0,g=b.useCallback(async j=>{var C;try{const w=j.target.checked;h(w);const E={...(C=T.getState()[t])==null?void 0:C.entries,[o]:w};if(M(t,E),d.actionType==="GO_TO_NEXT_UI"){const N=await a(t,s,E,o);N!=null&&N.data&&L(t,N==null?void 0:N.data)}}catch(w){console.error("Error in accordion checkbox action:",w),alert(JSON.stringify(w))}},[t,s,o,d.actionType,a]),m=d.disabled||_,p={...d,className:Le.accordion,disabled:m,checkboxChecked:u,onChanceCheckbox:d.hasCheckbox?g:void 0,actionContent:x?r.jsx(r.Fragment,{children:x.map((j,C)=>r.jsx(b.Fragment,{children:j},`accordion-action-${C}`))}):void 0,customContent:y?r.jsx(r.Fragment,{children:y.map((j,C)=>r.jsx(b.Fragment,{children:j},`accordion-custom-${C}`))}):void 0,children:f?r.jsx("section",{className:Le.accordionBody,children:f.map((j,C)=>r.jsx(b.Fragment,{children:j},`accordion-child-${C}`))}):void 0};return r.jsx(k.Accordion,{...p})},gt=e=>{const t=k.ThemeStore.useThemeStore(c=>c.theme.mode),s=e.dataSource,o=b.useMemo(()=>({url:e.dataSource.url,method:e.dataSource.method,headers:e.dataSource.headers,params:s==null?void 0:s.data}),[e.dataSource.url,e.dataSource.method,e.dataSource.headers,s==null?void 0:s.data]),l=e.locale??"en",i=b.useMemo(()=>{var n,d,a,u,h;const c={title:(n=e==null?void 0:e.translations)==null?void 0:n.title,welcomeTitle:(d=e==null?void 0:e.translations)==null?void 0:d.welcomeTitle,welcomeDescription:(a=e==null?void 0:e.translations)==null?void 0:a.welcomeDescription,placeholder:(u=e==null?void 0:e.translations)==null?void 0:u.placeholder,disclaimer:(h=e==null?void 0:e.translations)==null?void 0:h.disclaimer};return Object.fromEntries(Object.entries(c).filter(([,_])=>!!_))},[e==null?void 0:e.translations]);return b.useEffect(()=>{e.onResolveProps&&e.onResolveProps({dataSource:o,locale:l,translations:i,initialSuggestions:e.initialSuggestions,theme:t})},[e.onResolveProps,o,l,i,e.initialSuggestions,t]),e.onResolveProps?null:r.jsx(ce.ChatPanel,{dataSource:o,locale:l,translations:i,initialSuggestions:e.initialSuggestions,theme:t})},xt={promptCodeEditor:"_promptCodeEditor_1d57s_1"},bt=e=>{const{userFlow:t,responseKey:s,codeBlockValue:o,language:l,disabled:i,dependencies:c,dataSource:n,inputLabel:d,inputPlaceholder:a,codeBlockLabel:u}=e,h=k.ThemeStore.useThemeStore(j=>j.theme.mode),[_,f]=b.useState(o||""),{disabled:x}=B(t,c),y=i??x,g=l??"json",m={url:(n==null?void 0:n.url)||"",method:(n==null?void 0:n.method)||"post",headers:n==null?void 0:n.headers,body:n==null?void 0:n.data},p=j=>{f(j);const C={[s]:j};M(t,C)};return b.useEffect(()=>{o!==void 0&&o!==_&&f(o)},[o]),r.jsx("section",{className:xt.promptCodeEditor,children:r.jsx(ce.PromptCodeEditor,{themeMode:h,requestConfig:m,language:g,disabled:y,inputLabel:d,inputPlaceholder:a,codeBlockLabel:u,codeBlockValue:_,onCodeChange:p})})},pt={summaryCard:"_summaryCard_jva4h_1"},jt=e=>{const t=e.dataSource,s=b.useMemo(()=>({url:e.dataSource.url,method:e.dataSource.method,headers:e.dataSource.headers,body:t==null?void 0:t.data}),[e.dataSource.url,e.dataSource.method,e.dataSource.headers,t==null?void 0:t.data]),o=e.locale??"en",l=b.useMemo(()=>{var c,n,d;const i={title:(c=e==null?void 0:e.translations)==null?void 0:c.title,loading:(n=e==null?void 0:e.translations)==null?void 0:n.loading,noData:(d=e==null?void 0:e.translations)==null?void 0:d.noData};return Object.fromEntries(Object.entries(i).filter(([,a])=>!!a))},[e==null?void 0:e.translations]);return b.useEffect(()=>{e.onResolveProps&&e.onResolveProps({dataSource:s,locale:o,translations:l})},[e.onResolveProps,s,o,l]),e.onResolveProps?null:r.jsx("section",{className:pt.summaryCard,children:r.jsx(ce.SummaryCard,{dataSource:s,locale:o,translations:l})})},Me={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},Ct=({inputs:e})=>r.jsx("section",{className:Me.body,children:r.jsx("div",{className:Me.body_content,children:e.map((t,s)=>r.jsx(b.Fragment,{children:t},s))})}),wt={slotStack:"_slotStack_1b4wy_1"},Nt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c}=e,n=k.ThemeStore.useThemeStore(u=>u.theme.mode)==="dark",d=A(t,s,c!=null&&c.length?c:null),a=d&&d.length>0?r.jsx("div",{className:wt.slotStack,children:d.map((u,h)=>r.jsx(b.Fragment,{children:u},`box-${l}-${h}`))}):null;return r.jsx(k.Box,{darkMode:n,children:a})};var he={exports:{}};/*!
|
|
10
10
|
Copyright (c) 2018 Jed Watson.
|
|
11
11
|
Licensed under the MIT License (MIT), see
|
|
12
12
|
http://jedwatson.github.io/classnames
|
|
13
|
-
*/var Ie;function kt(){return Ie||(Ie=1,(function(e){(function(){var t={}.hasOwnProperty;function s(){for(var o=[],l=0;l<arguments.length;l++){var i=arguments[l];if(i){var c=typeof i;if(c==="string"||c==="number")o.push(i);else if(Array.isArray(i)){if(i.length){var n=s.apply(null,i);n&&o.push(n)}}else if(c==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){o.push(i.toString());continue}for(var d in i)t.call(i,d)&&i[d]&&o.push(d)}}}return o.join(" ")}e.exports?(s.default=s,e.exports=s):window.classNames=s})()})(he)),he.exports}var Et=kt();const Z=lt(Et),F={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},Tt=e=>{const{userFlow:t,pageId:s,responseKey:o,label:l,value:i,required:c,actionType:n,dependencies:d,direction:a,items:u}=e,h=a==="column"?"column":"row",{getNextUI:_}=K(),{disabled:f}=B(t,d),x=T(j=>{var w,C;return(C=(w=j[t])==null?void 0:w.entries)==null?void 0:C[o]}),y=x!=null?String(x):i??"",g=f,m=b.useMemo(()=>l?c?`${l} *`:l:null,[l,c]),p=b.useCallback(async j=>{var w;if(!g)try{const C={...(w=T.getState()[t])==null?void 0:w.entries,[o]:j};if(M(t,C),n==="GO_TO_NEXT_UI"||n==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const v=await _(t,s,C,o,n==="GO_TO_NEXT_UI");v!=null&&v.data&&L(t,v==null?void 0:v.data)}}catch(C){alert(JSON.stringify(C))}},[n,_,g,s,o,t]);return r.jsxs("fieldset",{className:Z(F.fieldset,h==="column"&&F.fieldsetColumn),children:[m?r.jsx("legend",{className:F.legend,children:m}):null,r.jsx("div",{className:Z(F.options,h==="column"?F.optionsColumn:F.optionsRow),children:u.map(j=>r.jsx(k.RadioButton,{name:o,value:j.value,checked:y===j.value,disabled:g||j.disabled,labelRight:j.label,onChange:()=>{p(j.value)}},j.value))})]})},Ot=({userFlow:e,pageId:t,component:s,hash:o,responseKey:l,items:i,itemActive:c,darkMode:n})=>r.jsx(k.Stepper,{items:i,itemActive:c,darkMode:n}),St=({userFlow:e,items:t,responseKey:s})=>{const{getNextUI:o}=K(),l=b.useCallback(async({actionType:c,hashCode:n,redirectUrl:d})=>{var a;try{switch(c){case"GO_TO_NEXT_UI":const u=await o(e,n,{...(a=T.getState()[e])==null?void 0:a.entries},s);u!=null&&u.data&&L(e,u==null?void 0:u.data);break;case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${c}`);break}}catch(u){alert(JSON.stringify(u))}},[]),i=b.useMemo(()=>t==null?void 0:t.map(c=>({title:c==null?void 0:c.title,component:r.jsx("div",{onClick:()=>l(c)})})),[]);return r.jsx(k.Breadcrumbs,{items:i})};function fe(e,t){const{getNextUI:s,fetchDataSource:o,fetchAndGetNextUI:l}=K();return b.useCallback(async i=>{var _,f,x,y;const{responseKey:c,actionType:n,dataSource:d,redirectUrl:a,dependencies:u}=i,h=(_=T.getState()[e])==null?void 0:_.entries;if(!Ae(h,u))try{const g={...(f=T.getState()[e])==null?void 0:f.entries,[c]:{status:200}};switch(M(e,g),n){case"CLOSE_MODAL":ne(e,!1);break;case"CLOSE_DRAWER":W(e,!1);break;case"OPEN_DRAWER":W(e,!0);break;case"GO_TO_NEXT_UI":{const m=await s(e,t,g,c);m!=null&&m.data&&L(e,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await l(e,t,g,c,d);m!=null&&m.data&&L(e,m==null?void 0:m.data);break}case"GET_DATA_SOURCE":{const m=await s(e,t,g,c),p=(x=m==null?void 0:m.data)==null?void 0:x.content;if((p==null?void 0:p.type)!=="fetch")break;const j=p==null?void 0:p.dataSource,w=await o(j,e,!1),C={...(y=T.getState()[e])==null?void 0:y.entries,[c]:{status:w==null?void 0:w.status,content:w==null?void 0:w.data}};M(e,C);const E=await s(e,t,C,c);E!=null&&E.data&&L(e,E==null?void 0:E.data);break}case"REDIRECT":a?window.location.href=a:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${n}`)}}catch(g){alert(JSON.stringify(g))}},[l,o,s,t,e])}const vt=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,label:i,content:c,dataSource:n,redirectUrl:d,dependencies:a,onClick:u,...h}=e,_=fe(t,s),{disabled:f}=B(t,a),x={...h,children:c??i},y=(x==null?void 0:x.disabled)??f,g=b.useCallback(async()=>{await _({responseKey:o,actionType:l,dataSource:n,redirectUrl:d,dependencies:a})},[l,n,a,d,o,_]);return r.jsx(k.Button,{...x,disabled:y,onClick:()=>!y&&(u??g)()})},Be={slotStack:"_slotStack_12u4t_5"},At=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,dependencies:c,content:n,actionContent:d,...a}=e,{disabled:u}=B(t,c),h=A(t,s,n&&n.length>0?n:null),_=A(t,s,d&&d.length>0?d:null),f=h&&h.length>0?r.jsx("div",{className:Be.slotStack,children:h.map((g,m)=>r.jsx(b.Fragment,{children:g},`card-accordion-body-${l}-${m}`))}):void 0,x=_&&_.length>0?r.jsx("div",{className:Be.slotStack,children:_.map((g,m)=>r.jsx(b.Fragment,{children:g},`card-accordion-actions-${l}-${m}`))}):void 0,y=a.disabled||u;return r.jsx(k.CardAccordion,{...a,disabled:y,actionContent:x,children:f??null})},Rt={slotStack:"_slotStack_ivk5b_1"},Dt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c,colorId:n,disabled:d,actionType:a,dataSource:u,redirectUrl:h,dependencies:_}=e,{getNextUI:f,fetchDataSource:x,fetchAndGetNextUI:y}=K(),{disabled:g}=B(t,_),m=d??g,p=A(t,s,c&&c.length>0?c:null),j=p&&p.length>0?r.jsx("div",{className:Rt.slotStack,children:p.map((C,E)=>r.jsx(b.Fragment,{children:C},`card-body-${l}-${E}`))}):null,w=b.useCallback(async()=>{var C,E,N;if(!(!a||m))try{const v={...(C=T.getState()[t])==null?void 0:C.entries,[i]:{status:200}};switch(M(t,v),a){case"CLOSE_MODAL":ne(t,!1);break;case"CLOSE_DRAWER":W(t,!1);break;case"OPEN_DRAWER":W(t,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const R=await f(t,s,v,i,a==="GO_TO_NEXT_UI");R!=null&&R.data&&L(t,R==null?void 0:R.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const S=await y(t,s,v,i,u);S!=null&&S.data&&L(t,S==null?void 0:S.data);break}case"GET_DATA_SOURCE":{const S=await f(t,s,v,i),R=(E=S==null?void 0:S.data)==null?void 0:E.content;if((R==null?void 0:R.type)!=="fetch")break;const U=R==null?void 0:R.dataSource,V=await x(U,t,!1),H={...(N=T.getState()[t])==null?void 0:N.entries,[i]:{status:V==null?void 0:V.status,content:V==null?void 0:V.data}};M(t,H);const I=await f(t,s,H,i);I!=null&&I.data&&L(t,I==null?void 0:I.data);break}case"REDIRECT":h&&(window.location.href=h);break;default:console.warn(`Unhandled card actionType: ${a}`)}}catch(v){alert(JSON.stringify(v))}},[a,u,m,y,x,f,s,h,i,t]);return r.jsx(k.Card,{colorId:n,disabled:m,onClick:a&&!m?()=>void w():void 0,children:j})},Lt=e=>{const{content:t,description:s,...o}=e,l={...o,children:t??s};return r.jsx(k.CardNotification,{...l})},Mt=(e,t,s)=>{const{url:o,paginationKeys:l,params:i}=e,c=[],n=(l==null?void 0:l.page)??"page";if(c.push(`${n}=${t}`),typeof s=="string"){const u=(l==null?void 0:l.text)??"text";c.push(`${u}=${encodeURIComponent(s||"")}`)}if(i&&typeof i=="object"){const u=Object.entries(i).map(([h,_])=>`${encodeURIComponent(h)}=${encodeURIComponent(_)}`);c.push(...u)}const d=c.join("&");return d?`${o}?${d}`:o},me=(e,t,s,o)=>{const{type:l,url:i,method:c,headers:n}=e;if(l==="rest"){const d=Mt(e,t,s),u={...(e==null?void 0:e.data)??{},...o??{}};return{type:"rest",url:d,method:c,headers:n,data:u}}else return{type:"graphql",url:i,method:"post",headers:n,query:e==null?void 0:e.query,variables:{...(e==null?void 0:e.variables)||{},...typeof s=="string"?{text:s}:{},page:t}}},ye=e=>Array.isArray(e)?e:typeof e=="object"?JSON.stringify(e):e,It=(e,t)=>{if(!t||e==null)return null;const{extractionJsonPath:s,injectionJsonPath:o}=t,l=G.value(e,s);if(l==null)return null;try{const i={};return G.value(i,o,l),i}catch(i){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",o,i),null}},Ge=(e,t,s,o)=>{const l=G.query(e,t),i=l==null?void 0:l.map(a=>{var u,h;if(s){const _={};for(const[f,x]of Object.entries(s))if(typeof x=="object"&&"path"in x){const y=x,g=(u=G.query(a,y.path))==null?void 0:u[0];y.translations&&String(g)in y.translations?_[f]=ye(y.translations[String(g)]):_[f]=ye(g)}else{const y=x;_[f]=ye((h=G.query(a,y))==null?void 0:h[0])}return _}else return a}),c=G.value(e,(o==null?void 0:o.size)??"$.meta.size")??l.length,n=G.value(e,(o==null?void 0:o.total)??"$.meta.total")??0,d={size:c,total:n,totalPages:o!=null&&o.totalPages?G.value(e,(o==null?void 0:o.totalPages)??"$.meta.totalPages"):c>0?Math.ceil(n/c):0};return{items:i,pagination:d}},ae=({withPadding:e=!1})=>{const t=s=>r.jsx("span",{style:{color:q.labelColor},children:s});return r.jsx(D.Legend,{formatter:t,wrapperStyle:{fontSize:q.fontSize,fontFamily:q.fontFamily,padding:e?"1rem 0":"0"}})},Bt=({active:e,payload:t,label:s,tooltipKey:o})=>{var i;if(!e||!t||!t.length)return null;const l={backgroundColor:q.tooltipBg,borderRadius:q.tooltipBorderRadius,color:q.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(o){const c=(i=t[0])==null?void 0:i.payload;if(c&&c[o]!==void 0&&c[o]!==null)return r.jsx("div",{style:l,children:r.jsx("p",{style:{margin:0},children:c[o]})})}return r.jsxs("div",{style:l,children:[r.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:s}),t.map((c,n)=>r.jsx("p",{style:{margin:"2px 0",color:c.color},children:`${c.name}: ${c.value}`},n))]})},oe=({tooltipKey:e}={})=>r.jsx(D.Tooltip,{content:r.jsx(Bt,{tooltipKey:e})}),ge=({dataKey:e,hide:t=!1})=>r.jsx(D.XAxis,{dataKey:e,hide:t,tick:{fill:q.labelColor,fontSize:q.fontSize}}),xe=()=>r.jsx(D.YAxis,{tick:{fill:q.labelColor,fontSize:q.fontSize}}),Gt={area:e=>{const{data:t,xKey:s,yKeys:o,tooltipKey:l}=e;return r.jsx(D.ResponsiveContainer,{width:"100%",height:400,children:r.jsxs(D.AreaChart,{data:t,children:[r.jsx(D.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(ge,{dataKey:s}),r.jsx(xe,{}),r.jsx(oe,{tooltipKey:l}),r.jsx(ae,{}),o.map((i,c)=>r.jsx(D.Area,{type:"monotone",dataKey:i,stroke:J[c%J.length],fill:J[c%J.length]},i))]})})},bar:e=>{const{data:t,yKeys:s,xKey:o,tooltipKey:l}=e;return r.jsx(D.ResponsiveContainer,{width:"100%",height:400,children:r.jsxs(D.BarChart,{data:t,children:[r.jsx(D.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(ge,{hide:!0,dataKey:o}),r.jsx(xe,{}),r.jsx(oe,{tooltipKey:l}),r.jsx(ae,{withPadding:!0}),s.map((i,c)=>r.jsx(D.Bar,{dataKey:i,fill:J[c%J.length]},i))]})})},line:e=>{const{data:t,xKey:s,yKeys:o,tooltipKey:l}=e;return r.jsx(D.ResponsiveContainer,{width:"100%",height:400,children:r.jsxs(D.LineChart,{data:t,children:[r.jsx(D.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(ge,{dataKey:s}),r.jsx(xe,{}),r.jsx(oe,{tooltipKey:l}),r.jsx(ae,{}),o.map((i,c)=>r.jsx(D.Line,{type:"monotone",dataKey:i,stroke:J[c%J.length],strokeWidth:2,dot:!1},i))]})})},pie:e=>{const{data:t,xKey:s,yKeys:o,tooltipKey:l}=e,i=({cx:c,cy:n,midAngle:d,innerRadius:a,outerRadius:u,value:h})=>{const _=Math.PI/180,f=25+a+(u-a),x=c+f*Math.cos(-(d??0)*_),y=n+f*Math.sin(-(d??0)*_);return r.jsx("text",{x,y,fill:q.labelColor,color:q.labelColor,textAnchor:"middle",dominantBaseline:"central",children:h})};return r.jsx(D.ResponsiveContainer,{width:"100%",height:400,children:r.jsxs(D.PieChart,{children:[r.jsx(oe,{tooltipKey:l}),r.jsx(ae,{}),r.jsx(D.Pie,{data:t,dataKey:o[0],nameKey:s,label:i,outerRadius:120,children:t.map((c,n)=>r.jsx(D.Cell,{fill:J[n%J.length]},`cell-${n}`))})]})})}},J=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],q={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},Ke=e=>{const{component:t,userFlow:s,hash:o,responseKey:l,dataSource:i,...c}=e,n=Gt[c.type];if(!n)return r.jsx("div",{children:"Not supported chart type"});const{fetchDataSource:d}=K(),[a,u]=b.useState(!1),[h,_]=b.useState([]),f=async()=>{var y,g;try{u(!0);const{jsonPathData:m,mapperData:p}=i,j=me(i,1),w=await d(j,s,!1),C=m?(y=Ge(w==null?void 0:w.data,m,p))==null?void 0:y.items:(g=w==null?void 0:w.data)==null?void 0:g.data;_(C),u(!1)}catch(m){alert(JSON.stringify(m)),u(!1)}};b.useEffect(()=>{i?f():_(c.data)},[]);const x={...c,data:h};return a?r.jsx(k.SkeletonBase,{height:400}):h.length>0?n(x):r.jsx(k.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})},Kt=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=e,u={...a},{getNextUI:h}=K(),[_,f]=b.useState(c||!1),{disabled:x}=B(t,d),y=b.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),g=b.useCallback(async()=>{var p;try{const j=!_;f(j);const w={...(p=T.getState()[t])==null?void 0:p.entries,[o]:j};switch(M(t,w),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const E=await h(t,s,w,o,l==="GO_TO_NEXT_UI");E!=null&&E.data&&L(t,E==null?void 0:E.data);break}default:break}}catch(j){console.error("Error in checkbox action:",j),alert(JSON.stringify(j))}},[t,s,o,l,_]),m=(u==null?void 0:u.disabled)??x;return r.jsx(k.Checkbox,{...u,labelRight:y,checked:_,disabled:m,onChange:()=>{!m&&g()}})},$={codeEditor:"_codeEditor_1wi2p_1",codeEditor_label:"_codeEditor_label_1wi2p_4",codeEditor_wrapper:"_codeEditor_wrapper_1wi2p_13",input:"_input_1wi2p_17",preview:"_preview_1wi2p_18",preview_inner:"_preview_inner_1wi2p_33"},Ut=e=>{const{userFlow:t,responseKey:s,label:o,language:l,placeholder:i,value:c,required:n,dependencies:d,disabled:a,showPreview:u,height:h="400px"}=e,[_,f]=b.useState(c??""),x=k.ThemeStore.useThemeStore(w=>w.theme.mode),{disabled:y}=B(t,d),g=a??y,m={json:je.json(),markdown:Pe.markdown(),sql:et.sql(),yaml:tt.yaml()},p=b.useMemo(()=>n&&o?`${o} *`:o??"",[o,n]),j=w=>{f(w);const C={[s]:w};M(t,C)};return r.jsxs("div",{className:$.codeEditor,children:[p&&p!==""&&r.jsx("label",{className:$.codeEditor_label,children:p}),r.jsxs("div",{className:$.codeEditor_wrapper,children:[r.jsx($e,{className:$.input,value:_,height:h,placeholder:i,extensions:[m[l]??je.json()],onChange:w=>j(w),theme:x,editable:!g}),l==="markdown"&&u&&r.jsx("div",{className:$.preview,style:{height:h},children:r.jsx(k.PreviewerMarkdown,{className:$.preview_inner,children:_})})]})]})},Ue={slotStack:"_slotStack_6n2wy_5"},zt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c,topContent:n,icon:d,headerStatusColor:a,...u}=e,h=a?`palette_${a}_50`:void 0,_=A(t,s,c&&c.length>0?c:null),f=A(t,s,n&&n.length>0?n:null),x=_&&_.length>0?r.jsx("div",{className:Ue.slotStack,children:_.map((g,m)=>r.jsx(b.Fragment,{children:g},`data-card-body-${l}-${m}`))}):void 0,y=f&&f.length>0?r.jsx("div",{className:Ue.slotStack,children:f.map((g,m)=>r.jsx(b.Fragment,{children:g},`data-card-top-${l}-${m}`))}):void 0;return r.jsx(k.DataCard,{...u,icon:d,headerStatusColor:h,topContent:y,children:x})},qt={dividerNotFront:"_dividerNotFront_tze3j_1"},Vt=e=>r.jsx(k.Divider,{...e,className:qt.dividerNotFront}),be={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},Jt=({userFlow:e,pageId:t,responseKey:s,header:o,body:l,footer:i,...c})=>{const n=T(y=>{var g;return(g=y[e])==null?void 0:g.isDrawerOpen}),d=T(y=>{var g;return(g=y[e])==null?void 0:g.isLoading}),a=n&&!d,u={...c,isOpen:a,children:null},h=b.useCallback(()=>{ie(e),W(e,!1)},[e]),_=Array.isArray(o)?A(e,t,o):o?r.jsx(k.Heading,{type:"h2",children:o}):void 0,f=A(e,t,l),x=i?A(e,t,i):void 0;return r.jsx(k.Drawer,{...u,className:be.drawer,isOpen:a,onClose:h,heightGap:0,title:_?r.jsx(r.Fragment,{children:Array.isArray(_)?_.map((y,g)=>r.jsx(b.Fragment,{children:y},`drawer-header-${g}`)):_}):void 0,children:r.jsx("section",{className:be.drawerBody,children:f.map((y,g)=>r.jsx(b.Fragment,{children:y},`drawer-body-${g}`))}),footer:x?r.jsx("div",{className:be.drawerFooter,children:x.map((y,g)=>r.jsx(b.Fragment,{children:y},`drawer-footer-${g}`))}):void 0})},Xt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c,items:n,disabled:d,variant:a,leftIcon:u,rightIcon:h}=e,_=fe(t,s),f=b.useMemo(()=>n.map(x=>({label:x.content??x.label??"",onClick:()=>{_({responseKey:x.responseKey,actionType:x.actionType,dataSource:x.dataSource,redirectUrl:x.redirectUrl,dependencies:x.dependencies})}})),[n,_]);return r.jsx(k.DropdownButton,{disabled:d,variant:a,items:f,children:r.jsxs(b.Fragment,{children:[u?r.jsx(Ce.Icon,{name:u,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,c,h?r.jsx(Ce.Icon,{name:h,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},ze={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},Ht=({components:e=[]})=>r.jsx("section",{className:Z(ze.header,"avocado-dark-theme"),children:r.jsx("div",{className:ze.header_content,children:e.map((t,s)=>r.jsx(b.Fragment,{children:t},s))})}),Wt=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,content:i,redirectUrl:c,target:n,dependencies:d,component:a,hash:u,...h}=e,{getNextUI:_}=K(),{disabled:f}=B(t,d),x=l&&h?(()=>{const{href:m,target:p,download:j,...w}=h;return w})():h,y=b.useCallback(async()=>{var m;if(l)try{const p={...(m=T.getState()[t])==null?void 0:m.entries,[o]:{status:200}};switch(M(t,p),l){case"GO_TO_NEXT_UI":{const j=await _(t,s,p,o);j!=null&&j.data&&L(t,j==null?void 0:j.data);break}case"REDIRECT":if(!c){console.warn("Missing redirectUrl for REDIRECT actionType");break}n==="_blank"?window.open(c,"_blank","noopener,noreferrer"):window.location.assign(c);break;default:console.warn(`Unhandled actionType for link: ${l}`);break}}catch(p){alert(JSON.stringify(p))}},[l,_,s,c,o,n,t]),g=x.disabled??f;return r.jsx(k.Link,{...x,disabled:g,onClick:l?y:void 0,children:i})},Qt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,items:c,closeOnClick:n,disabled:d,listOrigin:a,size:u,variant:h}=e,_=fe(t,s),f=b.useMemo(()=>c.map(x=>({icon:x.leftIcon,label:x.content??x.label??"",onClick:y=>{var g;(g=y==null?void 0:y.preventDefault)==null||g.call(y),_({responseKey:x.responseKey,actionType:x.actionType,dataSource:x.dataSource,redirectUrl:x.redirectUrl,dependencies:x.dependencies})}})),[c,_]);return r.jsx(k.Menu,{items:f,closeOnClick:n,disabled:d,listOrigin:a,size:u,variant:h})},Yt={modalContent:"_modalContent_p06ci_1"},Zt=({userFlow:e,pageId:t,responseKey:s,header:o,body:l,footer:i,headerStatusColor:c,...n})=>{const d=T(m=>{var p;return(p=m[e])==null?void 0:p.isModalOpen}),a=T(m=>{var p;return(p=m[e])==null?void 0:p.isLoading}),u=d&&!a,h={...n},_=(h==null?void 0:h.headerStatusColor)??c,f=b.useCallback(()=>{ie(e),ne(e,!1)},[e,s]),x=Array.isArray(o)?A(e,t,o):o,y=A(e,t,l),g=A(e,t,i);return r.jsx(k.Modal,{...h,headerStatusColor:_,header:typeof x=="string"?x:r.jsx(r.Fragment,{children:x.map((m,p)=>r.jsx(b.Fragment,{children:m},`modal-header-${p}`))}),children:r.jsx("section",{className:Yt.modalContent,children:y.map((m,p)=>r.jsx(b.Fragment,{children:m},`modal-body-${p}`))}),actions:r.jsx(r.Fragment,{children:g.map((m,p)=>r.jsx(b.Fragment,{children:m},`modal-footer-${p}`))}),open:u,onClose:f})},Ft=({userFlow:e,pageId:t})=>{var i,c;const s=at(e);if(!s)return null;const o=[...(s==null?void 0:s.components)||[],...((i=s==null?void 0:s.header)==null?void 0:i.components)||[],...((c=s==null?void 0:s.body)==null?void 0:c.components)||[]],l=A(e,t,o);return r.jsx(r.Fragment,{children:l==null?void 0:l.map((n,d)=>{const a=`overlay-${d}-${s==null?void 0:s.hash}`;return r.jsx(b.Fragment,{children:n},a)})})},$t={success:{color:"success-opacity",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-opacity",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-opacity",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-10",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-10",textColor:"neutral-70",iconColor:"neutral-70"}},Pt=e=>{const{content:t,variant:s="neutral",...o}=e,l=$t[s],i={...o,children:t,color:(o==null?void 0:o.color)??l.color,textColor:(o==null?void 0:o.textColor)??l.textColor,iconColor:(o==null?void 0:o.iconColor)??l.iconColor};return r.jsx(k.Pill,{...i})},en=e=>{const{content:t}=e;return r.jsx(k.PreviewerMarkdown,{children:t})},tn=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,dataSource:i,dependencies:c,onClick:n,...d}=e,{getNextUI:a,fetchAndGetNextUI:u}=K(),{disabled:h}=B(t,c),_={...d},f=(_==null?void 0:_.disabled)??h,x=b.useCallback(async()=>{var y;try{const g={...(y=T.getState()[t])==null?void 0:y.entries,[o]:{status:200}};switch(M(t,g),l){case"GO_TO_NEXT_UI":{const m=await a(t,s,g,o);m!=null&&m.data&&L(t,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await u(t,s,g,o,i);m!=null&&m.data&&L(t,m==null?void 0:m.data);break}case"CLOSE_MODAL":ne(t,!1);break;case"CLOSE_DRAWER":W(t,!1);break;case"OPEN_DRAWER":W(t,!0);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(g){alert(JSON.stringify(g))}},[l,i,s,o,t]);return r.jsx(k.RoundButton,{..._,disabled:f,onClick:()=>!f&&(n??x)()})},X={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},qe=e=>{const{userFlow:t,pageId:s,columnWidth:o,columns:l,gap:i="md",justifyContent:c="start",alignItems:n="stretch"}=e,d=Array.isArray(l)?l.map((a,u)=>{const h=`col_${u}`,_=`col_${u}`;if(Array.isArray(a))return{gap:"md",justifyContent:"start",alignItems:"start",items:a,hash:h,responseKey:_};const f=a;return{gap:(f==null?void 0:f.gap)??"md",justifyContent:(f==null?void 0:f.justifyContent)??"start",alignItems:(f==null?void 0:f.alignItems)??"start",items:(f==null?void 0:f.items)??[],hash:(f==null?void 0:f.hash)??h,responseKey:(f==null?void 0:f.responseKey)??_}}):[];return d.length===0?null:r.jsx("div",{className:Z(X.row,X[`row__gap-${i}`],X[`row__justify-${c}`],X[`row__align-${n}`]),children:d==null?void 0:d.map((a,u)=>{const h=(o==null?void 0:o[u])||`${100/d.length}%`,_=A(t,s,a.items);return!_||_.length===0?null:r.jsx("div",{className:Z(X.row_column,X[`row_column__gap-${a.gap}`],X[`row_column__justify-${a.justifyContent}`],X[`row_column__align-${a.alignItems}`]),style:{width:h},children:_},a.hash||u)})})};function Ve({userFlow:e,pageId:t,responseKey:s,actionType:o,getNextUI:l,isMulti:i=!1,debounceMs:c}){const n=b.useRef(null);b.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=b.useCallback(async u=>{var f;const h={...(f=T.getState()[e])==null?void 0:f.entries};if(u?(h[s]=u,M(e,h)):(delete h[s],ot(e,s)),o&&(o==="GO_TO_NEXT_UI"||o==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const y=await l(e,t,h,s,o==="GO_TO_NEXT_UI");y!=null&&y.data&&L(e,y.data)}catch(x){console.error("[useSelectChange] Failed to fetch next UI",x)}},[e,t,s,o,l]);return b.useCallback(u=>{if(!i){d(u);return}if(c==null){d(u);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{d(u),n.current=null},c)},[i,c,d])}const nn=/\{([^}]+)\}/g,sn=(e,t)=>{var s;return t.includes("{")?t.replace(nn,(o,l)=>{var c;const i=(c=G.query(e,l.trim()))==null?void 0:c[0];return i!=null?String(i):""}):(s=G.query(e,t))==null?void 0:s[0]},an=(e,t,s,o)=>{const l=G.query(e,t);return(l==null?void 0:l.map(i=>{var d;const c=sn(i,s),n=o?(d=G.query(i,o))==null?void 0:d[0]:i;return{label:c,value:n}}))??[]},on=(e,t,s,o=10)=>{var n,d;let l,i;if(s){const a=G.value(e,s.size??"$.meta.size")??o,u=G.value(e,s.total??"$.meta.total")??0;l=a,i=u}else{const a=e==null?void 0:e.meta;l=(a==null?void 0:a.size)??((n=a==null?void 0:a.page)==null?void 0:n.size)??o,i=(a==null?void 0:a.total)??((d=a==null?void 0:a.page)==null?void 0:d.total)??0}const c=i>0?Math.ceil(i/l)>t:!1;return{pageSize:l,total:i,hasMore:c}},Je={selectNotFront:"_selectNotFront_ch3v5_1"},rn=({userFlow:e,pageId:t,responseKey:s,required:o,dataSource:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:u,fetchDataSource:h}=K(),[_,f]=b.useState((a==null?void 0:a.value)??""),{disabled:x}=B(e,c),y=(a==null?void 0:a.disabled)??x,g=b.useMemo(()=>o&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,o]),m=b.useMemo(()=>{const C=a!=null&&a.isMulti?_:[_],E={};return Array.isArray(C)&&C.forEach(N=>{if(!N)return;const v=JSON.stringify(N.value),S=JSON.stringify(N.label);E[v]=N,S in E||(E[S]=N)}),E},[_]),p=Ve({userFlow:e,pageId:t,responseKey:s,actionType:i,getNextUI:u,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),j=C=>{f(C),p(C)},w=async(C,E,{page:N})=>{const{jsonPathLabel:v,jsonPathOptions:S,jsonPathValue:R,jsonPathPagination:U}=l,V=me(l,N,C),H=await h(V,e,!1),I=H==null?void 0:H.data,re=I?an(I,S,v,R):[],{hasMore:Sn}=on(I,N,U);return{options:re,hasMore:Sn,additional:{page:C?1:N+1}}};return r.jsx(k.SelectPagination,{...a,className:Je.selectNotFront,label:g,value:_,disabled:y,noOptionsMessage:()=>r.jsx(r.Fragment,{children:"Sin opciones"}),onChange:C=>!y&&j(C),loadOptions:w,additional:{page:1},isOptionDisabled:C=>{const E=JSON.stringify(C==null?void 0:C.value),N=JSON.stringify(C==null?void 0:C.label);return!!(m!=null&&m[E])||!!(m!=null&&m[N])},debounceTimeout:350})},cn=({userFlow:e,pageId:t,responseKey:s,dataSource:o,required:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:u}=K(),[h,_]=b.useState(a.value||""),{disabled:f}=B(e,c),x=(a==null?void 0:a.disabled)??f,y=b.useMemo(()=>l&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,l]),g=Ve({userFlow:e,pageId:t,responseKey:s,actionType:i,getNextUI:u,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),m=p=>{_(p),g(p)};return r.jsx(k.Select,{...a,className:Je.selectNotFront,label:y,value:h,disabled:x,onChange:p=>!x&&m(p)})},ln=e=>{const{dataSource:t}=e;return t?r.jsx(rn,{...e}):r.jsx(cn,{...e})},Xe={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},dn=e=>{const{size:t}=e,s=Z(Xe.spacing,Xe[`spacing__${t}`]);return r.jsx("div",{className:s})},_n=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=e,u={...a},{getNextUI:h}=K(),[_,f]=b.useState(c||!1),{disabled:x}=B(t,d),y=(u==null?void 0:u.disabled)??x,g=b.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),m=b.useCallback(async()=>{var p;try{const j=!_;f(j);const w={...(p=T.getState()[t])==null?void 0:p.entries,[o]:j};switch(M(t,w),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const E=await h(t,s,w,o,l==="GO_TO_NEXT_UI");E!=null&&E.data&&L(t,E==null?void 0:E.data);break}default:break}}catch(j){console.error("Error in switch action:",j),alert(JSON.stringify(j))}},[t,s,o,l,_]);return r.jsx(k.Switch,{...u,label:g,checked:_,disabled:y,onChange:()=>!y&&m()})},He={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},un=({values:e})=>{const s=e==null?void 0:e.slice(0,4),o=(e==null?void 0:e.length)-4;return r.jsxs("div",{className:He.tableArrayPills,children:[s.map((l,i)=>r.jsx(k.Pill,{children:String(l)},i)),o>0&&r.jsxs(k.Pill,{outlined:!0,children:["+",o]})]})},hn=({userFlow:e,pageId:t,tableResponseKey:s,component:o,rowData:l})=>{const{getNextUI:i,fetchAndGetNextUI:c,fetchDataSource:n}=K(),d=A(e,t,[{...o}]),a=(d==null?void 0:d[0])||null;if(!a)return null;const{actionType:u,responseKey:h,dataSource:_}=a.props,f=b.useCallback(async()=>{var x,y,g;try{const m={...(x=T.getState()[e])==null?void 0:x.entries,[h]:{status:200},[s]:[{...l}]};switch(M(e,m),u){case"GO_TO_NEXT_UI":{const p=await i(e,t,m,h);p!=null&&p.data&&L(e,p==null?void 0:p.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const p=await c(e,t,m,h,_);p!=null&&p.data&&L(e,p==null?void 0:p.data);break}case"GET_DATA_SOURCE":{const p=await i(e,t,m,h),j=(y=p==null?void 0:p.data)==null?void 0:y.content;if((j==null?void 0:j.type)!=="fetch")break;const w=j==null?void 0:j.dataSource,C=await n(w,e,!1),E={...(g=T.getState()[e])==null?void 0:g.entries,[h]:{status:C==null?void 0:C.status,content:C==null?void 0:C.data}};M(e,E);const N=await i(e,t,E,h);N!=null&&N.data&&L(e,N==null?void 0:N.data);break}default:console.warn(`Unhandled actionType: ${u}`);break}}catch(m){alert(JSON.stringify(m))}},[u,_,t,h,e]);return b.cloneElement(a,{onClick:f})},fn=()=>r.jsx("div",{className:He.tableSkeleton,children:[...Array(10)].map((e,t)=>r.jsx(k.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${t}`))}),mn=({userFlow:e,pageId:t,responseKey:s,component:o,dataSource:l,rightActions:i,...c})=>{var w,C,E;const{fetchDataSource:n}=K(),[d,a]=b.useState(!1),[u,h]=b.useState(1),[_,f]=b.useState(null),x=b.useRef(new Map([[1,null]])),y=b.useMemo(()=>{if(i!=null&&i.length)return i.map((N,v)=>({renderContent:S=>r.jsx(hn,{userFlow:e,pageId:t,tableResponseKey:s,component:N,rowData:S},`tableRowAction${v}`)}))},[i,e,t]),g=async(N=1)=>{const{mapperData:v,jsonPathData:S,jsonPathPagination:R,jsonPathCursorPagination:U}=l;if(U&&N!==1&&!x.current.has(N)){h(1),g(1);return}U&&N===1&&(x.current=new Map([[1,null]]));try{a(!0);const V=U?x.current.get(N)??null:null,H=me(l,N,void 0,V),I=await n(H,e,!1);if(f(Ge(I==null?void 0:I.data,S,v,R)),U){const re=It(I==null?void 0:I.data,U);re&&x.current.set(N+1,re)}a(!1)}catch(V){console.error("[TableNotFront] fetchData:",V),a(!1)}},m=N=>{h(N),g(N)};b.useEffect(()=>{g()},[]);const p=b.useMemo(()=>!(_!=null&&_.items)||!(c!=null&&c.columns)?c==null?void 0:c.columns:c.columns.map(N=>{var S;return((S=_==null?void 0:_.items)==null?void 0:S.some(R=>Array.isArray(N!=null&&N.accessor?R[N==null?void 0:N.accessor]:void 0)))?{...N,renderCell:R=>{const U=N.accessor?R[N.accessor]:void 0;return Array.isArray(U)?r.jsx(un,{values:U}):U??""}}:N}),[_==null?void 0:_.items,c==null?void 0:c.columns]),j={...c,data:_==null?void 0:_.items,columns:p,rightActions:y};return r.jsx(r.Fragment,{children:d?r.jsx(fn,{}):_&&((w=_==null?void 0:_.items)==null?void 0:w.length)>0?r.jsxs(r.Fragment,{children:[r.jsx(k.Table,{...j}),(_==null?void 0:_.pagination)&&((C=_==null?void 0:_.pagination)==null?void 0:C.totalPages)>1&&r.jsx(k.Pager,{classname:{global:"row__end"},page:u,size:_==null?void 0:_.pagination.size,total:(E=_==null?void 0:_.pagination)==null?void 0:E.total,onChange:m})]}):r.jsx(k.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},yn={tabsPanel:"_tabsPanel_kvslb_1"},gn=({userFlow:e,pageId:t,components:s})=>{const o=A(e,t,s);return o!=null&&o.length?r.jsx("section",{className:yn.tabsPanel,children:o.map((l,i)=>r.jsx(b.Fragment,{children:l},`tabs-panel-${i}`))}):null},xn=({userFlow:e,pageId:t,hash:s,items:o,activeIndex:l,className:i,responseKey:c})=>{const n=o.map((a,u)=>({label:a.label,disabled:a.disabled,children:r.jsx(gn,{userFlow:e,pageId:t,components:a.components},`${s}-tab-${u}`)})),d=a=>{var h;const u={...(h=T.getState()[e])==null?void 0:h.entries,[c]:a};M(e,u)};return r.jsx(k.Tabs,{className:i,activeIndex:l,items:n,onClick:d})},bn=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,required:c,dependencies:n,...d}=e,a={...d},[u,h]=b.useState((a==null?void 0:a.value)??""),{disabled:_}=B(t,n),f=(a==null?void 0:a.disabled)??_,x=b.useMemo(()=>c&&(a!=null&&a.label)?`${a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),y=g=>{var p;const m=(p=g==null?void 0:g.target)==null?void 0:p.value;h(m),M(t,{[i]:m})};return b.useEffect(()=>{h((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),r.jsx(k.Textarea,{...a,label:x,value:u,disabled:f,onChange:g=>!f&&y(g)})},pn={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},jn=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,required:c,dependencies:n,...d}=e,a={...d},[u,h]=b.useState((a==null?void 0:a.value)??""),{disabled:_}=B(t,n),f=(a==null?void 0:a.disabled)??_,x=b.useMemo(()=>c&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),y=g=>{var j;const m=(j=g==null?void 0:g.target)==null?void 0:j.value;h(m);const p={[i]:m};M(t,p)};return b.useEffect(()=>{h((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),r.jsx(k.TextField,{...a,className:pn.textFieldNotFront,allowClear:!1,label:x,value:u,disabled:f,onChange:g=>!f&&y(g)})},Cn=({userFlow:e,pageId:t,responseKey:s,variant:o,content:l,actionType:i,redirectUrl:c})=>{const n=b.useCallback(async()=>{ie(e);try{switch(i){case"AUTOCLOSE_AND_REDIRECT":window.location.href=c;break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(d){console.error("Error in toast action:",d),alert(JSON.stringify(d))}},[i,t,s,e,c]);return b.useEffect(()=>{({info:k.toast.info,error:k.toast.error,success:k.toast.success,warning:k.toast.warning}[o]||k.toast.info)(l,{autoClose:i?!1:4e3,containerId:e,onClose:n})},[n,e]),null},We={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},wn=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c,label:n,placement:d,notShowArrow:a,visible:u}=e,h=A(t,s,c!=null&&c.length?c:null),_=h&&h.length>0?r.jsx("div",{className:We.tooltipNotFront_content,children:h.map((f,x)=>r.jsx(b.Fragment,{children:f},`tooltip-${l}-${x}`))}):null;return r.jsx(k.Tooltip,{className:We.tooltipNotFront,label:n,placement:d,notShowArrow:a,visible:u,children:_})};function Nn({routes:e,renderPage:t,renderFallback:s,redirectTo:o="/"}){return r.jsxs(te.Routes,{children:[e.map(l=>r.jsx(te.Route,{path:l.path,element:l.canAccess?t(l.sessionName):(s==null?void 0:s())??null},`${l.path}:${l.sessionName}`)),r.jsx(te.Route,{path:"*",element:r.jsx(te.Navigate,{to:o,replace:!0})})]})}function kn({sessionName:e,apiConfig:t,onResolveComponentProps:s,children:o}){const l=Ye(e,t,null,s);return r.jsxs(r.Fragment,{children:[l,o]})}const Qe=(e,t,s,o,l)=>{const i=A(e,t,(o==null?void 0:o.components)||null,l);switch(s){case"body":return r.jsx(Ct,{...o,inputs:i||[]},JSON.stringify(o==null?void 0:o.components));case"header":return r.jsx(Ht,{...o,components:i||[]},JSON.stringify(o==null?void 0:o.components));default:return null}},Ye=(e,t,s,o)=>{var _,f,x;const[l,i]=b.useState(!1),c=T(y=>y),n=(_=c[e])==null?void 0:_.currentPageId;b.useEffect(()=>{if(typeof window>"u")return;const y=new URL(window.location.href),g=y.searchParams.get("sessionId");g&&(sessionStorage.setItem("sessionId",g),y.searchParams.delete("sessionId"),window.history.replaceState({},"",y.toString()))},[]);const d=n?Qe(e,n,"header",((f=c[e].pages[n].page)==null?void 0:f.header)||null,o):null,a=n?Qe(e,n,"body",((x=c[e].pages[n].page)==null?void 0:x.body)||null,o):null,u=b.useMemo(()=>{var y;return r.jsxs(r.Fragment,{children:[((y=c[e])==null?void 0:y.isLoading)&&r.jsx(k.Loading,{}),d,a,n&&r.jsx(Ft,{userFlow:e,pageId:n}),c[e]&&r.jsx(k.Toaster,{})]})},[d,a,n,e]),h=async()=>{try{const y=await De(t,e),g=y==null?void 0:y.data,m=g==null?void 0:g.content;(y==null?void 0:y.status)===200?le(e,t,m,g==null?void 0:g.sessionState):i(!0)}catch(y){console.error("[not-page]: API call failed",y),i(!0)}};return b.useEffect(()=>{t!=null&&t.api&&!s&&e?h():!(t!=null&&t.api)&&s&&e||t!=null&&t.api&&s&&e?le(e,t,s):(!(t!=null&&t.api)&&!s||!e)&&(i(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const y="avocado-theme-mode-changed",g=m=>{const p=m.detail;k.ThemeStore.setThemeMode(p)};return window.addEventListener(y,g),()=>{window.removeEventListener(y,g)}},[]),l&&console.error("[not-page]: No render page"),u};function Ze(e){const t=e.replace(/\/{2,}/g,"/");return!t||t==="/"?"/":t.replace(/\/+$/,"")}function En(e,t){return t.requiredPermissions.length===0?!0:t.requiredPermissions.some(s=>e.includes(s))}function pe(e,t){return e===t||e.startsWith(`${t}/`)}function Tn(e,t){return e.filter(s=>pe(s.path,t))}function On(e,t){const s=Ze(e);return pe(s,t)?s.slice(t.length)||"/":s}O.Chart=Ke,O.NotFrontDynamicRouter=Nn,O.NotFrontPage=kn,O.Row=qe,O.heading=Se,O.normalizePathname=Ze,O.pathBelongsToPrefix=pe,O.selectDynamicRoutesUnderPrefix=Tn,O.stripPrefixFromPathname=On,O.text=ve,O.usePage=Ye,O.userCanAccessDynamicRoute=En,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}));
|
|
13
|
+
*/var Ie;function kt(){return Ie||(Ie=1,(function(e){(function(){var t={}.hasOwnProperty;function s(){for(var o=[],l=0;l<arguments.length;l++){var i=arguments[l];if(i){var c=typeof i;if(c==="string"||c==="number")o.push(i);else if(Array.isArray(i)){if(i.length){var n=s.apply(null,i);n&&o.push(n)}}else if(c==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){o.push(i.toString());continue}for(var d in i)t.call(i,d)&&i[d]&&o.push(d)}}}return o.join(" ")}e.exports?(s.default=s,e.exports=s):window.classNames=s})()})(he)),he.exports}var Et=kt();const Z=lt(Et),F={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},Tt=e=>{const{userFlow:t,pageId:s,responseKey:o,label:l,value:i,required:c,actionType:n,dependencies:d,direction:a,items:u}=e,h=a==="column"?"column":"row",{getNextUI:_}=K(),{disabled:f}=B(t,d),x=T(j=>{var C,w;return(w=(C=j[t])==null?void 0:C.entries)==null?void 0:w[o]}),y=x!=null?String(x):i??"",g=f,m=b.useMemo(()=>l?c?`${l} *`:l:null,[l,c]),p=b.useCallback(async j=>{var C;if(!g)try{const w={...(C=T.getState()[t])==null?void 0:C.entries,[o]:j};if(M(t,w),n==="GO_TO_NEXT_UI"||n==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const v=await _(t,s,w,o,n==="GO_TO_NEXT_UI");v!=null&&v.data&&L(t,v==null?void 0:v.data)}}catch(w){alert(JSON.stringify(w))}},[n,_,g,s,o,t]);return r.jsxs("fieldset",{className:Z(F.fieldset,h==="column"&&F.fieldsetColumn),children:[m?r.jsx("legend",{className:F.legend,children:m}):null,r.jsx("div",{className:Z(F.options,h==="column"?F.optionsColumn:F.optionsRow),children:u.map(j=>r.jsx(k.RadioButton,{name:o,value:j.value,checked:y===j.value,disabled:g||j.disabled,labelRight:j.label,onChange:()=>{p(j.value)}},j.value))})]})},Ot=({userFlow:e,pageId:t,component:s,hash:o,responseKey:l,items:i,itemActive:c,darkMode:n})=>r.jsx(k.Stepper,{items:i,itemActive:c,darkMode:n}),St=({userFlow:e,items:t,responseKey:s})=>{const{getNextUI:o}=K(),l=b.useCallback(async({actionType:c,hashCode:n,redirectUrl:d})=>{var a;try{switch(c){case"GO_TO_NEXT_UI":const u=await o(e,n,{...(a=T.getState()[e])==null?void 0:a.entries},s);u!=null&&u.data&&L(e,u==null?void 0:u.data);break;case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${c}`);break}}catch(u){alert(JSON.stringify(u))}},[]),i=b.useMemo(()=>t==null?void 0:t.map(c=>({title:c==null?void 0:c.title,component:r.jsx("div",{onClick:()=>l(c)})})),[]);return r.jsx(k.Breadcrumbs,{items:i})};function fe(e,t){const{getNextUI:s,fetchDataSource:o,fetchAndGetNextUI:l}=K();return b.useCallback(async i=>{var _,f,x,y;const{responseKey:c,actionType:n,dataSource:d,redirectUrl:a,dependencies:u}=i,h=(_=T.getState()[e])==null?void 0:_.entries;if(!Ae(h,u))try{const g={...(f=T.getState()[e])==null?void 0:f.entries,[c]:{status:200}};switch(M(e,g),n){case"CLOSE_MODAL":ne(e,!1);break;case"CLOSE_DRAWER":W(e,!1);break;case"OPEN_DRAWER":W(e,!0);break;case"GO_TO_NEXT_UI":{const m=await s(e,t,g,c);m!=null&&m.data&&L(e,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await l(e,t,g,c,d);m!=null&&m.data&&L(e,m==null?void 0:m.data);break}case"GET_DATA_SOURCE":{const m=await s(e,t,g,c),p=(x=m==null?void 0:m.data)==null?void 0:x.content;if((p==null?void 0:p.type)!=="fetch")break;const j=p==null?void 0:p.dataSource,C=await o(j,e,!1),w={...(y=T.getState()[e])==null?void 0:y.entries,[c]:{status:C==null?void 0:C.status,content:C==null?void 0:C.data}};M(e,w);const E=await s(e,t,w,c);E!=null&&E.data&&L(e,E==null?void 0:E.data);break}case"REDIRECT":a?window.location.href=a:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${n}`)}}catch(g){alert(JSON.stringify(g))}},[l,o,s,t,e])}const vt=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,label:i,content:c,dataSource:n,redirectUrl:d,dependencies:a,onClick:u,...h}=e,_=fe(t,s),{disabled:f}=B(t,a),x={...h,children:c??i},y=(x==null?void 0:x.disabled)??f,g=b.useCallback(async()=>{await _({responseKey:o,actionType:l,dataSource:n,redirectUrl:d,dependencies:a})},[l,n,a,d,o,_]);return r.jsx(k.Button,{...x,disabled:y,onClick:()=>!y&&(u??g)()})},Be={slotStack:"_slotStack_12u4t_5"},At=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,dependencies:c,content:n,actionContent:d,...a}=e,{disabled:u}=B(t,c),h=A(t,s,n&&n.length>0?n:null),_=A(t,s,d&&d.length>0?d:null),f=h&&h.length>0?r.jsx("div",{className:Be.slotStack,children:h.map((g,m)=>r.jsx(b.Fragment,{children:g},`card-accordion-body-${l}-${m}`))}):void 0,x=_&&_.length>0?r.jsx("div",{className:Be.slotStack,children:_.map((g,m)=>r.jsx(b.Fragment,{children:g},`card-accordion-actions-${l}-${m}`))}):void 0,y=a.disabled||u;return r.jsx(k.CardAccordion,{...a,disabled:y,actionContent:x,children:f??null})},Rt={slotStack:"_slotStack_ivk5b_1"},Dt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c,colorId:n,disabled:d,actionType:a,dataSource:u,redirectUrl:h,dependencies:_}=e,{getNextUI:f,fetchDataSource:x,fetchAndGetNextUI:y}=K(),{disabled:g}=B(t,_),m=d??g,p=A(t,s,c&&c.length>0?c:null),j=p&&p.length>0?r.jsx("div",{className:Rt.slotStack,children:p.map((w,E)=>r.jsx(b.Fragment,{children:w},`card-body-${l}-${E}`))}):null,C=b.useCallback(async()=>{var w,E,N;if(!(!a||m))try{const v={...(w=T.getState()[t])==null?void 0:w.entries,[i]:{status:200}};switch(M(t,v),a){case"CLOSE_MODAL":ne(t,!1);break;case"CLOSE_DRAWER":W(t,!1);break;case"OPEN_DRAWER":W(t,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const R=await f(t,s,v,i,a==="GO_TO_NEXT_UI");R!=null&&R.data&&L(t,R==null?void 0:R.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const S=await y(t,s,v,i,u);S!=null&&S.data&&L(t,S==null?void 0:S.data);break}case"GET_DATA_SOURCE":{const S=await f(t,s,v,i),R=(E=S==null?void 0:S.data)==null?void 0:E.content;if((R==null?void 0:R.type)!=="fetch")break;const U=R==null?void 0:R.dataSource,V=await x(U,t,!1),H={...(N=T.getState()[t])==null?void 0:N.entries,[i]:{status:V==null?void 0:V.status,content:V==null?void 0:V.data}};M(t,H);const I=await f(t,s,H,i);I!=null&&I.data&&L(t,I==null?void 0:I.data);break}case"REDIRECT":h&&(window.location.href=h);break;default:console.warn(`Unhandled card actionType: ${a}`)}}catch(v){alert(JSON.stringify(v))}},[a,u,m,y,x,f,s,h,i,t]);return r.jsx(k.Card,{colorId:n,disabled:m,onClick:a&&!m?()=>void C():void 0,children:j})},Lt=e=>{const{content:t,description:s,...o}=e,l={...o,children:t??s};return r.jsx(k.CardNotification,{...l})},Mt=(e,t,s)=>{const{url:o,paginationKeys:l,params:i}=e,c=[],n=(l==null?void 0:l.page)??"page";if(c.push(`${n}=${t}`),typeof s=="string"){const u=(l==null?void 0:l.text)??"text";c.push(`${u}=${encodeURIComponent(s||"")}`)}if(i&&typeof i=="object"){const u=Object.entries(i).map(([h,_])=>`${encodeURIComponent(h)}=${encodeURIComponent(_)}`);c.push(...u)}const d=c.join("&");return d?`${o}?${d}`:o},me=(e,t,s,o)=>{const{type:l,url:i,method:c,headers:n}=e;if(l==="rest"){const d=Mt(e,t,s),u={...(e==null?void 0:e.data)??{},...o??{}};return{type:"rest",url:d,method:c,headers:n,data:u}}else return{type:"graphql",url:i,method:"post",headers:n,query:e==null?void 0:e.query,variables:{...(e==null?void 0:e.variables)||{},...typeof s=="string"?{text:s}:{},page:t}}},ye=e=>Array.isArray(e)?e:typeof e=="object"?JSON.stringify(e):e,It=(e,t)=>{if(!t||e==null)return null;const{extractionJsonPath:s,injectionJsonPath:o}=t,l=G.value(e,s);if(l==null)return null;try{const i={};return G.value(i,o,l),i}catch(i){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",o,i),null}},Ge=(e,t,s,o)=>{const l=G.query(e,t),i=l==null?void 0:l.map(a=>{var u,h;if(s){const _={};for(const[f,x]of Object.entries(s))if(typeof x=="object"&&"path"in x){const y=x,g=(u=G.query(a,y.path))==null?void 0:u[0];y.translations&&String(g)in y.translations?_[f]=ye(y.translations[String(g)]):_[f]=ye(g)}else{const y=x;_[f]=ye((h=G.query(a,y))==null?void 0:h[0])}return _}else return a}),c=G.value(e,(o==null?void 0:o.size)??"$.meta.size")??l.length,n=G.value(e,(o==null?void 0:o.total)??"$.meta.total")??0,d={size:c,total:n,totalPages:o!=null&&o.totalPages?G.value(e,(o==null?void 0:o.totalPages)??"$.meta.totalPages"):c>0?Math.ceil(n/c):0};return{items:i,pagination:d}},ae=({withPadding:e=!1})=>{const t=s=>r.jsx("span",{style:{color:q.labelColor},children:s});return r.jsx(D.Legend,{formatter:t,wrapperStyle:{fontSize:q.fontSize,fontFamily:q.fontFamily,padding:e?"1rem 0":"0"}})},Bt=({active:e,payload:t,label:s,tooltipKey:o})=>{var i;if(!e||!t||!t.length)return null;const l={backgroundColor:q.tooltipBg,borderRadius:q.tooltipBorderRadius,color:q.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(o){const c=(i=t[0])==null?void 0:i.payload;if(c&&c[o]!==void 0&&c[o]!==null)return r.jsx("div",{style:l,children:r.jsx("p",{style:{margin:0},children:c[o]})})}return r.jsxs("div",{style:l,children:[r.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:s}),t.map((c,n)=>r.jsx("p",{style:{margin:"2px 0",color:c.color},children:`${c.name}: ${c.value}`},n))]})},oe=({tooltipKey:e}={})=>r.jsx(D.Tooltip,{content:r.jsx(Bt,{tooltipKey:e})}),ge=({dataKey:e,hide:t=!1})=>r.jsx(D.XAxis,{dataKey:e,hide:t,tick:{fill:q.labelColor,fontSize:q.fontSize}}),xe=()=>r.jsx(D.YAxis,{tick:{fill:q.labelColor,fontSize:q.fontSize}}),Gt={area:e=>{const{data:t,xKey:s,yKeys:o,tooltipKey:l}=e;return r.jsx(D.ResponsiveContainer,{width:"100%",height:400,children:r.jsxs(D.AreaChart,{data:t,children:[r.jsx(D.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(ge,{dataKey:s}),r.jsx(xe,{}),r.jsx(oe,{tooltipKey:l}),r.jsx(ae,{}),o.map((i,c)=>r.jsx(D.Area,{type:"monotone",dataKey:i,stroke:J[c%J.length],fill:J[c%J.length]},i))]})})},bar:e=>{const{data:t,yKeys:s,xKey:o,tooltipKey:l}=e;return r.jsx(D.ResponsiveContainer,{width:"100%",height:400,children:r.jsxs(D.BarChart,{data:t,children:[r.jsx(D.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(ge,{hide:!0,dataKey:o}),r.jsx(xe,{}),r.jsx(oe,{tooltipKey:l}),r.jsx(ae,{withPadding:!0}),s.map((i,c)=>r.jsx(D.Bar,{dataKey:i,fill:J[c%J.length]},i))]})})},line:e=>{const{data:t,xKey:s,yKeys:o,tooltipKey:l}=e;return r.jsx(D.ResponsiveContainer,{width:"100%",height:400,children:r.jsxs(D.LineChart,{data:t,children:[r.jsx(D.CartesianGrid,{strokeDasharray:"3 3"}),r.jsx(ge,{dataKey:s}),r.jsx(xe,{}),r.jsx(oe,{tooltipKey:l}),r.jsx(ae,{}),o.map((i,c)=>r.jsx(D.Line,{type:"monotone",dataKey:i,stroke:J[c%J.length],strokeWidth:2,dot:!1},i))]})})},pie:e=>{const{data:t,xKey:s,yKeys:o,tooltipKey:l}=e,i=({cx:c,cy:n,midAngle:d,innerRadius:a,outerRadius:u,value:h})=>{const _=Math.PI/180,f=25+a+(u-a),x=c+f*Math.cos(-(d??0)*_),y=n+f*Math.sin(-(d??0)*_);return r.jsx("text",{x,y,fill:q.labelColor,color:q.labelColor,textAnchor:"middle",dominantBaseline:"central",children:h})};return r.jsx(D.ResponsiveContainer,{width:"100%",height:400,children:r.jsxs(D.PieChart,{children:[r.jsx(oe,{tooltipKey:l}),r.jsx(ae,{}),r.jsx(D.Pie,{data:t,dataKey:o[0],nameKey:s,label:i,outerRadius:120,children:t.map((c,n)=>r.jsx(D.Cell,{fill:J[n%J.length]},`cell-${n}`))})]})})}},J=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],q={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},Ke=e=>{const{component:t,userFlow:s,hash:o,responseKey:l,dataSource:i,...c}=e,n=Gt[c.type];if(!n)return r.jsx("div",{children:"Not supported chart type"});const{fetchDataSource:d}=K(),[a,u]=b.useState(!1),[h,_]=b.useState([]),f=async()=>{var y,g;try{u(!0);const{jsonPathData:m,mapperData:p}=i,j=me(i,1),C=await d(j,s,!1),w=m?(y=Ge(C==null?void 0:C.data,m,p))==null?void 0:y.items:(g=C==null?void 0:C.data)==null?void 0:g.data;_(w),u(!1)}catch(m){alert(JSON.stringify(m)),u(!1)}};b.useEffect(()=>{i?f():_(c.data)},[]);const x={...c,data:h};return a?r.jsx(k.SkeletonBase,{height:400}):h.length>0?n(x):r.jsx(k.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})},Kt=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=e,u={...a},{getNextUI:h}=K(),[_,f]=b.useState(c||!1),{disabled:x}=B(t,d),y=b.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),g=b.useCallback(async()=>{var p;try{const j=!_;f(j);const C={...(p=T.getState()[t])==null?void 0:p.entries,[o]:j};switch(M(t,C),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const E=await h(t,s,C,o,l==="GO_TO_NEXT_UI");E!=null&&E.data&&L(t,E==null?void 0:E.data);break}default:break}}catch(j){console.error("Error in checkbox action:",j),alert(JSON.stringify(j))}},[t,s,o,l,_]),m=(u==null?void 0:u.disabled)??x;return r.jsx(k.Checkbox,{...u,labelRight:y,checked:_,disabled:m,onChange:()=>{!m&&g()}})},$={codeEditor:"_codeEditor_1wi2p_1",codeEditor_label:"_codeEditor_label_1wi2p_4",codeEditor_wrapper:"_codeEditor_wrapper_1wi2p_13",input:"_input_1wi2p_17",preview:"_preview_1wi2p_18",preview_inner:"_preview_inner_1wi2p_33"},Ut=e=>{const{userFlow:t,responseKey:s,label:o,language:l,placeholder:i,value:c,required:n,dependencies:d,disabled:a,showPreview:u,height:h="400px"}=e,[_,f]=b.useState(c??""),x=k.ThemeStore.useThemeStore(C=>C.theme.mode),{disabled:y}=B(t,d),g=a??y,m={json:je.json(),markdown:Pe.markdown(),sql:et.sql(),yaml:tt.yaml()},p=b.useMemo(()=>n&&o?`${o} *`:o??"",[o,n]),j=C=>{f(C);const w={[s]:C};M(t,w)};return r.jsxs("div",{className:$.codeEditor,children:[p&&p!==""&&r.jsx("label",{className:$.codeEditor_label,children:p}),r.jsxs("div",{className:$.codeEditor_wrapper,children:[r.jsx($e,{className:$.input,value:_,height:h,placeholder:i,extensions:[m[l]??je.json()],onChange:C=>j(C),theme:x,editable:!g}),l==="markdown"&&u&&r.jsx("div",{className:$.preview,style:{height:h},children:r.jsx(k.PreviewerMarkdown,{className:$.preview_inner,children:_})})]})]})},Ue={slotStack:"_slotStack_6n2wy_5"},zt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c,topContent:n,icon:d,headerStatusColor:a,...u}=e,h=a?`palette_${a}_50`:void 0,_=A(t,s,c&&c.length>0?c:null),f=A(t,s,n&&n.length>0?n:null),x=_&&_.length>0?r.jsx("div",{className:Ue.slotStack,children:_.map((g,m)=>r.jsx(b.Fragment,{children:g},`data-card-body-${l}-${m}`))}):void 0,y=f&&f.length>0?r.jsx("div",{className:Ue.slotStack,children:f.map((g,m)=>r.jsx(b.Fragment,{children:g},`data-card-top-${l}-${m}`))}):void 0;return r.jsx(k.DataCard,{...u,icon:d,headerStatusColor:h,topContent:y,children:x})},qt={dividerNotFront:"_dividerNotFront_tze3j_1"},Vt=e=>r.jsx(k.Divider,{...e,className:qt.dividerNotFront}),be={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},Jt=({userFlow:e,pageId:t,responseKey:s,header:o,body:l,footer:i,...c})=>{const n=T(y=>{var g;return(g=y[e])==null?void 0:g.isDrawerOpen}),d=T(y=>{var g;return(g=y[e])==null?void 0:g.isLoading}),a=n&&!d,u={...c,isOpen:a,children:null},h=b.useCallback(()=>{ie(e),W(e,!1)},[e]),_=Array.isArray(o)?A(e,t,o):o?r.jsx(k.Heading,{type:"h2",children:o}):void 0,f=A(e,t,l),x=i?A(e,t,i):void 0;return r.jsx(k.Drawer,{...u,className:be.drawer,isOpen:a,onClose:h,heightGap:0,title:_?r.jsx(r.Fragment,{children:Array.isArray(_)?_.map((y,g)=>r.jsx(b.Fragment,{children:y},`drawer-header-${g}`)):_}):void 0,children:r.jsx("section",{className:be.drawerBody,children:f.map((y,g)=>r.jsx(b.Fragment,{children:y},`drawer-body-${g}`))}),footer:x?r.jsx("div",{className:be.drawerFooter,children:x.map((y,g)=>r.jsx(b.Fragment,{children:y},`drawer-footer-${g}`))}):void 0})},Xt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c,items:n,disabled:d,variant:a,leftIcon:u,rightIcon:h}=e,_=fe(t,s),f=b.useMemo(()=>n.map(x=>({label:x.content??x.label??"",onClick:()=>{_({responseKey:x.responseKey,actionType:x.actionType,dataSource:x.dataSource,redirectUrl:x.redirectUrl,dependencies:x.dependencies})}})),[n,_]);return r.jsx(k.DropdownButton,{disabled:d,variant:a,items:f,children:r.jsxs(b.Fragment,{children:[u?r.jsx(Ce.Icon,{name:u,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,c,h?r.jsx(Ce.Icon,{name:h,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},ze={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},Ht=({components:e=[]})=>r.jsx("section",{className:Z(ze.header,"avocado-dark-theme"),children:r.jsx("div",{className:ze.header_content,children:e.map((t,s)=>r.jsx(b.Fragment,{children:t},s))})}),Wt=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,content:i,redirectUrl:c,target:n,dependencies:d,component:a,hash:u,...h}=e,{getNextUI:_}=K(),{disabled:f}=B(t,d),x=l&&h?(()=>{const{href:m,target:p,download:j,...C}=h;return C})():h,y=b.useCallback(async()=>{var m;if(l)try{const p={...(m=T.getState()[t])==null?void 0:m.entries,[o]:{status:200}};switch(M(t,p),l){case"GO_TO_NEXT_UI":{const j=await _(t,s,p,o);j!=null&&j.data&&L(t,j==null?void 0:j.data);break}case"REDIRECT":if(!c){console.warn("Missing redirectUrl for REDIRECT actionType");break}n==="_blank"?window.open(c,"_blank","noopener,noreferrer"):window.location.assign(c);break;default:console.warn(`Unhandled actionType for link: ${l}`);break}}catch(p){alert(JSON.stringify(p))}},[l,_,s,c,o,n,t]),g=x.disabled??f;return r.jsx(k.Link,{...x,disabled:g,onClick:l?y:void 0,children:i})},Qt=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,items:c,closeOnClick:n,disabled:d,listOrigin:a,size:u,variant:h}=e,_=fe(t,s),f=b.useMemo(()=>c.map(x=>({icon:x.leftIcon,label:x.content??x.label??"",onClick:y=>{var g;(g=y==null?void 0:y.preventDefault)==null||g.call(y),_({responseKey:x.responseKey,actionType:x.actionType,dataSource:x.dataSource,redirectUrl:x.redirectUrl,dependencies:x.dependencies})}})),[c,_]);return r.jsx(k.Menu,{items:f,closeOnClick:n,disabled:d,listOrigin:a,size:u,variant:h})},Yt={modalContent:"_modalContent_p06ci_1"},Zt=({userFlow:e,pageId:t,responseKey:s,header:o,body:l,footer:i,headerStatusColor:c,...n})=>{const d=T(m=>{var p;return(p=m[e])==null?void 0:p.isModalOpen}),a=T(m=>{var p;return(p=m[e])==null?void 0:p.isLoading}),u=d&&!a,h={...n},_=(h==null?void 0:h.headerStatusColor)??c,f=b.useCallback(()=>{ie(e),ne(e,!1)},[e,s]),x=Array.isArray(o)?A(e,t,o):o,y=A(e,t,l),g=A(e,t,i);return r.jsx(k.Modal,{...h,headerStatusColor:_,header:typeof x=="string"?x:r.jsx(r.Fragment,{children:x.map((m,p)=>r.jsx(b.Fragment,{children:m},`modal-header-${p}`))}),children:r.jsx("section",{className:Yt.modalContent,children:y.map((m,p)=>r.jsx(b.Fragment,{children:m},`modal-body-${p}`))}),actions:r.jsx(r.Fragment,{children:g.map((m,p)=>r.jsx(b.Fragment,{children:m},`modal-footer-${p}`))}),open:u,onClose:f})},Ft=({userFlow:e,pageId:t})=>{var i,c;const s=at(e);if(!s)return null;const o=[...(s==null?void 0:s.components)||[],...((i=s==null?void 0:s.header)==null?void 0:i.components)||[],...((c=s==null?void 0:s.body)==null?void 0:c.components)||[]],l=A(e,t,o);return r.jsx(r.Fragment,{children:l==null?void 0:l.map((n,d)=>{const a=`overlay-${d}-${s==null?void 0:s.hash}`;return r.jsx(b.Fragment,{children:n},a)})})},$t={success:{color:"success-opacity",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-opacity",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-opacity",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-10",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-10",textColor:"neutral-70",iconColor:"neutral-70"}},Pt=e=>{const{content:t,variant:s="neutral",...o}=e,l=$t[s],i={...o,children:t,color:(o==null?void 0:o.color)??l.color,textColor:(o==null?void 0:o.textColor)??l.textColor,iconColor:(o==null?void 0:o.iconColor)??l.iconColor};return r.jsx(k.Pill,{...i})},en=e=>{const{content:t}=e;return r.jsx(k.PreviewerMarkdown,{children:t})},tn=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,dataSource:i,dependencies:c,onClick:n,...d}=e,{getNextUI:a,fetchAndGetNextUI:u}=K(),{disabled:h}=B(t,c),_={...d},f=(_==null?void 0:_.disabled)??h,x=b.useCallback(async()=>{var y;try{const g={...(y=T.getState()[t])==null?void 0:y.entries,[o]:{status:200}};switch(M(t,g),l){case"GO_TO_NEXT_UI":{const m=await a(t,s,g,o);m!=null&&m.data&&L(t,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await u(t,s,g,o,i);m!=null&&m.data&&L(t,m==null?void 0:m.data);break}case"CLOSE_MODAL":ne(t,!1);break;case"CLOSE_DRAWER":W(t,!1);break;case"OPEN_DRAWER":W(t,!0);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(g){alert(JSON.stringify(g))}},[l,i,s,o,t]);return r.jsx(k.RoundButton,{..._,disabled:f,onClick:()=>!f&&(n??x)()})},X={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},qe=e=>{const{userFlow:t,pageId:s,columnWidth:o,columns:l,gap:i="md",justifyContent:c="start",alignItems:n="stretch"}=e,d=Array.isArray(l)?l.map((a,u)=>{const h=`col_${u}`,_=`col_${u}`;if(Array.isArray(a))return{gap:"md",justifyContent:"start",alignItems:"start",items:a,hash:h,responseKey:_};const f=a;return{gap:(f==null?void 0:f.gap)??"md",justifyContent:(f==null?void 0:f.justifyContent)??"start",alignItems:(f==null?void 0:f.alignItems)??"start",items:(f==null?void 0:f.items)??[],hash:(f==null?void 0:f.hash)??h,responseKey:(f==null?void 0:f.responseKey)??_}}):[];return d.length===0?null:r.jsx("div",{className:Z(X.row,X[`row__gap-${i}`],X[`row__justify-${c}`],X[`row__align-${n}`]),children:d==null?void 0:d.map((a,u)=>{const h=(o==null?void 0:o[u])||`${100/d.length}%`,_=A(t,s,a.items);return!_||_.length===0?null:r.jsx("div",{className:Z(X.row_column,X[`row_column__gap-${a.gap}`],X[`row_column__justify-${a.justifyContent}`],X[`row_column__align-${a.alignItems}`]),style:{width:h},children:_},a.hash||u)})})};function Ve({userFlow:e,pageId:t,responseKey:s,actionType:o,getNextUI:l,isMulti:i=!1,debounceMs:c}){const n=b.useRef(null);b.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=b.useCallback(async u=>{var f;const h={...(f=T.getState()[e])==null?void 0:f.entries};if(u?(h[s]=u,M(e,h)):(delete h[s],ot(e,s)),o&&(o==="GO_TO_NEXT_UI"||o==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const y=await l(e,t,h,s,o==="GO_TO_NEXT_UI");y!=null&&y.data&&L(e,y.data)}catch(x){console.error("[useSelectChange] Failed to fetch next UI",x)}},[e,t,s,o,l]);return b.useCallback(u=>{if(!i){d(u);return}if(c==null){d(u);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{d(u),n.current=null},c)},[i,c,d])}const nn=/\{([^}]+)\}/g,sn=(e,t)=>{var s;return t.includes("{")?t.replace(nn,(o,l)=>{var c;const i=(c=G.query(e,l.trim()))==null?void 0:c[0];return i!=null?String(i):""}):(s=G.query(e,t))==null?void 0:s[0]},an=(e,t,s,o)=>{const l=G.query(e,t);return(l==null?void 0:l.map(i=>{var d;const c=sn(i,s),n=o?(d=G.query(i,o))==null?void 0:d[0]:i;return{label:c,value:n}}))??[]},on=(e,t,s,o=10)=>{var n,d;let l,i;if(s){const a=G.value(e,s.size??"$.meta.size")??o,u=G.value(e,s.total??"$.meta.total")??0;l=a,i=u}else{const a=e==null?void 0:e.meta;l=(a==null?void 0:a.size)??((n=a==null?void 0:a.page)==null?void 0:n.size)??o,i=(a==null?void 0:a.total)??((d=a==null?void 0:a.page)==null?void 0:d.total)??0}const c=i>0?Math.ceil(i/l)>t:!1;return{pageSize:l,total:i,hasMore:c}},Je={selectNotFront:"_selectNotFront_ch3v5_1"},rn=({userFlow:e,pageId:t,responseKey:s,required:o,dataSource:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:u,fetchDataSource:h}=K(),[_,f]=b.useState((a==null?void 0:a.value)??""),{disabled:x}=B(e,c),y=(a==null?void 0:a.disabled)??x,g=b.useMemo(()=>o&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,o]),m=b.useMemo(()=>{const w=a!=null&&a.isMulti?_:[_],E={};return Array.isArray(w)&&w.forEach(N=>{if(!N)return;const v=JSON.stringify(N.value),S=JSON.stringify(N.label);E[v]=N,S in E||(E[S]=N)}),E},[_]),p=Ve({userFlow:e,pageId:t,responseKey:s,actionType:i,getNextUI:u,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),j=w=>{f(w),p(w)},C=async(w,E,{page:N})=>{const{jsonPathLabel:v,jsonPathOptions:S,jsonPathValue:R,jsonPathPagination:U}=l,V=me(l,N,w),H=await h(V,e,!1),I=H==null?void 0:H.data,re=I?an(I,S,v,R):[],{hasMore:Sn}=on(I,N,U);return{options:re,hasMore:Sn,additional:{page:N+1}}};return r.jsx(k.SelectPagination,{...a,className:Je.selectNotFront,label:g,value:_,disabled:y,noOptionsMessage:()=>r.jsx(r.Fragment,{children:"Sin opciones"}),onChange:w=>!y&&j(w),loadOptions:C,additional:{page:1},isOptionDisabled:w=>{const E=JSON.stringify(w==null?void 0:w.value),N=JSON.stringify(w==null?void 0:w.label);return!!(m!=null&&m[E])||!!(m!=null&&m[N])},debounceTimeout:350})},cn=({userFlow:e,pageId:t,responseKey:s,dataSource:o,required:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:u}=K(),[h,_]=b.useState(a.value||""),{disabled:f}=B(e,c),x=(a==null?void 0:a.disabled)??f,y=b.useMemo(()=>l&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,l]),g=Ve({userFlow:e,pageId:t,responseKey:s,actionType:i,getNextUI:u,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),m=p=>{_(p),g(p)};return r.jsx(k.Select,{...a,className:Je.selectNotFront,label:y,value:h,disabled:x,onChange:p=>!x&&m(p)})},ln=e=>{const{dataSource:t}=e;return t?r.jsx(rn,{...e}):r.jsx(cn,{...e})},Xe={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},dn=e=>{const{size:t}=e,s=Z(Xe.spacing,Xe[`spacing__${t}`]);return r.jsx("div",{className:s})},_n=e=>{const{userFlow:t,pageId:s,responseKey:o,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=e,u={...a},{getNextUI:h}=K(),[_,f]=b.useState(c||!1),{disabled:x}=B(t,d),y=(u==null?void 0:u.disabled)??x,g=b.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),m=b.useCallback(async()=>{var p;try{const j=!_;f(j);const C={...(p=T.getState()[t])==null?void 0:p.entries,[o]:j};switch(M(t,C),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const E=await h(t,s,C,o,l==="GO_TO_NEXT_UI");E!=null&&E.data&&L(t,E==null?void 0:E.data);break}default:break}}catch(j){console.error("Error in switch action:",j),alert(JSON.stringify(j))}},[t,s,o,l,_]);return r.jsx(k.Switch,{...u,label:g,checked:_,disabled:y,onChange:()=>!y&&m()})},He={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},un=({values:e})=>{const s=e==null?void 0:e.slice(0,4),o=(e==null?void 0:e.length)-4;return r.jsxs("div",{className:He.tableArrayPills,children:[s.map((l,i)=>r.jsx(k.Pill,{children:String(l)},i)),o>0&&r.jsxs(k.Pill,{outlined:!0,children:["+",o]})]})},hn=({userFlow:e,pageId:t,tableResponseKey:s,component:o,rowData:l})=>{const{getNextUI:i,fetchAndGetNextUI:c,fetchDataSource:n}=K(),d=A(e,t,[{...o}]),a=(d==null?void 0:d[0])||null;if(!a)return null;const{actionType:u,responseKey:h,dataSource:_}=a.props,f=b.useCallback(async()=>{var x,y,g;try{const m={...(x=T.getState()[e])==null?void 0:x.entries,[h]:{status:200},[s]:[{...l}]};switch(M(e,m),u){case"GO_TO_NEXT_UI":{const p=await i(e,t,m,h);p!=null&&p.data&&L(e,p==null?void 0:p.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const p=await c(e,t,m,h,_);p!=null&&p.data&&L(e,p==null?void 0:p.data);break}case"GET_DATA_SOURCE":{const p=await i(e,t,m,h),j=(y=p==null?void 0:p.data)==null?void 0:y.content;if((j==null?void 0:j.type)!=="fetch")break;const C=j==null?void 0:j.dataSource,w=await n(C,e,!1),E={...(g=T.getState()[e])==null?void 0:g.entries,[h]:{status:w==null?void 0:w.status,content:w==null?void 0:w.data}};M(e,E);const N=await i(e,t,E,h);N!=null&&N.data&&L(e,N==null?void 0:N.data);break}default:console.warn(`Unhandled actionType: ${u}`);break}}catch(m){alert(JSON.stringify(m))}},[u,_,t,h,e]);return b.cloneElement(a,{onClick:f})},fn=()=>r.jsx("div",{className:He.tableSkeleton,children:[...Array(10)].map((e,t)=>r.jsx(k.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${t}`))}),mn=({userFlow:e,pageId:t,responseKey:s,component:o,dataSource:l,rightActions:i,...c})=>{var C,w,E;const{fetchDataSource:n}=K(),[d,a]=b.useState(!1),[u,h]=b.useState(1),[_,f]=b.useState(null),x=b.useRef(new Map([[1,null]])),y=b.useMemo(()=>{if(i!=null&&i.length)return i.map((N,v)=>({renderContent:S=>r.jsx(hn,{userFlow:e,pageId:t,tableResponseKey:s,component:N,rowData:S},`tableRowAction${v}`)}))},[i,e,t]),g=async(N=1)=>{const{mapperData:v,jsonPathData:S,jsonPathPagination:R,jsonPathCursorPagination:U}=l;if(U&&N!==1&&!x.current.has(N)){h(1),g(1);return}U&&N===1&&(x.current=new Map([[1,null]]));try{a(!0);const V=U?x.current.get(N)??null:null,H=me(l,N,void 0,V),I=await n(H,e,!1);if(f(Ge(I==null?void 0:I.data,S,v,R)),U){const re=It(I==null?void 0:I.data,U);re&&x.current.set(N+1,re)}a(!1)}catch(V){console.error("[TableNotFront] fetchData:",V),a(!1)}},m=N=>{h(N),g(N)};b.useEffect(()=>{g()},[]);const p=b.useMemo(()=>!(_!=null&&_.items)||!(c!=null&&c.columns)?c==null?void 0:c.columns:c.columns.map(N=>{var S;return((S=_==null?void 0:_.items)==null?void 0:S.some(R=>Array.isArray(N!=null&&N.accessor?R[N==null?void 0:N.accessor]:void 0)))?{...N,renderCell:R=>{const U=N.accessor?R[N.accessor]:void 0;return Array.isArray(U)?r.jsx(un,{values:U}):U??""}}:N}),[_==null?void 0:_.items,c==null?void 0:c.columns]),j={...c,data:_==null?void 0:_.items,columns:p,rightActions:y};return r.jsx(r.Fragment,{children:d?r.jsx(fn,{}):_&&((C=_==null?void 0:_.items)==null?void 0:C.length)>0?r.jsxs(r.Fragment,{children:[r.jsx(k.Table,{...j}),(_==null?void 0:_.pagination)&&((w=_==null?void 0:_.pagination)==null?void 0:w.totalPages)>1&&r.jsx(k.Pager,{classname:{global:"row__end"},page:u,size:_==null?void 0:_.pagination.size,total:(E=_==null?void 0:_.pagination)==null?void 0:E.total,onChange:m})]}):r.jsx(k.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},yn={tabsPanel:"_tabsPanel_kvslb_1"},gn=({userFlow:e,pageId:t,components:s})=>{const o=A(e,t,s);return o!=null&&o.length?r.jsx("section",{className:yn.tabsPanel,children:o.map((l,i)=>r.jsx(b.Fragment,{children:l},`tabs-panel-${i}`))}):null},xn=({userFlow:e,pageId:t,hash:s,items:o,activeIndex:l,className:i,responseKey:c})=>{const n=o.map((a,u)=>({label:a.label,disabled:a.disabled,children:r.jsx(gn,{userFlow:e,pageId:t,components:a.components},`${s}-tab-${u}`)})),d=a=>{var h;const u={...(h=T.getState()[e])==null?void 0:h.entries,[c]:a};M(e,u)};return r.jsx(k.Tabs,{className:i,activeIndex:l,items:n,onClick:d})},bn=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,required:c,dependencies:n,...d}=e,a={...d},[u,h]=b.useState((a==null?void 0:a.value)??""),{disabled:_}=B(t,n),f=(a==null?void 0:a.disabled)??_,x=b.useMemo(()=>c&&(a!=null&&a.label)?`${a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),y=g=>{var p;const m=(p=g==null?void 0:g.target)==null?void 0:p.value;h(m),M(t,{[i]:m})};return b.useEffect(()=>{h((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),r.jsx(k.Textarea,{...a,label:x,value:u,disabled:f,onChange:g=>!f&&y(g)})},pn={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},jn=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,required:c,dependencies:n,...d}=e,a={...d},[u,h]=b.useState((a==null?void 0:a.value)??""),{disabled:_}=B(t,n),f=(a==null?void 0:a.disabled)??_,x=b.useMemo(()=>c&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),y=g=>{var j;const m=(j=g==null?void 0:g.target)==null?void 0:j.value;h(m);const p={[i]:m};M(t,p)};return b.useEffect(()=>{h((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),r.jsx(k.TextField,{...a,className:pn.textFieldNotFront,allowClear:!1,label:x,value:u,disabled:f,onChange:g=>!f&&y(g)})},Cn=({userFlow:e,pageId:t,responseKey:s,variant:o,content:l,actionType:i,redirectUrl:c})=>{const n=b.useCallback(async()=>{ie(e);try{switch(i){case"AUTOCLOSE_AND_REDIRECT":window.location.href=c;break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(d){console.error("Error in toast action:",d),alert(JSON.stringify(d))}},[i,t,s,e,c]);return b.useEffect(()=>{({info:k.toast.info,error:k.toast.error,success:k.toast.success,warning:k.toast.warning}[o]||k.toast.info)(l,{autoClose:i?!1:4e3,containerId:e,onClose:n})},[n,e]),null},We={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},wn=e=>{const{userFlow:t,pageId:s,component:o,hash:l,responseKey:i,content:c,label:n,placement:d,notShowArrow:a,visible:u}=e,h=A(t,s,c!=null&&c.length?c:null),_=h&&h.length>0?r.jsx("div",{className:We.tooltipNotFront_content,children:h.map((f,x)=>r.jsx(b.Fragment,{children:f},`tooltip-${l}-${x}`))}):null;return r.jsx(k.Tooltip,{className:We.tooltipNotFront,label:n,placement:d,notShowArrow:a,visible:u,children:_})};function Nn({routes:e,renderPage:t,renderFallback:s,redirectTo:o="/"}){return r.jsxs(te.Routes,{children:[e.map(l=>r.jsx(te.Route,{path:l.path,element:l.canAccess?t(l.sessionName):(s==null?void 0:s())??null},`${l.path}:${l.sessionName}`)),r.jsx(te.Route,{path:"*",element:r.jsx(te.Navigate,{to:o,replace:!0})})]})}function kn({sessionName:e,apiConfig:t,onResolveComponentProps:s,children:o}){const l=Ye(e,t,null,s);return r.jsxs(r.Fragment,{children:[l,o]})}const Qe=(e,t,s,o,l)=>{const i=A(e,t,(o==null?void 0:o.components)||null,l);switch(s){case"body":return r.jsx(Ct,{...o,inputs:i||[]},JSON.stringify(o==null?void 0:o.components));case"header":return r.jsx(Ht,{...o,components:i||[]},JSON.stringify(o==null?void 0:o.components));default:return null}},Ye=(e,t,s,o)=>{var _,f,x;const[l,i]=b.useState(!1),c=T(y=>y),n=(_=c[e])==null?void 0:_.currentPageId;b.useEffect(()=>{if(typeof window>"u")return;const y=new URL(window.location.href),g=y.searchParams.get("sessionId");g&&(sessionStorage.setItem("sessionId",g),y.searchParams.delete("sessionId"),window.history.replaceState({},"",y.toString()))},[]);const d=n?Qe(e,n,"header",((f=c[e].pages[n].page)==null?void 0:f.header)||null,o):null,a=n?Qe(e,n,"body",((x=c[e].pages[n].page)==null?void 0:x.body)||null,o):null,u=b.useMemo(()=>{var y;return r.jsxs(r.Fragment,{children:[((y=c[e])==null?void 0:y.isLoading)&&r.jsx(k.Loading,{}),d,a,n&&r.jsx(Ft,{userFlow:e,pageId:n}),c[e]&&r.jsx(k.Toaster,{})]})},[d,a,n,e]),h=async()=>{try{const y=await De(t,e),g=y==null?void 0:y.data,m=g==null?void 0:g.content;(y==null?void 0:y.status)===200?le(e,t,m,g==null?void 0:g.sessionState):i(!0)}catch(y){console.error("[not-page]: API call failed",y),i(!0)}};return b.useEffect(()=>{t!=null&&t.api&&!s&&e?h():!(t!=null&&t.api)&&s&&e||t!=null&&t.api&&s&&e?le(e,t,s):(!(t!=null&&t.api)&&!s||!e)&&(i(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const y="avocado-theme-mode-changed",g=m=>{const p=m.detail;k.ThemeStore.setThemeMode(p)};return window.addEventListener(y,g),()=>{window.removeEventListener(y,g)}},[]),l&&console.error("[not-page]: No render page"),u};function Ze(e){const t=e.replace(/\/{2,}/g,"/");return!t||t==="/"?"/":t.replace(/\/+$/,"")}function En(e,t){return t.requiredPermissions.length===0?!0:t.requiredPermissions.some(s=>e.includes(s))}function pe(e,t){return e===t||e.startsWith(`${t}/`)}function Tn(e,t){return e.filter(s=>pe(s.path,t))}function On(e,t){const s=Ze(e);return pe(s,t)?s.slice(t.length)||"/":s}O.Chart=Ke,O.NotFrontDynamicRouter=Nn,O.NotFrontPage=kn,O.Row=qe,O.heading=Se,O.normalizePathname=Ze,O.pathBelongsToPrefix=pe,O.selectDynamicRoutesUnderPrefix=Tn,O.stripPrefixFromPathname=On,O.text=ve,O.usePage=Ye,O.userCanAccessDynamicRoute=En,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foris/avocado-not-front",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"recharts": "3.1.0",
|
|
52
52
|
"zustand": "4.5.4",
|
|
53
53
|
"@uiw/react-codemirror": "4.23.12",
|
|
54
|
-
"@foris/avocado-core": "1.3.0",
|
|
55
|
-
"@foris/avocado-icons": "1.16.6",
|
|
56
54
|
"@foris/ai-agent": "1.0.7",
|
|
57
|
-
"@foris/
|
|
58
|
-
"@foris/avocado-suite": "1.8.12"
|
|
55
|
+
"@foris/avocado-icons": "1.16.6",
|
|
56
|
+
"@foris/avocado-suite": "1.8.12",
|
|
57
|
+
"@foris/avocado-core": "1.3.0",
|
|
58
|
+
"@foris/tsconfig": "0.0.2"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@codemirror/lang-json": ">=6.0.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"streamdown": ">=1.6.0",
|
|
75
75
|
"zustand": ">=4.0.0",
|
|
76
76
|
"@foris/ai-agent": "1.0.7",
|
|
77
|
-
"@foris/avocado-core": "1.3.0",
|
|
78
77
|
"@foris/avocado-icons": "1.16.6",
|
|
78
|
+
"@foris/avocado-core": "1.3.0",
|
|
79
79
|
"@foris/avocado-suite": "1.8.12"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|