@eventcatalog/visualiser 3.15.2 → 3.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -96,9 +96,9 @@ __export(index_exports, {
96
96
  module.exports = __toCommonJS(index_exports);
97
97
 
98
98
  // src/components/NodeGraph.tsx
99
- var import_react69 = require("react");
99
+ var import_react71 = require("react");
100
100
  var import_react_dom = require("react-dom");
101
- var import_react70 = require("@xyflow/react");
101
+ var import_react72 = require("@xyflow/react");
102
102
  var import_style = require("@xyflow/react/dist/style.css");
103
103
  var import_lucide_react25 = require("lucide-react");
104
104
  var DropdownMenu2 = __toESM(require("@radix-ui/react-dropdown-menu"));
@@ -6968,13 +6968,229 @@ var MermaidView = ({
6968
6968
  };
6969
6969
  var MermaidView_default = MermaidView;
6970
6970
 
6971
+ // src/hooks/use-channel-visibility.ts
6972
+ var import_react65 = require("react");
6973
+
6974
+ // src/utils/utils/utils.ts
6975
+ var import_react64 = require("@xyflow/react");
6976
+ var import_dagre = __toESM(require("dagre"));
6977
+ var generateIdForNode = (node) => {
6978
+ return `${node.data.id}-${node.data.version}`;
6979
+ };
6980
+ var generateIdForNodes = (nodes) => {
6981
+ return nodes.map((node) => `${node.data.id}-${node.data.version}`).join("-");
6982
+ };
6983
+ var generatedIdForEdge = (source, target) => {
6984
+ return `${source.data.id}-${source.data.version}-${target.data.id}-${target.data.version}`;
6985
+ };
6986
+ var getColorFromString = (id) => {
6987
+ let hash = 0;
6988
+ for (let i = 0; i < id.length; i++) {
6989
+ hash = id.charCodeAt(i) + ((hash << 5) - hash);
6990
+ }
6991
+ let color = "#";
6992
+ for (let i = 0; i < 3; i++) {
6993
+ const value = hash >> i * 8 & 255;
6994
+ color += value.toString(16).padStart(2, "0");
6995
+ }
6996
+ return color;
6997
+ };
6998
+ var getEdgeLabelForServiceAsTarget = (data) => {
6999
+ const type = data.collection;
7000
+ switch (type) {
7001
+ case "commands":
7002
+ return "invokes";
7003
+ case "events":
7004
+ return "publishes \nevent";
7005
+ case "queries":
7006
+ return "requests";
7007
+ default:
7008
+ return "sends to";
7009
+ }
7010
+ };
7011
+ var getEdgeLabelForMessageAsSource = (data, throughChannel = false) => {
7012
+ const type = data.collection;
7013
+ switch (type) {
7014
+ case "commands":
7015
+ return "accepts";
7016
+ case "events":
7017
+ return throughChannel ? "subscribed to" : "subscribed by";
7018
+ case "queries":
7019
+ return "accepts";
7020
+ default:
7021
+ return "sends to";
7022
+ }
7023
+ };
7024
+ var calculatedNodes = (flow, nodes) => {
7025
+ return nodes.map((node) => {
7026
+ const { x, y } = flow.node(node.id);
7027
+ return { ...node, position: { x, y } };
7028
+ });
7029
+ };
7030
+ var createDagreGraph = ({
7031
+ ranksep = 180,
7032
+ nodesep = 50,
7033
+ ...rest
7034
+ }) => {
7035
+ const graph = new import_dagre.default.graphlib.Graph({ compound: true });
7036
+ graph.setGraph({ rankdir: "LR", ranksep, nodesep, ...rest });
7037
+ graph.setDefaultEdgeLabel(() => ({}));
7038
+ return graph;
7039
+ };
7040
+ var createEdge = (edgeOptions) => {
7041
+ return {
7042
+ label: "subscribed by",
7043
+ animated: false,
7044
+ // markerStart: {
7045
+ // type: MarkerType.Arrow,
7046
+ // width: 40,
7047
+ // height: 40,
7048
+ // },
7049
+ markerEnd: {
7050
+ type: import_react64.MarkerType.ArrowClosed,
7051
+ width: 40,
7052
+ height: 40,
7053
+ color: "rgb(var(--ec-page-text-muted))"
7054
+ },
7055
+ style: {
7056
+ strokeWidth: 1.5,
7057
+ stroke: "rgb(var(--ec-page-text-muted))",
7058
+ strokeDasharray: "5 5"
7059
+ },
7060
+ ...edgeOptions
7061
+ };
7062
+ };
7063
+ var createNode = (values) => {
7064
+ return {
7065
+ sourcePosition: import_react64.Position.Right,
7066
+ targetPosition: import_react64.Position.Left,
7067
+ ...values
7068
+ };
7069
+ };
7070
+ var getNodesAndEdgesFromDagre = ({
7071
+ nodes,
7072
+ edges,
7073
+ defaultFlow
7074
+ }) => {
7075
+ const flow = defaultFlow || createDagreGraph({ ranksep: 300, nodesep: 50 });
7076
+ nodes.forEach((node) => {
7077
+ flow.setNode(node.id, { width: 150, height: 100 });
7078
+ });
7079
+ edges.forEach((edge) => {
7080
+ flow.setEdge(edge.source, edge.target);
7081
+ });
7082
+ import_dagre.default.layout(flow);
7083
+ return {
7084
+ nodes: calculatedNodes(flow, nodes),
7085
+ edges
7086
+ };
7087
+ };
7088
+
7089
+ // src/hooks/use-channel-visibility.ts
7090
+ var useChannelVisibility = ({
7091
+ nodes,
7092
+ edges,
7093
+ setNodes,
7094
+ setEdges,
7095
+ skipProcessing = false
7096
+ }) => {
7097
+ const [hideChannels, setHideChannels] = (0, import_react65.useState)(false);
7098
+ const [initialNodes, setInitialNodes] = (0, import_react65.useState)(nodes);
7099
+ const [initialEdges, setInitialEdges] = (0, import_react65.useState)(edges);
7100
+ (0, import_react65.useEffect)(() => {
7101
+ const storedHideChannels = localStorage.getItem(
7102
+ "EventCatalog:hideChannels"
7103
+ );
7104
+ if (storedHideChannels !== null) {
7105
+ setHideChannels(storedHideChannels === "true");
7106
+ }
7107
+ }, []);
7108
+ (0, import_react65.useEffect)(() => {
7109
+ const hasChannels = nodes.some((node) => node.type === "channels");
7110
+ if (!hideChannels || hasChannels) {
7111
+ setInitialNodes(nodes);
7112
+ setInitialEdges(edges);
7113
+ }
7114
+ }, [nodes, edges, hideChannels]);
7115
+ const toggleChannelsVisibility = (0, import_react65.useCallback)(() => {
7116
+ setHideChannels((prev) => {
7117
+ const newValue = !prev;
7118
+ localStorage.setItem(
7119
+ "EventCatalog:hideChannels",
7120
+ JSON.stringify(newValue)
7121
+ );
7122
+ return newValue;
7123
+ });
7124
+ }, []);
7125
+ const channels = (0, import_react65.useMemo)(
7126
+ () => nodes.filter((node) => node.type === "channels"),
7127
+ [nodes]
7128
+ );
7129
+ const updatedNodes = (0, import_react65.useMemo)(
7130
+ () => nodes.filter((node) => node.type !== "channels"),
7131
+ [nodes]
7132
+ );
7133
+ const updatedEdges = (0, import_react65.useMemo)(() => {
7134
+ const newEdges = edges.reduce((acc, edge) => {
7135
+ const { source, target, data } = edge;
7136
+ const targetIsChannel = channels.some((channel) => channel.id === target);
7137
+ const sourceIsChannel = channels.some((channel) => channel.id === source);
7138
+ if (!sourceIsChannel && !targetIsChannel) {
7139
+ return [...acc, edge];
7140
+ }
7141
+ if (sourceIsChannel || targetIsChannel) {
7142
+ const rootSourceAndTarget = data?.rootSourceAndTarget;
7143
+ if (!rootSourceAndTarget) {
7144
+ return [...acc, edge];
7145
+ }
7146
+ const targetIsService = rootSourceAndTarget?.target?.collection === "services";
7147
+ const edgeLabel = targetIsService ? getEdgeLabelForMessageAsSource(rootSourceAndTarget.source) : getEdgeLabelForServiceAsTarget(rootSourceAndTarget.target);
7148
+ const newEdgeId = `${rootSourceAndTarget.source.id}-${rootSourceAndTarget.target.id}`;
7149
+ return [
7150
+ ...acc,
7151
+ createEdge({
7152
+ id: newEdgeId,
7153
+ source: rootSourceAndTarget.source.id,
7154
+ target: rootSourceAndTarget.target.id,
7155
+ label: edgeLabel
7156
+ })
7157
+ ];
7158
+ }
7159
+ return acc;
7160
+ }, []);
7161
+ return newEdges.filter(
7162
+ (edge, index, self) => index === self.findIndex((t) => t.id === edge.id)
7163
+ );
7164
+ }, [edges, channels]);
7165
+ (0, import_react65.useEffect)(() => {
7166
+ if (skipProcessing) {
7167
+ return;
7168
+ }
7169
+ if (hideChannels) {
7170
+ const { nodes: newNodes, edges: newEdges } = getNodesAndEdgesFromDagre({
7171
+ nodes: updatedNodes,
7172
+ edges: updatedEdges
7173
+ });
7174
+ setNodes(newNodes);
7175
+ setEdges(newEdges);
7176
+ } else {
7177
+ setNodes(initialNodes);
7178
+ setEdges(initialEdges);
7179
+ }
7180
+ }, [hideChannels, skipProcessing]);
7181
+ return {
7182
+ hideChannels,
7183
+ toggleChannelsVisibility
7184
+ };
7185
+ };
7186
+
6971
7187
  // src/components/VisualizerDropdownContent.tsx
6972
- var import_react64 = require("react");
7188
+ var import_react66 = require("react");
6973
7189
  var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
6974
7190
  var import_lucide_react23 = require("lucide-react");
6975
7191
  var import_outline2 = require("@heroicons/react/24/outline");
6976
7192
  var import_jsx_runtime35 = require("react/jsx-runtime");
6977
- var VisualizerDropdownContent = (0, import_react64.memo)(
7193
+ var VisualizerDropdownContent = (0, import_react66.memo)(
6978
7194
  ({
6979
7195
  isMermaidView,
6980
7196
  setIsMermaidView,
@@ -7000,7 +7216,7 @@ var VisualizerDropdownContent = (0, import_react64.memo)(
7000
7216
  notesCount = 0,
7001
7217
  onOpenNotes
7002
7218
  }) => {
7003
- const [layoutStatus, setLayoutStatus] = (0, import_react64.useState)("idle");
7219
+ const [layoutStatus, setLayoutStatus] = (0, import_react66.useState)("idle");
7004
7220
  const portalContainer = usePortalContainer();
7005
7221
  const handleSaveLayout = async () => {
7006
7222
  if (!onSaveLayout) return;
@@ -7339,10 +7555,10 @@ VisualizerDropdownContent.displayName = "VisualizerDropdownContent";
7339
7555
  var VisualizerDropdownContent_default = VisualizerDropdownContent;
7340
7556
 
7341
7557
  // src/components/NodeContextMenu.tsx
7342
- var import_react65 = require("react");
7558
+ var import_react67 = require("react");
7343
7559
  var ContextMenu5 = __toESM(require("@radix-ui/react-context-menu"));
7344
7560
  var import_jsx_runtime36 = require("react/jsx-runtime");
7345
- var NodeContextMenu_default = (0, import_react65.memo)(function NodeContextMenu({
7561
+ var NodeContextMenu_default = (0, import_react67.memo)(function NodeContextMenu({
7346
7562
  items,
7347
7563
  children
7348
7564
  }) {
@@ -7380,8 +7596,8 @@ var NodeContextMenu_default = (0, import_react65.memo)(function NodeContextMenu(
7380
7596
  });
7381
7597
 
7382
7598
  // src/utils/layout.ts
7383
- var import_dagre = __toESM(require("dagre"));
7384
- var import_react66 = require("@xyflow/react");
7599
+ var import_dagre2 = __toESM(require("dagre"));
7600
+ var import_react68 = require("@xyflow/react");
7385
7601
  var GROUP_HEADER_HEIGHT = 44;
7386
7602
  var GROUP_CONTENT_PADDING_TOP = 50;
7387
7603
  var GROUP_CONTENT_PADDING_BOTTOM = 30;
@@ -7566,7 +7782,7 @@ function layoutGraph(nodes, edges, options = {}, style) {
7566
7782
  computeGroupSize(child.id);
7567
7783
  }
7568
7784
  }
7569
- const ig = new import_dagre.default.graphlib.Graph();
7785
+ const ig = new import_dagre2.default.graphlib.Graph();
7570
7786
  ig.setDefaultEdgeLabel(() => ({}));
7571
7787
  ig.setGraph({
7572
7788
  rankdir,
@@ -7592,7 +7808,7 @@ function layoutGraph(nodes, edges, options = {}, style) {
7592
7808
  ig.setEdge(edge.source, edge.target);
7593
7809
  }
7594
7810
  }
7595
- import_dagre.default.layout(ig);
7811
+ import_dagre2.default.layout(ig);
7596
7812
  const childPositions = /* @__PURE__ */ new Map();
7597
7813
  let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
7598
7814
  for (const child of children) {
@@ -7647,7 +7863,7 @@ function layoutGraph(nodes, edges, options = {}, style) {
7647
7863
  topLevelGroupIds.add(groupId);
7648
7864
  }
7649
7865
  }
7650
- const outerG = new import_dagre.default.graphlib.Graph();
7866
+ const outerG = new import_dagre2.default.graphlib.Graph();
7651
7867
  outerG.setDefaultEdgeLabel(() => ({}));
7652
7868
  outerG.setGraph({ rankdir, nodesep, ranksep, edgesep });
7653
7869
  for (const groupId of topLevelGroupIds) {
@@ -7689,7 +7905,7 @@ function layoutGraph(nodes, edges, options = {}, style) {
7689
7905
  outerG.setEdge(src, tgt);
7690
7906
  }
7691
7907
  }
7692
- import_dagre.default.layout(outerG);
7908
+ import_dagre2.default.layout(outerG);
7693
7909
  const outerPositions = /* @__PURE__ */ new Map();
7694
7910
  outerG.nodes().forEach((id) => {
7695
7911
  const pos = outerG.node(id);
@@ -7793,7 +8009,7 @@ function layoutGraph(nodes, edges, options = {}, style) {
7793
8009
  const isFlowStep = edge.type === "flow-step";
7794
8010
  const isBidirectional = edge.type === "reads-writes";
7795
8011
  const arrowMarker = {
7796
- type: import_react66.MarkerType.ArrowClosed,
8012
+ type: import_react68.MarkerType.ArrowClosed,
7797
8013
  width: 20,
7798
8014
  height: 20,
7799
8015
  color: "rgb(var(--ec-page-text-muted))"
@@ -7824,7 +8040,7 @@ function getMessageCollection(edge, nodeById) {
7824
8040
  return targetNode ? `${targetNode.type}s` : void 0;
7825
8041
  }
7826
8042
  function flatLayout(nodes, edges, graphOpts, nodeSize, style) {
7827
- const g = new import_dagre.default.graphlib.Graph();
8043
+ const g = new import_dagre2.default.graphlib.Graph();
7828
8044
  g.setDefaultEdgeLabel(() => ({}));
7829
8045
  g.setGraph(graphOpts);
7830
8046
  nodes.forEach((node) => {
@@ -7834,7 +8050,7 @@ function flatLayout(nodes, edges, graphOpts, nodeSize, style) {
7834
8050
  edges.forEach((edge) => {
7835
8051
  g.setEdge(edge.source, edge.target);
7836
8052
  });
7837
- import_dagre.default.layout(g);
8053
+ import_dagre2.default.layout(g);
7838
8054
  const layoutNodes = nodes.map((node) => {
7839
8055
  const pos = g.node(node.id);
7840
8056
  return {
@@ -7850,7 +8066,7 @@ function flatLayout(nodes, edges, graphOpts, nodeSize, style) {
7850
8066
  const isFlowStep = edge.type === "flow-step";
7851
8067
  const isBidirectional = edge.type === "reads-writes";
7852
8068
  const arrowMarker = {
7853
- type: import_react66.MarkerType.ArrowClosed,
8069
+ type: import_react68.MarkerType.ArrowClosed,
7854
8070
  width: 20,
7855
8071
  height: 20,
7856
8072
  color: "rgb(var(--ec-page-text-muted))"
@@ -7870,9 +8086,9 @@ function flatLayout(nodes, edges, graphOpts, nodeSize, style) {
7870
8086
  }
7871
8087
 
7872
8088
  // src/components/NotesToolbarButton.tsx
7873
- var import_react67 = require("react");
8089
+ var import_react69 = require("react");
7874
8090
  var import_lucide_react24 = require("lucide-react");
7875
- var import_react68 = require("@xyflow/react");
8091
+ var import_react70 = require("@xyflow/react");
7876
8092
  var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
7877
8093
  var import_jsx_runtime37 = require("react/jsx-runtime");
7878
8094
  var NODE_TYPE_META = {
@@ -8133,12 +8349,12 @@ function AllNotesModal({
8133
8349
  onClose,
8134
8350
  nodes
8135
8351
  }) {
8136
- const { setCenter, getZoom } = (0, import_react68.useReactFlow)();
8137
- const [selectedIdx, setSelectedIdx] = (0, import_react67.useState)(0);
8352
+ const { setCenter, getZoom } = (0, import_react70.useReactFlow)();
8353
+ const [selectedIdx, setSelectedIdx] = (0, import_react69.useState)(0);
8138
8354
  const portalContainer = usePortalContainer();
8139
8355
  const totalNotes = noteGroups.reduce((sum, g) => sum + g.notes.length, 0);
8140
8356
  const selected = noteGroups[selectedIdx] || noteGroups[0];
8141
- const handleNavigate = (0, import_react67.useCallback)(
8357
+ const handleNavigate = (0, import_react69.useCallback)(
8142
8358
  (nodeId) => {
8143
8359
  const node = nodes.find((n) => n.id === nodeId);
8144
8360
  if (!node) return;
@@ -8590,13 +8806,13 @@ var LAYOUT_CHANGE_PANEL_STYLE_WITH_WALKTHROUGH = {
8590
8806
  };
8591
8807
  var LAYOUT_CHANGE_PANEL_STYLE_DEFAULT = { marginLeft: "60px" };
8592
8808
  var LEGEND_PANEL_STYLE_WITH_MINIMAP = { marginRight: "230px" };
8593
- var LegendPanel = (0, import_react69.memo)(function LegendPanel2({
8809
+ var LegendPanel = (0, import_react71.memo)(function LegendPanel2({
8594
8810
  legend,
8595
8811
  showMinimap,
8596
8812
  onLegendClick
8597
8813
  }) {
8598
8814
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
8599
- import_react70.Panel,
8815
+ import_react72.Panel,
8600
8816
  {
8601
8817
  position: "bottom-right",
8602
8818
  style: showMinimap ? LEGEND_PANEL_STYLE_WITH_MINIMAP : void 0,
@@ -8652,14 +8868,14 @@ var NodeGraphBuilder = ({
8652
8868
  onSaveLayout,
8653
8869
  onResetLayout
8654
8870
  }) => {
8655
- (0, import_react69.useEffect)(() => {
8871
+ (0, import_react71.useEffect)(() => {
8656
8872
  if (onBuildUrl) {
8657
8873
  setBuildUrlFn(onBuildUrl);
8658
8874
  }
8659
8875
  }, []);
8660
- const nodeTypes = (0, import_react69.useMemo)(() => {
8876
+ const nodeTypes = (0, import_react71.useMemo)(() => {
8661
8877
  const wrapWithContextMenu = (Component) => {
8662
- const Wrapped = (0, import_react69.memo)((props) => {
8878
+ const Wrapped = (0, import_react71.memo)((props) => {
8663
8879
  const items = props.data?.contextMenu;
8664
8880
  if (!items?.length) return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Component, { ...props });
8665
8881
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(NodeContextMenu_default, { items, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Component, { ...props }) });
@@ -8696,10 +8912,10 @@ var NodeGraphBuilder = ({
8696
8912
  "data-product": wrapWithContextMenu(DataProduct_default),
8697
8913
  "data-products": wrapWithContextMenu(DataProduct_default),
8698
8914
  group: GroupNode_default,
8699
- note: (0, import_react69.memo)((props) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(NoteNode_default, { ...props, readOnly: true }))
8915
+ note: (0, import_react71.memo)((props) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(NoteNode_default, { ...props, readOnly: true }))
8700
8916
  };
8701
8917
  }, []);
8702
- const edgeTypes2 = (0, import_react69.useMemo)(
8918
+ const edgeTypes2 = (0, import_react71.useMemo)(
8703
8919
  () => ({
8704
8920
  animated: AnimatedMessageEdge_default,
8705
8921
  multiline: MultilineEdgeLabel_default,
@@ -8707,47 +8923,47 @@ var NodeGraphBuilder = ({
8707
8923
  }),
8708
8924
  []
8709
8925
  );
8710
- const [nodes, setNodes, onNodesChange] = (0, import_react70.useNodesState)(initialNodes);
8711
- const [edges, setEdges, onEdgesChange] = (0, import_react70.useEdgesState)(initialEdges);
8712
- const { fitView, getNodes } = (0, import_react70.useReactFlow)();
8713
- (0, import_react69.useEffect)(() => {
8926
+ const [nodes, setNodes, onNodesChange] = (0, import_react72.useNodesState)(initialNodes);
8927
+ const [edges, setEdges, onEdgesChange] = (0, import_react72.useEdgesState)(initialEdges);
8928
+ const { fitView, getNodes } = (0, import_react72.useReactFlow)();
8929
+ (0, import_react71.useEffect)(() => {
8714
8930
  setNodes(initialNodes);
8715
8931
  setEdges(initialEdges);
8716
8932
  requestAnimationFrame(() => {
8717
8933
  fitView({ duration: 300, padding: 0.2 });
8718
8934
  });
8719
8935
  }, [initialNodes, initialEdges, setNodes, setEdges, fitView]);
8720
- const [animateMessages, setAnimateMessages] = (0, import_react69.useState)(true);
8721
- const [_activeStepIndex, _setActiveStepIndex] = (0, import_react69.useState)(null);
8722
- const [_isFullscreen, _setIsFullscreen] = (0, import_react69.useState)(false);
8723
- const [isShareModalOpen, setIsShareModalOpen] = (0, import_react69.useState)(false);
8724
- const [shareUrlCopySuccess, setShareUrlCopySuccess] = (0, import_react69.useState)(false);
8725
- const [isMermaidView, setIsMermaidView] = (0, import_react69.useState)(false);
8726
- const [showMinimap, setShowMinimap] = (0, import_react69.useState)(false);
8727
- const [hasLayoutChanges, setHasLayoutChanges] = (0, import_react69.useState)(false);
8728
- const [isSavingLayout, setIsSavingLayout] = (0, import_react69.useState)(false);
8729
- const initialPositionsRef = (0, import_react69.useRef)(
8936
+ const [animateMessages, setAnimateMessages] = (0, import_react71.useState)(true);
8937
+ const [_activeStepIndex, _setActiveStepIndex] = (0, import_react71.useState)(null);
8938
+ const [_isFullscreen, _setIsFullscreen] = (0, import_react71.useState)(false);
8939
+ const [isShareModalOpen, setIsShareModalOpen] = (0, import_react71.useState)(false);
8940
+ const [shareUrlCopySuccess, setShareUrlCopySuccess] = (0, import_react71.useState)(false);
8941
+ const [isMermaidView, setIsMermaidView] = (0, import_react71.useState)(false);
8942
+ const [showMinimap, setShowMinimap] = (0, import_react71.useState)(false);
8943
+ const [hasLayoutChanges, setHasLayoutChanges] = (0, import_react71.useState)(false);
8944
+ const [isSavingLayout, setIsSavingLayout] = (0, import_react71.useState)(false);
8945
+ const initialPositionsRef = (0, import_react71.useRef)(
8730
8946
  {}
8731
8947
  );
8732
- const [focusModeOpen, setFocusModeOpen] = (0, import_react69.useState)(false);
8733
- const [focusedNodeId, setFocusedNodeId] = (0, import_react69.useState)(null);
8734
- const [isNotesModalOpen, setIsNotesModalOpen] = (0, import_react69.useState)(false);
8735
- const openNotesModal = (0, import_react69.useCallback)(() => setIsNotesModalOpen(true), []);
8736
- const interactionCountRef = (0, import_react69.useRef)(0);
8737
- const startInteraction = (0, import_react69.useCallback)(() => {
8948
+ const [focusModeOpen, setFocusModeOpen] = (0, import_react71.useState)(false);
8949
+ const [focusedNodeId, setFocusedNodeId] = (0, import_react71.useState)(null);
8950
+ const [isNotesModalOpen, setIsNotesModalOpen] = (0, import_react71.useState)(false);
8951
+ const openNotesModal = (0, import_react71.useCallback)(() => setIsNotesModalOpen(true), []);
8952
+ const interactionCountRef = (0, import_react71.useRef)(0);
8953
+ const startInteraction = (0, import_react71.useCallback)(() => {
8738
8954
  interactionCountRef.current += 1;
8739
8955
  if (interactionCountRef.current === 1) {
8740
8956
  reactFlowWrapperRef.current?.classList.add("ec-interaction-active");
8741
8957
  }
8742
8958
  }, []);
8743
- const endInteraction = (0, import_react69.useCallback)(() => {
8959
+ const endInteraction = (0, import_react71.useCallback)(() => {
8744
8960
  interactionCountRef.current = Math.max(0, interactionCountRef.current - 1);
8745
8961
  if (interactionCountRef.current === 0) {
8746
8962
  reactFlowWrapperRef.current?.classList.remove("ec-interaction-active");
8747
8963
  }
8748
8964
  }, []);
8749
- const hoveredEdgeNodesRef = (0, import_react69.useRef)([]);
8750
- const handleEdgeMouseEnter = (0, import_react69.useCallback)(
8965
+ const hoveredEdgeNodesRef = (0, import_react71.useRef)([]);
8966
+ const handleEdgeMouseEnter = (0, import_react71.useCallback)(
8751
8967
  (_, edge) => {
8752
8968
  const wrapper = reactFlowWrapperRef.current;
8753
8969
  if (!wrapper) return;
@@ -8759,15 +8975,15 @@ var NodeGraphBuilder = ({
8759
8975
  },
8760
8976
  []
8761
8977
  );
8762
- const handleEdgeMouseLeave = (0, import_react69.useCallback)(() => {
8978
+ const handleEdgeMouseLeave = (0, import_react71.useCallback)(() => {
8763
8979
  hoveredEdgeNodesRef.current.forEach(
8764
8980
  (el) => el.classList.remove("ec-edge-hover-node")
8765
8981
  );
8766
8982
  hoveredEdgeNodesRef.current = [];
8767
8983
  }, []);
8768
- const hoveredNodeEdgesRef = (0, import_react69.useRef)([]);
8769
- const hoveredNodePeersRef = (0, import_react69.useRef)([]);
8770
- const handleNodeMouseEnter = (0, import_react69.useCallback)(
8984
+ const hoveredNodeEdgesRef = (0, import_react71.useRef)([]);
8985
+ const hoveredNodePeersRef = (0, import_react71.useRef)([]);
8986
+ const handleNodeMouseEnter = (0, import_react71.useCallback)(
8771
8987
  (_, node) => {
8772
8988
  const wrapper = reactFlowWrapperRef.current;
8773
8989
  if (!wrapper) return;
@@ -8796,7 +9012,7 @@ var NodeGraphBuilder = ({
8796
9012
  },
8797
9013
  []
8798
9014
  );
8799
- const handleNodeMouseLeave = (0, import_react69.useCallback)(() => {
9015
+ const handleNodeMouseLeave = (0, import_react71.useCallback)(() => {
8800
9016
  hoveredNodeEdgesRef.current.forEach(
8801
9017
  (el) => el.classList.remove("ec-node-hover-edge")
8802
9018
  );
@@ -8806,21 +9022,25 @@ var NodeGraphBuilder = ({
8806
9022
  );
8807
9023
  hoveredNodePeersRef.current = [];
8808
9024
  }, []);
8809
- const hasChannels = (0, import_react69.useMemo)(
9025
+ const hasChannels = (0, import_react71.useMemo)(
8810
9026
  () => initialNodes.some((node) => node.type === "channels"),
8811
9027
  [initialNodes]
8812
9028
  );
8813
- const hideChannels = false;
8814
- const toggleChannelsVisibility = () => {
8815
- };
8816
- const searchRef = (0, import_react69.useRef)(null);
8817
- const reactFlowWrapperRef = (0, import_react69.useRef)(null);
8818
- const scrollableContainerRef = (0, import_react69.useRef)(null);
8819
- const nodesRef = (0, import_react69.useRef)(nodes);
9029
+ const { hideChannels, toggleChannelsVisibility } = useChannelVisibility({
9030
+ nodes,
9031
+ edges,
9032
+ setNodes,
9033
+ setEdges,
9034
+ skipProcessing: !hasChannels
9035
+ });
9036
+ const searchRef = (0, import_react71.useRef)(null);
9037
+ const reactFlowWrapperRef = (0, import_react71.useRef)(null);
9038
+ const scrollableContainerRef = (0, import_react71.useRef)(null);
9039
+ const nodesRef = (0, import_react71.useRef)(nodes);
8820
9040
  nodesRef.current = nodes;
8821
- const edgesRef = (0, import_react69.useRef)(edges);
9041
+ const edgesRef = (0, import_react71.useRef)(edges);
8822
9042
  edgesRef.current = edges;
8823
- (0, import_react69.useEffect)(() => {
9043
+ (0, import_react71.useEffect)(() => {
8824
9044
  if (isDevMode && initialNodes.length > 0) {
8825
9045
  const positions = {};
8826
9046
  initialNodes.forEach((node) => {
@@ -8829,7 +9049,7 @@ var NodeGraphBuilder = ({
8829
9049
  initialPositionsRef.current = positions;
8830
9050
  }
8831
9051
  }, [isDevMode, initialNodes]);
8832
- const checkForLayoutChanges = (0, import_react69.useCallback)(() => {
9052
+ const checkForLayoutChanges = (0, import_react71.useCallback)(() => {
8833
9053
  if (!isDevMode) return;
8834
9054
  const initial = initialPositionsRef.current;
8835
9055
  if (Object.keys(initial).length === 0) return;
@@ -8839,7 +9059,7 @@ var NodeGraphBuilder = ({
8839
9059
  });
8840
9060
  setHasLayoutChanges(hasChanges);
8841
9061
  }, [isDevMode]);
8842
- const handleNodesChange = (0, import_react69.useCallback)(
9062
+ const handleNodesChange = (0, import_react71.useCallback)(
8843
9063
  (changes) => {
8844
9064
  onNodesChange(changes);
8845
9065
  const hasDragEnd = changes.some(
@@ -8851,7 +9071,7 @@ var NodeGraphBuilder = ({
8851
9071
  },
8852
9072
  [onNodesChange, checkForLayoutChanges]
8853
9073
  );
8854
- const resetNodesAndEdges = (0, import_react69.useCallback)(() => {
9074
+ const resetNodesAndEdges = (0, import_react71.useCallback)(() => {
8855
9075
  setNodes(
8856
9076
  (nds) => nds.map((node) => {
8857
9077
  node.style = { ...node.style, opacity: 1 };
@@ -8870,7 +9090,7 @@ var NodeGraphBuilder = ({
8870
9090
  })
8871
9091
  );
8872
9092
  }, [setNodes, setEdges, animateMessages]);
8873
- (0, import_react69.useEffect)(() => {
9093
+ (0, import_react71.useEffect)(() => {
8874
9094
  if (!focusNodeId) return;
8875
9095
  const targetNode = nodesRef.current.find((node) => node.id === focusNodeId);
8876
9096
  if (!targetNode) return;
@@ -8888,13 +9108,13 @@ var NodeGraphBuilder = ({
8888
9108
  });
8889
9109
  });
8890
9110
  }, [focusNodeId, focusRequestId, fitView, setNodes]);
8891
- (0, import_react69.useEffect)(() => {
9111
+ (0, import_react71.useEffect)(() => {
8892
9112
  if (fitRequestId == null) return;
8893
9113
  requestAnimationFrame(() => {
8894
9114
  fitView({ duration: 400, padding: 0.2 });
8895
9115
  });
8896
9116
  }, [fitRequestId, fitView]);
8897
- const handleNodeClick = (0, import_react69.useCallback)(
9117
+ const handleNodeClick = (0, import_react71.useCallback)(
8898
9118
  (_, node) => {
8899
9119
  if (onNodeClick) {
8900
9120
  onNodeClick(node);
@@ -8916,7 +9136,7 @@ var NodeGraphBuilder = ({
8916
9136
  },
8917
9137
  [onNodeClick, linksToVisualiser, onNavigate]
8918
9138
  );
8919
- const toggleAnimateMessages = (0, import_react69.useCallback)(() => {
9139
+ const toggleAnimateMessages = (0, import_react71.useCallback)(() => {
8920
9140
  setAnimateMessages((prev) => {
8921
9141
  const next = !prev;
8922
9142
  localStorage.setItem(
@@ -8926,10 +9146,10 @@ var NodeGraphBuilder = ({
8926
9146
  return next;
8927
9147
  });
8928
9148
  }, []);
8929
- const handleFitView = (0, import_react69.useCallback)(() => {
9149
+ const handleFitView = (0, import_react71.useCallback)(() => {
8930
9150
  fitView({ duration: 400, padding: 0.2 });
8931
9151
  }, [fitView]);
8932
- (0, import_react69.useEffect)(() => {
9152
+ (0, import_react71.useEffect)(() => {
8933
9153
  if (animated !== void 0) {
8934
9154
  setAnimateMessages(animated);
8935
9155
  return;
@@ -8949,7 +9169,7 @@ var NodeGraphBuilder = ({
8949
9169
  }
8950
9170
  }
8951
9171
  }, [animated]);
8952
- (0, import_react69.useEffect)(() => {
9172
+ (0, import_react71.useEffect)(() => {
8953
9173
  setEdges(
8954
9174
  (eds) => eds.map((edge) => ({
8955
9175
  ...edge,
@@ -8959,12 +9179,12 @@ var NodeGraphBuilder = ({
8959
9179
  }))
8960
9180
  );
8961
9181
  }, [animateMessages]);
8962
- (0, import_react69.useEffect)(() => {
9182
+ (0, import_react71.useEffect)(() => {
8963
9183
  setTimeout(() => {
8964
9184
  fitView({ duration: 800 });
8965
9185
  }, 150);
8966
9186
  }, []);
8967
- const generateMermaidCode = (0, import_react69.useCallback)(() => {
9187
+ const generateMermaidCode = (0, import_react71.useCallback)(() => {
8968
9188
  try {
8969
9189
  return convertToMermaid(nodesRef.current, edgesRef.current, {
8970
9190
  includeStyles: true,
@@ -8975,7 +9195,7 @@ var NodeGraphBuilder = ({
8975
9195
  return "";
8976
9196
  }
8977
9197
  }, []);
8978
- (0, import_react69.useEffect)(() => {
9198
+ (0, import_react71.useEffect)(() => {
8979
9199
  if (zoomOnScroll) return;
8980
9200
  const findScrollableContainer = () => {
8981
9201
  const selectors = [
@@ -9020,34 +9240,34 @@ var NodeGraphBuilder = ({
9020
9240
  };
9021
9241
  }
9022
9242
  }, [zoomOnScroll]);
9023
- const handlePaneClick = (0, import_react69.useCallback)(() => {
9243
+ const handlePaneClick = (0, import_react71.useCallback)(() => {
9024
9244
  searchRef.current?.hideSuggestions();
9025
9245
  resetNodesAndEdges();
9026
9246
  fitView({ duration: 800 });
9027
9247
  }, [resetNodesAndEdges, fitView]);
9028
- const handleNodeSelect = (0, import_react69.useCallback)(
9248
+ const handleNodeSelect = (0, import_react71.useCallback)(
9029
9249
  (node) => {
9030
9250
  handleNodeClick(null, node);
9031
9251
  },
9032
9252
  [handleNodeClick]
9033
9253
  );
9034
- const handleSearchClear = (0, import_react69.useCallback)(() => {
9254
+ const handleSearchClear = (0, import_react71.useCallback)(() => {
9035
9255
  resetNodesAndEdges();
9036
9256
  fitView({ duration: 800 });
9037
9257
  }, [resetNodesAndEdges, fitView]);
9038
- const downloadImage = (0, import_react69.useCallback)((dataUrl, filename) => {
9258
+ const downloadImage = (0, import_react71.useCallback)((dataUrl, filename) => {
9039
9259
  const a = document.createElement("a");
9040
9260
  a.setAttribute("download", `${filename || "eventcatalog"}.png`);
9041
9261
  a.setAttribute("href", dataUrl);
9042
9262
  a.click();
9043
9263
  }, []);
9044
- const openStudioModal = (0, import_react69.useCallback)(() => {
9264
+ const openStudioModal = (0, import_react71.useCallback)(() => {
9045
9265
  setIsStudioModalOpen(true);
9046
9266
  }, [setIsStudioModalOpen]);
9047
- const openChat = (0, import_react69.useCallback)(() => {
9267
+ const openChat = (0, import_react71.useCallback)(() => {
9048
9268
  window.dispatchEvent(new CustomEvent("eventcatalog:open-chat"));
9049
9269
  }, []);
9050
- const handleSaveLayout = (0, import_react69.useCallback)(async () => {
9270
+ const handleSaveLayout = (0, import_react71.useCallback)(async () => {
9051
9271
  if (!resourceKey || !onSaveLayout) return false;
9052
9272
  const positions = {};
9053
9273
  nodesRef.current.forEach((node) => {
@@ -9058,11 +9278,11 @@ var NodeGraphBuilder = ({
9058
9278
  });
9059
9279
  return await onSaveLayout(resourceKey, positions);
9060
9280
  }, [resourceKey, onSaveLayout]);
9061
- const handleResetLayout = (0, import_react69.useCallback)(async () => {
9281
+ const handleResetLayout = (0, import_react71.useCallback)(async () => {
9062
9282
  if (!resourceKey || !onResetLayout) return false;
9063
9283
  return await onResetLayout(resourceKey);
9064
9284
  }, [resourceKey, onResetLayout]);
9065
- const handleQuickSaveLayout = (0, import_react69.useCallback)(async () => {
9285
+ const handleQuickSaveLayout = (0, import_react71.useCallback)(async () => {
9066
9286
  setIsSavingLayout(true);
9067
9287
  const success = await handleSaveLayout();
9068
9288
  setIsSavingLayout(false);
@@ -9075,17 +9295,17 @@ var NodeGraphBuilder = ({
9075
9295
  setHasLayoutChanges(false);
9076
9296
  }
9077
9297
  }, [handleSaveLayout]);
9078
- const handleCopyArchitectureCode = (0, import_react69.useCallback)(async () => {
9298
+ const handleCopyArchitectureCode = (0, import_react71.useCallback)(async () => {
9079
9299
  const code = generateMermaidCode();
9080
9300
  await copyToClipboard(code);
9081
9301
  }, [generateMermaidCode]);
9082
- const handleCopyShareUrl = (0, import_react69.useCallback)(async () => {
9302
+ const handleCopyShareUrl = (0, import_react71.useCallback)(async () => {
9083
9303
  const url = typeof window !== "undefined" ? window.location.href : "";
9084
9304
  await copyToClipboard(url);
9085
9305
  setShareUrlCopySuccess(true);
9086
9306
  setTimeout(() => setShareUrlCopySuccess(false), 2e3);
9087
9307
  }, []);
9088
- const toggleFullScreen = (0, import_react69.useCallback)(() => {
9308
+ const toggleFullScreen = (0, import_react71.useCallback)(() => {
9089
9309
  if (!document.fullscreenElement) {
9090
9310
  reactFlowWrapperRef.current?.requestFullscreen().catch((err) => {
9091
9311
  console.error(
@@ -9096,7 +9316,7 @@ var NodeGraphBuilder = ({
9096
9316
  document.exitFullscreen();
9097
9317
  }
9098
9318
  }, []);
9099
- (0, import_react69.useEffect)(() => {
9319
+ (0, import_react71.useEffect)(() => {
9100
9320
  const handleFullscreenChange = () => {
9101
9321
  _setIsFullscreen(!!document.fullscreenElement);
9102
9322
  setTimeout(() => {
@@ -9108,13 +9328,13 @@ var NodeGraphBuilder = ({
9108
9328
  document.removeEventListener("fullscreenchange", handleFullscreenChange);
9109
9329
  };
9110
9330
  }, [fitView]);
9111
- const handleExportVisual = (0, import_react69.useCallback)(() => {
9331
+ const handleExportVisual = (0, import_react71.useCallback)(() => {
9112
9332
  const imageWidth = 1024;
9113
9333
  const imageHeight = 768;
9114
- const nodesBounds = (0, import_react70.getNodesBounds)(getNodes());
9334
+ const nodesBounds = (0, import_react72.getNodesBounds)(getNodes());
9115
9335
  const width = imageWidth > nodesBounds.width ? imageWidth : nodesBounds.width;
9116
9336
  const height = imageHeight > nodesBounds.height ? imageHeight : nodesBounds.height;
9117
- const viewport = (0, import_react70.getViewportForBounds)(
9337
+ const viewport = (0, import_react72.getViewportForBounds)(
9118
9338
  nodesBounds,
9119
9339
  width,
9120
9340
  height,
@@ -9140,7 +9360,7 @@ var NodeGraphBuilder = ({
9140
9360
  if (controls) controls.style.display = "block";
9141
9361
  });
9142
9362
  }, [getNodes, downloadImage, title]);
9143
- const handleLegendClick = (0, import_react69.useCallback)(
9363
+ const handleLegendClick = (0, import_react71.useCallback)(
9144
9364
  (collectionType, groupId) => {
9145
9365
  const updatedNodes = nodes.map((node) => {
9146
9366
  if (groupId && node.data.group && node.data.group?.id === groupId) {
@@ -9171,7 +9391,7 @@ var NodeGraphBuilder = ({
9171
9391
  },
9172
9392
  [nodes, edges, setNodes, setEdges, fitView]
9173
9393
  );
9174
- const getNodesByCollectionWithColors = (0, import_react69.useCallback)((nodes2) => {
9394
+ const getNodesByCollectionWithColors = (0, import_react71.useCallback)((nodes2) => {
9175
9395
  const colorClasses = {
9176
9396
  events: "bg-orange-600",
9177
9397
  services: "bg-pink-600",
@@ -9222,24 +9442,24 @@ var NodeGraphBuilder = ({
9222
9442
  );
9223
9443
  return { ...legendForDomains, ...legendForNodes };
9224
9444
  }, []);
9225
- const legendKeyRef = (0, import_react69.useRef)("");
9445
+ const legendKeyRef = (0, import_react71.useRef)("");
9226
9446
  const computedLegendKey = nodes.map((n) => `${n.id}:${n.type}:${n.data.group?.id || ""}`).join(",");
9227
9447
  if (computedLegendKey !== legendKeyRef.current) {
9228
9448
  legendKeyRef.current = computedLegendKey;
9229
9449
  }
9230
9450
  const legendKey = legendKeyRef.current;
9231
- const legend = (0, import_react69.useMemo)(
9451
+ const legend = (0, import_react71.useMemo)(
9232
9452
  () => getNodesByCollectionWithColors(nodes),
9233
9453
  [getNodesByCollectionWithColors, legendKey]
9234
9454
  );
9235
- const nodeIdsKeyRef = (0, import_react69.useRef)("");
9455
+ const nodeIdsKeyRef = (0, import_react71.useRef)("");
9236
9456
  const computedNodeIdsKey = nodes.map((n) => n.id).join(",");
9237
9457
  if (computedNodeIdsKey !== nodeIdsKeyRef.current) {
9238
9458
  nodeIdsKeyRef.current = computedNodeIdsKey;
9239
9459
  }
9240
9460
  const nodeIdsKey = nodeIdsKeyRef.current;
9241
- const searchNodes = (0, import_react69.useMemo)(() => nodes, [nodeIdsKey]);
9242
- const allNoteGroups = (0, import_react69.useMemo)(() => {
9461
+ const searchNodes = (0, import_react71.useMemo)(() => nodes, [nodeIdsKey]);
9462
+ const allNoteGroups = (0, import_react71.useMemo)(() => {
9243
9463
  const groups = [];
9244
9464
  for (const node of nodes) {
9245
9465
  const result = getNotesFromNode(node);
@@ -9254,11 +9474,11 @@ var NodeGraphBuilder = ({
9254
9474
  }
9255
9475
  return groups;
9256
9476
  }, [nodeIdsKey]);
9257
- const totalNotesCount = (0, import_react69.useMemo)(
9477
+ const totalNotesCount = (0, import_react71.useMemo)(
9258
9478
  () => allNoteGroups.reduce((sum, g) => sum + g.notes.length, 0),
9259
9479
  [allNoteGroups]
9260
9480
  );
9261
- const handleStepChange = (0, import_react69.useCallback)(
9481
+ const handleStepChange = (0, import_react71.useCallback)(
9262
9482
  (nodeId, highlightPaths, shouldZoomOut) => {
9263
9483
  if (nodeId === null) {
9264
9484
  resetNodesAndEdges();
@@ -9333,7 +9553,7 @@ var NodeGraphBuilder = ({
9333
9553
  },
9334
9554
  [nodes, edges, setNodes, setEdges, resetNodesAndEdges, fitView]
9335
9555
  );
9336
- const isFlowVisualization = (0, import_react69.useMemo)(
9556
+ const isFlowVisualization = (0, import_react71.useMemo)(
9337
9557
  () => edges.some((edge) => edge.type === "flow-edge"),
9338
9558
  [edges]
9339
9559
  );
@@ -9421,7 +9641,7 @@ var NodeGraphBuilder = ({
9421
9641
  }
9422
9642
  ) })
9423
9643
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
9424
- import_react70.ReactFlow,
9644
+ import_react72.ReactFlow,
9425
9645
  {
9426
9646
  nodeTypes,
9427
9647
  edgeTypes: edgeTypes2,
@@ -9433,7 +9653,7 @@ var NodeGraphBuilder = ({
9433
9653
  onEdgesChange,
9434
9654
  onEdgeMouseEnter: handleEdgeMouseEnter,
9435
9655
  onEdgeMouseLeave: handleEdgeMouseLeave,
9436
- connectionLineType: import_react70.ConnectionLineType.SmoothStep,
9656
+ connectionLineType: import_react72.ConnectionLineType.SmoothStep,
9437
9657
  nodeOrigin: NODE_ORIGIN,
9438
9658
  onNodeClick: handleNodeClick,
9439
9659
  onNodeMouseEnter: handleNodeMouseEnter,
@@ -9447,7 +9667,7 @@ var NodeGraphBuilder = ({
9447
9667
  className: "relative",
9448
9668
  children: [
9449
9669
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
9450
- import_react70.Panel,
9670
+ import_react72.Panel,
9451
9671
  {
9452
9672
  position: "top-center",
9453
9673
  className: "w-full pr-6 pointer-events-none",
@@ -9564,10 +9784,10 @@ var NodeGraphBuilder = ({
9564
9784
  ]
9565
9785
  }
9566
9786
  ),
9567
- includeBackground && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react70.Background, { color: "var(--ec-bg-dots)", gap: 16 }),
9568
- includeBackground && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react70.Controls, {}),
9787
+ includeBackground && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react72.Background, { color: "var(--ec-bg-dots)", gap: 16 }),
9788
+ includeBackground && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react72.Controls, {}),
9569
9789
  showMinimap && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9570
- import_react70.MiniMap,
9790
+ import_react72.MiniMap,
9571
9791
  {
9572
9792
  nodeStrokeWidth: 3,
9573
9793
  zoomable: true,
@@ -9575,7 +9795,7 @@ var NodeGraphBuilder = ({
9575
9795
  style: MINIMAP_STYLE
9576
9796
  }
9577
9797
  ),
9578
- isFlowVisualization && showFlowWalkthrough && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react70.Panel, { position: "bottom-left", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9798
+ isFlowVisualization && showFlowWalkthrough && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react72.Panel, { position: "bottom-left", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9579
9799
  StepWalkthrough_default,
9580
9800
  {
9581
9801
  nodes,
@@ -9586,7 +9806,7 @@ var NodeGraphBuilder = ({
9586
9806
  }
9587
9807
  ) }),
9588
9808
  isDevMode && hasLayoutChanges && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9589
- import_react70.Panel,
9809
+ import_react72.Panel,
9590
9810
  {
9591
9811
  position: "bottom-left",
9592
9812
  style: isFlowVisualization && showFlowWalkthrough ? LAYOUT_CHANGE_PANEL_STYLE_WITH_WALKTHROUGH : LAYOUT_CHANGE_PANEL_STYLE_DEFAULT,
@@ -9745,7 +9965,7 @@ var NodeGraph = ({
9745
9965
  onSaveLayout,
9746
9966
  onResetLayout
9747
9967
  }) => {
9748
- const graphLayout = (0, import_react69.useMemo)(() => {
9968
+ const graphLayout = (0, import_react71.useMemo)(() => {
9749
9969
  if (!graph) return null;
9750
9970
  return layoutGraph(
9751
9971
  graph.nodes,
@@ -9760,17 +9980,17 @@ var NodeGraph = ({
9760
9980
  const includeKey = includeKeyProp !== void 0 ? includeKeyProp : graph?.options?.legend !== false;
9761
9981
  const showSearch = showSearchProp !== void 0 ? showSearchProp : graph?.options?.search !== false;
9762
9982
  const animated = animatedProp ?? graph?.options?.animated;
9763
- const [elem, setElem] = (0, import_react69.useState)(null);
9764
- const [showFooter, setShowFooter] = (0, import_react69.useState)(true);
9765
- const [isStudioModalOpen, setIsStudioModalOpen] = (0, import_react69.useState)(false);
9766
- const openStudioModal = (0, import_react69.useCallback)(() => {
9983
+ const [elem, setElem] = (0, import_react71.useState)(null);
9984
+ const [showFooter, setShowFooter] = (0, import_react71.useState)(true);
9985
+ const [isStudioModalOpen, setIsStudioModalOpen] = (0, import_react71.useState)(false);
9986
+ const openStudioModal = (0, import_react71.useCallback)(() => {
9767
9987
  setIsStudioModalOpen(true);
9768
9988
  }, []);
9769
9989
  const containerToRenderInto = portalId || `${id}-portal`;
9770
- (0, import_react69.useEffect)(() => {
9990
+ (0, import_react71.useEffect)(() => {
9771
9991
  setElem(document.getElementById(containerToRenderInto));
9772
9992
  }, []);
9773
- (0, import_react69.useEffect)(() => {
9993
+ (0, import_react71.useEffect)(() => {
9774
9994
  const urlParams = new URLSearchParams(window.location.search);
9775
9995
  const embed = urlParams.get("embed");
9776
9996
  if (embed === "true") {
@@ -9779,7 +9999,7 @@ var NodeGraph = ({
9779
9999
  }, []);
9780
10000
  if (!elem) return null;
9781
10001
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: (0, import_react_dom.createPortal)(
9782
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react70.ReactFlowProvider, { children: [
10002
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react72.ReactFlowProvider, { children: [
9783
10003
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
9784
10004
  NodeGraphBuilder,
9785
10005
  {
@@ -9871,121 +10091,6 @@ var edgeTypes = {
9871
10091
  "flow-edge": FlowEdge_default,
9872
10092
  multiline: MultilineEdgeLabel_default
9873
10093
  };
9874
-
9875
- // src/utils/utils/utils.ts
9876
- var import_react71 = require("@xyflow/react");
9877
- var import_dagre2 = __toESM(require("dagre"));
9878
- var generateIdForNode = (node) => {
9879
- return `${node.data.id}-${node.data.version}`;
9880
- };
9881
- var generateIdForNodes = (nodes) => {
9882
- return nodes.map((node) => `${node.data.id}-${node.data.version}`).join("-");
9883
- };
9884
- var generatedIdForEdge = (source, target) => {
9885
- return `${source.data.id}-${source.data.version}-${target.data.id}-${target.data.version}`;
9886
- };
9887
- var getColorFromString = (id) => {
9888
- let hash = 0;
9889
- for (let i = 0; i < id.length; i++) {
9890
- hash = id.charCodeAt(i) + ((hash << 5) - hash);
9891
- }
9892
- let color = "#";
9893
- for (let i = 0; i < 3; i++) {
9894
- const value = hash >> i * 8 & 255;
9895
- color += value.toString(16).padStart(2, "0");
9896
- }
9897
- return color;
9898
- };
9899
- var getEdgeLabelForServiceAsTarget = (data) => {
9900
- const type = data.collection;
9901
- switch (type) {
9902
- case "commands":
9903
- return "invokes";
9904
- case "events":
9905
- return "publishes \nevent";
9906
- case "queries":
9907
- return "requests";
9908
- default:
9909
- return "sends to";
9910
- }
9911
- };
9912
- var getEdgeLabelForMessageAsSource = (data, throughChannel = false) => {
9913
- const type = data.collection;
9914
- switch (type) {
9915
- case "commands":
9916
- return "accepts";
9917
- case "events":
9918
- return throughChannel ? "subscribed to" : "subscribed by";
9919
- case "queries":
9920
- return "accepts";
9921
- default:
9922
- return "sends to";
9923
- }
9924
- };
9925
- var calculatedNodes = (flow, nodes) => {
9926
- return nodes.map((node) => {
9927
- const { x, y } = flow.node(node.id);
9928
- return { ...node, position: { x, y } };
9929
- });
9930
- };
9931
- var createDagreGraph = ({
9932
- ranksep = 180,
9933
- nodesep = 50,
9934
- ...rest
9935
- }) => {
9936
- const graph = new import_dagre2.default.graphlib.Graph({ compound: true });
9937
- graph.setGraph({ rankdir: "LR", ranksep, nodesep, ...rest });
9938
- graph.setDefaultEdgeLabel(() => ({}));
9939
- return graph;
9940
- };
9941
- var createEdge = (edgeOptions) => {
9942
- return {
9943
- label: "subscribed by",
9944
- animated: false,
9945
- // markerStart: {
9946
- // type: MarkerType.Arrow,
9947
- // width: 40,
9948
- // height: 40,
9949
- // },
9950
- markerEnd: {
9951
- type: import_react71.MarkerType.ArrowClosed,
9952
- width: 40,
9953
- height: 40,
9954
- color: "rgb(var(--ec-page-text-muted))"
9955
- },
9956
- style: {
9957
- strokeWidth: 1.5,
9958
- stroke: "rgb(var(--ec-page-text-muted))",
9959
- strokeDasharray: "5 5"
9960
- },
9961
- ...edgeOptions
9962
- };
9963
- };
9964
- var createNode = (values) => {
9965
- return {
9966
- sourcePosition: import_react71.Position.Right,
9967
- targetPosition: import_react71.Position.Left,
9968
- ...values
9969
- };
9970
- };
9971
- var getNodesAndEdgesFromDagre = ({
9972
- nodes,
9973
- edges,
9974
- defaultFlow
9975
- }) => {
9976
- const flow = defaultFlow || createDagreGraph({ ranksep: 300, nodesep: 50 });
9977
- nodes.forEach((node) => {
9978
- flow.setNode(node.id, { width: 150, height: 100 });
9979
- });
9980
- edges.forEach((edge) => {
9981
- flow.setEdge(edge.source, edge.target);
9982
- });
9983
- import_dagre2.default.layout(flow);
9984
- return {
9985
- nodes: calculatedNodes(flow, nodes),
9986
- edges
9987
- };
9988
- };
9989
10094
  // Annotate the CommonJS export names for ESM import in node:
9990
10095
  0 && (module.exports = {
9991
10096
  ACTOR,