treege 3.0.0-beta.89 → 3.0.0-beta.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { B as e, D as t, E as n, G as r, H as i, J as a, K as o, N as s, O as c, R as l, V as u, W as d, Y as f, _ as p, d as m, f as h, g, h as _, k as v, n as y, q as b, t as x, y as S } from "./ThemeContext-CiVygpDK.js";
2
- import { $ as C, A as w, B as T, D as E, E as D, F as O, G as ee, H as te, I as ne, J as k, K as A, L as re, M as ie, N as ae, O as oe, P as se, Q as j, R as ce, T as le, U as ue, V as de, W as M, X as fe, Y as N, Z as pe, at as P, ct as F, dt as I, et as me, f as he, it as ge, j as _e, k as ve, l as ye, lt as be, n as xe, nt as Se, ot as L, p as Ce, q as R, rt as we, s as Te, st as z, t as Ee, tt as De, ut as B, w as Oe, z as ke } from "./DefaultSubmitButton-BIjoDpUm.js";
1
+ import { B as e, D as t, E as n, H as r, J as i, K as a, N as o, O as s, U as c, W as l, X as u, Y as d, Z as f, _ as p, d as m, f as h, g, h as _, k as v, n as y, q as b, t as x, y as S } from "./ThemeContext-CPsC8QIP.js";
2
+ import { $ as C, A as w, B as T, D as E, E as D, F as O, G as ee, H as te, I as ne, J as k, K as A, L as re, M as ie, N as ae, O as oe, P as se, Q as j, R as ce, T as le, U as ue, V as de, W as M, X as fe, Y as N, Z as pe, at as P, ct as F, dt as I, et as me, f as he, it as ge, j as _e, k as ve, l as ye, lt as be, n as xe, nt as Se, ot as L, p as Ce, q as R, rt as we, s as Te, st as z, t as Ee, tt as De, ut as B, w as Oe, z as ke } from "./DefaultSubmitButton-NeSDqyzv.js";
3
3
  import { Background as Ae, BackgroundVariant as je, BaseEdge as Me, ControlButton as Ne, Controls as Pe, EdgeLabelRenderer as Fe, Handle as Ie, MiniMap as Le, Panel as Re, Position as ze, ReactFlow as Be, ReactFlowProvider as Ve, addEdge as He, getBezierPath as Ue, useConnection as We, useEdges as Ge, useNodes as Ke, useNodesInitialized as qe, useReactFlow as Je, useStore as Ye, useUpdateNodeInternals as Xe } from "@xyflow/react";
4
4
  import * as Ze from "react";
5
5
  import Qe, { createContext as $e, memo as et, useCallback as V, useContext as tt, useEffect as H, useId as nt, useMemo as U, useRef as rt, useState as W } from "react";
@@ -75,18 +75,18 @@ var Mn = "data:image/svg+xml,%3csvg%20width='462'%20height='144'%20viewBox='0%20
75
75
  setIsNodeSheetOpen: () => {},
76
76
  setLanguage: () => {}
77
77
  }, zn = (e) => {
78
- let t = Ke(), n = Ge(), { language: i } = Z();
78
+ let t = Ke(), n = Ge(), { language: r } = Z();
79
79
  return U(() => {
80
80
  if (!e) return [];
81
- let o = (e, t = /* @__PURE__ */ new Set()) => {
81
+ let i = (e, t = /* @__PURE__ */ new Set()) => {
82
82
  if (t.has(e)) return [];
83
83
  let r = new Set(t).add(e);
84
- return n.filter((t) => t.target === e).flatMap((e) => [e.source, ...o(e.source, r)]);
85
- }, s = o(e);
86
- return t.filter((e) => s.includes(e.id) && a(e)).map((e) => {
84
+ return n.filter((t) => t.target === e).flatMap((e) => [e.source, ...i(e.source, r)]);
85
+ }, a = i(e);
86
+ return t.filter((e) => a.includes(e.id) && u(e)).map((e) => {
87
87
  let t = e.data;
88
88
  return {
89
- label: r(t.label, i) || t.name || e.id,
89
+ label: b(t.label, r) || t.name || e.id,
90
90
  name: t.name,
91
91
  nodeId: e.id,
92
92
  options: t.options,
@@ -97,7 +97,7 @@ var Mn = "data:image/svg+xml,%3csvg%20width='462'%20height='144'%20viewBox='0%20
97
97
  e,
98
98
  t,
99
99
  n,
100
- i
100
+ r
101
101
  ]);
102
102
  }, Bn = /* @__PURE__ */ new WeakMap(), Vn = (e, t) => e && t ? "middle" : e ? "last" : t ? "first" : "single", Hn = (e) => {
103
103
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
@@ -117,7 +117,7 @@ var Mn = "data:image/svg+xml,%3csvg%20width='462'%20height='144'%20viewBox='0%20
117
117
  return (i === "first" || i === "middle") && (a === "middle" || a === "last");
118
118
  }), Q = (e) => {
119
119
  let t = Z();
120
- return i(e ?? t.language);
120
+ return l(e ?? t.language);
121
121
  };
122
122
  //#endregion
123
123
  //#region src/shared/components/ui/scroll-area.tsx
@@ -211,12 +211,12 @@ var Zn = {
211
211
  ">": ">",
212
212
  ">=": "≥"
213
213
  }, Qn = (e) => !!e.field && e.value !== void 0 && e.value !== "", $n = (e, t) => e === void 0 ? "" : e[t] ?? e.en ?? "", er = {
214
- conditional: et(({ id: e, source: t, target: n, sourceX: r, sourceY: i, targetX: a, targetY: o, sourcePosition: s, targetPosition: c, markerEnd: l, style: d, data: f }) => {
214
+ conditional: et(({ id: e, source: t, target: n, sourceX: r, sourceY: i, targetX: a, targetY: o, sourcePosition: s, targetPosition: l, markerEnd: u, style: d, data: f }) => {
215
215
  let [p] = Ue({
216
216
  sourcePosition: s,
217
217
  sourceX: r,
218
218
  sourceY: i,
219
- targetPosition: c,
219
+ targetPosition: l,
220
220
  targetX: a,
221
221
  targetY: o
222
222
  }), [m, h] = W(!1), [g, _] = W("basic"), { updateEdgeData: v, deleteElements: y } = Je(), { language: b } = Z(), x = Wn(t, n), S = zn(n), w = S.find((e) => e.nodeId === t) ?? S[0], T = Q(), E = Ge(), D = U(() => {
@@ -287,12 +287,12 @@ var Zn = {
287
287
  let [t] = e, n = S.find((e) => e.nodeId === t.field)?.label ?? t.field ?? "";
288
288
  return `${n === t.field && n.length > 5 ? `${n.slice(0, 5)}…` : n} ${Zn[t.operator] ?? t.operator} ${t.value ?? ""}`;
289
289
  }
290
- let t = e.filter((e) => e.logicalOperator === u.AND).length, n = e.filter((e) => e.logicalOperator === u.OR).length;
290
+ let t = e.filter((e) => e.logicalOperator === c.AND).length, n = e.filter((e) => e.logicalOperator === c.OR).length;
291
291
  return t > 0 && n === 0 ? `${e.length} ${T("editor.conditionalEdge.conditionsAnd")}` : n > 0 && t === 0 ? `${e.length} ${T("editor.conditionalEdge.conditionsOr")}` : `${e.length} ${T("editor.conditionalEdge.conditionsMixed")}`;
292
292
  }, ue = () => f?.isFallback ? "var(--treege-chart-4)" : O ? "var(--treege-chart-2)" : "var(--treege-chart-3)";
293
293
  return x ? null : /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(Me, {
294
294
  path: p,
295
- markerEnd: l,
295
+ markerEnd: u,
296
296
  style: {
297
297
  ...d,
298
298
  stroke: ue(),
@@ -562,16 +562,16 @@ var Zn = {
562
562
  className: "tg:flex tg:justify-center",
563
563
  children: /* @__PURE__ */ q(A, {
564
564
  disabled: t,
565
- value: e.state.value || u.AND,
565
+ value: e.state.value || c.AND,
566
566
  onValueChange: (t) => e.handleChange(t),
567
567
  children: [/* @__PURE__ */ K(j, {
568
568
  className: "tg:h-9 tg:w-32 tg:font-semibold",
569
569
  children: /* @__PURE__ */ K(C, {})
570
570
  }), /* @__PURE__ */ q(R, { children: [/* @__PURE__ */ K(N, {
571
- value: u.AND,
571
+ value: c.AND,
572
572
  children: "AND"
573
573
  }), /* @__PURE__ */ K(N, {
574
- value: u.OR,
574
+ value: c.OR,
575
575
  children: "OR"
576
576
  })] })]
577
577
  })
@@ -586,7 +586,7 @@ var Zn = {
586
586
  onClick: () => {
587
587
  e.pushValue({
588
588
  field: S[0]?.nodeId ?? "",
589
- logicalOperator: u.AND,
589
+ logicalOperator: c.AND,
590
590
  operator: "===",
591
591
  value: ""
592
592
  }), ee().then();
@@ -780,30 +780,30 @@ function hr({ className: e, ...t }) {
780
780
  }
781
781
  //#endregion
782
782
  //#region src/editor/features/TreegeEditor/nodes/components/NodeTypePickerMenuContent.tsx
783
- var gr = ({ onSelect: t }) => {
784
- let n = Q();
783
+ var gr = ({ onSelect: e }) => {
784
+ let t = Q();
785
785
  return /* @__PURE__ */ q(sr, {
786
786
  align: "center",
787
787
  side: "bottom",
788
788
  className: "treege-scrollbar tg:max-h-80",
789
789
  children: [
790
- /* @__PURE__ */ q(cr, { children: [/* @__PURE__ */ K(dr, { children: n("editor.selectNodeType.options.input") }), Object.values(M).map((n) => /* @__PURE__ */ q($, {
791
- onClick: () => t({
792
- data: { type: n },
793
- type: e.input
790
+ /* @__PURE__ */ q(cr, { children: [/* @__PURE__ */ K(dr, { children: t("editor.selectNodeType.options.input") }), Object.values(M).map((t) => /* @__PURE__ */ q($, {
791
+ onClick: () => e({
792
+ data: { type: t },
793
+ type: r.input
794
794
  }),
795
795
  className: "tg:capitalize",
796
- children: [/* @__PURE__ */ K(ir(n), {}), n]
797
- }, n))] }),
796
+ children: [/* @__PURE__ */ K(ir(t), {}), t]
797
+ }, t))] }),
798
798
  /* @__PURE__ */ K(fr, {}),
799
- /* @__PURE__ */ q(cr, { children: [/* @__PURE__ */ K(dr, { children: n("editor.selectNodeType.options.ui") }), Object.values(tr).map((n) => /* @__PURE__ */ q($, {
800
- onClick: () => t({
801
- data: { type: n },
802
- type: e.ui
799
+ /* @__PURE__ */ q(cr, { children: [/* @__PURE__ */ K(dr, { children: t("editor.selectNodeType.options.ui") }), Object.values(tr).map((t) => /* @__PURE__ */ q($, {
800
+ onClick: () => e({
801
+ data: { type: t },
802
+ type: r.ui
803
803
  }),
804
804
  className: "tg:capitalize",
805
- children: [/* @__PURE__ */ K(ir(n), {}), n]
806
- }, n))] })
805
+ children: [/* @__PURE__ */ K(ir(t), {}), t]
806
+ }, t))] })
807
807
  ]
808
808
  });
809
809
  }, _r = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", vr = (e = 21) => {
@@ -950,38 +950,38 @@ var gr = ({ onSelect: t }) => {
950
950
  };
951
951
  });
952
952
  }, Dr = () => {
953
- let { setNodes: e, setEdges: t, screenToFlowPosition: n, getNode: r, getNodes: i, getEdges: o } = Je(), { takeSnapshot: s } = Sr(), c = V((n, r, i = !1, c) => {
954
- let l = n.id, u = o().filter((e) => e.source === l), d = a(n);
955
- if (u.length > 0 && !d) return;
956
- s();
953
+ let { setNodes: e, setEdges: t, screenToFlowPosition: n, getNode: r, getNodes: i, getEdges: a } = Je(), { takeSnapshot: o } = Sr(), s = V((n, r, i = !1, s) => {
954
+ let c = n.id, l = a().filter((e) => e.source === c), d = u(n);
955
+ if (l.length > 0 && !d) return;
956
+ o();
957
957
  let f = vr(), p = {
958
958
  ...yr,
959
- ...c && {
960
- data: c.data ?? {},
961
- type: c.type
959
+ ...s && {
960
+ data: s.data ?? {},
961
+ type: s.type
962
962
  },
963
963
  id: f,
964
964
  position: r,
965
965
  selected: i
966
966
  };
967
967
  n?.parentId && (p.parentId = n.parentId), e((e) => e.concat(p)), t((e) => {
968
- let t = e.filter((e) => e.source === l).length > 0, n = {
968
+ let t = e.filter((e) => e.source === c).length > 0, n = {
969
969
  data: t && d ? { conditions: [{
970
- field: l,
970
+ field: c,
971
971
  operator: "===",
972
972
  value: ""
973
973
  }] } : void 0,
974
974
  id: vr(),
975
- source: l,
975
+ source: c,
976
976
  target: f,
977
977
  type: t && d ? "conditional" : "default"
978
978
  };
979
- return t && d ? e.map((e) => e.source === l ? {
979
+ return t && d ? e.map((e) => e.source === c ? {
980
980
  ...e,
981
981
  data: {
982
982
  ...e.data,
983
983
  conditions: e.data?.conditions || [{
984
- field: l,
984
+ field: c,
985
985
  operator: "===",
986
986
  value: ""
987
987
  }]
@@ -998,22 +998,22 @@ var gr = ({ onSelect: t }) => {
998
998
  })));
999
999
  });
1000
1000
  }, [
1001
- o,
1001
+ a,
1002
1002
  e,
1003
1003
  t,
1004
- s
1005
- ]), l = V((n, r) => {
1006
- s();
1007
- let i = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), a = parseFloat(i) || 100, { node: o, edges: c } = wr(n, r, {
1004
+ o
1005
+ ]), c = V((n, r) => {
1006
+ o();
1007
+ let i = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), a = parseFloat(i) || 100, { node: s, edges: c } = wr(n, r, {
1008
1008
  baseNode: yr,
1009
1009
  commonNodeId: vr(),
1010
1010
  nodeHeight: a,
1011
1011
  verticalSpacing: 100
1012
1012
  });
1013
- e((e) => e.concat(o)), t((e) => e.concat(...c)), requestAnimationFrame(() => {
1013
+ e((e) => e.concat(s)), t((e) => e.concat(...c)), requestAnimationFrame(() => {
1014
1014
  e((e) => e.map((e) => ({
1015
1015
  ...e,
1016
- selected: e.id === o.id
1016
+ selected: e.id === s.id
1017
1017
  }))), t((e) => e.map((e) => ({
1018
1018
  ...e,
1019
1019
  selected: !1
@@ -1022,12 +1022,12 @@ var gr = ({ onSelect: t }) => {
1022
1022
  }, [
1023
1023
  e,
1024
1024
  t,
1025
- s
1026
- ]), u = V((e) => {
1027
- let n = e.source, i = r(n), c = o(), l = !c.some((e) => e.source === n), u = !c.some((t) => t.source === e.target);
1028
- l && u || (s(), t((t) => {
1025
+ o
1026
+ ]), l = V((e) => {
1027
+ let n = e.source, i = r(n), s = a(), c = !s.some((e) => e.source === n), l = !s.some((t) => t.source === e.target);
1028
+ c && l || (o(), t((t) => {
1029
1029
  let r = He(e, t);
1030
- return r.filter((e) => e.source === n).length > 1 && i && a(i) ? r.map((e) => e.source === n ? {
1030
+ return r.filter((e) => e.source === n).length > 1 && i && u(i) ? r.map((e) => e.source === n ? {
1031
1031
  ...e,
1032
1032
  data: {
1033
1033
  ...e.data,
@@ -1043,26 +1043,26 @@ var gr = ({ onSelect: t }) => {
1043
1043
  }, [
1044
1044
  t,
1045
1045
  r,
1046
- o,
1047
- s
1046
+ a,
1047
+ o
1048
1048
  ]), d = V((e, t) => {
1049
1049
  let n = r(e);
1050
1050
  if (!n) return;
1051
- let a = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), s = getComputedStyle(document.documentElement).getPropertyValue("--node-width"), l = parseFloat(a) || 100, u = parseFloat(s) || 100, d = n.position.y + l + 100, f = i(), p = o(), m = f.filter((t) => p.some((n) => n.source === e && n.target === t.id)).map((e) => e.position.x);
1052
- c(n, {
1051
+ let o = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), c = getComputedStyle(document.documentElement).getPropertyValue("--node-width"), l = parseFloat(o) || 100, u = parseFloat(c) || 100, d = n.position.y + l + 100, f = i(), p = a(), m = f.filter((t) => p.some((n) => n.source === e && n.target === t.id)).map((e) => e.position.x);
1052
+ s(n, {
1053
1053
  x: m.length === 0 ? n.position.x : m.length % 2 == 1 ? Math.max(...m) + u + 50 : Math.min(...m) - u - 50,
1054
1054
  y: d
1055
1055
  }, !0, t);
1056
1056
  }, [
1057
1057
  r,
1058
1058
  i,
1059
- o,
1060
- c
1059
+ a,
1060
+ s
1061
1061
  ]), f = V((n, i) => {
1062
- let o = r(n);
1063
- if (!(o && a(o))) return;
1064
- s();
1065
- let c = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), l = getComputedStyle(document.documentElement).getPropertyValue("--node-width"), u = parseFloat(c) || 100, d = parseFloat(l) || 100, f = o.position.y + u + 100, p = d / 2 + 50 / 2, m = (e, t) => {
1062
+ let a = r(n);
1063
+ if (!(a && u(a))) return;
1064
+ o();
1065
+ let s = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), c = getComputedStyle(document.documentElement).getPropertyValue("--node-width"), l = parseFloat(s) || 100, d = parseFloat(c) || 100, f = a.position.y + l + 100, p = d / 2 + 50 / 2, m = (e, t) => {
1066
1066
  let n = {
1067
1067
  ...yr,
1068
1068
  ...i ? { type: i.type } : {},
@@ -1074,8 +1074,8 @@ var gr = ({ onSelect: t }) => {
1074
1074
  },
1075
1075
  selected: t
1076
1076
  };
1077
- return o.parentId && (n.parentId = o.parentId), n;
1078
- }, h = m(o.position.x - p, !0), g = m(o.position.x + p, !1);
1077
+ return a.parentId && (n.parentId = a.parentId), n;
1078
+ }, h = m(a.position.x - p, !0), g = m(a.position.x + p, !1);
1079
1079
  e((e) => e.concat(h, g)), t((e) => {
1080
1080
  let t = () => [{
1081
1081
  field: n,
@@ -1109,15 +1109,15 @@ var gr = ({ onSelect: t }) => {
1109
1109
  r,
1110
1110
  e,
1111
1111
  t,
1112
- s
1112
+ o
1113
1113
  ]), p = V((n, i) => {
1114
- let a = r(n);
1115
- if (!a) return;
1116
- let c = o(), l = c.filter((e) => e.source === n);
1114
+ let s = r(n);
1115
+ if (!s) return;
1116
+ let c = a(), l = c.filter((e) => e.source === n);
1117
1117
  if (l.length !== 1) return;
1118
1118
  let u = l[0], d = r(u.target);
1119
1119
  if (!d) return;
1120
- s();
1120
+ o();
1121
1121
  let f = getComputedStyle(document.documentElement).getPropertyValue("--node-height"), p = (parseFloat(f) || 100) + 100, m = new Set([d.id]), h = [d.id];
1122
1122
  for (; h.length > 0;) {
1123
1123
  let e = h.shift();
@@ -1138,7 +1138,7 @@ var gr = ({ onSelect: t }) => {
1138
1138
  },
1139
1139
  selected: !0
1140
1140
  };
1141
- a.parentId && (_.parentId = a.parentId), e((e) => e.map((e) => m.has(e.id) ? {
1141
+ s.parentId && (_.parentId = s.parentId), e((e) => e.map((e) => m.has(e.id) ? {
1142
1142
  ...e,
1143
1143
  position: {
1144
1144
  x: e.position.x,
@@ -1163,14 +1163,14 @@ var gr = ({ onSelect: t }) => {
1163
1163
  });
1164
1164
  }, [
1165
1165
  r,
1166
- o,
1166
+ a,
1167
1167
  e,
1168
1168
  t,
1169
- s
1169
+ o
1170
1170
  ]), m = V((n, i) => {
1171
- let a = r(n), o = r(i);
1172
- if (!(a && o)) return;
1173
- s(), t((e) => e.map((e) => e.source === n && e.target === i ? {
1171
+ let a = r(n), s = r(i);
1172
+ if (!(a && s)) return;
1173
+ o(), t((e) => e.map((e) => e.source === n && e.target === i ? {
1174
1174
  ...e,
1175
1175
  source: i,
1176
1176
  target: n
@@ -1181,12 +1181,12 @@ var gr = ({ onSelect: t }) => {
1181
1181
  ...e,
1182
1182
  source: n
1183
1183
  } : e));
1184
- let c = a.measured?.height, l = o.measured?.height, u = c != null && l != null ? l - c : 0;
1184
+ let c = a.measured?.height, l = s.measured?.height, u = c != null && l != null ? l - c : 0;
1185
1185
  e((e) => e.map((e) => e.id === n ? {
1186
1186
  ...e,
1187
1187
  position: {
1188
1188
  x: e.position.x,
1189
- y: o.position.y + u
1189
+ y: s.position.y + u
1190
1190
  }
1191
1191
  } : e.id === i ? {
1192
1192
  ...e,
@@ -1199,44 +1199,44 @@ var gr = ({ onSelect: t }) => {
1199
1199
  r,
1200
1200
  e,
1201
1201
  t,
1202
- s
1202
+ o
1203
1203
  ]), h = V((e) => {
1204
- let t = o(), n = t.filter((t) => t.target === e);
1204
+ let t = a(), n = t.filter((t) => t.target === e);
1205
1205
  if (n.length !== 1 || t.filter((t) => t.source === e).length > 1) return;
1206
1206
  let r = n[0].source;
1207
1207
  t.filter((e) => e.source === r).length === 1 && m(r, e);
1208
- }, [o, m]), g = V((e) => {
1209
- let t = o(), n = t.filter((t) => t.source === e);
1208
+ }, [a, m]), g = V((e) => {
1209
+ let t = a(), n = t.filter((t) => t.source === e);
1210
1210
  if (n.length !== 1) return;
1211
1211
  let r = n[0].target;
1212
1212
  t.filter((e) => e.target === r).length === 1 && (t.filter((e) => e.source === r).length > 1 || m(e, r));
1213
- }, [o, m]), _ = V((e, t) => {
1213
+ }, [a, m]), _ = V((e, t) => {
1214
1214
  let i = t.fromNode;
1215
1215
  if (!i) return;
1216
- let { clientX: a, clientY: s } = "changedTouches" in e ? e.changedTouches[0] : e, u = document.elementFromPoint(a, s)?.closest?.(".react-flow__node")?.getAttribute("data-id") ?? null ?? t.toNode?.id ?? null;
1216
+ let { clientX: o, clientY: l } = "changedTouches" in e ? e.changedTouches[0] : e, u = document.elementFromPoint(o, l)?.closest?.(".react-flow__node")?.getAttribute("data-id") ?? null ?? t.toNode?.id ?? null;
1217
1217
  if (u && u !== i.id) {
1218
- let e = r(u), t = o(), n = !t.some((e) => e.source === i.id), a = !t.some((e) => e.source === u);
1219
- e && n && a && l(i, e);
1218
+ let e = r(u), t = a(), n = !t.some((e) => e.source === i.id), o = !t.some((e) => e.source === u);
1219
+ e && n && o && c(i, e);
1220
1220
  return;
1221
1221
  }
1222
1222
  if (!t.isValid) {
1223
1223
  let e = n({
1224
- x: a,
1225
- y: s
1226
- }), t = i.parentId ? r(i.parentId) : void 0, o = t?.position ?? {
1224
+ x: o,
1225
+ y: l
1226
+ }), t = i.parentId ? r(i.parentId) : void 0, a = t?.position ?? {
1227
1227
  x: 0,
1228
1228
  y: 0
1229
1229
  };
1230
- c(i, t ? {
1231
- x: e.x - o.x,
1232
- y: e.y - o.y
1230
+ s(i, t ? {
1231
+ x: e.x - a.x,
1232
+ y: e.y - a.y
1233
1233
  } : e, !0);
1234
1234
  }
1235
1235
  }, [
1236
- l,
1237
1236
  c,
1237
+ s,
1238
1238
  r,
1239
- o,
1239
+ a,
1240
1240
  n
1241
1241
  ]), v = V((e) => {
1242
1242
  t((t) => Er(t.filter((t) => !e.find((e) => e.id === t.id)), new Set(e.map((e) => e.source))));
@@ -1246,13 +1246,13 @@ var gr = ({ onSelect: t }) => {
1246
1246
  if (e.source === e.target) return !1;
1247
1247
  let t = r(e.source);
1248
1248
  if (!t) return !1;
1249
- let n = o();
1250
- return Cr(n, e.source, e.target) || Tr(n, e.source, e.target) ? !1 : !(n.filter((t) => t.source === e.source).length > 0 && !a(t));
1251
- }, [r, o]),
1249
+ let n = a();
1250
+ return Cr(n, e.source, e.target) || Tr(n, e.source, e.target) ? !1 : !(n.filter((t) => t.source === e.source).length > 0 && !u(t));
1251
+ }, [r, a]),
1252
1252
  moveStackNodeDown: g,
1253
1253
  moveStackNodeUp: h,
1254
1254
  onAddFromHandle: d,
1255
- onConnect: u,
1255
+ onConnect: l,
1256
1256
  onConnectEnd: _,
1257
1257
  onCreateBranch: f,
1258
1258
  onEdgesDelete: v,
@@ -1371,7 +1371,7 @@ var gr = ({ onSelect: t }) => {
1371
1371
  ]
1372
1372
  });
1373
1373
  }, kr = () => {
1374
- let e = Ke(), t = U(() => e.filter(b), [e]), n = U(() => e.filter((e) => e.selected), [e]), r = U(() => e.find((e) => e.selected), [e]);
1374
+ let e = Ke(), t = U(() => e.filter(d), [e]), n = U(() => e.filter((e) => e.selected), [e]), r = U(() => e.find((e) => e.selected), [e]);
1375
1375
  return {
1376
1376
  groupNodes: t,
1377
1377
  hasSelectedNodes: n.length > 0,
@@ -1380,7 +1380,7 @@ var gr = ({ onSelect: t }) => {
1380
1380
  selectedNodes: n
1381
1381
  };
1382
1382
  }, Ar = ({ targetNodes: e, hideLabel: t, onChange: n } = {}) => {
1383
- let [i, a] = W(""), [s, c] = W(""), [l, u] = W(!1), [d, f] = W(!1), { selectedNode: p, groupNodes: m } = kr(), { setNodes: h } = Je(), g = Q(), _ = nt(), v = nt(), y = nt(), x = U(() => e ?? (p ? [p] : []), [e, p]), S = x.length > 0 && x.every(b), w = U(() => new Set(x.map((e) => e.id)), [x]), T = U(() => new Set(x.map((e) => e.parentId)), [x]).size > 1, E = !T && x[0] ? x[0].parentId : void 0, D = E ? m.find((e) => e.id === E) : void 0, O = r(D?.data?.label), ee = T ? "" : E ?? "none", te = g(T ? "editor.selectNodeGroup.mixed" : "editor.selectNodeGroup.noGroup"), ne = (e) => {
1383
+ let [r, a] = W(""), [o, s] = W(""), [c, l] = W(!1), [u, f] = W(!1), { selectedNode: p, groupNodes: m } = kr(), { setNodes: h } = Je(), g = Q(), _ = nt(), v = nt(), y = nt(), x = U(() => e ?? (p ? [p] : []), [e, p]), S = x.length > 0 && x.every(d), w = U(() => new Set(x.map((e) => e.id)), [x]), T = U(() => new Set(x.map((e) => e.parentId)), [x]).size > 1, E = !T && x[0] ? x[0].parentId : void 0, D = E ? m.find((e) => e.id === E) : void 0, O = b(D?.data?.label), ee = T ? "" : E ?? "none", te = g(T ? "editor.selectNodeGroup.mixed" : "editor.selectNodeGroup.noGroup"), ne = (e) => {
1384
1384
  x.length !== 0 && (h((t) => e === "none" ? t.map((e) => {
1385
1385
  if (w.has(e.id)) {
1386
1386
  let { parentId: t, extent: n, ...r } = e;
@@ -1398,9 +1398,9 @@ var gr = ({ onSelect: t }) => {
1398
1398
  return t;
1399
1399
  }) : t), n?.());
1400
1400
  }, re = () => {
1401
- let e = i.trim();
1401
+ let e = r.trim();
1402
1402
  if (!e || x.length === 0) return;
1403
- if (m.find((t) => r(t.data?.label).toLowerCase() === e.toLowerCase())) {
1403
+ if (m.find((t) => b(t.data?.label).toLowerCase() === e.toLowerCase())) {
1404
1404
  X.error("This group already exists", { description: "Use the selector to add the node to an existing group." });
1405
1405
  return;
1406
1406
  }
@@ -1423,11 +1423,11 @@ var gr = ({ onSelect: t }) => {
1423
1423
  };
1424
1424
  }
1425
1425
  return e;
1426
- })]), a(""), u(!1), X.success("Group created", { description: `The group "${e}" has been created successfully.` }), n?.();
1426
+ })]), a(""), l(!1), X.success("Group created", { description: `The group "${e}" has been created successfully.` }), n?.();
1427
1427
  }, ie = () => {
1428
- if (!(s.trim() && D)) return;
1429
- let e = s.trim();
1430
- if (m.find((t) => t.id !== D.id && r(t.data?.label).toLowerCase() === e.toLowerCase())) {
1428
+ if (!(o.trim() && D)) return;
1429
+ let e = o.trim();
1430
+ if (m.find((t) => t.id !== D.id && b(t.data?.label).toLowerCase() === e.toLowerCase())) {
1431
1431
  X.error("This group already exists", { description: "Choose a different name." });
1432
1432
  return;
1433
1433
  }
@@ -1435,13 +1435,13 @@ var gr = ({ onSelect: t }) => {
1435
1435
  ...t,
1436
1436
  data: {
1437
1437
  ...t.data,
1438
- label: o(t.data?.label, "en", e)
1438
+ label: i(t.data?.label, "en", e)
1439
1439
  }
1440
1440
  } : t)), f(!1);
1441
1441
  };
1442
1442
  return H(() => {
1443
- d && c(String(O ?? ""));
1444
- }, [d, O]), S || x.length === 0 ? null : /* @__PURE__ */ q("div", {
1443
+ u && s(String(O ?? ""));
1444
+ }, [u, O]), S || x.length === 0 ? null : /* @__PURE__ */ q("div", {
1445
1445
  className: "tg:space-y-2",
1446
1446
  children: [!t && /* @__PURE__ */ K(P, {
1447
1447
  htmlFor: _,
@@ -1461,11 +1461,11 @@ var gr = ({ onSelect: t }) => {
1461
1461
  children: g("editor.selectNodeGroup.noGroup")
1462
1462
  }), m.map((e) => /* @__PURE__ */ K(N, {
1463
1463
  value: e.id,
1464
- children: r(e.data.label) || e.id
1464
+ children: b(e.data.label) || e.id
1465
1465
  }, e.id))] }) })]
1466
1466
  }),
1467
1467
  D && /* @__PURE__ */ q(me, {
1468
- open: d,
1468
+ open: u,
1469
1469
  onOpenChange: f,
1470
1470
  children: [/* @__PURE__ */ K(Se, {
1471
1471
  asChild: !0,
@@ -1497,8 +1497,8 @@ var gr = ({ onSelect: t }) => {
1497
1497
  }), /* @__PURE__ */ K(L, {
1498
1498
  autoFocus: !0,
1499
1499
  id: y,
1500
- value: s,
1501
- onChange: (e) => c(e.target.value),
1500
+ value: o,
1501
+ onChange: (e) => s(e.target.value),
1502
1502
  onKeyDown: (e) => {
1503
1503
  e.key === "Enter" && (e.preventDefault(), ie());
1504
1504
  }
@@ -1514,7 +1514,7 @@ var gr = ({ onSelect: t }) => {
1514
1514
  }), /* @__PURE__ */ K(B, {
1515
1515
  size: "sm",
1516
1516
  onClick: ie,
1517
- disabled: !s.trim(),
1517
+ disabled: !o.trim(),
1518
1518
  children: g("common.save")
1519
1519
  })]
1520
1520
  })
@@ -1523,8 +1523,8 @@ var gr = ({ onSelect: t }) => {
1523
1523
  })]
1524
1524
  }),
1525
1525
  /* @__PURE__ */ q(me, {
1526
- open: l,
1527
- onOpenChange: u,
1526
+ open: c,
1527
+ onOpenChange: l,
1528
1528
  children: [/* @__PURE__ */ K(Se, {
1529
1529
  asChild: !0,
1530
1530
  children: /* @__PURE__ */ K(B, {
@@ -1558,7 +1558,7 @@ var gr = ({ onSelect: t }) => {
1558
1558
  }), /* @__PURE__ */ K(L, {
1559
1559
  autoFocus: !0,
1560
1560
  id: v,
1561
- value: i,
1561
+ value: r,
1562
1562
  onChange: (e) => a(e.target.value),
1563
1563
  placeholder: "Ex: Step 1 - Personal info",
1564
1564
  onKeyDown: (e) => {
@@ -1571,12 +1571,12 @@ var gr = ({ onSelect: t }) => {
1571
1571
  children: [/* @__PURE__ */ K(B, {
1572
1572
  variant: "outline",
1573
1573
  size: "sm",
1574
- onClick: () => u(!1),
1574
+ onClick: () => l(!1),
1575
1575
  children: g("common.cancel")
1576
1576
  }), /* @__PURE__ */ K(B, {
1577
1577
  size: "sm",
1578
1578
  onClick: re,
1579
- disabled: !i.trim(),
1579
+ disabled: !r.trim(),
1580
1580
  children: g("common.create")
1581
1581
  })]
1582
1582
  })
@@ -1588,7 +1588,7 @@ var gr = ({ onSelect: t }) => {
1588
1588
  })]
1589
1589
  });
1590
1590
  }, jr = (e) => Math.abs([...e].reduce((e, t) => e * 31 + t.charCodeAt(0) | 0, 0)), Mr = (e) => e ? `hsl(${jr(e) % 360} 65% 45%)` : "", Nr = ({ nodeId: e, groupId: t }) => {
1591
- let [n, r] = W(!1), i = Q(), a = Ke(), o = U(() => a.find((t) => t.id === e), [a, e]), s = U(() => t ? a.find((e) => e.id === t) : void 0, [a, t]), c = b(s) ? i(s.data?.label) : "", l = Mr(t), u = (e) => e.stopPropagation();
1591
+ let [n, r] = W(!1), i = Q(), a = Ke(), o = U(() => a.find((t) => t.id === e), [a, e]), s = U(() => t ? a.find((e) => e.id === t) : void 0, [a, t]), c = d(s) ? i(s.data?.label) : "", l = Mr(t), u = (e) => e.stopPropagation();
1592
1592
  return /* @__PURE__ */ q(me, {
1593
1593
  open: n,
1594
1594
  onOpenChange: r,
@@ -2077,12 +2077,12 @@ var gr = ({ onSelect: t }) => {
2077
2077
  case "checkbox": return [];
2078
2078
  default: return "";
2079
2079
  }
2080
- }, di = (e) => e.replace(/^[a-z][\w+.-]*:\/\/[^/]+/i, "") || e, fi = ({ nodeId: e, data: t }) => {
2081
- let [n, i] = W(!1), [a, o] = W(""), [s, c] = W(""), [u, d] = W(""), [f, p] = W(""), [g, _] = W(null), { language: v, headers: y } = Z(), { baseUrl: b } = ii(), { updateNodeData: x } = Rr(), S = Q(), C = t?.type;
2080
+ }, di = (e) => e.replace(/^[a-z][\w+.-]*:\/\/[^/]+/i, "") || e, fi = ({ nodeId: t, data: n }) => {
2081
+ let [r, i] = W(!1), [a, o] = W(""), [s, c] = W(""), [l, u] = W(""), [d, f] = W(""), [p, g] = W(null), { language: _, headers: v } = Z(), { baseUrl: y } = ii(), { updateNodeData: x } = Rr(), S = Q(), C = n?.type;
2082
2082
  if (!C) return null;
2083
- let w = ci(t), E = w ? t.optionsSource?.url : void 0, D = E ?? (C === "http" ? t.httpConfig?.url : void 0), O = w ? t.options ?? [] : [], ee = w, ne = w, k = h({
2084
- data: t,
2085
- id: e,
2083
+ let w = ci(n), E = w ? n.optionsSource?.url : void 0, D = E ?? (C === "http" ? n.httpConfig?.url : void 0), O = w ? n.options ?? [] : [], ee = w, ne = w, k = h({
2084
+ data: n,
2085
+ id: t,
2086
2086
  position: {
2087
2087
  x: 0,
2088
2088
  y: 0
@@ -2090,41 +2090,41 @@ var gr = ({ onSelect: t }) => {
2090
2090
  type: "input"
2091
2091
  }), A = {
2092
2092
  data: {
2093
- ...t,
2093
+ ...n,
2094
2094
  name: void 0,
2095
2095
  required: void 0
2096
2096
  },
2097
- id: e,
2097
+ id: t,
2098
2098
  position: {
2099
2099
  x: 0,
2100
2100
  y: 0
2101
2101
  },
2102
2102
  type: "input"
2103
2103
  }, ie = () => {
2104
- o(""), c(""), d(""), p("");
2105
- }, ae = (t) => {
2106
- t?.preventDefault();
2104
+ o(""), c(""), u(""), f("");
2105
+ }, ae = (e) => {
2106
+ e?.preventDefault();
2107
2107
  let n = a.trim(), r = s.trim();
2108
2108
  if (!(n || r)) return;
2109
- let o = f.trim(), c = {
2110
- label: { [v]: n },
2109
+ let o = d.trim(), c = {
2110
+ label: { [_]: n },
2111
2111
  value: r,
2112
- ...ee && u && { image: u },
2113
- ...ne && o && { description: { [v]: o } }
2112
+ ...ee && l && { image: l },
2113
+ ...ne && o && { description: { [_]: o } }
2114
2114
  };
2115
- x(e, { options: g === null ? [...O, c] : O.map((e, t) => t === g ? c : e) }), ie(), _(null), i(!1);
2115
+ x(t, { options: p === null ? [...O, c] : O.map((e, t) => t === p ? c : e) }), ie(), g(null), i(!1);
2116
2116
  }, oe = (e) => {
2117
- i(e), e || (ie(), _(null));
2117
+ i(e), e || (ie(), g(null));
2118
2118
  }, se = (e) => {
2119
2119
  let t = O[e];
2120
- t && (o(S(t.label) || ""), c(t.value || ""), d(t.image ?? ""), p(S(t.description) || ""), _(e), i(!0));
2121
- }, j = (t) => {
2122
- x(e, { options: O.filter((e, n) => n !== t) });
2120
+ t && (o(S(t.label) || ""), c(t.value || ""), u(t.image ?? ""), f(S(t.description) || ""), g(e), i(!0));
2121
+ }, j = (e) => {
2122
+ x(t, { options: O.filter((t, n) => n !== e) });
2123
2123
  }, ce = (e) => {
2124
2124
  e.key === "Enter" && (e.preventDefault(), ae());
2125
2125
  }, le = (e) => e.stopPropagation();
2126
2126
  if (C === "hidden") {
2127
- let e = ir(C), n = t.defaultValue?.type === "static" ? t.defaultValue.staticValue : void 0, r = t.defaultValue?.type === "reference" ? t.defaultValue.referenceField : void 0, i = (e) => e && typeof e == "object" && "name" in e ? String(e.name) : String(e), a = Array.isArray(n) ? n.map(i).join(", ") : typeof n == "boolean" ? String(n) : typeof n == "object" && n ? i(n) : n ?? (r ? `→ ${r}` : "");
2127
+ let e = ir(C), t = n.defaultValue?.type === "static" ? n.defaultValue.staticValue : void 0, r = n.defaultValue?.type === "reference" ? n.defaultValue.referenceField : void 0, i = (e) => e && typeof e == "object" && "name" in e ? String(e.name) : String(e), a = Array.isArray(t) ? t.map(i).join(", ") : typeof t == "boolean" ? String(t) : typeof t == "object" && t ? i(t) : t ?? (r ? `→ ${r}` : "");
2128
2128
  return /* @__PURE__ */ q("div", {
2129
2129
  className: "tg:pointer-events-none tg:flex tg:select-none tg:flex-col tg:gap-1 tg:text-sm",
2130
2130
  children: [/* @__PURE__ */ q("div", {
@@ -2138,19 +2138,19 @@ var gr = ({ onSelect: t }) => {
2138
2138
  }
2139
2139
  if (C === "submit") return /* @__PURE__ */ K("div", {
2140
2140
  className: "tg:pointer-events-none tg:flex tg:select-none tg:justify-center",
2141
- children: /* @__PURE__ */ K(l, {
2141
+ children: /* @__PURE__ */ K(e, {
2142
2142
  value: {
2143
- baseUrl: b,
2144
- headers: y,
2145
- language: v,
2143
+ baseUrl: y,
2144
+ headers: v,
2145
+ language: _,
2146
2146
  optionsDisplayLimit: 10
2147
2147
  },
2148
- children: /* @__PURE__ */ K(Ee, { label: r(t.label, v) || void 0 })
2148
+ children: /* @__PURE__ */ K(Ee, { label: b(n.label, _) || void 0 })
2149
2149
  })
2150
2150
  });
2151
2151
  let M = xe[C];
2152
2152
  if (!M) return null;
2153
- let fe = r(t.helperText, v), N = m(t, v), pe = ({ option: e, index: t, variant: n }) => {
2153
+ let fe = b(n.helperText, _), N = m(n, _), pe = ({ option: e, index: t, variant: n }) => {
2154
2154
  let r = String(e.value), i = S(e.label) || r;
2155
2155
  return /* @__PURE__ */ q(G, { children: [r && r !== i && n !== "card" && /* @__PURE__ */ K("span", {
2156
2156
  className: "tg:pointer-events-none tg:absolute tg:top-1/2 tg:right-2 tg:max-w-18 tg:-translate-y-1/2 tg:truncate tg:text-[10px] tg:text-muted-foreground/60 tg:group-hover/option:hidden",
@@ -2183,16 +2183,16 @@ var gr = ({ onSelect: t }) => {
2183
2183
  return /* @__PURE__ */ q(G, { children: [
2184
2184
  /* @__PURE__ */ K("div", {
2185
2185
  className: "tg:pointer-events-none tg:flex tg:select-none tg:flex-col tg:gap-1 tg:[&_label:empty]:hidden",
2186
- children: /* @__PURE__ */ K(l, {
2186
+ children: /* @__PURE__ */ K(e, {
2187
2187
  value: {
2188
- baseUrl: b,
2189
- headers: y,
2190
- language: v,
2188
+ baseUrl: y,
2189
+ headers: v,
2190
+ language: _,
2191
2191
  optionsDisplayLimit: 10
2192
2192
  },
2193
2193
  children: /* @__PURE__ */ K(M, {
2194
2194
  field: {
2195
- id: `${e}-preview`,
2195
+ id: `${t}-preview`,
2196
2196
  name: k,
2197
2197
  placeholder: N || void 0,
2198
2198
  value: ui(C)
@@ -2267,7 +2267,7 @@ var gr = ({ onSelect: t }) => {
2267
2267
  ]
2268
2268
  }, i);
2269
2269
  }), /* @__PURE__ */ q(me, {
2270
- open: n,
2270
+ open: r,
2271
2271
  onOpenChange: oe,
2272
2272
  children: [/* @__PURE__ */ K(Se, {
2273
2273
  asChild: !0,
@@ -2291,11 +2291,11 @@ var gr = ({ onSelect: t }) => {
2291
2291
  className: "tg:flex tg:items-start tg:gap-2",
2292
2292
  children: [
2293
2293
  ee && /* @__PURE__ */ K(si, {
2294
- value: u,
2295
- onChange: d
2294
+ value: l,
2295
+ onChange: u
2296
2296
  }),
2297
2297
  /* @__PURE__ */ K(L, {
2298
- id: `${e}-option-label`,
2298
+ id: `${t}-option-label`,
2299
2299
  autoFocus: !0,
2300
2300
  placeholder: S("editor.inputNodeForm.optionLabel"),
2301
2301
  value: a,
@@ -2303,7 +2303,7 @@ var gr = ({ onSelect: t }) => {
2303
2303
  onKeyDown: ce
2304
2304
  }),
2305
2305
  /* @__PURE__ */ K(L, {
2306
- id: `${e}-option-value`,
2306
+ id: `${t}-option-value`,
2307
2307
  placeholder: S("editor.inputNodeForm.optionValue"),
2308
2308
  value: s,
2309
2309
  onChange: (e) => c(e.target.value),
@@ -2312,10 +2312,10 @@ var gr = ({ onSelect: t }) => {
2312
2312
  ]
2313
2313
  }),
2314
2314
  ne && /* @__PURE__ */ K(L, {
2315
- id: `${e}-option-description`,
2315
+ id: `${t}-option-description`,
2316
2316
  placeholder: S("editor.inputNodeForm.optionDescription"),
2317
- value: f,
2318
- onChange: (e) => p(e.target.value),
2317
+ value: d,
2318
+ onChange: (e) => f(e.target.value),
2319
2319
  onKeyDown: ce
2320
2320
  }),
2321
2321
  /* @__PURE__ */ q("div", {
@@ -2332,7 +2332,7 @@ var gr = ({ onSelect: t }) => {
2332
2332
  size: "sm",
2333
2333
  className: "tg:flex-1",
2334
2334
  disabled: !(a.trim() || s.trim()),
2335
- children: S(g === null ? "common.create" : "common.save")
2335
+ children: S(p === null ? "common.create" : "common.save")
2336
2336
  })]
2337
2337
  })
2338
2338
  ]
@@ -2341,24 +2341,24 @@ var gr = ({ onSelect: t }) => {
2341
2341
  })]
2342
2342
  })
2343
2343
  ] });
2344
- }, pi = ({ nodeId: e, label: t, placeholder: n, className: r, autoFocus: i }) => {
2345
- let { language: a } = Z(), { updateNodeData: s, clearSelection: c } = Rr(), l = Q(), u = rt(null), f = d(t, a), p = n || l("editor.treegeNode.labelPlaceholder");
2344
+ }, pi = ({ nodeId: e, label: t, placeholder: n, className: r, autoFocus: o }) => {
2345
+ let { language: s } = Z(), { updateNodeData: c, clearSelection: l } = Rr(), u = Q(), d = rt(null), f = a(t, s), p = n || u("editor.treegeNode.labelPlaceholder");
2346
2346
  return H(() => {
2347
- if (!i) return;
2347
+ if (!o) return;
2348
2348
  let e = setTimeout(() => {
2349
- u.current?.focus();
2349
+ d.current?.focus();
2350
2350
  }, 300);
2351
2351
  return () => clearTimeout(e);
2352
- }, [i]), /* @__PURE__ */ K("input", {
2353
- ref: u,
2352
+ }, [o]), /* @__PURE__ */ K("input", {
2353
+ ref: d,
2354
2354
  type: "text",
2355
2355
  value: f,
2356
2356
  placeholder: p,
2357
2357
  onChange: (n) => {
2358
- s(e, { label: o(t, a, n.target.value) });
2358
+ c(e, { label: i(t, s, n.target.value) });
2359
2359
  },
2360
2360
  onKeyDown: (e) => {
2361
- e.key === "Enter" && (e.preventDefault(), u.current?.blur(), c());
2361
+ e.key === "Enter" && (e.preventDefault(), d.current?.blur(), l());
2362
2362
  },
2363
2363
  className: I("nodrag nopan tg:w-full tg:truncate tg:bg-transparent tg:outline-none tg:placeholder:text-muted-foreground/40", r)
2364
2364
  });
@@ -2513,18 +2513,18 @@ var Si = (e) => Ye(xi((t) => {
2513
2513
  })]
2514
2514
  })
2515
2515
  }) : null;
2516
- }, wi = Object.values(M), Ti = Object.values(tr), Ei = ({ nodeId: t, nodeType: n, subType: r }) => {
2517
- let { updateNodeType: i } = Rr(), { getEdges: a } = Je(), { openNodeTypeChangeConfirmation: o } = Z(), s = Q(), c = (e) => e.stopPropagation(), l = r || n, u = l, d = ir(l), f = (n, r) => {
2518
- let s = a().filter((e) => e.source === t).length;
2519
- if (n === e.ui && s > 1) {
2516
+ }, wi = Object.values(M), Ti = Object.values(tr), Ei = ({ nodeId: e, nodeType: t, subType: n }) => {
2517
+ let { updateNodeType: i } = Rr(), { getEdges: a } = Je(), { openNodeTypeChangeConfirmation: o } = Z(), s = Q(), c = (e) => e.stopPropagation(), l = n || t, u = l, d = ir(l), f = (t, n) => {
2518
+ let s = a().filter((t) => t.source === e).length;
2519
+ if (t === r.ui && s > 1) {
2520
2520
  o({
2521
- nodeId: t,
2522
- subType: r,
2523
- type: n
2521
+ nodeId: e,
2522
+ subType: n,
2523
+ type: t
2524
2524
  });
2525
2525
  return;
2526
2526
  }
2527
- i(t, n, r);
2527
+ i(e, t, n);
2528
2528
  };
2529
2529
  return /* @__PURE__ */ q(ar, { children: [/* @__PURE__ */ K(or, {
2530
2530
  asChild: !0,
@@ -2543,22 +2543,22 @@ var Si = (e) => Ye(xi((t) => {
2543
2543
  className: "treege-scrollbar tg:max-h-80",
2544
2544
  onClick: c,
2545
2545
  children: [
2546
- /* @__PURE__ */ q(cr, { children: [/* @__PURE__ */ K(dr, { children: s("editor.selectNodeType.options.input") }), wi.map((t) => {
2547
- let i = ir(t);
2546
+ /* @__PURE__ */ q(cr, { children: [/* @__PURE__ */ K(dr, { children: s("editor.selectNodeType.options.input") }), wi.map((e) => {
2547
+ let i = ir(e);
2548
2548
  return /* @__PURE__ */ q($, {
2549
- onClick: () => f(e.input, t),
2550
- className: I("tg:capitalize", n === e.input && t === r && "tg:bg-accent"),
2551
- children: [/* @__PURE__ */ K(i, {}), t]
2552
- }, t);
2549
+ onClick: () => f(r.input, e),
2550
+ className: I("tg:capitalize", t === r.input && e === n && "tg:bg-accent"),
2551
+ children: [/* @__PURE__ */ K(i, {}), e]
2552
+ }, e);
2553
2553
  })] }),
2554
2554
  /* @__PURE__ */ K(fr, {}),
2555
- /* @__PURE__ */ q(cr, { children: [/* @__PURE__ */ K(dr, { children: s("editor.selectNodeType.options.ui") }), Ti.map((t) => {
2556
- let i = ir(t);
2555
+ /* @__PURE__ */ q(cr, { children: [/* @__PURE__ */ K(dr, { children: s("editor.selectNodeType.options.ui") }), Ti.map((e) => {
2556
+ let i = ir(e);
2557
2557
  return /* @__PURE__ */ q($, {
2558
- onClick: () => f(e.ui, t),
2559
- className: I("tg:capitalize", n === e.ui && t === r && "tg:bg-accent"),
2560
- children: [/* @__PURE__ */ K(i, {}), t]
2561
- }, t);
2558
+ onClick: () => f(r.ui, e),
2559
+ className: I("tg:capitalize", t === r.ui && e === n && "tg:bg-accent"),
2560
+ children: [/* @__PURE__ */ K(i, {}), e]
2561
+ }, e);
2562
2562
  })] })
2563
2563
  ]
2564
2564
  })] });
@@ -2635,9 +2635,9 @@ var Si = (e) => Ye(xi((t) => {
2635
2635
  ]
2636
2636
  });
2637
2637
  }), Ai = {
2638
- [e.group]: () => null,
2639
- [e.input]: ki,
2640
- [e.ui]: ki
2638
+ [r.group]: () => null,
2639
+ [r.input]: ki,
2640
+ [r.ui]: ki
2641
2641
  }, ji = ({ show: e, onToggle: t }) => /* @__PURE__ */ K(Ne, {
2642
2642
  onClick: t,
2643
2643
  title: e ? "Hide minimap" : "Show minimap",
@@ -3457,7 +3457,7 @@ var ca = ({ aiConfig: e, onGenerate: t }) => {
3457
3457
  })]
3458
3458
  });
3459
3459
  }, la = () => ({
3460
- hasInputNodes: Ye((t) => t.nodes.some((t) => t.type === e.input)),
3460
+ hasInputNodes: Ye((e) => e.nodes.some((e) => e.type === r.input)),
3461
3461
  isEmpty: Ye((e) => e.nodes.length === 0 && e.edges.length === 0)
3462
3462
  }), ua = { variant: "card" }, da = (e) => typeof e == "object" && !!e && !Array.isArray(e), fa = (e) => {
3463
3463
  if (e == null || e === "") return !0;
@@ -3739,7 +3739,7 @@ var ca = ({ aiConfig: e, onGenerate: t }) => {
3739
3739
  /* @__PURE__ */ K(fr, {}),
3740
3740
  /* @__PURE__ */ q(dr, {
3741
3741
  className: "tg:font-normal tg:text-muted-foreground tg:text-xs",
3742
- children: ["v", "3.0.0-beta.89"]
3742
+ children: ["v", "3.0.0-beta.90"]
3743
3743
  })
3744
3744
  ]
3745
3745
  })]
@@ -3769,7 +3769,7 @@ var ca = ({ aiConfig: e, onGenerate: t }) => {
3769
3769
  ]
3770
3770
  });
3771
3771
  }, Da = () => {
3772
- let { selectedNodes: e } = kr(), { clearSelection: t, deleteNodes: n } = Rr(), r = Q(), i = U(() => e.filter((e) => !b(e)), [e]);
3772
+ let { selectedNodes: e } = kr(), { clearSelection: t, deleteNodes: n } = Rr(), r = Q(), i = U(() => e.filter((e) => !d(e)), [e]);
3773
3773
  return i.length < 2 ? null : /* @__PURE__ */ K(Re, {
3774
3774
  position: "top-center",
3775
3775
  className: "tg:pointer-events-auto",
@@ -3830,8 +3830,8 @@ var ca = ({ aiConfig: e, onGenerate: t }) => {
3830
3830
  }, e)) }) })]
3831
3831
  }), ka = ({ value: e, language: t, onChange: n, ...r }) => /* @__PURE__ */ K(L, {
3832
3832
  ...r,
3833
- value: d(e, t),
3834
- onChange: ({ target: r }) => n(o(e, t, r.value))
3833
+ value: a(e, t),
3834
+ onChange: ({ target: r }) => n(i(e, t, r.value))
3835
3835
  }), Aa = () => {
3836
3836
  let [e, t] = W("en"), { selectedNode: n } = kr(), { updateSelectedNodeData: r } = Rr(), { Field: i } = it({
3837
3837
  defaultValues: { label: n?.data?.label || {} },
@@ -4030,7 +4030,7 @@ var ca = ({ aiConfig: e, onGenerate: t }) => {
4030
4030
  for (let [e, t] of Object.entries(i)) if (a.push(e), typeof t == "object" && t && !Array.isArray(t)) for (let n of Object.keys(t)) a.push(`${e}.${n}`);
4031
4031
  return a;
4032
4032
  }, Ba = ({ request: e, mapping: t, onMappingChange: r, showOptionalFields: i = !1 }) => {
4033
- let [a, o] = W(!1), [l, u] = W([]), [d, f] = W(null), { headers: p } = Z(), { baseUrl: m } = ii(), { url: h, method: g = "GET", headers: _, queryParams: y, body: b, responsePath: x = "" } = e, S = Q(), w = U(() => l.map((e) => ({
4033
+ let [a, c] = W(!1), [l, u] = W([]), [d, f] = W(null), { headers: p } = Z(), { baseUrl: m } = ii(), { url: h, method: g = "GET", headers: _, queryParams: y, body: b, responsePath: x = "" } = e, S = Q(), w = U(() => l.map((e) => ({
4034
4034
  label: e,
4035
4035
  value: e
4036
4036
  })), [l]), T = U(() => {
@@ -4050,14 +4050,14 @@ var ca = ({ aiConfig: e, onGenerate: t }) => {
4050
4050
  X.error(S("editor.optionsSourceForm.urlRequired"));
4051
4051
  return;
4052
4052
  }
4053
- o(!0);
4053
+ c(!0);
4054
4054
  try {
4055
- let e = await c({
4055
+ let e = await s({
4056
4056
  body: b && Ra.includes(g) ? b : void 0,
4057
4057
  headers: v(p, _),
4058
4058
  method: g,
4059
4059
  queryParams: y,
4060
- url: s(h, m)
4060
+ url: o(h, m)
4061
4061
  });
4062
4062
  if (!e.success) {
4063
4063
  X.error(e.error || S("editor.optionsSourceForm.detectFailed"), D);
@@ -4072,7 +4072,7 @@ var ca = ({ aiConfig: e, onGenerate: t }) => {
4072
4072
  } catch (e) {
4073
4073
  X.error(e instanceof Error ? e.message : S("editor.optionsSourceForm.detectFailed"), D);
4074
4074
  } finally {
4075
- o(!1);
4075
+ c(!1);
4076
4076
  }
4077
4077
  }, ee = (e, n, i, a) => {
4078
4078
  let o = t[e] ?? "";
@@ -6192,53 +6192,53 @@ var uo = (e) => Object.values(wa).includes(e), fo = () => {
6192
6192
  })
6193
6193
  });
6194
6194
  }, mo = Object.values(M), ho = Object.values(tr), go = () => {
6195
- let { selectedNode: t } = kr(), { updateSelectedNodeType: n } = Rr(), { getEdges: r } = Je(), { openNodeTypeChangeConfirmation: i } = Z(), o = b(t), s = Q(), c = nt(), l = () => t ? a(t) || f(t) ? t.data?.type || "" : t.type || "" : "", u = (a, o) => {
6196
- if (!t) return;
6197
- let s = r().filter((e) => e.source === t.id).length;
6198
- if (a === e.ui && s > 1) {
6195
+ let { selectedNode: e } = kr(), { updateSelectedNodeType: t } = Rr(), { getEdges: n } = Je(), { openNodeTypeChangeConfirmation: i } = Z(), a = d(e), o = Q(), s = nt(), c = () => e ? u(e) || f(e) ? e.data?.type || "" : e.type || "" : "", l = (a, o) => {
6196
+ if (!e) return;
6197
+ let s = n().filter((t) => t.source === e.id).length;
6198
+ if (a === r.ui && s > 1) {
6199
6199
  i({
6200
- nodeId: t.id,
6200
+ nodeId: e.id,
6201
6201
  subType: o,
6202
6202
  type: a
6203
6203
  });
6204
6204
  return;
6205
6205
  }
6206
- n(a, o);
6206
+ t(a, o);
6207
6207
  };
6208
6208
  return /* @__PURE__ */ q(k, { children: [/* @__PURE__ */ K(fe, {
6209
- htmlFor: c,
6210
- children: s("editor.selectNodeType.nodeType")
6209
+ htmlFor: s,
6210
+ children: o("editor.selectNodeType.nodeType")
6211
6211
  }), /* @__PURE__ */ q(A, {
6212
- value: l(),
6213
- onValueChange: (t) => {
6214
- if (mo.includes(t)) {
6215
- u(e.input, t);
6212
+ value: c(),
6213
+ onValueChange: (e) => {
6214
+ if (mo.includes(e)) {
6215
+ l(r.input, e);
6216
6216
  return;
6217
6217
  }
6218
- if (ho.includes(t)) {
6219
- u(e.ui, t);
6218
+ if (ho.includes(e)) {
6219
+ l(r.ui, e);
6220
6220
  return;
6221
6221
  }
6222
- u(t);
6222
+ l(e);
6223
6223
  },
6224
- disabled: o,
6224
+ disabled: a,
6225
6225
  children: [/* @__PURE__ */ K(j, {
6226
6226
  className: "tg:w-full tg:capitalize",
6227
- id: c,
6228
- children: /* @__PURE__ */ K(C, { placeholder: s("editor.selectNodeType.nodeType") })
6227
+ id: s,
6228
+ children: /* @__PURE__ */ K(C, { placeholder: o("editor.selectNodeType.nodeType") })
6229
6229
  }), /* @__PURE__ */ K(R, {
6230
6230
  className: "treege-scrollbar tg:max-h-80",
6231
- children: o ? /* @__PURE__ */ K(k, { children: /* @__PURE__ */ K(N, {
6232
- value: e.group,
6233
- children: s("editor.selectNodeType.options.group")
6231
+ children: a ? /* @__PURE__ */ K(k, { children: /* @__PURE__ */ K(N, {
6232
+ value: r.group,
6233
+ children: o("editor.selectNodeType.options.group")
6234
6234
  }) }) : /* @__PURE__ */ q(G, { children: [
6235
- /* @__PURE__ */ q(k, { children: [/* @__PURE__ */ K(fe, { children: s("editor.selectNodeType.options.input") }), mo.map((e) => /* @__PURE__ */ q(N, {
6235
+ /* @__PURE__ */ q(k, { children: [/* @__PURE__ */ K(fe, { children: o("editor.selectNodeType.options.input") }), mo.map((e) => /* @__PURE__ */ q(N, {
6236
6236
  value: e,
6237
6237
  className: "tg:capitalize",
6238
6238
  children: [/* @__PURE__ */ K(ir(e), {}), e]
6239
6239
  }, e))] }),
6240
6240
  /* @__PURE__ */ K(pe, {}),
6241
- /* @__PURE__ */ q(k, { children: [/* @__PURE__ */ K(fe, { children: s("editor.selectNodeType.options.ui") }), ho.map((e) => /* @__PURE__ */ q(N, {
6241
+ /* @__PURE__ */ q(k, { children: [/* @__PURE__ */ K(fe, { children: o("editor.selectNodeType.options.ui") }), ho.map((e) => /* @__PURE__ */ q(N, {
6242
6242
  value: e,
6243
6243
  className: "tg:capitalize",
6244
6244
  children: [/* @__PURE__ */ K(ir(e), {}), e]
@@ -6318,28 +6318,28 @@ function wo({ className: e, ...t }) {
6318
6318
  //#endregion
6319
6319
  //#region src/editor/features/TreegeEditor/sheets/NodeActionsSheet.tsx
6320
6320
  var To = () => {
6321
- let { selectedNode: e } = kr(), { clearSelection: t } = Rr(), { isNodeSheetOpen: n, setIsNodeSheetOpen: r, openDeleteNodeConfirmation: i } = Z(), o = Q(), s = o(e?.data?.label), c = () => {
6321
+ let { selectedNode: e } = kr(), { clearSelection: t } = Rr(), { isNodeSheetOpen: n, setIsNodeSheetOpen: r, openDeleteNodeConfirmation: i } = Z(), a = Q(), o = a(e?.data?.label), s = () => {
6322
6322
  r(!1), t();
6323
6323
  };
6324
6324
  return /* @__PURE__ */ K(_o, {
6325
6325
  open: n && !!e,
6326
6326
  onOpenChange: (e) => {
6327
- e || c();
6327
+ e || s();
6328
6328
  },
6329
6329
  children: /* @__PURE__ */ q(bo, {
6330
6330
  className: "tg:flex tg:flex-col tg:gap-0",
6331
6331
  onKeyDown: (e) => {
6332
- e.key !== "Enter" || e.defaultPrevented || e.target.tagName === "INPUT" && (e.preventDefault(), c());
6332
+ e.key !== "Enter" || e.defaultPrevented || e.target.tagName === "INPUT" && (e.preventDefault(), s());
6333
6333
  },
6334
6334
  children: [
6335
6335
  /* @__PURE__ */ q(xo, { children: [/* @__PURE__ */ q(Co, { children: [
6336
- o("editor.nodeActionsSheet.editNode"),
6336
+ a("editor.nodeActionsSheet.editNode"),
6337
6337
  " ",
6338
6338
  /* @__PURE__ */ K("span", {
6339
6339
  className: "tg:font-light tg:text-muted-foreground tg:text-xs",
6340
6340
  children: e?.id
6341
6341
  })
6342
- ] }), /* @__PURE__ */ K(wo, { children: s || "\xA0" })] }),
6342
+ ] }), /* @__PURE__ */ K(wo, { children: o || "\xA0" })] }),
6343
6343
  /* @__PURE__ */ K(Gn, {
6344
6344
  className: "tg:flex tg:min-h-0 tg:flex-1 tg:flex-col tg:px-4",
6345
6345
  children: /* @__PURE__ */ q("div", {
@@ -6348,9 +6348,9 @@ var To = () => {
6348
6348
  /* @__PURE__ */ K(go, {}),
6349
6349
  /* @__PURE__ */ K(Ar, {}),
6350
6350
  /* @__PURE__ */ K(ce, {}),
6351
- a(e) && /* @__PURE__ */ K(fo, {}),
6351
+ u(e) && /* @__PURE__ */ K(fo, {}),
6352
6352
  f(e) && /* @__PURE__ */ K(po, {}),
6353
- b(e) && /* @__PURE__ */ K(Aa, {})
6353
+ d(e) && /* @__PURE__ */ K(Aa, {})
6354
6354
  ]
6355
6355
  })
6356
6356
  }),
@@ -6362,7 +6362,7 @@ var To = () => {
6362
6362
  onClick: () => {
6363
6363
  e && i(e.id);
6364
6364
  },
6365
- "aria-label": o("editor.nodeActionsSheet.deleteNode"),
6365
+ "aria-label": a("editor.nodeActionsSheet.deleteNode"),
6366
6366
  children: /* @__PURE__ */ K(on, {})
6367
6367
  })
6368
6368
  })