@goplasmatic/dataflow-ui 2.0.7 → 2.0.9

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
@@ -177,6 +177,15 @@ const Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "
177
177
  const ChevronDown = createLucideIcon("ChevronDown", [
178
178
  ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
179
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
+ ]);
180
189
  /**
181
190
  * @license lucide-react v0.462.0 - ISC
182
191
  *
@@ -186,6 +195,26 @@ const ChevronDown = createLucideIcon("ChevronDown", [
186
195
  const ChevronRight = createLucideIcon("ChevronRight", [
187
196
  ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
188
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", [
205
+ ["path", { d: "m11 17-5-5 5-5", key: "13zhaf" }],
206
+ ["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", [
215
+ ["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
216
+ ["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }]
217
+ ]);
189
218
  /**
190
219
  * @license lucide-react v0.462.0 - ISC
191
220
  *
@@ -207,6 +236,17 @@ const CircleCheckBig = createLucideIcon("CircleCheckBig", [
207
236
  ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
208
237
  ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
209
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", [
246
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
247
+ ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
248
+ ["path", { d: "m9 9 6 6", key: "z0biqf" }]
249
+ ]);
210
250
  /**
211
251
  * @license lucide-react v0.462.0 - ISC
212
252
  *
@@ -313,6 +353,15 @@ const ListTree = createLucideIcon("ListTree", [
313
353
  ["path", { d: "M3 6v4c0 1.1.9 2 2 2h3", key: "1ywdgy" }],
314
354
  ["path", { d: "M3 10v6c0 1.1.9 2 2 2h3", key: "2wc746" }]
315
355
  ]);
356
+ /**
357
+ * @license lucide-react v0.462.0 - ISC
358
+ *
359
+ * This source code is licensed under the ISC license.
360
+ * See the LICENSE file in the root directory of this source tree.
361
+ */
362
+ const LoaderCircle = createLucideIcon("LoaderCircle", [
363
+ ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
364
+ ]);
316
365
  /**
317
366
  * @license lucide-react v0.462.0 - ISC
318
367
  *
@@ -11008,7 +11057,7 @@ let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNod
11008
11057
  }
11009
11058
  ]
11010
11059
  ];
11011
- const ChevronLeft = createLucideIcon2("chevron-left", __iconNode$o);
11060
+ const ChevronLeft2 = createLucideIcon2("chevron-left", __iconNode$o);
11012
11061
  const __iconNode$n = [
11013
11062
  [
11014
11063
  "path",
@@ -11070,7 +11119,7 @@ let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNod
11070
11119
  }
11071
11120
  ]
11072
11121
  ];
11073
- const CircleX = createLucideIcon2("circle-x", __iconNode$l);
11122
+ const CircleX2 = createLucideIcon2("circle-x", __iconNode$l);
11074
11123
  const __iconNode$k = [
11075
11124
  [
11076
11125
  "path",
@@ -11698,7 +11747,7 @@ let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNod
11698
11747
  "database": Database,
11699
11748
  "boxes": Boxes,
11700
11749
  "circle-help": CircleQuestionMark,
11701
- "circle-x": CircleX,
11750
+ "circle-x": CircleX2,
11702
11751
  "git-commit-horizontal": GitCommitHorizontal,
11703
11752
  "search": Search2,
11704
11753
  "divide": Divide,
@@ -18868,7 +18917,7 @@ let CATEGORY_COLORS, DataLogicEditor, OPERATORS, applyTreeLayout, jsonLogicToNod
18868
18917
  onClick: stepBackward,
18869
18918
  disabled: isAtStart,
18870
18919
  title: "Step backward (Left Arrow)",
18871
- children: jsxRuntime.jsx(ChevronLeft, {
18920
+ children: jsxRuntime.jsx(ChevronLeft2, {
18872
18921
  size: 18
18873
18922
  })
18874
18923
  }),
@@ -19755,7 +19804,7 @@ function WorkflowFlowView({
19755
19804
  }
19756
19805
  function DataLogicView({ value }) {
19757
19806
  const { resolvedTheme } = useTheme();
19758
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-details-content", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-details-logic-editor", children: /* @__PURE__ */ jsxRuntime.jsx(
19807
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-details-content", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-details-logic-editor", "data-theme": resolvedTheme, children: /* @__PURE__ */ jsxRuntime.jsx(
19759
19808
  DataLogicEditor,
19760
19809
  {
19761
19810
  value,
@@ -20284,7 +20333,7 @@ function getParentFolderIds(path) {
20284
20333
  return ids;
20285
20334
  }
20286
20335
  function TreeView({ workflows, selection: selection2, onSelect, debugMode = false }) {
20287
- const debuggerContext = useDebugger();
20336
+ const debuggerContext = useDebuggerOptional();
20288
20337
  const effectiveDebugContext = debugMode ? debuggerContext : null;
20289
20338
  const folderTree = require$$0.useMemo(() => buildFolderTree(workflows), [workflows]);
20290
20339
  const sortedRootFolders = require$$0.useMemo(() => {
@@ -20425,1854 +20474,2151 @@ function TreeView({ workflows, selection: selection2, onSelect, debugMode = fals
20425
20474
  }
20426
20475
  ) });
20427
20476
  }
20428
- function SearchInput({
20429
- value,
20430
- onChange,
20431
- onClear,
20432
- placeholder = "Search...",
20433
- className = ""
20434
- }) {
20435
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-search-input ${className}`, children: [
20436
- /* @__PURE__ */ jsxRuntime.jsx(Search, { className: "df-search-icon", size: 16 }),
20437
- /* @__PURE__ */ jsxRuntime.jsx(
20438
- "input",
20439
- {
20440
- type: "text",
20441
- value,
20442
- onChange: (e) => onChange(e.target.value),
20443
- placeholder,
20444
- className: "df-search-field"
20445
- }
20446
- ),
20447
- value && onClear && /* @__PURE__ */ jsxRuntime.jsx(
20448
- "button",
20449
- {
20450
- onClick: onClear,
20451
- className: "df-search-clear",
20452
- "aria-label": "Clear search",
20453
- children: /* @__PURE__ */ jsxRuntime.jsx(X, { size: 14 })
20454
- }
20455
- )
20456
- ] });
20457
- }
20458
- function JsonViewer({
20459
- data,
20460
- initialExpanded = false,
20461
- maxStringLength = 50,
20462
- className = ""
20463
- }) {
20464
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `df-json-viewer ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(
20465
- JsonNode,
20466
- {
20467
- data,
20468
- initialExpanded,
20469
- maxStringLength
20470
- }
20471
- ) });
20472
- }
20473
- function JsonNode({
20474
- data,
20475
- initialExpanded,
20476
- maxStringLength,
20477
- keyName,
20478
- isLast = true
20479
- }) {
20480
- const [expanded, setExpanded] = require$$0.useState(initialExpanded);
20481
- const renderValue = () => {
20482
- if (data === null) {
20483
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-null", children: "null" });
20484
- }
20485
- if (data === void 0) {
20486
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-undefined", children: "undefined" });
20487
- }
20488
- if (typeof data === "boolean") {
20489
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-boolean", children: data.toString() });
20490
- }
20491
- if (typeof data === "number") {
20492
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-number", children: data });
20493
- }
20494
- if (typeof data === "string") {
20495
- const display = data.length > maxStringLength ? `${data.slice(0, maxStringLength)}...` : data;
20496
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-string", children: [
20497
- '"',
20498
- display,
20499
- '"'
20500
- ] });
20501
- }
20502
- if (Array.isArray(data)) {
20503
- if (data.length === 0) {
20504
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "[]" });
20477
+ function DebuggerControls({ compact = false, className = "" }) {
20478
+ const {
20479
+ state,
20480
+ play,
20481
+ pause,
20482
+ stop,
20483
+ reset,
20484
+ stepForward,
20485
+ stepBackward,
20486
+ setSpeed,
20487
+ isAtStart,
20488
+ isAtEnd,
20489
+ hasTrace,
20490
+ progress,
20491
+ totalSteps
20492
+ } = useDebugger();
20493
+ const { playbackState, playbackSpeed, currentStepIndex, isExecuting } = state;
20494
+ const handleKeyDown = require$$0.useCallback(
20495
+ (e) => {
20496
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
20497
+ return;
20505
20498
  }
20506
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-array", children: [
20507
- /* @__PURE__ */ jsxRuntime.jsx(
20508
- "button",
20509
- {
20510
- onClick: () => setExpanded(!expanded),
20511
- className: "df-json-toggle",
20512
- children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: 12 }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { size: 12 })
20499
+ switch (e.key) {
20500
+ case " ":
20501
+ e.preventDefault();
20502
+ if (playbackState === "playing") {
20503
+ pause();
20504
+ } else if (hasTrace) {
20505
+ play();
20513
20506
  }
20514
- ),
20515
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "[" }),
20516
- !expanded && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-preview", children: [
20517
- data.length,
20518
- " item",
20519
- data.length !== 1 ? "s" : ""
20520
- ] }),
20521
- expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-json-children", children: data.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsx(
20522
- JsonNode,
20523
- {
20524
- data: item,
20525
- initialExpanded: false,
20526
- maxStringLength,
20527
- isLast: index2 === data.length - 1
20528
- },
20529
- index2
20530
- )) }),
20531
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "]" })
20532
- ] });
20533
- }
20534
- if (typeof data === "object") {
20535
- const entries = Object.entries(data);
20536
- if (entries.length === 0) {
20537
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "{}" });
20538
- }
20539
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-object", children: [
20540
- /* @__PURE__ */ jsxRuntime.jsx(
20541
- "button",
20542
- {
20543
- onClick: () => setExpanded(!expanded),
20544
- className: "df-json-toggle",
20545
- children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: 12 }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { size: 12 })
20507
+ break;
20508
+ case "ArrowRight":
20509
+ e.preventDefault();
20510
+ if (hasTrace && !isAtEnd) {
20511
+ stepForward();
20546
20512
  }
20547
- ),
20548
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "{" }),
20549
- !expanded && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-preview", children: [
20550
- entries.length,
20551
- " key",
20552
- entries.length !== 1 ? "s" : ""
20553
- ] }),
20554
- expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-json-children", children: entries.map(([key, value], index2) => /* @__PURE__ */ jsxRuntime.jsx(
20555
- JsonNode,
20556
- {
20557
- keyName: key,
20558
- data: value,
20559
- initialExpanded: false,
20560
- maxStringLength,
20561
- isLast: index2 === entries.length - 1
20562
- },
20563
- key
20564
- )) }),
20565
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "}" })
20566
- ] });
20567
- }
20568
- return /* @__PURE__ */ jsxRuntime.jsx("span", { children: String(data) });
20513
+ break;
20514
+ case "ArrowLeft":
20515
+ e.preventDefault();
20516
+ if (hasTrace && !isAtStart) {
20517
+ stepBackward();
20518
+ }
20519
+ break;
20520
+ case "Escape":
20521
+ e.preventDefault();
20522
+ stop();
20523
+ break;
20524
+ case "r":
20525
+ if (e.metaKey || e.ctrlKey) {
20526
+ e.preventDefault();
20527
+ reset();
20528
+ }
20529
+ break;
20530
+ }
20531
+ },
20532
+ [playbackState, hasTrace, isAtEnd, isAtStart, play, pause, stop, stepForward, stepBackward, reset]
20533
+ );
20534
+ require$$0.useEffect(() => {
20535
+ window.addEventListener("keydown", handleKeyDown);
20536
+ return () => window.removeEventListener("keydown", handleKeyDown);
20537
+ }, [handleKeyDown]);
20538
+ const handleSpeedChange = (e) => {
20539
+ setSpeed(Number(e.target.value));
20569
20540
  };
20570
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-json-node", children: [
20571
- keyName !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
20572
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-key", children: [
20573
- '"',
20574
- keyName,
20575
- '"'
20576
- ] }),
20577
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-colon", children: ": " })
20578
- ] }),
20579
- renderValue(),
20580
- !isLast && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-comma", children: "," })
20581
- ] });
20582
- }
20583
- function _arrayLikeToArray(r, a) {
20584
- (null == a || a > r.length) && (a = r.length);
20585
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
20586
- return n;
20587
- }
20588
- function _arrayWithHoles(r) {
20589
- if (Array.isArray(r)) return r;
20590
- }
20591
- function _defineProperty$1(e, r, t) {
20592
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
20593
- value: t,
20594
- enumerable: true,
20595
- configurable: true,
20596
- writable: true
20597
- }) : e[r] = t, e;
20598
- }
20599
- function _iterableToArrayLimit(r, l2) {
20600
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
20601
- if (null != t) {
20602
- var e, n, i, u, a = [], f = true, o = false;
20603
- try {
20604
- if (i = (t = t.call(r)).next, 0 === l2) ;
20605
- else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l2); f = true) ;
20606
- } catch (r2) {
20607
- o = true, n = r2;
20608
- } finally {
20609
- try {
20610
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
20611
- } finally {
20612
- if (o) throw n;
20613
- }
20614
- }
20615
- return a;
20616
- }
20617
- }
20618
- function _nonIterableRest() {
20619
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
20620
- }
20621
- function ownKeys$1(e, r) {
20622
- var t = Object.keys(e);
20623
- if (Object.getOwnPropertySymbols) {
20624
- var o = Object.getOwnPropertySymbols(e);
20625
- r && (o = o.filter(function(r2) {
20626
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
20627
- })), t.push.apply(t, o);
20628
- }
20629
- return t;
20630
- }
20631
- function _objectSpread2$1(e) {
20632
- for (var r = 1; r < arguments.length; r++) {
20633
- var t = null != arguments[r] ? arguments[r] : {};
20634
- r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) {
20635
- _defineProperty$1(e, r2, t[r2]);
20636
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) {
20637
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
20638
- });
20639
- }
20640
- return e;
20641
- }
20642
- function _objectWithoutProperties(e, t) {
20643
- if (null == e) return {};
20644
- var o, r, i = _objectWithoutPropertiesLoose(e, t);
20645
- if (Object.getOwnPropertySymbols) {
20646
- var n = Object.getOwnPropertySymbols(e);
20647
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
20648
- }
20649
- return i;
20650
- }
20651
- function _objectWithoutPropertiesLoose(r, e) {
20652
- if (null == r) return {};
20653
- var t = {};
20654
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
20655
- if (-1 !== e.indexOf(n)) continue;
20656
- t[n] = r[n];
20657
- }
20658
- return t;
20659
- }
20660
- function _slicedToArray(r, e) {
20661
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
20662
- }
20663
- function _toPrimitive(t, r) {
20664
- if ("object" != typeof t || !t) return t;
20665
- var e = t[Symbol.toPrimitive];
20666
- if (void 0 !== e) {
20667
- var i = e.call(t, r);
20668
- if ("object" != typeof i) return i;
20669
- throw new TypeError("@@toPrimitive must return a primitive value.");
20670
- }
20671
- return ("string" === r ? String : Number)(t);
20672
- }
20673
- function _toPropertyKey(t) {
20674
- var i = _toPrimitive(t, "string");
20675
- return "symbol" == typeof i ? i : i + "";
20676
- }
20677
- function _unsupportedIterableToArray(r, a) {
20678
- if (r) {
20679
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
20680
- var t = {}.toString.call(r).slice(8, -1);
20681
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
20682
- }
20683
- }
20684
- function _defineProperty(obj, key, value) {
20685
- if (key in obj) {
20686
- Object.defineProperty(obj, key, {
20687
- value,
20688
- enumerable: true,
20689
- configurable: true,
20690
- writable: true
20691
- });
20692
- } else {
20693
- obj[key] = value;
20694
- }
20695
- return obj;
20696
- }
20697
- function ownKeys(object2, enumerableOnly) {
20698
- var keys = Object.keys(object2);
20699
- if (Object.getOwnPropertySymbols) {
20700
- var symbols = Object.getOwnPropertySymbols(object2);
20701
- if (enumerableOnly) symbols = symbols.filter(function(sym) {
20702
- return Object.getOwnPropertyDescriptor(object2, sym).enumerable;
20703
- });
20704
- keys.push.apply(keys, symbols);
20705
- }
20706
- return keys;
20707
- }
20708
- function _objectSpread2(target) {
20709
- for (var i = 1; i < arguments.length; i++) {
20710
- var source = arguments[i] != null ? arguments[i] : {};
20711
- if (i % 2) {
20712
- ownKeys(Object(source), true).forEach(function(key) {
20713
- _defineProperty(target, key, source[key]);
20714
- });
20715
- } else if (Object.getOwnPropertyDescriptors) {
20716
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
20717
- } else {
20718
- ownKeys(Object(source)).forEach(function(key) {
20719
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
20720
- });
20721
- }
20722
- }
20723
- return target;
20724
- }
20725
- function compose$1() {
20726
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
20727
- fns[_key] = arguments[_key];
20728
- }
20729
- return function(x) {
20730
- return fns.reduceRight(function(y, f) {
20731
- return f(y);
20732
- }, x);
20733
- };
20734
- }
20735
- function curry$1(fn) {
20736
- return function curried() {
20737
- var _this = this;
20738
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
20739
- args[_key2] = arguments[_key2];
20740
- }
20741
- return args.length >= fn.length ? fn.apply(this, args) : function() {
20742
- for (var _len3 = arguments.length, nextArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
20743
- nextArgs[_key3] = arguments[_key3];
20744
- }
20745
- return curried.apply(_this, [].concat(args, nextArgs));
20746
- };
20747
- };
20748
- }
20749
- function isObject$1(value) {
20750
- return {}.toString.call(value).includes("Object");
20751
- }
20752
- function isEmpty(obj) {
20753
- return !Object.keys(obj).length;
20754
- }
20755
- function isFunction(value) {
20756
- return typeof value === "function";
20757
- }
20758
- function hasOwnProperty(object2, property) {
20759
- return Object.prototype.hasOwnProperty.call(object2, property);
20760
- }
20761
- function validateChanges(initial, changes) {
20762
- if (!isObject$1(changes)) errorHandler$1("changeType");
20763
- if (Object.keys(changes).some(function(field) {
20764
- return !hasOwnProperty(initial, field);
20765
- })) errorHandler$1("changeField");
20766
- return changes;
20767
- }
20768
- function validateSelector(selector2) {
20769
- if (!isFunction(selector2)) errorHandler$1("selectorType");
20770
- }
20771
- function validateHandler(handler) {
20772
- if (!(isFunction(handler) || isObject$1(handler))) errorHandler$1("handlerType");
20773
- if (isObject$1(handler) && Object.values(handler).some(function(_handler) {
20774
- return !isFunction(_handler);
20775
- })) errorHandler$1("handlersType");
20776
- }
20777
- function validateInitial(initial) {
20778
- if (!initial) errorHandler$1("initialIsRequired");
20779
- if (!isObject$1(initial)) errorHandler$1("initialType");
20780
- if (isEmpty(initial)) errorHandler$1("initialContent");
20781
- }
20782
- function throwError$1(errorMessages2, type) {
20783
- throw new Error(errorMessages2[type] || errorMessages2["default"]);
20784
- }
20785
- var errorMessages$1 = {
20786
- initialIsRequired: "initial state is required",
20787
- initialType: "initial state should be an object",
20788
- initialContent: "initial state shouldn't be an empty object",
20789
- handlerType: "handler should be an object or a function",
20790
- handlersType: "all handlers should be a functions",
20791
- selectorType: "selector should be a function",
20792
- changeType: "provided value of changes should be an object",
20793
- changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
20794
- "default": "an unknown error accured in `state-local` package"
20795
- };
20796
- var errorHandler$1 = curry$1(throwError$1)(errorMessages$1);
20797
- var validators$1 = {
20798
- changes: validateChanges,
20799
- selector: validateSelector,
20800
- handler: validateHandler,
20801
- initial: validateInitial
20802
- };
20803
- function create(initial) {
20804
- var handler = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
20805
- validators$1.initial(initial);
20806
- validators$1.handler(handler);
20807
- var state = {
20808
- current: initial
20809
- };
20810
- var didUpdate = curry$1(didStateUpdate)(state, handler);
20811
- var update = curry$1(updateState)(state);
20812
- var validate = curry$1(validators$1.changes)(initial);
20813
- var getChanges = curry$1(extractChanges)(state);
20814
- function getState2() {
20815
- var selector2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(state2) {
20816
- return state2;
20817
- };
20818
- validators$1.selector(selector2);
20819
- return selector2(state.current);
20820
- }
20821
- function setState2(causedChanges) {
20822
- compose$1(didUpdate, update, validate, getChanges)(causedChanges);
20823
- }
20824
- return [getState2, setState2];
20825
- }
20826
- function extractChanges(state, causedChanges) {
20827
- return isFunction(causedChanges) ? causedChanges(state.current) : causedChanges;
20828
- }
20829
- function updateState(state, changes) {
20830
- state.current = _objectSpread2(_objectSpread2({}, state.current), changes);
20831
- return changes;
20832
- }
20833
- function didStateUpdate(state, handler, changes) {
20834
- isFunction(handler) ? handler(state.current) : Object.keys(changes).forEach(function(field) {
20835
- var _handler$field;
20836
- return (_handler$field = handler[field]) === null || _handler$field === void 0 ? void 0 : _handler$field.call(handler, state.current[field]);
20837
- });
20838
- return changes;
20839
- }
20840
- var index = {
20841
- create
20842
- };
20843
- var config$1 = {
20844
- paths: {
20845
- vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"
20846
- }
20847
- };
20848
- function curry(fn) {
20849
- return function curried() {
20850
- var _this = this;
20851
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20852
- args[_key] = arguments[_key];
20853
- }
20854
- return args.length >= fn.length ? fn.apply(this, args) : function() {
20855
- for (var _len2 = arguments.length, nextArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
20856
- nextArgs[_key2] = arguments[_key2];
20857
- }
20858
- return curried.apply(_this, [].concat(args, nextArgs));
20859
- };
20860
- };
20861
- }
20862
- function isObject(value) {
20863
- return {}.toString.call(value).includes("Object");
20864
- }
20865
- function validateConfig(config2) {
20866
- if (!config2) errorHandler("configIsRequired");
20867
- if (!isObject(config2)) errorHandler("configType");
20868
- if (config2.urls) {
20869
- informAboutDeprecation();
20870
- return {
20871
- paths: {
20872
- vs: config2.urls.monacoBase
20873
- }
20874
- };
20875
- }
20876
- return config2;
20877
- }
20878
- function informAboutDeprecation() {
20879
- console.warn(errorMessages.deprecation);
20880
- }
20881
- function throwError(errorMessages2, type) {
20882
- throw new Error(errorMessages2[type] || errorMessages2["default"]);
20883
- }
20884
- var errorMessages = {
20885
- configIsRequired: "the configuration object is required",
20886
- configType: "the configuration object should be an object",
20887
- "default": "an unknown error accured in `@monaco-editor/loader` package",
20888
- deprecation: "Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "
20889
- };
20890
- var errorHandler = curry(throwError)(errorMessages);
20891
- var validators = {
20892
- config: validateConfig
20893
- };
20894
- var compose = function compose2() {
20895
- for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
20896
- fns[_key] = arguments[_key];
20541
+ if (compact) {
20542
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-controls df-debug-controls-compact ${className}`, children: [
20543
+ /* @__PURE__ */ jsxRuntime.jsx(
20544
+ "button",
20545
+ {
20546
+ className: "df-debug-btn",
20547
+ onClick: stepBackward,
20548
+ disabled: !hasTrace || isAtStart || isExecuting,
20549
+ title: "Previous step (Left Arrow)",
20550
+ children: /* @__PURE__ */ jsxRuntime.jsx(SkipBack, { size: 16 })
20551
+ }
20552
+ ),
20553
+ playbackState === "playing" ? /* @__PURE__ */ jsxRuntime.jsx(
20554
+ "button",
20555
+ {
20556
+ className: "df-debug-btn df-debug-btn-primary",
20557
+ onClick: pause,
20558
+ disabled: !hasTrace || isExecuting,
20559
+ title: "Pause (Space)",
20560
+ children: /* @__PURE__ */ jsxRuntime.jsx(Pause, { size: 18 })
20561
+ }
20562
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
20563
+ "button",
20564
+ {
20565
+ className: "df-debug-btn df-debug-btn-primary",
20566
+ onClick: play,
20567
+ disabled: !hasTrace || isAtEnd || isExecuting,
20568
+ title: "Play (Space)",
20569
+ children: /* @__PURE__ */ jsxRuntime.jsx(Play, { size: 18 })
20570
+ }
20571
+ ),
20572
+ /* @__PURE__ */ jsxRuntime.jsx(
20573
+ "button",
20574
+ {
20575
+ className: "df-debug-btn",
20576
+ onClick: stepForward,
20577
+ disabled: !hasTrace || isAtEnd || isExecuting,
20578
+ title: "Next step (Right Arrow)",
20579
+ children: /* @__PURE__ */ jsxRuntime.jsx(SkipForward, { size: 16 })
20580
+ }
20581
+ ),
20582
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-debug-step-counter", children: [
20583
+ currentStepIndex + 1,
20584
+ " / ",
20585
+ totalSteps
20586
+ ] })
20587
+ ] });
20897
20588
  }
20898
- return function(x) {
20899
- return fns.reduceRight(function(y, f) {
20900
- return f(y);
20901
- }, x);
20902
- };
20903
- };
20904
- function merge(target, source) {
20905
- Object.keys(source).forEach(function(key) {
20906
- if (source[key] instanceof Object) {
20907
- if (target[key]) {
20908
- Object.assign(source[key], merge(target[key], source[key]));
20909
- }
20910
- }
20911
- });
20912
- return _objectSpread2$1(_objectSpread2$1({}, target), source);
20913
- }
20914
- var CANCELATION_MESSAGE = {
20915
- type: "cancelation",
20916
- msg: "operation is manually canceled"
20917
- };
20918
- function makeCancelable(promise) {
20919
- var hasCanceled_ = false;
20920
- var wrappedPromise = new Promise(function(resolve, reject) {
20921
- promise.then(function(val) {
20922
- return hasCanceled_ ? reject(CANCELATION_MESSAGE) : resolve(val);
20923
- });
20924
- promise["catch"](reject);
20925
- });
20926
- return wrappedPromise.cancel = function() {
20927
- return hasCanceled_ = true;
20928
- }, wrappedPromise;
20929
- }
20930
- var _excluded = ["monaco"];
20931
- var _state$create = index.create({
20932
- config: config$1,
20933
- isInitialized: false,
20934
- resolve: null,
20935
- reject: null,
20936
- monaco: null
20937
- }), _state$create2 = _slicedToArray(_state$create, 2), getState = _state$create2[0], setState = _state$create2[1];
20938
- function config(globalConfig) {
20939
- var _validators$config = validators.config(globalConfig), monaco = _validators$config.monaco, config2 = _objectWithoutProperties(_validators$config, _excluded);
20940
- setState(function(state) {
20941
- return {
20942
- config: merge(state.config, config2),
20943
- monaco
20944
- };
20945
- });
20589
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-controls ${className}`, children: [
20590
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-controls-main", children: [
20591
+ /* @__PURE__ */ jsxRuntime.jsx(
20592
+ "button",
20593
+ {
20594
+ className: "df-debug-btn",
20595
+ onClick: stop,
20596
+ disabled: !hasTrace || isExecuting,
20597
+ title: "Stop (Escape)",
20598
+ children: /* @__PURE__ */ jsxRuntime.jsx(Square, { size: 20 })
20599
+ }
20600
+ ),
20601
+ /* @__PURE__ */ jsxRuntime.jsx(
20602
+ "button",
20603
+ {
20604
+ className: "df-debug-btn",
20605
+ onClick: stepBackward,
20606
+ disabled: !hasTrace || isAtStart || isExecuting,
20607
+ title: "Previous step (Left Arrow)",
20608
+ children: /* @__PURE__ */ jsxRuntime.jsx(SkipBack, { size: 20 })
20609
+ }
20610
+ ),
20611
+ playbackState === "playing" ? /* @__PURE__ */ jsxRuntime.jsx(
20612
+ "button",
20613
+ {
20614
+ className: "df-debug-btn df-debug-btn-primary",
20615
+ onClick: pause,
20616
+ disabled: !hasTrace || isExecuting,
20617
+ title: "Pause (Space)",
20618
+ children: /* @__PURE__ */ jsxRuntime.jsx(Pause, { size: 24 })
20619
+ }
20620
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
20621
+ "button",
20622
+ {
20623
+ className: "df-debug-btn df-debug-btn-primary",
20624
+ onClick: play,
20625
+ disabled: !hasTrace || isAtEnd || isExecuting,
20626
+ title: "Play (Space)",
20627
+ children: /* @__PURE__ */ jsxRuntime.jsx(Play, { size: 24 })
20628
+ }
20629
+ ),
20630
+ /* @__PURE__ */ jsxRuntime.jsx(
20631
+ "button",
20632
+ {
20633
+ className: "df-debug-btn",
20634
+ onClick: stepForward,
20635
+ disabled: !hasTrace || isAtEnd || isExecuting,
20636
+ title: "Next step (Right Arrow)",
20637
+ children: /* @__PURE__ */ jsxRuntime.jsx(SkipForward, { size: 20 })
20638
+ }
20639
+ ),
20640
+ /* @__PURE__ */ jsxRuntime.jsx(
20641
+ "button",
20642
+ {
20643
+ className: "df-debug-btn",
20644
+ onClick: reset,
20645
+ disabled: !hasTrace || isExecuting,
20646
+ title: "Reset (Ctrl+R)",
20647
+ children: /* @__PURE__ */ jsxRuntime.jsx(RotateCcw, { size: 20 })
20648
+ }
20649
+ )
20650
+ ] }),
20651
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-progress", children: [
20652
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-progress-bar", children: /* @__PURE__ */ jsxRuntime.jsx(
20653
+ "div",
20654
+ {
20655
+ className: "df-debug-progress-fill",
20656
+ style: { width: `${progress * 100}%` }
20657
+ }
20658
+ ) }),
20659
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-debug-step-counter", children: [
20660
+ "Step ",
20661
+ currentStepIndex + 1,
20662
+ " of ",
20663
+ totalSteps
20664
+ ] })
20665
+ ] }),
20666
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-speed", children: [
20667
+ /* @__PURE__ */ jsxRuntime.jsx(Gauge, { size: 14 }),
20668
+ /* @__PURE__ */ jsxRuntime.jsx(
20669
+ "input",
20670
+ {
20671
+ type: "range",
20672
+ min: "100",
20673
+ max: "2000",
20674
+ step: "100",
20675
+ value: playbackSpeed,
20676
+ onChange: handleSpeedChange,
20677
+ className: "df-debug-speed-slider",
20678
+ title: `Playback speed: ${playbackSpeed}ms`
20679
+ }
20680
+ ),
20681
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-debug-speed-label", children: [
20682
+ playbackSpeed,
20683
+ "ms"
20684
+ ] })
20685
+ ] })
20686
+ ] });
20946
20687
  }
20947
- function init() {
20948
- var state = getState(function(_ref) {
20949
- var monaco = _ref.monaco, isInitialized = _ref.isInitialized, resolve = _ref.resolve;
20950
- return {
20951
- monaco,
20952
- isInitialized,
20953
- resolve
20954
- };
20955
- });
20956
- if (!state.isInitialized) {
20957
- setState({
20958
- isInitialized: true
20688
+ function MessageInputPanel({
20689
+ onExecute,
20690
+ isExecuting = false,
20691
+ className = ""
20692
+ }) {
20693
+ const { setInputPayload, state } = useDebugger();
20694
+ const { inputPayload } = state;
20695
+ const [expandedSections, setExpandedSections] = require$$0.useState(
20696
+ /* @__PURE__ */ new Set(["payload"])
20697
+ );
20698
+ const [editingSection, setEditingSection] = require$$0.useState(null);
20699
+ const [editText, setEditText] = require$$0.useState("");
20700
+ const [parseError, setParseError] = require$$0.useState(null);
20701
+ const payload = inputPayload || {};
20702
+ const toggleSection = (section) => {
20703
+ setExpandedSections((prev) => {
20704
+ const next = new Set(prev);
20705
+ if (next.has(section)) {
20706
+ next.delete(section);
20707
+ } else {
20708
+ next.add(section);
20709
+ }
20710
+ return next;
20959
20711
  });
20960
- if (state.monaco) {
20961
- state.resolve(state.monaco);
20962
- return makeCancelable(wrapperPromise);
20712
+ };
20713
+ const startEditing = () => {
20714
+ setEditingSection("payload");
20715
+ setEditText(JSON.stringify(payload, null, 2));
20716
+ setParseError(null);
20717
+ };
20718
+ const cancelEditing = () => {
20719
+ setEditingSection(null);
20720
+ setEditText("");
20721
+ setParseError(null);
20722
+ };
20723
+ const saveEditing = require$$0.useCallback(() => {
20724
+ if (!editingSection) return;
20725
+ try {
20726
+ const parsed = JSON.parse(editText);
20727
+ setInputPayload(parsed);
20728
+ setEditingSection(null);
20729
+ setEditText("");
20730
+ setParseError(null);
20731
+ } catch (err) {
20732
+ setParseError(err instanceof Error ? err.message : "Invalid JSON");
20963
20733
  }
20964
- if (window.monaco && window.monaco.editor) {
20965
- storeMonacoInstance(window.monaco);
20966
- state.resolve(window.monaco);
20967
- return makeCancelable(wrapperPromise);
20734
+ }, [editingSection, editText, setInputPayload]);
20735
+ const handleLoadSample = () => {
20736
+ setInputPayload({
20737
+ id: "123",
20738
+ name: "John Doe",
20739
+ email: "john@example.com",
20740
+ amount: 100
20741
+ });
20742
+ };
20743
+ const handleClear = () => {
20744
+ setInputPayload({});
20745
+ };
20746
+ const formatValue2 = (value) => {
20747
+ if (Object.keys(value).length === 0) {
20748
+ return "(empty)";
20968
20749
  }
20969
- compose(injectScripts, getMonacoLoaderScript)(configureLoader);
20970
- }
20971
- return makeCancelable(wrapperPromise);
20972
- }
20973
- function injectScripts(script) {
20974
- return document.body.appendChild(script);
20975
- }
20976
- function createScript(src) {
20977
- var script = document.createElement("script");
20978
- return src && (script.src = src), script;
20979
- }
20980
- function getMonacoLoaderScript(configureLoader2) {
20981
- var state = getState(function(_ref2) {
20982
- var config2 = _ref2.config, reject = _ref2.reject;
20983
- return {
20984
- config: config2,
20985
- reject
20986
- };
20987
- });
20988
- var loaderScript = createScript("".concat(state.config.paths.vs, "/loader.js"));
20989
- loaderScript.onload = function() {
20990
- return configureLoader2();
20750
+ return JSON.stringify(value, null, 2);
20991
20751
  };
20992
- loaderScript.onerror = state.reject;
20993
- return loaderScript;
20994
- }
20995
- function configureLoader() {
20996
- var state = getState(function(_ref3) {
20997
- var config2 = _ref3.config, resolve = _ref3.resolve, reject = _ref3.reject;
20998
- return {
20999
- config: config2,
21000
- resolve,
21001
- reject
21002
- };
21003
- });
21004
- var require2 = window.require;
21005
- require2.config(state.config);
21006
- require2(["vs/editor/editor.main"], function(loaded) {
21007
- var monaco = loaded.m || loaded;
21008
- storeMonacoInstance(monaco);
21009
- state.resolve(monaco);
21010
- }, function(error) {
21011
- state.reject(error);
21012
- });
21013
- }
21014
- function storeMonacoInstance(monaco) {
21015
- if (!getState().monaco) {
21016
- setState({
21017
- monaco
21018
- });
21019
- }
21020
- }
21021
- function __getMonacoInstance() {
21022
- return getState(function(_ref4) {
21023
- var monaco = _ref4.monaco;
21024
- return monaco;
21025
- });
21026
- }
21027
- var wrapperPromise = new Promise(function(resolve, reject) {
21028
- return setState({
21029
- resolve,
21030
- reject
21031
- });
21032
- });
21033
- var loader = {
21034
- config,
21035
- init,
21036
- __getMonacoInstance
21037
- };
21038
- var le = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, v = le;
21039
- var ae = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, Y = ae;
21040
- function Me({ children: e }) {
21041
- return require$$0.createElement("div", { style: Y.container }, e);
21042
- }
21043
- var Z = Me;
21044
- var $ = Z;
21045
- function Ee({ width: e, height: r, isEditorReady: n, loading: t, _ref: a, className: m, wrapperProps: E }) {
21046
- return require$$0.createElement("section", { style: { ...v.wrapper, width: e, height: r }, ...E }, !n && require$$0.createElement($, null, t), require$$0.createElement("div", { ref: a, style: { ...v.fullWidth, ...!n && v.hide }, className: m }));
21047
- }
21048
- var ee = Ee;
21049
- var H = require$$0.memo(ee);
21050
- function Ce(e) {
21051
- require$$0.useEffect(e, []);
21052
- }
21053
- var k = Ce;
21054
- function he(e, r, n = true) {
21055
- let t = require$$0.useRef(true);
21056
- require$$0.useEffect(t.current || !n ? () => {
21057
- t.current = false;
21058
- } : e, r);
21059
- }
21060
- var l = he;
21061
- function D() {
20752
+ const isEmptyPayload = Object.keys(payload).length === 0;
20753
+ const isExpanded = expandedSections.has("payload");
20754
+ const isEditing = editingSection === "payload";
20755
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-input-panel ${className}`, children: [
20756
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-header", children: [
20757
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-input-title", children: "Test Payload" }),
20758
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-actions", children: [
20759
+ /* @__PURE__ */ jsxRuntime.jsxs(
20760
+ "button",
20761
+ {
20762
+ className: "df-debug-btn-sm",
20763
+ onClick: handleLoadSample,
20764
+ title: "Load sample data",
20765
+ children: [
20766
+ /* @__PURE__ */ jsxRuntime.jsx(FileJson, { size: 12 }),
20767
+ "Sample"
20768
+ ]
20769
+ }
20770
+ ),
20771
+ /* @__PURE__ */ jsxRuntime.jsxs(
20772
+ "button",
20773
+ {
20774
+ className: "df-debug-btn-sm",
20775
+ onClick: handleClear,
20776
+ title: "Clear all data",
20777
+ children: [
20778
+ /* @__PURE__ */ jsxRuntime.jsx(RefreshCw, { size: 12 }),
20779
+ "Clear"
20780
+ ]
20781
+ }
20782
+ )
20783
+ ] })
20784
+ ] }),
20785
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-input-sections", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-section", children: [
20786
+ /* @__PURE__ */ jsxRuntime.jsxs(
20787
+ "div",
20788
+ {
20789
+ className: "df-debug-input-section-header",
20790
+ onClick: () => !isEditing && toggleSection("payload"),
20791
+ children: [
20792
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-toggle", children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: 14 }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { size: 14 }) }),
20793
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-label", children: "Payload" }),
20794
+ isEmptyPayload && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-empty", children: "(empty)" }),
20795
+ !isEditing && /* @__PURE__ */ jsxRuntime.jsx(
20796
+ "button",
20797
+ {
20798
+ className: "df-debug-section-edit",
20799
+ onClick: (e) => {
20800
+ e.stopPropagation();
20801
+ startEditing();
20802
+ },
20803
+ title: "Edit Payload",
20804
+ children: "Edit"
20805
+ }
20806
+ )
20807
+ ]
20808
+ }
20809
+ ),
20810
+ isExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-input-section-content", children: isEditing ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-editor", children: [
20811
+ /* @__PURE__ */ jsxRuntime.jsx(
20812
+ "textarea",
20813
+ {
20814
+ className: "df-debug-input-textarea",
20815
+ value: editText,
20816
+ onChange: (e) => setEditText(e.target.value),
20817
+ placeholder: "Enter payload as JSON...",
20818
+ spellCheck: false
20819
+ }
20820
+ ),
20821
+ parseError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-input-error", children: parseError }),
20822
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-editor-actions", children: [
20823
+ /* @__PURE__ */ jsxRuntime.jsx(
20824
+ "button",
20825
+ {
20826
+ className: "df-debug-btn-sm df-debug-btn-cancel",
20827
+ onClick: cancelEditing,
20828
+ children: "Cancel"
20829
+ }
20830
+ ),
20831
+ /* @__PURE__ */ jsxRuntime.jsx(
20832
+ "button",
20833
+ {
20834
+ className: "df-debug-btn-sm df-debug-btn-save",
20835
+ onClick: saveEditing,
20836
+ children: "Save"
20837
+ }
20838
+ )
20839
+ ] })
20840
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "df-debug-input-preview", children: formatValue2(payload) }) })
20841
+ ] }) }),
20842
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-input-footer", children: /* @__PURE__ */ jsxRuntime.jsx(
20843
+ "button",
20844
+ {
20845
+ className: "df-debug-run-btn",
20846
+ onClick: onExecute,
20847
+ disabled: isExecuting,
20848
+ children: isExecuting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
20849
+ /* @__PURE__ */ jsxRuntime.jsx(RefreshCw, { size: 14, className: "df-debug-spin" }),
20850
+ "Executing..."
20851
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
20852
+ /* @__PURE__ */ jsxRuntime.jsx(Play, { size: 14 }),
20853
+ "Run Debug"
20854
+ ] })
20855
+ }
20856
+ ) })
20857
+ ] });
21062
20858
  }
21063
- function h(e, r, n, t) {
21064
- return De(e, t) || be(e, r, n, t);
20859
+ function MessageStatePanel({ className = "" }) {
20860
+ const { currentStep, currentMessage, currentChanges } = useDebugger();
20861
+ const [activeTab, setActiveTab] = require$$0.useState("message");
20862
+ if (!currentStep || !currentMessage) {
20863
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `df-debug-state-panel df-debug-state-empty ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No step selected. Run debug to see message state changes." }) });
20864
+ }
20865
+ const { workflow_id, task_id, result } = currentStep;
20866
+ const tabs = [
20867
+ { key: "message", label: "Message" },
20868
+ { key: "changes", label: `Changes (${currentChanges.length})` }
20869
+ ];
20870
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-state-panel ${className}`, children: [
20871
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-state-header", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-state-tabs", children: tabs.map(({ key, label }) => /* @__PURE__ */ jsxRuntime.jsx(
20872
+ "button",
20873
+ {
20874
+ className: `df-debug-state-tab ${activeTab === key ? "df-debug-state-tab-active" : ""}`,
20875
+ onClick: () => setActiveTab(key),
20876
+ children: label
20877
+ },
20878
+ key
20879
+ )) }) }),
20880
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-state-content", children: [
20881
+ activeTab === "message" && /* @__PURE__ */ jsxRuntime.jsx(MessageView, { message: currentMessage }),
20882
+ activeTab === "changes" && /* @__PURE__ */ jsxRuntime.jsx(ChangesView, { changes: currentChanges })
20883
+ ] }),
20884
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-state-footer", children: [
20885
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-state-step-type", children: [
20886
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `df-debug-state-badge df-debug-state-badge-${result}`, children: result }),
20887
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-debug-state-type-label", children: [
20888
+ workflow_id,
20889
+ task_id ? ` / ${task_id}` : ""
20890
+ ] })
20891
+ ] }),
20892
+ currentMessage.errors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-state-error", children: [
20893
+ "Errors: ",
20894
+ currentMessage.errors.length
20895
+ ] })
20896
+ ] })
20897
+ ] });
21065
20898
  }
21066
- function De(e, r) {
21067
- return e.editor.getModel(te(e, r));
20899
+ function MessageView({ message }) {
20900
+ const [expandedSections, setExpandedSections] = require$$0.useState(
20901
+ /* @__PURE__ */ new Set(["context"])
20902
+ );
20903
+ const toggleSection = (section) => {
20904
+ setExpandedSections((prev) => {
20905
+ const next = new Set(prev);
20906
+ if (next.has(section)) {
20907
+ next.delete(section);
20908
+ } else {
20909
+ next.add(section);
20910
+ }
20911
+ return next;
20912
+ });
20913
+ };
20914
+ const sections = [
20915
+ { key: "context", value: message.context },
20916
+ { key: "payload", value: message.payload },
20917
+ { key: "errors", value: message.errors },
20918
+ { key: "audit_trail", value: message.audit_trail }
20919
+ ];
20920
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-message-view", children: sections.map(({ key, value }) => {
20921
+ const isExpanded = expandedSections.has(key);
20922
+ const isEmpty2 = Array.isArray(value) ? value.length === 0 : typeof value === "object" && value !== null ? Object.keys(value).length === 0 : !value;
20923
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-message-section", children: [
20924
+ /* @__PURE__ */ jsxRuntime.jsxs(
20925
+ "div",
20926
+ {
20927
+ className: "df-debug-message-section-header",
20928
+ onClick: () => toggleSection(key),
20929
+ children: [
20930
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-arrow", children: isExpanded ? "▼" : "▶" }),
20931
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-key", children: key }),
20932
+ isEmpty2 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-empty", children: "(empty)" })
20933
+ ]
20934
+ }
20935
+ ),
20936
+ isExpanded && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "df-debug-message-section-content", children: JSON.stringify(value, null, 2) })
20937
+ ] }, key);
20938
+ }) });
21068
20939
  }
21069
- function be(e, r, n, t) {
21070
- return e.editor.createModel(r, n, t ? te(e, t) : void 0);
20940
+ function ChangesView({ changes }) {
20941
+ if (changes.length === 0) {
20942
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-changes-empty", children: "No changes recorded in this step" });
20943
+ }
20944
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-changes-view", children: changes.map((change, index2) => {
20945
+ const isModified = change.old_value !== void 0 && change.new_value !== void 0;
20946
+ const isAdded = change.old_value === void 0 && change.new_value !== void 0;
20947
+ const isRemoved = change.old_value !== void 0 && change.new_value === void 0;
20948
+ const changeType = isAdded ? "added" : isRemoved ? "removed" : "modified";
20949
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-change-item df-debug-change-${changeType}`, children: [
20950
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-change-header", children: [
20951
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `df-debug-change-op df-debug-change-op-${changeType}`, children: changeType }),
20952
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-path", children: change.path })
20953
+ ] }),
20954
+ isModified && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-change-values", children: [
20955
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-old", children: formatValue(change.old_value) }),
20956
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-arrow", children: "→" }),
20957
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-new", children: formatValue(change.new_value) })
20958
+ ] }),
20959
+ isAdded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-change-values", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-new", children: formatValue(change.new_value) }) }),
20960
+ isRemoved && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-change-values", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-old", children: formatValue(change.old_value) }) })
20961
+ ] }, index2);
20962
+ }) });
21071
20963
  }
21072
- function te(e, r) {
21073
- return e.Uri.parse(r);
20964
+ function formatValue(value) {
20965
+ if (value === void 0) return "undefined";
20966
+ if (value === null) return "null";
20967
+ if (typeof value === "string") return `"${value}"`;
20968
+ if (typeof value === "object") return JSON.stringify(value);
20969
+ return String(value);
21074
20970
  }
21075
- function Oe({ original: e, modified: r, language: n, originalLanguage: t, modifiedLanguage: a, originalModelPath: m, modifiedModelPath: E, keepCurrentOriginalModel: g = false, keepCurrentModifiedModel: N = false, theme: x = "light", loading: P = "Loading...", options: y = {}, height: V = "100%", width: z = "100%", className: F, wrapperProps: j = {}, beforeMount: A = D, onMount: q = D }) {
21076
- let [M, O] = require$$0.useState(false), [T, s] = require$$0.useState(true), u = require$$0.useRef(null), c = require$$0.useRef(null), w = require$$0.useRef(null), d = require$$0.useRef(q), o = require$$0.useRef(A), b = require$$0.useRef(false);
21077
- k(() => {
21078
- let i = loader.init();
21079
- 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();
21080
- }), l(() => {
21081
- if (u.current && c.current) {
21082
- let i = u.current.getOriginalEditor(), f = h(c.current, e || "", t || n || "text", m || "");
21083
- f !== i.getModel() && i.setModel(f);
21084
- }
21085
- }, [m], M), l(() => {
21086
- if (u.current && c.current) {
21087
- let i = u.current.getModifiedEditor(), f = h(c.current, r || "", a || n || "text", E || "");
21088
- f !== i.getModel() && i.setModel(f);
21089
- }
21090
- }, [E], M), l(() => {
21091
- let i = u.current.getModifiedEditor();
21092
- 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());
21093
- }, [r], M), l(() => {
21094
- var _a, _b;
21095
- (_b = (_a = u.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.original.setValue(e || "");
21096
- }, [e], M), l(() => {
21097
- let { original: i, modified: f } = u.current.getModel();
21098
- c.current.editor.setModelLanguage(i, t || n || "text"), c.current.editor.setModelLanguage(f, a || n || "text");
21099
- }, [n, t, a], M), l(() => {
21100
- var _a;
21101
- (_a = c.current) == null ? void 0 : _a.editor.setTheme(x);
21102
- }, [x], M), l(() => {
21103
- var _a;
21104
- (_a = u.current) == null ? void 0 : _a.updateOptions(y);
21105
- }, [y], M);
21106
- let L = require$$0.useCallback(() => {
21107
- var _a;
21108
- if (!c.current) return;
21109
- o.current(c.current);
21110
- let i = h(c.current, e || "", t || n || "text", m || ""), f = h(c.current, r || "", a || n || "text", E || "");
21111
- (_a = u.current) == null ? void 0 : _a.setModel({ original: i, modified: f });
21112
- }, [n, r, a, e, t, m, E]), U = require$$0.useCallback(() => {
21113
- var _a;
21114
- !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);
21115
- }, [y, x, L]);
20971
+ function DebugInfoBubble({
20972
+ step,
20973
+ targetRef,
20974
+ visible,
20975
+ onClose
20976
+ }) {
20977
+ var _a;
20978
+ const [position, setPosition] = require$$0.useState({ top: 0, left: 0 });
20979
+ const bubbleRef = require$$0.useRef(null);
21116
20980
  require$$0.useEffect(() => {
21117
- M && d.current(u.current, c.current);
21118
- }, [M]), require$$0.useEffect(() => {
21119
- !T && !M && U();
21120
- }, [T, M, U]);
21121
- function I() {
21122
- var _a, _b, _c, _d;
21123
- let i = (_a = u.current) == null ? void 0 : _a.getModel();
21124
- 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();
20981
+ if (!visible || !targetRef.current) return;
20982
+ const updatePosition = () => {
20983
+ var _a2, _b;
20984
+ const targetRect = (_a2 = targetRef.current) == null ? void 0 : _a2.getBoundingClientRect();
20985
+ const bubbleRect = (_b = bubbleRef.current) == null ? void 0 : _b.getBoundingClientRect();
20986
+ if (!targetRect) return;
20987
+ let top = targetRect.bottom + 8;
20988
+ let left = targetRect.left;
20989
+ if (bubbleRect) {
20990
+ if (left + bubbleRect.width > window.innerWidth - 16) {
20991
+ left = window.innerWidth - bubbleRect.width - 16;
20992
+ }
20993
+ if (top + bubbleRect.height > window.innerHeight - 16) {
20994
+ top = targetRect.top - bubbleRect.height - 8;
20995
+ }
20996
+ }
20997
+ setPosition({ top, left });
20998
+ };
20999
+ updatePosition();
21000
+ window.addEventListener("scroll", updatePosition, true);
21001
+ window.addEventListener("resize", updatePosition);
21002
+ return () => {
21003
+ window.removeEventListener("scroll", updatePosition, true);
21004
+ window.removeEventListener("resize", updatePosition);
21005
+ };
21006
+ }, [visible, targetRef]);
21007
+ if (!visible) return null;
21008
+ const { workflow_id, task_id, result, message } = step;
21009
+ const state = result === "executed" ? "executed" : "skipped";
21010
+ const hasError = message && message.errors && message.errors.length > 0;
21011
+ const displayState = hasError ? "error" : state;
21012
+ return reactDom.createPortal(
21013
+ /* @__PURE__ */ jsxRuntime.jsxs(
21014
+ "div",
21015
+ {
21016
+ ref: bubbleRef,
21017
+ className: "df-debug-bubble",
21018
+ style: {
21019
+ position: "fixed",
21020
+ top: position.top,
21021
+ left: position.left
21022
+ },
21023
+ children: [
21024
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-header", children: [
21025
+ /* @__PURE__ */ jsxRuntime.jsx(StateIcon, { state: displayState }),
21026
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-title", children: task_id ? "Task Step" : "Workflow Skipped" }),
21027
+ onClose && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "df-debug-bubble-close", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(X, { size: 14 }) })
21028
+ ] }),
21029
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-content", children: [
21030
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-row", children: [
21031
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-label", children: "Workflow:" }),
21032
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-value", children: workflow_id })
21033
+ ] }),
21034
+ task_id && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-row", children: [
21035
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-label", children: "Task:" }),
21036
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-value", children: task_id })
21037
+ ] }),
21038
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-row", children: [
21039
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-label", children: "Result:" }),
21040
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `df-debug-bubble-state df-debug-bubble-state-${displayState}`, children: result })
21041
+ ] }),
21042
+ hasError && (message == null ? void 0 : message.errors) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-error", children: [
21043
+ /* @__PURE__ */ jsxRuntime.jsx(CircleAlert, { size: 14 }),
21044
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: ((_a = message.errors[0]) == null ? void 0 : _a.message) || "Unknown error" })
21045
+ ] })
21046
+ ] })
21047
+ ]
21048
+ }
21049
+ ),
21050
+ document.body
21051
+ );
21052
+ }
21053
+ function StateIcon({ state }) {
21054
+ switch (state) {
21055
+ case "executed":
21056
+ return /* @__PURE__ */ jsxRuntime.jsx(Check, { size: 16, className: "df-debug-icon-executed" });
21057
+ case "skipped":
21058
+ return /* @__PURE__ */ jsxRuntime.jsx(SkipForward, { size: 16, className: "df-debug-icon-skipped" });
21059
+ case "error":
21060
+ return /* @__PURE__ */ jsxRuntime.jsx(CircleAlert, { size: 16, className: "df-debug-icon-error" });
21061
+ case "current":
21062
+ return /* @__PURE__ */ jsxRuntime.jsx(Clock, { size: 16, className: "df-debug-icon-current" });
21063
+ case "pending":
21064
+ default:
21065
+ return /* @__PURE__ */ jsxRuntime.jsx(Clock, { size: 16, className: "df-debug-icon-pending" });
21125
21066
  }
21126
- return require$$0.createElement(H, { width: z, height: V, isEditorReady: M, loading: P, _ref: w, className: F, wrapperProps: j });
21127
21067
  }
21128
- var ie = Oe;
21129
- require$$0.memo(ie);
21130
- function He(e) {
21131
- let r = require$$0.useRef();
21132
- return require$$0.useEffect(() => {
21133
- r.current = e;
21134
- }, [e]), r.current;
21068
+ function DebugStateBadge({
21069
+ state,
21070
+ conditionResult,
21071
+ size = "sm"
21072
+ }) {
21073
+ const iconSize = size === "sm" ? 12 : 14;
21074
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `df-debug-badge df-debug-badge-${state} df-debug-badge-${size}`, children: [
21075
+ /* @__PURE__ */ jsxRuntime.jsx(StateIcon, { state }),
21076
+ conditionResult !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `df-debug-badge-condition ${conditionResult ? "df-debug-badge-condition-pass" : "df-debug-badge-condition-fail"}`, children: conditionResult ? /* @__PURE__ */ jsxRuntime.jsx(Check, { size: iconSize }) : /* @__PURE__ */ jsxRuntime.jsx(X, { size: iconSize }) })
21077
+ ] });
21135
21078
  }
21136
- var se = He;
21137
- var _ = /* @__PURE__ */ new Map();
21138
- function Ve({ defaultValue: e, defaultLanguage: r, defaultPath: n, value: t, language: a, path: m, theme: E = "light", line: g, loading: N = "Loading...", options: x = {}, overrideServices: P = {}, saveViewState: y = true, keepCurrentModel: V = false, width: z = "100%", height: F = "100%", className: j, wrapperProps: A = {}, beforeMount: q = D, onMount: M = D, onChange: O, onValidate: T = D }) {
21139
- let [s, u] = require$$0.useState(false), [c, w] = require$$0.useState(true), d = require$$0.useRef(null), o = require$$0.useRef(null), b = require$$0.useRef(null), L = require$$0.useRef(M), U = require$$0.useRef(q), I = require$$0.useRef(), i = require$$0.useRef(t), f = se(m), Q = require$$0.useRef(false), B = require$$0.useRef(false);
21140
- k(() => {
21141
- let p = loader.init();
21142
- 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();
21143
- }), l(() => {
21144
- var _a, _b, _c, _d;
21145
- let p = h(d.current, e || t || "", r || a || "", m || n || "");
21146
- 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))));
21147
- }, [m], s), l(() => {
21148
- var _a;
21149
- (_a = o.current) == null ? void 0 : _a.updateOptions(x);
21150
- }, [x], s), l(() => {
21151
- !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));
21152
- }, [t], s), l(() => {
21079
+ function IntegratedDebugToolbar({
21080
+ workflows,
21081
+ payload,
21082
+ autoExecute = false,
21083
+ onExecutionComplete,
21084
+ onExecutionError,
21085
+ className = ""
21086
+ }) {
21087
+ const {
21088
+ state,
21089
+ play,
21090
+ pause,
21091
+ stop,
21092
+ reset,
21093
+ stepForward,
21094
+ stepBackward,
21095
+ goToStep,
21096
+ startExecution,
21097
+ executeTrace,
21098
+ setExecutionError,
21099
+ runExecution,
21100
+ isAtStart,
21101
+ isAtEnd,
21102
+ hasTrace,
21103
+ totalSteps,
21104
+ isEngineReady
21105
+ } = useDebugger();
21106
+ const { playbackState, currentStepIndex, isExecuting, executionError, trace } = state;
21107
+ const lastExecutionRef = require$$0.useRef(null);
21108
+ const handleExecute = require$$0.useCallback(async () => {
21153
21109
  var _a, _b;
21154
- let p = (_a = o.current) == null ? void 0 : _a.getModel();
21155
- p && a && ((_b = d.current) == null ? void 0 : _b.editor.setModelLanguage(p, a));
21156
- }, [a], s), l(() => {
21157
- var _a;
21158
- g !== void 0 && ((_a = o.current) == null ? void 0 : _a.revealLine(g));
21159
- }, [g], s), l(() => {
21160
- var _a;
21161
- (_a = d.current) == null ? void 0 : _a.editor.setTheme(E);
21162
- }, [E], s);
21163
- let X2 = require$$0.useCallback(() => {
21164
- var _a;
21165
- if (!(!b.current || !d.current) && !Q.current) {
21166
- U.current(d.current);
21167
- let p = m || n, R = h(d.current, t || e || "", r || a || "", p || "");
21168
- 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;
21110
+ if (!isEngineReady || workflows.length === 0) return;
21111
+ const workflowsJson = JSON.stringify(workflows);
21112
+ const payloadJson = JSON.stringify(payload || {});
21113
+ const current = { workflows: workflowsJson, payload: payloadJson };
21114
+ if (((_a = lastExecutionRef.current) == null ? void 0 : _a.workflows) === current.workflows && ((_b = lastExecutionRef.current) == null ? void 0 : _b.payload) === current.payload) {
21115
+ return;
21169
21116
  }
21170
- }, [e, r, n, t, a, m, x, P, y, E, g]);
21171
- require$$0.useEffect(() => {
21172
- s && L.current(o.current, d.current);
21173
- }, [s]), require$$0.useEffect(() => {
21174
- !c && !s && X2();
21175
- }, [c, s, X2]), i.current = t, require$$0.useEffect(() => {
21176
- var _a, _b;
21177
- s && O && ((_a = I.current) == null ? void 0 : _a.dispose(), I.current = (_b = o.current) == null ? void 0 : _b.onDidChangeModelContent((p) => {
21178
- B.current || O(o.current.getValue(), p);
21179
- }));
21180
- }, [s, O]), require$$0.useEffect(() => {
21181
- if (s) {
21182
- let p = d.current.editor.onDidChangeMarkers((R) => {
21183
- var _a;
21184
- let G = (_a = o.current.getModel()) == null ? void 0 : _a.uri;
21185
- if (G && R.find((J) => J.path === G.path)) {
21186
- let J = d.current.editor.getModelMarkers({ resource: G });
21187
- T == null ? void 0 : T(J);
21188
- }
21189
- });
21190
- return () => {
21191
- p == null ? void 0 : p.dispose();
21192
- };
21117
+ startExecution();
21118
+ try {
21119
+ const result = await runExecution(workflows, payload || {});
21120
+ if (result) {
21121
+ executeTrace(result);
21122
+ lastExecutionRef.current = current;
21123
+ onExecutionComplete == null ? void 0 : onExecutionComplete(result);
21124
+ }
21125
+ } catch (err) {
21126
+ const errorMessage = err instanceof Error ? err.message : "Execution failed";
21127
+ setExecutionError(errorMessage);
21128
+ onExecutionError == null ? void 0 : onExecutionError(errorMessage);
21193
21129
  }
21194
- return () => {
21195
- };
21196
- }, [s, T]);
21197
- function pe() {
21198
- var _a, _b;
21199
- (_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();
21200
- }
21201
- return require$$0.createElement(H, { width: z, height: F, isEditorReady: s, loading: N, _ref: b, className: j, wrapperProps: A });
21202
- }
21203
- var fe = Ve;
21204
- var de = require$$0.memo(fe);
21205
- var Ft = de;
21206
- function findPathLineNumbers(jsonString, paths) {
21207
- if (!paths || paths.length === 0) return [];
21208
- const lines = jsonString.split("\n");
21209
- const lineNumbers = [];
21210
- for (const path of paths) {
21211
- const pathParts = path.split(".");
21212
- const lastKey = pathParts[pathParts.length - 1];
21213
- const keyPattern = new RegExp(`^\\s*"${lastKey}"\\s*:`);
21214
- for (let i = 0; i < lines.length; i++) {
21215
- if (keyPattern.test(lines[i])) {
21216
- if (pathParts.length === 1) {
21217
- lineNumbers.push(i + 1);
21218
- } else {
21219
- let matchedParents = 0;
21220
- for (let j = i - 1; j >= 0 && matchedParents < pathParts.length - 1; j--) {
21221
- const parentKey = pathParts[pathParts.length - 2 - matchedParents];
21222
- const parentPattern = new RegExp(`^\\s*"${parentKey}"\\s*:`);
21223
- if (parentPattern.test(lines[j])) {
21224
- matchedParents++;
21225
- }
21130
+ }, [
21131
+ isEngineReady,
21132
+ workflows,
21133
+ payload,
21134
+ startExecution,
21135
+ runExecution,
21136
+ executeTrace,
21137
+ setExecutionError,
21138
+ onExecutionComplete,
21139
+ onExecutionError
21140
+ ]);
21141
+ const handleReset = require$$0.useCallback(() => {
21142
+ reset();
21143
+ lastExecutionRef.current = null;
21144
+ }, [reset]);
21145
+ const goToFirst = require$$0.useCallback(() => {
21146
+ if (hasTrace) {
21147
+ stop();
21148
+ }
21149
+ }, [hasTrace, stop]);
21150
+ const goToLast = require$$0.useCallback(() => {
21151
+ if (hasTrace && totalSteps > 0) {
21152
+ goToStep(totalSteps - 1);
21153
+ }
21154
+ }, [hasTrace, totalSteps, goToStep]);
21155
+ require$$0.useEffect(() => {
21156
+ if (!autoExecute || !isEngineReady || workflows.length === 0) return;
21157
+ const timeoutId = setTimeout(() => {
21158
+ handleExecute();
21159
+ }, 500);
21160
+ return () => clearTimeout(timeoutId);
21161
+ }, [autoExecute, isEngineReady, workflows, payload]);
21162
+ const handleKeyDown = require$$0.useCallback(
21163
+ (e) => {
21164
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
21165
+ return;
21166
+ }
21167
+ switch (e.key) {
21168
+ case " ":
21169
+ e.preventDefault();
21170
+ if (playbackState === "playing") {
21171
+ pause();
21172
+ } else if (hasTrace && !isAtEnd) {
21173
+ play();
21226
21174
  }
21227
- if (matchedParents >= Math.min(pathParts.length - 1, 2)) {
21228
- lineNumbers.push(i + 1);
21175
+ break;
21176
+ case "ArrowRight":
21177
+ e.preventDefault();
21178
+ if (hasTrace && !isAtEnd) {
21179
+ stepForward();
21229
21180
  }
21230
- }
21181
+ break;
21182
+ case "ArrowLeft":
21183
+ e.preventDefault();
21184
+ if (hasTrace && !isAtStart) {
21185
+ stepBackward();
21186
+ }
21187
+ break;
21188
+ case "Home":
21189
+ e.preventDefault();
21190
+ if (hasTrace) {
21191
+ goToFirst();
21192
+ }
21193
+ break;
21194
+ case "End":
21195
+ e.preventDefault();
21196
+ if (hasTrace) {
21197
+ goToLast();
21198
+ }
21199
+ break;
21200
+ case "r":
21201
+ if (e.metaKey || e.ctrlKey) {
21202
+ e.preventDefault();
21203
+ handleReset();
21204
+ }
21205
+ break;
21231
21206
  }
21207
+ },
21208
+ [playbackState, hasTrace, isAtEnd, isAtStart, play, pause, stepForward, stepBackward, goToFirst, goToLast, handleReset]
21209
+ );
21210
+ require$$0.useEffect(() => {
21211
+ window.addEventListener("keydown", handleKeyDown);
21212
+ return () => window.removeEventListener("keydown", handleKeyDown);
21213
+ }, [handleKeyDown]);
21214
+ const getStatusIcon = () => {
21215
+ var _a;
21216
+ if (isExecuting) {
21217
+ return /* @__PURE__ */ jsxRuntime.jsx(LoaderCircle, { size: 14, className: "df-debug-spin" });
21232
21218
  }
21233
- }
21234
- return [...new Set(lineNumbers)];
21235
- }
21236
- const defineThemes = (monaco) => {
21237
- monaco.editor.defineTheme("vscode-dark", {
21238
- base: "vs-dark",
21239
- inherit: true,
21240
- rules: [
21241
- { token: "string.key.json", foreground: "9CDCFE" },
21242
- { token: "string.value.json", foreground: "CE9178" },
21243
- { token: "number", foreground: "B5CEA8" },
21244
- { token: "keyword", foreground: "569CD6" },
21245
- { token: "delimiter", foreground: "D4D4D4" }
21246
- ],
21247
- colors: {
21248
- "editor.background": "#1e1e1e",
21249
- "editor.foreground": "#d4d4d4",
21250
- "editor.lineHighlightBackground": "#2d2d2d",
21251
- "editor.selectionBackground": "#264f78",
21252
- "editorCursor.foreground": "#aeafad",
21253
- "editorLineNumber.foreground": "#858585",
21254
- "editorLineNumber.activeForeground": "#c6c6c6",
21255
- "editorIndentGuide.background": "#404040",
21256
- "editorIndentGuide.activeBackground": "#707070",
21257
- "editor.selectionHighlightBackground": "#3a3d41",
21258
- "editorBracketMatch.background": "#0064001a",
21259
- "editorBracketMatch.border": "#888888",
21260
- "editorGutter.background": "#1e1e1e",
21261
- "scrollbarSlider.background": "#79797966",
21262
- "scrollbarSlider.hoverBackground": "#646464b3",
21263
- "scrollbarSlider.activeBackground": "#bfbfbf66",
21264
- "minimap.background": "#1e1e1e"
21219
+ if (executionError) {
21220
+ return /* @__PURE__ */ jsxRuntime.jsx(CircleX, { size: 14, className: "df-debug-toolbar-status-error" });
21265
21221
  }
21266
- });
21267
- monaco.editor.defineTheme("vscode-light", {
21268
- base: "vs",
21269
- inherit: true,
21270
- rules: [
21271
- { token: "string.key.json", foreground: "0451A5" },
21272
- { token: "string.value.json", foreground: "A31515" },
21273
- { token: "number", foreground: "098658" },
21274
- { token: "keyword", foreground: "0000FF" },
21275
- { token: "delimiter", foreground: "000000" }
21276
- ],
21277
- colors: {
21278
- "editor.background": "#ffffff",
21279
- "editor.foreground": "#000000",
21280
- "editor.lineHighlightBackground": "#f5f5f5",
21281
- "editor.selectionBackground": "#add6ff",
21282
- "editorCursor.foreground": "#000000",
21283
- "editorLineNumber.foreground": "#999999",
21284
- "editorLineNumber.activeForeground": "#000000",
21285
- "editorIndentGuide.background": "#d3d3d3",
21286
- "editorIndentGuide.activeBackground": "#939393",
21287
- "editor.selectionHighlightBackground": "#add6ff4d",
21288
- "editorBracketMatch.background": "#0064001a",
21289
- "editorBracketMatch.border": "#b9b9b9",
21290
- "editorGutter.background": "#ffffff",
21291
- "scrollbarSlider.background": "#64646466",
21292
- "scrollbarSlider.hoverBackground": "#646464b3",
21293
- "scrollbarSlider.activeBackground": "#00000099",
21294
- "minimap.background": "#ffffff"
21222
+ if (hasTrace) {
21223
+ const finalStep = trace == null ? void 0 : trace.steps[trace.steps.length - 1];
21224
+ const hasErrors = ((_a = finalStep == null ? void 0 : finalStep.message) == null ? void 0 : _a.errors) && finalStep.message.errors.length > 0;
21225
+ if (hasErrors) {
21226
+ return /* @__PURE__ */ jsxRuntime.jsx(CircleAlert, { size: 14, className: "df-debug-toolbar-status-warning" });
21227
+ }
21228
+ return /* @__PURE__ */ jsxRuntime.jsx(CircleCheckBig, { size: 14, className: "df-debug-toolbar-status-success" });
21229
+ }
21230
+ return null;
21231
+ };
21232
+ const getStepText = () => {
21233
+ if (isExecuting) {
21234
+ return "Executing...";
21235
+ }
21236
+ if (!hasTrace) {
21237
+ return "Ready";
21295
21238
  }
21296
- });
21297
- };
21298
- function JsonEditor({
21239
+ if (currentStepIndex < 0) {
21240
+ return "Ready";
21241
+ }
21242
+ return `Step ${currentStepIndex + 1} / ${totalSteps}`;
21243
+ };
21244
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-toolbar-integrated ${className}`, children: [
21245
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-toolbar-status", children: [
21246
+ getStatusIcon(),
21247
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-toolbar-step-text", children: getStepText() })
21248
+ ] }),
21249
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-toolbar-controls", children: [
21250
+ /* @__PURE__ */ jsxRuntime.jsx(
21251
+ "button",
21252
+ {
21253
+ className: "df-debug-toolbar-btn",
21254
+ onClick: goToFirst,
21255
+ disabled: !hasTrace || isAtStart || isExecuting,
21256
+ title: "First step (Home)",
21257
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronsLeft, { size: 14 })
21258
+ }
21259
+ ),
21260
+ /* @__PURE__ */ jsxRuntime.jsx(
21261
+ "button",
21262
+ {
21263
+ className: "df-debug-toolbar-btn",
21264
+ onClick: stepBackward,
21265
+ disabled: !hasTrace || isAtStart || isExecuting,
21266
+ title: "Previous step (Left Arrow)",
21267
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeft, { size: 14 })
21268
+ }
21269
+ ),
21270
+ playbackState === "playing" ? /* @__PURE__ */ jsxRuntime.jsx(
21271
+ "button",
21272
+ {
21273
+ className: "df-debug-toolbar-btn df-debug-toolbar-btn-primary",
21274
+ onClick: pause,
21275
+ disabled: !hasTrace || isExecuting,
21276
+ title: "Pause (Space)",
21277
+ children: /* @__PURE__ */ jsxRuntime.jsx(Pause, { size: 14 })
21278
+ }
21279
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
21280
+ "button",
21281
+ {
21282
+ className: "df-debug-toolbar-btn df-debug-toolbar-btn-primary",
21283
+ onClick: play,
21284
+ disabled: !hasTrace || isAtEnd || isExecuting,
21285
+ title: "Play (Space)",
21286
+ children: /* @__PURE__ */ jsxRuntime.jsx(Play, { size: 14 })
21287
+ }
21288
+ ),
21289
+ /* @__PURE__ */ jsxRuntime.jsx(
21290
+ "button",
21291
+ {
21292
+ className: "df-debug-toolbar-btn",
21293
+ onClick: stepForward,
21294
+ disabled: !hasTrace || isAtEnd || isExecuting,
21295
+ title: "Next step (Right Arrow)",
21296
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { size: 14 })
21297
+ }
21298
+ ),
21299
+ /* @__PURE__ */ jsxRuntime.jsx(
21300
+ "button",
21301
+ {
21302
+ className: "df-debug-toolbar-btn",
21303
+ onClick: goToLast,
21304
+ disabled: !hasTrace || isAtEnd || isExecuting,
21305
+ title: "Last step (End)",
21306
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronsRight, { size: 14 })
21307
+ }
21308
+ )
21309
+ ] }),
21310
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-toolbar-actions", children: hasTrace ? /* @__PURE__ */ jsxRuntime.jsxs(
21311
+ "button",
21312
+ {
21313
+ className: "df-debug-toolbar-btn-action df-debug-toolbar-btn-reset",
21314
+ onClick: handleReset,
21315
+ disabled: isExecuting,
21316
+ title: "Reset (Ctrl+R)",
21317
+ children: [
21318
+ /* @__PURE__ */ jsxRuntime.jsx(RotateCcw, { size: 12 }),
21319
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Reset" })
21320
+ ]
21321
+ }
21322
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
21323
+ "button",
21324
+ {
21325
+ className: "df-debug-toolbar-btn-action df-debug-toolbar-btn-run",
21326
+ onClick: handleExecute,
21327
+ disabled: !isEngineReady || isExecuting || workflows.length === 0,
21328
+ title: "Run workflow",
21329
+ children: [
21330
+ isExecuting ? /* @__PURE__ */ jsxRuntime.jsx(LoaderCircle, { size: 12, className: "df-debug-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(Play, { size: 12 }),
21331
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: isExecuting ? "Running..." : "Run" })
21332
+ ]
21333
+ }
21334
+ ) })
21335
+ ] });
21336
+ }
21337
+ function SearchInput({
21299
21338
  value,
21300
21339
  onChange,
21301
- readOnly = false,
21302
- className = "",
21303
- theme = "dark",
21304
- onCursorChange,
21305
- highlightedPaths
21340
+ onClear,
21341
+ placeholder = "Search...",
21342
+ className = ""
21306
21343
  }) {
21307
- const editorRef = require$$0.useRef(null);
21308
- const decorationsRef = require$$0.useRef([]);
21309
- const handleEditorMount = require$$0.useCallback((editor, monaco) => {
21310
- editorRef.current = editor;
21311
- monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
21312
- validate: true,
21313
- schemas: [],
21314
- allowComments: false,
21315
- trailingCommas: "error"
21316
- });
21317
- if (onCursorChange) {
21318
- editor.onDidChangeCursorPosition((e) => {
21319
- onCursorChange(e.position.lineNumber, e.position.column);
21320
- });
21344
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-search-input ${className}`, children: [
21345
+ /* @__PURE__ */ jsxRuntime.jsx(Search, { className: "df-search-icon", size: 16 }),
21346
+ /* @__PURE__ */ jsxRuntime.jsx(
21347
+ "input",
21348
+ {
21349
+ type: "text",
21350
+ value,
21351
+ onChange: (e) => onChange(e.target.value),
21352
+ placeholder,
21353
+ className: "df-search-field"
21354
+ }
21355
+ ),
21356
+ value && onClear && /* @__PURE__ */ jsxRuntime.jsx(
21357
+ "button",
21358
+ {
21359
+ onClick: onClear,
21360
+ className: "df-search-clear",
21361
+ "aria-label": "Clear search",
21362
+ children: /* @__PURE__ */ jsxRuntime.jsx(X, { size: 14 })
21363
+ }
21364
+ )
21365
+ ] });
21366
+ }
21367
+ function JsonViewer({
21368
+ data,
21369
+ initialExpanded = false,
21370
+ maxStringLength = 50,
21371
+ className = ""
21372
+ }) {
21373
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `df-json-viewer ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(
21374
+ JsonNode,
21375
+ {
21376
+ data,
21377
+ initialExpanded,
21378
+ maxStringLength
21321
21379
  }
21322
- if (!readOnly) {
21323
- editor.focus();
21380
+ ) });
21381
+ }
21382
+ function JsonNode({
21383
+ data,
21384
+ initialExpanded,
21385
+ maxStringLength,
21386
+ keyName,
21387
+ isLast = true
21388
+ }) {
21389
+ const [expanded, setExpanded] = require$$0.useState(initialExpanded);
21390
+ const renderValue = () => {
21391
+ if (data === null) {
21392
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-null", children: "null" });
21324
21393
  }
21325
- }, [onCursorChange, readOnly]);
21326
- require$$0.useEffect(() => {
21327
- if (!editorRef.current || !highlightedPaths || highlightedPaths.length === 0) {
21328
- if (editorRef.current && decorationsRef.current.length > 0) {
21329
- decorationsRef.current = editorRef.current.deltaDecorations(decorationsRef.current, []);
21330
- }
21331
- return;
21394
+ if (data === void 0) {
21395
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-undefined", children: "undefined" });
21332
21396
  }
21333
- const lineNumbers = findPathLineNumbers(value, highlightedPaths);
21334
- if (lineNumbers.length > 0) {
21335
- const decorations = lineNumbers.map((lineNumber) => ({
21336
- range: {
21337
- startLineNumber: lineNumber,
21338
- startColumn: 1,
21339
- endLineNumber: lineNumber,
21340
- endColumn: 1
21341
- },
21342
- options: {
21343
- isWholeLine: true,
21344
- className: "df-highlighted-line",
21345
- glyphMarginClassName: "df-highlighted-glyph",
21346
- overviewRuler: {
21347
- color: theme === "dark" ? "#4ec9b0" : "#388a34",
21348
- position: 1
21349
- // Left
21350
- }
21351
- }
21352
- }));
21353
- decorationsRef.current = editorRef.current.deltaDecorations(
21354
- decorationsRef.current,
21355
- decorations
21356
- );
21357
- } else {
21358
- decorationsRef.current = editorRef.current.deltaDecorations(decorationsRef.current, []);
21397
+ if (typeof data === "boolean") {
21398
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-boolean", children: data.toString() });
21359
21399
  }
21360
- }, [value, highlightedPaths, theme]);
21361
- const handleChange = require$$0.useCallback((newValue) => {
21362
- onChange(newValue || "");
21363
- }, [onChange]);
21364
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `df-monaco-editor-wrapper ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(
21365
- Ft,
21366
- {
21367
- height: "100%",
21368
- defaultLanguage: "json",
21369
- value,
21370
- onChange: handleChange,
21371
- onMount: handleEditorMount,
21372
- beforeMount: defineThemes,
21373
- theme: theme === "dark" ? "vscode-dark" : "vscode-light",
21374
- options: {
21375
- readOnly,
21376
- minimap: { enabled: false },
21377
- fontSize: 13,
21378
- fontFamily: "'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace",
21379
- lineHeight: 20,
21380
- tabSize: 2,
21381
- insertSpaces: true,
21382
- automaticLayout: true,
21383
- scrollBeyondLastLine: false,
21384
- wordWrap: "on",
21385
- wrappingIndent: "indent",
21386
- folding: true,
21387
- foldingStrategy: "indentation",
21388
- showFoldingControls: "mouseover",
21389
- bracketPairColorization: { enabled: true },
21390
- guides: {
21391
- bracketPairs: false,
21392
- indentation: false,
21393
- highlightActiveBracketPair: true,
21394
- highlightActiveIndentation: false
21395
- },
21396
- renderLineHighlight: readOnly ? "none" : "line",
21397
- selectOnLineNumbers: true,
21398
- roundedSelection: true,
21399
- cursorBlinking: "smooth",
21400
- cursorSmoothCaretAnimation: "on",
21401
- smoothScrolling: true,
21402
- padding: { top: 8, bottom: 8 },
21403
- scrollbar: {
21404
- vertical: "auto",
21405
- horizontal: "auto",
21406
- verticalScrollbarSize: 10,
21407
- horizontalScrollbarSize: 10
21408
- },
21409
- overviewRulerBorder: false,
21410
- hideCursorInOverviewRuler: true,
21411
- contextmenu: true,
21412
- quickSuggestions: false,
21413
- suggestOnTriggerCharacters: false,
21414
- acceptSuggestionOnEnter: "off",
21415
- formatOnPaste: true,
21416
- formatOnType: false,
21417
- glyphMargin: highlightedPaths && highlightedPaths.length > 0
21400
+ if (typeof data === "number") {
21401
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-number", children: data });
21402
+ }
21403
+ if (typeof data === "string") {
21404
+ const display = data.length > maxStringLength ? `${data.slice(0, maxStringLength)}...` : data;
21405
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-string", children: [
21406
+ '"',
21407
+ display,
21408
+ '"'
21409
+ ] });
21410
+ }
21411
+ if (Array.isArray(data)) {
21412
+ if (data.length === 0) {
21413
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "[]" });
21418
21414
  }
21415
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-array", children: [
21416
+ /* @__PURE__ */ jsxRuntime.jsx(
21417
+ "button",
21418
+ {
21419
+ onClick: () => setExpanded(!expanded),
21420
+ className: "df-json-toggle",
21421
+ children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: 12 }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { size: 12 })
21422
+ }
21423
+ ),
21424
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "[" }),
21425
+ !expanded && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-preview", children: [
21426
+ data.length,
21427
+ " item",
21428
+ data.length !== 1 ? "s" : ""
21429
+ ] }),
21430
+ expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-json-children", children: data.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsx(
21431
+ JsonNode,
21432
+ {
21433
+ data: item,
21434
+ initialExpanded: false,
21435
+ maxStringLength,
21436
+ isLast: index2 === data.length - 1
21437
+ },
21438
+ index2
21439
+ )) }),
21440
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "]" })
21441
+ ] });
21419
21442
  }
21420
- ) });
21421
- }
21422
- class ErrorBoundary extends require$$0.Component {
21423
- constructor(props) {
21424
- super(props);
21425
- this.state = { hasError: false, error: null };
21426
- }
21427
- static getDerivedStateFromError(error) {
21428
- return { hasError: true, error };
21429
- }
21430
- componentDidCatch(error, errorInfo) {
21431
- console.error("ErrorBoundary caught an error:", error, errorInfo);
21432
- }
21433
- render() {
21434
- var _a;
21435
- if (this.state.hasError) {
21436
- if (this.props.fallback) {
21437
- return this.props.fallback;
21443
+ if (typeof data === "object") {
21444
+ const entries = Object.entries(data);
21445
+ if (entries.length === 0) {
21446
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "{}" });
21438
21447
  }
21439
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-error-boundary", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-error-boundary-content", children: [
21440
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "df-error-boundary-title", children: "Something went wrong" }),
21441
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "df-error-boundary-message", children: ((_a = this.state.error) == null ? void 0 : _a.message) || "An unexpected error occurred" }),
21448
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-object", children: [
21442
21449
  /* @__PURE__ */ jsxRuntime.jsx(
21443
21450
  "button",
21444
21451
  {
21445
- className: "df-error-boundary-button",
21446
- onClick: () => this.setState({ hasError: false, error: null }),
21447
- children: "Try again"
21452
+ onClick: () => setExpanded(!expanded),
21453
+ className: "df-json-toggle",
21454
+ children: expanded ? /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: 12 }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { size: 12 })
21448
21455
  }
21449
- )
21450
- ] }) });
21456
+ ),
21457
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "{" }),
21458
+ !expanded && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-preview", children: [
21459
+ entries.length,
21460
+ " key",
21461
+ entries.length !== 1 ? "s" : ""
21462
+ ] }),
21463
+ expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-json-children", children: entries.map(([key, value], index2) => /* @__PURE__ */ jsxRuntime.jsx(
21464
+ JsonNode,
21465
+ {
21466
+ keyName: key,
21467
+ data: value,
21468
+ initialExpanded: false,
21469
+ maxStringLength,
21470
+ isLast: index2 === entries.length - 1
21471
+ },
21472
+ key
21473
+ )) }),
21474
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-bracket", children: "}" })
21475
+ ] });
21451
21476
  }
21452
- return this.props.children;
21477
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { children: String(data) });
21478
+ };
21479
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-json-node", children: [
21480
+ keyName !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
21481
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-json-key", children: [
21482
+ '"',
21483
+ keyName,
21484
+ '"'
21485
+ ] }),
21486
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-colon", children: ": " })
21487
+ ] }),
21488
+ renderValue(),
21489
+ !isLast && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-json-comma", children: "," })
21490
+ ] });
21491
+ }
21492
+ function _arrayLikeToArray(r, a) {
21493
+ (null == a || a > r.length) && (a = r.length);
21494
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
21495
+ return n;
21496
+ }
21497
+ function _arrayWithHoles(r) {
21498
+ if (Array.isArray(r)) return r;
21499
+ }
21500
+ function _defineProperty$1(e, r, t) {
21501
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
21502
+ value: t,
21503
+ enumerable: true,
21504
+ configurable: true,
21505
+ writable: true
21506
+ }) : e[r] = t, e;
21507
+ }
21508
+ function _iterableToArrayLimit(r, l2) {
21509
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
21510
+ if (null != t) {
21511
+ var e, n, i, u, a = [], f = true, o = false;
21512
+ try {
21513
+ if (i = (t = t.call(r)).next, 0 === l2) ;
21514
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l2); f = true) ;
21515
+ } catch (r2) {
21516
+ o = true, n = r2;
21517
+ } finally {
21518
+ try {
21519
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
21520
+ } finally {
21521
+ if (o) throw n;
21522
+ }
21523
+ }
21524
+ return a;
21453
21525
  }
21454
21526
  }
21455
- function getSelectionInfo(selection2) {
21456
- switch (selection2.type) {
21457
- case "workflow-condition":
21458
- return {
21459
- title: "Workflow Condition",
21460
- subtitle: selection2.workflow.name
21461
- };
21462
- case "task":
21463
- return {
21464
- title: selection2.task.name,
21465
- subtitle: `${selection2.workflow.name} / ${selection2.task.function.name}`
21466
- };
21467
- case "task-condition":
21468
- return {
21469
- title: "Task Condition",
21470
- subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
21471
- };
21472
- case "mapping":
21473
- return {
21474
- title: selection2.mapping.path,
21475
- subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
21476
- };
21477
- case "validation-rule":
21478
- return {
21479
- title: selection2.rule.message,
21480
- subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
21481
- };
21482
- default:
21483
- return null;
21527
+ function _nonIterableRest() {
21528
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
21529
+ }
21530
+ function ownKeys$1(e, r) {
21531
+ var t = Object.keys(e);
21532
+ if (Object.getOwnPropertySymbols) {
21533
+ var o = Object.getOwnPropertySymbols(e);
21534
+ r && (o = o.filter(function(r2) {
21535
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
21536
+ })), t.push.apply(t, o);
21537
+ }
21538
+ return t;
21539
+ }
21540
+ function _objectSpread2$1(e) {
21541
+ for (var r = 1; r < arguments.length; r++) {
21542
+ var t = null != arguments[r] ? arguments[r] : {};
21543
+ r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) {
21544
+ _defineProperty$1(e, r2, t[r2]);
21545
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) {
21546
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
21547
+ });
21548
+ }
21549
+ return e;
21550
+ }
21551
+ function _objectWithoutProperties(e, t) {
21552
+ if (null == e) return {};
21553
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
21554
+ if (Object.getOwnPropertySymbols) {
21555
+ var n = Object.getOwnPropertySymbols(e);
21556
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
21557
+ }
21558
+ return i;
21559
+ }
21560
+ function _objectWithoutPropertiesLoose(r, e) {
21561
+ if (null == r) return {};
21562
+ var t = {};
21563
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
21564
+ if (-1 !== e.indexOf(n)) continue;
21565
+ t[n] = r[n];
21566
+ }
21567
+ return t;
21568
+ }
21569
+ function _slicedToArray(r, e) {
21570
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
21571
+ }
21572
+ function _toPrimitive(t, r) {
21573
+ if ("object" != typeof t || !t) return t;
21574
+ var e = t[Symbol.toPrimitive];
21575
+ if (void 0 !== e) {
21576
+ var i = e.call(t, r);
21577
+ if ("object" != typeof i) return i;
21578
+ throw new TypeError("@@toPrimitive must return a primitive value.");
21579
+ }
21580
+ return ("string" === r ? String : Number)(t);
21581
+ }
21582
+ function _toPropertyKey(t) {
21583
+ var i = _toPrimitive(t, "string");
21584
+ return "symbol" == typeof i ? i : i + "";
21585
+ }
21586
+ function _unsupportedIterableToArray(r, a) {
21587
+ if (r) {
21588
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
21589
+ var t = {}.toString.call(r).slice(8, -1);
21590
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
21591
+ }
21592
+ }
21593
+ function _defineProperty(obj, key, value) {
21594
+ if (key in obj) {
21595
+ Object.defineProperty(obj, key, {
21596
+ value,
21597
+ enumerable: true,
21598
+ configurable: true,
21599
+ writable: true
21600
+ });
21601
+ } else {
21602
+ obj[key] = value;
21603
+ }
21604
+ return obj;
21605
+ }
21606
+ function ownKeys(object2, enumerableOnly) {
21607
+ var keys = Object.keys(object2);
21608
+ if (Object.getOwnPropertySymbols) {
21609
+ var symbols = Object.getOwnPropertySymbols(object2);
21610
+ if (enumerableOnly) symbols = symbols.filter(function(sym) {
21611
+ return Object.getOwnPropertyDescriptor(object2, sym).enumerable;
21612
+ });
21613
+ keys.push.apply(keys, symbols);
21614
+ }
21615
+ return keys;
21616
+ }
21617
+ function _objectSpread2(target) {
21618
+ for (var i = 1; i < arguments.length; i++) {
21619
+ var source = arguments[i] != null ? arguments[i] : {};
21620
+ if (i % 2) {
21621
+ ownKeys(Object(source), true).forEach(function(key) {
21622
+ _defineProperty(target, key, source[key]);
21623
+ });
21624
+ } else if (Object.getOwnPropertyDescriptors) {
21625
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
21626
+ } else {
21627
+ ownKeys(Object(source)).forEach(function(key) {
21628
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
21629
+ });
21630
+ }
21631
+ }
21632
+ return target;
21633
+ }
21634
+ function compose$1() {
21635
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
21636
+ fns[_key] = arguments[_key];
21484
21637
  }
21638
+ return function(x) {
21639
+ return fns.reduceRight(function(y, f) {
21640
+ return f(y);
21641
+ }, x);
21642
+ };
21485
21643
  }
21486
- function VisualizerInner({
21487
- workflows,
21488
- onTaskSelect,
21489
- onWorkflowSelect,
21490
- executionResult,
21491
- debugMode = false
21492
- }) {
21493
- const { resolvedTheme } = useTheme();
21494
- const debuggerContext = debugMode ? useDebugger() : null;
21495
- const [selection2, setSelection] = require$$0.useState({ type: "none" });
21496
- const [leftPanelWidth, setLeftPanelWidth] = require$$0.useState(280);
21497
- const [isDragging, setIsDragging] = require$$0.useState(false);
21498
- const [treePanelHeight, setTreePanelHeight] = require$$0.useState(50);
21499
- const [isVerticalDragging, setIsVerticalDragging] = require$$0.useState(false);
21500
- const containerRef = require$$0.useRef(null);
21501
- const leftPanelRef = require$$0.useRef(null);
21502
- const handleSelection = (newSelection) => {
21503
- setSelection(newSelection);
21504
- if (newSelection.type === "workflow-condition") {
21505
- onWorkflowSelect == null ? void 0 : onWorkflowSelect(newSelection.workflow);
21506
- } else if (newSelection.type === "task" || newSelection.type === "task-condition" || newSelection.type === "mapping" || newSelection.type === "validation-rule") {
21507
- onTaskSelect == null ? void 0 : onTaskSelect(newSelection.task, newSelection.workflow);
21644
+ function curry$1(fn) {
21645
+ return function curried() {
21646
+ var _this = this;
21647
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
21648
+ args[_key2] = arguments[_key2];
21508
21649
  }
21509
- };
21510
- const handleMouseDown = require$$0.useCallback((e) => {
21511
- e.preventDefault();
21512
- setIsDragging(true);
21513
- }, []);
21514
- const handleVerticalMouseDown = require$$0.useCallback((e) => {
21515
- e.preventDefault();
21516
- setIsVerticalDragging(true);
21517
- }, []);
21518
- require$$0.useEffect(() => {
21519
- if (!isDragging) return;
21520
- const handleMouseMove = (e) => {
21521
- if (containerRef.current) {
21522
- const rect = containerRef.current.getBoundingClientRect();
21523
- const newWidth = e.clientX - rect.left;
21524
- setLeftPanelWidth(Math.max(200, Math.min(450, newWidth)));
21525
- }
21526
- };
21527
- const handleMouseUp = () => {
21528
- setIsDragging(false);
21529
- };
21530
- document.addEventListener("mousemove", handleMouseMove);
21531
- document.addEventListener("mouseup", handleMouseUp);
21532
- return () => {
21533
- document.removeEventListener("mousemove", handleMouseMove);
21534
- document.removeEventListener("mouseup", handleMouseUp);
21535
- };
21536
- }, [isDragging]);
21537
- require$$0.useEffect(() => {
21538
- if (!isVerticalDragging) return;
21539
- const handleMouseMove = (e) => {
21540
- if (leftPanelRef.current) {
21541
- const rect = leftPanelRef.current.getBoundingClientRect();
21542
- const relativeY = e.clientY - rect.top;
21543
- const percentage = relativeY / rect.height * 100;
21544
- setTreePanelHeight(Math.max(20, Math.min(80, percentage)));
21650
+ return args.length >= fn.length ? fn.apply(this, args) : function() {
21651
+ for (var _len3 = arguments.length, nextArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
21652
+ nextArgs[_key3] = arguments[_key3];
21545
21653
  }
21654
+ return curried.apply(_this, [].concat(args, nextArgs));
21546
21655
  };
21547
- const handleMouseUp = () => {
21548
- setIsVerticalDragging(false);
21549
- };
21550
- document.addEventListener("mousemove", handleMouseMove);
21551
- document.addEventListener("mouseup", handleMouseUp);
21552
- return () => {
21553
- document.removeEventListener("mousemove", handleMouseMove);
21554
- document.removeEventListener("mouseup", handleMouseUp);
21555
- };
21556
- }, [isVerticalDragging]);
21557
- const selectionInfo = getSelectionInfo(selection2);
21558
- const hasDebugTrace = debugMode && (debuggerContext == null ? void 0 : debuggerContext.hasTrace);
21559
- const displayMessage = hasDebugTrace ? debuggerContext == null ? void 0 : debuggerContext.currentMessage : executionResult;
21560
- const currentChanges = hasDebugTrace ? debuggerContext == null ? void 0 : debuggerContext.currentChanges : [];
21561
- const currentStepIndex = hasDebugTrace ? debuggerContext == null ? void 0 : debuggerContext.state.currentStepIndex : -1;
21562
- const highlightedPaths = require$$0.useMemo(() => {
21563
- if (!currentChanges || currentChanges.length === 0) return void 0;
21564
- return currentChanges.map((change) => change.path);
21565
- }, [currentChanges]);
21566
- const isDraggingAny = isDragging || isVerticalDragging;
21567
- return /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsxs(
21568
- "div",
21569
- {
21570
- ref: containerRef,
21571
- className: `df-visualizer-horizontal df-theme-${resolvedTheme} ${isDraggingAny ? "df-dragging" : ""}`,
21572
- children: [
21573
- /* @__PURE__ */ jsxRuntime.jsxs(
21574
- "div",
21575
- {
21576
- ref: leftPanelRef,
21577
- className: "df-visualizer-left",
21578
- style: { width: leftPanelWidth },
21579
- children: [
21580
- /* @__PURE__ */ jsxRuntime.jsxs(
21581
- "div",
21582
- {
21583
- className: `df-visualizer-left-tree ${displayMessage ? "df-with-result" : ""}`,
21584
- style: displayMessage ? { height: `${treePanelHeight}%` } : void 0,
21585
- children: [
21586
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-visualizer-left-header", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-visualizer-left-title", children: "Explorer" }) }),
21587
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-visualizer-left-content", children: workflows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-empty-state", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No workflows to display" }) }) : /* @__PURE__ */ jsxRuntime.jsx(
21588
- TreeView,
21589
- {
21590
- workflows,
21591
- selection: selection2,
21592
- onSelect: handleSelection,
21593
- debugMode
21594
- }
21595
- ) })
21596
- ]
21597
- }
21598
- ),
21599
- displayMessage && /* @__PURE__ */ jsxRuntime.jsx(
21600
- "div",
21601
- {
21602
- className: `df-visualizer-divider-horizontal ${isVerticalDragging ? "df-divider-active" : ""}`,
21603
- onMouseDown: handleVerticalMouseDown
21604
- }
21605
- ),
21606
- displayMessage && /* @__PURE__ */ jsxRuntime.jsxs(
21607
- "div",
21608
- {
21609
- className: "df-visualizer-result-panel",
21610
- style: { height: `${100 - treePanelHeight}%` },
21611
- children: [
21612
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-visualizer-result-header", children: [
21613
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-visualizer-result-title", children: hasDebugTrace ? currentStepIndex !== void 0 && currentStepIndex >= 0 ? `Step ${currentStepIndex + 1}` : "Ready" : "Result" }),
21614
- hasDebugTrace && currentChanges && currentChanges.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-visualizer-result-changes", children: [
21615
- currentChanges.length,
21616
- " change",
21617
- currentChanges.length !== 1 ? "s" : ""
21618
- ] })
21619
- ] }),
21620
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-visualizer-result-content", children: /* @__PURE__ */ jsxRuntime.jsx(
21621
- JsonEditor,
21622
- {
21623
- value: JSON.stringify(displayMessage, null, 2),
21624
- onChange: () => {
21625
- },
21626
- readOnly: true,
21627
- theme: resolvedTheme === "dark" ? "dark" : "light",
21628
- highlightedPaths
21629
- }
21630
- ) })
21631
- ]
21632
- }
21633
- )
21634
- ]
21635
- }
21636
- ),
21637
- /* @__PURE__ */ jsxRuntime.jsx(
21638
- "div",
21639
- {
21640
- className: `df-visualizer-divider ${isDragging ? "df-divider-active" : ""}`,
21641
- onMouseDown: handleMouseDown
21642
- }
21643
- ),
21644
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-visualizer-right", children: [
21645
- selectionInfo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-details-header", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-details-header-info", children: [
21646
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-details-header-title", children: selectionInfo.title }),
21647
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-details-header-subtitle", children: selectionInfo.subtitle })
21648
- ] }) }),
21649
- /* @__PURE__ */ jsxRuntime.jsx(DetailsPanel, { selection: selection2 })
21650
- ] })
21651
- ]
21652
- }
21653
- ) });
21656
+ };
21654
21657
  }
21655
- function WorkflowVisualizer({
21656
- workflows,
21657
- onWorkflowSelect,
21658
- onTaskSelect,
21659
- theme = "system",
21660
- className = "",
21661
- executionResult,
21662
- debugMode = false
21663
- }) {
21664
- return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { defaultTheme: theme, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `df-root ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(
21665
- VisualizerInner,
21666
- {
21667
- workflows,
21668
- onTaskSelect,
21669
- onWorkflowSelect,
21670
- executionResult,
21671
- debugMode
21672
- }
21673
- ) }) });
21658
+ function isObject$1(value) {
21659
+ return {}.toString.call(value).includes("Object");
21674
21660
  }
21675
- function DebuggerControls({ compact = false, className = "" }) {
21676
- const {
21677
- state,
21678
- play,
21679
- pause,
21680
- stop,
21681
- reset,
21682
- stepForward,
21683
- stepBackward,
21684
- setSpeed,
21685
- isAtStart,
21686
- isAtEnd,
21687
- hasTrace,
21688
- progress,
21689
- totalSteps
21690
- } = useDebugger();
21691
- const { playbackState, playbackSpeed, currentStepIndex, isExecuting } = state;
21692
- const handleKeyDown = require$$0.useCallback(
21693
- (e) => {
21694
- if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
21695
- return;
21696
- }
21697
- switch (e.key) {
21698
- case " ":
21699
- e.preventDefault();
21700
- if (playbackState === "playing") {
21701
- pause();
21702
- } else if (hasTrace) {
21703
- play();
21704
- }
21705
- break;
21706
- case "ArrowRight":
21707
- e.preventDefault();
21708
- if (hasTrace && !isAtEnd) {
21709
- stepForward();
21710
- }
21711
- break;
21712
- case "ArrowLeft":
21713
- e.preventDefault();
21714
- if (hasTrace && !isAtStart) {
21715
- stepBackward();
21716
- }
21717
- break;
21718
- case "Escape":
21719
- e.preventDefault();
21720
- stop();
21721
- break;
21722
- case "r":
21723
- if (e.metaKey || e.ctrlKey) {
21724
- e.preventDefault();
21725
- reset();
21726
- }
21727
- break;
21728
- }
21729
- },
21730
- [playbackState, hasTrace, isAtEnd, isAtStart, play, pause, stop, stepForward, stepBackward, reset]
21731
- );
21732
- require$$0.useEffect(() => {
21733
- window.addEventListener("keydown", handleKeyDown);
21734
- return () => window.removeEventListener("keydown", handleKeyDown);
21735
- }, [handleKeyDown]);
21736
- const handleSpeedChange = (e) => {
21737
- setSpeed(Number(e.target.value));
21661
+ function isEmpty(obj) {
21662
+ return !Object.keys(obj).length;
21663
+ }
21664
+ function isFunction(value) {
21665
+ return typeof value === "function";
21666
+ }
21667
+ function hasOwnProperty(object2, property) {
21668
+ return Object.prototype.hasOwnProperty.call(object2, property);
21669
+ }
21670
+ function validateChanges(initial, changes) {
21671
+ if (!isObject$1(changes)) errorHandler$1("changeType");
21672
+ if (Object.keys(changes).some(function(field) {
21673
+ return !hasOwnProperty(initial, field);
21674
+ })) errorHandler$1("changeField");
21675
+ return changes;
21676
+ }
21677
+ function validateSelector(selector2) {
21678
+ if (!isFunction(selector2)) errorHandler$1("selectorType");
21679
+ }
21680
+ function validateHandler(handler) {
21681
+ if (!(isFunction(handler) || isObject$1(handler))) errorHandler$1("handlerType");
21682
+ if (isObject$1(handler) && Object.values(handler).some(function(_handler) {
21683
+ return !isFunction(_handler);
21684
+ })) errorHandler$1("handlersType");
21685
+ }
21686
+ function validateInitial(initial) {
21687
+ if (!initial) errorHandler$1("initialIsRequired");
21688
+ if (!isObject$1(initial)) errorHandler$1("initialType");
21689
+ if (isEmpty(initial)) errorHandler$1("initialContent");
21690
+ }
21691
+ function throwError$1(errorMessages2, type) {
21692
+ throw new Error(errorMessages2[type] || errorMessages2["default"]);
21693
+ }
21694
+ var errorMessages$1 = {
21695
+ initialIsRequired: "initial state is required",
21696
+ initialType: "initial state should be an object",
21697
+ initialContent: "initial state shouldn't be an empty object",
21698
+ handlerType: "handler should be an object or a function",
21699
+ handlersType: "all handlers should be a functions",
21700
+ selectorType: "selector should be a function",
21701
+ changeType: "provided value of changes should be an object",
21702
+ changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
21703
+ "default": "an unknown error accured in `state-local` package"
21704
+ };
21705
+ var errorHandler$1 = curry$1(throwError$1)(errorMessages$1);
21706
+ var validators$1 = {
21707
+ changes: validateChanges,
21708
+ selector: validateSelector,
21709
+ handler: validateHandler,
21710
+ initial: validateInitial
21711
+ };
21712
+ function create(initial) {
21713
+ var handler = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
21714
+ validators$1.initial(initial);
21715
+ validators$1.handler(handler);
21716
+ var state = {
21717
+ current: initial
21738
21718
  };
21739
- if (compact) {
21740
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-controls df-debug-controls-compact ${className}`, children: [
21741
- /* @__PURE__ */ jsxRuntime.jsx(
21742
- "button",
21743
- {
21744
- className: "df-debug-btn",
21745
- onClick: stepBackward,
21746
- disabled: !hasTrace || isAtStart || isExecuting,
21747
- title: "Previous step (Left Arrow)",
21748
- children: /* @__PURE__ */ jsxRuntime.jsx(SkipBack, { size: 16 })
21749
- }
21750
- ),
21751
- playbackState === "playing" ? /* @__PURE__ */ jsxRuntime.jsx(
21752
- "button",
21753
- {
21754
- className: "df-debug-btn df-debug-btn-primary",
21755
- onClick: pause,
21756
- disabled: !hasTrace || isExecuting,
21757
- title: "Pause (Space)",
21758
- children: /* @__PURE__ */ jsxRuntime.jsx(Pause, { size: 18 })
21759
- }
21760
- ) : /* @__PURE__ */ jsxRuntime.jsx(
21761
- "button",
21762
- {
21763
- className: "df-debug-btn df-debug-btn-primary",
21764
- onClick: play,
21765
- disabled: !hasTrace || isAtEnd || isExecuting,
21766
- title: "Play (Space)",
21767
- children: /* @__PURE__ */ jsxRuntime.jsx(Play, { size: 18 })
21768
- }
21769
- ),
21770
- /* @__PURE__ */ jsxRuntime.jsx(
21771
- "button",
21772
- {
21773
- className: "df-debug-btn",
21774
- onClick: stepForward,
21775
- disabled: !hasTrace || isAtEnd || isExecuting,
21776
- title: "Next step (Right Arrow)",
21777
- children: /* @__PURE__ */ jsxRuntime.jsx(SkipForward, { size: 16 })
21778
- }
21779
- ),
21780
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-debug-step-counter", children: [
21781
- currentStepIndex + 1,
21782
- " / ",
21783
- totalSteps
21784
- ] })
21785
- ] });
21719
+ var didUpdate = curry$1(didStateUpdate)(state, handler);
21720
+ var update = curry$1(updateState)(state);
21721
+ var validate = curry$1(validators$1.changes)(initial);
21722
+ var getChanges = curry$1(extractChanges)(state);
21723
+ function getState2() {
21724
+ var selector2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(state2) {
21725
+ return state2;
21726
+ };
21727
+ validators$1.selector(selector2);
21728
+ return selector2(state.current);
21786
21729
  }
21787
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-controls ${className}`, children: [
21788
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-controls-main", children: [
21789
- /* @__PURE__ */ jsxRuntime.jsx(
21790
- "button",
21791
- {
21792
- className: "df-debug-btn",
21793
- onClick: stop,
21794
- disabled: !hasTrace || isExecuting,
21795
- title: "Stop (Escape)",
21796
- children: /* @__PURE__ */ jsxRuntime.jsx(Square, { size: 20 })
21797
- }
21798
- ),
21799
- /* @__PURE__ */ jsxRuntime.jsx(
21800
- "button",
21801
- {
21802
- className: "df-debug-btn",
21803
- onClick: stepBackward,
21804
- disabled: !hasTrace || isAtStart || isExecuting,
21805
- title: "Previous step (Left Arrow)",
21806
- children: /* @__PURE__ */ jsxRuntime.jsx(SkipBack, { size: 20 })
21807
- }
21808
- ),
21809
- playbackState === "playing" ? /* @__PURE__ */ jsxRuntime.jsx(
21810
- "button",
21811
- {
21812
- className: "df-debug-btn df-debug-btn-primary",
21813
- onClick: pause,
21814
- disabled: !hasTrace || isExecuting,
21815
- title: "Pause (Space)",
21816
- children: /* @__PURE__ */ jsxRuntime.jsx(Pause, { size: 24 })
21817
- }
21818
- ) : /* @__PURE__ */ jsxRuntime.jsx(
21819
- "button",
21820
- {
21821
- className: "df-debug-btn df-debug-btn-primary",
21822
- onClick: play,
21823
- disabled: !hasTrace || isAtEnd || isExecuting,
21824
- title: "Play (Space)",
21825
- children: /* @__PURE__ */ jsxRuntime.jsx(Play, { size: 24 })
21826
- }
21827
- ),
21828
- /* @__PURE__ */ jsxRuntime.jsx(
21829
- "button",
21830
- {
21831
- className: "df-debug-btn",
21832
- onClick: stepForward,
21833
- disabled: !hasTrace || isAtEnd || isExecuting,
21834
- title: "Next step (Right Arrow)",
21835
- children: /* @__PURE__ */ jsxRuntime.jsx(SkipForward, { size: 20 })
21836
- }
21837
- ),
21838
- /* @__PURE__ */ jsxRuntime.jsx(
21839
- "button",
21840
- {
21841
- className: "df-debug-btn",
21842
- onClick: reset,
21843
- disabled: !hasTrace || isExecuting,
21844
- title: "Reset (Ctrl+R)",
21845
- children: /* @__PURE__ */ jsxRuntime.jsx(RotateCcw, { size: 20 })
21846
- }
21847
- )
21848
- ] }),
21849
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-progress", children: [
21850
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-progress-bar", children: /* @__PURE__ */ jsxRuntime.jsx(
21851
- "div",
21852
- {
21853
- className: "df-debug-progress-fill",
21854
- style: { width: `${progress * 100}%` }
21855
- }
21856
- ) }),
21857
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-debug-step-counter", children: [
21858
- "Step ",
21859
- currentStepIndex + 1,
21860
- " of ",
21861
- totalSteps
21862
- ] })
21863
- ] }),
21864
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-speed", children: [
21865
- /* @__PURE__ */ jsxRuntime.jsx(Gauge, { size: 14 }),
21866
- /* @__PURE__ */ jsxRuntime.jsx(
21867
- "input",
21868
- {
21869
- type: "range",
21870
- min: "100",
21871
- max: "2000",
21872
- step: "100",
21873
- value: playbackSpeed,
21874
- onChange: handleSpeedChange,
21875
- className: "df-debug-speed-slider",
21876
- title: `Playback speed: ${playbackSpeed}ms`
21877
- }
21878
- ),
21879
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-debug-speed-label", children: [
21880
- playbackSpeed,
21881
- "ms"
21882
- ] })
21883
- ] })
21884
- ] });
21730
+ function setState2(causedChanges) {
21731
+ compose$1(didUpdate, update, validate, getChanges)(causedChanges);
21732
+ }
21733
+ return [getState2, setState2];
21885
21734
  }
21886
- function MessageInputPanel({
21887
- onExecute,
21888
- isExecuting = false,
21889
- className = ""
21890
- }) {
21891
- const { setInputPayload, state } = useDebugger();
21892
- const { inputPayload } = state;
21893
- const [expandedSections, setExpandedSections] = require$$0.useState(
21894
- /* @__PURE__ */ new Set(["payload"])
21895
- );
21896
- const [editingSection, setEditingSection] = require$$0.useState(null);
21897
- const [editText, setEditText] = require$$0.useState("");
21898
- const [parseError, setParseError] = require$$0.useState(null);
21899
- const payload = inputPayload || {};
21900
- const toggleSection = (section) => {
21901
- setExpandedSections((prev) => {
21902
- const next = new Set(prev);
21903
- if (next.has(section)) {
21904
- next.delete(section);
21905
- } else {
21906
- next.add(section);
21735
+ function extractChanges(state, causedChanges) {
21736
+ return isFunction(causedChanges) ? causedChanges(state.current) : causedChanges;
21737
+ }
21738
+ function updateState(state, changes) {
21739
+ state.current = _objectSpread2(_objectSpread2({}, state.current), changes);
21740
+ return changes;
21741
+ }
21742
+ function didStateUpdate(state, handler, changes) {
21743
+ isFunction(handler) ? handler(state.current) : Object.keys(changes).forEach(function(field) {
21744
+ var _handler$field;
21745
+ return (_handler$field = handler[field]) === null || _handler$field === void 0 ? void 0 : _handler$field.call(handler, state.current[field]);
21746
+ });
21747
+ return changes;
21748
+ }
21749
+ var index = {
21750
+ create
21751
+ };
21752
+ var config$1 = {
21753
+ paths: {
21754
+ vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"
21755
+ }
21756
+ };
21757
+ function curry(fn) {
21758
+ return function curried() {
21759
+ var _this = this;
21760
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
21761
+ args[_key] = arguments[_key];
21762
+ }
21763
+ return args.length >= fn.length ? fn.apply(this, args) : function() {
21764
+ for (var _len2 = arguments.length, nextArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
21765
+ nextArgs[_key2] = arguments[_key2];
21907
21766
  }
21908
- return next;
21909
- });
21910
- };
21911
- const startEditing = () => {
21912
- setEditingSection("payload");
21913
- setEditText(JSON.stringify(payload, null, 2));
21914
- setParseError(null);
21767
+ return curried.apply(_this, [].concat(args, nextArgs));
21768
+ };
21915
21769
  };
21916
- const cancelEditing = () => {
21917
- setEditingSection(null);
21918
- setEditText("");
21919
- setParseError(null);
21770
+ }
21771
+ function isObject(value) {
21772
+ return {}.toString.call(value).includes("Object");
21773
+ }
21774
+ function validateConfig(config2) {
21775
+ if (!config2) errorHandler("configIsRequired");
21776
+ if (!isObject(config2)) errorHandler("configType");
21777
+ if (config2.urls) {
21778
+ informAboutDeprecation();
21779
+ return {
21780
+ paths: {
21781
+ vs: config2.urls.monacoBase
21782
+ }
21783
+ };
21784
+ }
21785
+ return config2;
21786
+ }
21787
+ function informAboutDeprecation() {
21788
+ console.warn(errorMessages.deprecation);
21789
+ }
21790
+ function throwError(errorMessages2, type) {
21791
+ throw new Error(errorMessages2[type] || errorMessages2["default"]);
21792
+ }
21793
+ var errorMessages = {
21794
+ configIsRequired: "the configuration object is required",
21795
+ configType: "the configuration object should be an object",
21796
+ "default": "an unknown error accured in `@monaco-editor/loader` package",
21797
+ deprecation: "Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "
21798
+ };
21799
+ var errorHandler = curry(throwError)(errorMessages);
21800
+ var validators = {
21801
+ config: validateConfig
21802
+ };
21803
+ var compose = function compose2() {
21804
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
21805
+ fns[_key] = arguments[_key];
21806
+ }
21807
+ return function(x) {
21808
+ return fns.reduceRight(function(y, f) {
21809
+ return f(y);
21810
+ }, x);
21920
21811
  };
21921
- const saveEditing = require$$0.useCallback(() => {
21922
- if (!editingSection) return;
21923
- try {
21924
- const parsed = JSON.parse(editText);
21925
- setInputPayload(parsed);
21926
- setEditingSection(null);
21927
- setEditText("");
21928
- setParseError(null);
21929
- } catch (err) {
21930
- setParseError(err instanceof Error ? err.message : "Invalid JSON");
21812
+ };
21813
+ function merge(target, source) {
21814
+ Object.keys(source).forEach(function(key) {
21815
+ if (source[key] instanceof Object) {
21816
+ if (target[key]) {
21817
+ Object.assign(source[key], merge(target[key], source[key]));
21818
+ }
21931
21819
  }
21932
- }, [editingSection, editText, setInputPayload]);
21933
- const handleLoadSample = () => {
21934
- setInputPayload({
21935
- id: "123",
21936
- name: "John Doe",
21937
- email: "john@example.com",
21938
- amount: 100
21820
+ });
21821
+ return _objectSpread2$1(_objectSpread2$1({}, target), source);
21822
+ }
21823
+ var CANCELATION_MESSAGE = {
21824
+ type: "cancelation",
21825
+ msg: "operation is manually canceled"
21826
+ };
21827
+ function makeCancelable(promise) {
21828
+ var hasCanceled_ = false;
21829
+ var wrappedPromise = new Promise(function(resolve, reject) {
21830
+ promise.then(function(val) {
21831
+ return hasCanceled_ ? reject(CANCELATION_MESSAGE) : resolve(val);
21939
21832
  });
21833
+ promise["catch"](reject);
21834
+ });
21835
+ return wrappedPromise.cancel = function() {
21836
+ return hasCanceled_ = true;
21837
+ }, wrappedPromise;
21838
+ }
21839
+ var _excluded = ["monaco"];
21840
+ var _state$create = index.create({
21841
+ config: config$1,
21842
+ isInitialized: false,
21843
+ resolve: null,
21844
+ reject: null,
21845
+ monaco: null
21846
+ }), _state$create2 = _slicedToArray(_state$create, 2), getState = _state$create2[0], setState = _state$create2[1];
21847
+ function config(globalConfig) {
21848
+ var _validators$config = validators.config(globalConfig), monaco = _validators$config.monaco, config2 = _objectWithoutProperties(_validators$config, _excluded);
21849
+ setState(function(state) {
21850
+ return {
21851
+ config: merge(state.config, config2),
21852
+ monaco
21853
+ };
21854
+ });
21855
+ }
21856
+ function init() {
21857
+ var state = getState(function(_ref) {
21858
+ var monaco = _ref.monaco, isInitialized = _ref.isInitialized, resolve = _ref.resolve;
21859
+ return {
21860
+ monaco,
21861
+ isInitialized,
21862
+ resolve
21863
+ };
21864
+ });
21865
+ if (!state.isInitialized) {
21866
+ setState({
21867
+ isInitialized: true
21868
+ });
21869
+ if (state.monaco) {
21870
+ state.resolve(state.monaco);
21871
+ return makeCancelable(wrapperPromise);
21872
+ }
21873
+ if (window.monaco && window.monaco.editor) {
21874
+ storeMonacoInstance(window.monaco);
21875
+ state.resolve(window.monaco);
21876
+ return makeCancelable(wrapperPromise);
21877
+ }
21878
+ compose(injectScripts, getMonacoLoaderScript)(configureLoader);
21879
+ }
21880
+ return makeCancelable(wrapperPromise);
21881
+ }
21882
+ function injectScripts(script) {
21883
+ return document.body.appendChild(script);
21884
+ }
21885
+ function createScript(src) {
21886
+ var script = document.createElement("script");
21887
+ return src && (script.src = src), script;
21888
+ }
21889
+ function getMonacoLoaderScript(configureLoader2) {
21890
+ var state = getState(function(_ref2) {
21891
+ var config2 = _ref2.config, reject = _ref2.reject;
21892
+ return {
21893
+ config: config2,
21894
+ reject
21895
+ };
21896
+ });
21897
+ var loaderScript = createScript("".concat(state.config.paths.vs, "/loader.js"));
21898
+ loaderScript.onload = function() {
21899
+ return configureLoader2();
21940
21900
  };
21941
- const handleClear = () => {
21942
- setInputPayload({});
21943
- };
21944
- const formatValue2 = (value) => {
21945
- if (Object.keys(value).length === 0) {
21946
- return "(empty)";
21901
+ loaderScript.onerror = state.reject;
21902
+ return loaderScript;
21903
+ }
21904
+ function configureLoader() {
21905
+ var state = getState(function(_ref3) {
21906
+ var config2 = _ref3.config, resolve = _ref3.resolve, reject = _ref3.reject;
21907
+ return {
21908
+ config: config2,
21909
+ resolve,
21910
+ reject
21911
+ };
21912
+ });
21913
+ var require2 = window.require;
21914
+ require2.config(state.config);
21915
+ require2(["vs/editor/editor.main"], function(loaded) {
21916
+ var monaco = loaded.m || loaded;
21917
+ storeMonacoInstance(monaco);
21918
+ state.resolve(monaco);
21919
+ }, function(error) {
21920
+ state.reject(error);
21921
+ });
21922
+ }
21923
+ function storeMonacoInstance(monaco) {
21924
+ if (!getState().monaco) {
21925
+ setState({
21926
+ monaco
21927
+ });
21928
+ }
21929
+ }
21930
+ function __getMonacoInstance() {
21931
+ return getState(function(_ref4) {
21932
+ var monaco = _ref4.monaco;
21933
+ return monaco;
21934
+ });
21935
+ }
21936
+ var wrapperPromise = new Promise(function(resolve, reject) {
21937
+ return setState({
21938
+ resolve,
21939
+ reject
21940
+ });
21941
+ });
21942
+ var loader = {
21943
+ config,
21944
+ init,
21945
+ __getMonacoInstance
21946
+ };
21947
+ var le = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, v = le;
21948
+ var ae = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, Y = ae;
21949
+ function Me({ children: e }) {
21950
+ return require$$0.createElement("div", { style: Y.container }, e);
21951
+ }
21952
+ var Z = Me;
21953
+ var $ = Z;
21954
+ function Ee({ width: e, height: r, isEditorReady: n, loading: t, _ref: a, className: m, wrapperProps: E }) {
21955
+ return require$$0.createElement("section", { style: { ...v.wrapper, width: e, height: r }, ...E }, !n && require$$0.createElement($, null, t), require$$0.createElement("div", { ref: a, style: { ...v.fullWidth, ...!n && v.hide }, className: m }));
21956
+ }
21957
+ var ee = Ee;
21958
+ var H = require$$0.memo(ee);
21959
+ function Ce(e) {
21960
+ require$$0.useEffect(e, []);
21961
+ }
21962
+ var k = Ce;
21963
+ function he(e, r, n = true) {
21964
+ let t = require$$0.useRef(true);
21965
+ require$$0.useEffect(t.current || !n ? () => {
21966
+ t.current = false;
21967
+ } : e, r);
21968
+ }
21969
+ var l = he;
21970
+ function D() {
21971
+ }
21972
+ function h(e, r, n, t) {
21973
+ return De(e, t) || be(e, r, n, t);
21974
+ }
21975
+ function De(e, r) {
21976
+ return e.editor.getModel(te(e, r));
21977
+ }
21978
+ function be(e, r, n, t) {
21979
+ return e.editor.createModel(r, n, t ? te(e, t) : void 0);
21980
+ }
21981
+ function te(e, r) {
21982
+ return e.Uri.parse(r);
21983
+ }
21984
+ function Oe({ original: e, modified: r, language: n, originalLanguage: t, modifiedLanguage: a, originalModelPath: m, modifiedModelPath: E, keepCurrentOriginalModel: g = false, keepCurrentModifiedModel: N = false, theme: x = "light", loading: P = "Loading...", options: y = {}, height: V = "100%", width: z = "100%", className: F, wrapperProps: j = {}, beforeMount: A = D, onMount: q = D }) {
21985
+ let [M, O] = require$$0.useState(false), [T, s] = require$$0.useState(true), u = require$$0.useRef(null), c = require$$0.useRef(null), w = require$$0.useRef(null), d = require$$0.useRef(q), o = require$$0.useRef(A), b = require$$0.useRef(false);
21986
+ k(() => {
21987
+ let i = loader.init();
21988
+ 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();
21989
+ }), l(() => {
21990
+ if (u.current && c.current) {
21991
+ let i = u.current.getOriginalEditor(), f = h(c.current, e || "", t || n || "text", m || "");
21992
+ f !== i.getModel() && i.setModel(f);
21993
+ }
21994
+ }, [m], M), l(() => {
21995
+ if (u.current && c.current) {
21996
+ let i = u.current.getModifiedEditor(), f = h(c.current, r || "", a || n || "text", E || "");
21997
+ f !== i.getModel() && i.setModel(f);
21998
+ }
21999
+ }, [E], M), l(() => {
22000
+ let i = u.current.getModifiedEditor();
22001
+ 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());
22002
+ }, [r], M), l(() => {
22003
+ var _a, _b;
22004
+ (_b = (_a = u.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.original.setValue(e || "");
22005
+ }, [e], M), l(() => {
22006
+ let { original: i, modified: f } = u.current.getModel();
22007
+ c.current.editor.setModelLanguage(i, t || n || "text"), c.current.editor.setModelLanguage(f, a || n || "text");
22008
+ }, [n, t, a], M), l(() => {
22009
+ var _a;
22010
+ (_a = c.current) == null ? void 0 : _a.editor.setTheme(x);
22011
+ }, [x], M), l(() => {
22012
+ var _a;
22013
+ (_a = u.current) == null ? void 0 : _a.updateOptions(y);
22014
+ }, [y], M);
22015
+ let L = require$$0.useCallback(() => {
22016
+ var _a;
22017
+ if (!c.current) return;
22018
+ o.current(c.current);
22019
+ let i = h(c.current, e || "", t || n || "text", m || ""), f = h(c.current, r || "", a || n || "text", E || "");
22020
+ (_a = u.current) == null ? void 0 : _a.setModel({ original: i, modified: f });
22021
+ }, [n, r, a, e, t, m, E]), U = require$$0.useCallback(() => {
22022
+ var _a;
22023
+ !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);
22024
+ }, [y, x, L]);
22025
+ require$$0.useEffect(() => {
22026
+ M && d.current(u.current, c.current);
22027
+ }, [M]), require$$0.useEffect(() => {
22028
+ !T && !M && U();
22029
+ }, [T, M, U]);
22030
+ function I() {
22031
+ var _a, _b, _c, _d;
22032
+ let i = (_a = u.current) == null ? void 0 : _a.getModel();
22033
+ 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();
22034
+ }
22035
+ return require$$0.createElement(H, { width: z, height: V, isEditorReady: M, loading: P, _ref: w, className: F, wrapperProps: j });
22036
+ }
22037
+ var ie = Oe;
22038
+ require$$0.memo(ie);
22039
+ function He(e) {
22040
+ let r = require$$0.useRef();
22041
+ return require$$0.useEffect(() => {
22042
+ r.current = e;
22043
+ }, [e]), r.current;
22044
+ }
22045
+ var se = He;
22046
+ var _ = /* @__PURE__ */ new Map();
22047
+ function Ve({ defaultValue: e, defaultLanguage: r, defaultPath: n, value: t, language: a, path: m, theme: E = "light", line: g, loading: N = "Loading...", options: x = {}, overrideServices: P = {}, saveViewState: y = true, keepCurrentModel: V = false, width: z = "100%", height: F = "100%", className: j, wrapperProps: A = {}, beforeMount: q = D, onMount: M = D, onChange: O, onValidate: T = D }) {
22048
+ let [s, u] = require$$0.useState(false), [c, w] = require$$0.useState(true), d = require$$0.useRef(null), o = require$$0.useRef(null), b = require$$0.useRef(null), L = require$$0.useRef(M), U = require$$0.useRef(q), I = require$$0.useRef(), i = require$$0.useRef(t), f = se(m), Q = require$$0.useRef(false), B = require$$0.useRef(false);
22049
+ k(() => {
22050
+ let p = loader.init();
22051
+ 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();
22052
+ }), l(() => {
22053
+ var _a, _b, _c, _d;
22054
+ let p = h(d.current, e || t || "", r || a || "", m || n || "");
22055
+ 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))));
22056
+ }, [m], s), l(() => {
22057
+ var _a;
22058
+ (_a = o.current) == null ? void 0 : _a.updateOptions(x);
22059
+ }, [x], s), l(() => {
22060
+ !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));
22061
+ }, [t], s), l(() => {
22062
+ var _a, _b;
22063
+ let p = (_a = o.current) == null ? void 0 : _a.getModel();
22064
+ p && a && ((_b = d.current) == null ? void 0 : _b.editor.setModelLanguage(p, a));
22065
+ }, [a], s), l(() => {
22066
+ var _a;
22067
+ g !== void 0 && ((_a = o.current) == null ? void 0 : _a.revealLine(g));
22068
+ }, [g], s), l(() => {
22069
+ var _a;
22070
+ (_a = d.current) == null ? void 0 : _a.editor.setTheme(E);
22071
+ }, [E], s);
22072
+ let X2 = require$$0.useCallback(() => {
22073
+ var _a;
22074
+ if (!(!b.current || !d.current) && !Q.current) {
22075
+ U.current(d.current);
22076
+ let p = m || n, R = h(d.current, t || e || "", r || a || "", p || "");
22077
+ 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;
21947
22078
  }
21948
- return JSON.stringify(value, null, 2);
21949
- };
21950
- const isEmptyPayload = Object.keys(payload).length === 0;
21951
- const isExpanded = expandedSections.has("payload");
21952
- const isEditing = editingSection === "payload";
21953
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-input-panel ${className}`, children: [
21954
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-header", children: [
21955
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-input-title", children: "Test Payload" }),
21956
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-actions", children: [
21957
- /* @__PURE__ */ jsxRuntime.jsxs(
21958
- "button",
21959
- {
21960
- className: "df-debug-btn-sm",
21961
- onClick: handleLoadSample,
21962
- title: "Load sample data",
21963
- children: [
21964
- /* @__PURE__ */ jsxRuntime.jsx(FileJson, { size: 12 }),
21965
- "Sample"
21966
- ]
21967
- }
21968
- ),
21969
- /* @__PURE__ */ jsxRuntime.jsxs(
21970
- "button",
21971
- {
21972
- className: "df-debug-btn-sm",
21973
- onClick: handleClear,
21974
- title: "Clear all data",
21975
- children: [
21976
- /* @__PURE__ */ jsxRuntime.jsx(RefreshCw, { size: 12 }),
21977
- "Clear"
21978
- ]
21979
- }
21980
- )
21981
- ] })
21982
- ] }),
21983
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-input-sections", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-section", children: [
21984
- /* @__PURE__ */ jsxRuntime.jsxs(
21985
- "div",
21986
- {
21987
- className: "df-debug-input-section-header",
21988
- onClick: () => !isEditing && toggleSection("payload"),
21989
- children: [
21990
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-toggle", children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: 14 }) : /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { size: 14 }) }),
21991
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-label", children: "Payload" }),
21992
- isEmptyPayload && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-empty", children: "(empty)" }),
21993
- !isEditing && /* @__PURE__ */ jsxRuntime.jsx(
21994
- "button",
21995
- {
21996
- className: "df-debug-section-edit",
21997
- onClick: (e) => {
21998
- e.stopPropagation();
21999
- startEditing();
22000
- },
22001
- title: "Edit Payload",
22002
- children: "Edit"
22003
- }
22004
- )
22005
- ]
22079
+ }, [e, r, n, t, a, m, x, P, y, E, g]);
22080
+ require$$0.useEffect(() => {
22081
+ s && L.current(o.current, d.current);
22082
+ }, [s]), require$$0.useEffect(() => {
22083
+ !c && !s && X2();
22084
+ }, [c, s, X2]), i.current = t, require$$0.useEffect(() => {
22085
+ var _a, _b;
22086
+ s && O && ((_a = I.current) == null ? void 0 : _a.dispose(), I.current = (_b = o.current) == null ? void 0 : _b.onDidChangeModelContent((p) => {
22087
+ B.current || O(o.current.getValue(), p);
22088
+ }));
22089
+ }, [s, O]), require$$0.useEffect(() => {
22090
+ if (s) {
22091
+ let p = d.current.editor.onDidChangeMarkers((R) => {
22092
+ var _a;
22093
+ let G = (_a = o.current.getModel()) == null ? void 0 : _a.uri;
22094
+ if (G && R.find((J) => J.path === G.path)) {
22095
+ let J = d.current.editor.getModelMarkers({ resource: G });
22096
+ T == null ? void 0 : T(J);
22006
22097
  }
22007
- ),
22008
- isExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-input-section-content", children: isEditing ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-editor", children: [
22009
- /* @__PURE__ */ jsxRuntime.jsx(
22010
- "textarea",
22011
- {
22012
- className: "df-debug-input-textarea",
22013
- value: editText,
22014
- onChange: (e) => setEditText(e.target.value),
22015
- placeholder: "Enter payload as JSON...",
22016
- spellCheck: false
22017
- }
22018
- ),
22019
- parseError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-input-error", children: parseError }),
22020
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-input-editor-actions", children: [
22021
- /* @__PURE__ */ jsxRuntime.jsx(
22022
- "button",
22023
- {
22024
- className: "df-debug-btn-sm df-debug-btn-cancel",
22025
- onClick: cancelEditing,
22026
- children: "Cancel"
22027
- }
22028
- ),
22029
- /* @__PURE__ */ jsxRuntime.jsx(
22030
- "button",
22031
- {
22032
- className: "df-debug-btn-sm df-debug-btn-save",
22033
- onClick: saveEditing,
22034
- children: "Save"
22035
- }
22036
- )
22037
- ] })
22038
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "df-debug-input-preview", children: formatValue2(payload) }) })
22039
- ] }) }),
22040
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-input-footer", children: /* @__PURE__ */ jsxRuntime.jsx(
22041
- "button",
22042
- {
22043
- className: "df-debug-run-btn",
22044
- onClick: onExecute,
22045
- disabled: isExecuting,
22046
- children: isExecuting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
22047
- /* @__PURE__ */ jsxRuntime.jsx(RefreshCw, { size: 14, className: "df-debug-spin" }),
22048
- "Executing..."
22049
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
22050
- /* @__PURE__ */ jsxRuntime.jsx(Play, { size: 14 }),
22051
- "Run Debug"
22052
- ] })
22053
- }
22054
- ) })
22055
- ] });
22056
- }
22057
- function MessageStatePanel({ className = "" }) {
22058
- const { currentStep, currentMessage, currentChanges } = useDebugger();
22059
- const [activeTab, setActiveTab] = require$$0.useState("message");
22060
- if (!currentStep || !currentMessage) {
22061
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `df-debug-state-panel df-debug-state-empty ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No step selected. Run debug to see message state changes." }) });
22098
+ });
22099
+ return () => {
22100
+ p == null ? void 0 : p.dispose();
22101
+ };
22102
+ }
22103
+ return () => {
22104
+ };
22105
+ }, [s, T]);
22106
+ function pe() {
22107
+ var _a, _b;
22108
+ (_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();
22062
22109
  }
22063
- const { workflow_id, task_id, result } = currentStep;
22064
- const tabs = [
22065
- { key: "message", label: "Message" },
22066
- { key: "changes", label: `Changes (${currentChanges.length})` }
22067
- ];
22068
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-state-panel ${className}`, children: [
22069
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-state-header", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-state-tabs", children: tabs.map(({ key, label }) => /* @__PURE__ */ jsxRuntime.jsx(
22070
- "button",
22071
- {
22072
- className: `df-debug-state-tab ${activeTab === key ? "df-debug-state-tab-active" : ""}`,
22073
- onClick: () => setActiveTab(key),
22074
- children: label
22075
- },
22076
- key
22077
- )) }) }),
22078
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-state-content", children: [
22079
- activeTab === "message" && /* @__PURE__ */ jsxRuntime.jsx(MessageView, { message: currentMessage }),
22080
- activeTab === "changes" && /* @__PURE__ */ jsxRuntime.jsx(ChangesView, { changes: currentChanges })
22081
- ] }),
22082
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-state-footer", children: [
22083
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-state-step-type", children: [
22084
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: `df-debug-state-badge df-debug-state-badge-${result}`, children: result }),
22085
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-debug-state-type-label", children: [
22086
- workflow_id,
22087
- task_id ? ` / ${task_id}` : ""
22088
- ] })
22089
- ] }),
22090
- currentMessage.errors.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-state-error", children: [
22091
- "Errors: ",
22092
- currentMessage.errors.length
22093
- ] })
22094
- ] })
22095
- ] });
22110
+ return require$$0.createElement(H, { width: z, height: F, isEditorReady: s, loading: N, _ref: b, className: j, wrapperProps: A });
22096
22111
  }
22097
- function MessageView({ message }) {
22098
- const [expandedSections, setExpandedSections] = require$$0.useState(
22099
- /* @__PURE__ */ new Set(["context"])
22100
- );
22101
- const toggleSection = (section) => {
22102
- setExpandedSections((prev) => {
22103
- const next = new Set(prev);
22104
- if (next.has(section)) {
22105
- next.delete(section);
22106
- } else {
22107
- next.add(section);
22112
+ var fe = Ve;
22113
+ var de = require$$0.memo(fe);
22114
+ var Ft = de;
22115
+ function findPathLineNumbers(jsonString, paths) {
22116
+ if (!paths || paths.length === 0) return [];
22117
+ const lines = jsonString.split("\n");
22118
+ const lineNumbers = [];
22119
+ for (const path of paths) {
22120
+ const pathParts = path.split(".");
22121
+ const lastKey = pathParts[pathParts.length - 1];
22122
+ const keyPattern = new RegExp(`^\\s*"${lastKey}"\\s*:`);
22123
+ for (let i = 0; i < lines.length; i++) {
22124
+ if (keyPattern.test(lines[i])) {
22125
+ if (pathParts.length === 1) {
22126
+ lineNumbers.push(i + 1);
22127
+ } else {
22128
+ let matchedParents = 0;
22129
+ for (let j = i - 1; j >= 0 && matchedParents < pathParts.length - 1; j--) {
22130
+ const parentKey = pathParts[pathParts.length - 2 - matchedParents];
22131
+ const parentPattern = new RegExp(`^\\s*"${parentKey}"\\s*:`);
22132
+ if (parentPattern.test(lines[j])) {
22133
+ matchedParents++;
22134
+ }
22135
+ }
22136
+ if (matchedParents >= Math.min(pathParts.length - 1, 2)) {
22137
+ lineNumbers.push(i + 1);
22138
+ }
22139
+ }
22108
22140
  }
22109
- return next;
22141
+ }
22142
+ }
22143
+ return [...new Set(lineNumbers)];
22144
+ }
22145
+ const defineThemes = (monaco) => {
22146
+ monaco.editor.defineTheme("vscode-dark", {
22147
+ base: "vs-dark",
22148
+ inherit: true,
22149
+ rules: [
22150
+ { token: "string.key.json", foreground: "9CDCFE" },
22151
+ { token: "string.value.json", foreground: "CE9178" },
22152
+ { token: "number", foreground: "B5CEA8" },
22153
+ { token: "keyword", foreground: "569CD6" },
22154
+ { token: "delimiter", foreground: "D4D4D4" }
22155
+ ],
22156
+ colors: {
22157
+ "editor.background": "#1e1e1e",
22158
+ "editor.foreground": "#d4d4d4",
22159
+ "editor.lineHighlightBackground": "#2d2d2d",
22160
+ "editor.selectionBackground": "#264f78",
22161
+ "editorCursor.foreground": "#aeafad",
22162
+ "editorLineNumber.foreground": "#858585",
22163
+ "editorLineNumber.activeForeground": "#c6c6c6",
22164
+ "editorIndentGuide.background": "#404040",
22165
+ "editorIndentGuide.activeBackground": "#707070",
22166
+ "editor.selectionHighlightBackground": "#3a3d41",
22167
+ "editorBracketMatch.background": "#0064001a",
22168
+ "editorBracketMatch.border": "#888888",
22169
+ "editorGutter.background": "#1e1e1e",
22170
+ "scrollbarSlider.background": "#79797966",
22171
+ "scrollbarSlider.hoverBackground": "#646464b3",
22172
+ "scrollbarSlider.activeBackground": "#bfbfbf66",
22173
+ "minimap.background": "#1e1e1e"
22174
+ }
22175
+ });
22176
+ monaco.editor.defineTheme("vscode-light", {
22177
+ base: "vs",
22178
+ inherit: true,
22179
+ rules: [
22180
+ { token: "string.key.json", foreground: "0451A5" },
22181
+ { token: "string.value.json", foreground: "A31515" },
22182
+ { token: "number", foreground: "098658" },
22183
+ { token: "keyword", foreground: "0000FF" },
22184
+ { token: "delimiter", foreground: "000000" }
22185
+ ],
22186
+ colors: {
22187
+ "editor.background": "#ffffff",
22188
+ "editor.foreground": "#000000",
22189
+ "editor.lineHighlightBackground": "#f5f5f5",
22190
+ "editor.selectionBackground": "#add6ff",
22191
+ "editorCursor.foreground": "#000000",
22192
+ "editorLineNumber.foreground": "#999999",
22193
+ "editorLineNumber.activeForeground": "#000000",
22194
+ "editorIndentGuide.background": "#d3d3d3",
22195
+ "editorIndentGuide.activeBackground": "#939393",
22196
+ "editor.selectionHighlightBackground": "#add6ff4d",
22197
+ "editorBracketMatch.background": "#0064001a",
22198
+ "editorBracketMatch.border": "#b9b9b9",
22199
+ "editorGutter.background": "#ffffff",
22200
+ "scrollbarSlider.background": "#64646466",
22201
+ "scrollbarSlider.hoverBackground": "#646464b3",
22202
+ "scrollbarSlider.activeBackground": "#00000099",
22203
+ "minimap.background": "#ffffff"
22204
+ }
22205
+ });
22206
+ };
22207
+ function JsonEditor({
22208
+ value,
22209
+ onChange,
22210
+ readOnly = false,
22211
+ className = "",
22212
+ theme = "dark",
22213
+ onCursorChange,
22214
+ highlightedPaths
22215
+ }) {
22216
+ const editorRef = require$$0.useRef(null);
22217
+ const decorationsRef = require$$0.useRef([]);
22218
+ const handleEditorMount = require$$0.useCallback((editor, monaco) => {
22219
+ editorRef.current = editor;
22220
+ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
22221
+ validate: true,
22222
+ schemas: [],
22223
+ allowComments: false,
22224
+ trailingCommas: "error"
22110
22225
  });
22111
- };
22112
- const sections = [
22113
- { key: "context", value: message.context },
22114
- { key: "payload", value: message.payload },
22115
- { key: "errors", value: message.errors },
22116
- { key: "audit_trail", value: message.audit_trail }
22117
- ];
22118
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-message-view", children: sections.map(({ key, value }) => {
22119
- const isExpanded = expandedSections.has(key);
22120
- const isEmpty2 = Array.isArray(value) ? value.length === 0 : typeof value === "object" && value !== null ? Object.keys(value).length === 0 : !value;
22121
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-message-section", children: [
22122
- /* @__PURE__ */ jsxRuntime.jsxs(
22123
- "div",
22124
- {
22125
- className: "df-debug-message-section-header",
22126
- onClick: () => toggleSection(key),
22127
- children: [
22128
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-arrow", children: isExpanded ? "▼" : "▶" }),
22129
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-key", children: key }),
22130
- isEmpty2 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-section-empty", children: "(empty)" })
22131
- ]
22226
+ if (onCursorChange) {
22227
+ editor.onDidChangeCursorPosition((e) => {
22228
+ onCursorChange(e.position.lineNumber, e.position.column);
22229
+ });
22230
+ }
22231
+ if (!readOnly) {
22232
+ editor.focus();
22233
+ }
22234
+ }, [onCursorChange, readOnly]);
22235
+ require$$0.useEffect(() => {
22236
+ if (!editorRef.current || !highlightedPaths || highlightedPaths.length === 0) {
22237
+ if (editorRef.current && decorationsRef.current.length > 0) {
22238
+ decorationsRef.current = editorRef.current.deltaDecorations(decorationsRef.current, []);
22239
+ }
22240
+ return;
22241
+ }
22242
+ const lineNumbers = findPathLineNumbers(value, highlightedPaths);
22243
+ if (lineNumbers.length > 0) {
22244
+ const decorations = lineNumbers.map((lineNumber) => ({
22245
+ range: {
22246
+ startLineNumber: lineNumber,
22247
+ startColumn: 1,
22248
+ endLineNumber: lineNumber,
22249
+ endColumn: 1
22250
+ },
22251
+ options: {
22252
+ isWholeLine: true,
22253
+ className: "df-highlighted-line",
22254
+ glyphMarginClassName: "df-highlighted-glyph",
22255
+ overviewRuler: {
22256
+ color: theme === "dark" ? "#4ec9b0" : "#388a34",
22257
+ position: 1
22258
+ // Left
22259
+ }
22132
22260
  }
22133
- ),
22134
- isExpanded && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "df-debug-message-section-content", children: JSON.stringify(value, null, 2) })
22135
- ] }, key);
22136
- }) });
22261
+ }));
22262
+ decorationsRef.current = editorRef.current.deltaDecorations(
22263
+ decorationsRef.current,
22264
+ decorations
22265
+ );
22266
+ } else {
22267
+ decorationsRef.current = editorRef.current.deltaDecorations(decorationsRef.current, []);
22268
+ }
22269
+ }, [value, highlightedPaths, theme]);
22270
+ const handleChange = require$$0.useCallback((newValue) => {
22271
+ onChange(newValue || "");
22272
+ }, [onChange]);
22273
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `df-monaco-editor-wrapper ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(
22274
+ Ft,
22275
+ {
22276
+ height: "100%",
22277
+ defaultLanguage: "json",
22278
+ value,
22279
+ onChange: handleChange,
22280
+ onMount: handleEditorMount,
22281
+ beforeMount: defineThemes,
22282
+ theme: theme === "dark" ? "vscode-dark" : "vscode-light",
22283
+ options: {
22284
+ readOnly,
22285
+ minimap: { enabled: false },
22286
+ fontSize: 13,
22287
+ fontFamily: "'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace",
22288
+ lineHeight: 20,
22289
+ tabSize: 2,
22290
+ insertSpaces: true,
22291
+ automaticLayout: true,
22292
+ scrollBeyondLastLine: false,
22293
+ wordWrap: "on",
22294
+ wrappingIndent: "indent",
22295
+ folding: true,
22296
+ foldingStrategy: "indentation",
22297
+ showFoldingControls: "mouseover",
22298
+ bracketPairColorization: { enabled: true },
22299
+ guides: {
22300
+ bracketPairs: false,
22301
+ indentation: false,
22302
+ highlightActiveBracketPair: true,
22303
+ highlightActiveIndentation: false
22304
+ },
22305
+ renderLineHighlight: readOnly ? "none" : "line",
22306
+ selectOnLineNumbers: true,
22307
+ roundedSelection: true,
22308
+ cursorBlinking: "smooth",
22309
+ cursorSmoothCaretAnimation: "on",
22310
+ smoothScrolling: true,
22311
+ padding: { top: 8, bottom: 8 },
22312
+ scrollbar: {
22313
+ vertical: "auto",
22314
+ horizontal: "auto",
22315
+ verticalScrollbarSize: 10,
22316
+ horizontalScrollbarSize: 10
22317
+ },
22318
+ overviewRulerBorder: false,
22319
+ hideCursorInOverviewRuler: true,
22320
+ contextmenu: true,
22321
+ quickSuggestions: false,
22322
+ suggestOnTriggerCharacters: false,
22323
+ acceptSuggestionOnEnter: "off",
22324
+ formatOnPaste: true,
22325
+ formatOnType: false,
22326
+ glyphMargin: highlightedPaths && highlightedPaths.length > 0
22327
+ }
22328
+ }
22329
+ ) });
22137
22330
  }
22138
- function ChangesView({ changes }) {
22139
- if (changes.length === 0) {
22140
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-changes-empty", children: "No changes recorded in this step" });
22331
+ class ErrorBoundary extends require$$0.Component {
22332
+ constructor(props) {
22333
+ super(props);
22334
+ this.state = { hasError: false, error: null };
22335
+ }
22336
+ static getDerivedStateFromError(error) {
22337
+ return { hasError: true, error };
22338
+ }
22339
+ componentDidCatch(error, errorInfo) {
22340
+ console.error("ErrorBoundary caught an error:", error, errorInfo);
22341
+ }
22342
+ render() {
22343
+ var _a;
22344
+ if (this.state.hasError) {
22345
+ if (this.props.fallback) {
22346
+ return this.props.fallback;
22347
+ }
22348
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-error-boundary", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-error-boundary-content", children: [
22349
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "df-error-boundary-title", children: "Something went wrong" }),
22350
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "df-error-boundary-message", children: ((_a = this.state.error) == null ? void 0 : _a.message) || "An unexpected error occurred" }),
22351
+ /* @__PURE__ */ jsxRuntime.jsx(
22352
+ "button",
22353
+ {
22354
+ className: "df-error-boundary-button",
22355
+ onClick: () => this.setState({ hasError: false, error: null }),
22356
+ children: "Try again"
22357
+ }
22358
+ )
22359
+ ] }) });
22360
+ }
22361
+ return this.props.children;
22141
22362
  }
22142
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-changes-view", children: changes.map((change, index2) => {
22143
- const isModified = change.old_value !== void 0 && change.new_value !== void 0;
22144
- const isAdded = change.old_value === void 0 && change.new_value !== void 0;
22145
- const isRemoved = change.old_value !== void 0 && change.new_value === void 0;
22146
- const changeType = isAdded ? "added" : isRemoved ? "removed" : "modified";
22147
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-debug-change-item df-debug-change-${changeType}`, children: [
22148
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-change-header", children: [
22149
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: `df-debug-change-op df-debug-change-op-${changeType}`, children: changeType }),
22150
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-path", children: change.path })
22151
- ] }),
22152
- isModified && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-change-values", children: [
22153
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-old", children: formatValue(change.old_value) }),
22154
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-arrow", children: "→" }),
22155
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-new", children: formatValue(change.new_value) })
22156
- ] }),
22157
- isAdded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-change-values", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-new", children: formatValue(change.new_value) }) }),
22158
- isRemoved && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-debug-change-values", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-change-old", children: formatValue(change.old_value) }) })
22159
- ] }, index2);
22160
- }) });
22161
22363
  }
22162
- function formatValue(value) {
22163
- if (value === void 0) return "undefined";
22164
- if (value === null) return "null";
22165
- if (typeof value === "string") return `"${value}"`;
22166
- if (typeof value === "object") return JSON.stringify(value);
22167
- return String(value);
22364
+ function getSelectionInfo(selection2) {
22365
+ switch (selection2.type) {
22366
+ case "workflow-condition":
22367
+ return {
22368
+ title: "Workflow Condition",
22369
+ subtitle: selection2.workflow.name
22370
+ };
22371
+ case "task":
22372
+ return {
22373
+ title: selection2.task.name,
22374
+ subtitle: `${selection2.workflow.name} / ${selection2.task.function.name}`
22375
+ };
22376
+ case "task-condition":
22377
+ return {
22378
+ title: "Task Condition",
22379
+ subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
22380
+ };
22381
+ case "mapping":
22382
+ return {
22383
+ title: selection2.mapping.path,
22384
+ subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
22385
+ };
22386
+ case "validation-rule":
22387
+ return {
22388
+ title: selection2.rule.message,
22389
+ subtitle: `${selection2.workflow.name} / ${selection2.task.name}`
22390
+ };
22391
+ default:
22392
+ return null;
22393
+ }
22168
22394
  }
22169
- function DebugInfoBubble({
22170
- step,
22171
- targetRef,
22172
- visible,
22173
- onClose
22395
+ function VisualizerInner({
22396
+ workflows,
22397
+ onTaskSelect,
22398
+ onWorkflowSelect,
22399
+ executionResult,
22400
+ debugConfig,
22401
+ debugPayload
22174
22402
  }) {
22175
- var _a;
22176
- const [position, setPosition] = require$$0.useState({ top: 0, left: 0 });
22177
- const bubbleRef = require$$0.useRef(null);
22403
+ const { resolvedTheme } = useTheme();
22404
+ const debugMode = (debugConfig == null ? void 0 : debugConfig.enabled) ?? false;
22405
+ const debuggerContext = useDebuggerOptional();
22406
+ const effectiveDebugContext = debugMode ? debuggerContext : null;
22407
+ const [selection2, setSelection] = require$$0.useState({ type: "none" });
22408
+ const [leftPanelWidth, setLeftPanelWidth] = require$$0.useState(280);
22409
+ const [isDragging, setIsDragging] = require$$0.useState(false);
22410
+ const [treePanelHeight, setTreePanelHeight] = require$$0.useState(50);
22411
+ const [isVerticalDragging, setIsVerticalDragging] = require$$0.useState(false);
22412
+ const containerRef = require$$0.useRef(null);
22413
+ const leftPanelRef = require$$0.useRef(null);
22414
+ const handleSelection = (newSelection) => {
22415
+ setSelection(newSelection);
22416
+ if (newSelection.type === "workflow-condition") {
22417
+ onWorkflowSelect == null ? void 0 : onWorkflowSelect(newSelection.workflow);
22418
+ } else if (newSelection.type === "task" || newSelection.type === "task-condition" || newSelection.type === "mapping" || newSelection.type === "validation-rule") {
22419
+ onTaskSelect == null ? void 0 : onTaskSelect(newSelection.task, newSelection.workflow);
22420
+ }
22421
+ };
22422
+ const handleMouseDown = require$$0.useCallback((e) => {
22423
+ e.preventDefault();
22424
+ setIsDragging(true);
22425
+ }, []);
22426
+ const handleVerticalMouseDown = require$$0.useCallback((e) => {
22427
+ e.preventDefault();
22428
+ setIsVerticalDragging(true);
22429
+ }, []);
22178
22430
  require$$0.useEffect(() => {
22179
- if (!visible || !targetRef.current) return;
22180
- const updatePosition = () => {
22181
- var _a2, _b;
22182
- const targetRect = (_a2 = targetRef.current) == null ? void 0 : _a2.getBoundingClientRect();
22183
- const bubbleRect = (_b = bubbleRef.current) == null ? void 0 : _b.getBoundingClientRect();
22184
- if (!targetRect) return;
22185
- let top = targetRect.bottom + 8;
22186
- let left = targetRect.left;
22187
- if (bubbleRect) {
22188
- if (left + bubbleRect.width > window.innerWidth - 16) {
22189
- left = window.innerWidth - bubbleRect.width - 16;
22190
- }
22191
- if (top + bubbleRect.height > window.innerHeight - 16) {
22192
- top = targetRect.top - bubbleRect.height - 8;
22193
- }
22431
+ if (!isDragging) return;
22432
+ const handleMouseMove = (e) => {
22433
+ if (containerRef.current) {
22434
+ const rect = containerRef.current.getBoundingClientRect();
22435
+ const newWidth = e.clientX - rect.left;
22436
+ setLeftPanelWidth(Math.max(200, Math.min(450, newWidth)));
22194
22437
  }
22195
- setPosition({ top, left });
22196
22438
  };
22197
- updatePosition();
22198
- window.addEventListener("scroll", updatePosition, true);
22199
- window.addEventListener("resize", updatePosition);
22439
+ const handleMouseUp = () => {
22440
+ setIsDragging(false);
22441
+ };
22442
+ document.addEventListener("mousemove", handleMouseMove);
22443
+ document.addEventListener("mouseup", handleMouseUp);
22200
22444
  return () => {
22201
- window.removeEventListener("scroll", updatePosition, true);
22202
- window.removeEventListener("resize", updatePosition);
22445
+ document.removeEventListener("mousemove", handleMouseMove);
22446
+ document.removeEventListener("mouseup", handleMouseUp);
22203
22447
  };
22204
- }, [visible, targetRef]);
22205
- if (!visible) return null;
22206
- const { workflow_id, task_id, result, message } = step;
22207
- const state = result === "executed" ? "executed" : "skipped";
22208
- const hasError = message && message.errors && message.errors.length > 0;
22209
- const displayState = hasError ? "error" : state;
22210
- return reactDom.createPortal(
22448
+ }, [isDragging]);
22449
+ require$$0.useEffect(() => {
22450
+ if (!isVerticalDragging) return;
22451
+ const handleMouseMove = (e) => {
22452
+ if (leftPanelRef.current) {
22453
+ const rect = leftPanelRef.current.getBoundingClientRect();
22454
+ const relativeY = e.clientY - rect.top;
22455
+ const percentage = relativeY / rect.height * 100;
22456
+ setTreePanelHeight(Math.max(20, Math.min(80, percentage)));
22457
+ }
22458
+ };
22459
+ const handleMouseUp = () => {
22460
+ setIsVerticalDragging(false);
22461
+ };
22462
+ document.addEventListener("mousemove", handleMouseMove);
22463
+ document.addEventListener("mouseup", handleMouseUp);
22464
+ return () => {
22465
+ document.removeEventListener("mousemove", handleMouseMove);
22466
+ document.removeEventListener("mouseup", handleMouseUp);
22467
+ };
22468
+ }, [isVerticalDragging]);
22469
+ const selectionInfo = getSelectionInfo(selection2);
22470
+ const hasDebugTrace = debugMode && (effectiveDebugContext == null ? void 0 : effectiveDebugContext.hasTrace);
22471
+ const displayMessage = hasDebugTrace ? effectiveDebugContext == null ? void 0 : effectiveDebugContext.currentMessage : executionResult;
22472
+ const currentChanges = hasDebugTrace ? effectiveDebugContext == null ? void 0 : effectiveDebugContext.currentChanges : [];
22473
+ const currentStepIndex = hasDebugTrace ? effectiveDebugContext == null ? void 0 : effectiveDebugContext.state.currentStepIndex : -1;
22474
+ const highlightedPaths = require$$0.useMemo(() => {
22475
+ if (!currentChanges || currentChanges.length === 0) return void 0;
22476
+ return currentChanges.map((change) => change.path);
22477
+ }, [currentChanges]);
22478
+ const isDraggingAny = isDragging || isVerticalDragging;
22479
+ return /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `df-visualizer-container df-theme-${resolvedTheme}`, children: [
22480
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-visualizer-title-bar", children: [
22481
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-visualizer-title", children: "Workflows" }),
22482
+ debugMode && debugConfig && /* @__PURE__ */ jsxRuntime.jsx(
22483
+ IntegratedDebugToolbar,
22484
+ {
22485
+ workflows,
22486
+ payload: debugPayload ?? debugConfig.initialPayload,
22487
+ autoExecute: debugConfig.autoExecute,
22488
+ onExecutionComplete: debugConfig.onExecutionComplete,
22489
+ onExecutionError: debugConfig.onExecutionError
22490
+ }
22491
+ )
22492
+ ] }),
22211
22493
  /* @__PURE__ */ jsxRuntime.jsxs(
22212
22494
  "div",
22213
22495
  {
22214
- ref: bubbleRef,
22215
- className: "df-debug-bubble",
22216
- style: {
22217
- position: "fixed",
22218
- top: position.top,
22219
- left: position.left
22220
- },
22496
+ ref: containerRef,
22497
+ className: `df-visualizer-horizontal ${isDraggingAny ? "df-dragging" : ""}`,
22221
22498
  children: [
22222
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-header", children: [
22223
- /* @__PURE__ */ jsxRuntime.jsx(StateIcon, { state: displayState }),
22224
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-title", children: task_id ? "Task Step" : "Workflow Skipped" }),
22225
- onClose && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "df-debug-bubble-close", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(X, { size: 14 }) })
22226
- ] }),
22227
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-content", children: [
22228
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-row", children: [
22229
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-label", children: "Workflow:" }),
22230
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-value", children: workflow_id })
22231
- ] }),
22232
- task_id && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-row", children: [
22233
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-label", children: "Task:" }),
22234
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-value", children: task_id })
22235
- ] }),
22236
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-row", children: [
22237
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-debug-bubble-label", children: "Result:" }),
22238
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: `df-debug-bubble-state df-debug-bubble-state-${displayState}`, children: result })
22239
- ] }),
22240
- hasError && (message == null ? void 0 : message.errors) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-debug-bubble-error", children: [
22241
- /* @__PURE__ */ jsxRuntime.jsx(CircleAlert, { size: 14 }),
22242
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: ((_a = message.errors[0]) == null ? void 0 : _a.message) || "Unknown error" })
22243
- ] })
22499
+ /* @__PURE__ */ jsxRuntime.jsxs(
22500
+ "div",
22501
+ {
22502
+ ref: leftPanelRef,
22503
+ className: "df-visualizer-left",
22504
+ style: { width: leftPanelWidth },
22505
+ children: [
22506
+ /* @__PURE__ */ jsxRuntime.jsxs(
22507
+ "div",
22508
+ {
22509
+ className: `df-visualizer-left-tree ${displayMessage ? "df-with-result" : ""}`,
22510
+ style: displayMessage ? { height: `${treePanelHeight}%` } : void 0,
22511
+ children: [
22512
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-visualizer-left-header", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-visualizer-left-title", children: "Explorer" }) }),
22513
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-visualizer-left-content", children: workflows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-empty-state", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No workflows to display" }) }) : /* @__PURE__ */ jsxRuntime.jsx(
22514
+ TreeView,
22515
+ {
22516
+ workflows,
22517
+ selection: selection2,
22518
+ onSelect: handleSelection,
22519
+ debugMode
22520
+ }
22521
+ ) })
22522
+ ]
22523
+ }
22524
+ ),
22525
+ displayMessage && /* @__PURE__ */ jsxRuntime.jsx(
22526
+ "div",
22527
+ {
22528
+ className: `df-visualizer-divider-horizontal ${isVerticalDragging ? "df-divider-active" : ""}`,
22529
+ onMouseDown: handleVerticalMouseDown
22530
+ }
22531
+ ),
22532
+ displayMessage && /* @__PURE__ */ jsxRuntime.jsxs(
22533
+ "div",
22534
+ {
22535
+ className: "df-visualizer-result-panel",
22536
+ style: { height: `${100 - treePanelHeight}%` },
22537
+ children: [
22538
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-visualizer-result-header", children: [
22539
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-visualizer-result-title", children: hasDebugTrace ? currentStepIndex !== void 0 && currentStepIndex >= 0 ? `Step ${currentStepIndex + 1}` : "Ready" : "Result" }),
22540
+ hasDebugTrace && currentChanges && currentChanges.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "df-visualizer-result-changes", children: [
22541
+ currentChanges.length,
22542
+ " change",
22543
+ currentChanges.length !== 1 ? "s" : ""
22544
+ ] })
22545
+ ] }),
22546
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-visualizer-result-content", children: /* @__PURE__ */ jsxRuntime.jsx(
22547
+ JsonEditor,
22548
+ {
22549
+ value: JSON.stringify(displayMessage, null, 2),
22550
+ onChange: () => {
22551
+ },
22552
+ readOnly: true,
22553
+ theme: resolvedTheme === "dark" ? "dark" : "light",
22554
+ highlightedPaths
22555
+ }
22556
+ ) })
22557
+ ]
22558
+ }
22559
+ )
22560
+ ]
22561
+ }
22562
+ ),
22563
+ /* @__PURE__ */ jsxRuntime.jsx(
22564
+ "div",
22565
+ {
22566
+ className: `df-visualizer-divider ${isDragging ? "df-divider-active" : ""}`,
22567
+ onMouseDown: handleMouseDown
22568
+ }
22569
+ ),
22570
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-visualizer-right", children: [
22571
+ selectionInfo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "df-details-header", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "df-details-header-info", children: [
22572
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-details-header-title", children: selectionInfo.title }),
22573
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "df-details-header-subtitle", children: selectionInfo.subtitle })
22574
+ ] }) }),
22575
+ /* @__PURE__ */ jsxRuntime.jsx(DetailsPanel, { selection: selection2 })
22244
22576
  ] })
22245
22577
  ]
22246
22578
  }
22247
- ),
22248
- document.body
22249
- );
22250
- }
22251
- function StateIcon({ state }) {
22252
- switch (state) {
22253
- case "executed":
22254
- return /* @__PURE__ */ jsxRuntime.jsx(Check, { size: 16, className: "df-debug-icon-executed" });
22255
- case "skipped":
22256
- return /* @__PURE__ */ jsxRuntime.jsx(SkipForward, { size: 16, className: "df-debug-icon-skipped" });
22257
- case "error":
22258
- return /* @__PURE__ */ jsxRuntime.jsx(CircleAlert, { size: 16, className: "df-debug-icon-error" });
22259
- case "current":
22260
- return /* @__PURE__ */ jsxRuntime.jsx(Clock, { size: 16, className: "df-debug-icon-current" });
22261
- case "pending":
22262
- default:
22263
- return /* @__PURE__ */ jsxRuntime.jsx(Clock, { size: 16, className: "df-debug-icon-pending" });
22264
- }
22579
+ )
22580
+ ] }) });
22265
22581
  }
22266
- function DebugStateBadge({
22267
- state,
22268
- conditionResult,
22269
- size = "sm"
22582
+ function WorkflowVisualizer({
22583
+ workflows,
22584
+ onWorkflowSelect,
22585
+ onTaskSelect,
22586
+ theme = "system",
22587
+ className = "",
22588
+ executionResult,
22589
+ debugConfig,
22590
+ debugPayload
22270
22591
  }) {
22271
- const iconSize = size === "sm" ? 12 : 14;
22272
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `df-debug-badge df-debug-badge-${state} df-debug-badge-${size}`, children: [
22273
- /* @__PURE__ */ jsxRuntime.jsx(StateIcon, { state }),
22274
- conditionResult !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `df-debug-badge-condition ${conditionResult ? "df-debug-badge-condition-pass" : "df-debug-badge-condition-fail"}`, children: conditionResult ? /* @__PURE__ */ jsxRuntime.jsx(Check, { size: iconSize }) : /* @__PURE__ */ jsxRuntime.jsx(X, { size: iconSize }) })
22275
- ] });
22592
+ if (debugConfig == null ? void 0 : debugConfig.enabled) {
22593
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { defaultTheme: theme, children: /* @__PURE__ */ jsxRuntime.jsx(
22594
+ DebuggerProvider,
22595
+ {
22596
+ engineFactory: debugConfig.engineFactory,
22597
+ autoActivate: true,
22598
+ initialPayload: debugPayload ?? debugConfig.initialPayload,
22599
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `df-root ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(
22600
+ VisualizerInner,
22601
+ {
22602
+ workflows,
22603
+ onTaskSelect,
22604
+ onWorkflowSelect,
22605
+ executionResult,
22606
+ debugConfig,
22607
+ debugPayload
22608
+ }
22609
+ ) })
22610
+ }
22611
+ ) });
22612
+ }
22613
+ return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { defaultTheme: theme, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `df-root ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(
22614
+ VisualizerInner,
22615
+ {
22616
+ workflows,
22617
+ onTaskSelect,
22618
+ onWorkflowSelect,
22619
+ executionResult
22620
+ }
22621
+ ) }) });
22276
22622
  }
22277
22623
  class WasmEngine {
22278
22624
  __destroy_into_raw() {
@@ -22498,6 +22844,7 @@ exports.DebuggerControls = DebuggerControls;
22498
22844
  exports.DebuggerProvider = DebuggerProvider;
22499
22845
  exports.ErrorBoundary = ErrorBoundary;
22500
22846
  exports.FunctionTypeBadge = FunctionTypeBadge;
22847
+ exports.IntegratedDebugToolbar = IntegratedDebugToolbar;
22501
22848
  exports.JsonViewer = JsonViewer;
22502
22849
  exports.MessageInputPanel = MessageInputPanel;
22503
22850
  exports.MessageStatePanel = MessageStatePanel;