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