@goplasmatic/dataflow-ui 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
2
  import React, { createContext, useState, useEffect, useContext, forwardRef, createElement, useReducer, useRef, useCallback, useMemo, memo, useLayoutEffect, createRef, useImperativeHandle, Component } from "react";
6
3
  import { createPortal } from "react-dom";
@@ -39,22 +36,18 @@ function useTheme() {
39
36
  }
40
37
  return context;
41
38
  }
42
- /**
43
- * @license lucide-react v0.462.0 - ISC
44
- *
45
- * This source code is licensed under the ISC license.
46
- * See the LICENSE file in the root directory of this source tree.
47
- */
48
- const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
49
39
  const mergeClasses = (...classes) => classes.filter((className, index2, array2) => {
50
40
  return Boolean(className) && className.trim() !== "" && array2.indexOf(className) === index2;
51
41
  }).join(" ").trim();
52
- /**
53
- * @license lucide-react v0.462.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */
42
+ const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
43
+ const toCamelCase = (string) => string.replace(
44
+ /^([A-Z])|[\s-_]+(\w)/g,
45
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
46
+ );
47
+ const toPascalCase = (string) => {
48
+ const camelCase = toCamelCase(string);
49
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
50
+ };
58
51
  var defaultAttributes = {
59
52
  xmlns: "http://www.w3.org/2000/svg",
60
53
  width: 24,
@@ -66,12 +59,14 @@ var defaultAttributes = {
66
59
  strokeLinecap: "round",
67
60
  strokeLinejoin: "round"
68
61
  };
69
- /**
70
- * @license lucide-react v0.462.0 - ISC
71
- *
72
- * This source code is licensed under the ISC license.
73
- * See the LICENSE file in the root directory of this source tree.
74
- */
62
+ const hasA11yProp = (props) => {
63
+ for (const prop in props) {
64
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
65
+ return true;
66
+ }
67
+ }
68
+ return false;
69
+ };
75
70
  const Icon = forwardRef(
76
71
  ({
77
72
  color: color2 = "currentColor",
@@ -82,73 +77,54 @@ const Icon = forwardRef(
82
77
  children: children2,
83
78
  iconNode,
84
79
  ...rest
85
- }, ref) => {
86
- return createElement(
87
- "svg",
88
- {
89
- ref,
90
- ...defaultAttributes,
91
- width: size,
92
- height: size,
93
- stroke: color2,
94
- strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
95
- className: mergeClasses("lucide", className),
96
- ...rest
97
- },
98
- [
99
- ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
100
- ...Array.isArray(children2) ? children2 : [children2]
101
- ]
102
- );
103
- }
80
+ }, ref) => createElement(
81
+ "svg",
82
+ {
83
+ ref,
84
+ ...defaultAttributes,
85
+ width: size,
86
+ height: size,
87
+ stroke: color2,
88
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
89
+ className: mergeClasses("lucide", className),
90
+ ...!children2 && !hasA11yProp(rest) && { "aria-hidden": "true" },
91
+ ...rest
92
+ },
93
+ [
94
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
95
+ ...Array.isArray(children2) ? children2 : [children2]
96
+ ]
97
+ )
104
98
  );
105
- /**
106
- * @license lucide-react v0.462.0 - ISC
107
- *
108
- * This source code is licensed under the ISC license.
109
- * See the LICENSE file in the root directory of this source tree.
110
- */
111
99
  const createLucideIcon = (iconName, iconNode) => {
112
100
  const Component2 = forwardRef(
113
101
  ({ className, ...props }, ref) => createElement(Icon, {
114
102
  ref,
115
103
  iconNode,
116
- className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
104
+ className: mergeClasses(
105
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
106
+ `lucide-${iconName}`,
107
+ className
108
+ ),
117
109
  ...props
118
110
  })
119
111
  );
120
- Component2.displayName = `${iconName}`;
112
+ Component2.displayName = toPascalCase(iconName);
121
113
  return Component2;
122
114
  };
123
- /**
124
- * @license lucide-react v0.462.0 - ISC
125
- *
126
- * This source code is licensed under the ISC license.
127
- * See the LICENSE file in the root directory of this source tree.
128
- */
129
- const ArrowRightLeft = createLucideIcon("ArrowRightLeft", [
115
+ const __iconNode$t = [
130
116
  ["path", { d: "m16 3 4 4-4 4", key: "1x1c3m" }],
131
117
  ["path", { d: "M20 7H4", key: "zbl0bi" }],
132
118
  ["path", { d: "m8 21-4-4 4-4", key: "h9nckh" }],
133
119
  ["path", { d: "M4 17h16", key: "g4d7ey" }]
134
- ]);
135
- /**
136
- * @license lucide-react v0.462.0 - ISC
137
- *
138
- * This source code is licensed under the ISC license.
139
- * See the LICENSE file in the root directory of this source tree.
140
- */
141
- const ArrowRight = createLucideIcon("ArrowRight", [
120
+ ];
121
+ const ArrowRightLeft = createLucideIcon("arrow-right-left", __iconNode$t);
122
+ const __iconNode$s = [
142
123
  ["path", { d: "M5 12h14", key: "1ays0h" }],
143
124
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
144
- ]);
145
- /**
146
- * @license lucide-react v0.462.0 - ISC
147
- *
148
- * This source code is licensed under the ISC license.
149
- * See the LICENSE file in the root directory of this source tree.
150
- */
151
- const Box = createLucideIcon("Box", [
125
+ ];
126
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$s);
127
+ const __iconNode$r = [
152
128
  [
153
129
  "path",
154
130
  {
@@ -158,123 +134,63 @@ const Box = createLucideIcon("Box", [
158
134
  ],
159
135
  ["path", { d: "m3.3 7 8.7 5 8.7-5", key: "g66t2b" }],
160
136
  ["path", { d: "M12 22V12", key: "d0xqtd" }]
161
- ]);
162
- /**
163
- * @license lucide-react v0.462.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */
168
- const Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
169
- /**
170
- * @license lucide-react v0.462.0 - ISC
171
- *
172
- * This source code is licensed under the ISC license.
173
- * See the LICENSE file in the root directory of this source tree.
174
- */
175
- const ChevronDown = createLucideIcon("ChevronDown", [
176
- ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
177
- ]);
178
- /**
179
- * @license lucide-react v0.462.0 - ISC
180
- *
181
- * This source code is licensed under the ISC license.
182
- * See the LICENSE file in the root directory of this source tree.
183
- */
184
- const ChevronLeft = createLucideIcon("ChevronLeft", [
185
- ["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
186
- ]);
187
- /**
188
- * @license lucide-react v0.462.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */
193
- const ChevronRight = createLucideIcon("ChevronRight", [
194
- ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
195
- ]);
196
- /**
197
- * @license lucide-react v0.462.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */
202
- const ChevronsLeft = createLucideIcon("ChevronsLeft", [
137
+ ];
138
+ const Box = createLucideIcon("box", __iconNode$r);
139
+ const __iconNode$q = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
140
+ const Check = createLucideIcon("check", __iconNode$q);
141
+ const __iconNode$p = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
142
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$p);
143
+ const __iconNode$o = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
144
+ const ChevronLeft = createLucideIcon("chevron-left", __iconNode$o);
145
+ const __iconNode$n = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
146
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$n);
147
+ const __iconNode$m = [
203
148
  ["path", { d: "m11 17-5-5 5-5", key: "13zhaf" }],
204
149
  ["path", { d: "m18 17-5-5 5-5", key: "h8a8et" }]
205
- ]);
206
- /**
207
- * @license lucide-react v0.462.0 - ISC
208
- *
209
- * This source code is licensed under the ISC license.
210
- * See the LICENSE file in the root directory of this source tree.
211
- */
212
- const ChevronsRight = createLucideIcon("ChevronsRight", [
150
+ ];
151
+ const ChevronsLeft = createLucideIcon("chevrons-left", __iconNode$m);
152
+ const __iconNode$l = [
213
153
  ["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
214
154
  ["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }]
215
- ]);
216
- /**
217
- * @license lucide-react v0.462.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */
222
- const CircleAlert = createLucideIcon("CircleAlert", [
155
+ ];
156
+ const ChevronsRight = createLucideIcon("chevrons-right", __iconNode$l);
157
+ const __iconNode$k = [
223
158
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
224
159
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
225
160
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
226
- ]);
227
- /**
228
- * @license lucide-react v0.462.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */
233
- const CircleCheckBig = createLucideIcon("CircleCheckBig", [
161
+ ];
162
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$k);
163
+ const __iconNode$j = [
234
164
  ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
235
165
  ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
236
- ]);
237
- /**
238
- * @license lucide-react v0.462.0 - ISC
239
- *
240
- * This source code is licensed under the ISC license.
241
- * See the LICENSE file in the root directory of this source tree.
242
- */
243
- const CircleX = createLucideIcon("CircleX", [
166
+ ];
167
+ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$j);
168
+ const __iconNode$i = [
244
169
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
245
170
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
246
171
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
247
- ]);
248
- /**
249
- * @license lucide-react v0.462.0 - ISC
250
- *
251
- * This source code is licensed under the ISC license.
252
- * See the LICENSE file in the root directory of this source tree.
253
- */
254
- const Clock = createLucideIcon("Clock", [
172
+ ];
173
+ const CircleX = createLucideIcon("circle-x", __iconNode$i);
174
+ const __iconNode$h = [
255
175
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
256
- ["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
257
- ]);
258
- /**
259
- * @license lucide-react v0.462.0 - ISC
260
- *
261
- * This source code is licensed under the ISC license.
262
- * See the LICENSE file in the root directory of this source tree.
263
- */
264
- const ExternalLink = createLucideIcon("ExternalLink", [
176
+ ["path", { d: "M12 6v6l4 2", key: "mmk7yg" }]
177
+ ];
178
+ const Clock = createLucideIcon("clock", __iconNode$h);
179
+ const __iconNode$g = [
265
180
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
266
181
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
267
182
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
268
- ]);
269
- /**
270
- * @license lucide-react v0.462.0 - ISC
271
- *
272
- * This source code is licensed under the ISC license.
273
- * See the LICENSE file in the root directory of this source tree.
274
- */
275
- const FileJson = createLucideIcon("FileJson", [
276
- ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
277
- ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
183
+ ];
184
+ const ExternalLink = createLucideIcon("external-link", __iconNode$g);
185
+ const __iconNode$f = [
186
+ [
187
+ "path",
188
+ {
189
+ d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
190
+ key: "1oefj6"
191
+ }
192
+ ],
193
+ ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
278
194
  [
279
195
  "path",
280
196
  { d: "M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1", key: "1oajmo" }
@@ -283,14 +199,9 @@ const FileJson = createLucideIcon("FileJson", [
283
199
  "path",
284
200
  { d: "M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1", key: "mpwhp6" }
285
201
  ]
286
- ]);
287
- /**
288
- * @license lucide-react v0.462.0 - ISC
289
- *
290
- * This source code is licensed under the ISC license.
291
- * See the LICENSE file in the root directory of this source tree.
292
- */
293
- const Folder = createLucideIcon("Folder", [
202
+ ];
203
+ const FileBraces = createLucideIcon("file-braces", __iconNode$f);
204
+ const __iconNode$e = [
294
205
  [
295
206
  "path",
296
207
  {
@@ -298,142 +209,104 @@ const Folder = createLucideIcon("Folder", [
298
209
  key: "1kt360"
299
210
  }
300
211
  ]
301
- ]);
302
- /**
303
- * @license lucide-react v0.462.0 - ISC
304
- *
305
- * This source code is licensed under the ISC license.
306
- * See the LICENSE file in the root directory of this source tree.
307
- */
308
- const Gauge = createLucideIcon("Gauge", [
212
+ ];
213
+ const Folder = createLucideIcon("folder", __iconNode$e);
214
+ const __iconNode$d = [
309
215
  ["path", { d: "m12 14 4-4", key: "9kzdfg" }],
310
216
  ["path", { d: "M3.34 19a10 10 0 1 1 17.32 0", key: "19p75a" }]
311
- ]);
312
- /**
313
- * @license lucide-react v0.462.0 - ISC
314
- *
315
- * This source code is licensed under the ISC license.
316
- * See the LICENSE file in the root directory of this source tree.
317
- */
318
- const GitBranch = createLucideIcon("GitBranch", [
319
- ["line", { x1: "6", x2: "6", y1: "3", y2: "15", key: "17qcm7" }],
217
+ ];
218
+ const Gauge = createLucideIcon("gauge", __iconNode$d);
219
+ const __iconNode$c = [
220
+ ["path", { d: "M15 6a9 9 0 0 0-9 9V3", key: "1cii5b" }],
320
221
  ["circle", { cx: "18", cy: "6", r: "3", key: "1h7g24" }],
321
- ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
322
- ["path", { d: "M18 9a9 9 0 0 1-9 9", key: "n2h4wq" }]
323
- ]);
324
- /**
325
- * @license lucide-react v0.462.0 - ISC
326
- *
327
- * This source code is licensed under the ISC license.
328
- * See the LICENSE file in the root directory of this source tree.
329
- */
330
- const Layers = createLucideIcon("Layers", [
222
+ ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }]
223
+ ];
224
+ const GitBranch = createLucideIcon("git-branch", __iconNode$c);
225
+ const __iconNode$b = [
226
+ [
227
+ "path",
228
+ {
229
+ d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
230
+ key: "zw3jo"
231
+ }
232
+ ],
331
233
  [
332
234
  "path",
333
235
  {
334
- d: "m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",
335
- key: "8b97xw"
236
+ d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
237
+ key: "1wduqc"
336
238
  }
337
239
  ],
338
- ["path", { d: "m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65", key: "dd6zsq" }],
339
- ["path", { d: "m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65", key: "ep9fru" }]
340
- ]);
341
- /**
342
- * @license lucide-react v0.462.0 - ISC
343
- *
344
- * This source code is licensed under the ISC license.
345
- * See the LICENSE file in the root directory of this source tree.
346
- */
347
- const LoaderCircle = createLucideIcon("LoaderCircle", [
348
- ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
349
- ]);
350
- /**
351
- * @license lucide-react v0.462.0 - ISC
352
- *
353
- * This source code is licensed under the ISC license.
354
- * See the LICENSE file in the root directory of this source tree.
355
- */
356
- const Pause = createLucideIcon("Pause", [
357
- ["rect", { x: "14", y: "4", width: "4", height: "16", rx: "1", key: "zuxfzm" }],
358
- ["rect", { x: "6", y: "4", width: "4", height: "16", rx: "1", key: "1okwgv" }]
359
- ]);
360
- /**
361
- * @license lucide-react v0.462.0 - ISC
362
- *
363
- * This source code is licensed under the ISC license.
364
- * See the LICENSE file in the root directory of this source tree.
365
- */
366
- const Play = createLucideIcon("Play", [
367
- ["polygon", { points: "6 3 20 12 6 21 6 3", key: "1oa8hb" }]
368
- ]);
369
- /**
370
- * @license lucide-react v0.462.0 - ISC
371
- *
372
- * This source code is licensed under the ISC license.
373
- * See the LICENSE file in the root directory of this source tree.
374
- */
375
- const RefreshCw = createLucideIcon("RefreshCw", [
240
+ [
241
+ "path",
242
+ {
243
+ d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
244
+ key: "kqbvx6"
245
+ }
246
+ ]
247
+ ];
248
+ const Layers = createLucideIcon("layers", __iconNode$b);
249
+ const __iconNode$a = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
250
+ const LoaderCircle = createLucideIcon("loader-circle", __iconNode$a);
251
+ const __iconNode$9 = [
252
+ ["rect", { x: "14", y: "3", width: "5", height: "18", rx: "1", key: "kaeet6" }],
253
+ ["rect", { x: "5", y: "3", width: "5", height: "18", rx: "1", key: "1wsw3u" }]
254
+ ];
255
+ const Pause = createLucideIcon("pause", __iconNode$9);
256
+ const __iconNode$8 = [
257
+ [
258
+ "path",
259
+ {
260
+ d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
261
+ key: "10ikf1"
262
+ }
263
+ ]
264
+ ];
265
+ const Play = createLucideIcon("play", __iconNode$8);
266
+ const __iconNode$7 = [
376
267
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
377
268
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
378
269
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
379
270
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
380
- ]);
381
- /**
382
- * @license lucide-react v0.462.0 - ISC
383
- *
384
- * This source code is licensed under the ISC license.
385
- * See the LICENSE file in the root directory of this source tree.
386
- */
387
- const RotateCcw = createLucideIcon("RotateCcw", [
271
+ ];
272
+ const RefreshCw = createLucideIcon("refresh-cw", __iconNode$7);
273
+ const __iconNode$6 = [
388
274
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
389
275
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
390
- ]);
391
- /**
392
- * @license lucide-react v0.462.0 - ISC
393
- *
394
- * This source code is licensed under the ISC license.
395
- * See the LICENSE file in the root directory of this source tree.
396
- */
397
- const Search = createLucideIcon("Search", [
398
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
399
- ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
400
- ]);
401
- /**
402
- * @license lucide-react v0.462.0 - ISC
403
- *
404
- * This source code is licensed under the ISC license.
405
- * See the LICENSE file in the root directory of this source tree.
406
- */
407
- const SkipBack = createLucideIcon("SkipBack", [
408
- ["polygon", { points: "19 20 9 12 19 4 19 20", key: "o2sva" }],
409
- ["line", { x1: "5", x2: "5", y1: "19", y2: "5", key: "1ocqjk" }]
410
- ]);
411
- /**
412
- * @license lucide-react v0.462.0 - ISC
413
- *
414
- * This source code is licensed under the ISC license.
415
- * See the LICENSE file in the root directory of this source tree.
416
- */
417
- const SkipForward = createLucideIcon("SkipForward", [
418
- ["polygon", { points: "5 4 15 12 5 20 5 4", key: "16p6eg" }],
419
- ["line", { x1: "19", x2: "19", y1: "5", y2: "19", key: "futhcm" }]
420
- ]);
421
- /**
422
- * @license lucide-react v0.462.0 - ISC
423
- *
424
- * This source code is licensed under the ISC license.
425
- * See the LICENSE file in the root directory of this source tree.
426
- */
427
- const Square = createLucideIcon("Square", [
276
+ ];
277
+ const RotateCcw = createLucideIcon("rotate-ccw", __iconNode$6);
278
+ const __iconNode$5 = [
279
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
280
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
281
+ ];
282
+ const Search = createLucideIcon("search", __iconNode$5);
283
+ const __iconNode$4 = [
284
+ [
285
+ "path",
286
+ {
287
+ d: "M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",
288
+ key: "15892j"
289
+ }
290
+ ],
291
+ ["path", { d: "M3 20V4", key: "1ptbpl" }]
292
+ ];
293
+ const SkipBack = createLucideIcon("skip-back", __iconNode$4);
294
+ const __iconNode$3 = [
295
+ ["path", { d: "M21 4v16", key: "7j8fe9" }],
296
+ [
297
+ "path",
298
+ {
299
+ d: "M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",
300
+ key: "zs4d6"
301
+ }
302
+ ]
303
+ ];
304
+ const SkipForward = createLucideIcon("skip-forward", __iconNode$3);
305
+ const __iconNode$2 = [
428
306
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
429
- ]);
430
- /**
431
- * @license lucide-react v0.462.0 - ISC
432
- *
433
- * This source code is licensed under the ISC license.
434
- * See the LICENSE file in the root directory of this source tree.
435
- */
436
- const TriangleAlert = createLucideIcon("TriangleAlert", [
307
+ ];
308
+ const Square = createLucideIcon("square", __iconNode$2);
309
+ const __iconNode$1 = [
437
310
  [
438
311
  "path",
439
312
  {
@@ -443,17 +316,13 @@ const TriangleAlert = createLucideIcon("TriangleAlert", [
443
316
  ],
444
317
  ["path", { d: "M12 9v4", key: "juzpu7" }],
445
318
  ["path", { d: "M12 17h.01", key: "p32p05" }]
446
- ]);
447
- /**
448
- * @license lucide-react v0.462.0 - ISC
449
- *
450
- * This source code is licensed under the ISC license.
451
- * See the LICENSE file in the root directory of this source tree.
452
- */
453
- const X = createLucideIcon("X", [
319
+ ];
320
+ const TriangleAlert = createLucideIcon("triangle-alert", __iconNode$1);
321
+ const __iconNode = [
454
322
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
455
323
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
456
- ]);
324
+ ];
325
+ const X = createLucideIcon("x", __iconNode);
457
326
  function isBuiltinFunction(name) {
458
327
  return name === "map" || name === "validation" || name === "validate";
459
328
  }
@@ -505,8 +374,7 @@ function getChangesAtStep(trace, stepIndex) {
505
374
  return auditTrail[auditTrail.length - 1].changes;
506
375
  }
507
376
  function getMappingContext(step, mappingIndex) {
508
- var _a, _b;
509
- return ((_a = step.mapping_contexts) == null ? void 0 : _a[mappingIndex]) ?? ((_b = step.message) == null ? void 0 : _b.context);
377
+ return step.mapping_contexts?.[mappingIndex] ?? step.message?.context;
510
378
  }
511
379
  function getWorkflowState(trace, currentStepIndex, workflowId) {
512
380
  const workflowStepIndices = [];
@@ -817,14 +685,13 @@ function DebuggerProvider({
817
685
  );
818
686
  const runExecution = useCallback(
819
687
  async (workflows, payload) => {
820
- var _a;
821
688
  if (workflows.length === 0 || !engineFactory) {
822
689
  return null;
823
690
  }
824
691
  try {
825
692
  const workflowsJson = JSON.stringify(workflows);
826
693
  if (lastWorkflowsJsonRef.current !== workflowsJson || !engineRef.current) {
827
- if ((_a = engineRef.current) == null ? void 0 : _a.dispose) {
694
+ if (engineRef.current?.dispose) {
828
695
  engineRef.current.dispose();
829
696
  }
830
697
  engineRef.current = engineFactory(workflows);
@@ -840,8 +707,7 @@ function DebuggerProvider({
840
707
  );
841
708
  useEffect(() => {
842
709
  return () => {
843
- var _a;
844
- if ((_a = engineRef.current) == null ? void 0 : _a.dispose) {
710
+ if (engineRef.current?.dispose) {
845
711
  engineRef.current.dispose();
846
712
  engineRef.current = null;
847
713
  }
@@ -3858,9 +3724,9 @@ const getConnectedEdges = (nodes, edges) => {
3858
3724
  };
3859
3725
  function getFitViewNodes(nodeLookup, options) {
3860
3726
  const fitViewNodes = /* @__PURE__ */ new Map();
3861
- const optionNodeIds = (options == null ? void 0 : options.nodes) ? new Set(options.nodes.map((node) => node.id)) : null;
3727
+ const optionNodeIds = options?.nodes ? new Set(options.nodes.map((node) => node.id)) : null;
3862
3728
  nodeLookup.forEach((n) => {
3863
- const isVisible = n.measured.width && n.measured.height && ((options == null ? void 0 : options.includeHiddenNodes) || !n.hidden);
3729
+ const isVisible = n.measured.width && n.measured.height && (options?.includeHiddenNodes || !n.hidden);
3864
3730
  if (isVisible && (!optionNodeIds || optionNodeIds.has(n.id))) {
3865
3731
  fitViewNodes.set(n.id, n);
3866
3732
  }
@@ -3873,11 +3739,11 @@ async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom },
3873
3739
  }
3874
3740
  const nodesToFit = getFitViewNodes(nodes, options);
3875
3741
  const bounds = getInternalNodesBounds(nodesToFit);
3876
- const viewport = getViewportForBounds(bounds, width, height, (options == null ? void 0 : options.minZoom) ?? minZoom, (options == null ? void 0 : options.maxZoom) ?? maxZoom, (options == null ? void 0 : options.padding) ?? 0.1);
3742
+ const viewport = getViewportForBounds(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
3877
3743
  await panZoom.setViewport(viewport, {
3878
- duration: options == null ? void 0 : options.duration,
3879
- ease: options == null ? void 0 : options.ease,
3880
- interpolate: options == null ? void 0 : options.interpolate
3744
+ duration: options?.duration,
3745
+ ease: options?.ease,
3746
+ interpolate: options?.interpolate
3881
3747
  });
3882
3748
  return Promise.resolve(true);
3883
3749
  }
@@ -3889,7 +3755,7 @@ function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin =
3889
3755
  let extent = node.extent || nodeExtent;
3890
3756
  if (node.extent === "parent" && !node.expandParent) {
3891
3757
  if (!parentNode) {
3892
- onError == null ? void 0 : onError("005", errorMessages$2["error005"]());
3758
+ onError?.("005", errorMessages$2["error005"]());
3893
3759
  } else {
3894
3760
  const parentWidth = parentNode.measured.width;
3895
3761
  const parentHeight = parentNode.measured.height;
@@ -3908,7 +3774,7 @@ function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin =
3908
3774
  }
3909
3775
  const positionAbsolute = isCoordinateExtent(extent) ? clampPosition(nextPosition, extent, node.measured) : nextPosition;
3910
3776
  if (node.measured.width === void 0 || node.measured.height === void 0) {
3911
- onError == null ? void 0 : onError("015", errorMessages$2["error015"]());
3777
+ onError?.("015", errorMessages$2["error015"]());
3912
3778
  }
3913
3779
  return {
3914
3780
  position: {
@@ -3958,8 +3824,8 @@ async function getElementsToRemove({ nodesToRemove = [], edgesToRemove = [], nod
3958
3824
  }
3959
3825
  const clamp = (val, min = 0, max = 1) => Math.min(Math.max(val, min), max);
3960
3826
  const clampPosition = (position = { x: 0, y: 0 }, extent, dimensions) => ({
3961
- x: clamp(position.x, extent[0][0], extent[1][0] - ((dimensions == null ? void 0 : dimensions.width) ?? 0)),
3962
- y: clamp(position.y, extent[0][1], extent[1][1] - ((dimensions == null ? void 0 : dimensions.height) ?? 0))
3827
+ x: clamp(position.x, extent[0][0], extent[1][0] - (dimensions?.width ?? 0)),
3828
+ y: clamp(position.y, extent[0][1], extent[1][1] - (dimensions?.height ?? 0))
3963
3829
  });
3964
3830
  function clampPositionToParent(childPosition, childDimensions, parent) {
3965
3831
  const { width: parentWidth, height: parentHeight } = getNodeDimensions(parent);
@@ -4001,23 +3867,21 @@ const boxToRect = ({ x, y, x2, y2 }) => ({
4001
3867
  height: y2 - y
4002
3868
  });
4003
3869
  const nodeToRect = (node, nodeOrigin = [0, 0]) => {
4004
- var _a, _b;
4005
3870
  const { x, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
4006
3871
  return {
4007
3872
  x,
4008
3873
  y,
4009
- width: ((_a = node.measured) == null ? void 0 : _a.width) ?? node.width ?? node.initialWidth ?? 0,
4010
- height: ((_b = node.measured) == null ? void 0 : _b.height) ?? node.height ?? node.initialHeight ?? 0
3874
+ width: node.measured?.width ?? node.width ?? node.initialWidth ?? 0,
3875
+ height: node.measured?.height ?? node.height ?? node.initialHeight ?? 0
4011
3876
  };
4012
3877
  };
4013
3878
  const nodeToBox = (node, nodeOrigin = [0, 0]) => {
4014
- var _a, _b;
4015
3879
  const { x, y } = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin);
4016
3880
  return {
4017
3881
  x,
4018
3882
  y,
4019
- x2: x + (((_a = node.measured) == null ? void 0 : _a.width) ?? node.width ?? node.initialWidth ?? 0),
4020
- y2: y + (((_b = node.measured) == null ? void 0 : _b.height) ?? node.height ?? node.initialHeight ?? 0)
3883
+ x2: x + (node.measured?.width ?? node.width ?? node.initialWidth ?? 0),
3884
+ y2: y + (node.measured?.height ?? node.height ?? node.initialHeight ?? 0)
4021
3885
  };
4022
3886
  };
4023
3887
  const getBoundsOfRects = (rect1, rect2) => boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2)));
@@ -4128,23 +3992,18 @@ const getViewportForBounds = (bounds, width, height, minZoom, maxZoom, padding)
4128
3992
  zoom: clampedZoom
4129
3993
  };
4130
3994
  };
4131
- const isMacOs = () => {
4132
- var _a;
4133
- return typeof navigator !== "undefined" && ((_a = navigator == null ? void 0 : navigator.userAgent) == null ? void 0 : _a.indexOf("Mac")) >= 0;
4134
- };
3995
+ const isMacOs = () => typeof navigator !== "undefined" && navigator?.userAgent?.indexOf("Mac") >= 0;
4135
3996
  function isCoordinateExtent(extent) {
4136
3997
  return extent !== void 0 && extent !== null && extent !== "parent";
4137
3998
  }
4138
3999
  function getNodeDimensions(node) {
4139
- var _a, _b;
4140
4000
  return {
4141
- width: ((_a = node.measured) == null ? void 0 : _a.width) ?? node.width ?? node.initialWidth ?? 0,
4142
- height: ((_b = node.measured) == null ? void 0 : _b.height) ?? node.height ?? node.initialHeight ?? 0
4001
+ width: node.measured?.width ?? node.width ?? node.initialWidth ?? 0,
4002
+ height: node.measured?.height ?? node.height ?? node.initialHeight ?? 0
4143
4003
  };
4144
4004
  }
4145
4005
  function nodeHasDimensions(node) {
4146
- var _a, _b;
4147
- return (((_a = node.measured) == null ? void 0 : _a.width) ?? node.width ?? node.initialWidth) !== void 0 && (((_b = node.measured) == null ? void 0 : _b.height) ?? node.height ?? node.initialHeight) !== void 0;
4006
+ return (node.measured?.width ?? node.width ?? node.initialWidth) !== void 0 && (node.measured?.height ?? node.height ?? node.initialHeight) !== void 0;
4148
4007
  }
4149
4008
  function evaluateAbsolutePosition(position, dimensions = { width: 0, height: 0 }, parentId, nodeLookup, nodeOrigin) {
4150
4009
  const positionAbsolute = { ...position };
@@ -4181,7 +4040,7 @@ function mergeAriaLabelConfig(partial) {
4181
4040
  }
4182
4041
  function getPointerPosition(event, { snapGrid = [0, 0], snapToGrid = false, transform: transform2, containerBounds }) {
4183
4042
  const { x, y } = getEventPosition(event);
4184
- const pointerPos = pointToRendererPoint({ x: x - ((containerBounds == null ? void 0 : containerBounds.left) ?? 0), y: y - ((containerBounds == null ? void 0 : containerBounds.top) ?? 0) }, transform2);
4043
+ const pointerPos = pointToRendererPoint({ x: x - (containerBounds?.left ?? 0), y: y - (containerBounds?.top ?? 0) }, transform2);
4185
4044
  const { x: xSnapped, y: ySnapped } = snapToGrid ? snapPosition(pointerPos, snapGrid) : pointerPos;
4186
4045
  return {
4187
4046
  xSnapped,
@@ -4193,28 +4052,23 @@ const getDimensions = (node) => ({
4193
4052
  width: node.offsetWidth,
4194
4053
  height: node.offsetHeight
4195
4054
  });
4196
- const getHostForElement = (element) => {
4197
- var _a;
4198
- return ((_a = element == null ? void 0 : element.getRootNode) == null ? void 0 : _a.call(element)) || (window == null ? void 0 : window.document);
4199
- };
4055
+ const getHostForElement = (element) => element?.getRootNode?.() || window?.document;
4200
4056
  const inputTags = ["INPUT", "SELECT", "TEXTAREA"];
4201
4057
  function isInputDOMNode(event) {
4202
- var _a, _b;
4203
- const target = ((_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)) == null ? void 0 : _b[0]) || event.target;
4204
- if ((target == null ? void 0 : target.nodeType) !== 1)
4058
+ const target = event.composedPath?.()?.[0] || event.target;
4059
+ if (target?.nodeType !== 1)
4205
4060
  return false;
4206
4061
  const isInput = inputTags.includes(target.nodeName) || target.hasAttribute("contenteditable");
4207
4062
  return isInput || !!target.closest(".nokey");
4208
4063
  }
4209
4064
  const isMouseEvent = (event) => "clientX" in event;
4210
4065
  const getEventPosition = (event, bounds) => {
4211
- var _a, _b;
4212
4066
  const isMouse = isMouseEvent(event);
4213
- const evtX = isMouse ? event.clientX : (_a = event.touches) == null ? void 0 : _a[0].clientX;
4214
- const evtY = isMouse ? event.clientY : (_b = event.touches) == null ? void 0 : _b[0].clientY;
4067
+ const evtX = isMouse ? event.clientX : event.touches?.[0].clientX;
4068
+ const evtY = isMouse ? event.clientY : event.touches?.[0].clientY;
4215
4069
  return {
4216
- x: evtX - ((bounds == null ? void 0 : bounds.left) ?? 0),
4217
- y: evtY - ((bounds == null ? void 0 : bounds.top) ?? 0)
4070
+ x: evtX - (bounds?.left ?? 0),
4071
+ y: evtY - (bounds?.top ?? 0)
4218
4072
  };
4219
4073
  };
4220
4074
  const getHandleBounds = (type, nodeElement, nodeBounds, zoom2, nodeId) => {
@@ -4509,33 +4363,31 @@ function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom,
4509
4363
  return [path, labelX, labelY, offsetX, offsetY];
4510
4364
  }
4511
4365
  function isNodeInitialized(node) {
4512
- var _a;
4513
- return node && !!(node.internals.handleBounds || ((_a = node.handles) == null ? void 0 : _a.length)) && !!(node.measured.width || node.width || node.initialWidth);
4366
+ return node && !!(node.internals.handleBounds || node.handles?.length) && !!(node.measured.width || node.width || node.initialWidth);
4514
4367
  }
4515
4368
  function getEdgePosition(params) {
4516
- var _a;
4517
4369
  const { sourceNode, targetNode } = params;
4518
4370
  if (!isNodeInitialized(sourceNode) || !isNodeInitialized(targetNode)) {
4519
4371
  return null;
4520
4372
  }
4521
4373
  const sourceHandleBounds = sourceNode.internals.handleBounds || toHandleBounds(sourceNode.handles);
4522
4374
  const targetHandleBounds = targetNode.internals.handleBounds || toHandleBounds(targetNode.handles);
4523
- const sourceHandle = getHandle$1((sourceHandleBounds == null ? void 0 : sourceHandleBounds.source) ?? [], params.sourceHandle);
4375
+ const sourceHandle = getHandle$1(sourceHandleBounds?.source ?? [], params.sourceHandle);
4524
4376
  const targetHandle = getHandle$1(
4525
4377
  // when connection type is loose we can define all handles as sources and connect source -> source
4526
- params.connectionMode === ConnectionMode.Strict ? (targetHandleBounds == null ? void 0 : targetHandleBounds.target) ?? [] : ((targetHandleBounds == null ? void 0 : targetHandleBounds.target) ?? []).concat((targetHandleBounds == null ? void 0 : targetHandleBounds.source) ?? []),
4378
+ params.connectionMode === ConnectionMode.Strict ? targetHandleBounds?.target ?? [] : (targetHandleBounds?.target ?? []).concat(targetHandleBounds?.source ?? []),
4527
4379
  params.targetHandle
4528
4380
  );
4529
4381
  if (!sourceHandle || !targetHandle) {
4530
- (_a = params.onError) == null ? void 0 : _a.call(params, "008", errorMessages$2["error008"](!sourceHandle ? "source" : "target", {
4382
+ params.onError?.("008", errorMessages$2["error008"](!sourceHandle ? "source" : "target", {
4531
4383
  id: params.id,
4532
4384
  sourceHandle: params.sourceHandle,
4533
4385
  targetHandle: params.targetHandle
4534
4386
  }));
4535
4387
  return null;
4536
4388
  }
4537
- const sourcePosition = (sourceHandle == null ? void 0 : sourceHandle.position) || Position.Bottom;
4538
- const targetPosition = (targetHandle == null ? void 0 : targetHandle.position) || Position.Top;
4389
+ const sourcePosition = sourceHandle?.position || Position.Bottom;
4390
+ const targetPosition = targetHandle?.position || Position.Top;
4539
4391
  const source = getHandlePosition(sourceNode, sourceHandle, sourcePosition);
4540
4392
  const target = getHandlePosition(targetNode, targetHandle, targetPosition);
4541
4393
  return {
@@ -4568,13 +4420,13 @@ function toHandleBounds(handles) {
4568
4420
  };
4569
4421
  }
4570
4422
  function getHandlePosition(node, handle, fallbackPosition = Position.Left, center = false) {
4571
- const x = ((handle == null ? void 0 : handle.x) ?? 0) + node.internals.positionAbsolute.x;
4572
- const y = ((handle == null ? void 0 : handle.y) ?? 0) + node.internals.positionAbsolute.y;
4423
+ const x = (handle?.x ?? 0) + node.internals.positionAbsolute.x;
4424
+ const y = (handle?.y ?? 0) + node.internals.positionAbsolute.y;
4573
4425
  const { width, height } = handle ?? getNodeDimensions(node);
4574
4426
  if (center) {
4575
4427
  return { x: x + width / 2, y: y + height / 2 };
4576
4428
  }
4577
- const position = (handle == null ? void 0 : handle.position) ?? fallbackPosition;
4429
+ const position = handle?.position ?? fallbackPosition;
4578
4430
  switch (position) {
4579
4431
  case Position.Top:
4580
4432
  return { x: x + width / 2, y };
@@ -4654,7 +4506,7 @@ function updateAbsolutePositions(nodeLookup, parentLookup, options) {
4654
4506
  }
4655
4507
  function parseHandles(userNode, internalNode) {
4656
4508
  if (!userNode.handles) {
4657
- return !userNode.measured ? void 0 : internalNode == null ? void 0 : internalNode.internals.handleBounds;
4509
+ return !userNode.measured ? void 0 : internalNode?.internals.handleBounds;
4658
4510
  }
4659
4511
  const source = [];
4660
4512
  const target = [];
@@ -4684,17 +4536,16 @@ function isManualZIndexMode(zIndexMode) {
4684
4536
  return zIndexMode === "manual";
4685
4537
  }
4686
4538
  function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
4687
- var _a, _b;
4688
4539
  const _options = mergeObjects(adoptUserNodesDefaultOptions, options);
4689
4540
  const rootParentIndex = { i: 0 };
4690
4541
  const tmpLookup = new Map(nodeLookup);
4691
- const selectedNodeZ = (_options == null ? void 0 : _options.elevateNodesOnSelect) && !isManualZIndexMode(_options.zIndexMode) ? SELECTED_NODE_Z : 0;
4542
+ const selectedNodeZ = _options?.elevateNodesOnSelect && !isManualZIndexMode(_options.zIndexMode) ? SELECTED_NODE_Z : 0;
4692
4543
  let nodesInitialized = nodes.length > 0;
4693
4544
  nodeLookup.clear();
4694
4545
  parentLookup.clear();
4695
4546
  for (const userNode of nodes) {
4696
4547
  let internalNode = tmpLookup.get(userNode.id);
4697
- if (_options.checkEquality && userNode === (internalNode == null ? void 0 : internalNode.internals.userNode)) {
4548
+ if (_options.checkEquality && userNode === internalNode?.internals.userNode) {
4698
4549
  nodeLookup.set(userNode.id, internalNode);
4699
4550
  } else {
4700
4551
  const positionWithOrigin = getNodePositionWithOrigin(userNode, _options.nodeOrigin);
@@ -4704,8 +4555,8 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
4704
4555
  ..._options.defaults,
4705
4556
  ...userNode,
4706
4557
  measured: {
4707
- width: (_a = userNode.measured) == null ? void 0 : _a.width,
4708
- height: (_b = userNode.measured) == null ? void 0 : _b.height
4558
+ width: userNode.measured?.width,
4559
+ height: userNode.measured?.height
4709
4560
  },
4710
4561
  internals: {
4711
4562
  positionAbsolute: clampedPosition,
@@ -4793,7 +4644,6 @@ function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, select
4793
4644
  };
4794
4645
  }
4795
4646
  function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0, 0]) {
4796
- var _a;
4797
4647
  const changes = [];
4798
4648
  const parentExpansions = /* @__PURE__ */ new Map();
4799
4649
  for (const child of children2) {
@@ -4801,13 +4651,12 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
4801
4651
  if (!parent) {
4802
4652
  continue;
4803
4653
  }
4804
- const parentRect = ((_a = parentExpansions.get(child.parentId)) == null ? void 0 : _a.expandedRect) ?? nodeToRect(parent);
4654
+ const parentRect = parentExpansions.get(child.parentId)?.expandedRect ?? nodeToRect(parent);
4805
4655
  const expandedRect = getBoundsOfRects(parentRect, child.rect);
4806
4656
  parentExpansions.set(child.parentId, { expandedRect, parent });
4807
4657
  }
4808
4658
  if (parentExpansions.size > 0) {
4809
4659
  parentExpansions.forEach(({ expandedRect, parent }, parentId) => {
4810
- var _a2;
4811
4660
  const positionAbsolute = parent.internals.positionAbsolute;
4812
4661
  const dimensions = getNodeDimensions(parent);
4813
4662
  const origin = parent.origin ?? nodeOrigin;
@@ -4826,7 +4675,7 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
4826
4675
  y: parent.position.y - yChange + heightChange
4827
4676
  }
4828
4677
  });
4829
- (_a2 = parentLookup.get(parentId)) == null ? void 0 : _a2.forEach((childNode) => {
4678
+ parentLookup.get(parentId)?.forEach((childNode) => {
4830
4679
  if (!children2.some((child) => child.id === childNode.id)) {
4831
4680
  changes.push({
4832
4681
  id: childNode.id,
@@ -4855,7 +4704,7 @@ function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0
4855
4704
  return changes;
4856
4705
  }
4857
4706
  function updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin, nodeExtent, zIndexMode) {
4858
- const viewportNode = domNode == null ? void 0 : domNode.querySelector(".xyflow__viewport");
4707
+ const viewportNode = domNode?.querySelector(".xyflow__viewport");
4859
4708
  let updatedInternals = false;
4860
4709
  if (!viewportNode) {
4861
4710
  return { changes: [], updatedInternals };
@@ -4986,14 +4835,13 @@ function isParentSelected(node, nodeLookup) {
4986
4835
  return isParentSelected(parentNode, nodeLookup);
4987
4836
  }
4988
4837
  function hasSelector(target, selector2, domNode) {
4989
- var _a;
4990
4838
  let current = target;
4991
4839
  do {
4992
- if ((_a = current == null ? void 0 : current.matches) == null ? void 0 : _a.call(current, selector2))
4840
+ if (current?.matches?.(selector2))
4993
4841
  return true;
4994
4842
  if (current === domNode)
4995
4843
  return false;
4996
- current = current == null ? void 0 : current.parentElement;
4844
+ current = current?.parentElement;
4997
4845
  } while (current);
4998
4846
  return false;
4999
4847
  }
@@ -5028,10 +4876,9 @@ function getDragItems(nodeLookup, nodesDraggable, mousePos, nodeId) {
5028
4876
  return dragItems;
5029
4877
  }
5030
4878
  function getEventHandlerParams({ nodeId, dragItems, nodeLookup, dragging = true }) {
5031
- var _a, _b, _c;
5032
4879
  const nodesFromDragItems = [];
5033
4880
  for (const [id2, dragItem] of dragItems) {
5034
- const node2 = (_a = nodeLookup.get(id2)) == null ? void 0 : _a.internals.userNode;
4881
+ const node2 = nodeLookup.get(id2)?.internals.userNode;
5035
4882
  if (node2) {
5036
4883
  nodesFromDragItems.push({
5037
4884
  ...node2,
@@ -5043,11 +4890,11 @@ function getEventHandlerParams({ nodeId, dragItems, nodeLookup, dragging = true
5043
4890
  if (!nodeId) {
5044
4891
  return [nodesFromDragItems[0], nodesFromDragItems];
5045
4892
  }
5046
- const node = (_b = nodeLookup.get(nodeId)) == null ? void 0 : _b.internals.userNode;
4893
+ const node = nodeLookup.get(nodeId)?.internals.userNode;
5047
4894
  return [
5048
4895
  !node ? nodesFromDragItems[0] : {
5049
4896
  ...node,
5050
- position: ((_c = dragItems.get(nodeId)) == null ? void 0 : _c.position) || node.position,
4897
+ position: dragItems.get(nodeId)?.position || node.position,
5051
4898
  dragging
5052
4899
  },
5053
4900
  nodesFromDragItems
@@ -5140,10 +4987,10 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
5140
4987
  dragItems,
5141
4988
  nodeLookup
5142
4989
  });
5143
- onDrag == null ? void 0 : onDrag(dragEvent, dragItems, currentNode, currentNodes);
5144
- onNodeDrag == null ? void 0 : onNodeDrag(dragEvent, currentNode, currentNodes);
4990
+ onDrag?.(dragEvent, dragItems, currentNode, currentNodes);
4991
+ onNodeDrag?.(dragEvent, currentNode, currentNodes);
5145
4992
  if (!nodeId) {
5146
- onSelectionDrag == null ? void 0 : onSelectionDrag(dragEvent, currentNodes);
4993
+ onSelectionDrag?.(dragEvent, currentNodes);
5147
4994
  }
5148
4995
  }
5149
4996
  }
@@ -5168,16 +5015,15 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
5168
5015
  autoPanId = requestAnimationFrame(autoPan);
5169
5016
  }
5170
5017
  function startDrag(event) {
5171
- var _a;
5172
5018
  const { nodeLookup, multiSelectionActive, nodesDraggable, transform: transform2, snapGrid, snapToGrid, selectNodesOnDrag, onNodeDragStart, onSelectionDragStart, unselectNodesAndEdges } = getStoreItems();
5173
5019
  dragStarted = true;
5174
5020
  if ((!selectNodesOnDrag || !isSelectable) && !multiSelectionActive && nodeId) {
5175
- if (!((_a = nodeLookup.get(nodeId)) == null ? void 0 : _a.selected)) {
5021
+ if (!nodeLookup.get(nodeId)?.selected) {
5176
5022
  unselectNodesAndEdges();
5177
5023
  }
5178
5024
  }
5179
5025
  if (isSelectable && selectNodesOnDrag && nodeId) {
5180
- onNodeMouseDown == null ? void 0 : onNodeMouseDown(nodeId);
5026
+ onNodeMouseDown?.(nodeId);
5181
5027
  }
5182
5028
  const pointerPos = getPointerPosition(event.sourceEvent, { transform: transform2, snapGrid, snapToGrid, containerBounds });
5183
5029
  lastPos = pointerPos;
@@ -5188,16 +5034,16 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
5188
5034
  dragItems,
5189
5035
  nodeLookup
5190
5036
  });
5191
- onDragStart == null ? void 0 : onDragStart(event.sourceEvent, dragItems, currentNode, currentNodes);
5192
- onNodeDragStart == null ? void 0 : onNodeDragStart(event.sourceEvent, currentNode, currentNodes);
5037
+ onDragStart?.(event.sourceEvent, dragItems, currentNode, currentNodes);
5038
+ onNodeDragStart?.(event.sourceEvent, currentNode, currentNodes);
5193
5039
  if (!nodeId) {
5194
- onSelectionDragStart == null ? void 0 : onSelectionDragStart(event.sourceEvent, currentNodes);
5040
+ onSelectionDragStart?.(event.sourceEvent, currentNodes);
5195
5041
  }
5196
5042
  }
5197
5043
  }
5198
5044
  const d3DragInstance = drag().clickDistance(nodeClickDistance).on("start", (event) => {
5199
5045
  const { domNode: domNode2, nodeDragThreshold, transform: transform2, snapGrid, snapToGrid } = getStoreItems();
5200
- containerBounds = (domNode2 == null ? void 0 : domNode2.getBoundingClientRect()) || null;
5046
+ containerBounds = domNode2?.getBoundingClientRect() || null;
5201
5047
  abortDrag = false;
5202
5048
  nodePositionsChanged = false;
5203
5049
  dragEvent = event.sourceEvent;
@@ -5255,10 +5101,10 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
5255
5101
  nodeLookup,
5256
5102
  dragging: false
5257
5103
  });
5258
- onDragStop == null ? void 0 : onDragStop(event.sourceEvent, dragItems, currentNode, currentNodes);
5259
- onNodeDragStop == null ? void 0 : onNodeDragStop(event.sourceEvent, currentNode, currentNodes);
5104
+ onDragStop?.(event.sourceEvent, dragItems, currentNode, currentNodes);
5105
+ onNodeDragStop?.(event.sourceEvent, currentNode, currentNodes);
5260
5106
  if (!nodeId) {
5261
- onSelectionDragStop == null ? void 0 : onSelectionDragStop(event.sourceEvent, currentNodes);
5107
+ onSelectionDragStop?.(event.sourceEvent, currentNodes);
5262
5108
  }
5263
5109
  }
5264
5110
  }
@@ -5270,7 +5116,7 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
5270
5116
  d3Selection.call(d3DragInstance);
5271
5117
  }
5272
5118
  function destroy() {
5273
- d3Selection == null ? void 0 : d3Selection.on(".drag", null);
5119
+ d3Selection?.on(".drag", null);
5274
5120
  }
5275
5121
  return {
5276
5122
  update,
@@ -5294,12 +5140,11 @@ function getNodesWithinDistance(position, nodeLookup, distance2) {
5294
5140
  }
5295
5141
  const ADDITIONAL_DISTANCE = 250;
5296
5142
  function getClosestHandle(position, connectionRadius, nodeLookup, fromHandle) {
5297
- var _a, _b;
5298
5143
  let closestHandles = [];
5299
5144
  let minDistance = Infinity;
5300
5145
  const closeNodes = getNodesWithinDistance(position, nodeLookup, connectionRadius + ADDITIONAL_DISTANCE);
5301
5146
  for (const node of closeNodes) {
5302
- const allHandles = [...((_a = node.internals.handleBounds) == null ? void 0 : _a.source) ?? [], ...((_b = node.internals.handleBounds) == null ? void 0 : _b.target) ?? []];
5147
+ const allHandles = [...node.internals.handleBounds?.source ?? [], ...node.internals.handleBounds?.target ?? []];
5303
5148
  for (const handle of allHandles) {
5304
5149
  if (fromHandle.nodeId === handle.nodeId && fromHandle.type === handle.type && fromHandle.id === handle.id) {
5305
5150
  continue;
@@ -5327,21 +5172,20 @@ function getClosestHandle(position, connectionRadius, nodeLookup, fromHandle) {
5327
5172
  return closestHandles[0];
5328
5173
  }
5329
5174
  function getHandle(nodeId, handleType, handleId, nodeLookup, connectionMode, withAbsolutePosition = false) {
5330
- var _a, _b, _c;
5331
5175
  const node = nodeLookup.get(nodeId);
5332
5176
  if (!node) {
5333
5177
  return null;
5334
5178
  }
5335
- const handles = connectionMode === "strict" ? (_a = node.internals.handleBounds) == null ? void 0 : _a[handleType] : [...((_b = node.internals.handleBounds) == null ? void 0 : _b.source) ?? [], ...((_c = node.internals.handleBounds) == null ? void 0 : _c.target) ?? []];
5336
- const handle = (handleId ? handles == null ? void 0 : handles.find((h2) => h2.id === handleId) : handles == null ? void 0 : handles[0]) ?? null;
5179
+ const handles = connectionMode === "strict" ? node.internals.handleBounds?.[handleType] : [...node.internals.handleBounds?.source ?? [], ...node.internals.handleBounds?.target ?? []];
5180
+ const handle = (handleId ? handles?.find((h2) => h2.id === handleId) : handles?.[0]) ?? null;
5337
5181
  return handle && withAbsolutePosition ? { ...handle, ...getHandlePosition(node, handle, handle.position, true) } : handle;
5338
5182
  }
5339
5183
  function getHandleType(edgeUpdaterType, handleDomNode) {
5340
5184
  if (edgeUpdaterType) {
5341
5185
  return edgeUpdaterType;
5342
- } else if (handleDomNode == null ? void 0 : handleDomNode.classList.contains("target")) {
5186
+ } else if (handleDomNode?.classList.contains("target")) {
5343
5187
  return "target";
5344
- } else if (handleDomNode == null ? void 0 : handleDomNode.classList.contains("source")) {
5188
+ } else if (handleDomNode?.classList.contains("source")) {
5345
5189
  return "source";
5346
5190
  }
5347
5191
  return null;
@@ -5362,7 +5206,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
5362
5206
  let closestHandle;
5363
5207
  const { x, y } = getEventPosition(event);
5364
5208
  const handleType = getHandleType(edgeUpdaterType, handleDomNode);
5365
- const containerBounds = domNode == null ? void 0 : domNode.getBoundingClientRect();
5209
+ const containerBounds = domNode?.getBoundingClientRect();
5366
5210
  let connectionStarted = false;
5367
5211
  if (!containerBounds || !handleType) {
5368
5212
  return;
@@ -5408,7 +5252,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
5408
5252
  function startConnection() {
5409
5253
  connectionStarted = true;
5410
5254
  updateConnection(previousConnection);
5411
- onConnectStart == null ? void 0 : onConnectStart(event, { nodeId, handleId, handleType });
5255
+ onConnectStart?.(event, { nodeId, handleId, handleType });
5412
5256
  }
5413
5257
  if (dragThreshold === 0) {
5414
5258
  startConnection();
@@ -5471,16 +5315,16 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
5471
5315
  }
5472
5316
  if (connectionStarted) {
5473
5317
  if ((closestHandle || resultHandleDomNode) && connection && isValid) {
5474
- onConnect == null ? void 0 : onConnect(connection);
5318
+ onConnect?.(connection);
5475
5319
  }
5476
5320
  const { inProgress, ...connectionState } = previousConnection;
5477
5321
  const finalConnectionState = {
5478
5322
  ...connectionState,
5479
5323
  toPosition: previousConnection.toHandle ? previousConnection.toPosition : null
5480
5324
  };
5481
- onConnectEnd == null ? void 0 : onConnectEnd(event2, finalConnectionState);
5325
+ onConnectEnd?.(event2, finalConnectionState);
5482
5326
  if (edgeUpdaterType) {
5483
- onReconnectEnd == null ? void 0 : onReconnectEnd(event2, finalConnectionState);
5327
+ onReconnectEnd?.(event2, finalConnectionState);
5484
5328
  }
5485
5329
  }
5486
5330
  cancelConnection();
@@ -5501,10 +5345,10 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
5501
5345
  }
5502
5346
  function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib: lib2, flowId, isValidConnection = alwaysValid, nodeLookup }) {
5503
5347
  const isTarget = fromType === "target";
5504
- const handleDomNode = handle ? doc.querySelector(`.${lib2}-flow__handle[data-id="${flowId}-${handle == null ? void 0 : handle.nodeId}-${handle == null ? void 0 : handle.id}-${handle == null ? void 0 : handle.type}"]`) : null;
5348
+ const handleDomNode = handle ? doc.querySelector(`.${lib2}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`) : null;
5505
5349
  const { x, y } = getEventPosition(event);
5506
5350
  const handleBelow = doc.elementFromPoint(x, y);
5507
- const handleToCheck = (handleBelow == null ? void 0 : handleBelow.classList.contains(`${lib2}-flow__handle`)) ? handleBelow : handleDomNode;
5351
+ const handleToCheck = handleBelow?.classList.contains(`${lib2}-flow__handle`) ? handleBelow : handleDomNode;
5508
5352
  const result = {
5509
5353
  handleDomNode: handleToCheck,
5510
5354
  isValid: false,
@@ -5655,11 +5499,11 @@ function createPanOnScrollHandler({ zoomPanValues, noWheelClassName, d3Selection
5655
5499
  clearTimeout(zoomPanValues.panScrollTimeout);
5656
5500
  if (!zoomPanValues.isPanScrolling) {
5657
5501
  zoomPanValues.isPanScrolling = true;
5658
- onPanZoomStart == null ? void 0 : onPanZoomStart(event, nextViewport);
5502
+ onPanZoomStart?.(event, nextViewport);
5659
5503
  } else {
5660
- onPanZoom == null ? void 0 : onPanZoom(event, nextViewport);
5504
+ onPanZoom?.(event, nextViewport);
5661
5505
  zoomPanValues.panScrollTimeout = setTimeout(() => {
5662
- onPanZoomEnd == null ? void 0 : onPanZoomEnd(event, nextViewport);
5506
+ onPanZoomEnd?.(event, nextViewport);
5663
5507
  zoomPanValues.isPanScrolling = false;
5664
5508
  }, 150);
5665
5509
  }
@@ -5682,38 +5526,35 @@ function createZoomOnScrollHandler({ noWheelClassName, preventScrolling, d3ZoomH
5682
5526
  }
5683
5527
  function createPanZoomStartHandler({ zoomPanValues, onDraggingChange, onPanZoomStart }) {
5684
5528
  return (event) => {
5685
- var _a, _b, _c;
5686
- if ((_a = event.sourceEvent) == null ? void 0 : _a.internal) {
5529
+ if (event.sourceEvent?.internal) {
5687
5530
  return;
5688
5531
  }
5689
5532
  const viewport = transformToViewport(event.transform);
5690
- zoomPanValues.mouseButton = ((_b = event.sourceEvent) == null ? void 0 : _b.button) || 0;
5533
+ zoomPanValues.mouseButton = event.sourceEvent?.button || 0;
5691
5534
  zoomPanValues.isZoomingOrPanning = true;
5692
5535
  zoomPanValues.prevViewport = viewport;
5693
- if (((_c = event.sourceEvent) == null ? void 0 : _c.type) === "mousedown") {
5536
+ if (event.sourceEvent?.type === "mousedown") {
5694
5537
  onDraggingChange(true);
5695
5538
  }
5696
5539
  if (onPanZoomStart) {
5697
- onPanZoomStart == null ? void 0 : onPanZoomStart(event.sourceEvent, viewport);
5540
+ onPanZoomStart?.(event.sourceEvent, viewport);
5698
5541
  }
5699
5542
  };
5700
5543
  }
5701
5544
  function createPanZoomHandler({ zoomPanValues, panOnDrag, onPaneContextMenu, onTransformChange, onPanZoom }) {
5702
5545
  return (event) => {
5703
- var _a, _b;
5704
5546
  zoomPanValues.usedRightMouseButton = !!(onPaneContextMenu && isRightClickPan(panOnDrag, zoomPanValues.mouseButton ?? 0));
5705
- if (!((_a = event.sourceEvent) == null ? void 0 : _a.sync)) {
5547
+ if (!event.sourceEvent?.sync) {
5706
5548
  onTransformChange([event.transform.x, event.transform.y, event.transform.k]);
5707
5549
  }
5708
- if (onPanZoom && !((_b = event.sourceEvent) == null ? void 0 : _b.internal)) {
5709
- onPanZoom == null ? void 0 : onPanZoom(event.sourceEvent, transformToViewport(event.transform));
5550
+ if (onPanZoom && !event.sourceEvent?.internal) {
5551
+ onPanZoom?.(event.sourceEvent, transformToViewport(event.transform));
5710
5552
  }
5711
5553
  };
5712
5554
  }
5713
5555
  function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDraggingChange, onPanZoomEnd, onPaneContextMenu }) {
5714
5556
  return (event) => {
5715
- var _a;
5716
- if ((_a = event.sourceEvent) == null ? void 0 : _a.internal) {
5557
+ if (event.sourceEvent?.internal) {
5717
5558
  return;
5718
5559
  }
5719
5560
  zoomPanValues.isZoomingOrPanning = false;
@@ -5728,7 +5569,7 @@ function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDrag
5728
5569
  clearTimeout(zoomPanValues.timerId);
5729
5570
  zoomPanValues.timerId = setTimeout(
5730
5571
  () => {
5731
- onPanZoomEnd == null ? void 0 : onPanZoomEnd(event.sourceEvent, viewport);
5572
+ onPanZoomEnd?.(event.sourceEvent, viewport);
5732
5573
  },
5733
5574
  // we need a setTimeout for panOnScroll to supress multiple end events fired during scroll
5734
5575
  panOnScroll ? 150 : 0
@@ -5738,7 +5579,6 @@ function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDrag
5738
5579
  }
5739
5580
  function createFilter({ zoomActivationKeyPressed, zoomOnScroll, zoomOnPinch, panOnDrag, panOnScroll, zoomOnDoubleClick, userSelectionActive, noWheelClassName, noPanClassName, lib: lib2, connectionInProgress }) {
5740
5581
  return (event) => {
5741
- var _a;
5742
5582
  const zoomScroll = zoomActivationKeyPressed || zoomOnScroll;
5743
5583
  const pinchZoom = zoomOnPinch && event.ctrlKey;
5744
5584
  const isWheelEvent = event.type === "wheel";
@@ -5763,7 +5603,7 @@ function createFilter({ zoomActivationKeyPressed, zoomOnScroll, zoomOnPinch, pan
5763
5603
  if (!zoomOnPinch && event.ctrlKey && isWheelEvent) {
5764
5604
  return false;
5765
5605
  }
5766
- if (!zoomOnPinch && event.type === "touchstart" && ((_a = event.touches) == null ? void 0 : _a.length) > 1) {
5606
+ if (!zoomOnPinch && event.type === "touchstart" && event.touches?.length > 1) {
5767
5607
  event.preventDefault();
5768
5608
  return false;
5769
5609
  }
@@ -5807,7 +5647,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
5807
5647
  function setTransform(transform2, options) {
5808
5648
  if (d3Selection) {
5809
5649
  return new Promise((resolve) => {
5810
- d3ZoomInstance == null ? void 0 : d3ZoomInstance.interpolate((options == null ? void 0 : options.interpolate) === "linear" ? interpolate$1 : interpolateZoom).transform(getD3Transition(d3Selection, options == null ? void 0 : options.duration, options == null ? void 0 : options.ease, () => resolve(true)), transform2);
5650
+ d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? interpolate$1 : interpolateZoom).transform(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(true)), transform2);
5811
5651
  });
5812
5652
  }
5813
5653
  return Promise.resolve(false);
@@ -5885,7 +5725,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
5885
5725
  }
5886
5726
  async function setViewportConstrained(viewport2, extent, translateExtent2) {
5887
5727
  const nextTransform = viewportToTransform(viewport2);
5888
- const contrainedTransform = d3ZoomInstance == null ? void 0 : d3ZoomInstance.constrain()(nextTransform, extent, translateExtent2);
5728
+ const contrainedTransform = d3ZoomInstance?.constrain()(nextTransform, extent, translateExtent2);
5889
5729
  if (contrainedTransform) {
5890
5730
  await setTransform(contrainedTransform);
5891
5731
  }
@@ -5901,7 +5741,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
5901
5741
  const nextTransform = viewportToTransform(viewport2);
5902
5742
  const currentTransform = d3Selection.property("__zoom");
5903
5743
  if (currentTransform.k !== viewport2.zoom || currentTransform.x !== viewport2.x || currentTransform.y !== viewport2.y) {
5904
- d3ZoomInstance == null ? void 0 : d3ZoomInstance.transform(d3Selection, nextTransform, null, { sync: true });
5744
+ d3ZoomInstance?.transform(d3Selection, nextTransform, null, { sync: true });
5905
5745
  }
5906
5746
  }
5907
5747
  }
@@ -5912,7 +5752,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
5912
5752
  function scaleTo(zoom2, options) {
5913
5753
  if (d3Selection) {
5914
5754
  return new Promise((resolve) => {
5915
- d3ZoomInstance == null ? void 0 : d3ZoomInstance.interpolate((options == null ? void 0 : options.interpolate) === "linear" ? interpolate$1 : interpolateZoom).scaleTo(getD3Transition(d3Selection, options == null ? void 0 : options.duration, options == null ? void 0 : options.ease, () => resolve(true)), zoom2);
5755
+ d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? interpolate$1 : interpolateZoom).scaleTo(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(true)), zoom2);
5916
5756
  });
5917
5757
  }
5918
5758
  return Promise.resolve(false);
@@ -5920,20 +5760,20 @@ function XYPanZoom({ domNode, minZoom, maxZoom, translateExtent, viewport, onPan
5920
5760
  function scaleBy(factor, options) {
5921
5761
  if (d3Selection) {
5922
5762
  return new Promise((resolve) => {
5923
- d3ZoomInstance == null ? void 0 : d3ZoomInstance.interpolate((options == null ? void 0 : options.interpolate) === "linear" ? interpolate$1 : interpolateZoom).scaleBy(getD3Transition(d3Selection, options == null ? void 0 : options.duration, options == null ? void 0 : options.ease, () => resolve(true)), factor);
5763
+ d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? interpolate$1 : interpolateZoom).scaleBy(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(true)), factor);
5924
5764
  });
5925
5765
  }
5926
5766
  return Promise.resolve(false);
5927
5767
  }
5928
5768
  function setScaleExtent(scaleExtent) {
5929
- d3ZoomInstance == null ? void 0 : d3ZoomInstance.scaleExtent(scaleExtent);
5769
+ d3ZoomInstance?.scaleExtent(scaleExtent);
5930
5770
  }
5931
5771
  function setTranslateExtent(translateExtent2) {
5932
- d3ZoomInstance == null ? void 0 : d3ZoomInstance.translateExtent(translateExtent2);
5772
+ d3ZoomInstance?.translateExtent(translateExtent2);
5933
5773
  }
5934
5774
  function setClickDistance(distance2) {
5935
5775
  const validDistance = !isNumeric(distance2) || distance2 < 0 ? 0 : distance2;
5936
- d3ZoomInstance == null ? void 0 : d3ZoomInstance.clickDistance(validDistance);
5776
+ d3ZoomInstance?.clickDistance(validDistance);
5937
5777
  }
5938
5778
  return {
5939
5779
  update,
@@ -6171,7 +6011,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
6171
6011
  if (!node) {
6172
6012
  return;
6173
6013
  }
6174
- containerBounds = (paneDomNode == null ? void 0 : paneDomNode.getBoundingClientRect()) ?? null;
6014
+ containerBounds = paneDomNode?.getBoundingClientRect() ?? null;
6175
6015
  const { xSnapped, ySnapped } = getPointerPosition(event.sourceEvent, {
6176
6016
  transform: transform2,
6177
6017
  snapGrid,
@@ -6217,7 +6057,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
6217
6057
  }
6218
6058
  }
6219
6059
  }
6220
- onResizeStart == null ? void 0 : onResizeStart(event, { ...prevValues });
6060
+ onResizeStart?.(event, { ...prevValues });
6221
6061
  }).on("drag", (event) => {
6222
6062
  const { transform: transform2, snapGrid, snapToGrid, nodeOrigin: storeNodeOrigin } = getStoreItems();
6223
6063
  const pointerPosition = getPointerPosition(event.sourceEvent, {
@@ -6285,19 +6125,19 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
6285
6125
  affectsY: params.controlDirection.affectsY
6286
6126
  });
6287
6127
  const nextValues = { ...prevValues, direction };
6288
- const callResize = shouldResize == null ? void 0 : shouldResize(event, nextValues);
6128
+ const callResize = shouldResize?.(event, nextValues);
6289
6129
  if (callResize === false) {
6290
6130
  return;
6291
6131
  }
6292
6132
  resizeDetected = true;
6293
- onResize == null ? void 0 : onResize(event, nextValues);
6133
+ onResize?.(event, nextValues);
6294
6134
  onChange(change, childChanges);
6295
6135
  }).on("end", (event) => {
6296
6136
  if (!resizeDetected) {
6297
6137
  return;
6298
6138
  }
6299
- onResizeEnd == null ? void 0 : onResizeEnd(event, { ...prevValues });
6300
- onEnd == null ? void 0 : onEnd({ ...prevValues });
6139
+ onResizeEnd?.(event, { ...prevValues });
6140
+ onEnd?.({ ...prevValues });
6301
6141
  resizeDetected = false;
6302
6142
  });
6303
6143
  selection2.call(dragHandler);
@@ -6317,15 +6157,6 @@ var withSelector = { exports: {} };
6317
6157
  var withSelector_production = {};
6318
6158
  var shim = { exports: {} };
6319
6159
  var useSyncExternalStoreShim_production = {};
6320
- /**
6321
- * @license React
6322
- * use-sync-external-store-shim.production.js
6323
- *
6324
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6325
- *
6326
- * This source code is licensed under the MIT license found in the
6327
- * LICENSE file in the root directory of this source tree.
6328
- */
6329
6160
  var hasRequiredUseSyncExternalStoreShim_production;
6330
6161
  function requireUseSyncExternalStoreShim_production() {
6331
6162
  if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
@@ -6375,15 +6206,6 @@ function requireUseSyncExternalStoreShim_production() {
6375
6206
  return useSyncExternalStoreShim_production;
6376
6207
  }
6377
6208
  var useSyncExternalStoreShim_development = {};
6378
- /**
6379
- * @license React
6380
- * use-sync-external-store-shim.development.js
6381
- *
6382
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6383
- *
6384
- * This source code is licensed under the MIT license found in the
6385
- * LICENSE file in the root directory of this source tree.
6386
- */
6387
6209
  var hasRequiredUseSyncExternalStoreShim_development;
6388
6210
  function requireUseSyncExternalStoreShim_development() {
6389
6211
  if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
@@ -6458,15 +6280,6 @@ function requireShim() {
6458
6280
  }
6459
6281
  return shim.exports;
6460
6282
  }
6461
- /**
6462
- * @license React
6463
- * use-sync-external-store-shim/with-selector.production.js
6464
- *
6465
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6466
- *
6467
- * This source code is licensed under the MIT license found in the
6468
- * LICENSE file in the root directory of this source tree.
6469
- */
6470
6283
  var hasRequiredWithSelector_production;
6471
6284
  function requireWithSelector_production() {
6472
6285
  if (hasRequiredWithSelector_production) return withSelector_production;
@@ -6530,15 +6343,6 @@ function requireWithSelector_production() {
6530
6343
  return withSelector_production;
6531
6344
  }
6532
6345
  var withSelector_development = {};
6533
- /**
6534
- * @license React
6535
- * use-sync-external-store-shim/with-selector.development.js
6536
- *
6537
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6538
- *
6539
- * This source code is licensed under the MIT license found in the
6540
- * LICENSE file in the root directory of this source tree.
6541
- */
6542
6346
  var hasRequiredWithSelector_development;
6543
6347
  function requireWithSelector_development() {
6544
6348
  if (hasRequiredWithSelector_development) return withSelector_development;
@@ -6758,7 +6562,7 @@ const Panel = forwardRef(({ position = "top-left", children: children2, classNam
6758
6562
  });
6759
6563
  Panel.displayName = "Panel";
6760
6564
  function Attribution({ proOptions, position = "bottom-right" }) {
6761
- if (proOptions == null ? void 0 : proOptions.hideAttribution) {
6565
+ if (proOptions?.hideAttribution) {
6762
6566
  return null;
6763
6567
  }
6764
6568
  return jsx(Panel, { position, className: "react-flow__attribution", "data-message": "Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev", children: jsx("a", { href: "https://reactflow.dev", target: "_blank", rel: "noopener noreferrer", "aria-label": "React Flow attribution", children: "React Flow" }) });
@@ -6787,7 +6591,7 @@ function SelectionListenerInner({ onSelectionChange }) {
6787
6591
  const { selectedNodes, selectedEdges } = useStore(selector$m, areEqual);
6788
6592
  useEffect(() => {
6789
6593
  const params = { nodes: selectedNodes, edges: selectedEdges };
6790
- onSelectionChange == null ? void 0 : onSelectionChange(params);
6594
+ onSelectionChange?.(params);
6791
6595
  store.getState().onSelectionChangeHandlers.forEach((fn) => fn(params));
6792
6596
  }, [selectedNodes, selectedEdges, onSelectionChange]);
6793
6597
  return null;
@@ -6942,7 +6746,6 @@ function getMediaQuery() {
6942
6746
  return window.matchMedia("(prefers-color-scheme: dark)");
6943
6747
  }
6944
6748
  function useColorModeClass(colorMode) {
6945
- var _a;
6946
6749
  const [colorModeClass, setColorModeClass] = useState(colorMode === "system" ? null : colorMode);
6947
6750
  useEffect(() => {
6948
6751
  if (colorMode !== "system") {
@@ -6950,14 +6753,14 @@ function useColorModeClass(colorMode) {
6950
6753
  return;
6951
6754
  }
6952
6755
  const mediaQuery = getMediaQuery();
6953
- const updateColorModeClass = () => setColorModeClass((mediaQuery == null ? void 0 : mediaQuery.matches) ? "dark" : "light");
6756
+ const updateColorModeClass = () => setColorModeClass(mediaQuery?.matches ? "dark" : "light");
6954
6757
  updateColorModeClass();
6955
- mediaQuery == null ? void 0 : mediaQuery.addEventListener("change", updateColorModeClass);
6758
+ mediaQuery?.addEventListener("change", updateColorModeClass);
6956
6759
  return () => {
6957
- mediaQuery == null ? void 0 : mediaQuery.removeEventListener("change", updateColorModeClass);
6760
+ mediaQuery?.removeEventListener("change", updateColorModeClass);
6958
6761
  };
6959
6762
  }, [colorMode]);
6960
- return colorModeClass !== null ? colorModeClass : ((_a = getMediaQuery()) == null ? void 0 : _a.matches) ? "dark" : "light";
6763
+ return colorModeClass !== null ? colorModeClass : getMediaQuery()?.matches ? "dark" : "light";
6961
6764
  }
6962
6765
  const defaultDoc = typeof document !== "undefined" ? document : null;
6963
6766
  function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideInputWithModifier: true }) {
@@ -6974,11 +6777,10 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
6974
6777
  return [[], []];
6975
6778
  }, [keyCode]);
6976
6779
  useEffect(() => {
6977
- const target = (options == null ? void 0 : options.target) ?? defaultDoc;
6978
- const actInsideInputWithModifier = (options == null ? void 0 : options.actInsideInputWithModifier) ?? true;
6780
+ const target = options?.target ?? defaultDoc;
6781
+ const actInsideInputWithModifier = options?.actInsideInputWithModifier ?? true;
6979
6782
  if (keyCode !== null) {
6980
6783
  const downHandler = (event) => {
6981
- var _a, _b;
6982
6784
  modifierPressed.current = event.ctrlKey || event.metaKey || event.shiftKey || event.altKey;
6983
6785
  const preventAction = (!modifierPressed.current || modifierPressed.current && !actInsideInputWithModifier) && isInputDOMNode(event);
6984
6786
  if (preventAction) {
@@ -6987,8 +6789,8 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
6987
6789
  const keyOrCode = useKeyOrCode(event.code, keysToWatch);
6988
6790
  pressedKeys.current.add(event[keyOrCode]);
6989
6791
  if (isMatchingKey(keyCodes, pressedKeys.current, false)) {
6990
- const target2 = ((_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)) == null ? void 0 : _b[0]) || event.target;
6991
- const isInteractiveElement = (target2 == null ? void 0 : target2.nodeName) === "BUTTON" || (target2 == null ? void 0 : target2.nodeName) === "A";
6792
+ const target2 = event.composedPath?.()?.[0] || event.target;
6793
+ const isInteractiveElement = target2?.nodeName === "BUTTON" || target2?.nodeName === "A";
6992
6794
  if (options.preventDefault !== false && (modifierPressed.current || !isInteractiveElement)) {
6993
6795
  event.preventDefault();
6994
6796
  }
@@ -7012,13 +6814,13 @@ function useKeyPress(keyCode = null, options = { target: defaultDoc, actInsideIn
7012
6814
  pressedKeys.current.clear();
7013
6815
  setKeyPressed(false);
7014
6816
  };
7015
- target == null ? void 0 : target.addEventListener("keydown", downHandler);
7016
- target == null ? void 0 : target.addEventListener("keyup", upHandler);
6817
+ target?.addEventListener("keydown", downHandler);
6818
+ target?.addEventListener("keyup", upHandler);
7017
6819
  window.addEventListener("blur", resetHandler);
7018
6820
  window.addEventListener("contextmenu", resetHandler);
7019
6821
  return () => {
7020
- target == null ? void 0 : target.removeEventListener("keydown", downHandler);
7021
- target == null ? void 0 : target.removeEventListener("keyup", upHandler);
6822
+ target?.removeEventListener("keydown", downHandler);
6823
+ target?.removeEventListener("keyup", upHandler);
7022
6824
  window.removeEventListener("blur", resetHandler);
7023
6825
  window.removeEventListener("contextmenu", resetHandler);
7024
6826
  };
@@ -7038,15 +6840,15 @@ const useViewportHelper = () => {
7038
6840
  return {
7039
6841
  zoomIn: (options) => {
7040
6842
  const { panZoom } = store.getState();
7041
- return panZoom ? panZoom.scaleBy(1.2, { duration: options == null ? void 0 : options.duration }) : Promise.resolve(false);
6843
+ return panZoom ? panZoom.scaleBy(1.2, { duration: options?.duration }) : Promise.resolve(false);
7042
6844
  },
7043
6845
  zoomOut: (options) => {
7044
6846
  const { panZoom } = store.getState();
7045
- return panZoom ? panZoom.scaleBy(1 / 1.2, { duration: options == null ? void 0 : options.duration }) : Promise.resolve(false);
6847
+ return panZoom ? panZoom.scaleBy(1 / 1.2, { duration: options?.duration }) : Promise.resolve(false);
7046
6848
  },
7047
6849
  zoomTo: (zoomLevel, options) => {
7048
6850
  const { panZoom } = store.getState();
7049
- return panZoom ? panZoom.scaleTo(zoomLevel, { duration: options == null ? void 0 : options.duration }) : Promise.resolve(false);
6851
+ return panZoom ? panZoom.scaleTo(zoomLevel, { duration: options?.duration }) : Promise.resolve(false);
7050
6852
  },
7051
6853
  getZoom: () => store.getState().transform[2],
7052
6854
  setViewport: async (viewport, options) => {
@@ -7070,14 +6872,14 @@ const useViewportHelper = () => {
7070
6872
  },
7071
6873
  fitBounds: async (bounds, options) => {
7072
6874
  const { width, height, minZoom, maxZoom, panZoom } = store.getState();
7073
- const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, (options == null ? void 0 : options.padding) ?? 0.1);
6875
+ const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
7074
6876
  if (!panZoom) {
7075
6877
  return Promise.resolve(false);
7076
6878
  }
7077
6879
  await panZoom.setViewport(viewport, {
7078
- duration: options == null ? void 0 : options.duration,
7079
- ease: options == null ? void 0 : options.ease,
7080
- interpolate: options == null ? void 0 : options.interpolate
6880
+ duration: options?.duration,
6881
+ ease: options?.ease,
6882
+ interpolate: options?.interpolate
7081
6883
  });
7082
6884
  return Promise.resolve(true);
7083
6885
  },
@@ -7222,12 +7024,11 @@ function getSelectionChanges(items, selectedIds = /* @__PURE__ */ new Set(), mut
7222
7024
  return changes;
7223
7025
  }
7224
7026
  function getElementsDiffChanges({ items = [], lookup }) {
7225
- var _a;
7226
7027
  const changes = [];
7227
7028
  const itemsLookup = new Map(items.map((item) => [item.id, item]));
7228
7029
  for (const [index2, item] of items.entries()) {
7229
7030
  const lookupItem = lookup.get(item.id);
7230
- const storeItem = ((_a = lookupItem == null ? void 0 : lookupItem.internals) == null ? void 0 : _a.userNode) ?? lookupItem;
7031
+ const storeItem = lookupItem?.internals?.userNode ?? lookupItem;
7231
7032
  if (storeItem !== void 0 && storeItem !== item) {
7232
7033
  changes.push({ id: item.id, item, type: "replace" });
7233
7034
  }
@@ -7300,7 +7101,7 @@ function BatchProvider({ children: children2 }) {
7300
7101
  setNodes(next);
7301
7102
  }
7302
7103
  if (changes.length > 0) {
7303
- onNodesChange == null ? void 0 : onNodesChange(changes);
7104
+ onNodesChange?.(changes);
7304
7105
  } else if (fitViewQueued) {
7305
7106
  window.requestAnimationFrame(() => {
7306
7107
  const { fitViewQueued: fitViewQueued2, nodes: nodes2, setNodes: setNodes2 } = store.getState();
@@ -7352,15 +7153,14 @@ function useReactFlow() {
7352
7153
  batchContext.edgeQueue.push(payload);
7353
7154
  };
7354
7155
  const getNodeRect = (node) => {
7355
- var _a, _b;
7356
7156
  const { nodeLookup, nodeOrigin } = store.getState();
7357
7157
  const nodeToUse = isNode(node) ? node : nodeLookup.get(node.id);
7358
7158
  const position = nodeToUse.parentId ? evaluateAbsolutePosition(nodeToUse.position, nodeToUse.measured, nodeToUse.parentId, nodeLookup, nodeOrigin) : nodeToUse.position;
7359
7159
  const nodeWithPosition = {
7360
7160
  ...nodeToUse,
7361
7161
  position,
7362
- width: ((_a = nodeToUse.measured) == null ? void 0 : _a.width) ?? nodeToUse.width,
7363
- height: ((_b = nodeToUse.measured) == null ? void 0 : _b.height) ?? nodeToUse.height
7162
+ width: nodeToUse.measured?.width ?? nodeToUse.width,
7163
+ height: nodeToUse.measured?.height ?? nodeToUse.height
7364
7164
  };
7365
7165
  return nodeToRect(nodeWithPosition);
7366
7166
  };
@@ -7384,10 +7184,7 @@ function useReactFlow() {
7384
7184
  };
7385
7185
  return {
7386
7186
  getNodes: () => store.getState().nodes.map((n) => ({ ...n })),
7387
- getNode: (id2) => {
7388
- var _a;
7389
- return (_a = getInternalNode(id2)) == null ? void 0 : _a.internals.userNode;
7390
- },
7187
+ getNode: (id2) => getInternalNode(id2)?.internals.userNode,
7391
7188
  getInternalNode,
7392
7189
  getEdges: () => {
7393
7190
  const { edges = [] } = store.getState();
@@ -7430,16 +7227,16 @@ function useReactFlow() {
7430
7227
  const hasMatchingNodes = matchingNodes.length > 0;
7431
7228
  if (hasMatchingEdges) {
7432
7229
  const edgeChanges = matchingEdges.map(elementToRemoveChange);
7433
- onEdgesDelete == null ? void 0 : onEdgesDelete(matchingEdges);
7230
+ onEdgesDelete?.(matchingEdges);
7434
7231
  triggerEdgeChanges(edgeChanges);
7435
7232
  }
7436
7233
  if (hasMatchingNodes) {
7437
7234
  const nodeChanges = matchingNodes.map(elementToRemoveChange);
7438
- onNodesDelete == null ? void 0 : onNodesDelete(matchingNodes);
7235
+ onNodesDelete?.(matchingNodes);
7439
7236
  triggerNodeChanges(nodeChanges);
7440
7237
  }
7441
7238
  if (hasMatchingNodes || hasMatchingEdges) {
7442
- onDelete == null ? void 0 : onDelete({ nodes: matchingNodes, edges: matchingEdges });
7239
+ onDelete?.({ nodes: matchingNodes, edges: matchingEdges });
7443
7240
  }
7444
7241
  return { deletedNodes: matchingNodes, deletedEdges: matchingEdges };
7445
7242
  },
@@ -7494,14 +7291,8 @@ function useReactFlow() {
7494
7291
  const { nodeLookup, nodeOrigin } = store.getState();
7495
7292
  return getNodesBounds(nodes, { nodeLookup, nodeOrigin });
7496
7293
  },
7497
- getHandleConnections: ({ type, id: id2, nodeId }) => {
7498
- var _a;
7499
- return Array.from(((_a = store.getState().connectionLookup.get(`${nodeId}-${type}${id2 ? `-${id2}` : ""}`)) == null ? void 0 : _a.values()) ?? []);
7500
- },
7501
- getNodeConnections: ({ type, handleId, nodeId }) => {
7502
- var _a;
7503
- return Array.from(((_a = store.getState().connectionLookup.get(`${nodeId}${type ? handleId ? `-${type}-${handleId}` : `-${type}` : ""}`)) == null ? void 0 : _a.values()) ?? []);
7504
- },
7294
+ getHandleConnections: ({ type, id: id2, nodeId }) => Array.from(store.getState().connectionLookup.get(`${nodeId}-${type}${id2 ? `-${id2}` : ""}`)?.values() ?? []),
7295
+ getNodeConnections: ({ type, handleId, nodeId }) => Array.from(store.getState().connectionLookup.get(`${nodeId}${type ? handleId ? `-${type}-${handleId}` : `-${type}` : ""}`)?.values() ?? []),
7505
7296
  fitView: async (options) => {
7506
7297
  const fitViewResolver = store.getState().fitViewResolver ?? withResolvers();
7507
7298
  store.setState({ fitViewQueued: true, fitViewOptions: options, fitViewResolver });
@@ -7540,13 +7331,12 @@ function useResizeHandler(domNode) {
7540
7331
  const store = useStoreApi();
7541
7332
  useEffect(() => {
7542
7333
  const updateDimensions = () => {
7543
- var _a, _b, _c, _d;
7544
- if (!domNode.current || !(((_b = (_a = domNode.current).checkVisibility) == null ? void 0 : _b.call(_a)) ?? true)) {
7334
+ if (!domNode.current || !(domNode.current.checkVisibility?.() ?? true)) {
7545
7335
  return false;
7546
7336
  }
7547
7337
  const size = getDimensions(domNode.current);
7548
7338
  if (size.height === 0 || size.width === 0) {
7549
- (_d = (_c = store.getState()).onError) == null ? void 0 : _d.call(_c, "004", errorMessages$2["error004"]());
7339
+ store.getState().onError?.("004", errorMessages$2["error004"]());
7550
7340
  }
7551
7341
  store.setState({ width: size.width || 500, height: size.height || 500 });
7552
7342
  };
@@ -7584,7 +7374,7 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
7584
7374
  const panZoom = useRef();
7585
7375
  useResizeHandler(zoomPane);
7586
7376
  const onTransformChange = useCallback((transform2) => {
7587
- onViewportChange == null ? void 0 : onViewportChange({ x: transform2[0], y: transform2[1], zoom: transform2[2] });
7377
+ onViewportChange?.({ x: transform2[0], y: transform2[1], zoom: transform2[2] });
7588
7378
  if (!isControlledViewport) {
7589
7379
  store.setState({ transform: transform2 });
7590
7380
  }
@@ -7597,21 +7387,21 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
7597
7387
  maxZoom,
7598
7388
  translateExtent,
7599
7389
  viewport: defaultViewport2,
7600
- onDraggingChange: (paneDragging) => store.setState({ paneDragging }),
7390
+ onDraggingChange: (paneDragging) => store.setState((prevState) => prevState.paneDragging === paneDragging ? prevState : { paneDragging }),
7601
7391
  onPanZoomStart: (event, vp) => {
7602
7392
  const { onViewportChangeStart, onMoveStart } = store.getState();
7603
- onMoveStart == null ? void 0 : onMoveStart(event, vp);
7604
- onViewportChangeStart == null ? void 0 : onViewportChangeStart(vp);
7393
+ onMoveStart?.(event, vp);
7394
+ onViewportChangeStart?.(vp);
7605
7395
  },
7606
7396
  onPanZoom: (event, vp) => {
7607
7397
  const { onViewportChange: onViewportChange2, onMove } = store.getState();
7608
- onMove == null ? void 0 : onMove(event, vp);
7609
- onViewportChange2 == null ? void 0 : onViewportChange2(vp);
7398
+ onMove?.(event, vp);
7399
+ onViewportChange2?.(vp);
7610
7400
  },
7611
7401
  onPanZoomEnd: (event, vp) => {
7612
7402
  const { onViewportChangeEnd, onMoveEnd } = store.getState();
7613
- onMoveEnd == null ? void 0 : onMoveEnd(event, vp);
7614
- onViewportChangeEnd == null ? void 0 : onViewportChangeEnd(vp);
7403
+ onMoveEnd?.(event, vp);
7404
+ onViewportChangeEnd?.(vp);
7615
7405
  }
7616
7406
  });
7617
7407
  const { x, y, zoom: zoom2 } = panZoom.current.getViewport();
@@ -7621,14 +7411,12 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
7621
7411
  domNode: zoomPane.current.closest(".react-flow")
7622
7412
  });
7623
7413
  return () => {
7624
- var _a;
7625
- (_a = panZoom.current) == null ? void 0 : _a.destroy();
7414
+ panZoom.current?.destroy();
7626
7415
  };
7627
7416
  }
7628
7417
  }, []);
7629
7418
  useEffect(() => {
7630
- var _a;
7631
- (_a = panZoom.current) == null ? void 0 : _a.update({
7419
+ panZoom.current?.update({
7632
7420
  onPaneContextMenu,
7633
7421
  zoomOnScroll,
7634
7422
  zoomOnPinch,
@@ -7691,7 +7479,7 @@ const wrapHandler = (handler, containerRef) => {
7691
7479
  if (event.target !== containerRef.current) {
7692
7480
  return;
7693
7481
  }
7694
- handler == null ? void 0 : handler(event);
7482
+ handler?.(event);
7695
7483
  };
7696
7484
  };
7697
7485
  const selector$h = (s) => ({
@@ -7714,16 +7502,16 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
7714
7502
  selectionInProgress.current = false;
7715
7503
  return;
7716
7504
  }
7717
- onPaneClick == null ? void 0 : onPaneClick(event);
7505
+ onPaneClick?.(event);
7718
7506
  store.getState().resetSelectedElements();
7719
7507
  store.setState({ nodesSelectionActive: false });
7720
7508
  };
7721
7509
  const onContextMenu = (event) => {
7722
- if (Array.isArray(panOnDrag) && (panOnDrag == null ? void 0 : panOnDrag.includes(2))) {
7510
+ if (Array.isArray(panOnDrag) && panOnDrag?.includes(2)) {
7723
7511
  event.preventDefault();
7724
7512
  return;
7725
7513
  }
7726
- onPaneContextMenu == null ? void 0 : onPaneContextMenu(event);
7514
+ onPaneContextMenu?.(event);
7727
7515
  };
7728
7516
  const onWheel = onPaneScroll ? (event) => onPaneScroll(event) : void 0;
7729
7517
  const onClickCapture = (event) => {
@@ -7733,9 +7521,8 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
7733
7521
  }
7734
7522
  };
7735
7523
  const onPointerDownCapture = (event) => {
7736
- var _a, _b;
7737
7524
  const { domNode } = store.getState();
7738
- containerBounds.current = domNode == null ? void 0 : domNode.getBoundingClientRect();
7525
+ containerBounds.current = domNode?.getBoundingClientRect();
7739
7526
  if (!containerBounds.current)
7740
7527
  return;
7741
7528
  const eventTargetIsContainer = event.target === container.current;
@@ -7744,7 +7531,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
7744
7531
  if (isNoKeyEvent || !isSelecting || !isSelectionActive || event.button !== 0 || !event.isPrimary) {
7745
7532
  return;
7746
7533
  }
7747
- (_b = (_a = event.target) == null ? void 0 : _a.setPointerCapture) == null ? void 0 : _b.call(_a, event.pointerId);
7534
+ event.target?.setPointerCapture?.(event.pointerId);
7748
7535
  selectionInProgress.current = false;
7749
7536
  const { x, y } = getEventPosition(event.nativeEvent, containerBounds.current);
7750
7537
  store.setState({
@@ -7776,7 +7563,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
7776
7563
  return;
7777
7564
  }
7778
7565
  resetSelectedElements();
7779
- onSelectionStart == null ? void 0 : onSelectionStart(event);
7566
+ onSelectionStart?.(event);
7780
7567
  }
7781
7568
  selectionInProgress.current = true;
7782
7569
  const nextUserSelectRect = {
@@ -7791,7 +7578,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
7791
7578
  const prevSelectedEdgeIds = selectedEdgeIds.current;
7792
7579
  selectedNodeIds.current = new Set(getNodesInside(nodeLookup, nextUserSelectRect, transform2, selectionMode === SelectionMode.Partial, true).map((node) => node.id));
7793
7580
  selectedEdgeIds.current = /* @__PURE__ */ new Set();
7794
- const edgesSelectable = (defaultEdgeOptions == null ? void 0 : defaultEdgeOptions.selectable) ?? true;
7581
+ const edgesSelectable = defaultEdgeOptions?.selectable ?? true;
7795
7582
  for (const nodeId of selectedNodeIds.current) {
7796
7583
  const connections = connectionLookup.get(nodeId);
7797
7584
  if (!connections)
@@ -7818,20 +7605,19 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
7818
7605
  });
7819
7606
  };
7820
7607
  const onPointerUp = (event) => {
7821
- var _a, _b;
7822
7608
  if (event.button !== 0) {
7823
7609
  return;
7824
7610
  }
7825
- (_b = (_a = event.target) == null ? void 0 : _a.releasePointerCapture) == null ? void 0 : _b.call(_a, event.pointerId);
7611
+ event.target?.releasePointerCapture?.(event.pointerId);
7826
7612
  if (!userSelectionActive && event.target === container.current && store.getState().userSelectionRect) {
7827
- onClick == null ? void 0 : onClick(event);
7613
+ onClick?.(event);
7828
7614
  }
7829
7615
  store.setState({
7830
7616
  userSelectionActive: false,
7831
7617
  userSelectionRect: null
7832
7618
  });
7833
7619
  if (selectionInProgress.current) {
7834
- onSelectionEnd == null ? void 0 : onSelectionEnd(event);
7620
+ onSelectionEnd?.(event);
7835
7621
  store.setState({
7836
7622
  nodesSelectionActive: selectedNodeIds.current.size > 0
7837
7623
  });
@@ -7844,7 +7630,7 @@ function handleNodeClick({ id: id2, store, unselect = false, nodeRef }) {
7844
7630
  const { addSelectedNodes, unselectNodesAndEdges, multiSelectionActive, nodeLookup, onError } = store.getState();
7845
7631
  const node = nodeLookup.get(id2);
7846
7632
  if (!node) {
7847
- onError == null ? void 0 : onError("012", errorMessages$2["error012"](id2));
7633
+ onError?.("012", errorMessages$2["error012"](id2));
7848
7634
  return;
7849
7635
  }
7850
7636
  store.setState({ nodesSelectionActive: false });
@@ -7852,10 +7638,7 @@ function handleNodeClick({ id: id2, store, unselect = false, nodeRef }) {
7852
7638
  addSelectedNodes([id2]);
7853
7639
  } else if (unselect || node.selected && multiSelectionActive) {
7854
7640
  unselectNodesAndEdges({ nodes: [node], edges: [] });
7855
- requestAnimationFrame(() => {
7856
- var _a;
7857
- return (_a = nodeRef == null ? void 0 : nodeRef.current) == null ? void 0 : _a.blur();
7858
- });
7641
+ requestAnimationFrame(() => nodeRef?.current?.blur());
7859
7642
  }
7860
7643
  }
7861
7644
  function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, nodeId, isSelectable, nodeClickDistance }) {
@@ -7881,24 +7664,21 @@ function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, n
7881
7664
  });
7882
7665
  }, []);
7883
7666
  useEffect(() => {
7884
- var _a, _b;
7885
- if (disabled) {
7886
- (_a = xyDrag.current) == null ? void 0 : _a.destroy();
7887
- } else if (nodeRef.current) {
7888
- (_b = xyDrag.current) == null ? void 0 : _b.update({
7889
- noDragClassName,
7890
- handleSelector,
7891
- domNode: nodeRef.current,
7892
- isSelectable,
7893
- nodeId,
7894
- nodeClickDistance
7895
- });
7896
- return () => {
7897
- var _a2;
7898
- (_a2 = xyDrag.current) == null ? void 0 : _a2.destroy();
7899
- };
7667
+ if (disabled || !nodeRef.current || !xyDrag.current) {
7668
+ return;
7900
7669
  }
7901
- }, [noDragClassName, handleSelector, disabled, isSelectable, nodeRef, nodeId]);
7670
+ xyDrag.current.update({
7671
+ noDragClassName,
7672
+ handleSelector,
7673
+ domNode: nodeRef.current,
7674
+ isSelectable,
7675
+ nodeId,
7676
+ nodeClickDistance
7677
+ });
7678
+ return () => {
7679
+ xyDrag.current?.destroy();
7680
+ };
7681
+ }, [noDragClassName, handleSelector, disabled, isSelectable, nodeRef, nodeId, nodeClickDistance]);
7902
7682
  return dragging;
7903
7683
  }
7904
7684
  const selectedAndDraggable = (nodesDraggable) => (n) => n.selected && (n.draggable || nodesDraggable && typeof n.draggable === "undefined");
@@ -7954,19 +7734,18 @@ const selector$g = (s) => ({
7954
7734
  const connectingSelector = (nodeId, handleId, type) => (state) => {
7955
7735
  const { connectionClickStartHandle: clickHandle, connectionMode, connection } = state;
7956
7736
  const { fromHandle, toHandle, isValid } = connection;
7957
- const connectingTo = (toHandle == null ? void 0 : toHandle.nodeId) === nodeId && (toHandle == null ? void 0 : toHandle.id) === handleId && (toHandle == null ? void 0 : toHandle.type) === type;
7737
+ const connectingTo = toHandle?.nodeId === nodeId && toHandle?.id === handleId && toHandle?.type === type;
7958
7738
  return {
7959
- connectingFrom: (fromHandle == null ? void 0 : fromHandle.nodeId) === nodeId && (fromHandle == null ? void 0 : fromHandle.id) === handleId && (fromHandle == null ? void 0 : fromHandle.type) === type,
7739
+ connectingFrom: fromHandle?.nodeId === nodeId && fromHandle?.id === handleId && fromHandle?.type === type,
7960
7740
  connectingTo,
7961
- clickConnecting: (clickHandle == null ? void 0 : clickHandle.nodeId) === nodeId && (clickHandle == null ? void 0 : clickHandle.id) === handleId && (clickHandle == null ? void 0 : clickHandle.type) === type,
7962
- isPossibleEndHandle: connectionMode === ConnectionMode.Strict ? (fromHandle == null ? void 0 : fromHandle.type) !== type : nodeId !== (fromHandle == null ? void 0 : fromHandle.nodeId) || handleId !== (fromHandle == null ? void 0 : fromHandle.id),
7741
+ clickConnecting: clickHandle?.nodeId === nodeId && clickHandle?.id === handleId && clickHandle?.type === type,
7742
+ isPossibleEndHandle: connectionMode === ConnectionMode.Strict ? fromHandle?.type !== type : nodeId !== fromHandle?.nodeId || handleId !== fromHandle?.id,
7963
7743
  connectionInProcess: !!fromHandle,
7964
7744
  clickConnectionInProcess: !!clickHandle,
7965
7745
  valid: connectingTo && isValid
7966
7746
  };
7967
7747
  };
7968
7748
  function HandleComponent({ type = "source", position = Position.Top, isValidConnection, isConnectable = true, isConnectableStart = true, isConnectableEnd = true, id: id2, onConnect, children: children2, className, onMouseDown, onTouchStart, ...rest }, ref) {
7969
- var _a, _b;
7970
7749
  const handleId = id2 || null;
7971
7750
  const isTarget = type === "target";
7972
7751
  const store = useStoreApi();
@@ -7974,7 +7753,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
7974
7753
  const { connectOnClick, noPanClassName, rfId } = useStore(selector$g, shallow$1);
7975
7754
  const { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, clickConnectionInProcess, valid } = useStore(connectingSelector(nodeId, handleId, type), shallow$1);
7976
7755
  if (!nodeId) {
7977
- (_b = (_a = store.getState()).onError) == null ? void 0 : _b.call(_a, "010", errorMessages$2["error010"]());
7756
+ store.getState().onError?.("010", errorMessages$2["error010"]());
7978
7757
  }
7979
7758
  const onConnectExtended = (params) => {
7980
7759
  const { defaultEdgeOptions, onConnect: onConnectAction, hasDefaultEdges } = store.getState();
@@ -7986,8 +7765,8 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
7986
7765
  const { edges, setEdges } = store.getState();
7987
7766
  setEdges(addEdge(edgeParams, edges));
7988
7767
  }
7989
- onConnectAction == null ? void 0 : onConnectAction(edgeParams);
7990
- onConnect == null ? void 0 : onConnect(edgeParams);
7768
+ onConnectAction?.(edgeParams);
7769
+ onConnect?.(edgeParams);
7991
7770
  };
7992
7771
  const onPointerDown2 = (event) => {
7993
7772
  if (!nodeId) {
@@ -8011,10 +7790,10 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
8011
7790
  panBy: currentStore.panBy,
8012
7791
  cancelConnection: currentStore.cancelConnection,
8013
7792
  onConnectStart: currentStore.onConnectStart,
8014
- onConnectEnd: currentStore.onConnectEnd,
7793
+ onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
8015
7794
  updateConnection: currentStore.updateConnection,
8016
7795
  onConnect: onConnectExtended,
8017
- isValidConnection: isValidConnection || currentStore.isValidConnection,
7796
+ isValidConnection: isValidConnection || ((...args) => store.getState().isValidConnection?.(...args) ?? true),
8018
7797
  getTransform: () => store.getState().transform,
8019
7798
  getFromHandle: () => store.getState().connection.fromHandle,
8020
7799
  autoPanSpeed: currentStore.autoPanSpeed,
@@ -8022,9 +7801,9 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
8022
7801
  });
8023
7802
  }
8024
7803
  if (isMouseTriggered) {
8025
- onMouseDown == null ? void 0 : onMouseDown(event);
7804
+ onMouseDown?.(event);
8026
7805
  } else {
8027
- onTouchStart == null ? void 0 : onTouchStart(event);
7806
+ onTouchStart?.(event);
8028
7807
  }
8029
7808
  };
8030
7809
  const onClick = (event) => {
@@ -8033,7 +7812,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
8033
7812
  return;
8034
7813
  }
8035
7814
  if (!connectionClickStartHandle) {
8036
- onClickConnectStart == null ? void 0 : onClickConnectStart(event.nativeEvent, { nodeId, handleId, handleType: type });
7815
+ onClickConnectStart?.(event.nativeEvent, { nodeId, handleId, handleType: type });
8037
7816
  store.setState({ connectionClickStartHandle: { nodeId, type, id: handleId } });
8038
7817
  return;
8039
7818
  }
@@ -8061,7 +7840,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
8061
7840
  const connectionClone = structuredClone(connectionState);
8062
7841
  delete connectionClone.inProgress;
8063
7842
  connectionClone.toPosition = connectionClone.toHandle ? connectionClone.toHandle.position : null;
8064
- onClickConnectEnd == null ? void 0 : onClickConnectEnd(event, connectionClone);
7843
+ onClickConnectEnd?.(event, connectionClone);
8065
7844
  store.setState({ connectionClickStartHandle: null });
8066
7845
  };
8067
7846
  return jsx("div", { "data-handleid": handleId, "data-nodeid": nodeId, "data-handlepos": position, "data-id": `${rfId}-${nodeId}-${handleId}-${type}`, className: cc([
@@ -8090,16 +7869,16 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
8090
7869
  }
8091
7870
  const Handle = memo(fixedForwardRef(HandleComponent));
8092
7871
  function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }) {
8093
- return jsxs(Fragment, { children: [data == null ? void 0 : data.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
7872
+ return jsxs(Fragment, { children: [data?.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
8094
7873
  }
8095
7874
  function DefaultNode({ data, isConnectable, targetPosition = Position.Top, sourcePosition = Position.Bottom }) {
8096
- return jsxs(Fragment, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data == null ? void 0 : data.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
7875
+ return jsxs(Fragment, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable })] });
8097
7876
  }
8098
7877
  function GroupNode() {
8099
7878
  return null;
8100
7879
  }
8101
7880
  function OutputNode({ data, isConnectable, targetPosition = Position.Top }) {
8102
- return jsxs(Fragment, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data == null ? void 0 : data.label] });
7881
+ return jsxs(Fragment, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable }), data?.label] });
8103
7882
  }
8104
7883
  const arrowKeyDiffs = {
8105
7884
  ArrowUp: { x: 0, y: -1 },
@@ -8114,16 +7893,15 @@ const builtinNodeTypes = {
8114
7893
  group: GroupNode
8115
7894
  };
8116
7895
  function getNodeInlineStyleDimensions(node) {
8117
- var _a, _b, _c, _d;
8118
7896
  if (node.internals.handleBounds === void 0) {
8119
7897
  return {
8120
- width: node.width ?? node.initialWidth ?? ((_a = node.style) == null ? void 0 : _a.width),
8121
- height: node.height ?? node.initialHeight ?? ((_b = node.style) == null ? void 0 : _b.height)
7898
+ width: node.width ?? node.initialWidth ?? node.style?.width,
7899
+ height: node.height ?? node.initialHeight ?? node.style?.height
8122
7900
  };
8123
7901
  }
8124
7902
  return {
8125
- width: node.width ?? ((_c = node.style) == null ? void 0 : _c.width),
8126
- height: node.height ?? ((_d = node.style) == null ? void 0 : _d.height)
7903
+ width: node.width ?? node.style?.width,
7904
+ height: node.height ?? node.style?.height
8127
7905
  };
8128
7906
  }
8129
7907
  const selector$f = (s) => {
@@ -8143,17 +7921,18 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
8143
7921
  const moveSelectedNodes = useMoveSelectedNodes();
8144
7922
  const nodeRef = useRef(null);
8145
7923
  useEffect(() => {
8146
- var _a;
8147
7924
  if (!disableKeyboardA11y) {
8148
- (_a = nodeRef.current) == null ? void 0 : _a.focus({
7925
+ nodeRef.current?.focus({
8149
7926
  preventScroll: true
8150
7927
  });
8151
7928
  }
8152
7929
  }, [disableKeyboardA11y]);
7930
+ const shouldRender = !userSelectionActive && width !== null && height !== null;
8153
7931
  useDrag({
8154
- nodeRef
7932
+ nodeRef,
7933
+ disabled: !shouldRender
8155
7934
  });
8156
- if (userSelectionActive || !width || !height) {
7935
+ if (!shouldRender) {
8157
7936
  return null;
8158
7937
  }
8159
7938
  const onContextMenu = onSelectionContextMenu ? (event) => {
@@ -8222,7 +8001,7 @@ function useResizeObserver() {
8222
8001
  });
8223
8002
  useEffect(() => {
8224
8003
  return () => {
8225
- resizeObserver == null ? void 0 : resizeObserver.disconnect();
8004
+ resizeObserver?.disconnect();
8226
8005
  };
8227
8006
  }, [resizeObserver]);
8228
8007
  return resizeObserver;
@@ -8238,16 +8017,16 @@ function useNodeObserver({ node, nodeType, hasDimensions, resizeObserver }) {
8238
8017
  useEffect(() => {
8239
8018
  if (nodeRef.current && !node.hidden && (!isInitialized || observedNode.current !== nodeRef.current)) {
8240
8019
  if (observedNode.current) {
8241
- resizeObserver == null ? void 0 : resizeObserver.unobserve(observedNode.current);
8020
+ resizeObserver?.unobserve(observedNode.current);
8242
8021
  }
8243
- resizeObserver == null ? void 0 : resizeObserver.observe(nodeRef.current);
8022
+ resizeObserver?.observe(nodeRef.current);
8244
8023
  observedNode.current = nodeRef.current;
8245
8024
  }
8246
8025
  }, [isInitialized, node.hidden]);
8247
8026
  useEffect(() => {
8248
8027
  return () => {
8249
8028
  if (observedNode.current) {
8250
- resizeObserver == null ? void 0 : resizeObserver.unobserve(observedNode.current);
8029
+ resizeObserver?.unobserve(observedNode.current);
8251
8030
  observedNode.current = null;
8252
8031
  }
8253
8032
  };
@@ -8278,11 +8057,11 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
8278
8057
  };
8279
8058
  }, shallow$1);
8280
8059
  let nodeType = node.type || "default";
8281
- let NodeComponent = (nodeTypes2 == null ? void 0 : nodeTypes2[nodeType]) || builtinNodeTypes[nodeType];
8060
+ let NodeComponent = nodeTypes2?.[nodeType] || builtinNodeTypes[nodeType];
8282
8061
  if (NodeComponent === void 0) {
8283
- onError == null ? void 0 : onError("003", errorMessages$2["error003"](nodeType));
8062
+ onError?.("003", errorMessages$2["error003"](nodeType));
8284
8063
  nodeType = "default";
8285
- NodeComponent = (nodeTypes2 == null ? void 0 : nodeTypes2["default"]) || builtinNodeTypes.default;
8064
+ NodeComponent = nodeTypes2?.["default"] || builtinNodeTypes.default;
8286
8065
  }
8287
8066
  const isDraggable = !!(node.draggable || nodesDraggable && typeof node.draggable === "undefined");
8288
8067
  const isSelectable = !!(node.selectable || elementsSelectable && typeof node.selectable === "undefined");
@@ -8354,8 +8133,7 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
8354
8133
  }
8355
8134
  };
8356
8135
  const onFocus = () => {
8357
- var _a;
8358
- if (disableKeyboardA11y || !((_a = nodeRef.current) == null ? void 0 : _a.matches(":focus-visible"))) {
8136
+ if (disableKeyboardA11y || !nodeRef.current?.matches(":focus-visible")) {
8359
8137
  return;
8360
8138
  }
8361
8139
  const { transform: transform2, width, height, autoPanOnNodeFocus, setCenter } = store.getState();
@@ -8484,10 +8262,9 @@ const MarkerSymbols = {
8484
8262
  function useMarkerSymbol(type) {
8485
8263
  const store = useStoreApi();
8486
8264
  const symbol = useMemo(() => {
8487
- var _a, _b;
8488
8265
  const symbolExists = Object.prototype.hasOwnProperty.call(MarkerSymbols, type);
8489
8266
  if (!symbolExists) {
8490
- (_b = (_a = store.getState()).onError) == null ? void 0 : _b.call(_a, "009", errorMessages$2["error009"](type));
8267
+ store.getState().onError?.("009", errorMessages$2["error009"](type));
8491
8268
  return null;
8492
8269
  }
8493
8270
  return MarkerSymbols[type];
@@ -8508,8 +8285,8 @@ const MarkerDefinitions = ({ defaultColor, rfId }) => {
8508
8285
  const markers2 = createMarkerIds(edges, {
8509
8286
  id: rfId,
8510
8287
  defaultColor,
8511
- defaultMarkerStart: defaultEdgeOptions == null ? void 0 : defaultEdgeOptions.markerStart,
8512
- defaultMarkerEnd: defaultEdgeOptions == null ? void 0 : defaultEdgeOptions.markerEnd
8288
+ defaultMarkerStart: defaultEdgeOptions?.markerStart,
8289
+ defaultMarkerEnd: defaultEdgeOptions?.markerEnd
8513
8290
  });
8514
8291
  return markers2;
8515
8292
  }, [edges, defaultEdgeOptions, rfId, defaultColor]);
@@ -8611,9 +8388,9 @@ function createSmoothStepEdge(params) {
8611
8388
  targetX,
8612
8389
  targetY,
8613
8390
  targetPosition,
8614
- borderRadius: pathOptions == null ? void 0 : pathOptions.borderRadius,
8615
- offset: pathOptions == null ? void 0 : pathOptions.offset,
8616
- stepPosition: pathOptions == null ? void 0 : pathOptions.stepPosition
8391
+ borderRadius: pathOptions?.borderRadius,
8392
+ offset: pathOptions?.offset,
8393
+ stepPosition: pathOptions?.stepPosition
8617
8394
  });
8618
8395
  const _id = params.isInternal ? void 0 : id2;
8619
8396
  return jsx(BaseEdge, { id: _id, path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth });
@@ -8625,12 +8402,8 @@ SmoothStepEdge.displayName = "SmoothStepEdge";
8625
8402
  SmoothStepEdgeInternal.displayName = "SmoothStepEdgeInternal";
8626
8403
  function createStepEdge(params) {
8627
8404
  return memo(({ id: id2, ...props }) => {
8628
- var _a;
8629
8405
  const _id = params.isInternal ? void 0 : id2;
8630
- return jsx(SmoothStepEdge, { ...props, id: _id, pathOptions: useMemo(() => {
8631
- var _a2;
8632
- return { borderRadius: 0, offset: (_a2 = props.pathOptions) == null ? void 0 : _a2.offset };
8633
- }, [(_a = props.pathOptions) == null ? void 0 : _a.offset]) });
8406
+ return jsx(SmoothStepEdge, { ...props, id: _id, pathOptions: useMemo(() => ({ borderRadius: 0, offset: props.pathOptions?.offset }), [props.pathOptions?.offset]) });
8634
8407
  });
8635
8408
  }
8636
8409
  const StepEdge = createStepEdge({ isInternal: false });
@@ -8657,7 +8430,7 @@ function createBezierEdge(params) {
8657
8430
  targetX,
8658
8431
  targetY,
8659
8432
  targetPosition,
8660
- curvature: pathOptions == null ? void 0 : pathOptions.curvature
8433
+ curvature: pathOptions?.curvature
8661
8434
  });
8662
8435
  const _id = params.isInternal ? void 0 : id2;
8663
8436
  return jsx(BaseEdge, { id: _id, path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth });
@@ -8706,17 +8479,17 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
8706
8479
  if (event.button !== 0) {
8707
8480
  return;
8708
8481
  }
8709
- const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib: lib2, onConnectStart, onConnectEnd, cancelConnection, nodeLookup, rfId: flowId, panBy: panBy2, updateConnection } = store.getState();
8482
+ const { autoPanOnConnect, domNode, connectionMode, connectionRadius, lib: lib2, onConnectStart, cancelConnection, nodeLookup, rfId: flowId, panBy: panBy2, updateConnection } = store.getState();
8710
8483
  const isTarget = oppositeHandle.type === "target";
8711
8484
  const _onReconnectEnd = (evt, connectionState) => {
8712
8485
  setReconnecting(false);
8713
- onReconnectEnd == null ? void 0 : onReconnectEnd(evt, edge, oppositeHandle.type, connectionState);
8486
+ onReconnectEnd?.(evt, edge, oppositeHandle.type, connectionState);
8714
8487
  };
8715
- const onConnectEdge = (connection) => onReconnect == null ? void 0 : onReconnect(edge, connection);
8488
+ const onConnectEdge = (connection) => onReconnect?.(edge, connection);
8716
8489
  const _onConnectStart = (_event, params) => {
8717
8490
  setReconnecting(true);
8718
- onReconnectStart == null ? void 0 : onReconnectStart(event, edge, oppositeHandle.type);
8719
- onConnectStart == null ? void 0 : onConnectStart(_event, params);
8491
+ onReconnectStart?.(event, edge, oppositeHandle.type);
8492
+ onConnectStart?.(_event, params);
8720
8493
  };
8721
8494
  XYHandle.onPointerDown(event.nativeEvent, {
8722
8495
  autoPanOnConnect,
@@ -8732,10 +8505,10 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
8732
8505
  flowId,
8733
8506
  cancelConnection,
8734
8507
  panBy: panBy2,
8735
- isValidConnection,
8508
+ isValidConnection: (...args) => store.getState().isValidConnection?.(...args) ?? true,
8736
8509
  onConnect: onConnectEdge,
8737
8510
  onConnectStart: _onConnectStart,
8738
- onConnectEnd,
8511
+ onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
8739
8512
  onReconnectEnd: _onReconnectEnd,
8740
8513
  updateConnection,
8741
8514
  getTransform: () => store.getState().transform,
@@ -8755,11 +8528,11 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
8755
8528
  const defaultEdgeOptions = useStore((s) => s.defaultEdgeOptions);
8756
8529
  edge = defaultEdgeOptions ? { ...defaultEdgeOptions, ...edge } : edge;
8757
8530
  let edgeType = edge.type || "default";
8758
- let EdgeComponent = (edgeTypes == null ? void 0 : edgeTypes[edgeType]) || builtinEdgeTypes[edgeType];
8531
+ let EdgeComponent = edgeTypes?.[edgeType] || builtinEdgeTypes[edgeType];
8759
8532
  if (EdgeComponent === void 0) {
8760
- onError == null ? void 0 : onError("011", errorMessages$2["error011"](edgeType));
8533
+ onError?.("011", errorMessages$2["error011"](edgeType));
8761
8534
  edgeType = "default";
8762
- EdgeComponent = (edgeTypes == null ? void 0 : edgeTypes["default"]) || builtinEdgeTypes.default;
8535
+ EdgeComponent = edgeTypes?.["default"] || builtinEdgeTypes.default;
8763
8536
  }
8764
8537
  const isFocusable = !!(edge.focusable || edgesFocusable && typeof edge.focusable === "undefined");
8765
8538
  const isReconnectable = typeof onReconnect !== "undefined" && (edge.reconnectable || edgesReconnectable && typeof edge.reconnectable === "undefined");
@@ -8805,13 +8578,12 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
8805
8578
  return null;
8806
8579
  }
8807
8580
  const onEdgeClick = (event) => {
8808
- var _a;
8809
8581
  const { addSelectedEdges, unselectNodesAndEdges, multiSelectionActive } = store.getState();
8810
8582
  if (isSelectable) {
8811
8583
  store.setState({ nodesSelectionActive: false });
8812
8584
  if (edge.selected && multiSelectionActive) {
8813
8585
  unselectNodesAndEdges({ nodes: [], edges: [edge] });
8814
- (_a = edgeRef.current) == null ? void 0 : _a.blur();
8586
+ edgeRef.current?.blur();
8815
8587
  } else {
8816
8588
  addSelectedEdges([id2]);
8817
8589
  }
@@ -8836,12 +8608,11 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
8836
8608
  onMouseLeave(event, { ...edge });
8837
8609
  } : void 0;
8838
8610
  const onKeyDown = (event) => {
8839
- var _a;
8840
8611
  if (!disableKeyboardA11y && elementSelectionKeys.includes(event.key) && isSelectable) {
8841
8612
  const { unselectNodesAndEdges, addSelectedEdges } = store.getState();
8842
8613
  const unselect = event.key === "Escape";
8843
8614
  if (unselect) {
8844
- (_a = edgeRef.current) == null ? void 0 : _a.blur();
8615
+ edgeRef.current?.blur();
8845
8616
  unselectNodesAndEdges({ edges: [edge] });
8846
8617
  } else {
8847
8618
  addSelectedEdges([id2]);
@@ -8894,16 +8665,13 @@ function useOnInitHandler(onInit) {
8894
8665
  }
8895
8666
  }, [onInit, rfInstance.viewportInitialized]);
8896
8667
  }
8897
- const selector$8 = (state) => {
8898
- var _a;
8899
- return (_a = state.panZoom) == null ? void 0 : _a.syncViewport;
8900
- };
8668
+ const selector$8 = (state) => state.panZoom?.syncViewport;
8901
8669
  function useViewportSync(viewport) {
8902
8670
  const syncViewport = useStore(selector$8);
8903
8671
  const store = useStoreApi();
8904
8672
  useEffect(() => {
8905
8673
  if (viewport) {
8906
- syncViewport == null ? void 0 : syncViewport(viewport);
8674
+ syncViewport?.(viewport);
8907
8675
  store.setState({ transform: [viewport.x, viewport.y, viewport.zoom] });
8908
8676
  }
8909
8677
  }, [viewport, syncViewport]);
@@ -8978,12 +8746,11 @@ function useNodeOrEdgeTypesWarning(nodeOrEdgeTypes = emptyTypes) {
8978
8746
  const typesRef = useRef(nodeOrEdgeTypes);
8979
8747
  const store = useStoreApi();
8980
8748
  useEffect(() => {
8981
- var _a, _b;
8982
8749
  if (process.env.NODE_ENV === "development") {
8983
8750
  const usedKeys = /* @__PURE__ */ new Set([...Object.keys(typesRef.current), ...Object.keys(nodeOrEdgeTypes)]);
8984
8751
  for (const key of usedKeys) {
8985
8752
  if (typesRef.current[key] !== nodeOrEdgeTypes[key]) {
8986
- (_b = (_a = store.getState()).onError) == null ? void 0 : _b.call(_a, "002", errorMessages$2["error002"]());
8753
+ store.getState().onError?.("002", errorMessages$2["error002"]());
8987
8754
  break;
8988
8755
  }
8989
8756
  }
@@ -8995,12 +8762,11 @@ function useStylesLoadedWarning() {
8995
8762
  const store = useStoreApi();
8996
8763
  const checked = useRef(false);
8997
8764
  useEffect(() => {
8998
- var _a, _b;
8999
8765
  if (process.env.NODE_ENV === "development") {
9000
8766
  if (!checked.current) {
9001
8767
  const pane = document.querySelector(".react-flow__pane");
9002
8768
  if (pane && !(window.getComputedStyle(pane).zIndex === "1")) {
9003
- (_b = (_a = store.getState()).onError) == null ? void 0 : _b.call(_a, "013", errorMessages$2["error013"]("react"));
8769
+ store.getState().onError?.("013", errorMessages$2["error013"]("react"));
9004
8770
  }
9005
8771
  checked.current = true;
9006
8772
  }
@@ -9037,7 +8803,7 @@ const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, heig
9037
8803
  const bounds = getInternalNodesBounds(nodeLookup, {
9038
8804
  filter: (node) => !!((node.width || node.initialWidth) && (node.height || node.initialHeight))
9039
8805
  });
9040
- const { x, y, zoom: zoom2 } = getViewportForBounds(bounds, width, height, minZoom, maxZoom, (fitViewOptions == null ? void 0 : fitViewOptions.padding) ?? 0.1);
8806
+ const { x, y, zoom: zoom2 } = getViewportForBounds(bounds, width, height, minZoom, maxZoom, fitViewOptions?.padding ?? 0.1);
9041
8807
  transform2 = [x, y, zoom2];
9042
8808
  }
9043
8809
  return {
@@ -9120,7 +8886,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
9120
8886
  minZoom: minZoom2,
9121
8887
  maxZoom: maxZoom2
9122
8888
  }, fitViewOptions2);
9123
- fitViewResolver == null ? void 0 : fitViewResolver.resolve(true);
8889
+ fitViewResolver?.resolve(true);
9124
8890
  set2({ fitViewResolver: null });
9125
8891
  }
9126
8892
  return {
@@ -9190,11 +8956,11 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
9190
8956
  } else {
9191
8957
  set2({});
9192
8958
  }
9193
- if ((changes == null ? void 0 : changes.length) > 0) {
8959
+ if (changes?.length > 0) {
9194
8960
  if (debug2) {
9195
8961
  console.log("React Flow: trigger node changes", changes);
9196
8962
  }
9197
- triggerNodeChanges == null ? void 0 : triggerNodeChanges(changes);
8963
+ triggerNodeChanges?.(changes);
9198
8964
  }
9199
8965
  },
9200
8966
  updateNodePositions: (nodeDragItems, dragging = false) => {
@@ -9203,7 +8969,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
9203
8969
  const { nodeLookup, triggerNodeChanges, connection, updateConnection, onNodesChangeMiddlewareMap } = get2();
9204
8970
  for (const [id2, dragItem] of nodeDragItems) {
9205
8971
  const node = nodeLookup.get(id2);
9206
- const expandParent = !!((node == null ? void 0 : node.expandParent) && (node == null ? void 0 : node.parentId) && (dragItem == null ? void 0 : dragItem.position));
8972
+ const expandParent = !!(node?.expandParent && node?.parentId && dragItem?.position);
9207
8973
  const change = {
9208
8974
  id: id2,
9209
8975
  type: "position",
@@ -9242,7 +9008,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
9242
9008
  },
9243
9009
  triggerNodeChanges: (changes) => {
9244
9010
  const { onNodesChange, setNodes, nodes: nodes2, hasDefaultNodes, debug: debug2 } = get2();
9245
- if (changes == null ? void 0 : changes.length) {
9011
+ if (changes?.length) {
9246
9012
  if (hasDefaultNodes) {
9247
9013
  const updatedNodes = applyNodeChanges(changes, nodes2);
9248
9014
  setNodes(updatedNodes);
@@ -9250,12 +9016,12 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
9250
9016
  if (debug2) {
9251
9017
  console.log("React Flow: trigger node changes", changes);
9252
9018
  }
9253
- onNodesChange == null ? void 0 : onNodesChange(changes);
9019
+ onNodesChange?.(changes);
9254
9020
  }
9255
9021
  },
9256
9022
  triggerEdgeChanges: (changes) => {
9257
9023
  const { onEdgesChange, setEdges, edges: edges2, hasDefaultEdges, debug: debug2 } = get2();
9258
- if (changes == null ? void 0 : changes.length) {
9024
+ if (changes?.length) {
9259
9025
  if (hasDefaultEdges) {
9260
9026
  const updatedEdges = applyEdgeChanges(changes, edges2);
9261
9027
  setEdges(updatedEdges);
@@ -9263,7 +9029,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
9263
9029
  if (debug2) {
9264
9030
  console.log("React Flow: trigger edge changes", changes);
9265
9031
  }
9266
- onEdgesChange == null ? void 0 : onEdgesChange(changes);
9032
+ onEdgesChange?.(changes);
9267
9033
  }
9268
9034
  },
9269
9035
  addSelectedNodes: (selectedNodeIds) => {
@@ -9290,30 +9056,39 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
9290
9056
  const { edges: storeEdges, nodes: storeNodes, nodeLookup, triggerNodeChanges, triggerEdgeChanges } = get2();
9291
9057
  const nodesToUnselect = nodes2 ? nodes2 : storeNodes;
9292
9058
  const edgesToUnselect = edges2 ? edges2 : storeEdges;
9293
- const nodeChanges = nodesToUnselect.map((n) => {
9294
- const internalNode = nodeLookup.get(n.id);
9059
+ const nodeChanges = [];
9060
+ for (const node of nodesToUnselect) {
9061
+ if (!node.selected) {
9062
+ continue;
9063
+ }
9064
+ const internalNode = nodeLookup.get(node.id);
9295
9065
  if (internalNode) {
9296
9066
  internalNode.selected = false;
9297
9067
  }
9298
- return createSelectionChange(n.id, false);
9299
- });
9300
- const edgeChanges = edgesToUnselect.map((edge) => createSelectionChange(edge.id, false));
9068
+ nodeChanges.push(createSelectionChange(node.id, false));
9069
+ }
9070
+ const edgeChanges = [];
9071
+ for (const edge of edgesToUnselect) {
9072
+ if (!edge.selected) {
9073
+ continue;
9074
+ }
9075
+ edgeChanges.push(createSelectionChange(edge.id, false));
9076
+ }
9301
9077
  triggerNodeChanges(nodeChanges);
9302
9078
  triggerEdgeChanges(edgeChanges);
9303
9079
  },
9304
9080
  setMinZoom: (minZoom2) => {
9305
9081
  const { panZoom, maxZoom: maxZoom2 } = get2();
9306
- panZoom == null ? void 0 : panZoom.setScaleExtent([minZoom2, maxZoom2]);
9082
+ panZoom?.setScaleExtent([minZoom2, maxZoom2]);
9307
9083
  set2({ minZoom: minZoom2 });
9308
9084
  },
9309
9085
  setMaxZoom: (maxZoom2) => {
9310
9086
  const { panZoom, minZoom: minZoom2 } = get2();
9311
- panZoom == null ? void 0 : panZoom.setScaleExtent([minZoom2, maxZoom2]);
9087
+ panZoom?.setScaleExtent([minZoom2, maxZoom2]);
9312
9088
  set2({ maxZoom: maxZoom2 });
9313
9089
  },
9314
9090
  setTranslateExtent: (translateExtent) => {
9315
- var _a;
9316
- (_a = get2().panZoom) == null ? void 0 : _a.setTranslateExtent(translateExtent);
9091
+ get2().panZoom?.setTranslateExtent(translateExtent);
9317
9092
  set2({ translateExtent });
9318
9093
  },
9319
9094
  resetSelectedElements: () => {
@@ -9349,12 +9124,12 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
9349
9124
  if (!panZoom) {
9350
9125
  return Promise.resolve(false);
9351
9126
  }
9352
- const nextZoom = typeof (options == null ? void 0 : options.zoom) !== "undefined" ? options.zoom : maxZoom2;
9127
+ const nextZoom = typeof options?.zoom !== "undefined" ? options.zoom : maxZoom2;
9353
9128
  await panZoom.setViewport({
9354
9129
  x: width2 / 2 - x * nextZoom,
9355
9130
  y: height2 / 2 - y * nextZoom,
9356
9131
  zoom: nextZoom
9357
- }, { duration: options == null ? void 0 : options.duration, ease: options == null ? void 0 : options.ease, interpolate: options == null ? void 0 : options.interpolate });
9132
+ }, { duration: options?.duration, ease: options?.ease, interpolate: options?.interpolate });
9358
9133
  return Promise.resolve(true);
9359
9134
  },
9360
9135
  cancelConnection: () => {
@@ -9405,7 +9180,7 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
9405
9180
  const colorModeClassName = useColorModeClass(colorMode);
9406
9181
  const wrapperOnScroll = useCallback((e) => {
9407
9182
  e.currentTarget.scrollTo({ top: 0, left: 0, behavior: "instant" });
9408
- onScroll == null ? void 0 : onScroll(e);
9183
+ onScroll?.(e);
9409
9184
  }, [onScroll]);
9410
9185
  return jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, role: "application", children: jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, zIndexMode, children: [jsx(GraphView, { onInit, onNodeClick, onEdgeClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, nodeTypes: nodeTypes2, edgeTypes, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, deleteKeyCode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent, minZoom, maxZoom, preventScrolling, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noDragClassName, noWheelClassName, noPanClassName, rfId, disableKeyboardA11y, nodeExtent, viewport, onViewportChange }), jsx(StoreUpdater, { nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, edgesFocusable, edgesReconnectable, elementsSelectable, elevateNodesOnSelect, elevateEdgesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, snapToGrid, snapGrid, connectionMode, translateExtent, connectOnClick, defaultEdgeOptions, fitView, fitViewOptions, onNodesDelete, onEdgesDelete, onDelete, onNodeDragStart, onNodeDrag, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, onMove, onMoveStart, onMoveEnd, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, onError, connectionRadius, isValidConnection, selectNodesOnDrag, nodeDragThreshold, connectionDragThreshold, onBeforeDelete, debug: debug2, ariaLabelConfig, zIndexMode }), jsx(SelectionListener, { onSelectionChange }), children2, jsx(Attribution, { proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
9411
9186
  }
@@ -9518,15 +9293,15 @@ function ControlsComponent({ style: style2, showZoom = true, showFitView = true,
9518
9293
  const { zoomIn, zoomOut, fitView } = useReactFlow();
9519
9294
  const onZoomInHandler = () => {
9520
9295
  zoomIn();
9521
- onZoomIn == null ? void 0 : onZoomIn();
9296
+ onZoomIn?.();
9522
9297
  };
9523
9298
  const onZoomOutHandler = () => {
9524
9299
  zoomOut();
9525
- onZoomOut == null ? void 0 : onZoomOut();
9300
+ onZoomOut?.();
9526
9301
  };
9527
9302
  const onFitViewHandler = () => {
9528
9303
  fitView(fitViewOptions);
9529
- onFitView == null ? void 0 : onFitView();
9304
+ onFitView?.();
9530
9305
  };
9531
9306
  const onToggleInteractivity = () => {
9532
9307
  store.setState({
@@ -9534,7 +9309,7 @@ function ControlsComponent({ style: style2, showZoom = true, showFitView = true,
9534
9309
  nodesConnectable: !isInteractive,
9535
9310
  elementsSelectable: !isInteractive
9536
9311
  });
9537
- onInteractiveChange == null ? void 0 : onInteractiveChange(!isInteractive);
9312
+ onInteractiveChange?.(!isInteractive);
9538
9313
  };
9539
9314
  const orientationClass = orientation === "horizontal" ? "horizontal" : "vertical";
9540
9315
  return jsxs(Panel, { className: cc(["react-flow__controls", orientationClass, className]), position, style: style2, "data-testid": "rf__controls", "aria-label": ariaLabel ?? ariaLabelConfig["controls.ariaLabel"], children: [showZoom && jsxs(Fragment, { children: [jsx(ControlButton, { onClick: onZoomInHandler, className: "react-flow__controls-zoomin", title: ariaLabelConfig["controls.zoomIn.ariaLabel"], "aria-label": ariaLabelConfig["controls.zoomIn.ariaLabel"], disabled: maxZoomReached, children: jsx(PlusIcon, {}) }), jsx(ControlButton, { onClick: onZoomOutHandler, className: "react-flow__controls-zoomout", title: ariaLabelConfig["controls.zoomOut.ariaLabel"], "aria-label": ariaLabelConfig["controls.zoomOut.ariaLabel"], disabled: minZoomReached, children: jsx(MinusIcon, {}) })] }), showFitView && jsx(ControlButton, { className: "react-flow__controls-fitview", onClick: onFitViewHandler, title: ariaLabelConfig["controls.fitView.ariaLabel"], "aria-label": ariaLabelConfig["controls.fitView.ariaLabel"], children: jsx(FitViewIcon, {}) }), showInteractive && jsx(ControlButton, { className: "react-flow__controls-interactive", onClick: onToggleInteractivity, title: ariaLabelConfig["controls.interactive.ariaLabel"], "aria-label": ariaLabelConfig["controls.interactive.ariaLabel"], children: isInteractive ? jsx(UnlockIcon, {}) : jsx(LockIcon, {}) }), children2] });
@@ -9584,12 +9359,15 @@ function MiniMapNodes({
9584
9359
  }
9585
9360
  function NodeComponentWrapperInner({ id: id2, nodeColorFunc, nodeStrokeColorFunc, nodeClassNameFunc, nodeBorderRadius, nodeStrokeWidth, shapeRendering, NodeComponent, onClick }) {
9586
9361
  const { node, x, y, width, height } = useStore((s) => {
9587
- const { internals } = s.nodeLookup.get(id2);
9588
- const node2 = internals.userNode;
9589
- const { x: x2, y: y2 } = internals.positionAbsolute;
9590
- const { width: width2, height: height2 } = getNodeDimensions(node2);
9362
+ const node2 = s.nodeLookup.get(id2);
9363
+ if (!node2) {
9364
+ return { node: void 0, x: 0, y: 0, width: 0, height: 0 };
9365
+ }
9366
+ const userNode = node2.internals.userNode;
9367
+ const { x: x2, y: y2 } = node2.internals.positionAbsolute;
9368
+ const { width: width2, height: height2 } = getNodeDimensions(userNode);
9591
9369
  return {
9592
- node: node2,
9370
+ node: userNode,
9593
9371
  x: x2,
9594
9372
  y: y2,
9595
9373
  width: width2,
@@ -9655,8 +9433,8 @@ function MiniMapComponent({
9655
9433
  const store = useStoreApi();
9656
9434
  const svg = useRef(null);
9657
9435
  const { boundingRect, viewBB, rfId, panZoom, translateExtent, flowWidth, flowHeight, ariaLabelConfig } = useStore(selector$1, shallow$1);
9658
- const elementWidth = (style2 == null ? void 0 : style2.width) ?? defaultWidth;
9659
- const elementHeight = (style2 == null ? void 0 : style2.height) ?? defaultHeight;
9436
+ const elementWidth = style2?.width ?? defaultWidth;
9437
+ const elementHeight = style2?.height ?? defaultHeight;
9660
9438
  const scaledWidth = boundingRect.width / elementWidth;
9661
9439
  const scaledHeight = boundingRect.height / elementHeight;
9662
9440
  const viewScale = Math.max(scaledWidth, scaledHeight);
@@ -9680,14 +9458,12 @@ function MiniMapComponent({
9680
9458
  getViewScale: () => viewScaleRef.current
9681
9459
  });
9682
9460
  return () => {
9683
- var _a;
9684
- (_a = minimapInstance.current) == null ? void 0 : _a.destroy();
9461
+ minimapInstance.current?.destroy();
9685
9462
  };
9686
9463
  }
9687
9464
  }, [panZoom]);
9688
9465
  useEffect(() => {
9689
- var _a;
9690
- (_a = minimapInstance.current) == null ? void 0 : _a.update({
9466
+ minimapInstance.current?.update({
9691
9467
  translateExtent,
9692
9468
  width: flowWidth,
9693
9469
  height: flowHeight,
@@ -9698,8 +9474,7 @@ function MiniMapComponent({
9698
9474
  });
9699
9475
  }, [pannable, zoomable, inversePan, zoomStep, translateExtent, flowWidth, flowHeight]);
9700
9476
  const onSvgClick = onClick ? (event) => {
9701
- var _a;
9702
- const [x2, y2] = ((_a = minimapInstance.current) == null ? void 0 : _a.pointer(event)) || [0, 0];
9477
+ const [x2, y2] = minimapInstance.current?.pointer(event) || [0, 0];
9703
9478
  onClick(event, { x: x2, y: y2 });
9704
9479
  } : void 0;
9705
9480
  const onSvgNodeClick = onNodeClick ? useCallback((event, nodeId) => {
@@ -9841,8 +9616,7 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
9841
9616
  shouldResize
9842
9617
  });
9843
9618
  return () => {
9844
- var _a;
9845
- (_a = resizer.current) == null ? void 0 : _a.destroy();
9619
+ resizer.current?.destroy();
9846
9620
  };
9847
9621
  }, [
9848
9622
  controlPosition,
@@ -9864,21 +9638,21 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
9864
9638
  }, children: children2 });
9865
9639
  }
9866
9640
  memo(ResizeControl);
9867
- var __defProp2 = Object.defineProperty;
9868
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9869
- var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
9641
+ var __defProp = Object.defineProperty;
9642
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9643
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
9870
9644
  let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNodes;
9871
9645
  (async () => {
9872
9646
  const toKebabCase2 = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
9873
- const toCamelCase = (string) => string.replace(/^([A-Z])|[\s-_]+(\w)/g, (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase());
9874
- const toPascalCase = (string) => {
9875
- const camelCase = toCamelCase(string);
9647
+ const toCamelCase2 = (string) => string.replace(/^([A-Z])|[\s-_]+(\w)/g, (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase());
9648
+ const toPascalCase2 = (string) => {
9649
+ const camelCase = toCamelCase2(string);
9876
9650
  return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
9877
9651
  };
9878
9652
  const mergeClasses2 = (...classes) => classes.filter((className, index2, array2) => {
9879
9653
  return Boolean(className) && className.trim() !== "" && array2.indexOf(className) === index2;
9880
9654
  }).join(" ").trim();
9881
- const hasA11yProp = (props) => {
9655
+ const hasA11yProp2 = (props) => {
9882
9656
  for (const prop in props) {
9883
9657
  if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
9884
9658
  return true;
@@ -9904,7 +9678,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
9904
9678
  stroke: color2,
9905
9679
  strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
9906
9680
  className: mergeClasses2("lucide", className),
9907
- ...!children2 && !hasA11yProp(rest) && {
9681
+ ...!children2 && !hasA11yProp2(rest) && {
9908
9682
  "aria-hidden": "true"
9909
9683
  },
9910
9684
  ...rest
@@ -9918,13 +9692,13 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
9918
9692
  const Component2 = forwardRef(({ className, ...props }, ref) => createElement(Icon$1, {
9919
9693
  ref,
9920
9694
  iconNode,
9921
- className: mergeClasses2(`lucide-${toKebabCase2(toPascalCase(iconName))}`, `lucide-${iconName}`, className),
9695
+ className: mergeClasses2(`lucide-${toKebabCase2(toPascalCase2(iconName))}`, `lucide-${iconName}`, className),
9922
9696
  ...props
9923
9697
  }));
9924
- Component2.displayName = toPascalCase(iconName);
9698
+ Component2.displayName = toPascalCase2(iconName);
9925
9699
  return Component2;
9926
9700
  };
9927
- const __iconNode$Q = [
9701
+ const __iconNode$R = [
9928
9702
  [
9929
9703
  "path",
9930
9704
  {
@@ -9940,8 +9714,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
9940
9714
  }
9941
9715
  ]
9942
9716
  ];
9943
- const ArrowUp = createLucideIcon2("arrow-up", __iconNode$Q);
9944
- const __iconNode$P = [
9717
+ const ArrowUp = createLucideIcon2("arrow-up", __iconNode$R);
9718
+ const __iconNode$Q = [
9945
9719
  [
9946
9720
  "path",
9947
9721
  {
@@ -9959,8 +9733,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
9959
9733
  }
9960
9734
  ]
9961
9735
  ];
9962
- const Ban = createLucideIcon2("ban", __iconNode$P);
9963
- const __iconNode$O = [
9736
+ const Ban = createLucideIcon2("ban", __iconNode$Q);
9737
+ const __iconNode$P = [
9964
9738
  [
9965
9739
  "rect",
9966
9740
  {
@@ -10012,8 +9786,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10012
9786
  }
10013
9787
  ]
10014
9788
  ];
10015
- const Binary = createLucideIcon2("binary", __iconNode$O);
10016
- const __iconNode$N = [
9789
+ const Binary = createLucideIcon2("binary", __iconNode$P);
9790
+ const __iconNode$O = [
10017
9791
  [
10018
9792
  "path",
10019
9793
  {
@@ -10036,8 +9810,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10036
9810
  }
10037
9811
  ]
10038
9812
  ];
10039
- const Box2 = createLucideIcon2("box", __iconNode$N);
10040
- const __iconNode$M = [
9813
+ const Box2 = createLucideIcon2("box", __iconNode$O);
9814
+ const __iconNode$N = [
10041
9815
  [
10042
9816
  "path",
10043
9817
  {
@@ -10123,8 +9897,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10123
9897
  }
10124
9898
  ]
10125
9899
  ];
10126
- const Boxes = createLucideIcon2("boxes", __iconNode$M);
10127
- const __iconNode$L = [
9900
+ const Boxes = createLucideIcon2("boxes", __iconNode$N);
9901
+ const __iconNode$M = [
10128
9902
  [
10129
9903
  "path",
10130
9904
  {
@@ -10140,8 +9914,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10140
9914
  }
10141
9915
  ]
10142
9916
  ];
10143
- const Braces = createLucideIcon2("braces", __iconNode$L);
10144
- const __iconNode$K = [
9917
+ const Braces = createLucideIcon2("braces", __iconNode$M);
9918
+ const __iconNode$L = [
10145
9919
  [
10146
9920
  "path",
10147
9921
  {
@@ -10220,8 +9994,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10220
9994
  }
10221
9995
  ]
10222
9996
  ];
10223
- const Bug = createLucideIcon2("bug", __iconNode$K);
10224
- const __iconNode$J = [
9997
+ const Bug = createLucideIcon2("bug", __iconNode$L);
9998
+ const __iconNode$K = [
10225
9999
  [
10226
10000
  "rect",
10227
10001
  {
@@ -10303,8 +10077,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10303
10077
  }
10304
10078
  ]
10305
10079
  ];
10306
- const Calculator = createLucideIcon2("calculator", __iconNode$J);
10307
- const __iconNode$I = [
10080
+ const Calculator = createLucideIcon2("calculator", __iconNode$K);
10081
+ const __iconNode$J = [
10308
10082
  [
10309
10083
  "path",
10310
10084
  {
@@ -10338,8 +10112,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10338
10112
  }
10339
10113
  ]
10340
10114
  ];
10341
- const Calendar = createLucideIcon2("calendar", __iconNode$I);
10342
- const __iconNode$H = [
10115
+ const Calendar = createLucideIcon2("calendar", __iconNode$J);
10116
+ const __iconNode$I = [
10343
10117
  [
10344
10118
  "path",
10345
10119
  {
@@ -10348,8 +10122,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10348
10122
  }
10349
10123
  ]
10350
10124
  ];
10351
- const Check2 = createLucideIcon2("check", __iconNode$H);
10352
- const __iconNode$G = [
10125
+ const Check2 = createLucideIcon2("check", __iconNode$I);
10126
+ const __iconNode$H = [
10353
10127
  [
10354
10128
  "path",
10355
10129
  {
@@ -10358,8 +10132,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10358
10132
  }
10359
10133
  ]
10360
10134
  ];
10361
- const ChevronDown2 = createLucideIcon2("chevron-down", __iconNode$G);
10362
- const __iconNode$F = [
10135
+ const ChevronDown2 = createLucideIcon2("chevron-down", __iconNode$H);
10136
+ const __iconNode$G = [
10363
10137
  [
10364
10138
  "path",
10365
10139
  {
@@ -10368,8 +10142,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10368
10142
  }
10369
10143
  ]
10370
10144
  ];
10371
- const ChevronLeft2 = createLucideIcon2("chevron-left", __iconNode$F);
10372
- const __iconNode$E = [
10145
+ const ChevronLeft2 = createLucideIcon2("chevron-left", __iconNode$G);
10146
+ const __iconNode$F = [
10373
10147
  [
10374
10148
  "path",
10375
10149
  {
@@ -10378,8 +10152,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10378
10152
  }
10379
10153
  ]
10380
10154
  ];
10381
- const ChevronRight2 = createLucideIcon2("chevron-right", __iconNode$E);
10382
- const __iconNode$D = [
10155
+ const ChevronRight2 = createLucideIcon2("chevron-right", __iconNode$F);
10156
+ const __iconNode$E = [
10383
10157
  [
10384
10158
  "circle",
10385
10159
  {
@@ -10410,8 +10184,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10410
10184
  }
10411
10185
  ]
10412
10186
  ];
10413
- const CircleAlert2 = createLucideIcon2("circle-alert", __iconNode$D);
10414
- const __iconNode$C = [
10187
+ const CircleAlert2 = createLucideIcon2("circle-alert", __iconNode$E);
10188
+ const __iconNode$D = [
10415
10189
  [
10416
10190
  "circle",
10417
10191
  {
@@ -10436,8 +10210,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10436
10210
  }
10437
10211
  ]
10438
10212
  ];
10439
- const CircleQuestionMark = createLucideIcon2("circle-question-mark", __iconNode$C);
10440
- const __iconNode$B = [
10213
+ const CircleQuestionMark = createLucideIcon2("circle-question-mark", __iconNode$D);
10214
+ const __iconNode$C = [
10441
10215
  [
10442
10216
  "circle",
10443
10217
  {
@@ -10462,8 +10236,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10462
10236
  }
10463
10237
  ]
10464
10238
  ];
10465
- const CircleX2 = createLucideIcon2("circle-x", __iconNode$B);
10466
- const __iconNode$A = [
10239
+ const CircleX2 = createLucideIcon2("circle-x", __iconNode$C);
10240
+ const __iconNode$B = [
10467
10241
  [
10468
10242
  "rect",
10469
10243
  {
@@ -10484,8 +10258,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10484
10258
  }
10485
10259
  ]
10486
10260
  ];
10487
- const Clipboard = createLucideIcon2("clipboard", __iconNode$A);
10488
- const __iconNode$z = [
10261
+ const Clipboard = createLucideIcon2("clipboard", __iconNode$B);
10262
+ const __iconNode$A = [
10489
10263
  [
10490
10264
  "path",
10491
10265
  {
@@ -10503,8 +10277,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10503
10277
  }
10504
10278
  ]
10505
10279
  ];
10506
- const Clock2 = createLucideIcon2("clock", __iconNode$z);
10507
- const __iconNode$y = [
10280
+ const Clock2 = createLucideIcon2("clock", __iconNode$A);
10281
+ const __iconNode$z = [
10508
10282
  [
10509
10283
  "path",
10510
10284
  {
@@ -10608,8 +10382,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10608
10382
  }
10609
10383
  ]
10610
10384
  ];
10611
- const Cog = createLucideIcon2("cog", __iconNode$y);
10612
- const __iconNode$x = [
10385
+ const Cog = createLucideIcon2("cog", __iconNode$z);
10386
+ const __iconNode$y = [
10613
10387
  [
10614
10388
  "rect",
10615
10389
  {
@@ -10630,8 +10404,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10630
10404
  }
10631
10405
  ]
10632
10406
  ];
10633
- const Copy = createLucideIcon2("copy", __iconNode$x);
10634
- const __iconNode$w = [
10407
+ const Copy = createLucideIcon2("copy", __iconNode$y);
10408
+ const __iconNode$x = [
10635
10409
  [
10636
10410
  "ellipse",
10637
10411
  {
@@ -10657,8 +10431,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10657
10431
  }
10658
10432
  ]
10659
10433
  ];
10660
- const Database = createLucideIcon2("database", __iconNode$w);
10661
- const __iconNode$v = [
10434
+ const Database = createLucideIcon2("database", __iconNode$x);
10435
+ const __iconNode$w = [
10662
10436
  [
10663
10437
  "path",
10664
10438
  {
@@ -10667,8 +10441,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10667
10441
  }
10668
10442
  ]
10669
10443
  ];
10670
- const Diamond = createLucideIcon2("diamond", __iconNode$v);
10671
- const __iconNode$u = [
10444
+ const Diamond = createLucideIcon2("diamond", __iconNode$w);
10445
+ const __iconNode$v = [
10672
10446
  [
10673
10447
  "circle",
10674
10448
  {
@@ -10698,8 +10472,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10698
10472
  }
10699
10473
  ]
10700
10474
  ];
10701
- const Divide = createLucideIcon2("divide", __iconNode$u);
10702
- const __iconNode$t = [
10475
+ const Divide = createLucideIcon2("divide", __iconNode$v);
10476
+ const __iconNode$u = [
10703
10477
  [
10704
10478
  "path",
10705
10479
  {
@@ -10722,8 +10496,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10722
10496
  }
10723
10497
  ]
10724
10498
  ];
10725
- const ExternalLink2 = createLucideIcon2("external-link", __iconNode$t);
10726
- const __iconNode$s = [
10499
+ const ExternalLink2 = createLucideIcon2("external-link", __iconNode$u);
10500
+ const __iconNode$t2 = [
10727
10501
  [
10728
10502
  "line",
10729
10503
  {
@@ -10760,8 +10534,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10760
10534
  }
10761
10535
  ]
10762
10536
  ];
10763
- const GitBranch2 = createLucideIcon2("git-branch", __iconNode$s);
10764
- const __iconNode$r = [
10537
+ const GitBranch2 = createLucideIcon2("git-branch", __iconNode$t2);
10538
+ const __iconNode$s2 = [
10765
10539
  [
10766
10540
  "circle",
10767
10541
  {
@@ -10792,8 +10566,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10792
10566
  }
10793
10567
  ]
10794
10568
  ];
10795
- const GitCommitHorizontal = createLucideIcon2("git-commit-horizontal", __iconNode$r);
10796
- const __iconNode$q = [
10569
+ const GitCommitHorizontal = createLucideIcon2("git-commit-horizontal", __iconNode$s2);
10570
+ const __iconNode$r2 = [
10797
10571
  [
10798
10572
  "circle",
10799
10573
  {
@@ -10820,8 +10594,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10820
10594
  }
10821
10595
  ]
10822
10596
  ];
10823
- const GitMerge = createLucideIcon2("git-merge", __iconNode$q);
10824
- const __iconNode$p = [
10597
+ const GitMerge = createLucideIcon2("git-merge", __iconNode$r2);
10598
+ const __iconNode$q2 = [
10825
10599
  [
10826
10600
  "line",
10827
10601
  {
@@ -10863,8 +10637,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10863
10637
  }
10864
10638
  ]
10865
10639
  ];
10866
- const Hash = createLucideIcon2("hash", __iconNode$p);
10867
- const __iconNode$o = [
10640
+ const Hash = createLucideIcon2("hash", __iconNode$q2);
10641
+ const __iconNode$p2 = [
10868
10642
  [
10869
10643
  "path",
10870
10644
  {
@@ -10887,8 +10661,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10887
10661
  }
10888
10662
  ]
10889
10663
  ];
10890
- const Layers2 = createLucideIcon2("layers", __iconNode$o);
10891
- const __iconNode$n = [
10664
+ const Layers2 = createLucideIcon2("layers", __iconNode$p2);
10665
+ const __iconNode$o2 = [
10892
10666
  [
10893
10667
  "path",
10894
10668
  {
@@ -10924,8 +10698,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10924
10698
  }
10925
10699
  ]
10926
10700
  ];
10927
- const Link2Off = createLucideIcon2("link-2-off", __iconNode$n);
10928
- const __iconNode$m = [
10701
+ const Link2Off = createLucideIcon2("link-2-off", __iconNode$o2);
10702
+ const __iconNode$n2 = [
10929
10703
  [
10930
10704
  "path",
10931
10705
  {
@@ -10969,8 +10743,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
10969
10743
  }
10970
10744
  ]
10971
10745
  ];
10972
- const List = createLucideIcon2("list", __iconNode$m);
10973
- const __iconNode$l = [
10746
+ const List = createLucideIcon2("list", __iconNode$n2);
10747
+ const __iconNode$m2 = [
10974
10748
  [
10975
10749
  "path",
10976
10750
  {
@@ -11000,8 +10774,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11000
10774
  }
11001
10775
  ]
11002
10776
  ];
11003
- const Maximize = createLucideIcon2("maximize", __iconNode$l);
11004
- const __iconNode$k = [
10777
+ const Maximize = createLucideIcon2("maximize", __iconNode$m2);
10778
+ const __iconNode$l2 = [
11005
10779
  [
11006
10780
  "path",
11007
10781
  {
@@ -11010,8 +10784,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11010
10784
  }
11011
10785
  ]
11012
10786
  ];
11013
- const MousePointer2 = createLucideIcon2("mouse-pointer-2", __iconNode$k);
11014
- const __iconNode$j = [
10787
+ const MousePointer2 = createLucideIcon2("mouse-pointer-2", __iconNode$l2);
10788
+ const __iconNode$k2 = [
11015
10789
  [
11016
10790
  "rect",
11017
10791
  {
@@ -11035,8 +10809,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11035
10809
  }
11036
10810
  ]
11037
10811
  ];
11038
- const Pause2 = createLucideIcon2("pause", __iconNode$j);
11039
- const __iconNode$i = [
10812
+ const Pause2 = createLucideIcon2("pause", __iconNode$k2);
10813
+ const __iconNode$j2 = [
11040
10814
  [
11041
10815
  "path",
11042
10816
  {
@@ -11052,8 +10826,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11052
10826
  }
11053
10827
  ]
11054
10828
  ];
11055
- const PenLine = createLucideIcon2("pen-line", __iconNode$i);
11056
- const __iconNode$h = [
10829
+ const PenLine = createLucideIcon2("pen-line", __iconNode$j2);
10830
+ const __iconNode$i2 = [
11057
10831
  [
11058
10832
  "path",
11059
10833
  {
@@ -11062,8 +10836,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11062
10836
  }
11063
10837
  ]
11064
10838
  ];
11065
- const Play2 = createLucideIcon2("play", __iconNode$h);
11066
- const __iconNode$g = [
10839
+ const Play2 = createLucideIcon2("play", __iconNode$i2);
10840
+ const __iconNode$h2 = [
11067
10841
  [
11068
10842
  "path",
11069
10843
  {
@@ -11079,8 +10853,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11079
10853
  }
11080
10854
  ]
11081
10855
  ];
11082
- const Plus = createLucideIcon2("plus", __iconNode$g);
11083
- const __iconNode$f = [
10856
+ const Plus = createLucideIcon2("plus", __iconNode$h2);
10857
+ const __iconNode$g2 = [
11084
10858
  [
11085
10859
  "path",
11086
10860
  {
@@ -11096,8 +10870,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11096
10870
  }
11097
10871
  ]
11098
10872
  ];
11099
- const Quote = createLucideIcon2("quote", __iconNode$f);
11100
- const __iconNode$e = [
10873
+ const Quote = createLucideIcon2("quote", __iconNode$g2);
10874
+ const __iconNode$f2 = [
11101
10875
  [
11102
10876
  "path",
11103
10877
  {
@@ -11113,8 +10887,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11113
10887
  }
11114
10888
  ]
11115
10889
  ];
11116
- const Redo2 = createLucideIcon2("redo-2", __iconNode$e);
11117
- const __iconNode$d = [
10890
+ const Redo2 = createLucideIcon2("redo-2", __iconNode$f2);
10891
+ const __iconNode$e2 = [
11118
10892
  [
11119
10893
  "path",
11120
10894
  {
@@ -11144,8 +10918,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11144
10918
  }
11145
10919
  ]
11146
10920
  ];
11147
- const Repeat = createLucideIcon2("repeat", __iconNode$d);
11148
- const __iconNode$c = [
10921
+ const Repeat = createLucideIcon2("repeat", __iconNode$e2);
10922
+ const __iconNode$d2 = [
11149
10923
  [
11150
10924
  "path",
11151
10925
  {
@@ -11182,8 +10956,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11182
10956
  }
11183
10957
  ]
11184
10958
  ];
11185
- const Scale = createLucideIcon2("scale", __iconNode$c);
11186
- const __iconNode$b = [
10959
+ const Scale = createLucideIcon2("scale", __iconNode$d2);
10960
+ const __iconNode$c2 = [
11187
10961
  [
11188
10962
  "path",
11189
10963
  {
@@ -11201,8 +10975,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11201
10975
  }
11202
10976
  ]
11203
10977
  ];
11204
- const Search2 = createLucideIcon2("search", __iconNode$b);
11205
- const __iconNode$a = [
10978
+ const Search2 = createLucideIcon2("search", __iconNode$c2);
10979
+ const __iconNode$b2 = [
11206
10980
  [
11207
10981
  "path",
11208
10982
  {
@@ -11218,8 +10992,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11218
10992
  }
11219
10993
  ]
11220
10994
  ];
11221
- const SkipBack2 = createLucideIcon2("skip-back", __iconNode$a);
11222
- const __iconNode$9 = [
10995
+ const SkipBack2 = createLucideIcon2("skip-back", __iconNode$b2);
10996
+ const __iconNode$a2 = [
11223
10997
  [
11224
10998
  "path",
11225
10999
  {
@@ -11235,8 +11009,28 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11235
11009
  }
11236
11010
  ]
11237
11011
  ];
11238
- const SkipForward2 = createLucideIcon2("skip-forward", __iconNode$9);
11239
- const __iconNode$8 = [
11012
+ const SkipForward2 = createLucideIcon2("skip-forward", __iconNode$a2);
11013
+ const __iconNode$92 = [
11014
+ [
11015
+ "path",
11016
+ {
11017
+ d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
11018
+ key: "vktsd0"
11019
+ }
11020
+ ],
11021
+ [
11022
+ "circle",
11023
+ {
11024
+ cx: "7.5",
11025
+ cy: "7.5",
11026
+ r: ".5",
11027
+ fill: "currentColor",
11028
+ key: "kqv944"
11029
+ }
11030
+ ]
11031
+ ];
11032
+ const Tag = createLucideIcon2("tag", __iconNode$92);
11033
+ const __iconNode$82 = [
11240
11034
  [
11241
11035
  "path",
11242
11036
  {
@@ -11259,8 +11053,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11259
11053
  }
11260
11054
  ]
11261
11055
  ];
11262
- const TextAlignStart = createLucideIcon2("text-align-start", __iconNode$8);
11263
- const __iconNode$7 = [
11056
+ const TextAlignStart = createLucideIcon2("text-align-start", __iconNode$82);
11057
+ const __iconNode$72 = [
11264
11058
  [
11265
11059
  "circle",
11266
11060
  {
@@ -11282,8 +11076,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11282
11076
  }
11283
11077
  ]
11284
11078
  ];
11285
- const ToggleLeft = createLucideIcon2("toggle-left", __iconNode$7);
11286
- const __iconNode$6 = [
11079
+ const ToggleLeft = createLucideIcon2("toggle-left", __iconNode$72);
11080
+ const __iconNode$62 = [
11287
11081
  [
11288
11082
  "circle",
11289
11083
  {
@@ -11305,8 +11099,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11305
11099
  }
11306
11100
  ]
11307
11101
  ];
11308
- const ToggleRight = createLucideIcon2("toggle-right", __iconNode$6);
11309
- const __iconNode$5 = [
11102
+ const ToggleRight = createLucideIcon2("toggle-right", __iconNode$62);
11103
+ const __iconNode$52 = [
11310
11104
  [
11311
11105
  "path",
11312
11106
  {
@@ -11343,8 +11137,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11343
11137
  }
11344
11138
  ]
11345
11139
  ];
11346
- const Trash2 = createLucideIcon2("trash-2", __iconNode$5);
11347
- const __iconNode$4 = [
11140
+ const Trash2 = createLucideIcon2("trash-2", __iconNode$52);
11141
+ const __iconNode$42 = [
11348
11142
  [
11349
11143
  "path",
11350
11144
  {
@@ -11367,8 +11161,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11367
11161
  }
11368
11162
  ]
11369
11163
  ];
11370
- const Type = createLucideIcon2("type", __iconNode$4);
11371
- const __iconNode$3 = [
11164
+ const Type = createLucideIcon2("type", __iconNode$42);
11165
+ const __iconNode$32 = [
11372
11166
  [
11373
11167
  "path",
11374
11168
  {
@@ -11384,8 +11178,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11384
11178
  }
11385
11179
  ]
11386
11180
  ];
11387
- const Undo2 = createLucideIcon2("undo-2", __iconNode$3);
11388
- const __iconNode$2 = [
11181
+ const Undo2 = createLucideIcon2("undo-2", __iconNode$32);
11182
+ const __iconNode$22 = [
11389
11183
  [
11390
11184
  "path",
11391
11185
  {
@@ -11421,8 +11215,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11421
11215
  }
11422
11216
  ]
11423
11217
  ];
11424
- const Variable = createLucideIcon2("variable", __iconNode$2);
11425
- const __iconNode$1 = [
11218
+ const Variable = createLucideIcon2("variable", __iconNode$22);
11219
+ const __iconNode$12 = [
11426
11220
  [
11427
11221
  "path",
11428
11222
  {
@@ -11438,8 +11232,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11438
11232
  }
11439
11233
  ]
11440
11234
  ];
11441
- const X2 = createLucideIcon2("x", __iconNode$1);
11442
- const __iconNode = [
11235
+ const X2 = createLucideIcon2("x", __iconNode$12);
11236
+ const __iconNode2 = [
11443
11237
  [
11444
11238
  "circle",
11445
11239
  {
@@ -11480,7 +11274,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
11480
11274
  }
11481
11275
  ]
11482
11276
  ];
11483
- const ZoomIn = createLucideIcon2("zoom-in", __iconNode);
11277
+ const ZoomIn = createLucideIcon2("zoom-in", __iconNode2);
11484
11278
  const BRANCH_COLORS = {
11485
11279
  yes: "#22C55E"
11486
11280
  };
@@ -14460,6 +14254,388 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
14460
14254
  ]
14461
14255
  }
14462
14256
  },
14257
+ switch: {
14258
+ name: "switch",
14259
+ label: "Switch",
14260
+ category: "control",
14261
+ description: "Match a value against cases (switch/case)",
14262
+ arity: {
14263
+ type: "special",
14264
+ min: 2,
14265
+ args: [
14266
+ {
14267
+ name: "discriminant",
14268
+ label: "Value",
14269
+ type: "any",
14270
+ required: true
14271
+ },
14272
+ {
14273
+ name: "cases",
14274
+ label: "Cases",
14275
+ type: "array",
14276
+ required: true
14277
+ },
14278
+ {
14279
+ name: "default",
14280
+ label: "Default",
14281
+ type: "any",
14282
+ required: false
14283
+ }
14284
+ ]
14285
+ },
14286
+ help: {
14287
+ summary: "Evaluate a value once and match it against case/result pairs",
14288
+ details: "Evaluates the discriminant expression once, then compares it against each case value using strict equality. Returns the result of the first matching case, or the default value if no case matches. If no default is provided and nothing matches, returns null.",
14289
+ returnType: "any",
14290
+ examples: [
14291
+ {
14292
+ title: "Simple string matching",
14293
+ rule: {
14294
+ switch: [
14295
+ {
14296
+ var: "color"
14297
+ },
14298
+ [
14299
+ [
14300
+ "red",
14301
+ "stop"
14302
+ ],
14303
+ [
14304
+ "green",
14305
+ "go"
14306
+ ]
14307
+ ],
14308
+ "unknown"
14309
+ ]
14310
+ },
14311
+ data: {
14312
+ color: "red"
14313
+ },
14314
+ result: "stop"
14315
+ },
14316
+ {
14317
+ title: "HTTP status codes",
14318
+ rule: {
14319
+ switch: [
14320
+ {
14321
+ var: "status"
14322
+ },
14323
+ [
14324
+ [
14325
+ 200,
14326
+ "OK"
14327
+ ],
14328
+ [
14329
+ 404,
14330
+ "Not Found"
14331
+ ],
14332
+ [
14333
+ 500,
14334
+ "Error"
14335
+ ]
14336
+ ],
14337
+ "Unknown"
14338
+ ]
14339
+ },
14340
+ data: {
14341
+ status: 404
14342
+ },
14343
+ result: "Not Found"
14344
+ },
14345
+ {
14346
+ title: "Computed discriminant",
14347
+ rule: {
14348
+ switch: [
14349
+ {
14350
+ "+": [
14351
+ {
14352
+ var: "a"
14353
+ },
14354
+ {
14355
+ var: "b"
14356
+ }
14357
+ ]
14358
+ },
14359
+ [
14360
+ [
14361
+ 10,
14362
+ "ten"
14363
+ ],
14364
+ [
14365
+ 20,
14366
+ "twenty"
14367
+ ]
14368
+ ],
14369
+ "other"
14370
+ ]
14371
+ },
14372
+ data: {
14373
+ a: 7,
14374
+ b: 3
14375
+ },
14376
+ result: "ten"
14377
+ },
14378
+ {
14379
+ title: "Expression as result",
14380
+ rule: {
14381
+ switch: [
14382
+ {
14383
+ var: "tier"
14384
+ },
14385
+ [
14386
+ [
14387
+ "gold",
14388
+ {
14389
+ "*": [
14390
+ {
14391
+ var: "price"
14392
+ },
14393
+ 0.8
14394
+ ]
14395
+ }
14396
+ ],
14397
+ [
14398
+ "silver",
14399
+ {
14400
+ "*": [
14401
+ {
14402
+ var: "price"
14403
+ },
14404
+ 0.9
14405
+ ]
14406
+ }
14407
+ ]
14408
+ ],
14409
+ {
14410
+ var: "price"
14411
+ }
14412
+ ]
14413
+ },
14414
+ data: {
14415
+ tier: "gold",
14416
+ price: 100
14417
+ },
14418
+ result: 80
14419
+ }
14420
+ ],
14421
+ notes: [
14422
+ "Pattern: [discriminant, [[case1, result1], [case2, result2], ...], default]",
14423
+ "Uses strict equality (type-sensitive)",
14424
+ "First matching case wins",
14425
+ "Only the matched result is evaluated (short-circuit)",
14426
+ '"match" is an alias for "switch"'
14427
+ ],
14428
+ seeAlso: [
14429
+ "if",
14430
+ "?:",
14431
+ "=="
14432
+ ]
14433
+ },
14434
+ ui: {
14435
+ icon: "git-branch",
14436
+ shortLabel: "switch",
14437
+ nodeType: "decision",
14438
+ collapsible: true,
14439
+ addArgumentLabel: "Add Case"
14440
+ },
14441
+ panel: {
14442
+ sections: [
14443
+ {
14444
+ id: "discriminant",
14445
+ title: "Match Value",
14446
+ fields: [
14447
+ {
14448
+ id: "discriminant",
14449
+ label: "Value",
14450
+ inputType: "expression",
14451
+ required: true,
14452
+ helpText: "Expression to evaluate and match against cases"
14453
+ }
14454
+ ]
14455
+ },
14456
+ {
14457
+ id: "cases",
14458
+ title: "Cases",
14459
+ fields: [
14460
+ {
14461
+ id: "caseCount",
14462
+ label: "Number of Cases",
14463
+ inputType: "number",
14464
+ min: 1,
14465
+ max: 50,
14466
+ defaultValue: 1,
14467
+ helpText: "Number of case/result pairs"
14468
+ },
14469
+ {
14470
+ id: "case",
14471
+ label: "Case",
14472
+ inputType: "expression",
14473
+ repeatable: true,
14474
+ helpText: "Case value and result pairs"
14475
+ }
14476
+ ]
14477
+ },
14478
+ {
14479
+ id: "default",
14480
+ title: "Default",
14481
+ fields: [
14482
+ {
14483
+ id: "hasDefault",
14484
+ label: "Has Default",
14485
+ inputType: "boolean",
14486
+ defaultValue: false
14487
+ },
14488
+ {
14489
+ id: "default",
14490
+ label: "Default",
14491
+ inputType: "expression",
14492
+ showWhen: [
14493
+ {
14494
+ field: "hasDefault",
14495
+ operator: "equals",
14496
+ value: true
14497
+ }
14498
+ ],
14499
+ helpText: "Value returned if no cases match"
14500
+ }
14501
+ ]
14502
+ }
14503
+ ]
14504
+ }
14505
+ },
14506
+ match: {
14507
+ name: "match",
14508
+ label: "Match",
14509
+ category: "control",
14510
+ description: "Match a value against cases (alias for switch)",
14511
+ arity: {
14512
+ type: "special",
14513
+ min: 2,
14514
+ args: [
14515
+ {
14516
+ name: "discriminant",
14517
+ label: "Value",
14518
+ type: "any",
14519
+ required: true
14520
+ },
14521
+ {
14522
+ name: "cases",
14523
+ label: "Cases",
14524
+ type: "array",
14525
+ required: true
14526
+ },
14527
+ {
14528
+ name: "default",
14529
+ label: "Default",
14530
+ type: "any",
14531
+ required: false
14532
+ }
14533
+ ]
14534
+ },
14535
+ help: {
14536
+ summary: "Evaluate a value once and match it against case/result pairs (alias for switch)",
14537
+ details: 'Identical to "switch". Evaluates the discriminant expression once, then compares it against each case value using strict equality.',
14538
+ returnType: "any",
14539
+ examples: [
14540
+ {
14541
+ title: "Simple matching",
14542
+ rule: {
14543
+ match: [
14544
+ {
14545
+ var: "color"
14546
+ },
14547
+ [
14548
+ [
14549
+ "red",
14550
+ "stop"
14551
+ ],
14552
+ [
14553
+ "green",
14554
+ "go"
14555
+ ]
14556
+ ],
14557
+ "unknown"
14558
+ ]
14559
+ },
14560
+ data: {
14561
+ color: "green"
14562
+ },
14563
+ result: "go"
14564
+ }
14565
+ ],
14566
+ notes: [
14567
+ 'Alias for "switch"',
14568
+ 'See "switch" for full documentation'
14569
+ ],
14570
+ seeAlso: [
14571
+ "switch",
14572
+ "if",
14573
+ "?:"
14574
+ ]
14575
+ },
14576
+ ui: {
14577
+ icon: "git-branch",
14578
+ shortLabel: "match",
14579
+ nodeType: "decision",
14580
+ collapsible: true,
14581
+ addArgumentLabel: "Add Case"
14582
+ },
14583
+ panel: {
14584
+ sections: [
14585
+ {
14586
+ id: "discriminant",
14587
+ title: "Match Value",
14588
+ fields: [
14589
+ {
14590
+ id: "discriminant",
14591
+ label: "Value",
14592
+ inputType: "expression",
14593
+ required: true,
14594
+ helpText: "Expression to evaluate and match against cases"
14595
+ }
14596
+ ]
14597
+ },
14598
+ {
14599
+ id: "cases",
14600
+ title: "Cases",
14601
+ fields: [
14602
+ {
14603
+ id: "case",
14604
+ label: "Case",
14605
+ inputType: "expression",
14606
+ repeatable: true,
14607
+ helpText: "Case value and result pairs"
14608
+ }
14609
+ ]
14610
+ },
14611
+ {
14612
+ id: "default",
14613
+ title: "Default",
14614
+ fields: [
14615
+ {
14616
+ id: "hasDefault",
14617
+ label: "Has Default",
14618
+ inputType: "boolean",
14619
+ defaultValue: false
14620
+ },
14621
+ {
14622
+ id: "default",
14623
+ label: "Default",
14624
+ inputType: "expression",
14625
+ showWhen: [
14626
+ {
14627
+ field: "hasDefault",
14628
+ operator: "equals",
14629
+ value: true
14630
+ }
14631
+ ],
14632
+ helpText: "Value returned if no cases match"
14633
+ }
14634
+ ]
14635
+ }
14636
+ ]
14637
+ }
14638
+ },
14463
14639
  "??": {
14464
14640
  name: "??",
14465
14641
  label: "Coalesce",
@@ -18500,6 +18676,23 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
18500
18676
  }
18501
18677
  return parts.join(" ");
18502
18678
  }
18679
+ if (op === "switch" || op === "match") {
18680
+ const parts = [
18681
+ `${op}(${toText(args[0])})`
18682
+ ];
18683
+ if (args.length >= 2 && Array.isArray(args[1])) {
18684
+ const cases = args[1];
18685
+ for (const c of cases) {
18686
+ if (Array.isArray(c) && c.length >= 2) {
18687
+ parts.push(`${toText(c[0])}: ${toText(c[1])}`);
18688
+ }
18689
+ }
18690
+ }
18691
+ if (args.length >= 3) {
18692
+ parts.push(`default: ${toText(args[2])}`);
18693
+ }
18694
+ return parts.join(", ");
18695
+ }
18503
18696
  return `${op}(${args.map((a) => toText(a)).join(", ")})`;
18504
18697
  }
18505
18698
  return String(val);
@@ -18587,7 +18780,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
18587
18780
  "layers": Layers2,
18588
18781
  "clock": Clock2,
18589
18782
  "alert-circle": CircleAlert2,
18590
- "arrow-up": ArrowUp
18783
+ "arrow-up": ArrowUp,
18784
+ "tag": Tag
18591
18785
  };
18592
18786
  function Icon2({ name, size = 14, className, style: style2 }) {
18593
18787
  const IconComponent = ICON_COMPONENTS[name];
@@ -19318,6 +19512,173 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
19318
19512
  }
19319
19513
  return nodeId;
19320
19514
  }
19515
+ function convertSwitch(operator, switchArgs, context, convertValue2) {
19516
+ const parentInfo = getParentInfo(context);
19517
+ const nodeId = v4();
19518
+ const cells = [];
19519
+ let cellIndex = 0;
19520
+ let branchIndex = 0;
19521
+ if (switchArgs.length >= 1) {
19522
+ const discriminant = switchArgs[0];
19523
+ if (isSimpleOperand(discriminant)) {
19524
+ cells.push({
19525
+ type: "inline",
19526
+ icon: "diamond",
19527
+ rowLabel: "Match",
19528
+ label: formatOperandLabel(discriminant),
19529
+ index: cellIndex
19530
+ });
19531
+ } else {
19532
+ const discBranchId = convertValue2(discriminant, {
19533
+ nodes: context.nodes,
19534
+ edges: context.edges,
19535
+ parentId: nodeId,
19536
+ argIndex: 0,
19537
+ preserveStructure: context.preserveStructure
19538
+ });
19539
+ context.edges.push(createBranchEdge(nodeId, discBranchId, branchIndex));
19540
+ cells.push({
19541
+ type: "branch",
19542
+ icon: "diamond",
19543
+ rowLabel: "Match",
19544
+ label: generateExpressionText(discriminant, 40),
19545
+ branchId: discBranchId,
19546
+ index: cellIndex
19547
+ });
19548
+ branchIndex++;
19549
+ }
19550
+ cellIndex++;
19551
+ }
19552
+ if (switchArgs.length >= 2) {
19553
+ const cases = switchArgs[1];
19554
+ const casePairs = Array.isArray(cases) ? cases : [];
19555
+ for (let i = 0; i < casePairs.length; i++) {
19556
+ const pair = casePairs[i];
19557
+ if (!Array.isArray(pair) || pair.length < 2) continue;
19558
+ const caseValue = pair[0];
19559
+ const resultValue = pair[1];
19560
+ if (isSimpleOperand(caseValue)) {
19561
+ cells.push({
19562
+ type: "inline",
19563
+ icon: "tag",
19564
+ rowLabel: "Case",
19565
+ label: formatOperandLabel(caseValue),
19566
+ index: cellIndex
19567
+ });
19568
+ } else {
19569
+ const caseBranchId = convertValue2(caseValue, {
19570
+ nodes: context.nodes,
19571
+ edges: context.edges,
19572
+ parentId: nodeId,
19573
+ argIndex: cellIndex,
19574
+ preserveStructure: context.preserveStructure
19575
+ });
19576
+ context.edges.push(createBranchEdge(nodeId, caseBranchId, branchIndex));
19577
+ cells.push({
19578
+ type: "branch",
19579
+ icon: "tag",
19580
+ rowLabel: "Case",
19581
+ label: generateExpressionText(caseValue, 40),
19582
+ branchId: caseBranchId,
19583
+ index: cellIndex
19584
+ });
19585
+ branchIndex++;
19586
+ }
19587
+ cellIndex++;
19588
+ if (isSimpleOperand(resultValue)) {
19589
+ cells.push({
19590
+ type: "inline",
19591
+ icon: "check",
19592
+ rowLabel: "Then",
19593
+ label: formatOperandLabel(resultValue),
19594
+ index: cellIndex
19595
+ });
19596
+ } else {
19597
+ const resultBranchId = convertValue2(resultValue, {
19598
+ nodes: context.nodes,
19599
+ edges: context.edges,
19600
+ parentId: nodeId,
19601
+ argIndex: cellIndex,
19602
+ branchType: "yes",
19603
+ preserveStructure: context.preserveStructure
19604
+ });
19605
+ context.edges.push(createBranchEdge(nodeId, resultBranchId, branchIndex));
19606
+ cells.push({
19607
+ type: "branch",
19608
+ icon: "check",
19609
+ rowLabel: "Then",
19610
+ label: generateExpressionText(resultValue, 40),
19611
+ branchId: resultBranchId,
19612
+ index: cellIndex
19613
+ });
19614
+ branchIndex++;
19615
+ }
19616
+ cellIndex++;
19617
+ }
19618
+ }
19619
+ if (switchArgs.length >= 3) {
19620
+ const defaultValue = switchArgs[2];
19621
+ if (isSimpleOperand(defaultValue)) {
19622
+ cells.push({
19623
+ type: "inline",
19624
+ icon: "x",
19625
+ rowLabel: "Default",
19626
+ label: formatOperandLabel(defaultValue),
19627
+ index: cellIndex
19628
+ });
19629
+ } else {
19630
+ const defaultBranchId = convertValue2(defaultValue, {
19631
+ nodes: context.nodes,
19632
+ edges: context.edges,
19633
+ parentId: nodeId,
19634
+ argIndex: cellIndex,
19635
+ branchType: "no",
19636
+ preserveStructure: context.preserveStructure
19637
+ });
19638
+ context.edges.push(createBranchEdge(nodeId, defaultBranchId, branchIndex));
19639
+ cells.push({
19640
+ type: "branch",
19641
+ icon: "x",
19642
+ rowLabel: "Default",
19643
+ label: generateExpressionText(defaultValue, 40),
19644
+ branchId: defaultBranchId,
19645
+ index: cellIndex
19646
+ });
19647
+ }
19648
+ }
19649
+ const originalExpr = {
19650
+ [operator]: switchArgs
19651
+ };
19652
+ const expressionText = generateExpressionText(originalExpr);
19653
+ const label = operator === "match" ? "Match / Case" : "Switch / Case";
19654
+ const switchNode = {
19655
+ id: nodeId,
19656
+ type: "operator",
19657
+ position: {
19658
+ x: 0,
19659
+ y: 0
19660
+ },
19661
+ data: {
19662
+ type: "operator",
19663
+ operator,
19664
+ category: "control",
19665
+ label,
19666
+ icon: "diamond",
19667
+ cells,
19668
+ collapsed: false,
19669
+ expressionText,
19670
+ parentId: parentInfo.parentId,
19671
+ argIndex: parentInfo.argIndex,
19672
+ branchType: parentInfo.branchType,
19673
+ expression: originalExpr
19674
+ }
19675
+ };
19676
+ context.nodes.push(switchNode);
19677
+ if (parentInfo.parentId && !parentInfo.branchType) {
19678
+ context.edges.push(createArgEdge(parentInfo.parentId, nodeId, parentInfo.argIndex ?? 0));
19679
+ }
19680
+ return nodeId;
19681
+ }
19321
19682
  function convertOperator$1(operator, operandArray, context, convertValue2) {
19322
19683
  const nodeId = v4();
19323
19684
  const op = getOperator(operator);
@@ -19523,6 +19884,12 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
19523
19884
  ];
19524
19885
  return convertIfElse(ifArgs, context, convertValue);
19525
19886
  }
19887
+ if (operator === "switch" || operator === "match") {
19888
+ const switchArgs = Array.isArray(operands) ? operands : [
19889
+ operands
19890
+ ];
19891
+ return convertSwitch(operator, switchArgs, context, convertValue);
19892
+ }
19526
19893
  if (isVariableOperator(operator)) {
19527
19894
  return convertVariable(operator, operands, context, convertValue);
19528
19895
  }
@@ -19689,20 +20056,36 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
19689
20056
  context.edges.push(createArgEdge(parentInfo.parentId, nodeId, parentInfo.argIndex ?? 0));
19690
20057
  }
19691
20058
  }
20059
+ function deepEqual(a, b) {
20060
+ if (a === b) return true;
20061
+ if (a === null || b === null || typeof a !== typeof b) return a === b;
20062
+ if (Array.isArray(a)) {
20063
+ if (!Array.isArray(b) || a.length !== b.length) return false;
20064
+ return a.every((v2, i) => deepEqual(v2, b[i]));
20065
+ }
20066
+ if (typeof a === "object") {
20067
+ const aObj = a;
20068
+ const bObj = b;
20069
+ const aKeys = Object.keys(aObj);
20070
+ const bKeys = Object.keys(bObj);
20071
+ if (aKeys.length !== bKeys.length) return false;
20072
+ return aKeys.every((k2) => k2 in bObj && deepEqual(aObj[k2], bObj[k2]));
20073
+ }
20074
+ return false;
20075
+ }
19692
20076
  function findMatchingChild(operand, children2, usedIndices) {
19693
- const operandStr = JSON.stringify(operand);
19694
20077
  for (let i = 0; i < children2.length; i++) {
19695
20078
  if (usedIndices.has(i)) continue;
19696
20079
  try {
19697
- const childExprStr = JSON.stringify(JSON.parse(children2[i].expression));
19698
- if (childExprStr === operandStr) {
20080
+ const childExpr = JSON.parse(children2[i].expression);
20081
+ if (deepEqual(operand, childExpr)) {
19699
20082
  return {
19700
20083
  child: children2[i],
19701
20084
  index: i
19702
20085
  };
19703
20086
  }
19704
20087
  } catch {
19705
- if (children2[i].expression === operandStr) {
20088
+ if (children2[i].expression === JSON.stringify(operand)) {
19706
20089
  return {
19707
20090
  child: children2[i],
19708
20091
  index: i
@@ -20081,6 +20464,176 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
20081
20464
  context.edges.push(createArgEdge(parentInfo.parentId, nodeId, parentInfo.argIndex ?? 0));
20082
20465
  }
20083
20466
  }
20467
+ function createSwitchNodeFromTrace(nodeId, expression, children2, context, parentInfo, processExpressionNode2, createFallbackNode2) {
20468
+ const obj = expression;
20469
+ const operator = Object.keys(obj)[0];
20470
+ const switchArgs = obj[operator];
20471
+ const usedChildIndices = /* @__PURE__ */ new Set();
20472
+ const cells = [];
20473
+ let cellIndex = 0;
20474
+ let branchIndex = 0;
20475
+ function processBranch(value, argIndex, branchType) {
20476
+ let branchId;
20477
+ const match = findMatchingChild(value, children2, usedChildIndices);
20478
+ if (match) {
20479
+ usedChildIndices.add(match.index);
20480
+ branchId = processExpressionNode2(match.child, context, {
20481
+ parentId: nodeId,
20482
+ argIndex,
20483
+ branchType
20484
+ });
20485
+ } else {
20486
+ const nodeType = determineNodeType(value, context.preserveStructure);
20487
+ const nextUnused = nodeType !== "literal" ? getNextUnusedChild(children2, usedChildIndices) : null;
20488
+ if (nextUnused) {
20489
+ usedChildIndices.add(nextUnused.index);
20490
+ branchId = processExpressionNode2(nextUnused.child, context, {
20491
+ parentId: nodeId,
20492
+ argIndex,
20493
+ branchType
20494
+ }, value);
20495
+ } else {
20496
+ branchId = `${nodeId}-arg-${argIndex}`;
20497
+ createFallbackNode2(branchId, value, context, {
20498
+ parentId: nodeId,
20499
+ argIndex,
20500
+ branchType
20501
+ });
20502
+ }
20503
+ }
20504
+ return branchId;
20505
+ }
20506
+ if (switchArgs.length >= 1) {
20507
+ const discriminant = switchArgs[0];
20508
+ if (isSimpleOperand(discriminant)) {
20509
+ cells.push({
20510
+ type: "inline",
20511
+ icon: "diamond",
20512
+ rowLabel: "Match",
20513
+ label: formatOperandLabel(discriminant),
20514
+ index: cellIndex
20515
+ });
20516
+ } else {
20517
+ const discBranchId = processBranch(discriminant, 0);
20518
+ context.edges.push(createBranchEdge(nodeId, discBranchId, branchIndex));
20519
+ cells.push({
20520
+ type: "branch",
20521
+ icon: "diamond",
20522
+ rowLabel: "Match",
20523
+ label: generateExpressionText(discriminant, 40),
20524
+ branchId: discBranchId,
20525
+ index: cellIndex
20526
+ });
20527
+ branchIndex++;
20528
+ }
20529
+ cellIndex++;
20530
+ }
20531
+ if (switchArgs.length >= 2) {
20532
+ const cases = switchArgs[1];
20533
+ const casePairs = Array.isArray(cases) ? cases : [];
20534
+ for (let i = 0; i < casePairs.length; i++) {
20535
+ const pair = casePairs[i];
20536
+ if (!Array.isArray(pair) || pair.length < 2) continue;
20537
+ const caseValue = pair[0];
20538
+ const resultValue = pair[1];
20539
+ if (isSimpleOperand(caseValue)) {
20540
+ cells.push({
20541
+ type: "inline",
20542
+ icon: "tag",
20543
+ rowLabel: "Case",
20544
+ label: formatOperandLabel(caseValue),
20545
+ index: cellIndex
20546
+ });
20547
+ } else {
20548
+ const caseBranchId = processBranch(caseValue, cellIndex);
20549
+ context.edges.push(createBranchEdge(nodeId, caseBranchId, branchIndex));
20550
+ cells.push({
20551
+ type: "branch",
20552
+ icon: "tag",
20553
+ rowLabel: "Case",
20554
+ label: generateExpressionText(caseValue, 40),
20555
+ branchId: caseBranchId,
20556
+ index: cellIndex
20557
+ });
20558
+ branchIndex++;
20559
+ }
20560
+ cellIndex++;
20561
+ if (isSimpleOperand(resultValue)) {
20562
+ cells.push({
20563
+ type: "inline",
20564
+ icon: "check",
20565
+ rowLabel: "Then",
20566
+ label: formatOperandLabel(resultValue),
20567
+ index: cellIndex
20568
+ });
20569
+ } else {
20570
+ const resultBranchId = processBranch(resultValue, cellIndex, "yes");
20571
+ context.edges.push(createBranchEdge(nodeId, resultBranchId, branchIndex));
20572
+ cells.push({
20573
+ type: "branch",
20574
+ icon: "check",
20575
+ rowLabel: "Then",
20576
+ label: generateExpressionText(resultValue, 40),
20577
+ branchId: resultBranchId,
20578
+ index: cellIndex
20579
+ });
20580
+ branchIndex++;
20581
+ }
20582
+ cellIndex++;
20583
+ }
20584
+ }
20585
+ if (switchArgs.length >= 3) {
20586
+ const defaultValue = switchArgs[2];
20587
+ if (isSimpleOperand(defaultValue)) {
20588
+ cells.push({
20589
+ type: "inline",
20590
+ icon: "x",
20591
+ rowLabel: "Default",
20592
+ label: formatOperandLabel(defaultValue),
20593
+ index: cellIndex
20594
+ });
20595
+ } else {
20596
+ const defaultBranchId = processBranch(defaultValue, cellIndex, "no");
20597
+ context.edges.push(createBranchEdge(nodeId, defaultBranchId, branchIndex));
20598
+ cells.push({
20599
+ type: "branch",
20600
+ icon: "x",
20601
+ rowLabel: "Default",
20602
+ label: generateExpressionText(defaultValue, 40),
20603
+ branchId: defaultBranchId,
20604
+ index: cellIndex
20605
+ });
20606
+ }
20607
+ }
20608
+ const expressionText = generateExpressionText(expression);
20609
+ const label = operator === "match" ? "Match / Case" : "Switch / Case";
20610
+ const switchNode = {
20611
+ id: nodeId,
20612
+ type: "operator",
20613
+ position: {
20614
+ x: 0,
20615
+ y: 0
20616
+ },
20617
+ data: {
20618
+ type: "operator",
20619
+ operator,
20620
+ category: "control",
20621
+ label,
20622
+ icon: "diamond",
20623
+ cells,
20624
+ collapsed: false,
20625
+ expressionText,
20626
+ parentId: parentInfo.parentId,
20627
+ argIndex: parentInfo.argIndex,
20628
+ branchType: parentInfo.branchType,
20629
+ expression
20630
+ }
20631
+ };
20632
+ context.nodes.push(switchNode);
20633
+ if (parentInfo.parentId && !parentInfo.branchType) {
20634
+ context.edges.push(createArgEdge(parentInfo.parentId, nodeId, parentInfo.argIndex ?? 0));
20635
+ }
20636
+ }
20084
20637
  const EXPR_PLACEHOLDER = "{{EXPR}}";
20085
20638
  const EXPR_PLACEHOLDER_QUOTED = `"${EXPR_PLACEHOLDER}"`;
20086
20639
  function isExpressionBranch(item, preserveStructure) {
@@ -20251,6 +20804,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
20251
20804
  createVariableNodeFromTrace(nodeId, expression, exprNode.children, context, parentInfo);
20252
20805
  } else if (op === "if" || op === "?:") {
20253
20806
  createIfElseNodeFromTrace(nodeId, expression, exprNode.children, context, parentInfo, processExpressionNode, createFallbackNode);
20807
+ } else if (op === "switch" || op === "match") {
20808
+ createSwitchNodeFromTrace(nodeId, expression, exprNode.children, context, parentInfo, processExpressionNode, createFallbackNode);
20254
20809
  } else {
20255
20810
  const operands = obj[op];
20256
20811
  const args = Array.isArray(operands) ? operands : [
@@ -20292,6 +20847,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
20292
20847
  createVariableNodeFromTrace(nodeId, value, [], context, parentInfo);
20293
20848
  } else if (op === "if" || op === "?:") {
20294
20849
  createIfElseNodeFromTrace(nodeId, value, [], context, parentInfo, processExpressionNode, createFallbackNode);
20850
+ } else if (op === "switch" || op === "match") {
20851
+ createSwitchNodeFromTrace(nodeId, value, [], context, parentInfo, processExpressionNode, createFallbackNode);
20295
20852
  } else {
20296
20853
  const operands = obj[op];
20297
20854
  const args = Array.isArray(operands) ? operands : [
@@ -20326,23 +20883,23 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
20326
20883
  var EDGE_KEY_DELIM = "";
20327
20884
  class Graph {
20328
20885
  constructor(opts) {
20329
- __publicField2(this, "_isDirected", true);
20330
- __publicField2(this, "_isMultigraph", false);
20331
- __publicField2(this, "_isCompound", false);
20332
- __publicField2(this, "_label");
20333
- __publicField2(this, "_defaultNodeLabelFn", () => void 0);
20334
- __publicField2(this, "_defaultEdgeLabelFn", () => void 0);
20335
- __publicField2(this, "_nodes", {});
20336
- __publicField2(this, "_in", {});
20337
- __publicField2(this, "_preds", {});
20338
- __publicField2(this, "_out", {});
20339
- __publicField2(this, "_sucs", {});
20340
- __publicField2(this, "_edgeObjs", {});
20341
- __publicField2(this, "_edgeLabels", {});
20342
- __publicField2(this, "_nodeCount", 0);
20343
- __publicField2(this, "_edgeCount", 0);
20344
- __publicField2(this, "_parent");
20345
- __publicField2(this, "_children");
20886
+ __publicField(this, "_isDirected", true);
20887
+ __publicField(this, "_isMultigraph", false);
20888
+ __publicField(this, "_isCompound", false);
20889
+ __publicField(this, "_label");
20890
+ __publicField(this, "_defaultNodeLabelFn", () => void 0);
20891
+ __publicField(this, "_defaultEdgeLabelFn", () => void 0);
20892
+ __publicField(this, "_nodes", {});
20893
+ __publicField(this, "_in", {});
20894
+ __publicField(this, "_preds", {});
20895
+ __publicField(this, "_out", {});
20896
+ __publicField(this, "_sucs", {});
20897
+ __publicField(this, "_edgeObjs", {});
20898
+ __publicField(this, "_edgeLabels", {});
20899
+ __publicField(this, "_nodeCount", 0);
20900
+ __publicField(this, "_edgeCount", 0);
20901
+ __publicField(this, "_parent");
20902
+ __publicField(this, "_children");
20346
20903
  if (opts) {
20347
20904
  this._isDirected = Object.hasOwn(opts, "directed") ? opts.directed : true;
20348
20905
  this._isMultigraph = Object.hasOwn(opts, "multigraph") ? opts.multigraph : false;
@@ -20874,8 +21431,8 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
20874
21431
  hasRequiredPriorityQueue2 = 1;
20875
21432
  class PriorityQueue {
20876
21433
  constructor() {
20877
- __publicField2(this, "_arr", []);
20878
- __publicField2(this, "_keyIndices", {});
21434
+ __publicField(this, "_arr", []);
21435
+ __publicField(this, "_keyIndices", {});
20879
21436
  }
20880
21437
  size() {
20881
21438
  return this._arr.length;
@@ -26692,7 +27249,7 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
26692
27249
  try {
26693
27250
  setLoading(true);
26694
27251
  setError(null);
26695
- const wasm2 = await import("./datalogic_wasm-RwP1VzMM-Tde_T26r.js");
27252
+ const wasm2 = await import("./datalogic_wasm-dEsk1ML--ByKZSKJe.js");
26696
27253
  await wasm2.default();
26697
27254
  if (!cancelled) {
26698
27255
  moduleRef.current = {
@@ -28977,6 +29534,9 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
28977
29534
  resultArgs.push(storedOperands[i]);
28978
29535
  }
28979
29536
  }
29537
+ if (data.operator === "switch" || data.operator === "match") {
29538
+ return convertSwitchFromCells(data, storedOperands, nodeMap);
29539
+ }
28980
29540
  if (data.operator === "val") {
28981
29541
  return convertValFromCells(data);
28982
29542
  }
@@ -28992,6 +29552,52 @@ let CATEGORY_COLORS, DataLogicEditor, operators, applyTreeLayout, jsonLogicToNod
28992
29552
  [data.operator]: resultArgs
28993
29553
  };
28994
29554
  }
29555
+ function convertSwitchFromCells(data, storedOperands, nodeMap) {
29556
+ const storedCases = Array.isArray(storedOperands[1]) ? storedOperands[1] : [];
29557
+ let discriminant = null;
29558
+ const casePairs = [];
29559
+ let defaultValue;
29560
+ let pendingCaseValue = null;
29561
+ let caseIndex = 0;
29562
+ for (const cell of data.cells) {
29563
+ if (cell.rowLabel === "Match") {
29564
+ discriminant = resolveCellValue(cell, storedOperands[0], nodeMap);
29565
+ } else if (cell.rowLabel === "Case") {
29566
+ const storedPair = storedCases[caseIndex];
29567
+ pendingCaseValue = resolveCellValue(cell, (storedPair == null ? void 0 : storedPair[0]) ?? null, nodeMap);
29568
+ } else if (cell.rowLabel === "Then" && pendingCaseValue !== null) {
29569
+ const storedPair = storedCases[caseIndex];
29570
+ const resultValue = resolveCellValue(cell, (storedPair == null ? void 0 : storedPair[1]) ?? null, nodeMap);
29571
+ casePairs.push([
29572
+ pendingCaseValue,
29573
+ resultValue
29574
+ ]);
29575
+ pendingCaseValue = null;
29576
+ caseIndex++;
29577
+ } else if (cell.rowLabel === "Default") {
29578
+ defaultValue = resolveCellValue(cell, storedOperands[2] ?? null, nodeMap);
29579
+ }
29580
+ }
29581
+ const args = [
29582
+ discriminant,
29583
+ casePairs
29584
+ ];
29585
+ if (defaultValue !== void 0) {
29586
+ args.push(defaultValue);
29587
+ }
29588
+ return {
29589
+ [data.operator]: args
29590
+ };
29591
+ }
29592
+ function resolveCellValue(cell, storedValue, nodeMap) {
29593
+ if (cell.type === "branch" && cell.branchId) {
29594
+ const branchNode = nodeMap.get(cell.branchId);
29595
+ if (branchNode) {
29596
+ return convertNode(branchNode.data, nodeMap);
29597
+ }
29598
+ }
29599
+ return storedValue;
29600
+ }
28995
29601
  function convertValFromCells(data) {
28996
29602
  const scopeCell = data.cells.find((c) => c.fieldId === "scopeLevel");
28997
29603
  const pathCells = data.cells.filter((c) => c.fieldId === "path");
@@ -31884,13 +32490,13 @@ function TaskRow({
31884
32490
  "div",
31885
32491
  {
31886
32492
  className: `df-task-row ${isHighlighted ? "df-task-row-highlighted" : ""}`,
31887
- onClick: () => onSelect == null ? void 0 : onSelect(task, workflow),
32493
+ onClick: () => onSelect?.(task, workflow),
31888
32494
  role: "button",
31889
32495
  tabIndex: 0,
31890
32496
  onKeyDown: (e) => {
31891
32497
  if (e.key === "Enter" || e.key === " ") {
31892
32498
  e.preventDefault();
31893
- onSelect == null ? void 0 : onSelect(task, workflow);
32499
+ onSelect?.(task, workflow);
31894
32500
  }
31895
32501
  },
31896
32502
  children: [
@@ -31966,7 +32572,7 @@ function WorkflowCard({
31966
32572
  task,
31967
32573
  workflow,
31968
32574
  index: index2,
31969
- isHighlighted: highlightedTaskIds == null ? void 0 : highlightedTaskIds.has(task.id),
32575
+ isHighlighted: highlightedTaskIds?.has(task.id),
31970
32576
  onSelect: onTaskSelect
31971
32577
  },
31972
32578
  task.id
@@ -32238,7 +32844,6 @@ function useMappingDebugState(task, workflow, _mappingIndex) {
32238
32844
  function useValidationRuleDebugState(task, workflow, ruleIndex) {
32239
32845
  const dbgContext = useDebuggerOptional();
32240
32846
  return useMemo(() => {
32241
- var _a;
32242
32847
  if (!dbgContext || !dbgContext.state.isActive || !dbgContext.hasTrace || !dbgContext.state.trace) {
32243
32848
  return nullState;
32244
32849
  }
@@ -32265,8 +32870,8 @@ function useValidationRuleDebugState(task, workflow, ruleIndex) {
32265
32870
  const isCurrent = taskStepIndex === currentStepIndex;
32266
32871
  let hasError = false;
32267
32872
  if (taskStep.message && taskStep.message.errors.length > 0) {
32268
- const rules = (_a = task.function) == null ? void 0 : _a.input;
32269
- const rulesList = (rules == null ? void 0 : rules.rules) || [];
32873
+ const rules = task.function?.input;
32874
+ const rulesList = rules?.rules || [];
32270
32875
  const rule = rulesList[ruleIndex];
32271
32876
  if (rule) {
32272
32877
  hasError = taskStep.message.errors.some((e) => e.message.includes(rule.message));
@@ -32389,7 +32994,7 @@ function WorkflowFlowView({
32389
32994
  /* @__PURE__ */ jsx("span", { children: "Message" })
32390
32995
  ] }) }),
32391
32996
  sortedWorkflows.map((workflow) => {
32392
- const isWorkflowConditionSelected = (selection2 == null ? void 0 : selection2.type) === "workflow-condition" && selection2.workflow.id === workflow.id;
32997
+ const isWorkflowConditionSelected = selection2?.type === "workflow-condition" && selection2.workflow.id === workflow.id;
32393
32998
  return /* @__PURE__ */ jsxs("div", { className: "df-flow-node-wrapper", children: [
32394
32999
  /* @__PURE__ */ jsx("div", { className: "df-flow-connector", children: /* @__PURE__ */ jsx(ArrowRight, { size: 18 }) }),
32395
33000
  /* @__PURE__ */ jsxs("div", { className: `df-flow-column ${isWorkflowConditionSelected ? "df-flow-column-selected" : ""}`, children: [
@@ -32397,7 +33002,7 @@ function WorkflowFlowView({
32397
33002
  "div",
32398
33003
  {
32399
33004
  className: "df-flow-workflow-header",
32400
- onClick: () => onWorkflowSelect == null ? void 0 : onWorkflowSelect(workflow),
33005
+ onClick: () => onWorkflowSelect?.(workflow),
32401
33006
  children: [
32402
33007
  /* @__PURE__ */ jsxs("span", { className: "df-flow-workflow-priority", children: [
32403
33008
  "P",
@@ -32408,7 +33013,7 @@ function WorkflowFlowView({
32408
33013
  ConditionIcon,
32409
33014
  {
32410
33015
  condition: workflow.condition,
32411
- onClick: () => onWorkflowConditionClick == null ? void 0 : onWorkflowConditionClick(workflow),
33016
+ onClick: () => onWorkflowConditionClick?.(workflow),
32412
33017
  isSelected: isWorkflowConditionSelected
32413
33018
  }
32414
33019
  )
@@ -32416,12 +33021,12 @@ function WorkflowFlowView({
32416
33021
  }
32417
33022
  ),
32418
33023
  /* @__PURE__ */ jsx("div", { className: "df-flow-tasks", children: workflow.tasks.map((task, index2) => {
32419
- const isTaskSelected = (selection2 == null ? void 0 : selection2.type) === "task" && selection2.task.id === task.id;
32420
- const isTaskConditionSelected = (selection2 == null ? void 0 : selection2.type) === "task-condition" && selection2.task.id === task.id;
33024
+ const isTaskSelected = selection2?.type === "task" && selection2.task.id === task.id;
33025
+ const isTaskConditionSelected = selection2?.type === "task-condition" && selection2.task.id === task.id;
32421
33026
  return /* @__PURE__ */ jsxs(
32422
33027
  "div",
32423
33028
  {
32424
- className: `df-flow-task ${(highlightedTaskIds == null ? void 0 : highlightedTaskIds.has(task.id)) ? "df-flow-task-highlighted" : ""} ${isTaskSelected || isTaskConditionSelected ? "df-flow-task-selected" : ""}`,
33029
+ className: `df-flow-task ${highlightedTaskIds?.has(task.id) ? "df-flow-task-highlighted" : ""} ${isTaskSelected || isTaskConditionSelected ? "df-flow-task-selected" : ""}`,
32425
33030
  children: [
32426
33031
  /* @__PURE__ */ jsxs("div", { className: "df-flow-task-header", children: [
32427
33032
  /* @__PURE__ */ jsx("span", { className: "df-flow-task-index", children: index2 + 1 }),
@@ -32430,7 +33035,7 @@ function WorkflowFlowView({
32430
33035
  ConditionIcon,
32431
33036
  {
32432
33037
  condition: task.condition,
32433
- onClick: () => onTaskConditionClick == null ? void 0 : onTaskConditionClick(task, workflow),
33038
+ onClick: () => onTaskConditionClick?.(task, workflow),
32434
33039
  isSelected: isTaskConditionSelected
32435
33040
  }
32436
33041
  )
@@ -32443,7 +33048,7 @@ function WorkflowFlowView({
32443
33048
  className: "df-flow-task-details-link",
32444
33049
  onClick: (e) => {
32445
33050
  e.stopPropagation();
32446
- onTaskSelect == null ? void 0 : onTaskSelect(task, workflow);
33051
+ onTaskSelect?.(task, workflow);
32447
33052
  },
32448
33053
  title: "View task details",
32449
33054
  children: [
@@ -32497,7 +33102,7 @@ function TaskContent({ selection: selection2 }) {
32497
33102
  const functionName = task.function.name;
32498
33103
  const input = task.function.input;
32499
33104
  let debugData;
32500
- if ((dbgContext == null ? void 0 : dbgContext.state.isActive) && dbgContext.currentStep) {
33105
+ if (dbgContext?.state.isActive && dbgContext.currentStep) {
32501
33106
  const step = dbgContext.currentStep;
32502
33107
  if (step.workflow_id === selection2.workflow.id && step.task_id === task.id && step.result === "executed") {
32503
33108
  if (functionName === "map") {
@@ -32508,7 +33113,7 @@ function TaskContent({ selection: selection2 }) {
32508
33113
  }
32509
33114
  }
32510
33115
  if (functionName === "map") {
32511
- const mappings = (input == null ? void 0 : input.mappings) || [];
33116
+ const mappings = input?.mappings || [];
32512
33117
  const visualData = convertMappingsToObject(mappings);
32513
33118
  return /* @__PURE__ */ jsx("div", { className: "df-details-content", children: /* @__PURE__ */ jsx("div", { className: "df-details-logic-editor", children: /* @__PURE__ */ jsx(
32514
33119
  DataLogicEditor,
@@ -32522,7 +33127,7 @@ function TaskContent({ selection: selection2 }) {
32522
33127
  ) }) });
32523
33128
  }
32524
33129
  if (functionName === "validation" || functionName === "validate") {
32525
- const rules = (input == null ? void 0 : input.rules) || [];
33130
+ const rules = input?.rules || [];
32526
33131
  const andExpression = {
32527
33132
  and: rules.map((rule) => rule.logic)
32528
33133
  };
@@ -32555,7 +33160,7 @@ function MappingContent({ selection: selection2 }) {
32555
33160
  [mapping.path]: mapping.logic
32556
33161
  };
32557
33162
  let debugData;
32558
- if ((dbgContext == null ? void 0 : dbgContext.state.isActive) && dbgContext.currentStep) {
33163
+ if (dbgContext?.state.isActive && dbgContext.currentStep) {
32559
33164
  const step = dbgContext.currentStep;
32560
33165
  if (step.workflow_id === selection2.workflow.id && step.task_id === selection2.task.id && step.result === "executed") {
32561
33166
  debugData = getMappingContext(step, selection2.mappingIndex);
@@ -32577,7 +33182,7 @@ function ValidationRuleContent({ selection: selection2 }) {
32577
33182
  const { resolvedTheme } = useTheme();
32578
33183
  const dbgContext = useDebuggerOptional();
32579
33184
  let debugData;
32580
- if ((dbgContext == null ? void 0 : dbgContext.state.isActive) && dbgContext.currentStep) {
33185
+ if (dbgContext?.state.isActive && dbgContext.currentStep) {
32581
33186
  const step = dbgContext.currentStep;
32582
33187
  if (step.workflow_id === selection2.workflow.id && step.task_id === selection2.task.id && step.result === "executed" && step.message) {
32583
33188
  debugData = step.message.context;
@@ -32674,36 +33279,36 @@ function requireGraph() {
32674
33279
  var GRAPH_NODE = "\0";
32675
33280
  var EDGE_KEY_DELIM = "";
32676
33281
  class Graph {
33282
+ _isDirected = true;
33283
+ _isMultigraph = false;
33284
+ _isCompound = false;
33285
+ // Label for the graph itself
33286
+ _label;
33287
+ // Defaults to be set when creating a new node
33288
+ _defaultNodeLabelFn = () => void 0;
33289
+ // Defaults to be set when creating a new edge
33290
+ _defaultEdgeLabelFn = () => void 0;
33291
+ // v -> label
33292
+ _nodes = {};
33293
+ // v -> edgeObj
33294
+ _in = {};
33295
+ // u -> v -> Number
33296
+ _preds = {};
33297
+ // v -> edgeObj
33298
+ _out = {};
33299
+ // v -> w -> Number
33300
+ _sucs = {};
33301
+ // e -> edgeObj
33302
+ _edgeObjs = {};
33303
+ // e -> label
33304
+ _edgeLabels = {};
33305
+ /* Number of nodes in the graph. Should only be changed by the implementation. */
33306
+ _nodeCount = 0;
33307
+ /* Number of edges in the graph. Should only be changed by the implementation. */
33308
+ _edgeCount = 0;
33309
+ _parent;
33310
+ _children;
32677
33311
  constructor(opts) {
32678
- __publicField(this, "_isDirected", true);
32679
- __publicField(this, "_isMultigraph", false);
32680
- __publicField(this, "_isCompound", false);
32681
- // Label for the graph itself
32682
- __publicField(this, "_label");
32683
- // Defaults to be set when creating a new node
32684
- __publicField(this, "_defaultNodeLabelFn", () => void 0);
32685
- // Defaults to be set when creating a new edge
32686
- __publicField(this, "_defaultEdgeLabelFn", () => void 0);
32687
- // v -> label
32688
- __publicField(this, "_nodes", {});
32689
- // v -> edgeObj
32690
- __publicField(this, "_in", {});
32691
- // u -> v -> Number
32692
- __publicField(this, "_preds", {});
32693
- // v -> edgeObj
32694
- __publicField(this, "_out", {});
32695
- // v -> w -> Number
32696
- __publicField(this, "_sucs", {});
32697
- // e -> edgeObj
32698
- __publicField(this, "_edgeObjs", {});
32699
- // e -> label
32700
- __publicField(this, "_edgeLabels", {});
32701
- /* Number of nodes in the graph. Should only be changed by the implementation. */
32702
- __publicField(this, "_nodeCount", 0);
32703
- /* Number of edges in the graph. Should only be changed by the implementation. */
32704
- __publicField(this, "_edgeCount", 0);
32705
- __publicField(this, "_parent");
32706
- __publicField(this, "_children");
32707
33312
  if (opts) {
32708
33313
  this._isDirected = Object.hasOwn(opts, "directed") ? opts.directed : true;
32709
33314
  this._isMultigraph = Object.hasOwn(opts, "multigraph") ? opts.multigraph : false;
@@ -33378,10 +33983,8 @@ function requirePriorityQueue() {
33378
33983
  if (hasRequiredPriorityQueue) return priorityQueue;
33379
33984
  hasRequiredPriorityQueue = 1;
33380
33985
  class PriorityQueue {
33381
- constructor() {
33382
- __publicField(this, "_arr", []);
33383
- __publicField(this, "_keyIndices", {});
33384
- }
33986
+ _arr = [];
33987
+ _keyIndices = {};
33385
33988
  /**
33386
33989
  * Returns the number of elements in the queue. Takes `O(1)` time.
33387
33990
  */
@@ -36569,7 +37172,7 @@ function WorkflowFlowDiagram({ workflow, onSelect }) {
36569
37172
  const label = node.data.label ?? "";
36570
37173
  const taskName = label.replace("\nCondition", "");
36571
37174
  const task = workflow.tasks.find((t) => t.name === taskName);
36572
- if (task == null ? void 0 : task.condition) {
37175
+ if (task?.condition) {
36573
37176
  onSelect({
36574
37177
  type: "task-condition",
36575
37178
  task,
@@ -36800,7 +37403,7 @@ function GroupFlowDiagram({ workflows, name: _name, onSelect }) {
36800
37403
  const workflowId = node.data.workflowId;
36801
37404
  if (workflowId) {
36802
37405
  const workflow = workflows.find((w) => w.id === workflowId);
36803
- if (workflow == null ? void 0 : workflow.condition) {
37406
+ if (workflow?.condition) {
36804
37407
  onSelect({
36805
37408
  type: "workflow-condition",
36806
37409
  workflow,
@@ -36857,7 +37460,7 @@ function DetailsPanel({ selection: selection2, onSelect }) {
36857
37460
  return /* @__PURE__ */ jsx("div", { className: "df-details-panel", children: /* @__PURE__ */ jsx(WorkflowFlowDiagram, { workflow: selection2.workflow, onSelect }) });
36858
37461
  }
36859
37462
  let conditionDebugData;
36860
- if ((dbgContext == null ? void 0 : dbgContext.state.isActive) && dbgContext.state.trace && dbgContext.state.currentStepIndex >= 0) {
37463
+ if (dbgContext?.state.isActive && dbgContext.state.trace && dbgContext.state.currentStepIndex >= 0) {
36861
37464
  const { trace, currentStepIndex } = dbgContext.state;
36862
37465
  if (selection2.type === "workflow-condition" || selection2.type === "task-condition") {
36863
37466
  const prevMessage = currentStepIndex > 0 ? getMessageAtStep(trace, currentStepIndex - 1) : null;
@@ -36913,11 +37516,11 @@ function TreeNode({
36913
37516
  };
36914
37517
  const handleClick = (e) => {
36915
37518
  e.stopPropagation();
36916
- onClick == null ? void 0 : onClick();
37519
+ onClick?.();
36917
37520
  };
36918
37521
  const handleToggle = (e) => {
36919
37522
  e.stopPropagation();
36920
- onToggle == null ? void 0 : onToggle();
37523
+ onToggle?.();
36921
37524
  };
36922
37525
  const debugStateClass = debugState ? `df-tree-node-${debugState}` : "";
36923
37526
  const currentClass = isCurrent ? "df-tree-node-current-step" : "";
@@ -37028,8 +37631,8 @@ function TaskNode({
37028
37631
  const functionName = task.function.name;
37029
37632
  const input = task.function.input;
37030
37633
  const hasCondition2 = task.condition !== void 0 && task.condition !== null && task.condition !== true;
37031
- const mappings = functionName === "map" ? (input == null ? void 0 : input.mappings) || [] : [];
37032
- const rules = functionName === "validation" || functionName === "validate" ? (input == null ? void 0 : input.rules) || [] : [];
37634
+ const mappings = functionName === "map" ? input?.mappings || [] : [];
37635
+ const rules = functionName === "validation" || functionName === "validate" ? input?.rules || [] : [];
37033
37636
  const hasChildren = hasCondition2 || mappings.length > 0 || rules.length > 0;
37034
37637
  const isTaskSelected = selection2.type === "task" && selection2.task.id === task.id && selection2.workflow.id === workflow.id;
37035
37638
  const taskDebugState = useTaskDebugState(task, workflow);
@@ -37352,19 +37955,18 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
37352
37955
  const lastSelectedRef = useRef(null);
37353
37956
  const treeContainerRef = useRef(null);
37354
37957
  useEffect(() => {
37355
- var _a, _b;
37356
- if (!debugMode || !(effectiveDebugContext == null ? void 0 : effectiveDebugContext.currentStep) || effectiveDebugContext.state.currentStepIndex < 0) {
37958
+ if (!debugMode || !effectiveDebugContext?.currentStep || effectiveDebugContext.state.currentStepIndex < 0) {
37357
37959
  return;
37358
37960
  }
37359
37961
  const { workflow_id, task_id } = effectiveDebugContext.currentStep;
37360
- if (((_a = lastSelectedRef.current) == null ? void 0 : _a.workflowId) === workflow_id && ((_b = lastSelectedRef.current) == null ? void 0 : _b.taskId) === task_id) {
37962
+ if (lastSelectedRef.current?.workflowId === workflow_id && lastSelectedRef.current?.taskId === task_id) {
37361
37963
  return;
37362
37964
  }
37363
37965
  const workflow = workflows.find((w) => w.id === workflow_id);
37364
37966
  setExpandedNodes((prev) => {
37365
37967
  const next = new Set(prev);
37366
37968
  next.add(NODE_IDS.ROOT);
37367
- if (workflow == null ? void 0 : workflow.path) {
37969
+ if (workflow?.path) {
37368
37970
  getParentFolderIds(workflow.path).forEach((id2) => next.add(id2));
37369
37971
  }
37370
37972
  next.add(NODE_IDS.workflow(workflow_id));
@@ -37374,7 +37976,7 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
37374
37976
  return next;
37375
37977
  });
37376
37978
  if (task_id) {
37377
- const task = workflow == null ? void 0 : workflow.tasks.find((t) => t.id === task_id);
37979
+ const task = workflow?.tasks.find((t) => t.id === task_id);
37378
37980
  if (workflow && task) {
37379
37981
  lastSelectedRef.current = { workflowId: workflow_id, taskId: task_id };
37380
37982
  onSelect({ type: "task", task, workflow });
@@ -37383,8 +37985,7 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
37383
37985
  lastSelectedRef.current = { workflowId: workflow_id };
37384
37986
  }
37385
37987
  setTimeout(() => {
37386
- var _a2;
37387
- const currentStepElement = (_a2 = treeContainerRef.current) == null ? void 0 : _a2.querySelector('[data-current-step="true"]');
37988
+ const currentStepElement = treeContainerRef.current?.querySelector('[data-current-step="true"]');
37388
37989
  if (currentStepElement) {
37389
37990
  currentStepElement.scrollIntoView({
37390
37991
  behavior: "smooth",
@@ -37392,7 +37993,7 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
37392
37993
  });
37393
37994
  }
37394
37995
  }, PLAYBACK.AUTO_SCROLL_DELAY_MS);
37395
- }, [debugMode, effectiveDebugContext == null ? void 0 : effectiveDebugContext.currentStep, effectiveDebugContext == null ? void 0 : effectiveDebugContext.state.currentStepIndex, workflows, onSelect]);
37996
+ }, [debugMode, effectiveDebugContext?.currentStep, effectiveDebugContext?.state.currentStepIndex, workflows, onSelect]);
37396
37997
  const toggleNode = (id2) => {
37397
37998
  setExpandedNodes((prev) => {
37398
37999
  const next = new Set(prev);
@@ -38100,7 +38701,7 @@ function Oe({ original: e, modified: r, language: n, originalLanguage: t, modifi
38100
38701
  let [M, O] = useState(false), [T, s] = useState(true), u = useRef(null), c = useRef(null), w = useRef(null), d = useRef(q), o = useRef(A), b = useRef(false);
38101
38702
  k(() => {
38102
38703
  let i = loader.init();
38103
- return i.then((f) => (c.current = f) && s(false)).catch((f) => (f == null ? void 0 : f.type) !== "cancelation" && console.error("Monaco initialization: error:", f)), () => u.current ? I() : i.cancel();
38704
+ return i.then((f) => (c.current = f) && s(false)).catch((f) => f?.type !== "cancelation" && console.error("Monaco initialization: error:", f)), () => u.current ? I() : i.cancel();
38104
38705
  }), l(() => {
38105
38706
  if (u.current && c.current) {
38106
38707
  let i = u.current.getOriginalEditor(), f = h(c.current, e || "", t || n || "text", m || "");
@@ -38115,27 +38716,22 @@ function Oe({ original: e, modified: r, language: n, originalLanguage: t, modifi
38115
38716
  let i = u.current.getModifiedEditor();
38116
38717
  i.getOption(c.current.editor.EditorOption.readOnly) ? i.setValue(r || "") : r !== i.getValue() && (i.executeEdits("", [{ range: i.getModel().getFullModelRange(), text: r || "", forceMoveMarkers: true }]), i.pushUndoStop());
38117
38718
  }, [r], M), l(() => {
38118
- var _a, _b;
38119
- (_b = (_a = u.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.original.setValue(e || "");
38719
+ u.current?.getModel()?.original.setValue(e || "");
38120
38720
  }, [e], M), l(() => {
38121
38721
  let { original: i, modified: f } = u.current.getModel();
38122
38722
  c.current.editor.setModelLanguage(i, t || n || "text"), c.current.editor.setModelLanguage(f, a || n || "text");
38123
38723
  }, [n, t, a], M), l(() => {
38124
- var _a;
38125
- (_a = c.current) == null ? void 0 : _a.editor.setTheme(x);
38724
+ c.current?.editor.setTheme(x);
38126
38725
  }, [x], M), l(() => {
38127
- var _a;
38128
- (_a = u.current) == null ? void 0 : _a.updateOptions(y);
38726
+ u.current?.updateOptions(y);
38129
38727
  }, [y], M);
38130
38728
  let L = useCallback(() => {
38131
- var _a;
38132
38729
  if (!c.current) return;
38133
38730
  o.current(c.current);
38134
38731
  let i = h(c.current, e || "", t || n || "text", m || ""), f = h(c.current, r || "", a || n || "text", E || "");
38135
- (_a = u.current) == null ? void 0 : _a.setModel({ original: i, modified: f });
38732
+ u.current?.setModel({ original: i, modified: f });
38136
38733
  }, [n, r, a, e, t, m, E]), U = useCallback(() => {
38137
- var _a;
38138
- !b.current && w.current && (u.current = c.current.editor.createDiffEditor(w.current, { automaticLayout: true, ...y }), L(), (_a = c.current) == null ? void 0 : _a.editor.setTheme(x), O(true), b.current = true);
38734
+ !b.current && w.current && (u.current = c.current.editor.createDiffEditor(w.current, { automaticLayout: true, ...y }), L(), c.current?.editor.setTheme(x), O(true), b.current = true);
38139
38735
  }, [y, x, L]);
38140
38736
  useEffect(() => {
38141
38737
  M && d.current(u.current, c.current);
@@ -38143,9 +38739,8 @@ function Oe({ original: e, modified: r, language: n, originalLanguage: t, modifi
38143
38739
  !T && !M && U();
38144
38740
  }, [T, M, U]);
38145
38741
  function I() {
38146
- var _a, _b, _c, _d;
38147
- let i = (_a = u.current) == null ? void 0 : _a.getModel();
38148
- g || ((_b = i == null ? void 0 : i.original) == null ? void 0 : _b.dispose()), N || ((_c = i == null ? void 0 : i.modified) == null ? void 0 : _c.dispose()), (_d = u.current) == null ? void 0 : _d.dispose();
38742
+ let i = u.current?.getModel();
38743
+ g || i?.original?.dispose(), N || i?.modified?.dispose(), u.current?.dispose();
38149
38744
  }
38150
38745
  return React.createElement(H, { width: z, height: V, isEditorReady: M, loading: P, _ref: w, className: F, wrapperProps: j });
38151
38746
  }
@@ -38163,33 +38758,27 @@ function Ve({ defaultValue: e, defaultLanguage: r, defaultPath: n, value: t, lan
38163
38758
  let [s, u] = useState(false), [c, w] = useState(true), d = useRef(null), o = useRef(null), b = useRef(null), L = useRef(M), U = useRef(q), I = useRef(), i = useRef(t), f = se(m), Q = useRef(false), B = useRef(false);
38164
38759
  k(() => {
38165
38760
  let p = loader.init();
38166
- return p.then((R) => (d.current = R) && w(false)).catch((R) => (R == null ? void 0 : R.type) !== "cancelation" && console.error("Monaco initialization: error:", R)), () => o.current ? pe() : p.cancel();
38761
+ return p.then((R) => (d.current = R) && w(false)).catch((R) => R?.type !== "cancelation" && console.error("Monaco initialization: error:", R)), () => o.current ? pe() : p.cancel();
38167
38762
  }), l(() => {
38168
- var _a, _b, _c, _d;
38169
38763
  let p = h(d.current, e || t || "", r || a || "", m || n || "");
38170
- p !== ((_a = o.current) == null ? void 0 : _a.getModel()) && (y && _.set(f, (_b = o.current) == null ? void 0 : _b.saveViewState()), (_c = o.current) == null ? void 0 : _c.setModel(p), y && ((_d = o.current) == null ? void 0 : _d.restoreViewState(_.get(m))));
38764
+ p !== o.current?.getModel() && (y && _.set(f, o.current?.saveViewState()), o.current?.setModel(p), y && o.current?.restoreViewState(_.get(m)));
38171
38765
  }, [m], s), l(() => {
38172
- var _a;
38173
- (_a = o.current) == null ? void 0 : _a.updateOptions(x);
38766
+ o.current?.updateOptions(x);
38174
38767
  }, [x], s), l(() => {
38175
38768
  !o.current || t === void 0 || (o.current.getOption(d.current.editor.EditorOption.readOnly) ? o.current.setValue(t) : t !== o.current.getValue() && (B.current = true, o.current.executeEdits("", [{ range: o.current.getModel().getFullModelRange(), text: t, forceMoveMarkers: true }]), o.current.pushUndoStop(), B.current = false));
38176
38769
  }, [t], s), l(() => {
38177
- var _a, _b;
38178
- let p = (_a = o.current) == null ? void 0 : _a.getModel();
38179
- p && a && ((_b = d.current) == null ? void 0 : _b.editor.setModelLanguage(p, a));
38770
+ let p = o.current?.getModel();
38771
+ p && a && d.current?.editor.setModelLanguage(p, a);
38180
38772
  }, [a], s), l(() => {
38181
- var _a;
38182
- g !== void 0 && ((_a = o.current) == null ? void 0 : _a.revealLine(g));
38773
+ g !== void 0 && o.current?.revealLine(g);
38183
38774
  }, [g], s), l(() => {
38184
- var _a;
38185
- (_a = d.current) == null ? void 0 : _a.editor.setTheme(E);
38775
+ d.current?.editor.setTheme(E);
38186
38776
  }, [E], s);
38187
38777
  let X2 = useCallback(() => {
38188
- var _a;
38189
38778
  if (!(!b.current || !d.current) && !Q.current) {
38190
38779
  U.current(d.current);
38191
38780
  let p = m || n, R = h(d.current, t || e || "", r || a || "", p || "");
38192
- o.current = (_a = d.current) == null ? void 0 : _a.editor.create(b.current, { model: R, automaticLayout: true, ...x }, P), y && o.current.restoreViewState(_.get(p)), d.current.editor.setTheme(E), g !== void 0 && o.current.revealLine(g), u(true), Q.current = true;
38781
+ o.current = d.current?.editor.create(b.current, { model: R, automaticLayout: true, ...x }, P), y && o.current.restoreViewState(_.get(p)), d.current.editor.setTheme(E), g !== void 0 && o.current.revealLine(g), u(true), Q.current = true;
38193
38782
  }
38194
38783
  }, [e, r, n, t, a, m, x, P, y, E, g]);
38195
38784
  useEffect(() => {
@@ -38197,30 +38786,27 @@ function Ve({ defaultValue: e, defaultLanguage: r, defaultPath: n, value: t, lan
38197
38786
  }, [s]), useEffect(() => {
38198
38787
  !c && !s && X2();
38199
38788
  }, [c, s, X2]), i.current = t, useEffect(() => {
38200
- var _a, _b;
38201
- s && O && ((_a = I.current) == null ? void 0 : _a.dispose(), I.current = (_b = o.current) == null ? void 0 : _b.onDidChangeModelContent((p) => {
38789
+ s && O && (I.current?.dispose(), I.current = o.current?.onDidChangeModelContent((p) => {
38202
38790
  B.current || O(o.current.getValue(), p);
38203
38791
  }));
38204
38792
  }, [s, O]), useEffect(() => {
38205
38793
  if (s) {
38206
38794
  let p = d.current.editor.onDidChangeMarkers((R) => {
38207
- var _a;
38208
- let G = (_a = o.current.getModel()) == null ? void 0 : _a.uri;
38795
+ let G = o.current.getModel()?.uri;
38209
38796
  if (G && R.find((J) => J.path === G.path)) {
38210
38797
  let J = d.current.editor.getModelMarkers({ resource: G });
38211
- T == null ? void 0 : T(J);
38798
+ T?.(J);
38212
38799
  }
38213
38800
  });
38214
38801
  return () => {
38215
- p == null ? void 0 : p.dispose();
38802
+ p?.dispose();
38216
38803
  };
38217
38804
  }
38218
38805
  return () => {
38219
38806
  };
38220
38807
  }, [s, T]);
38221
38808
  function pe() {
38222
- var _a, _b;
38223
- (_a = I.current) == null ? void 0 : _a.dispose(), V ? y && _.set(m, o.current.saveViewState()) : (_b = o.current.getModel()) == null ? void 0 : _b.dispose(), o.current.dispose();
38809
+ I.current?.dispose(), V ? y && _.set(m, o.current.saveViewState()) : o.current.getModel()?.dispose(), o.current.dispose();
38224
38810
  }
38225
38811
  return React.createElement(H, { width: z, height: F, isEditorReady: s, loading: N, _ref: b, className: j, wrapperProps: A });
38226
38812
  }
@@ -38488,14 +39074,13 @@ class ErrorBoundary extends Component {
38488
39074
  console.error("ErrorBoundary caught an error:", error, errorInfo);
38489
39075
  }
38490
39076
  render() {
38491
- var _a;
38492
39077
  if (this.state.hasError) {
38493
39078
  if (this.props.fallback) {
38494
39079
  return this.props.fallback;
38495
39080
  }
38496
39081
  return /* @__PURE__ */ jsx("div", { className: "df-error-boundary", children: /* @__PURE__ */ jsxs("div", { className: "df-error-boundary-content", children: [
38497
39082
  /* @__PURE__ */ jsx("h3", { className: "df-error-boundary-title", children: "Something went wrong" }),
38498
- /* @__PURE__ */ jsx("p", { className: "df-error-boundary-message", children: ((_a = this.state.error) == null ? void 0 : _a.message) || "An unexpected error occurred" }),
39083
+ /* @__PURE__ */ jsx("p", { className: "df-error-boundary-message", children: this.state.error?.message || "An unexpected error occurred" }),
38499
39084
  /* @__PURE__ */ jsx(
38500
39085
  "button",
38501
39086
  {
@@ -38831,7 +39416,7 @@ function MessageInputPanel({
38831
39416
  onClick: handleLoadSample,
38832
39417
  title: "Load sample data",
38833
39418
  children: [
38834
- /* @__PURE__ */ jsx(FileJson, { size: 12 }),
39419
+ /* @__PURE__ */ jsx(FileBraces, { size: 12 }),
38835
39420
  "Sample"
38836
39421
  ]
38837
39422
  }
@@ -39042,15 +39627,13 @@ function DebugInfoBubble({
39042
39627
  visible,
39043
39628
  onClose
39044
39629
  }) {
39045
- var _a;
39046
39630
  const [position, setPosition] = useState({ top: 0, left: 0 });
39047
39631
  const bubbleRef = useRef(null);
39048
39632
  useEffect(() => {
39049
39633
  if (!visible || !targetRef.current) return;
39050
39634
  const updatePosition = () => {
39051
- var _a2, _b;
39052
- const targetRect = (_a2 = targetRef.current) == null ? void 0 : _a2.getBoundingClientRect();
39053
- const bubbleRect = (_b = bubbleRef.current) == null ? void 0 : _b.getBoundingClientRect();
39635
+ const targetRect = targetRef.current?.getBoundingClientRect();
39636
+ const bubbleRect = bubbleRef.current?.getBoundingClientRect();
39054
39637
  if (!targetRect) return;
39055
39638
  let top = targetRect.bottom + 8;
39056
39639
  let left = targetRect.left;
@@ -39107,9 +39690,9 @@ function DebugInfoBubble({
39107
39690
  /* @__PURE__ */ jsx("span", { className: "df-debug-bubble-label", children: "Result:" }),
39108
39691
  /* @__PURE__ */ jsx("span", { className: `df-debug-bubble-state df-debug-bubble-state-${displayState}`, children: result })
39109
39692
  ] }),
39110
- hasError && (message == null ? void 0 : message.errors) && /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-error", children: [
39693
+ hasError && message?.errors && /* @__PURE__ */ jsxs("div", { className: "df-debug-bubble-error", children: [
39111
39694
  /* @__PURE__ */ jsx(CircleAlert, { size: 14 }),
39112
- /* @__PURE__ */ jsx("span", { children: ((_a = message.errors[0]) == null ? void 0 : _a.message) || "Unknown error" })
39695
+ /* @__PURE__ */ jsx("span", { children: message.errors[0]?.message || "Unknown error" })
39113
39696
  ] })
39114
39697
  ] })
39115
39698
  ]
@@ -39178,12 +39761,11 @@ function IntegratedDebugToolbar({
39178
39761
  const { playbackState, isExecuting, executionError, trace } = state;
39179
39762
  const lastExecutionRef = useRef(null);
39180
39763
  const handleExecute = useCallback(async () => {
39181
- var _a, _b;
39182
39764
  if (!isEngineReady || workflows.length === 0) return;
39183
39765
  const workflowsJson = JSON.stringify(workflows);
39184
39766
  const payloadJson = JSON.stringify(payload || {});
39185
39767
  const current = { workflows: workflowsJson, payload: payloadJson };
39186
- if (((_a = lastExecutionRef.current) == null ? void 0 : _a.workflows) === current.workflows && ((_b = lastExecutionRef.current) == null ? void 0 : _b.payload) === current.payload) {
39768
+ if (lastExecutionRef.current?.workflows === current.workflows && lastExecutionRef.current?.payload === current.payload) {
39187
39769
  return;
39188
39770
  }
39189
39771
  startExecution();
@@ -39192,12 +39774,12 @@ function IntegratedDebugToolbar({
39192
39774
  if (result) {
39193
39775
  executeTrace(result);
39194
39776
  lastExecutionRef.current = current;
39195
- onExecutionComplete == null ? void 0 : onExecutionComplete(result);
39777
+ onExecutionComplete?.(result);
39196
39778
  }
39197
39779
  } catch (err) {
39198
39780
  const errorMessage = err instanceof Error ? err.message : "Execution failed";
39199
39781
  setExecutionError(errorMessage);
39200
- onExecutionError == null ? void 0 : onExecutionError(errorMessage);
39782
+ onExecutionError?.(errorMessage);
39201
39783
  }
39202
39784
  }, [
39203
39785
  isEngineReady,
@@ -39284,7 +39866,6 @@ function IntegratedDebugToolbar({
39284
39866
  return () => window.removeEventListener("keydown", handleKeyDown);
39285
39867
  }, [handleKeyDown]);
39286
39868
  const getStatusIcon = () => {
39287
- var _a;
39288
39869
  if (isExecuting) {
39289
39870
  return /* @__PURE__ */ jsx(LoaderCircle, { size: 14, className: "df-debug-spin" });
39290
39871
  }
@@ -39292,8 +39873,8 @@ function IntegratedDebugToolbar({
39292
39873
  return /* @__PURE__ */ jsx(CircleX, { size: 14, className: "df-debug-toolbar-status-error" });
39293
39874
  }
39294
39875
  if (hasTrace) {
39295
- const finalStep = trace == null ? void 0 : trace.steps[trace.steps.length - 1];
39296
- const hasErrors = ((_a = finalStep == null ? void 0 : finalStep.message) == null ? void 0 : _a.errors) && finalStep.message.errors.length > 0;
39876
+ const finalStep = trace?.steps[trace.steps.length - 1];
39877
+ const hasErrors = finalStep?.message?.errors && finalStep.message.errors.length > 0;
39297
39878
  if (hasErrors) {
39298
39879
  return /* @__PURE__ */ jsx(CircleAlert, { size: 14, className: "df-debug-toolbar-status-warning" });
39299
39880
  }
@@ -39469,7 +40050,7 @@ function VisualizerInner({
39469
40050
  debugPayload
39470
40051
  }) {
39471
40052
  const { resolvedTheme } = useTheme();
39472
- const debugMode = (debugConfig == null ? void 0 : debugConfig.enabled) ?? false;
40053
+ const debugMode = debugConfig?.enabled ?? false;
39473
40054
  const debuggerContext = useDebuggerOptional();
39474
40055
  const effectiveDebugContext = debugMode ? debuggerContext : null;
39475
40056
  const [selection2, setSelection] = useState({ type: "none" });
@@ -39500,18 +40081,18 @@ function VisualizerInner({
39500
40081
  const handleSelection = (newSelection) => {
39501
40082
  setSelection(newSelection);
39502
40083
  if (newSelection.type === "workflow") {
39503
- onWorkflowSelect == null ? void 0 : onWorkflowSelect(newSelection.workflow);
40084
+ onWorkflowSelect?.(newSelection.workflow);
39504
40085
  } else if (newSelection.type === "workflow-condition") {
39505
- onWorkflowSelect == null ? void 0 : onWorkflowSelect(newSelection.workflow);
40086
+ onWorkflowSelect?.(newSelection.workflow);
39506
40087
  } else if (newSelection.type === "task" || newSelection.type === "task-condition" || newSelection.type === "mapping" || newSelection.type === "validation-rule") {
39507
- onTaskSelect == null ? void 0 : onTaskSelect(newSelection.task, newSelection.workflow);
40088
+ onTaskSelect?.(newSelection.task, newSelection.workflow);
39508
40089
  }
39509
40090
  };
39510
40091
  const selectionInfo = getSelectionInfo(selection2);
39511
- const hasDebugTrace = debugMode && (effectiveDebugContext == null ? void 0 : effectiveDebugContext.hasTrace);
39512
- const displayMessage = hasDebugTrace ? effectiveDebugContext == null ? void 0 : effectiveDebugContext.currentMessage : executionResult;
39513
- const currentChanges = hasDebugTrace ? effectiveDebugContext == null ? void 0 : effectiveDebugContext.currentChanges : [];
39514
- const currentStepIndex = hasDebugTrace ? effectiveDebugContext == null ? void 0 : effectiveDebugContext.state.currentStepIndex : -1;
40092
+ const hasDebugTrace = debugMode && effectiveDebugContext?.hasTrace;
40093
+ const displayMessage = hasDebugTrace ? effectiveDebugContext?.currentMessage : executionResult;
40094
+ const currentChanges = hasDebugTrace ? effectiveDebugContext?.currentChanges : [];
40095
+ const currentStepIndex = hasDebugTrace ? effectiveDebugContext?.state.currentStepIndex : -1;
39515
40096
  const isDraggingAny = isDragging || isVerticalDragging;
39516
40097
  return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs("div", { className: `df-visualizer-container df-theme-${resolvedTheme}`, children: [
39517
40098
  /* @__PURE__ */ jsxs("div", { className: "df-visualizer-title-bar", children: [
@@ -39615,7 +40196,7 @@ function WorkflowVisualizer({
39615
40196
  debugConfig,
39616
40197
  debugPayload
39617
40198
  }) {
39618
- if (debugConfig == null ? void 0 : debugConfig.enabled) {
40199
+ if (debugConfig?.enabled) {
39619
40200
  return /* @__PURE__ */ jsx(ThemeProvider, { defaultTheme: theme, children: /* @__PURE__ */ jsx(
39620
40201
  DebuggerProvider,
39621
40202
  {
@@ -39851,8 +40432,8 @@ if (!("encodeInto" in cachedTextEncoder)) {
39851
40432
  let WASM_VECTOR_LEN = 0;
39852
40433
  let wasm;
39853
40434
  class WasmEngineAdapter {
40435
+ engine;
39854
40436
  constructor(workflows) {
39855
- __publicField(this, "engine");
39856
40437
  const workflowsJson = JSON.stringify(workflows);
39857
40438
  this.engine = new WasmEngine(workflowsJson);
39858
40439
  }