@object-ui/plugin-workflow 3.0.3 → 3.1.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.
package/dist/index.js CHANGED
@@ -1,151 +1,153 @@
1
- import { ComponentRegistry as ie } from "@object-ui/core";
2
- import ge, { useState as $, useMemo as je, useCallback as P } from "react";
3
- import { Input as C, Badge as N, Button as R, Card as S, CardHeader as Y, CardTitle as W, CardContent as A, Label as b } from "@object-ui/components";
4
- import { Save as ve, Play as ce, GitBranch as de, Trash2 as ae, ArrowRight as ue, Plus as be, Settings as Ne, Code as ye, Bell as we, Clock as me, Users as Ee, Circle as ke, CheckCircle as Re, MessageSquare as _e, Check as Te, X as Ce, RefreshCw as Se, User as Ae } from "lucide-react";
5
- var z = { exports: {} }, I = {};
6
- var le;
7
- function Oe() {
8
- if (le) return I;
9
- le = 1;
10
- var f = /* @__PURE__ */ Symbol.for("react.transitional.element"), y = /* @__PURE__ */ Symbol.for("react.fragment");
11
- function l(j, a, d) {
12
- var h = null;
13
- if (d !== void 0 && (h = "" + d), a.key !== void 0 && (h = "" + a.key), "key" in a) {
14
- d = {};
15
- for (var g in a)
16
- g !== "key" && (d[g] = a[g]);
17
- } else d = a;
18
- return a = d.ref, {
19
- $$typeof: f,
20
- type: j,
21
- key: h,
22
- ref: a !== void 0 ? a : null,
23
- props: d
1
+ import { ComponentRegistry as we } from "@object-ui/core";
2
+ import hs, { useState as $, useMemo as Se, useCallback as _, useRef as $e } from "react";
3
+ import { Input as S, Badge as I, Button as T, Card as q, CardHeader as J, CardTitle as Z, CardContent as X, Label as h, Select as U, SelectTrigger as B, SelectValue as H, SelectContent as W, SelectItem as Y, Separator as ce, Switch as ps } from "@object-ui/components";
4
+ import { Save as Qe, Play as Ve, GitBranch as Re, Trash2 as ye, ArrowRight as es, Plus as Ye, Settings as ze, Code as ss, Bell as Ue, Clock as me, Users as Fe, Circle as gs, CheckCircle as Be, MessageSquare as js, Check as fs, X as bs, RefreshCw as Ns, User as vs, Zap as Me, Globe as ts, FileEdit as ys, Mail as ws, Undo2 as ks, Redo2 as Cs, ZoomIn as Es, RotateCcw as _s, ZoomOut as Ts, History as Ss, Download as Rs, Upload as As, PanelRightClose as Ps, PanelRightOpen as Os, Link as Ds, AlertCircle as as, GitMerge as $s, Square as Is, SkipForward as Fs, Loader2 as Ms } from "lucide-react";
5
+ import { clsx as Ls } from "clsx";
6
+ import { twMerge as Vs } from "tailwind-merge";
7
+ var Te = { exports: {} }, je = {};
8
+ var We;
9
+ function Ys() {
10
+ if (We) return je;
11
+ We = 1;
12
+ var n = /* @__PURE__ */ Symbol.for("react.transitional.element"), c = /* @__PURE__ */ Symbol.for("react.fragment");
13
+ function a(d, o, t) {
14
+ var u = null;
15
+ if (t !== void 0 && (u = "" + t), o.key !== void 0 && (u = "" + o.key), "key" in o) {
16
+ t = {};
17
+ for (var g in o)
18
+ g !== "key" && (t[g] = o[g]);
19
+ } else t = o;
20
+ return o = t.ref, {
21
+ $$typeof: n,
22
+ type: d,
23
+ key: u,
24
+ ref: o !== void 0 ? o : null,
25
+ props: t
24
26
  };
25
27
  }
26
- return I.Fragment = y, I.jsx = l, I.jsxs = l, I;
28
+ return je.Fragment = c, je.jsx = a, je.jsxs = a, je;
27
29
  }
28
- var D = {};
29
- var ne;
30
- function Pe() {
31
- return ne || (ne = 1, process.env.NODE_ENV !== "production" && (function() {
32
- function f(s) {
30
+ var fe = {};
31
+ var qe;
32
+ function zs() {
33
+ return qe || (qe = 1, process.env.NODE_ENV !== "production" && (function() {
34
+ function n(s) {
33
35
  if (s == null) return null;
34
36
  if (typeof s == "function")
35
- return s.$$typeof === pe ? null : s.displayName || s.name || null;
37
+ return s.$$typeof === G ? null : s.displayName || s.name || null;
36
38
  if (typeof s == "string") return s;
37
39
  switch (s) {
38
- case O:
40
+ case i:
39
41
  return "Fragment";
40
- case F:
42
+ case R:
41
43
  return "Profiler";
42
- case V:
44
+ case b:
43
45
  return "StrictMode";
44
- case x:
46
+ case P:
45
47
  return "Suspense";
46
- case p:
48
+ case M:
47
49
  return "SuspenseList";
48
- case xe:
50
+ case E:
49
51
  return "Activity";
50
52
  }
51
53
  if (typeof s == "object")
52
54
  switch (typeof s.tag == "number" && console.error(
53
55
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
54
56
  ), s.$$typeof) {
55
- case L:
57
+ case de:
56
58
  return "Portal";
57
59
  case r:
58
60
  return s.displayName || "Context";
59
- case q:
61
+ case C:
60
62
  return (s._context.displayName || "Context") + ".Consumer";
61
- case n:
62
- var t = s.render;
63
- return s = s.displayName, s || (s = t.displayName || t.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
64
- case M:
65
- return t = s.displayName || null, t !== null ? t : f(s.type) || "Memo";
66
- case B:
67
- t = s._payload, s = s._init;
63
+ case j:
64
+ var x = s.render;
65
+ return s = s.displayName, s || (s = x.displayName || x.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
66
+ case ue:
67
+ return x = s.displayName || null, x !== null ? x : n(s.type) || "Memo";
68
+ case N:
69
+ x = s._payload, s = s._init;
68
70
  try {
69
- return f(s(t));
71
+ return n(s(x));
70
72
  } catch {
71
73
  }
72
74
  }
73
75
  return null;
74
76
  }
75
- function y(s) {
77
+ function c(s) {
76
78
  return "" + s;
77
79
  }
78
- function l(s) {
80
+ function a(s) {
79
81
  try {
80
- y(s);
81
- var t = !1;
82
+ c(s);
83
+ var x = !1;
82
84
  } catch {
83
- t = !0;
85
+ x = !0;
84
86
  }
85
- if (t) {
86
- t = console;
87
- var c = t.error, u = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
88
- return c.call(
89
- t,
87
+ if (x) {
88
+ x = console;
89
+ var y = x.error, A = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
90
+ return y.call(
91
+ x,
90
92
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
91
- u
92
- ), y(s);
93
+ A
94
+ ), c(s);
93
95
  }
94
96
  }
95
- function j(s) {
96
- if (s === O) return "<>";
97
- if (typeof s == "object" && s !== null && s.$$typeof === B)
97
+ function d(s) {
98
+ if (s === i) return "<>";
99
+ if (typeof s == "object" && s !== null && s.$$typeof === N)
98
100
  return "<...>";
99
101
  try {
100
- var t = f(s);
101
- return t ? "<" + t + ">" : "<...>";
102
+ var x = n(s);
103
+ return x ? "<" + x + ">" : "<...>";
102
104
  } catch {
103
105
  return "<...>";
104
106
  }
105
107
  }
106
- function a() {
107
- var s = G.A;
108
+ function o() {
109
+ var s = K.A;
108
110
  return s === null ? null : s.getOwner();
109
111
  }
110
- function d() {
112
+ function t() {
111
113
  return Error("react-stack-top-frame");
112
114
  }
113
- function h(s) {
114
- if (Z.call(s, "key")) {
115
- var t = Object.getOwnPropertyDescriptor(s, "key").get;
116
- if (t && t.isReactWarning) return !1;
115
+ function u(s) {
116
+ if (z.call(s, "key")) {
117
+ var x = Object.getOwnPropertyDescriptor(s, "key").get;
118
+ if (x && x.isReactWarning) return !1;
117
119
  }
118
120
  return s.key !== void 0;
119
121
  }
120
- function g(s, t) {
121
- function c() {
122
- K || (K = !0, console.error(
122
+ function g(s, x) {
123
+ function y() {
124
+ re || (re = !0, console.error(
123
125
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
124
- t
126
+ x
125
127
  ));
126
128
  }
127
- c.isReactWarning = !0, Object.defineProperty(s, "key", {
128
- get: c,
129
+ y.isReactWarning = !0, Object.defineProperty(s, "key", {
130
+ get: y,
129
131
  configurable: !0
130
132
  });
131
133
  }
132
- function _() {
133
- var s = f(this.type);
134
+ function F() {
135
+ var s = n(this.type);
134
136
  return ee[s] || (ee[s] = !0, console.error(
135
137
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
136
138
  )), s = this.props.ref, s !== void 0 ? s : null;
137
139
  }
138
- function w(s, t, c, u, U, J) {
139
- var m = c.ref;
140
+ function O(s, x, y, A, se, ne) {
141
+ var w = y.ref;
140
142
  return s = {
141
- $$typeof: k,
143
+ $$typeof: L,
142
144
  type: s,
143
- key: t,
144
- props: c,
145
- _owner: u
146
- }, (m !== void 0 ? m : null) !== null ? Object.defineProperty(s, "ref", {
145
+ key: x,
146
+ props: y,
147
+ _owner: A
148
+ }, (w !== void 0 ? w : null) !== null ? Object.defineProperty(s, "ref", {
147
149
  enumerable: !1,
148
- get: _
150
+ get: F
149
151
  }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
150
152
  configurable: !1,
151
153
  enumerable: !1,
@@ -160,119 +162,119 @@ function Pe() {
160
162
  configurable: !1,
161
163
  enumerable: !1,
162
164
  writable: !0,
163
- value: U
165
+ value: se
164
166
  }), Object.defineProperty(s, "_debugTask", {
165
167
  configurable: !1,
166
168
  enumerable: !1,
167
169
  writable: !0,
168
- value: J
170
+ value: ne
169
171
  }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
170
172
  }
171
- function o(s, t, c, u, U, J) {
172
- var m = t.children;
173
- if (m !== void 0)
174
- if (u)
175
- if (fe(m)) {
176
- for (u = 0; u < m.length; u++)
177
- E(m[u]);
178
- Object.freeze && Object.freeze(m);
173
+ function p(s, x, y, A, se, ne) {
174
+ var w = x.children;
175
+ if (w !== void 0)
176
+ if (A)
177
+ if (ae(w)) {
178
+ for (A = 0; A < w.length; A++)
179
+ k(w[A]);
180
+ Object.freeze && Object.freeze(w);
179
181
  } else
180
182
  console.error(
181
183
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
182
184
  );
183
- else E(m);
184
- if (Z.call(t, "key")) {
185
- m = f(s);
186
- var T = Object.keys(t).filter(function(he) {
187
- return he !== "key";
185
+ else k(w);
186
+ if (z.call(x, "key")) {
187
+ w = n(s);
188
+ var te = Object.keys(x).filter(function(pe) {
189
+ return pe !== "key";
188
190
  });
189
- u = 0 < T.length ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}", te[m + u] || (T = 0 < T.length ? "{" + T.join(": ..., ") + ": ...}" : "{}", console.error(
191
+ A = 0 < te.length ? "{key: someKey, " + te.join(": ..., ") + ": ...}" : "{key: someKey}", ke[w + A] || (te = 0 < te.length ? "{" + te.join(": ..., ") + ": ...}" : "{}", console.error(
190
192
  `A props object containing a "key" prop is being spread into JSX:
191
193
  let props = %s;
192
194
  <%s {...props} />
193
195
  React keys must be passed directly to JSX without using spread:
194
196
  let props = %s;
195
197
  <%s key={someKey} {...props} />`,
196
- u,
197
- m,
198
- T,
199
- m
200
- ), te[m + u] = !0);
198
+ A,
199
+ w,
200
+ te,
201
+ w
202
+ ), ke[w + A] = !0);
201
203
  }
202
- if (m = null, c !== void 0 && (l(c), m = "" + c), h(t) && (l(t.key), m = "" + t.key), "key" in t) {
203
- c = {};
204
- for (var X in t)
205
- X !== "key" && (c[X] = t[X]);
206
- } else c = t;
207
- return m && g(
208
- c,
204
+ if (w = null, y !== void 0 && (a(y), w = "" + y), u(x) && (a(x.key), w = "" + x.key), "key" in x) {
205
+ y = {};
206
+ for (var he in x)
207
+ he !== "key" && (y[he] = x[he]);
208
+ } else y = x;
209
+ return w && g(
210
+ y,
209
211
  typeof s == "function" ? s.displayName || s.name || "Unknown" : s
210
- ), w(
212
+ ), O(
211
213
  s,
212
- m,
213
- c,
214
- a(),
215
- U,
216
- J
214
+ w,
215
+ y,
216
+ o(),
217
+ se,
218
+ ne
217
219
  );
218
220
  }
219
- function E(s) {
220
- v(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === B && (s._payload.status === "fulfilled" ? v(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
221
+ function k(s) {
222
+ v(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === N && (s._payload.status === "fulfilled" ? v(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
221
223
  }
222
224
  function v(s) {
223
- return typeof s == "object" && s !== null && s.$$typeof === k;
225
+ return typeof s == "object" && s !== null && s.$$typeof === L;
224
226
  }
225
- var i = ge, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), L = /* @__PURE__ */ Symbol.for("react.portal"), O = /* @__PURE__ */ Symbol.for("react.fragment"), V = /* @__PURE__ */ Symbol.for("react.strict_mode"), F = /* @__PURE__ */ Symbol.for("react.profiler"), q = /* @__PURE__ */ Symbol.for("react.consumer"), r = /* @__PURE__ */ Symbol.for("react.context"), n = /* @__PURE__ */ Symbol.for("react.forward_ref"), x = /* @__PURE__ */ Symbol.for("react.suspense"), p = /* @__PURE__ */ Symbol.for("react.suspense_list"), M = /* @__PURE__ */ Symbol.for("react.memo"), B = /* @__PURE__ */ Symbol.for("react.lazy"), xe = /* @__PURE__ */ Symbol.for("react.activity"), pe = /* @__PURE__ */ Symbol.for("react.client.reference"), G = i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Z = Object.prototype.hasOwnProperty, fe = Array.isArray, H = console.createTask ? console.createTask : function() {
227
+ var f = hs, L = /* @__PURE__ */ Symbol.for("react.transitional.element"), de = /* @__PURE__ */ Symbol.for("react.portal"), i = /* @__PURE__ */ Symbol.for("react.fragment"), b = /* @__PURE__ */ Symbol.for("react.strict_mode"), R = /* @__PURE__ */ Symbol.for("react.profiler"), C = /* @__PURE__ */ Symbol.for("react.consumer"), r = /* @__PURE__ */ Symbol.for("react.context"), j = /* @__PURE__ */ Symbol.for("react.forward_ref"), P = /* @__PURE__ */ Symbol.for("react.suspense"), M = /* @__PURE__ */ Symbol.for("react.suspense_list"), ue = /* @__PURE__ */ Symbol.for("react.memo"), N = /* @__PURE__ */ Symbol.for("react.lazy"), E = /* @__PURE__ */ Symbol.for("react.activity"), G = /* @__PURE__ */ Symbol.for("react.client.reference"), K = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, z = Object.prototype.hasOwnProperty, ae = Array.isArray, Q = console.createTask ? console.createTask : function() {
226
228
  return null;
227
229
  };
228
- i = {
230
+ f = {
229
231
  react_stack_bottom_frame: function(s) {
230
232
  return s();
231
233
  }
232
234
  };
233
- var K, ee = {}, se = i.react_stack_bottom_frame.bind(
234
- i,
235
- d
236
- )(), re = H(j(d)), te = {};
237
- D.Fragment = O, D.jsx = function(s, t, c) {
238
- var u = 1e4 > G.recentlyCreatedOwnerStacks++;
239
- return o(
235
+ var re, ee = {}, le = f.react_stack_bottom_frame.bind(
236
+ f,
237
+ t
238
+ )(), xe = Q(d(t)), ke = {};
239
+ fe.Fragment = i, fe.jsx = function(s, x, y) {
240
+ var A = 1e4 > K.recentlyCreatedOwnerStacks++;
241
+ return p(
240
242
  s,
241
- t,
242
- c,
243
+ x,
244
+ y,
243
245
  !1,
244
- u ? Error("react-stack-top-frame") : se,
245
- u ? H(j(s)) : re
246
+ A ? Error("react-stack-top-frame") : le,
247
+ A ? Q(d(s)) : xe
246
248
  );
247
- }, D.jsxs = function(s, t, c) {
248
- var u = 1e4 > G.recentlyCreatedOwnerStacks++;
249
- return o(
249
+ }, fe.jsxs = function(s, x, y) {
250
+ var A = 1e4 > K.recentlyCreatedOwnerStacks++;
251
+ return p(
250
252
  s,
251
- t,
252
- c,
253
+ x,
254
+ y,
253
255
  !0,
254
- u ? Error("react-stack-top-frame") : se,
255
- u ? H(j(s)) : re
256
+ A ? Error("react-stack-top-frame") : le,
257
+ A ? Q(d(s)) : xe
256
258
  );
257
259
  };
258
- })()), D;
260
+ })()), fe;
259
261
  }
260
- var oe;
261
- function Ie() {
262
- return oe || (oe = 1, process.env.NODE_ENV === "production" ? z.exports = Oe() : z.exports = Pe()), z.exports;
262
+ var Xe;
263
+ function Us() {
264
+ return Xe || (Xe = 1, process.env.NODE_ENV === "production" ? Te.exports = Ys() : Te.exports = zs()), Te.exports;
263
265
  }
264
- var e = Ie();
265
- const Q = {
266
- start: /* @__PURE__ */ e.jsx(ce, { className: "h-4 w-4 text-green-500" }),
267
- end: /* @__PURE__ */ e.jsx(Re, { className: "h-4 w-4 text-red-500" }),
268
- task: /* @__PURE__ */ e.jsx(ke, { className: "h-4 w-4 text-blue-500" }),
269
- approval: /* @__PURE__ */ e.jsx(Ee, { className: "h-4 w-4 text-purple-500" }),
270
- condition: /* @__PURE__ */ e.jsx(de, { className: "h-4 w-4 text-orange-500" }),
271
- parallel: /* @__PURE__ */ e.jsx(ue, { className: "h-4 w-4 text-teal-500" }),
266
+ var e = Us();
267
+ const Ie = {
268
+ start: /* @__PURE__ */ e.jsx(Ve, { className: "h-4 w-4 text-green-500" }),
269
+ end: /* @__PURE__ */ e.jsx(Be, { className: "h-4 w-4 text-red-500" }),
270
+ task: /* @__PURE__ */ e.jsx(gs, { className: "h-4 w-4 text-blue-500" }),
271
+ approval: /* @__PURE__ */ e.jsx(Fe, { className: "h-4 w-4 text-purple-500" }),
272
+ condition: /* @__PURE__ */ e.jsx(Re, { className: "h-4 w-4 text-orange-500" }),
273
+ parallel: /* @__PURE__ */ e.jsx(es, { className: "h-4 w-4 text-teal-500" }),
272
274
  delay: /* @__PURE__ */ e.jsx(me, { className: "h-4 w-4 text-gray-500" }),
273
- notification: /* @__PURE__ */ e.jsx(we, { className: "h-4 w-4 text-yellow-500" }),
274
- script: /* @__PURE__ */ e.jsx(ye, { className: "h-4 w-4 text-indigo-500" })
275
- }, De = {
275
+ notification: /* @__PURE__ */ e.jsx(Ue, { className: "h-4 w-4 text-yellow-500" }),
276
+ script: /* @__PURE__ */ e.jsx(ss, { className: "h-4 w-4 text-indigo-500" })
277
+ }, Bs = {
276
278
  start: "border-green-300 bg-green-50",
277
279
  end: "border-red-300 bg-red-50",
278
280
  task: "border-blue-300 bg-blue-50",
@@ -282,18 +284,18 @@ const Q = {
282
284
  delay: "border-gray-300 bg-gray-50",
283
285
  notification: "border-yellow-300 bg-yellow-50",
284
286
  script: "border-indigo-300 bg-indigo-50"
285
- }, $e = {
287
+ }, Hs = {
286
288
  draft: { variant: "secondary", label: "Draft" },
287
289
  active: { variant: "default", label: "Active" },
288
290
  paused: { variant: "outline", label: "Paused" },
289
291
  completed: { variant: "default", label: "Completed" },
290
292
  cancelled: { variant: "destructive", label: "Cancelled" }
291
- }, Ye = ({ schema: f }) => {
293
+ }, Ws = ({ schema: n }) => {
292
294
  const {
293
- workflow: y,
294
- readOnly: l = !1,
295
- showToolbar: j = !0
296
- } = f, [a, d] = $(y || {
295
+ workflow: c,
296
+ readOnly: a = !1,
297
+ showToolbar: d = !0
298
+ } = n, [o, t] = $(c || {
297
299
  type: "workflow",
298
300
  title: "New Workflow",
299
301
  status: "draft",
@@ -303,107 +305,107 @@ const Q = {
303
305
  ],
304
306
  edges: [],
305
307
  variables: []
306
- }), [h, g] = $(null), [_, w] = $(null), o = je(
307
- () => a.nodes.find((r) => r.id === h),
308
- [a.nodes, h]
309
- ), E = P((r) => {
310
- if (l) return;
311
- const n = `${r}-${Date.now()}`, x = {
312
- id: n,
308
+ }), [u, g] = $(null), [F, O] = $(null), p = Se(
309
+ () => o.nodes.find((r) => r.id === u),
310
+ [o.nodes, u]
311
+ ), k = _((r) => {
312
+ if (a) return;
313
+ const j = `${r}-${Date.now()}`, P = {
314
+ id: j,
313
315
  type: r,
314
316
  label: `New ${r.charAt(0).toUpperCase() + r.slice(1)}`,
315
- position: { x: 200, y: (a.nodes.length + 1) * 80 }
317
+ position: { x: 200, y: (o.nodes.length + 1) * 80 }
316
318
  };
317
- d((p) => ({
318
- ...p,
319
- nodes: [...p.nodes, x]
320
- })), g(n);
321
- }, [l, a.nodes.length]), v = P((r, n) => {
322
- l || d((x) => ({
323
- ...x,
324
- nodes: x.nodes.map((p) => p.id === r ? { ...p, ...n } : p)
325
- }));
326
- }, [l]), i = P((r) => {
327
- l || (d((n) => ({
328
- ...n,
329
- nodes: n.nodes.filter((x) => x.id !== r),
330
- edges: n.edges.filter((x) => x.source !== r && x.target !== r)
331
- })), h === r && g(null));
332
- }, [l, h]), k = P((r, n) => {
333
- if (l) return;
334
- const p = { id: `edge-${Date.now()}`, source: r, target: n };
335
- d((M) => ({
319
+ t((M) => ({
336
320
  ...M,
337
- edges: [...M.edges, p]
321
+ nodes: [...M.nodes, P]
322
+ })), g(j);
323
+ }, [a, o.nodes.length]), v = _((r, j) => {
324
+ a || t((P) => ({
325
+ ...P,
326
+ nodes: P.nodes.map((M) => M.id === r ? { ...M, ...j } : M)
338
327
  }));
339
- }, [l]), L = P((r) => {
340
- l || (d((n) => ({
341
- ...n,
342
- edges: n.edges.filter((x) => x.id !== r)
343
- })), _ === r && w(null));
344
- }, [l, _]), O = () => {
345
- console.log("Saving workflow:", a), f.onSave;
346
- }, V = () => {
347
- d((r) => ({ ...r, status: "active" })), console.log("Publishing workflow"), f.onPublish;
348
- }, F = $e[a.status || "draft"], q = ["task", "approval", "condition", "parallel", "delay", "notification", "script"];
328
+ }, [a]), f = _((r) => {
329
+ a || (t((j) => ({
330
+ ...j,
331
+ nodes: j.nodes.filter((P) => P.id !== r),
332
+ edges: j.edges.filter((P) => P.source !== r && P.target !== r)
333
+ })), u === r && g(null));
334
+ }, [a, u]), L = _((r, j) => {
335
+ if (a) return;
336
+ const M = { id: `edge-${Date.now()}`, source: r, target: j };
337
+ t((ue) => ({
338
+ ...ue,
339
+ edges: [...ue.edges, M]
340
+ }));
341
+ }, [a]), de = _((r) => {
342
+ a || (t((j) => ({
343
+ ...j,
344
+ edges: j.edges.filter((P) => P.id !== r)
345
+ })), F === r && O(null));
346
+ }, [a, F]), i = () => {
347
+ console.log("Saving workflow:", o), n.onSave;
348
+ }, b = () => {
349
+ t((r) => ({ ...r, status: "active" })), console.log("Publishing workflow"), n.onPublish;
350
+ }, R = Hs[o.status || "draft"], C = ["task", "approval", "condition", "parallel", "delay", "notification", "script"];
349
351
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
350
- j && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border", children: [
352
+ d && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border", children: [
351
353
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
352
354
  /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
353
- C,
355
+ S,
354
356
  {
355
- value: a.title || "",
356
- onChange: (r) => d((n) => ({ ...n, title: r.target.value })),
357
+ value: o.title || "",
358
+ onChange: (r) => t((j) => ({ ...j, title: r.target.value })),
357
359
  className: "text-lg font-semibold border-none p-0 h-auto focus-visible:ring-0",
358
- readOnly: l,
360
+ readOnly: a,
359
361
  placeholder: "Workflow Title"
360
362
  }
361
363
  ) }),
362
- /* @__PURE__ */ e.jsx(N, { variant: F.variant, children: F.label })
364
+ /* @__PURE__ */ e.jsx(I, { variant: R.variant, children: R.label })
363
365
  ] }),
364
- !l && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
365
- /* @__PURE__ */ e.jsxs(R, { variant: "outline", size: "sm", onClick: O, children: [
366
- /* @__PURE__ */ e.jsx(ve, { className: "h-4 w-4 mr-2" }),
366
+ !a && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
367
+ /* @__PURE__ */ e.jsxs(T, { variant: "outline", size: "sm", onClick: i, children: [
368
+ /* @__PURE__ */ e.jsx(Qe, { className: "h-4 w-4 mr-2" }),
367
369
  "Save"
368
370
  ] }),
369
- /* @__PURE__ */ e.jsxs(R, { size: "sm", onClick: V, disabled: a.status === "active", children: [
370
- /* @__PURE__ */ e.jsx(ce, { className: "h-4 w-4 mr-2" }),
371
+ /* @__PURE__ */ e.jsxs(T, { size: "sm", onClick: b, disabled: o.status === "active", children: [
372
+ /* @__PURE__ */ e.jsx(Ve, { className: "h-4 w-4 mr-2" }),
371
373
  "Publish"
372
374
  ] })
373
375
  ] })
374
376
  ] }),
375
377
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-4 gap-4", children: [
376
- !l && /* @__PURE__ */ e.jsxs(S, { className: "lg:col-span-1", children: [
377
- /* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsx(W, { className: "text-sm", children: "Add Node" }) }),
378
- /* @__PURE__ */ e.jsx(A, { className: "space-y-2", children: q.map((r) => /* @__PURE__ */ e.jsxs(
378
+ !a && /* @__PURE__ */ e.jsxs(q, { className: "lg:col-span-1", children: [
379
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(Z, { className: "text-sm", children: "Add Node" }) }),
380
+ /* @__PURE__ */ e.jsx(X, { className: "space-y-2", children: C.map((r) => /* @__PURE__ */ e.jsxs(
379
381
  "button",
380
382
  {
381
- onClick: () => E(r),
383
+ onClick: () => k(r),
382
384
  className: "w-full flex items-center gap-2 p-2 rounded-md border hover:bg-muted/50 transition-colors text-sm",
383
385
  children: [
384
- Q[r],
386
+ Ie[r],
385
387
  /* @__PURE__ */ e.jsx("span", { className: "capitalize", children: r })
386
388
  ]
387
389
  },
388
390
  r
389
391
  )) })
390
392
  ] }),
391
- /* @__PURE__ */ e.jsxs(S, { className: l ? "lg:col-span-3" : "lg:col-span-2", children: [
392
- /* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsxs(W, { className: "text-sm flex items-center gap-2", children: [
393
- /* @__PURE__ */ e.jsx(de, { className: "h-4 w-4" }),
393
+ /* @__PURE__ */ e.jsxs(q, { className: a ? "lg:col-span-3" : "lg:col-span-2", children: [
394
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(Z, { className: "text-sm flex items-center gap-2", children: [
395
+ /* @__PURE__ */ e.jsx(Re, { className: "h-4 w-4" }),
394
396
  "Workflow Flow"
395
397
  ] }) }),
396
- /* @__PURE__ */ e.jsx(A, { children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
397
- a.nodes.map((r) => /* @__PURE__ */ e.jsxs(
398
+ /* @__PURE__ */ e.jsx(X, { children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
399
+ o.nodes.map((r) => /* @__PURE__ */ e.jsxs(
398
400
  "div",
399
401
  {
400
402
  onClick: () => {
401
- g(r.id), w(null);
403
+ g(r.id), O(null);
402
404
  },
403
- className: `flex items-center justify-between p-3 rounded-lg border-2 cursor-pointer transition-all ${De[r.type]} ${h === r.id ? "ring-2 ring-primary shadow-md" : "hover:shadow-sm"}`,
405
+ className: `flex items-center justify-between p-3 rounded-lg border-2 cursor-pointer transition-all ${Bs[r.type]} ${u === r.id ? "ring-2 ring-primary shadow-md" : "hover:shadow-sm"}`,
404
406
  children: [
405
407
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
406
- Q[r.type],
408
+ Ie[r.type],
407
409
  /* @__PURE__ */ e.jsx("span", { className: "font-medium text-sm", children: r.label }),
408
410
  /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground capitalize", children: [
409
411
  "(",
@@ -412,20 +414,20 @@ const Q = {
412
414
  ] })
413
415
  ] }),
414
416
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-1", children: [
415
- a.edges.filter((n) => n.source === r.id).length > 0 && /* @__PURE__ */ e.jsxs(N, { variant: "outline", className: "text-xs", children: [
416
- a.edges.filter((n) => n.source === r.id).length,
417
+ o.edges.filter((j) => j.source === r.id).length > 0 && /* @__PURE__ */ e.jsxs(I, { variant: "outline", className: "text-xs", children: [
418
+ o.edges.filter((j) => j.source === r.id).length,
417
419
  " out"
418
420
  ] }),
419
- !l && r.type !== "start" && r.type !== "end" && /* @__PURE__ */ e.jsx(
420
- R,
421
+ !a && r.type !== "start" && r.type !== "end" && /* @__PURE__ */ e.jsx(
422
+ T,
421
423
  {
422
424
  size: "sm",
423
425
  variant: "ghost",
424
426
  className: "h-6 w-6 p-0 text-red-500 hover:text-red-700",
425
- onClick: (n) => {
426
- n.stopPropagation(), i(r.id);
427
+ onClick: (j) => {
428
+ j.stopPropagation(), f(r.id);
427
429
  },
428
- children: /* @__PURE__ */ e.jsx(ae, { className: "h-3 w-3" })
430
+ children: /* @__PURE__ */ e.jsx(ye, { className: "h-3 w-3" })
429
431
  }
430
432
  )
431
433
  ] })
@@ -433,30 +435,30 @@ const Q = {
433
435
  },
434
436
  r.id
435
437
  )),
436
- a.edges.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "mt-4 pt-4 border-t", children: [
437
- /* @__PURE__ */ e.jsx(b, { className: "text-xs text-muted-foreground mb-2 block", children: "Connections" }),
438
- a.edges.map((r) => {
439
- const n = a.nodes.find((p) => p.id === r.source), x = a.nodes.find((p) => p.id === r.target);
438
+ o.edges.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "mt-4 pt-4 border-t", children: [
439
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs text-muted-foreground mb-2 block", children: "Connections" }),
440
+ o.edges.map((r) => {
441
+ const j = o.nodes.find((M) => M.id === r.source), P = o.nodes.find((M) => M.id === r.target);
440
442
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 p-2 text-sm", children: [
441
- /* @__PURE__ */ e.jsx("span", { children: n?.label || r.source }),
442
- /* @__PURE__ */ e.jsx(ue, { className: "h-3 w-3 text-muted-foreground" }),
443
- /* @__PURE__ */ e.jsx("span", { children: x?.label || r.target }),
444
- r.label && /* @__PURE__ */ e.jsx(N, { variant: "outline", className: "text-xs", children: r.label }),
445
- !l && /* @__PURE__ */ e.jsx(
446
- R,
443
+ /* @__PURE__ */ e.jsx("span", { children: j?.label || r.source }),
444
+ /* @__PURE__ */ e.jsx(es, { className: "h-3 w-3 text-muted-foreground" }),
445
+ /* @__PURE__ */ e.jsx("span", { children: P?.label || r.target }),
446
+ r.label && /* @__PURE__ */ e.jsx(I, { variant: "outline", className: "text-xs", children: r.label }),
447
+ !a && /* @__PURE__ */ e.jsx(
448
+ T,
447
449
  {
448
450
  size: "sm",
449
451
  variant: "ghost",
450
452
  className: "h-5 w-5 p-0 ml-auto text-red-500",
451
- onClick: () => L(r.id),
452
- children: /* @__PURE__ */ e.jsx(ae, { className: "h-3 w-3" })
453
+ onClick: () => de(r.id),
454
+ children: /* @__PURE__ */ e.jsx(ye, { className: "h-3 w-3" })
453
455
  }
454
456
  )
455
457
  ] }, r.id);
456
458
  })
457
459
  ] }),
458
- !l && a.nodes.length >= 2 && /* @__PURE__ */ e.jsxs("div", { className: "mt-4 pt-4 border-t", children: [
459
- /* @__PURE__ */ e.jsx(b, { className: "text-xs text-muted-foreground mb-2 block", children: "Quick Connect" }),
460
+ !a && o.nodes.length >= 2 && /* @__PURE__ */ e.jsxs("div", { className: "mt-4 pt-4 border-t", children: [
461
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs text-muted-foreground mb-2 block", children: "Quick Connect" }),
460
462
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
461
463
  /* @__PURE__ */ e.jsxs(
462
464
  "select",
@@ -465,7 +467,7 @@ const Q = {
465
467
  className: "border rounded-md p-1.5 text-sm bg-background",
466
468
  children: [
467
469
  /* @__PURE__ */ e.jsx("option", { value: "", children: "From..." }),
468
- a.nodes.filter((r) => r.type !== "end").map((r) => /* @__PURE__ */ e.jsx("option", { value: r.id, children: r.label }, r.id))
470
+ o.nodes.filter((r) => r.type !== "end").map((r) => /* @__PURE__ */ e.jsx("option", { value: r.id, children: r.label }, r.id))
469
471
  ]
470
472
  }
471
473
  ),
@@ -476,23 +478,23 @@ const Q = {
476
478
  className: "border rounded-md p-1.5 text-sm bg-background",
477
479
  children: [
478
480
  /* @__PURE__ */ e.jsx("option", { value: "", children: "To..." }),
479
- a.nodes.filter((r) => r.type !== "start").map((r) => /* @__PURE__ */ e.jsx("option", { value: r.id, children: r.label }, r.id))
481
+ o.nodes.filter((r) => r.type !== "start").map((r) => /* @__PURE__ */ e.jsx("option", { value: r.id, children: r.label }, r.id))
480
482
  ]
481
483
  }
482
484
  )
483
485
  ] }),
484
486
  /* @__PURE__ */ e.jsxs(
485
- R,
487
+ T,
486
488
  {
487
489
  size: "sm",
488
490
  variant: "outline",
489
491
  className: "mt-2 w-full",
490
492
  onClick: () => {
491
- const r = document.getElementById("edge-source")?.value, n = document.getElementById("edge-target")?.value;
492
- r && n && r !== n && k(r, n);
493
+ const r = document.getElementById("edge-source")?.value, j = document.getElementById("edge-target")?.value;
494
+ r && j && r !== j && L(r, j);
493
495
  },
494
496
  children: [
495
- /* @__PURE__ */ e.jsx(be, { className: "h-3 w-3 mr-1" }),
497
+ /* @__PURE__ */ e.jsx(Ye, { className: "h-3 w-3 mr-1" }),
496
498
  "Connect"
497
499
  ]
498
500
  }
@@ -500,66 +502,66 @@ const Q = {
500
502
  ] })
501
503
  ] }) })
502
504
  ] }),
503
- /* @__PURE__ */ e.jsxs(S, { className: "lg:col-span-1", children: [
504
- /* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsxs(W, { className: "text-sm flex items-center gap-2", children: [
505
- /* @__PURE__ */ e.jsx(Ne, { className: "h-4 w-4" }),
505
+ /* @__PURE__ */ e.jsxs(q, { className: "lg:col-span-1", children: [
506
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(Z, { className: "text-sm flex items-center gap-2", children: [
507
+ /* @__PURE__ */ e.jsx(ze, { className: "h-4 w-4" }),
506
508
  "Properties"
507
509
  ] }) }),
508
- /* @__PURE__ */ e.jsx(A, { children: o ? /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
510
+ /* @__PURE__ */ e.jsx(X, { children: p ? /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
509
511
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
510
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Label" }),
512
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Label" }),
511
513
  /* @__PURE__ */ e.jsx(
512
- C,
514
+ S,
513
515
  {
514
- value: o.label,
515
- onChange: (r) => v(o.id, { label: r.target.value }),
516
+ value: p.label,
517
+ onChange: (r) => v(p.id, { label: r.target.value }),
516
518
  className: "h-8 text-sm",
517
- readOnly: l
519
+ readOnly: a
518
520
  }
519
521
  )
520
522
  ] }),
521
523
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
522
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Type" }),
524
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Type" }),
523
525
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 p-2 rounded-md bg-muted text-sm", children: [
524
- Q[o.type],
525
- /* @__PURE__ */ e.jsx("span", { className: "capitalize", children: o.type })
526
+ Ie[p.type],
527
+ /* @__PURE__ */ e.jsx("span", { className: "capitalize", children: p.type })
526
528
  ] })
527
529
  ] }),
528
- o.description !== void 0 && /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
529
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Description" }),
530
+ p.description !== void 0 && /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
531
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Description" }),
530
532
  /* @__PURE__ */ e.jsx(
531
- C,
533
+ S,
532
534
  {
533
- value: o.description || "",
534
- onChange: (r) => v(o.id, { description: r.target.value }),
535
+ value: p.description || "",
536
+ onChange: (r) => v(p.id, { description: r.target.value }),
535
537
  className: "h-8 text-sm",
536
- readOnly: l
538
+ readOnly: a
537
539
  }
538
540
  )
539
541
  ] }),
540
- (o.type === "approval" || o.type === "task") && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
542
+ (p.type === "approval" || p.type === "task") && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
541
543
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
542
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Assignee" }),
544
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Assignee" }),
543
545
  /* @__PURE__ */ e.jsx(
544
- C,
546
+ S,
545
547
  {
546
- value: o.assignee || "",
547
- onChange: (r) => v(o.id, { assignee: r.target.value }),
548
+ value: p.assignee || "",
549
+ onChange: (r) => v(p.id, { assignee: r.target.value }),
548
550
  className: "h-8 text-sm",
549
551
  placeholder: "User, role, or expression",
550
- readOnly: l
552
+ readOnly: a
551
553
  }
552
554
  )
553
555
  ] }),
554
556
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
555
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Assignee Type" }),
557
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Assignee Type" }),
556
558
  /* @__PURE__ */ e.jsxs(
557
559
  "select",
558
560
  {
559
561
  className: "w-full border rounded-md h-8 text-sm px-2 bg-background",
560
- value: o.assigneeType || "user",
561
- onChange: (r) => v(o.id, { assigneeType: r.target.value }),
562
- disabled: l,
562
+ value: p.assigneeType || "user",
563
+ onChange: (r) => v(p.id, { assigneeType: r.target.value }),
564
+ disabled: a,
563
565
  children: [
564
566
  /* @__PURE__ */ e.jsx("option", { value: "user", children: "User" }),
565
567
  /* @__PURE__ */ e.jsx("option", { value: "role", children: "Role" }),
@@ -570,133 +572,133 @@ const Q = {
570
572
  )
571
573
  ] })
572
574
  ] }),
573
- o.type === "delay" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
574
- /* @__PURE__ */ e.jsx(b, { className: "text-xs", children: "Timeout (minutes)" }),
575
+ p.type === "delay" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
576
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Timeout (minutes)" }),
575
577
  /* @__PURE__ */ e.jsx(
576
- C,
578
+ S,
577
579
  {
578
580
  type: "number",
579
- value: o.timeout || 60,
580
- onChange: (r) => v(o.id, { timeout: Number(r.target.value) }),
581
+ value: p.timeout || 60,
582
+ onChange: (r) => v(p.id, { timeout: Number(r.target.value) }),
581
583
  className: "h-8 text-sm",
582
- readOnly: l
584
+ readOnly: a
583
585
  }
584
586
  )
585
587
  ] }),
586
588
  /* @__PURE__ */ e.jsxs("div", { className: "text-xs text-muted-foreground mt-2", children: [
587
589
  "ID: ",
588
- o.id
590
+ p.id
589
591
  ] })
590
592
  ] }) : /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground text-center py-8", children: "Select a node to edit its properties" }) })
591
593
  ] })
592
594
  ] })
593
595
  ] });
594
- }, We = ({ schema: f }) => {
596
+ }, qs = ({ schema: n }) => {
595
597
  const {
596
- currentNodeId: y,
597
- approvalRule: l,
598
- history: j = [],
599
- data: a,
600
- showHistory: d = !0,
601
- showComments: h = !0
602
- } = f, [g, _] = $(""), [w, o] = $(!1), E = (i) => {
603
- o(!0), console.log(`Approval action: ${i}`, {
604
- currentNodeId: y,
598
+ currentNodeId: c,
599
+ approvalRule: a,
600
+ history: d = [],
601
+ data: o,
602
+ showHistory: t = !0,
603
+ showComments: u = !0
604
+ } = n, [g, F] = $(""), [O, p] = $(!1), k = (f) => {
605
+ p(!0), console.log(`Approval action: ${f}`, {
606
+ currentNodeId: c,
605
607
  comment: g,
606
- data: a
608
+ data: o
607
609
  }), setTimeout(() => {
608
- o(!1), _("");
610
+ p(!1), F("");
609
611
  }, 500);
610
- }, v = (i) => {
611
- switch (i) {
612
+ }, v = (f) => {
613
+ switch (f) {
612
614
  case "approve":
613
615
  case "approved":
614
- return /* @__PURE__ */ e.jsx(N, { variant: "default", className: "bg-green-500", children: "Approved" });
616
+ return /* @__PURE__ */ e.jsx(I, { variant: "default", className: "bg-green-500", children: "Approved" });
615
617
  case "reject":
616
618
  case "rejected":
617
- return /* @__PURE__ */ e.jsx(N, { variant: "destructive", children: "Rejected" });
619
+ return /* @__PURE__ */ e.jsx(I, { variant: "destructive", children: "Rejected" });
618
620
  case "reassign":
619
621
  case "reassigned":
620
- return /* @__PURE__ */ e.jsx(N, { variant: "secondary", children: "Reassigned" });
622
+ return /* @__PURE__ */ e.jsx(I, { variant: "secondary", children: "Reassigned" });
621
623
  case "comment":
622
- return /* @__PURE__ */ e.jsx(N, { variant: "outline", children: "Comment" });
624
+ return /* @__PURE__ */ e.jsx(I, { variant: "outline", children: "Comment" });
623
625
  case "escalate":
624
626
  case "escalated":
625
- return /* @__PURE__ */ e.jsx(N, { variant: "secondary", className: "bg-orange-500 text-white", children: "Escalated" });
627
+ return /* @__PURE__ */ e.jsx(I, { variant: "secondary", className: "bg-orange-500 text-white", children: "Escalated" });
626
628
  default:
627
- return /* @__PURE__ */ e.jsx(N, { variant: "outline", children: i });
629
+ return /* @__PURE__ */ e.jsx(I, { variant: "outline", children: f });
628
630
  }
629
631
  };
630
632
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
631
- /* @__PURE__ */ e.jsxs(S, { children: [
632
- /* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsxs(W, { className: "flex items-center gap-2", children: [
633
+ /* @__PURE__ */ e.jsxs(q, { children: [
634
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(Z, { className: "flex items-center gap-2", children: [
633
635
  /* @__PURE__ */ e.jsx(me, { className: "h-5 w-5" }),
634
636
  "Pending Approval",
635
- l && /* @__PURE__ */ e.jsxs(N, { variant: "outline", className: "ml-2", children: [
636
- l.type === "any" && "Any approver",
637
- l.type === "all" && "All must approve",
638
- l.type === "majority" && "Majority approval",
639
- l.type === "sequential" && "Sequential"
637
+ a && /* @__PURE__ */ e.jsxs(I, { variant: "outline", className: "ml-2", children: [
638
+ a.type === "any" && "Any approver",
639
+ a.type === "all" && "All must approve",
640
+ a.type === "majority" && "Majority approval",
641
+ a.type === "sequential" && "Sequential"
640
642
  ] })
641
643
  ] }) }),
642
- /* @__PURE__ */ e.jsxs(A, { className: "space-y-4", children: [
643
- a && Object.keys(a).length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "p-3 bg-muted/50 rounded-lg", children: [
644
- /* @__PURE__ */ e.jsx(b, { className: "text-xs text-muted-foreground mb-2 block", children: "Request Details" }),
645
- /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-2 gap-2", children: Object.entries(a).slice(0, 6).map(([i, k]) => /* @__PURE__ */ e.jsxs("div", { className: "text-sm", children: [
644
+ /* @__PURE__ */ e.jsxs(X, { className: "space-y-4", children: [
645
+ o && Object.keys(o).length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "p-3 bg-muted/50 rounded-lg", children: [
646
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs text-muted-foreground mb-2 block", children: "Request Details" }),
647
+ /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-2 gap-2", children: Object.entries(o).slice(0, 6).map(([f, L]) => /* @__PURE__ */ e.jsxs("div", { className: "text-sm", children: [
646
648
  /* @__PURE__ */ e.jsxs("span", { className: "text-muted-foreground", children: [
647
- i,
649
+ f,
648
650
  ": "
649
651
  ] }),
650
- /* @__PURE__ */ e.jsx("span", { className: "font-medium", children: String(k) })
651
- ] }, i)) })
652
+ /* @__PURE__ */ e.jsx("span", { className: "font-medium", children: String(L) })
653
+ ] }, f)) })
652
654
  ] }),
653
- h && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
654
- /* @__PURE__ */ e.jsxs(b, { className: "flex items-center gap-2 text-sm", children: [
655
- /* @__PURE__ */ e.jsx(_e, { className: "h-4 w-4" }),
655
+ u && /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
656
+ /* @__PURE__ */ e.jsxs(h, { className: "flex items-center gap-2 text-sm", children: [
657
+ /* @__PURE__ */ e.jsx(js, { className: "h-4 w-4" }),
656
658
  "Comment"
657
659
  ] }),
658
660
  /* @__PURE__ */ e.jsx(
659
- C,
661
+ S,
660
662
  {
661
663
  value: g,
662
- onChange: (i) => _(i.target.value),
664
+ onChange: (f) => F(f.target.value),
663
665
  placeholder: "Add a comment (optional)"
664
666
  }
665
667
  )
666
668
  ] }),
667
669
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
668
670
  /* @__PURE__ */ e.jsxs(
669
- R,
671
+ T,
670
672
  {
671
- onClick: () => E("approve"),
672
- disabled: w,
673
+ onClick: () => k("approve"),
674
+ disabled: O,
673
675
  className: "bg-green-600 hover:bg-green-700",
674
676
  children: [
675
- /* @__PURE__ */ e.jsx(Te, { className: "h-4 w-4 mr-2" }),
677
+ /* @__PURE__ */ e.jsx(fs, { className: "h-4 w-4 mr-2" }),
676
678
  "Approve"
677
679
  ]
678
680
  }
679
681
  ),
680
682
  /* @__PURE__ */ e.jsxs(
681
- R,
683
+ T,
682
684
  {
683
685
  variant: "destructive",
684
- onClick: () => E("reject"),
685
- disabled: w,
686
+ onClick: () => k("reject"),
687
+ disabled: O,
686
688
  children: [
687
- /* @__PURE__ */ e.jsx(Ce, { className: "h-4 w-4 mr-2" }),
689
+ /* @__PURE__ */ e.jsx(bs, { className: "h-4 w-4 mr-2" }),
688
690
  "Reject"
689
691
  ]
690
692
  }
691
693
  ),
692
694
  /* @__PURE__ */ e.jsxs(
693
- R,
695
+ T,
694
696
  {
695
697
  variant: "outline",
696
- onClick: () => E("reassign"),
697
- disabled: w,
698
+ onClick: () => k("reassign"),
699
+ disabled: O,
698
700
  children: [
699
- /* @__PURE__ */ e.jsx(Se, { className: "h-4 w-4 mr-2" }),
701
+ /* @__PURE__ */ e.jsx(Ns, { className: "h-4 w-4 mr-2" }),
700
702
  "Reassign"
701
703
  ]
702
704
  }
@@ -704,26 +706,1097 @@ const Q = {
704
706
  ] })
705
707
  ] })
706
708
  ] }),
707
- d && j.length > 0 && /* @__PURE__ */ e.jsxs(S, { children: [
708
- /* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsx(W, { className: "text-sm", children: "Approval History" }) }),
709
- /* @__PURE__ */ e.jsx(A, { children: /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: j.map((i, k) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-start gap-3 p-3 rounded-lg border", children: [
710
- /* @__PURE__ */ e.jsx("div", { className: "mt-0.5", children: /* @__PURE__ */ e.jsx(Ae, { className: "h-4 w-4 text-muted-foreground" }) }),
709
+ t && d.length > 0 && /* @__PURE__ */ e.jsxs(q, { children: [
710
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(Z, { className: "text-sm", children: "Approval History" }) }),
711
+ /* @__PURE__ */ e.jsx(X, { children: /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: d.map((f, L) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-start gap-3 p-3 rounded-lg border", children: [
712
+ /* @__PURE__ */ e.jsx("div", { className: "mt-0.5", children: /* @__PURE__ */ e.jsx(vs, { className: "h-4 w-4 text-muted-foreground" }) }),
711
713
  /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0", children: [
712
714
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
713
- /* @__PURE__ */ e.jsx("span", { className: "font-medium text-sm", children: i.actorName || i.actor }),
714
- v(i.action),
715
- /* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground", children: new Date(i.timestamp).toLocaleString() })
715
+ /* @__PURE__ */ e.jsx("span", { className: "font-medium text-sm", children: f.actorName || f.actor }),
716
+ v(f.action),
717
+ /* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground", children: new Date(f.timestamp).toLocaleString() })
718
+ ] }),
719
+ f.comment && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: f.comment })
720
+ ] })
721
+ ] }, L)) }) })
722
+ ] }),
723
+ t && d.length === 0 && /* @__PURE__ */ e.jsx(q, { children: /* @__PURE__ */ e.jsx(X, { className: "p-6 text-center text-muted-foreground text-sm", children: "No approval history yet" }) })
724
+ ] });
725
+ }, Ge = {
726
+ record_created: "Record Created",
727
+ record_updated: "Record Updated",
728
+ record_deleted: "Record Deleted",
729
+ field_changed: "Field Changed",
730
+ scheduled: "Scheduled"
731
+ }, Je = {
732
+ send_email: "Send Email",
733
+ update_field: "Update Field",
734
+ create_record: "Create Record",
735
+ delete_record: "Delete Record",
736
+ webhook: "Webhook",
737
+ notification: "Notification"
738
+ }, Xs = {
739
+ send_email: /* @__PURE__ */ e.jsx(ws, { className: "h-4 w-4" }),
740
+ update_field: /* @__PURE__ */ e.jsx(ys, { className: "h-4 w-4" }),
741
+ create_record: /* @__PURE__ */ e.jsx(Ye, { className: "h-4 w-4" }),
742
+ delete_record: /* @__PURE__ */ e.jsx(ye, { className: "h-4 w-4" }),
743
+ webhook: /* @__PURE__ */ e.jsx(ts, { className: "h-4 w-4" }),
744
+ notification: /* @__PURE__ */ e.jsx(Ue, { className: "h-4 w-4" })
745
+ }, Ze = {
746
+ equals: "Equals",
747
+ not_equals: "Not Equals",
748
+ contains: "Contains",
749
+ greater_than: "Greater Than",
750
+ less_than: "Less Than"
751
+ }, Gs = () => ({
752
+ id: `auto-${Date.now()}`,
753
+ name: "",
754
+ description: "",
755
+ enabled: !0,
756
+ trigger: { type: "record_created" },
757
+ actions: [],
758
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
759
+ }), be = ({ label: n, value: c, placeholder: a, onChange: d }) => /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
760
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: n }),
761
+ /* @__PURE__ */ e.jsx(S, { value: c, onChange: (o) => d(o.target.value), placeholder: a })
762
+ ] }), Js = ({
763
+ automation: n,
764
+ objects: c = [],
765
+ onSave: a,
766
+ onCancel: d,
767
+ className: o
768
+ }) => {
769
+ const [t, u] = $(n ?? Gs()), g = _((i) => {
770
+ u((b) => ({ ...b, trigger: { ...b.trigger, ...i } }));
771
+ }, []), F = _(() => {
772
+ u((i) => ({ ...i, actions: [...i.actions, { type: "send_email", params: {} }] }));
773
+ }, []), O = _((i, b) => {
774
+ u((R) => ({ ...R, actions: R.actions.map((C, r) => r === i ? { ...C, ...b } : C) }));
775
+ }, []), p = _((i) => {
776
+ u((b) => ({ ...b, actions: b.actions.filter((R, C) => C !== i) }));
777
+ }, []), k = t.trigger.type !== "scheduled", v = t.trigger.type === "field_changed", f = t.trigger.type === "scheduled", L = c.find((i) => i.name === t.trigger.objectName)?.fields, de = (i, b) => {
778
+ const R = (C, r) => O(b, { params: { ...i.params, [C]: r } });
779
+ switch (i.type) {
780
+ case "send_email":
781
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
782
+ /* @__PURE__ */ e.jsx(be, { label: "To", value: i.params.to ?? "", placeholder: "Recipient email", onChange: (C) => R("to", C) }),
783
+ /* @__PURE__ */ e.jsx(be, { label: "Subject", value: i.params.subject ?? "", placeholder: "Email subject", onChange: (C) => R("subject", C) })
784
+ ] });
785
+ case "webhook":
786
+ return /* @__PURE__ */ e.jsx(be, { label: "URL", value: i.params.url ?? "", placeholder: "https://...", onChange: (C) => R("url", C) });
787
+ case "notification":
788
+ return /* @__PURE__ */ e.jsx(be, { label: "Message", value: i.params.message ?? "", placeholder: "Notification message", onChange: (C) => R("message", C) });
789
+ case "update_field":
790
+ case "create_record":
791
+ case "delete_record":
792
+ return /* @__PURE__ */ e.jsx(be, { label: "Target Object", value: i.params.objectName ?? "", placeholder: "Object name", onChange: (C) => R("objectName", C) });
793
+ default:
794
+ return null;
795
+ }
796
+ };
797
+ return /* @__PURE__ */ e.jsxs("div", { className: o ?? "space-y-4", children: [
798
+ /* @__PURE__ */ e.jsxs(q, { children: [
799
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(Z, { className: "flex items-center gap-2 text-sm", children: [
800
+ /* @__PURE__ */ e.jsx(Me, { className: "h-4 w-4 text-yellow-500" }),
801
+ "Trigger"
802
+ ] }) }),
803
+ /* @__PURE__ */ e.jsxs(X, { className: "space-y-4", children: [
804
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
805
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Trigger Type" }),
806
+ /* @__PURE__ */ e.jsxs(U, { value: t.trigger.type, onValueChange: (i) => g({ type: i }), children: [
807
+ /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(H, { placeholder: "Select trigger type" }) }),
808
+ /* @__PURE__ */ e.jsx(W, { children: Object.keys(Ge).map((i) => /* @__PURE__ */ e.jsx(Y, { value: i, children: Ge[i] }, i)) })
809
+ ] })
810
+ ] }),
811
+ k && /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
812
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Object" }),
813
+ c.length > 0 ? /* @__PURE__ */ e.jsxs(U, { value: t.trigger.objectName ?? "", onValueChange: (i) => g({ objectName: i }), children: [
814
+ /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(H, { placeholder: "Select object" }) }),
815
+ /* @__PURE__ */ e.jsx(W, { children: c.map((i) => /* @__PURE__ */ e.jsx(Y, { value: i.name, children: i.label }, i.name)) })
816
+ ] }) : /* @__PURE__ */ e.jsx(S, { value: t.trigger.objectName ?? "", onChange: (i) => g({ objectName: i.target.value }), placeholder: "Object name" })
817
+ ] }),
818
+ v && /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
819
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Field" }),
820
+ L ? /* @__PURE__ */ e.jsxs(U, { value: t.trigger.fieldName ?? "", onValueChange: (i) => g({ fieldName: i }), children: [
821
+ /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(H, { placeholder: "Select field" }) }),
822
+ /* @__PURE__ */ e.jsx(W, { children: Object.keys(L).map((i) => /* @__PURE__ */ e.jsx(Y, { value: i, children: i }, i)) })
823
+ ] }) : /* @__PURE__ */ e.jsx(S, { value: t.trigger.fieldName ?? "", onChange: (i) => g({ fieldName: i.target.value }), placeholder: "Field name" })
824
+ ] }),
825
+ f && /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
826
+ /* @__PURE__ */ e.jsxs(h, { className: "text-xs flex items-center gap-1", children: [
827
+ /* @__PURE__ */ e.jsx(me, { className: "h-3 w-3" }),
828
+ " Cron Schedule"
829
+ ] }),
830
+ /* @__PURE__ */ e.jsx(S, { value: t.trigger.schedule ?? "", onChange: (i) => g({ schedule: i.target.value }), placeholder: "e.g. 0 9 * * 1-5" })
831
+ ] }),
832
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
833
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Condition (optional)" }),
834
+ /* @__PURE__ */ e.jsx(S, { value: t.trigger.condition ?? "", onChange: (i) => g({ condition: i.target.value }), placeholder: 'e.g. ${data.status === "active"}' })
835
+ ] }),
836
+ /* @__PURE__ */ e.jsx(ce, {}),
837
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
838
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs font-medium", children: "Conditional Trigger (optional)" }),
839
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs text-muted-foreground", children: "Run only when a field matches a specific value." }),
840
+ /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 gap-2", children: [
841
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
842
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Field" }),
843
+ L ? /* @__PURE__ */ e.jsxs(U, { value: t.trigger.conditionField ?? "", onValueChange: (i) => g({ conditionField: i }), children: [
844
+ /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(H, { placeholder: "Field" }) }),
845
+ /* @__PURE__ */ e.jsx(W, { children: Object.keys(L).map((i) => /* @__PURE__ */ e.jsx(Y, { value: i, children: i }, i)) })
846
+ ] }) : /* @__PURE__ */ e.jsx(S, { value: t.trigger.conditionField ?? "", onChange: (i) => g({ conditionField: i.target.value }), placeholder: "e.g. status" })
847
+ ] }),
848
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
849
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Operator" }),
850
+ /* @__PURE__ */ e.jsxs(U, { value: t.trigger.conditionOperator ?? "equals", onValueChange: (i) => g({ conditionOperator: i }), children: [
851
+ /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(H, { placeholder: "Operator" }) }),
852
+ /* @__PURE__ */ e.jsx(W, { children: Object.keys(Ze).map((i) => /* @__PURE__ */ e.jsx(Y, { value: i, children: Ze[i] }, i)) })
853
+ ] })
854
+ ] }),
855
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
856
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Value" }),
857
+ /* @__PURE__ */ e.jsx(S, { value: t.trigger.conditionValue ?? "", onChange: (i) => g({ conditionValue: i.target.value }), placeholder: "e.g. urgent" })
858
+ ] })
859
+ ] })
860
+ ] })
861
+ ] })
862
+ ] }),
863
+ /* @__PURE__ */ e.jsxs(q, { children: [
864
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(Z, { className: "flex items-center gap-2 text-sm", children: [
865
+ /* @__PURE__ */ e.jsx(ze, { className: "h-4 w-4" }),
866
+ " Actions",
867
+ /* @__PURE__ */ e.jsx(I, { variant: "secondary", className: "ml-auto", children: t.actions.length })
868
+ ] }) }),
869
+ /* @__PURE__ */ e.jsxs(X, { className: "space-y-3", children: [
870
+ t.actions.length > 1 && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
871
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Execution" }),
872
+ /* @__PURE__ */ e.jsxs(U, { value: t.executionMode ?? "sequential", onValueChange: (i) => u((b) => ({ ...b, executionMode: i })), children: [
873
+ /* @__PURE__ */ e.jsx(B, { className: "h-7 w-36", children: /* @__PURE__ */ e.jsx(H, {}) }),
874
+ /* @__PURE__ */ e.jsxs(W, { children: [
875
+ /* @__PURE__ */ e.jsx(Y, { value: "sequential", children: "Sequential" }),
876
+ /* @__PURE__ */ e.jsx(Y, { value: "parallel", children: "Parallel" })
877
+ ] })
878
+ ] })
879
+ ] }),
880
+ t.actions.map((i, b) => /* @__PURE__ */ e.jsxs("div", { className: "rounded-lg border p-3 space-y-3", children: [
881
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
882
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
883
+ Xs[i.type],
884
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium", children: t.actions.length > 1 && (t.executionMode ?? "sequential") === "sequential" ? `Step ${b + 1}` : `Action ${b + 1}` }),
885
+ b > 0 && t.actions.length > 1 && (t.executionMode ?? "sequential") === "sequential" && /* @__PURE__ */ e.jsx(I, { variant: "outline", className: "text-[10px] px-1", children: "then" })
886
+ ] }),
887
+ /* @__PURE__ */ e.jsx(T, { size: "sm", variant: "ghost", className: "h-7 w-7 p-0 text-red-500 hover:text-red-700", onClick: () => p(b), children: /* @__PURE__ */ e.jsx(ye, { className: "h-4 w-4" }) })
888
+ ] }),
889
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
890
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Action Type" }),
891
+ /* @__PURE__ */ e.jsxs(U, { value: i.type, onValueChange: (R) => O(b, { type: R, params: {} }), children: [
892
+ /* @__PURE__ */ e.jsx(B, { children: /* @__PURE__ */ e.jsx(H, {}) }),
893
+ /* @__PURE__ */ e.jsx(W, { children: Object.keys(Je).map((R) => /* @__PURE__ */ e.jsx(Y, { value: R, children: Je[R] }, R)) })
894
+ ] })
716
895
  ] }),
717
- i.comment && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: i.comment })
896
+ de(i, b)
897
+ ] }, b)),
898
+ /* @__PURE__ */ e.jsxs(T, { variant: "outline", size: "sm", className: "w-full", onClick: F, children: [
899
+ /* @__PURE__ */ e.jsx(Ye, { className: "h-4 w-4 mr-2" }),
900
+ " Add Action"
901
+ ] })
902
+ ] })
903
+ ] }),
904
+ /* @__PURE__ */ e.jsxs(q, { children: [
905
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(Z, { className: "text-sm", children: "Summary" }) }),
906
+ /* @__PURE__ */ e.jsxs(X, { className: "space-y-4", children: [
907
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
908
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Name" }),
909
+ /* @__PURE__ */ e.jsx(S, { value: t.name, onChange: (i) => u((b) => ({ ...b, name: i.target.value })), placeholder: "Automation name" })
910
+ ] }),
911
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
912
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Description" }),
913
+ /* @__PURE__ */ e.jsx(S, { value: t.description ?? "", onChange: (i) => u((b) => ({ ...b, description: i.target.value })), placeholder: "Optional description" })
914
+ ] }),
915
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
916
+ /* @__PURE__ */ e.jsx(h, { className: "text-sm", children: "Enabled" }),
917
+ /* @__PURE__ */ e.jsx(ps, { checked: t.enabled, onCheckedChange: (i) => u((b) => ({ ...b, enabled: i })) })
918
+ ] }),
919
+ /* @__PURE__ */ e.jsx(ce, {}),
920
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 justify-end", children: [
921
+ d && /* @__PURE__ */ e.jsx(T, { variant: "outline", size: "sm", onClick: d, children: "Cancel" }),
922
+ /* @__PURE__ */ e.jsxs(T, { size: "sm", onClick: () => a?.(t), children: [
923
+ /* @__PURE__ */ e.jsx(Me, { className: "h-4 w-4 mr-2" }),
924
+ " Save Automation"
925
+ ] })
926
+ ] })
927
+ ] })
928
+ ] })
929
+ ] });
930
+ }, Zs = {
931
+ success: "default",
932
+ failure: "destructive",
933
+ running: "secondary",
934
+ pending: "outline"
935
+ }, Ks = {
936
+ success: "Success",
937
+ failure: "Failed",
938
+ running: "Running",
939
+ pending: "Pending"
940
+ };
941
+ function Qs(n, c) {
942
+ if (!c) return "—";
943
+ const a = new Date(c).getTime() - new Date(n).getTime();
944
+ if (a < 1e3) return `${a}ms`;
945
+ const d = Math.floor(a / 1e3);
946
+ if (d < 60) return `${d}s`;
947
+ const o = Math.floor(d / 60), t = d % 60;
948
+ return `${o}m ${t}s`;
949
+ }
950
+ const et = ({
951
+ runs: n = [],
952
+ className: c
953
+ }) => /* @__PURE__ */ e.jsxs(q, { className: c, children: [
954
+ /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(Z, { className: "flex items-center gap-2 text-sm", children: [
955
+ /* @__PURE__ */ e.jsx(me, { className: "h-4 w-4" }),
956
+ "Automation Run History",
957
+ /* @__PURE__ */ e.jsx(I, { variant: "outline", className: "ml-auto", children: n.length })
958
+ ] }) }),
959
+ /* @__PURE__ */ e.jsx(X, { children: n.length === 0 ? /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground text-center py-6", children: "No automation runs yet" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: n.map((a) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-start gap-3 rounded-lg border p-3", children: [
960
+ /* @__PURE__ */ e.jsx(I, { variant: Zs[a.status], children: Ks[a.status] }),
961
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 min-w-0 space-y-1", children: [
962
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
963
+ /* @__PURE__ */ e.jsx("span", { className: "text-sm font-medium", children: a.automationName }),
964
+ a.triggerEvent && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
965
+ "— ",
966
+ a.triggerEvent
967
+ ] })
968
+ ] }),
969
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
970
+ /* @__PURE__ */ e.jsx("span", { children: new Date(a.startedAt).toLocaleString() }),
971
+ /* @__PURE__ */ e.jsxs("span", { children: [
972
+ "Duration: ",
973
+ Qs(a.startedAt, a.completedAt)
718
974
  ] })
719
- ] }, k)) }) })
975
+ ] }),
976
+ a.status === "failure" && a.error && /* @__PURE__ */ e.jsx("p", { className: "text-xs text-red-600 mt-1", children: a.error })
977
+ ] })
978
+ ] }, a.id)) }) })
979
+ ] });
980
+ function Le(...n) {
981
+ return Vs(Ls(n));
982
+ }
983
+ const rs = 130, Ne = 52, ve = {
984
+ start: "Start",
985
+ end: "End",
986
+ task: "Task",
987
+ user_task: "User Task",
988
+ service_task: "Service Task",
989
+ script_task: "Script Task",
990
+ approval: "Approval",
991
+ condition: "Condition",
992
+ parallel_gateway: "Parallel Gateway",
993
+ join_gateway: "Join Gateway",
994
+ boundary_event: "Boundary Event",
995
+ delay: "Delay",
996
+ notification: "Notification",
997
+ webhook: "Webhook"
998
+ }, ls = {
999
+ start: /* @__PURE__ */ e.jsx(Ve, { className: "h-3.5 w-3.5 text-green-500" }),
1000
+ end: /* @__PURE__ */ e.jsx(Is, { className: "h-3.5 w-3.5 text-red-500" }),
1001
+ task: /* @__PURE__ */ e.jsx(Be, { className: "h-3.5 w-3.5 text-blue-500" }),
1002
+ user_task: /* @__PURE__ */ e.jsx(Fe, { className: "h-3.5 w-3.5 text-blue-600" }),
1003
+ service_task: /* @__PURE__ */ e.jsx(ze, { className: "h-3.5 w-3.5 text-blue-400" }),
1004
+ script_task: /* @__PURE__ */ e.jsx(ss, { className: "h-3.5 w-3.5 text-indigo-500" }),
1005
+ approval: /* @__PURE__ */ e.jsx(Fe, { className: "h-3.5 w-3.5 text-purple-500" }),
1006
+ condition: /* @__PURE__ */ e.jsx(Re, { className: "h-3.5 w-3.5 text-orange-500" }),
1007
+ parallel_gateway: /* @__PURE__ */ e.jsx(Re, { className: "h-3.5 w-3.5 text-teal-500" }),
1008
+ join_gateway: /* @__PURE__ */ e.jsx($s, { className: "h-3.5 w-3.5 text-teal-600" }),
1009
+ boundary_event: /* @__PURE__ */ e.jsx(as, { className: "h-3.5 w-3.5 text-amber-500" }),
1010
+ delay: /* @__PURE__ */ e.jsx(me, { className: "h-3.5 w-3.5 text-gray-500" }),
1011
+ notification: /* @__PURE__ */ e.jsx(Ue, { className: "h-3.5 w-3.5 text-yellow-500" }),
1012
+ webhook: /* @__PURE__ */ e.jsx(ts, { className: "h-3.5 w-3.5 text-cyan-500" })
1013
+ }, st = {
1014
+ start: "border-green-400 bg-green-50 dark:bg-green-950",
1015
+ end: "border-red-400 bg-red-50 dark:bg-red-950",
1016
+ task: "border-blue-300 bg-blue-50 dark:bg-blue-950",
1017
+ user_task: "border-blue-400 bg-blue-50 dark:bg-blue-950",
1018
+ service_task: "border-blue-200 bg-slate-50 dark:bg-slate-900",
1019
+ script_task: "border-indigo-300 bg-indigo-50 dark:bg-indigo-950",
1020
+ approval: "border-purple-400 bg-purple-50 dark:bg-purple-950",
1021
+ condition: "border-orange-400 bg-orange-50 dark:bg-orange-950",
1022
+ parallel_gateway: "border-teal-400 bg-teal-50 dark:bg-teal-950",
1023
+ join_gateway: "border-teal-500 bg-teal-50 dark:bg-teal-950",
1024
+ boundary_event: "border-amber-400 bg-amber-50 dark:bg-amber-950 border-dashed",
1025
+ delay: "border-gray-400 bg-gray-50 dark:bg-gray-900",
1026
+ notification: "border-yellow-400 bg-yellow-50 dark:bg-yellow-950",
1027
+ webhook: "border-cyan-400 bg-cyan-50 dark:bg-cyan-950"
1028
+ }, tt = {
1029
+ pending: { color: "text-muted-foreground", icon: /* @__PURE__ */ e.jsx(me, { className: "h-3 w-3" }) },
1030
+ running: { color: "text-blue-500", icon: /* @__PURE__ */ e.jsx(Ms, { className: "h-3 w-3 animate-spin" }) },
1031
+ completed: { color: "text-green-500", icon: /* @__PURE__ */ e.jsx(Be, { className: "h-3 w-3" }) },
1032
+ failed: { color: "text-red-500", icon: /* @__PURE__ */ e.jsx(as, { className: "h-3 w-3" }) },
1033
+ skipped: { color: "text-gray-400", icon: /* @__PURE__ */ e.jsx(Fs, { className: "h-3 w-3" }) }
1034
+ }, at = [
1035
+ "task",
1036
+ "user_task",
1037
+ "service_task",
1038
+ "script_task",
1039
+ "approval",
1040
+ "condition",
1041
+ "parallel_gateway",
1042
+ "join_gateway",
1043
+ "boundary_event",
1044
+ "delay",
1045
+ "notification",
1046
+ "webhook"
1047
+ ], rt = {
1048
+ allow: "Allow (run concurrently)",
1049
+ forbid: "Forbid (skip new)",
1050
+ replace: "Replace (cancel existing)",
1051
+ queue: "Queue (run after current)"
1052
+ }, Ke = {
1053
+ condition: "Condition",
1054
+ manual: "Manual",
1055
+ webhook: "Webhook",
1056
+ timer: "Timer",
1057
+ signal: "Signal"
1058
+ }, lt = () => [
1059
+ { id: "start-1", type: "start", label: "Start", position: { x: 80, y: 200 } },
1060
+ { id: "end-1", type: "end", label: "End", position: { x: 500, y: 200 } }
1061
+ ], nt = () => [];
1062
+ function it(n) {
1063
+ const [c, a] = $([n]), [d, o] = $(0), t = c[d], u = _((k) => {
1064
+ a((v) => [...v.slice(0, d + 1), k]), o((v) => v + 1);
1065
+ }, [d]), g = _(() => {
1066
+ o((k) => Math.max(0, k - 1));
1067
+ }, []), F = _(() => {
1068
+ a((k) => (o((v) => Math.min(k.length - 1, v + 1)), k));
1069
+ }, []), O = d > 0, p = d < c.length - 1;
1070
+ return { current: t, push: u, undo: g, redo: F, canUndo: O, canRedo: p };
1071
+ }
1072
+ function ot(n, c, a) {
1073
+ const d = [], o = ["boundary_event"];
1074
+ n.forEach((u) => {
1075
+ o.includes(u.type) && d.push(`Node "${u.label}" (${u.type}) has limited BPMN mapping.`);
1076
+ });
1077
+ const t = [
1078
+ '<?xml version="1.0" encoding="UTF-8"?>',
1079
+ '<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"',
1080
+ ' xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"',
1081
+ ' targetNamespace="http://objectui.org/bpmn">',
1082
+ ` <process id="process-1" name="${a}" isExecutable="true">`,
1083
+ ...n.map((u) => ` <${ct(u.type)} id="${u.id}" name="${u.label}" />`),
1084
+ ...c.map((u) => ` <sequenceFlow ${[
1085
+ `id="${u.id}"`,
1086
+ `sourceRef="${u.source}"`,
1087
+ `targetRef="${u.target}"`,
1088
+ u.condition ? `conditionExpression="${u.condition}"` : ""
1089
+ ].filter(Boolean).join(" ")} />`),
1090
+ " </process>",
1091
+ "</definitions>"
1092
+ ].join(`
1093
+ `);
1094
+ return {
1095
+ success: !0,
1096
+ nodeCount: n.length,
1097
+ edgeCount: c.length,
1098
+ warnings: d.length ? d : void 0,
1099
+ bpmnXml: t
1100
+ };
1101
+ }
1102
+ function ct(n) {
1103
+ return {
1104
+ start: "startEvent",
1105
+ end: "endEvent",
1106
+ task: "task",
1107
+ user_task: "userTask",
1108
+ service_task: "serviceTask",
1109
+ script_task: "scriptTask",
1110
+ approval: "userTask",
1111
+ condition: "exclusiveGateway",
1112
+ parallel_gateway: "parallelGateway",
1113
+ join_gateway: "parallelGateway",
1114
+ boundary_event: "boundaryEvent",
1115
+ delay: "intermediateCatchEvent",
1116
+ notification: "sendTask",
1117
+ webhook: "serviceTask"
1118
+ }[n] ?? "task";
1119
+ }
1120
+ function dt(n, c) {
1121
+ const a = n.position.x + rs, d = n.position.y + Ne / 2, o = c.position.x, t = c.position.y + Ne / 2, u = (a + o) / 2;
1122
+ return { d: `M ${a} ${d} C ${u} ${d}, ${u} ${t}, ${o} ${t}`, labelX: u, labelY: (d + t) / 2 - 8 };
1123
+ }
1124
+ const ut = ({
1125
+ node: n,
1126
+ isSelected: c,
1127
+ isConnectSource: a,
1128
+ connectMode: d,
1129
+ readOnly: o,
1130
+ showExecutionOverlay: t,
1131
+ onSelect: u,
1132
+ onDelete: g,
1133
+ onDragStart: F,
1134
+ onPortClick: O
1135
+ }) => {
1136
+ const p = n.executionStatus, k = p ? tt[p] : null;
1137
+ return /* @__PURE__ */ e.jsxs(
1138
+ "div",
1139
+ {
1140
+ className: "absolute select-none",
1141
+ style: { left: n.position.x, top: n.position.y },
1142
+ draggable: !o && !d,
1143
+ onDragStart: (v) => F(v, n.id),
1144
+ onClick: (v) => u(n.id, v.shiftKey),
1145
+ role: "group",
1146
+ "aria-label": n.label,
1147
+ children: [
1148
+ /* @__PURE__ */ e.jsxs(
1149
+ "div",
1150
+ {
1151
+ className: Le(
1152
+ "flex items-center gap-2 border-2 rounded px-3 py-2 min-h-[52px] transition-shadow cursor-pointer",
1153
+ st[n.type],
1154
+ c && "ring-2 ring-primary shadow-md",
1155
+ a && "ring-2 ring-blue-400 shadow-lg",
1156
+ d && !a && "cursor-crosshair",
1157
+ t && p === "running" && "ring-2 ring-blue-400",
1158
+ t && p === "failed" && "ring-2 ring-red-400",
1159
+ t && p === "completed" && "ring-2 ring-green-400"
1160
+ ),
1161
+ style: { width: rs, minHeight: Ne },
1162
+ children: [
1163
+ /* @__PURE__ */ e.jsx("span", { className: "shrink-0", children: ls[n.type] }),
1164
+ /* @__PURE__ */ e.jsx("span", { className: "text-xs font-medium leading-tight flex-1 truncate", children: n.label }),
1165
+ t && k && /* @__PURE__ */ e.jsx("span", { className: Le("shrink-0", k.color), children: k.icon })
1166
+ ]
1167
+ }
1168
+ ),
1169
+ !o && (c || d) && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1170
+ /* @__PURE__ */ e.jsx(
1171
+ "div",
1172
+ {
1173
+ className: "absolute w-3 h-3 rounded-full bg-primary border-2 border-background shadow cursor-crosshair",
1174
+ style: { right: -6, top: Ne / 2 - 6 },
1175
+ title: "Connect from this node",
1176
+ onClick: (v) => {
1177
+ v.stopPropagation(), O(n.id);
1178
+ }
1179
+ }
1180
+ ),
1181
+ /* @__PURE__ */ e.jsx(
1182
+ "div",
1183
+ {
1184
+ className: "absolute w-3 h-3 rounded-full bg-muted-foreground border-2 border-background shadow cursor-crosshair",
1185
+ style: { left: -6, top: Ne / 2 - 6 },
1186
+ title: "Connect to this node",
1187
+ onClick: (v) => {
1188
+ v.stopPropagation(), O(n.id);
1189
+ }
1190
+ }
1191
+ )
1192
+ ] }),
1193
+ !o && c && !d && /* @__PURE__ */ e.jsx(
1194
+ "button",
1195
+ {
1196
+ className: "absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow",
1197
+ onClick: (v) => {
1198
+ v.stopPropagation(), g(n.id);
1199
+ },
1200
+ "aria-label": `Delete node ${n.label}`,
1201
+ children: /* @__PURE__ */ e.jsx(ye, { className: "h-3 w-3" })
1202
+ }
1203
+ )
1204
+ ]
1205
+ }
1206
+ );
1207
+ }, xt = ({
1208
+ node: n,
1209
+ edge: c,
1210
+ readOnly: a,
1211
+ onNodeChange: d,
1212
+ onEdgeChange: o
1213
+ }) => !n && !c ? /* @__PURE__ */ e.jsx("div", { className: "p-4 text-sm text-muted-foreground", children: "Select a node or edge to edit its properties." }) : n ? /* @__PURE__ */ e.jsxs("div", { className: "p-3 space-y-3 overflow-y-auto", children: [
1214
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide", children: "Node Properties" }),
1215
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1216
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Label" }),
1217
+ /* @__PURE__ */ e.jsx(
1218
+ S,
1219
+ {
1220
+ value: n.label,
1221
+ onChange: (t) => d({ ...n, label: t.target.value }),
1222
+ disabled: a,
1223
+ className: "h-7 text-xs"
1224
+ }
1225
+ )
1226
+ ] }),
1227
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1228
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Type" }),
1229
+ /* @__PURE__ */ e.jsxs(
1230
+ U,
1231
+ {
1232
+ value: n.type,
1233
+ onValueChange: (t) => d({ ...n, type: t }),
1234
+ disabled: a,
1235
+ children: [
1236
+ /* @__PURE__ */ e.jsx(B, { className: "h-7 text-xs", children: /* @__PURE__ */ e.jsx(H, {}) }),
1237
+ /* @__PURE__ */ e.jsx(W, { children: Object.keys(ve).map((t) => /* @__PURE__ */ e.jsx(Y, { value: t, className: "text-xs", children: ve[t] }, t)) })
1238
+ ]
1239
+ }
1240
+ )
1241
+ ] }),
1242
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1243
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Description" }),
1244
+ /* @__PURE__ */ e.jsx(
1245
+ S,
1246
+ {
1247
+ value: n.description ?? "",
1248
+ onChange: (t) => d({ ...n, description: t.target.value }),
1249
+ disabled: a,
1250
+ className: "h-7 text-xs",
1251
+ placeholder: "Optional description"
1252
+ }
1253
+ )
1254
+ ] }),
1255
+ ["task", "user_task", "service_task", "script_task", "delay", "webhook"].includes(n.type) && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1256
+ /* @__PURE__ */ e.jsx(ce, {}),
1257
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide", children: "Executor" }),
1258
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1259
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Executor Type" }),
1260
+ /* @__PURE__ */ e.jsx(
1261
+ S,
1262
+ {
1263
+ value: n.executor?.type ?? "",
1264
+ onChange: (t) => d({
1265
+ ...n,
1266
+ executor: { ...n.executor, type: t.target.value }
1267
+ }),
1268
+ disabled: a,
1269
+ className: "h-7 text-xs",
1270
+ placeholder: "e.g. http, script, email"
1271
+ }
1272
+ )
1273
+ ] }),
1274
+ n.type === "delay" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1275
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Wait Event Type" }),
1276
+ /* @__PURE__ */ e.jsxs(
1277
+ U,
1278
+ {
1279
+ value: n.executor?.waitEventConfig?.eventType ?? "timer",
1280
+ onValueChange: (t) => d({
1281
+ ...n,
1282
+ executor: {
1283
+ ...n.executor,
1284
+ type: n.executor?.type ?? "wait",
1285
+ waitEventConfig: {
1286
+ ...n.executor?.waitEventConfig,
1287
+ eventType: t
1288
+ }
1289
+ }
1290
+ }),
1291
+ disabled: a,
1292
+ children: [
1293
+ /* @__PURE__ */ e.jsx(B, { className: "h-7 text-xs", children: /* @__PURE__ */ e.jsx(H, {}) }),
1294
+ /* @__PURE__ */ e.jsx(W, { children: Object.keys(Ke).map((t) => /* @__PURE__ */ e.jsx(Y, { value: t, className: "text-xs", children: Ke[t] }, t)) })
1295
+ ]
1296
+ }
1297
+ )
1298
+ ] }),
1299
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1300
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Timeout (ms)" }),
1301
+ /* @__PURE__ */ e.jsx(
1302
+ S,
1303
+ {
1304
+ type: "number",
1305
+ value: n.executor?.timeoutMs ?? "",
1306
+ onChange: (t) => d({
1307
+ ...n,
1308
+ executor: {
1309
+ ...n.executor,
1310
+ type: n.executor?.type ?? "",
1311
+ timeoutMs: t.target.value ? Number(t.target.value) : void 0
1312
+ }
1313
+ }),
1314
+ disabled: a,
1315
+ className: "h-7 text-xs",
1316
+ placeholder: "e.g. 30000"
1317
+ }
1318
+ )
1319
+ ] })
1320
+ ] }),
1321
+ n.type === "boundary_event" && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1322
+ /* @__PURE__ */ e.jsx(ce, {}),
1323
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide", children: "Boundary Config" }),
1324
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1325
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Attached To Node ID" }),
1326
+ /* @__PURE__ */ e.jsx(
1327
+ S,
1328
+ {
1329
+ value: n.boundaryConfig?.attachedToNodeId ?? "",
1330
+ onChange: (t) => d({
1331
+ ...n,
1332
+ boundaryConfig: {
1333
+ ...n.boundaryConfig,
1334
+ attachedToNodeId: t.target.value,
1335
+ eventType: n.boundaryConfig?.eventType ?? "error"
1336
+ }
1337
+ }),
1338
+ disabled: a,
1339
+ className: "h-7 text-xs",
1340
+ placeholder: "Host node id"
1341
+ }
1342
+ )
720
1343
  ] }),
721
- d && j.length === 0 && /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsx(A, { className: "p-6 text-center text-muted-foreground text-sm", children: "No approval history yet" }) })
1344
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1345
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Event Type" }),
1346
+ /* @__PURE__ */ e.jsxs(
1347
+ U,
1348
+ {
1349
+ value: n.boundaryConfig?.eventType ?? "error",
1350
+ onValueChange: (t) => d({
1351
+ ...n,
1352
+ boundaryConfig: {
1353
+ ...n.boundaryConfig,
1354
+ attachedToNodeId: n.boundaryConfig?.attachedToNodeId ?? "",
1355
+ eventType: t
1356
+ }
1357
+ }),
1358
+ disabled: a,
1359
+ children: [
1360
+ /* @__PURE__ */ e.jsx(B, { className: "h-7 text-xs", children: /* @__PURE__ */ e.jsx(H, {}) }),
1361
+ /* @__PURE__ */ e.jsx(W, { children: ["error", "timer", "message", "signal", "compensation"].map((t) => /* @__PURE__ */ e.jsx(Y, { value: t, className: "text-xs capitalize", children: t }, t)) })
1362
+ ]
1363
+ }
1364
+ )
1365
+ ] })
1366
+ ] })
1367
+ ] }) : c ? /* @__PURE__ */ e.jsxs("div", { className: "p-3 space-y-3 overflow-y-auto", children: [
1368
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide", children: "Edge Properties" }),
1369
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1370
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Label" }),
1371
+ /* @__PURE__ */ e.jsx(
1372
+ S,
1373
+ {
1374
+ value: c.label ?? "",
1375
+ onChange: (t) => o({ ...c, label: t.target.value }),
1376
+ disabled: a,
1377
+ className: "h-7 text-xs"
1378
+ }
1379
+ )
1380
+ ] }),
1381
+ /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1382
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Type" }),
1383
+ /* @__PURE__ */ e.jsxs(
1384
+ U,
1385
+ {
1386
+ value: c.type ?? "default",
1387
+ onValueChange: (t) => o({ ...c, type: t }),
1388
+ disabled: a,
1389
+ children: [
1390
+ /* @__PURE__ */ e.jsx(B, { className: "h-7 text-xs", children: /* @__PURE__ */ e.jsx(H, {}) }),
1391
+ /* @__PURE__ */ e.jsxs(W, { children: [
1392
+ /* @__PURE__ */ e.jsx(Y, { value: "default", className: "text-xs", children: "Default" }),
1393
+ /* @__PURE__ */ e.jsx(Y, { value: "conditional", className: "text-xs", children: "Conditional" }),
1394
+ /* @__PURE__ */ e.jsx(Y, { value: "timeout", className: "text-xs", children: "Timeout" })
1395
+ ] })
1396
+ ]
1397
+ }
1398
+ )
1399
+ ] }),
1400
+ c.type === "conditional" && /* @__PURE__ */ e.jsxs("div", { className: "space-y-1", children: [
1401
+ /* @__PURE__ */ e.jsx(h, { className: "text-xs", children: "Condition Expression" }),
1402
+ /* @__PURE__ */ e.jsx(
1403
+ S,
1404
+ {
1405
+ value: c.condition ?? "",
1406
+ onChange: (t) => o({ ...c, condition: t.target.value }),
1407
+ disabled: a,
1408
+ className: "h-7 text-xs font-mono",
1409
+ placeholder: "e.g. status === 'approved'"
1410
+ }
1411
+ )
1412
+ ] }),
1413
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1414
+ /* @__PURE__ */ e.jsx(
1415
+ "input",
1416
+ {
1417
+ type: "checkbox",
1418
+ id: "edge-isDefault",
1419
+ checked: c.isDefault ?? !1,
1420
+ onChange: (t) => o({ ...c, isDefault: t.target.checked }),
1421
+ disabled: a,
1422
+ className: "h-3.5 w-3.5"
1423
+ }
1424
+ ),
1425
+ /* @__PURE__ */ e.jsx(h, { htmlFor: "edge-isDefault", className: "text-xs", children: "Default edge (isDefault)" })
1426
+ ] })
1427
+ ] }) : null, mt = ({ versions: n }) => /* @__PURE__ */ e.jsxs("div", { className: "p-3 space-y-2", children: [
1428
+ /* @__PURE__ */ e.jsx("p", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide", children: "Version History" }),
1429
+ n.length === 0 && /* @__PURE__ */ e.jsx("p", { className: "text-xs text-muted-foreground", children: "No version history available." }),
1430
+ /* @__PURE__ */ e.jsx("div", { className: "space-y-1.5", children: n.map((c) => /* @__PURE__ */ e.jsxs(
1431
+ "div",
1432
+ {
1433
+ className: Le(
1434
+ "rounded border p-2 text-xs",
1435
+ c.isCurrent ? "border-primary bg-primary/5" : "border-border bg-muted/30"
1436
+ ),
1437
+ children: [
1438
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
1439
+ /* @__PURE__ */ e.jsxs("span", { className: "font-medium", children: [
1440
+ "v",
1441
+ c.version
1442
+ ] }),
1443
+ c.isCurrent && /* @__PURE__ */ e.jsx(I, { variant: "default", className: "text-[10px] h-4", children: "Current" })
1444
+ ] }),
1445
+ c.changeNote && /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground mt-0.5", children: c.changeNote }),
1446
+ /* @__PURE__ */ e.jsxs("p", { className: "text-muted-foreground mt-0.5", children: [
1447
+ c.author && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1448
+ c.author,
1449
+ " · "
1450
+ ] }),
1451
+ new Date(c.createdAt).toLocaleDateString()
1452
+ ] })
1453
+ ]
1454
+ },
1455
+ c.version
1456
+ )) })
1457
+ ] }), ht = ({ schema: n, onSave: c }) => {
1458
+ const {
1459
+ readOnly: a = !1,
1460
+ showToolbar: d = !0,
1461
+ showMinimap: o = !1,
1462
+ showVersionHistory: t = !1,
1463
+ showExecutionOverlay: u = !1,
1464
+ executionSteps: g = [],
1465
+ versionHistory: F = [],
1466
+ concurrencyPolicy: O,
1467
+ title: p = "New Flow",
1468
+ description: k = "",
1469
+ status: v = "draft"
1470
+ } = n, [f, L] = $(p), [de, i] = $(k), b = n.nodes ?? lt(), R = n.edges ?? nt(), { current: C, push: r, undo: j, redo: P, canUndo: M, canRedo: ue } = it({
1471
+ nodes: b,
1472
+ edges: R
1473
+ }), N = C.nodes, E = C.edges, [G, K] = $(null), [z, ae] = $(null), [Q, re] = $(!1), [ee, le] = $(null), [xe, ke] = $(!0), [s, x] = $(t), [y, A] = $(null), [se, ne] = $(1), w = $e(null), te = Se(
1474
+ () => N.find((l) => l.id === G) ?? null,
1475
+ [N, G]
1476
+ ), he = Se(
1477
+ () => E.find((l) => l.id === z) ?? null,
1478
+ [E, z]
1479
+ ), pe = Se(() => {
1480
+ if (!u || g.length === 0) return N;
1481
+ const l = new Map(g.map((m) => [m.nodeId, m.status]));
1482
+ return N.map(
1483
+ (m) => l.has(m.id) ? { ...m, executionStatus: l.get(m.id) } : m
1484
+ );
1485
+ }, [N, u, g]), ns = _((l) => {
1486
+ if (a) return;
1487
+ const D = {
1488
+ id: `${l}-${Date.now()}`,
1489
+ type: l,
1490
+ label: ve[l],
1491
+ position: { x: 200, y: 80 + N.length * 70 }
1492
+ };
1493
+ r({ nodes: [...N, D], edges: E });
1494
+ }, [a, N, E, r]), Ae = _((l) => {
1495
+ if (a) return;
1496
+ const m = N.filter((V) => V.id !== l), D = E.filter((V) => V.source !== l && V.target !== l);
1497
+ r({ nodes: m, edges: D }), G === l && K(null);
1498
+ }, [a, N, E, r, G]), is = _((l) => {
1499
+ a || r({ nodes: N.map((m) => m.id === l.id ? l : m), edges: E });
1500
+ }, [a, N, E, r]), He = _((l) => {
1501
+ a || (r({ nodes: N, edges: E.filter((m) => m.id !== l) }), z === l && ae(null));
1502
+ }, [a, N, E, r, z]), os = _((l) => {
1503
+ a || r({ nodes: N, edges: E.map((m) => m.id === l.id ? l : m) });
1504
+ }, [a, N, E, r]), cs = _((l) => {
1505
+ if (!a) {
1506
+ if (!Q) {
1507
+ re(!0), le(l);
1508
+ return;
1509
+ }
1510
+ if (ee && ee !== l) {
1511
+ const D = { id: `edge-${Date.now()}`, source: ee, target: l };
1512
+ r({ nodes: N, edges: [...E, D] });
1513
+ }
1514
+ re(!1), le(null);
1515
+ }
1516
+ }, [a, Q, ee, N, E, r]), Ce = $e(null), ie = $e(null), ds = _((l, m) => {
1517
+ Ce.current = m;
1518
+ const D = N.find((V) => V.id === m);
1519
+ D && (ie.current = {
1520
+ mouseX: l.clientX,
1521
+ mouseY: l.clientY,
1522
+ nodeX: D.position.x,
1523
+ nodeY: D.position.y
1524
+ }), l.dataTransfer.effectAllowed = "move";
1525
+ }, [N]), us = _((l) => {
1526
+ if (l.preventDefault(), !Ce.current || !ie.current || !w.current) return;
1527
+ w.current.getBoundingClientRect();
1528
+ const m = (l.clientX - ie.current.mouseX) / se, D = (l.clientY - ie.current.mouseY) / se, V = Math.max(0, ie.current.nodeX + m), Ee = Math.max(0, ie.current.nodeY + D), _e = Ce.current;
1529
+ r({
1530
+ nodes: N.map(
1531
+ (oe) => oe.id === _e ? { ...oe, position: { x: V, y: Ee } } : oe
1532
+ ),
1533
+ edges: E
1534
+ }), Ce.current = null, ie.current = null;
1535
+ }, [N, E, r, se]), xs = _(() => {
1536
+ const l = ot(N, E, f);
1537
+ A(l);
1538
+ const m = new Blob([l.bpmnXml ?? ""], { type: "application/xml" }), D = URL.createObjectURL(m), V = document.createElement("a");
1539
+ V.href = D, V.download = `${f.replace(/\s+/g, "-").toLowerCase()}.bpmn`, V.click(), URL.revokeObjectURL(D);
1540
+ }, [N, E, f]), Pe = _(() => {
1541
+ c?.(N, E);
1542
+ }, [N, E, c]), ms = _((l) => {
1543
+ const m = l.ctrlKey || l.metaKey;
1544
+ if (m && l.key === "z" && !l.shiftKey) {
1545
+ l.preventDefault(), j();
1546
+ return;
1547
+ }
1548
+ if (m && (l.key === "y" || l.key === "z" && l.shiftKey)) {
1549
+ l.preventDefault(), P();
1550
+ return;
1551
+ }
1552
+ if (m && l.key === "s") {
1553
+ l.preventDefault(), Pe();
1554
+ return;
1555
+ }
1556
+ l.key === "Escape" && (re(!1), le(null), K(null), ae(null)), (l.key === "Delete" || l.key === "Backspace") && (G ? Ae(G) : z && He(z));
1557
+ }, [j, P, Pe, G, z, Ae, He]);
1558
+ return /* @__PURE__ */ e.jsxs(q, { className: "flex flex-col h-full min-h-[600px] outline-none", tabIndex: 0, onKeyDown: ms, children: [
1559
+ /* @__PURE__ */ e.jsx(J, { className: "py-2 px-4 border-b flex-shrink-0", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3 flex-wrap", children: [
1560
+ /* @__PURE__ */ e.jsx(Me, { className: "h-4 w-4 text-primary shrink-0" }),
1561
+ /* @__PURE__ */ e.jsx(Z, { className: "text-sm font-semibold", children: a ? /* @__PURE__ */ e.jsx("span", { children: f }) : /* @__PURE__ */ e.jsx(
1562
+ S,
1563
+ {
1564
+ value: f,
1565
+ onChange: (l) => L(l.target.value),
1566
+ className: "h-6 text-sm font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent",
1567
+ "aria-label": "Flow title"
1568
+ }
1569
+ ) }),
1570
+ /* @__PURE__ */ e.jsx(I, { variant: "outline", className: "text-xs capitalize", children: v }),
1571
+ O && /* @__PURE__ */ e.jsx(I, { variant: "secondary", className: "text-xs", children: rt[O] }),
1572
+ /* @__PURE__ */ e.jsxs("div", { className: "ml-auto flex items-center gap-1", children: [
1573
+ !a && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1574
+ /* @__PURE__ */ e.jsx(T, { size: "icon", variant: "ghost", className: "h-7 w-7", onClick: j, disabled: !M, title: "Undo (Ctrl+Z)", children: /* @__PURE__ */ e.jsx(ks, { className: "h-4 w-4" }) }),
1575
+ /* @__PURE__ */ e.jsx(T, { size: "icon", variant: "ghost", className: "h-7 w-7", onClick: P, disabled: !ue, title: "Redo (Ctrl+Y)", children: /* @__PURE__ */ e.jsx(Cs, { className: "h-4 w-4" }) }),
1576
+ /* @__PURE__ */ e.jsx(ce, { orientation: "vertical", className: "h-5 mx-1" })
1577
+ ] }),
1578
+ /* @__PURE__ */ e.jsx(T, { size: "icon", variant: "ghost", className: "h-7 w-7", onClick: () => ne((l) => Math.min(2, l + 0.1)), title: "Zoom in", children: /* @__PURE__ */ e.jsx(Es, { className: "h-4 w-4" }) }),
1579
+ /* @__PURE__ */ e.jsx(T, { size: "icon", variant: "ghost", className: "h-7 w-7", onClick: () => ne(1), title: "Reset zoom", children: /* @__PURE__ */ e.jsx(_s, { className: "h-4 w-4" }) }),
1580
+ /* @__PURE__ */ e.jsx(T, { size: "icon", variant: "ghost", className: "h-7 w-7", onClick: () => ne((l) => Math.max(0.3, l - 0.1)), title: "Zoom out", children: /* @__PURE__ */ e.jsx(Ts, { className: "h-4 w-4" }) }),
1581
+ /* @__PURE__ */ e.jsx(ce, { orientation: "vertical", className: "h-5 mx-1" }),
1582
+ F.length > 0 && /* @__PURE__ */ e.jsx(
1583
+ T,
1584
+ {
1585
+ size: "icon",
1586
+ variant: s ? "secondary" : "ghost",
1587
+ className: "h-7 w-7",
1588
+ onClick: () => x((l) => !l),
1589
+ title: "Version history",
1590
+ children: /* @__PURE__ */ e.jsx(Ss, { className: "h-4 w-4" })
1591
+ }
1592
+ ),
1593
+ /* @__PURE__ */ e.jsx(T, { size: "icon", variant: "ghost", className: "h-7 w-7", onClick: xs, title: "Export BPMN", children: /* @__PURE__ */ e.jsx(Rs, { className: "h-4 w-4" }) }),
1594
+ !a && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1595
+ /* @__PURE__ */ e.jsx(T, { size: "icon", variant: "ghost", className: "h-7 w-7", title: "Import BPMN (drag & drop)", children: /* @__PURE__ */ e.jsx(As, { className: "h-4 w-4" }) }),
1596
+ /* @__PURE__ */ e.jsxs(
1597
+ T,
1598
+ {
1599
+ size: "sm",
1600
+ variant: "default",
1601
+ className: "h-7 text-xs gap-1",
1602
+ onClick: Pe,
1603
+ title: "Save (Ctrl+S)",
1604
+ children: [
1605
+ /* @__PURE__ */ e.jsx(Qe, { className: "h-3.5 w-3.5" }),
1606
+ " Save"
1607
+ ]
1608
+ }
1609
+ )
1610
+ ] }),
1611
+ /* @__PURE__ */ e.jsx(
1612
+ T,
1613
+ {
1614
+ size: "icon",
1615
+ variant: "ghost",
1616
+ className: "h-7 w-7",
1617
+ onClick: () => ke((l) => !l),
1618
+ title: xe ? "Hide properties" : "Show properties",
1619
+ children: xe ? /* @__PURE__ */ e.jsx(Ps, { className: "h-4 w-4" }) : /* @__PURE__ */ e.jsx(Os, { className: "h-4 w-4" })
1620
+ }
1621
+ )
1622
+ ] })
1623
+ ] }) }),
1624
+ /* @__PURE__ */ e.jsxs(X, { className: "flex flex-1 p-0 overflow-hidden", children: [
1625
+ d && !a && /* @__PURE__ */ e.jsxs("div", { className: "w-36 border-r bg-muted/30 flex-shrink-0 overflow-y-auto py-2 px-2", children: [
1626
+ /* @__PURE__ */ e.jsx("p", { className: "text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1", children: "Add Node" }),
1627
+ /* @__PURE__ */ e.jsx("div", { className: "space-y-1", children: at.map((l) => /* @__PURE__ */ e.jsxs(
1628
+ "button",
1629
+ {
1630
+ className: "w-full flex items-center gap-2 text-xs px-2 py-1.5 rounded hover:bg-muted transition-colors text-left",
1631
+ onClick: () => ns(l),
1632
+ title: `Add ${ve[l]}`,
1633
+ children: [
1634
+ ls[l],
1635
+ /* @__PURE__ */ e.jsx("span", { className: "truncate", children: ve[l] })
1636
+ ]
1637
+ },
1638
+ l
1639
+ )) }),
1640
+ Q && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1641
+ /* @__PURE__ */ e.jsx(ce, { className: "my-2" }),
1642
+ /* @__PURE__ */ e.jsxs("div", { className: "px-1", children: [
1643
+ /* @__PURE__ */ e.jsx("p", { className: "text-[10px] text-blue-600 font-medium", children: "Connect mode" }),
1644
+ /* @__PURE__ */ e.jsx("p", { className: "text-[10px] text-muted-foreground", children: "Click a target node port to connect." }),
1645
+ /* @__PURE__ */ e.jsx(
1646
+ T,
1647
+ {
1648
+ size: "sm",
1649
+ variant: "outline",
1650
+ className: "h-6 text-xs mt-1 w-full",
1651
+ onClick: () => {
1652
+ re(!1), le(null);
1653
+ },
1654
+ children: "Cancel"
1655
+ }
1656
+ )
1657
+ ] })
1658
+ ] })
1659
+ ] }),
1660
+ /* @__PURE__ */ e.jsx("div", { className: "flex-1 overflow-auto relative bg-dot-pattern", children: /* @__PURE__ */ e.jsxs(
1661
+ "div",
1662
+ {
1663
+ ref: w,
1664
+ className: "relative",
1665
+ style: {
1666
+ width: 1200,
1667
+ height: 700,
1668
+ transform: `scale(${se})`,
1669
+ transformOrigin: "top left"
1670
+ },
1671
+ onDrop: us,
1672
+ onDragOver: (l) => l.preventDefault(),
1673
+ onClick: (l) => {
1674
+ l.target === w.current && (K(null), ae(null));
1675
+ },
1676
+ children: [
1677
+ /* @__PURE__ */ e.jsxs(
1678
+ "svg",
1679
+ {
1680
+ className: "absolute inset-0 pointer-events-none",
1681
+ width: 1200,
1682
+ height: 700,
1683
+ style: { overflow: "visible" },
1684
+ children: [
1685
+ /* @__PURE__ */ e.jsxs("defs", { children: [
1686
+ /* @__PURE__ */ e.jsx("marker", { id: "fd-arrowhead", markerWidth: "10", markerHeight: "7", refX: "9", refY: "3.5", orient: "auto", children: /* @__PURE__ */ e.jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "hsl(var(--foreground) / 0.5)" }) }),
1687
+ /* @__PURE__ */ e.jsx("marker", { id: "fd-arrowhead-selected", markerWidth: "10", markerHeight: "7", refX: "9", refY: "3.5", orient: "auto", children: /* @__PURE__ */ e.jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "hsl(var(--primary))" }) }),
1688
+ /* @__PURE__ */ e.jsx("marker", { id: "fd-arrowhead-conditional", markerWidth: "10", markerHeight: "7", refX: "9", refY: "3.5", orient: "auto", children: /* @__PURE__ */ e.jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "hsl(var(--foreground) / 0.6)" }) })
1689
+ ] }),
1690
+ E.map((l) => {
1691
+ const m = pe.find((ge) => ge.id === l.source), D = pe.find((ge) => ge.id === l.target);
1692
+ if (!m || !D) return null;
1693
+ const { d: V, labelX: Ee, labelY: _e } = dt(m, D), oe = l.id === z, Oe = l.type === "conditional", De = l.isDefault;
1694
+ return /* @__PURE__ */ e.jsxs(
1695
+ "g",
1696
+ {
1697
+ className: "pointer-events-auto cursor-pointer",
1698
+ onClick: (ge) => {
1699
+ ge.stopPropagation(), ae(l.id), K(null);
1700
+ },
1701
+ children: [
1702
+ /* @__PURE__ */ e.jsx(
1703
+ "path",
1704
+ {
1705
+ d: V,
1706
+ fill: "none",
1707
+ stroke: oe ? "hsl(var(--primary))" : Oe ? "hsl(var(--foreground) / 0.6)" : "hsl(var(--foreground) / 0.4)",
1708
+ strokeWidth: oe ? 2.5 : 2,
1709
+ strokeDasharray: Oe ? "6 3" : De ? "3 3" : void 0,
1710
+ markerEnd: `url(#fd-arrowhead${oe ? "-selected" : Oe ? "-conditional" : ""})`
1711
+ }
1712
+ ),
1713
+ (l.label || De) && /* @__PURE__ */ e.jsx(
1714
+ "text",
1715
+ {
1716
+ x: Ee,
1717
+ y: _e,
1718
+ textAnchor: "middle",
1719
+ className: "text-[10px] fill-muted-foreground",
1720
+ style: { fontSize: 10 },
1721
+ children: l.label ?? (De ? "(default)" : "")
1722
+ }
1723
+ ),
1724
+ l.condition && /* @__PURE__ */ e.jsx(
1725
+ "text",
1726
+ {
1727
+ x: Ee,
1728
+ y: _e + 12,
1729
+ textAnchor: "middle",
1730
+ className: "text-[9px] fill-orange-500",
1731
+ style: { fontSize: 9 },
1732
+ children: l.condition.length > 24 ? l.condition.slice(0, 24) + "…" : l.condition
1733
+ }
1734
+ ),
1735
+ /* @__PURE__ */ e.jsx("path", { d: V, fill: "none", stroke: "transparent", strokeWidth: 12 })
1736
+ ]
1737
+ },
1738
+ l.id
1739
+ );
1740
+ })
1741
+ ]
1742
+ }
1743
+ ),
1744
+ pe.map((l) => /* @__PURE__ */ e.jsx(
1745
+ ut,
1746
+ {
1747
+ node: l,
1748
+ isSelected: G === l.id,
1749
+ isConnectSource: ee === l.id,
1750
+ connectMode: Q,
1751
+ readOnly: a,
1752
+ showExecutionOverlay: u,
1753
+ onSelect: (m, D) => {
1754
+ D || ae(null), K(m);
1755
+ },
1756
+ onDelete: Ae,
1757
+ onDragStart: ds,
1758
+ onPortClick: cs
1759
+ },
1760
+ l.id
1761
+ )),
1762
+ Q && ee && /* @__PURE__ */ e.jsxs(
1763
+ "div",
1764
+ {
1765
+ className: "absolute bottom-4 left-1/2 -translate-x-1/2 bg-blue-600 text-white text-xs px-3 py-1.5 rounded shadow-lg pointer-events-none",
1766
+ children: [
1767
+ /* @__PURE__ */ e.jsx(Ds, { className: "h-3 w-3 inline mr-1" }),
1768
+ "Click a node port to complete the connection — Esc to cancel"
1769
+ ]
1770
+ }
1771
+ ),
1772
+ N.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 flex items-center justify-center text-muted-foreground text-sm", children: "No nodes yet. Use the toolbar to add nodes." })
1773
+ ]
1774
+ }
1775
+ ) }),
1776
+ s && F.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "w-48 border-l bg-background flex-shrink-0 overflow-y-auto", children: /* @__PURE__ */ e.jsx(mt, { versions: F }) }),
1777
+ xe && /* @__PURE__ */ e.jsxs("div", { className: "w-52 border-l bg-background flex-shrink-0 overflow-y-auto", children: [
1778
+ /* @__PURE__ */ e.jsx(
1779
+ xt,
1780
+ {
1781
+ node: te,
1782
+ edge: he,
1783
+ readOnly: a,
1784
+ onNodeChange: is,
1785
+ onEdgeChange: os
1786
+ }
1787
+ ),
1788
+ y && /* @__PURE__ */ e.jsxs("div", { className: "p-3 border-t", children: [
1789
+ /* @__PURE__ */ e.jsx("p", { className: "text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-1", children: "BPMN Export" }),
1790
+ /* @__PURE__ */ e.jsx(I, { variant: y.success ? "default" : "destructive", className: "text-[10px]", children: y.success ? `Exported ${y.nodeCount} nodes` : "Export failed" }),
1791
+ y.warnings?.map((l, m) => /* @__PURE__ */ e.jsx("p", { className: "text-[10px] text-amber-600 mt-0.5", children: l }, m))
1792
+ ] })
1793
+ ] })
1794
+ ] })
722
1795
  ] });
723
1796
  };
724
- ie.register(
1797
+ we.register(
725
1798
  "workflow-designer",
726
- Ye,
1799
+ Ws,
727
1800
  {
728
1801
  label: "Workflow Designer",
729
1802
  category: "Enterprise",
@@ -735,9 +1808,9 @@ ie.register(
735
1808
  ]
736
1809
  }
737
1810
  );
738
- ie.register(
1811
+ we.register(
739
1812
  "approval-process",
740
- We,
1813
+ qs,
741
1814
  {
742
1815
  label: "Approval Process",
743
1816
  category: "Enterprise",
@@ -752,7 +1825,54 @@ ie.register(
752
1825
  ]
753
1826
  }
754
1827
  );
1828
+ we.register(
1829
+ "automation-builder",
1830
+ Js,
1831
+ {
1832
+ label: "Automation Builder",
1833
+ category: "Enterprise",
1834
+ inputs: [
1835
+ { name: "automation", type: "code", label: "Automation Definition" },
1836
+ { name: "objects", type: "code", label: "Available Objects" }
1837
+ ]
1838
+ }
1839
+ );
1840
+ we.register(
1841
+ "automation-run-history",
1842
+ et,
1843
+ {
1844
+ label: "Automation Run History",
1845
+ category: "Enterprise",
1846
+ inputs: [
1847
+ { name: "runs", type: "code", label: "Run History" }
1848
+ ]
1849
+ }
1850
+ );
1851
+ we.register(
1852
+ "flow-designer",
1853
+ ht,
1854
+ {
1855
+ label: "Flow Designer",
1856
+ category: "Enterprise",
1857
+ inputs: [
1858
+ { name: "nodes", type: "code", label: "Flow Nodes" },
1859
+ { name: "edges", type: "code", label: "Flow Edges" },
1860
+ { name: "title", type: "string", label: "Flow Title" },
1861
+ { name: "readOnly", type: "boolean", label: "Read Only", defaultValue: !1 },
1862
+ { name: "showToolbar", type: "boolean", label: "Show Toolbar", defaultValue: !0 },
1863
+ { name: "showMinimap", type: "boolean", label: "Show Minimap", defaultValue: !1 },
1864
+ { name: "showVersionHistory", type: "boolean", label: "Show Version History", defaultValue: !1 },
1865
+ { name: "showExecutionOverlay", type: "boolean", label: "Show Execution Overlay", defaultValue: !1 },
1866
+ { name: "concurrencyPolicy", type: "string", label: "Concurrency Policy" },
1867
+ { name: "versionHistory", type: "code", label: "Version History" },
1868
+ { name: "executionSteps", type: "code", label: "Execution Steps" }
1869
+ ]
1870
+ }
1871
+ );
755
1872
  export {
756
- We as ApprovalProcess,
757
- Ye as WorkflowDesigner
1873
+ qs as ApprovalProcess,
1874
+ Js as AutomationBuilder,
1875
+ et as AutomationRunHistory,
1876
+ ht as FlowDesigner,
1877
+ Ws as WorkflowDesigner
758
1878
  };