"use client";
import e from "../../../../classcat/index.js";
import { ConnectionLineType as t, ConnectionMode as n, MarkerType as r, PanOnScrollMode as i, Position as a, ResizeControlVariant as o, SelectionMode as s, XYDrag as c, XYHandle as l, XYMinimap as u, XYPanZoom as d, XYResizer as f, addEdge as p, adoptUserNodes as m, areSetsEqual as h, calculateNodePosition as g, createMarkerIds as _, defaultAriaLabelConfig as v, devWarn as y, elementSelectionKeys as b, errorMessages as x, evaluateAbsolutePosition as S, fitViewport as C, getBezierEdgeCenter as w, getBezierPath as T, getBoundsOfRects as E, getConnectionStatus as D, getDimensions as O, getEdgePosition as k, getElementsToRemove as A, getElevatedEdgeZIndex as j, getEventPosition as M, getHandlePosition as N, getHostForElement as P, getInternalNodesBounds as F, getMarkerId as ee, getNodeDimensions as I, getNodesBounds as L, getNodesInside as R, getOverlappingArea as z, getSmoothStepPath as B, getStraightPath as V, getViewportForBounds as H, handleExpandParent as te, infiniteExtent as ne, initialConnection as re, isEdgeBase as ie, isEdgeVisible as ae, isInputDOMNode as oe, isMacOs as se, isMouseEvent as ce, isNodeBase as le, isNumeric as ue, isRectObject as de, mergeAriaLabelConfig as fe, nodeHasDimensions as pe, nodeToRect as me, panBy as he, pointToRendererPoint as ge, rendererPointToPoint as _e, snapPosition as ve, updateAbsolutePositions as ye, updateConnectionLookup as be, updateNodeInternals as xe, withResolvers as Se } from "../../../system/dist/esm/index.js";
import { createContext as Ce, forwardRef as we, memo as U, useCallback as W, useContext as Te, useEffect as G, useLayoutEffect as Ee, useMemo as K, useRef as q, useState as J } from "react";
import { Fragment as De, jsx as Y, jsxs as X } from "react/jsx-runtime";
import { createPortal as Oe } from "react-dom";
import { createWithEqualityFn as ke, useStoreWithEqualityFn as Ae } from "zustand/traditional";
import { shallow as Z } from "zustand/shallow";
//#region ../../node_modules/@xyflow/react/dist/esm/index.js
var je = Ce(null), Me = je.Provider, Ne = x.error001();
function Q(e, t) {
	let n = Te(je);
	if (n === null) throw Error(Ne);
	return Ae(n, e, t);
}
function $() {
	let e = Te(je);
	if (e === null) throw Error(Ne);
	return K(() => ({
		getState: e.getState,
		setState: e.setState,
		subscribe: e.subscribe
	}), [e]);
}
var Pe = { display: "none" }, Fe = {
	position: "absolute",
	width: 1,
	height: 1,
	margin: -1,
	border: 0,
	padding: 0,
	overflow: "hidden",
	clip: "rect(0px, 0px, 0px, 0px)",
	clipPath: "inset(100%)"
}, Ie = "react-flow__node-desc", Le = "react-flow__edge-desc", Re = "react-flow__aria-live", ze = (e) => e.ariaLiveMessage, Be = (e) => e.ariaLabelConfig;
function Ve({ rfId: e }) {
	let t = Q(ze);
	return Y("div", {
		id: `${Re}-${e}`,
		"aria-live": "assertive",
		"aria-atomic": "true",
		style: Fe,
		children: t
	});
}
function He({ rfId: e, disableKeyboardA11y: t }) {
	let n = Q(Be);
	return X(De, { children: [
		Y("div", {
			id: `${Ie}-${e}`,
			style: Pe,
			children: t ? n["node.a11yDescription.default"] : n["node.a11yDescription.keyboardDisabled"]
		}),
		Y("div", {
			id: `${Le}-${e}`,
			style: Pe,
			children: n["edge.a11yDescription.default"]
		}),
		!t && Y(Ve, { rfId: e })
	] });
}
var Ue = we(({ position: t = "top-left", children: n, className: r, style: i, ...a }, o) => Y("div", {
	className: e([
		"react-flow__panel",
		r,
		...`${t}`.split("-")
	]),
	style: i,
	ref: o,
	...a,
	children: n
}));
Ue.displayName = "Panel";
function We({ proOptions: e, position: t = "bottom-right" }) {
	return e?.hideAttribution ? null : Y(Ue, {
		position: t,
		className: "react-flow__attribution",
		"data-message": "Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",
		children: Y("a", {
			href: "https://reactflow.dev",
			target: "_blank",
			rel: "noopener noreferrer",
			"aria-label": "React Flow attribution",
			children: "React Flow"
		})
	});
}
var Ge = (e) => {
	let t = [], n = [];
	for (let [, n] of e.nodeLookup) n.selected && t.push(n.internals.userNode);
	for (let [, t] of e.edgeLookup) t.selected && n.push(t);
	return {
		selectedNodes: t,
		selectedEdges: n
	};
}, Ke = (e) => e.id;
function qe(e, t) {
	return Z(e.selectedNodes.map(Ke), t.selectedNodes.map(Ke)) && Z(e.selectedEdges.map(Ke), t.selectedEdges.map(Ke));
}
function Je({ onSelectionChange: e }) {
	let t = $(), { selectedNodes: n, selectedEdges: r } = Q(Ge, qe);
	return G(() => {
		let i = {
			nodes: n,
			edges: r
		};
		e?.(i), t.getState().onSelectionChangeHandlers.forEach((e) => e(i));
	}, [
		n,
		r,
		e
	]), null;
}
var Ye = (e) => !!e.onSelectionChangeHandlers;
function Xe({ onSelectionChange: e }) {
	let t = Q(Ye);
	return e || t ? Y(Je, { onSelectionChange: e }) : null;
}
var Ze = typeof window < "u" ? Ee : G, Qe = [0, 0], $e = {
	x: 0,
	y: 0,
	zoom: 1
}, et = [.../* @__PURE__ */ "nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode".split("."), "rfId"], tt = (e) => ({
	setNodes: e.setNodes,
	setEdges: e.setEdges,
	setMinZoom: e.setMinZoom,
	setMaxZoom: e.setMaxZoom,
	setTranslateExtent: e.setTranslateExtent,
	setNodeExtent: e.setNodeExtent,
	reset: e.reset,
	setDefaultNodesAndEdges: e.setDefaultNodesAndEdges
}), nt = {
	translateExtent: ne,
	nodeOrigin: Qe,
	minZoom: .5,
	maxZoom: 2,
	elementsSelectable: !0,
	noPanClassName: "nopan",
	rfId: "1"
};
function rt(e) {
	let { setNodes: t, setEdges: n, setMinZoom: r, setMaxZoom: i, setTranslateExtent: a, setNodeExtent: o, reset: s, setDefaultNodesAndEdges: c } = Q(tt, Z), l = $();
	Ze(() => (c(e.defaultNodes, e.defaultEdges), () => {
		u.current = nt, s();
	}), []);
	let u = q(nt);
	return Ze(() => {
		for (let s of et) {
			let c = e[s];
			c !== u.current[s] && e[s] !== void 0 && (s === "nodes" ? t(c) : s === "edges" ? n(c) : s === "minZoom" ? r(c) : s === "maxZoom" ? i(c) : s === "translateExtent" ? a(c) : s === "nodeExtent" ? o(c) : s === "ariaLabelConfig" ? l.setState({ ariaLabelConfig: fe(c) }) : s === "fitView" ? l.setState({ fitViewQueued: c }) : s === "fitViewOptions" ? l.setState({ fitViewOptions: c }) : l.setState({ [s]: c }));
		}
		u.current = e;
	}, et.map((t) => e[t])), null;
}
function it() {
	return typeof window > "u" || !window.matchMedia ? null : window.matchMedia("(prefers-color-scheme: dark)");
}
function at(e) {
	let [t, n] = J(e === "system" ? null : e);
	return G(() => {
		if (e !== "system") {
			n(e);
			return;
		}
		let t = it(), r = () => n(t?.matches ? "dark" : "light");
		return r(), t?.addEventListener("change", r), () => {
			t?.removeEventListener("change", r);
		};
	}, [e]), t === null ? it()?.matches ? "dark" : "light" : t;
}
var ot = typeof document < "u" ? document : null;
function st(e = null, t = {
	target: ot,
	actInsideInputWithModifier: !0
}) {
	let [n, r] = J(!1), i = q(!1), a = q(/* @__PURE__ */ new Set([])), [o, s] = K(() => {
		if (e !== null) {
			let t = (Array.isArray(e) ? e : [e]).filter((e) => typeof e == "string").map((e) => e.replace("+", "\n").replace("\n\n", "\n+").split("\n"));
			return [t, t.reduce((e, t) => e.concat(...t), [])];
		}
		return [[], []];
	}, [e]);
	return G(() => {
		let n = t?.target ?? ot, c = t?.actInsideInputWithModifier ?? !0;
		if (e !== null) {
			let e = (e) => {
				if (i.current = e.ctrlKey || e.metaKey || e.shiftKey || e.altKey, (!i.current || i.current && !c) && oe(e)) return !1;
				let n = lt(e.code, s);
				if (a.current.add(e[n]), ct(o, a.current, !1)) {
					let n = e.composedPath?.()?.[0] || e.target, a = n?.nodeName === "BUTTON" || n?.nodeName === "A";
					t.preventDefault !== !1 && (i.current || !a) && e.preventDefault(), r(!0);
				}
			}, l = (e) => {
				let t = lt(e.code, s);
				ct(o, a.current, !0) ? (r(!1), a.current.clear()) : a.current.delete(e[t]), e.key === "Meta" && a.current.clear(), i.current = !1;
			}, u = () => {
				a.current.clear(), r(!1);
			};
			return n?.addEventListener("keydown", e), n?.addEventListener("keyup", l), window.addEventListener("blur", u), window.addEventListener("contextmenu", u), () => {
				n?.removeEventListener("keydown", e), n?.removeEventListener("keyup", l), window.removeEventListener("blur", u), window.removeEventListener("contextmenu", u);
			};
		}
	}, [e, r]), n;
}
function ct(e, t, n) {
	return e.filter((e) => n || e.length === t.size).some((e) => e.every((e) => t.has(e)));
}
function lt(e, t) {
	return t.includes(e) ? "code" : "key";
}
var ut = () => {
	let e = $();
	return K(() => ({
		zoomIn: (t) => {
			let { panZoom: n } = e.getState();
			return n ? n.scaleBy(1.2, t) : Promise.resolve(!1);
		},
		zoomOut: (t) => {
			let { panZoom: n } = e.getState();
			return n ? n.scaleBy(1 / 1.2, t) : Promise.resolve(!1);
		},
		zoomTo: (t, n) => {
			let { panZoom: r } = e.getState();
			return r ? r.scaleTo(t, n) : Promise.resolve(!1);
		},
		getZoom: () => e.getState().transform[2],
		setViewport: async (t, n) => {
			let { transform: [r, i, a], panZoom: o } = e.getState();
			return o ? (await o.setViewport({
				x: t.x ?? r,
				y: t.y ?? i,
				zoom: t.zoom ?? a
			}, n), Promise.resolve(!0)) : Promise.resolve(!1);
		},
		getViewport: () => {
			let [t, n, r] = e.getState().transform;
			return {
				x: t,
				y: n,
				zoom: r
			};
		},
		setCenter: async (t, n, r) => e.getState().setCenter(t, n, r),
		fitBounds: async (t, n) => {
			let { width: r, height: i, minZoom: a, maxZoom: o, panZoom: s } = e.getState(), c = H(t, r, i, a, o, n?.padding ?? .1);
			return s ? (await s.setViewport(c, {
				duration: n?.duration,
				ease: n?.ease,
				interpolate: n?.interpolate
			}), Promise.resolve(!0)) : Promise.resolve(!1);
		},
		screenToFlowPosition: (t, n = {}) => {
			let { transform: r, snapGrid: i, snapToGrid: a, domNode: o } = e.getState();
			if (!o) return t;
			let { x: s, y: c } = o.getBoundingClientRect(), l = {
				x: t.x - s,
				y: t.y - c
			}, u = n.snapGrid ?? i;
			return ge(l, r, n.snapToGrid ?? a, u);
		},
		flowToScreenPosition: (t) => {
			let { transform: n, domNode: r } = e.getState();
			if (!r) return t;
			let { x: i, y: a } = r.getBoundingClientRect(), o = _e(t, n);
			return {
				x: o.x + i,
				y: o.y + a
			};
		}
	}), []);
};
function dt(e, t) {
	let n = [], r = /* @__PURE__ */ new Map(), i = [];
	for (let t of e) if (t.type === "add") {
		i.push(t);
		continue;
	} else if (t.type === "remove" || t.type === "replace") r.set(t.id, [t]);
	else {
		let e = r.get(t.id);
		e ? e.push(t) : r.set(t.id, [t]);
	}
	for (let e of t) {
		let t = r.get(e.id);
		if (!t) {
			n.push(e);
			continue;
		}
		if (t[0].type === "remove") continue;
		if (t[0].type === "replace") {
			n.push({ ...t[0].item });
			continue;
		}
		let i = { ...e };
		for (let e of t) ft(e, i);
		n.push(i);
	}
	return i.length && i.forEach((e) => {
		e.index === void 0 ? n.push({ ...e.item }) : n.splice(e.index, 0, { ...e.item });
	}), n;
}
function ft(e, t) {
	switch (e.type) {
		case "select":
			t.selected = e.selected;
			break;
		case "position":
			e.position !== void 0 && (t.position = e.position), e.dragging !== void 0 && (t.dragging = e.dragging);
			break;
		case "dimensions":
			e.dimensions !== void 0 && (t.measured = { ...e.dimensions }, e.setAttributes && ((e.setAttributes === !0 || e.setAttributes === "width") && (t.width = e.dimensions.width), (e.setAttributes === !0 || e.setAttributes === "height") && (t.height = e.dimensions.height))), typeof e.resizing == "boolean" && (t.resizing = e.resizing);
			break;
	}
}
function pt(e, t) {
	return dt(e, t);
}
function mt(e, t) {
	return dt(e, t);
}
function ht(e, t) {
	return {
		id: e,
		type: "select",
		selected: t
	};
}
function gt(e, t = /* @__PURE__ */ new Set(), n = !1) {
	let r = [];
	for (let [i, a] of e) {
		let e = t.has(i);
		!(a.selected === void 0 && !e) && a.selected !== e && (n && (a.selected = e), r.push(ht(a.id, e)));
	}
	return r;
}
function _t({ items: e = [], lookup: t }) {
	let n = [], r = new Map(e.map((e) => [e.id, e]));
	for (let [r, i] of e.entries()) {
		let e = t.get(i.id), a = e?.internals?.userNode ?? e;
		a !== void 0 && a !== i && n.push({
			id: i.id,
			item: i,
			type: "replace"
		}), a === void 0 && n.push({
			item: i,
			type: "add",
			index: r
		});
	}
	for (let [e] of t) r.get(e) === void 0 && n.push({
		id: e,
		type: "remove"
	});
	return n;
}
function vt(e) {
	return {
		id: e.id,
		type: "remove"
	};
}
var yt = (e) => le(e), bt = (e) => ie(e);
function xt(e) {
	return we(e);
}
function St(e) {
	let [t, n] = J(BigInt(0)), [r] = J(() => Ct(() => n((e) => e + BigInt(1))));
	return Ze(() => {
		let t = r.get();
		t.length && (e(t), r.reset());
	}, [t]), r;
}
function Ct(e) {
	let t = [];
	return {
		get: () => t,
		reset: () => {
			t = [];
		},
		push: (n) => {
			t.push(n), e();
		}
	};
}
var wt = Ce(null);
function Tt({ children: e }) {
	let t = $(), n = St(W((e) => {
		let { nodes: n = [], setNodes: r, hasDefaultNodes: i, onNodesChange: a, nodeLookup: o, fitViewQueued: s, onNodesChangeMiddlewareMap: c } = t.getState(), l = n;
		for (let t of e) l = typeof t == "function" ? t(l) : t;
		let u = _t({
			items: l,
			lookup: o
		});
		for (let e of c.values()) u = e(u);
		i && r(l), u.length > 0 ? a?.(u) : s && window.requestAnimationFrame(() => {
			let { fitViewQueued: e, nodes: n, setNodes: r } = t.getState();
			e && r(n);
		});
	}, [])), r = St(W((e) => {
		let { edges: n = [], setEdges: r, hasDefaultEdges: i, onEdgesChange: a, edgeLookup: o } = t.getState(), s = n;
		for (let t of e) s = typeof t == "function" ? t(s) : t;
		i ? r(s) : a && a(_t({
			items: s,
			lookup: o
		}));
	}, [])), i = K(() => ({
		nodeQueue: n,
		edgeQueue: r
	}), []);
	return Y(wt.Provider, {
		value: i,
		children: e
	});
}
function Et() {
	let e = Te(wt);
	if (!e) throw Error("useBatchContext must be used within a BatchProvider");
	return e;
}
var Dt = (e) => !!e.panZoom;
function Ot() {
	let e = ut(), t = $(), n = Et(), r = Q(Dt), i = K(() => {
		let e = (e) => t.getState().nodeLookup.get(e), r = (e) => {
			n.nodeQueue.push(e);
		}, i = (e) => {
			n.edgeQueue.push(e);
		}, a = (e) => {
			let { nodeLookup: n, nodeOrigin: r } = t.getState(), i = yt(e) ? e : n.get(e.id), a = i.parentId ? S(i.position, i.measured, i.parentId, n, r) : i.position;
			return me({
				...i,
				position: a,
				width: i.measured?.width ?? i.width,
				height: i.measured?.height ?? i.height
			});
		}, o = (e, t, n = { replace: !1 }) => {
			r((r) => r.map((r) => {
				if (r.id === e) {
					let e = typeof t == "function" ? t(r) : t;
					return n.replace && yt(e) ? e : {
						...r,
						...e
					};
				}
				return r;
			}));
		}, s = (e, t, n = { replace: !1 }) => {
			i((r) => r.map((r) => {
				if (r.id === e) {
					let e = typeof t == "function" ? t(r) : t;
					return n.replace && bt(e) ? e : {
						...r,
						...e
					};
				}
				return r;
			}));
		};
		return {
			getNodes: () => t.getState().nodes.map((e) => ({ ...e })),
			getNode: (t) => e(t)?.internals.userNode,
			getInternalNode: e,
			getEdges: () => {
				let { edges: e = [] } = t.getState();
				return e.map((e) => ({ ...e }));
			},
			getEdge: (e) => t.getState().edgeLookup.get(e),
			setNodes: r,
			setEdges: i,
			addNodes: (e) => {
				let t = Array.isArray(e) ? e : [e];
				n.nodeQueue.push((e) => [...e, ...t]);
			},
			addEdges: (e) => {
				let t = Array.isArray(e) ? e : [e];
				n.edgeQueue.push((e) => [...e, ...t]);
			},
			toObject: () => {
				let { nodes: e = [], edges: n = [], transform: r } = t.getState(), [i, a, o] = r;
				return {
					nodes: e.map((e) => ({ ...e })),
					edges: n.map((e) => ({ ...e })),
					viewport: {
						x: i,
						y: a,
						zoom: o
					}
				};
			},
			deleteElements: async ({ nodes: e = [], edges: n = [] }) => {
				let { nodes: r, edges: i, onNodesDelete: a, onEdgesDelete: o, triggerNodeChanges: s, triggerEdgeChanges: c, onDelete: l, onBeforeDelete: u } = t.getState(), { nodes: d, edges: f } = await A({
					nodesToRemove: e,
					edgesToRemove: n,
					nodes: r,
					edges: i,
					onBeforeDelete: u
				}), p = f.length > 0, m = d.length > 0;
				if (p) {
					let e = f.map(vt);
					o?.(f), c(e);
				}
				if (m) {
					let e = d.map(vt);
					a?.(d), s(e);
				}
				return (m || p) && l?.({
					nodes: d,
					edges: f
				}), {
					deletedNodes: d,
					deletedEdges: f
				};
			},
			getIntersectingNodes: (e, n = !0, r) => {
				let i = de(e), o = i ? e : a(e), s = r !== void 0;
				return o ? (r || t.getState().nodes).filter((r) => {
					let a = t.getState().nodeLookup.get(r.id);
					if (a && !i && (r.id === e.id || !a.internals.positionAbsolute)) return !1;
					let c = me(s ? r : a), l = z(c, o);
					return n && l > 0 || l >= c.width * c.height || l >= o.width * o.height;
				}) : [];
			},
			isNodeIntersecting: (e, t, n = !0) => {
				let r = de(e) ? e : a(e);
				if (!r) return !1;
				let i = z(r, t);
				return n && i > 0 || i >= t.width * t.height || i >= r.width * r.height;
			},
			updateNode: o,
			updateNodeData: (e, t, n = { replace: !1 }) => {
				o(e, (e) => {
					let r = typeof t == "function" ? t(e) : t;
					return n.replace ? {
						...e,
						data: r
					} : {
						...e,
						data: {
							...e.data,
							...r
						}
					};
				}, n);
			},
			updateEdge: s,
			updateEdgeData: (e, t, n = { replace: !1 }) => {
				s(e, (e) => {
					let r = typeof t == "function" ? t(e) : t;
					return n.replace ? {
						...e,
						data: r
					} : {
						...e,
						data: {
							...e.data,
							...r
						}
					};
				}, n);
			},
			getNodesBounds: (e) => {
				let { nodeLookup: n, nodeOrigin: r } = t.getState();
				return L(e, {
					nodeLookup: n,
					nodeOrigin: r
				});
			},
			getHandleConnections: ({ type: e, id: n, nodeId: r }) => Array.from(t.getState().connectionLookup.get(`${r}-${e}${n ? `-${n}` : ""}`)?.values() ?? []),
			getNodeConnections: ({ type: e, handleId: n, nodeId: r }) => Array.from(t.getState().connectionLookup.get(`${r}${e ? n ? `-${e}-${n}` : `-${e}` : ""}`)?.values() ?? []),
			fitView: async (e) => {
				let r = t.getState().fitViewResolver ?? Se();
				return t.setState({
					fitViewQueued: !0,
					fitViewOptions: e,
					fitViewResolver: r
				}), n.nodeQueue.push((e) => [...e]), r.promise;
			}
		};
	}, []);
	return K(() => ({
		...i,
		...e,
		viewportInitialized: r
	}), [r]);
}
var kt = (e) => e.selected, At = typeof window < "u" ? window : void 0;
function jt({ deleteKeyCode: e, multiSelectionKeyCode: t }) {
	let n = $(), { deleteElements: r } = Ot(), i = st(e, { actInsideInputWithModifier: !1 }), a = st(t, { target: At });
	G(() => {
		if (i) {
			let { edges: e, nodes: t } = n.getState();
			r({
				nodes: t.filter(kt),
				edges: e.filter(kt)
			}), n.setState({ nodesSelectionActive: !1 });
		}
	}, [i]), G(() => {
		n.setState({ multiSelectionActive: a });
	}, [a]);
}
function Mt(e) {
	let t = $();
	G(() => {
		let n = () => {
			if (!e.current || !(e.current.checkVisibility?.() ?? !0)) return !1;
			let n = O(e.current);
			(n.height === 0 || n.width === 0) && t.getState().onError?.("004", x.error004()), t.setState({
				width: n.width || 500,
				height: n.height || 500
			});
		};
		if (e.current) {
			n(), window.addEventListener("resize", n);
			let t = new ResizeObserver(() => n());
			return t.observe(e.current), () => {
				window.removeEventListener("resize", n), t && e.current && t.unobserve(e.current);
			};
		}
	}, []);
}
var Nt = {
	position: "absolute",
	width: "100%",
	height: "100%",
	top: 0,
	left: 0
}, Pt = (e) => ({
	userSelectionActive: e.userSelectionActive,
	lib: e.lib,
	connectionInProgress: e.connection.inProgress
});
function Ft({ onPaneContextMenu: e, zoomOnScroll: t = !0, zoomOnPinch: n = !0, panOnScroll: r = !1, panOnScrollSpeed: a = .5, panOnScrollMode: o = i.Free, zoomOnDoubleClick: s = !0, panOnDrag: c = !0, defaultViewport: l, translateExtent: u, minZoom: f, maxZoom: p, zoomActivationKeyCode: m, preventScrolling: h = !0, children: g, noWheelClassName: _, noPanClassName: v, onViewportChange: y, isControlledViewport: b, paneClickDistance: x, selectionOnDrag: S }) {
	let C = $(), w = q(null), { userSelectionActive: T, lib: E, connectionInProgress: D } = Q(Pt, Z), O = st(m), k = q();
	Mt(w);
	let A = W((e) => {
		y?.({
			x: e[0],
			y: e[1],
			zoom: e[2]
		}), b || C.setState({ transform: e });
	}, [y, b]);
	return G(() => {
		if (w.current) {
			k.current = d({
				domNode: w.current,
				minZoom: f,
				maxZoom: p,
				translateExtent: u,
				viewport: l,
				onDraggingChange: (e) => C.setState((t) => t.paneDragging === e ? t : { paneDragging: e }),
				onPanZoomStart: (e, t) => {
					let { onViewportChangeStart: n, onMoveStart: r } = C.getState();
					r?.(e, t), n?.(t);
				},
				onPanZoom: (e, t) => {
					let { onViewportChange: n, onMove: r } = C.getState();
					r?.(e, t), n?.(t);
				},
				onPanZoomEnd: (e, t) => {
					let { onViewportChangeEnd: n, onMoveEnd: r } = C.getState();
					r?.(e, t), n?.(t);
				}
			});
			let { x: e, y: t, zoom: n } = k.current.getViewport();
			return C.setState({
				panZoom: k.current,
				transform: [
					e,
					t,
					n
				],
				domNode: w.current.closest(".react-flow")
			}), () => {
				k.current?.destroy();
			};
		}
	}, []), G(() => {
		k.current?.update({
			onPaneContextMenu: e,
			zoomOnScroll: t,
			zoomOnPinch: n,
			panOnScroll: r,
			panOnScrollSpeed: a,
			panOnScrollMode: o,
			zoomOnDoubleClick: s,
			panOnDrag: c,
			zoomActivationKeyPressed: O,
			preventScrolling: h,
			noPanClassName: v,
			userSelectionActive: T,
			noWheelClassName: _,
			lib: E,
			onTransformChange: A,
			connectionInProgress: D,
			selectionOnDrag: S,
			paneClickDistance: x
		});
	}, [
		e,
		t,
		n,
		r,
		a,
		o,
		s,
		c,
		O,
		h,
		v,
		T,
		_,
		E,
		A,
		D,
		S,
		x
	]), Y("div", {
		className: "react-flow__renderer",
		ref: w,
		style: Nt,
		children: g
	});
}
var It = (e) => ({
	userSelectionActive: e.userSelectionActive,
	userSelectionRect: e.userSelectionRect
});
function Lt() {
	let { userSelectionActive: e, userSelectionRect: t } = Q(It, Z);
	return e && t ? Y("div", {
		className: "react-flow__selection react-flow__container",
		style: {
			width: t.width,
			height: t.height,
			transform: `translate(${t.x}px, ${t.y}px)`
		}
	}) : null;
}
var Rt = (e, t) => (n) => {
	n.target === t.current && e?.(n);
}, zt = (e) => ({
	userSelectionActive: e.userSelectionActive,
	elementsSelectable: e.elementsSelectable,
	connectionInProgress: e.connection.inProgress,
	dragging: e.paneDragging
});
function Bt({ isSelecting: t, selectionKeyPressed: n, selectionMode: r = s.Full, panOnDrag: i, paneClickDistance: a, selectionOnDrag: o, onSelectionStart: c, onSelectionEnd: l, onPaneClick: u, onPaneContextMenu: d, onPaneScroll: f, onPaneMouseEnter: p, onPaneMouseMove: m, onPaneMouseLeave: g, children: _ }) {
	let v = $(), { userSelectionActive: y, elementsSelectable: b, dragging: x, connectionInProgress: S } = Q(zt, Z), C = b && (t || y), w = q(null), T = q(), E = q(/* @__PURE__ */ new Set()), D = q(/* @__PURE__ */ new Set()), O = q(!1), k = (e) => {
		if (O.current || S) {
			O.current = !1;
			return;
		}
		u?.(e), v.getState().resetSelectedElements(), v.setState({ nodesSelectionActive: !1 });
	}, A = (e) => {
		if (Array.isArray(i) && i?.includes(2)) {
			e.preventDefault();
			return;
		}
		d?.(e);
	}, j = f ? (e) => f(e) : void 0;
	return X("div", {
		className: e(["react-flow__pane", {
			draggable: i === !0 || Array.isArray(i) && i.includes(0),
			dragging: x,
			selection: t
		}]),
		onClick: C ? void 0 : Rt(k, w),
		onContextMenu: Rt(A, w),
		onWheel: Rt(j, w),
		onPointerEnter: C ? void 0 : p,
		onPointerMove: C ? (e) => {
			let { userSelectionRect: t, transform: i, nodeLookup: o, edgeLookup: l, connectionLookup: u, triggerNodeChanges: d, triggerEdgeChanges: f, defaultEdgeOptions: p, resetSelectedElements: m } = v.getState();
			if (!T.current || !t) return;
			let { x: g, y: _ } = M(e.nativeEvent, T.current), { startX: y, startY: b } = t;
			if (!O.current) {
				let t = n ? 0 : a;
				if (Math.hypot(g - y, _ - b) <= t) return;
				m(), c?.(e);
			}
			O.current = !0;
			let x = {
				startX: y,
				startY: b,
				x: g < y ? g : y,
				y: _ < b ? _ : b,
				width: Math.abs(g - y),
				height: Math.abs(_ - b)
			}, S = E.current, C = D.current;
			E.current = new Set(R(o, x, i, r === s.Partial, !0).map((e) => e.id)), D.current = /* @__PURE__ */ new Set();
			let w = p?.selectable ?? !0;
			for (let e of E.current) {
				let t = u.get(e);
				if (t) for (let { edgeId: e } of t.values()) {
					let t = l.get(e);
					t && (t.selectable ?? w) && D.current.add(e);
				}
			}
			h(S, E.current) || d(gt(o, E.current, !0)), h(C, D.current) || f(gt(l, D.current)), v.setState({
				userSelectionRect: x,
				userSelectionActive: !0,
				nodesSelectionActive: !1
			});
		} : m,
		onPointerUp: C ? (e) => {
			e.button === 0 && (e.target?.releasePointerCapture?.(e.pointerId), !y && e.target === w.current && v.getState().userSelectionRect && k?.(e), v.setState({
				userSelectionActive: !1,
				userSelectionRect: null
			}), O.current && (l?.(e), v.setState({ nodesSelectionActive: E.current.size > 0 })));
		} : void 0,
		onPointerDownCapture: C ? (e) => {
			let { domNode: r } = v.getState();
			if (T.current = r?.getBoundingClientRect(), !T.current) return;
			let i = e.target === w.current;
			if (!i && e.target.closest(".nokey") || !t || !(o && i || n) || e.button !== 0 || !e.isPrimary) return;
			e.target?.setPointerCapture?.(e.pointerId), O.current = !1;
			let { x: a, y: s } = M(e.nativeEvent, T.current);
			v.setState({ userSelectionRect: {
				width: 0,
				height: 0,
				startX: a,
				startY: s,
				x: a,
				y: s
			} }), i || (e.stopPropagation(), e.preventDefault());
		} : void 0,
		onClickCapture: C ? (e) => {
			O.current &&= (e.stopPropagation(), !1);
		} : void 0,
		onPointerLeave: g,
		ref: w,
		style: Nt,
		children: [_, Y(Lt, {})]
	});
}
function Vt({ id: e, store: t, unselect: n = !1, nodeRef: r }) {
	let { addSelectedNodes: i, unselectNodesAndEdges: a, multiSelectionActive: o, nodeLookup: s, onError: c } = t.getState(), l = s.get(e);
	if (!l) {
		c?.("012", x.error012(e));
		return;
	}
	t.setState({ nodesSelectionActive: !1 }), l.selected ? (n || l.selected && o) && (a({
		nodes: [l],
		edges: []
	}), requestAnimationFrame(() => r?.current?.blur())) : i([e]);
}
function Ht({ nodeRef: e, disabled: t = !1, noDragClassName: n, handleSelector: r, nodeId: i, isSelectable: a, nodeClickDistance: o }) {
	let s = $(), [l, u] = J(!1), d = q();
	return G(() => {
		d.current = c({
			getStoreItems: () => s.getState(),
			onNodeMouseDown: (t) => {
				Vt({
					id: t,
					store: s,
					nodeRef: e
				});
			},
			onDragStart: () => {
				u(!0);
			},
			onDragStop: () => {
				u(!1);
			}
		});
	}, []), G(() => {
		if (!(t || !e.current || !d.current)) return d.current.update({
			noDragClassName: n,
			handleSelector: r,
			domNode: e.current,
			isSelectable: a,
			nodeId: i,
			nodeClickDistance: o
		}), () => {
			d.current?.destroy();
		};
	}, [
		n,
		r,
		t,
		a,
		e,
		i,
		o
	]), l;
}
var Ut = (e) => (t) => t.selected && (t.draggable || e && t.draggable === void 0);
function Wt() {
	let e = $();
	return W((t) => {
		let { nodeExtent: n, snapToGrid: r, snapGrid: i, nodesDraggable: a, onError: o, updateNodePositions: s, nodeLookup: c, nodeOrigin: l } = e.getState(), u = /* @__PURE__ */ new Map(), d = Ut(a), f = r ? i[0] : 5, p = r ? i[1] : 5, m = t.direction.x * f * t.factor, h = t.direction.y * p * t.factor;
		for (let [, e] of c) {
			if (!d(e)) continue;
			let t = {
				x: e.internals.positionAbsolute.x + m,
				y: e.internals.positionAbsolute.y + h
			};
			r && (t = ve(t, i));
			let { position: a, positionAbsolute: s } = g({
				nodeId: e.id,
				nextPosition: t,
				nodeLookup: c,
				nodeExtent: n,
				nodeOrigin: l,
				onError: o
			});
			e.position = a, e.internals.positionAbsolute = s, u.set(e.id, e);
		}
		s(u);
	}, []);
}
var Gt = Ce(null), Kt = Gt.Provider;
Gt.Consumer;
var qt = () => Te(Gt), Jt = (e) => ({
	connectOnClick: e.connectOnClick,
	noPanClassName: e.noPanClassName,
	rfId: e.rfId
}), Yt = (e, t, r) => (i) => {
	let { connectionClickStartHandle: a, connectionMode: o, connection: s } = i, { fromHandle: c, toHandle: l, isValid: u } = s, d = l?.nodeId === e && l?.id === t && l?.type === r;
	return {
		connectingFrom: c?.nodeId === e && c?.id === t && c?.type === r,
		connectingTo: d,
		clickConnecting: a?.nodeId === e && a?.id === t && a?.type === r,
		isPossibleEndHandle: o === n.Strict ? c?.type !== r : e !== c?.nodeId || t !== c?.id,
		connectionInProcess: !!c,
		clickConnectionInProcess: !!a,
		valid: d && u
	};
};
function Xt({ type: t = "source", position: n = a.Top, isValidConnection: r, isConnectable: i = !0, isConnectableStart: o = !0, isConnectableEnd: s = !0, id: c, onConnect: u, children: d, className: f, onMouseDown: m, onTouchStart: h, ...g }, _) {
	let v = c || null, y = t === "target", b = $(), S = qt(), { connectOnClick: C, noPanClassName: w, rfId: T } = Q(Jt, Z), { connectingFrom: E, connectingTo: D, clickConnecting: O, isPossibleEndHandle: k, connectionInProcess: A, clickConnectionInProcess: j, valid: M } = Q(Yt(S, v, t), Z);
	S || b.getState().onError?.("010", x.error010());
	let N = (e) => {
		let { defaultEdgeOptions: t, onConnect: n, hasDefaultEdges: r } = b.getState(), i = {
			...t,
			...e
		};
		if (r) {
			let { edges: e, setEdges: t } = b.getState();
			t(p(i, e));
		}
		n?.(i), u?.(i);
	}, F = (e) => {
		if (!S) return;
		let t = ce(e.nativeEvent);
		if (o && (t && e.button === 0 || !t)) {
			let t = b.getState();
			l.onPointerDown(e.nativeEvent, {
				handleDomNode: e.currentTarget,
				autoPanOnConnect: t.autoPanOnConnect,
				connectionMode: t.connectionMode,
				connectionRadius: t.connectionRadius,
				domNode: t.domNode,
				nodeLookup: t.nodeLookup,
				lib: t.lib,
				isTarget: y,
				handleId: v,
				nodeId: S,
				flowId: t.rfId,
				panBy: t.panBy,
				cancelConnection: t.cancelConnection,
				onConnectStart: t.onConnectStart,
				onConnectEnd: (...e) => b.getState().onConnectEnd?.(...e),
				updateConnection: t.updateConnection,
				onConnect: N,
				isValidConnection: r || ((...e) => b.getState().isValidConnection?.(...e) ?? !0),
				getTransform: () => b.getState().transform,
				getFromHandle: () => b.getState().connection.fromHandle,
				autoPanSpeed: t.autoPanSpeed,
				dragThreshold: t.connectionDragThreshold
			});
		}
		t ? m?.(e) : h?.(e);
	};
	return Y("div", {
		"data-handleid": v,
		"data-nodeid": S,
		"data-handlepos": n,
		"data-id": `${T}-${S}-${v}-${t}`,
		className: e([
			"react-flow__handle",
			`react-flow__handle-${n}`,
			"nodrag",
			w,
			f,
			{
				source: !y,
				target: y,
				connectable: i,
				connectablestart: o,
				connectableend: s,
				clickconnecting: O,
				connectingfrom: E,
				connectingto: D,
				valid: M,
				connectionindicator: i && (!A || k) && (A || j ? s : o)
			}
		]),
		onMouseDown: F,
		onTouchStart: F,
		onClick: C ? (e) => {
			let { onClickConnectStart: n, onClickConnectEnd: i, connectionClickStartHandle: a, connectionMode: s, isValidConnection: c, lib: u, rfId: d, nodeLookup: f, connection: p } = b.getState();
			if (!S || !a && !o) return;
			if (!a) {
				n?.(e.nativeEvent, {
					nodeId: S,
					handleId: v,
					handleType: t
				}), b.setState({ connectionClickStartHandle: {
					nodeId: S,
					type: t,
					id: v
				} });
				return;
			}
			let m = P(e.target), h = r || c, { connection: g, isValid: _ } = l.isValid(e.nativeEvent, {
				handle: {
					nodeId: S,
					id: v,
					type: t
				},
				connectionMode: s,
				fromNodeId: a.nodeId,
				fromHandleId: a.id || null,
				fromType: a.type,
				isValidConnection: h,
				flowId: d,
				doc: m,
				lib: u,
				nodeLookup: f
			});
			_ && g && N(g);
			let y = structuredClone(p);
			delete y.inProgress, y.toPosition = y.toHandle ? y.toHandle.position : null, i?.(e, y), b.setState({ connectionClickStartHandle: null });
		} : void 0,
		ref: _,
		...g,
		children: d
	});
}
var Zt = U(xt(Xt));
function Qt({ data: e, isConnectable: t, sourcePosition: n = a.Bottom }) {
	return X(De, { children: [e?.label, Y(Zt, {
		type: "source",
		position: n,
		isConnectable: t
	})] });
}
function $t({ data: e, isConnectable: t, targetPosition: n = a.Top, sourcePosition: r = a.Bottom }) {
	return X(De, { children: [
		Y(Zt, {
			type: "target",
			position: n,
			isConnectable: t
		}),
		e?.label,
		Y(Zt, {
			type: "source",
			position: r,
			isConnectable: t
		})
	] });
}
function en() {
	return null;
}
function tn({ data: e, isConnectable: t, targetPosition: n = a.Top }) {
	return X(De, { children: [Y(Zt, {
		type: "target",
		position: n,
		isConnectable: t
	}), e?.label] });
}
var nn = {
	ArrowUp: {
		x: 0,
		y: -1
	},
	ArrowDown: {
		x: 0,
		y: 1
	},
	ArrowLeft: {
		x: -1,
		y: 0
	},
	ArrowRight: {
		x: 1,
		y: 0
	}
}, rn = {
	input: Qt,
	default: $t,
	output: tn,
	group: en
};
function an(e) {
	return e.internals.handleBounds === void 0 ? {
		width: e.width ?? e.initialWidth ?? e.style?.width,
		height: e.height ?? e.initialHeight ?? e.style?.height
	} : {
		width: e.width ?? e.style?.width,
		height: e.height ?? e.style?.height
	};
}
var on = (e) => {
	let { width: t, height: n, x: r, y: i } = F(e.nodeLookup, { filter: (e) => !!e.selected });
	return {
		width: ue(t) ? t : null,
		height: ue(n) ? n : null,
		userSelectionActive: e.userSelectionActive,
		transformString: `translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`
	};
};
function sn({ onSelectionContextMenu: t, noPanClassName: n, disableKeyboardA11y: r }) {
	let i = $(), { width: a, height: o, transformString: s, userSelectionActive: c } = Q(on, Z), l = Wt(), u = q(null);
	G(() => {
		r || u.current?.focus({ preventScroll: !0 });
	}, [r]);
	let d = !c && a !== null && o !== null;
	if (Ht({
		nodeRef: u,
		disabled: !d
	}), !d) return null;
	let f = t ? (e) => {
		t(e, i.getState().nodes.filter((e) => e.selected));
	} : void 0;
	return Y("div", {
		className: e([
			"react-flow__nodesselection",
			"react-flow__container",
			n
		]),
		style: { transform: s },
		children: Y("div", {
			ref: u,
			className: "react-flow__nodesselection-rect",
			onContextMenu: f,
			tabIndex: r ? void 0 : -1,
			onKeyDown: r ? void 0 : (e) => {
				Object.prototype.hasOwnProperty.call(nn, e.key) && (e.preventDefault(), l({
					direction: nn[e.key],
					factor: e.shiftKey ? 4 : 1
				}));
			},
			style: {
				width: a,
				height: o
			}
		})
	});
}
var cn = typeof window < "u" ? window : void 0, ln = (e) => ({
	nodesSelectionActive: e.nodesSelectionActive,
	userSelectionActive: e.userSelectionActive
});
function un({ children: e, onPaneClick: t, onPaneMouseEnter: n, onPaneMouseMove: r, onPaneMouseLeave: i, onPaneContextMenu: a, onPaneScroll: o, paneClickDistance: s, deleteKeyCode: c, selectionKeyCode: l, selectionOnDrag: u, selectionMode: d, onSelectionStart: f, onSelectionEnd: p, multiSelectionKeyCode: m, panActivationKeyCode: h, zoomActivationKeyCode: g, elementsSelectable: _, zoomOnScroll: v, zoomOnPinch: y, panOnScroll: b, panOnScrollSpeed: x, panOnScrollMode: S, zoomOnDoubleClick: C, panOnDrag: w, defaultViewport: T, translateExtent: E, minZoom: D, maxZoom: O, preventScrolling: k, onSelectionContextMenu: A, noWheelClassName: j, noPanClassName: M, disableKeyboardA11y: N, onViewportChange: P, isControlledViewport: F }) {
	let { nodesSelectionActive: ee, userSelectionActive: I } = Q(ln, Z), L = st(l, { target: cn }), R = st(h, { target: cn }), z = R || w, B = R || b, V = u && z !== !0, H = L || I || V;
	return jt({
		deleteKeyCode: c,
		multiSelectionKeyCode: m
	}), Y(Ft, {
		onPaneContextMenu: a,
		elementsSelectable: _,
		zoomOnScroll: v,
		zoomOnPinch: y,
		panOnScroll: B,
		panOnScrollSpeed: x,
		panOnScrollMode: S,
		zoomOnDoubleClick: C,
		panOnDrag: !L && z,
		defaultViewport: T,
		translateExtent: E,
		minZoom: D,
		maxZoom: O,
		zoomActivationKeyCode: g,
		preventScrolling: k,
		noWheelClassName: j,
		noPanClassName: M,
		onViewportChange: P,
		isControlledViewport: F,
		paneClickDistance: s,
		selectionOnDrag: V,
		children: X(Bt, {
			onSelectionStart: f,
			onSelectionEnd: p,
			onPaneClick: t,
			onPaneMouseEnter: n,
			onPaneMouseMove: r,
			onPaneMouseLeave: i,
			onPaneContextMenu: a,
			onPaneScroll: o,
			panOnDrag: z,
			isSelecting: !!H,
			selectionMode: d,
			selectionKeyPressed: L,
			paneClickDistance: s,
			selectionOnDrag: V,
			children: [e, ee && Y(sn, {
				onSelectionContextMenu: A,
				noPanClassName: M,
				disableKeyboardA11y: N
			})]
		})
	});
}
un.displayName = "FlowRenderer";
var dn = U(un), fn = (e) => (t) => e ? R(t.nodeLookup, {
	x: 0,
	y: 0,
	width: t.width,
	height: t.height
}, t.transform, !0).map((e) => e.id) : Array.from(t.nodeLookup.keys());
function pn(e) {
	return Q(W(fn(e), [e]), Z);
}
var mn = (e) => e.updateNodeInternals;
function hn() {
	let e = Q(mn), [t] = J(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((t) => {
		let n = /* @__PURE__ */ new Map();
		t.forEach((e) => {
			let t = e.target.getAttribute("data-id");
			n.set(t, {
				id: t,
				nodeElement: e.target,
				force: !0
			});
		}), e(n);
	}));
	return G(() => () => {
		t?.disconnect();
	}, [t]), t;
}
function gn({ node: e, nodeType: t, hasDimensions: n, resizeObserver: r }) {
	let i = $(), a = q(null), o = q(null), s = q(e.sourcePosition), c = q(e.targetPosition), l = q(t), u = n && !!e.internals.handleBounds;
	return G(() => {
		a.current && !e.hidden && (!u || o.current !== a.current) && (o.current && r?.unobserve(o.current), r?.observe(a.current), o.current = a.current);
	}, [u, e.hidden]), G(() => () => {
		o.current &&= (r?.unobserve(o.current), null);
	}, []), G(() => {
		if (a.current) {
			let n = l.current !== t, r = s.current !== e.sourcePosition, o = c.current !== e.targetPosition;
			(n || r || o) && (l.current = t, s.current = e.sourcePosition, c.current = e.targetPosition, i.getState().updateNodeInternals(new Map([[e.id, {
				id: e.id,
				nodeElement: a.current,
				force: !0
			}]])));
		}
	}, [
		e.id,
		t,
		e.sourcePosition,
		e.targetPosition
	]), a;
}
function _n({ id: t, onClick: n, onMouseEnter: r, onMouseMove: i, onMouseLeave: a, onContextMenu: o, onDoubleClick: s, nodesDraggable: c, elementsSelectable: l, nodesConnectable: u, nodesFocusable: d, resizeObserver: f, noDragClassName: p, noPanClassName: m, disableKeyboardA11y: h, rfId: g, nodeTypes: _, nodeClickDistance: v, onError: y }) {
	let { node: S, internals: C, isParent: w } = Q((e) => {
		let n = e.nodeLookup.get(t), r = e.parentLookup.has(t);
		return {
			node: n,
			internals: n.internals,
			isParent: r
		};
	}, Z), T = S.type || "default", E = _?.[T] || rn[T];
	E === void 0 && (y?.("003", x.error003(T)), T = "default", E = _?.default || rn.default);
	let D = !!(S.draggable || c && S.draggable === void 0), O = !!(S.selectable || l && S.selectable === void 0), k = !!(S.connectable || u && S.connectable === void 0), A = !!(S.focusable || d && S.focusable === void 0), j = $(), M = pe(S), N = gn({
		node: S,
		nodeType: T,
		hasDimensions: M,
		resizeObserver: f
	}), P = Ht({
		nodeRef: N,
		disabled: S.hidden || !D,
		noDragClassName: p,
		handleSelector: S.dragHandle,
		nodeId: t,
		isSelectable: O,
		nodeClickDistance: v
	}), F = Wt();
	if (S.hidden) return null;
	let ee = I(S), L = an(S), z = O || D || n || r || i || a, B = r ? (e) => r(e, { ...C.userNode }) : void 0, V = i ? (e) => i(e, { ...C.userNode }) : void 0, H = a ? (e) => a(e, { ...C.userNode }) : void 0, te = o ? (e) => o(e, { ...C.userNode }) : void 0, ne = s ? (e) => s(e, { ...C.userNode }) : void 0, re = (e) => {
		let { selectNodesOnDrag: r, nodeDragThreshold: i } = j.getState();
		O && (!r || !D || i > 0) && Vt({
			id: t,
			store: j,
			nodeRef: N
		}), n && n(e, { ...C.userNode });
	}, ie = (e) => {
		if (!(oe(e.nativeEvent) || h)) {
			if (b.includes(e.key) && O) Vt({
				id: t,
				store: j,
				unselect: e.key === "Escape",
				nodeRef: N
			});
			else if (D && S.selected && Object.prototype.hasOwnProperty.call(nn, e.key)) {
				e.preventDefault();
				let { ariaLabelConfig: t } = j.getState();
				j.setState({ ariaLiveMessage: t["node.a11yDescription.ariaLiveMessage"]({
					direction: e.key.replace("Arrow", "").toLowerCase(),
					x: ~~C.positionAbsolute.x,
					y: ~~C.positionAbsolute.y
				}) }), F({
					direction: nn[e.key],
					factor: e.shiftKey ? 4 : 1
				});
			}
		}
	}, ae = () => {
		if (h || !N.current?.matches(":focus-visible")) return;
		let { transform: e, width: n, height: r, autoPanOnNodeFocus: i, setCenter: a } = j.getState();
		i && (R(new Map([[t, S]]), {
			x: 0,
			y: 0,
			width: n,
			height: r
		}, e, !0).length > 0 || a(S.position.x + ee.width / 2, S.position.y + ee.height / 2, { zoom: e[2] }));
	};
	return Y("div", {
		className: e([
			"react-flow__node",
			`react-flow__node-${T}`,
			{ [m]: D },
			S.className,
			{
				selected: S.selected,
				selectable: O,
				parent: w,
				draggable: D,
				dragging: P
			}
		]),
		ref: N,
		style: {
			zIndex: C.z,
			transform: `translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,
			pointerEvents: z ? "all" : "none",
			visibility: M ? "visible" : "hidden",
			...S.style,
			...L
		},
		"data-id": t,
		"data-testid": `rf__node-${t}`,
		onMouseEnter: B,
		onMouseMove: V,
		onMouseLeave: H,
		onContextMenu: te,
		onClick: re,
		onDoubleClick: ne,
		onKeyDown: A ? ie : void 0,
		tabIndex: A ? 0 : void 0,
		onFocus: A ? ae : void 0,
		role: S.ariaRole ?? (A ? "group" : void 0),
		"aria-roledescription": "node",
		"aria-describedby": h ? void 0 : `${Ie}-${g}`,
		"aria-label": S.ariaLabel,
		...S.domAttributes,
		children: Y(Kt, {
			value: t,
			children: Y(E, {
				id: t,
				data: S.data,
				type: T,
				positionAbsoluteX: C.positionAbsolute.x,
				positionAbsoluteY: C.positionAbsolute.y,
				selected: S.selected ?? !1,
				selectable: O,
				draggable: D,
				deletable: S.deletable ?? !0,
				isConnectable: k,
				sourcePosition: S.sourcePosition,
				targetPosition: S.targetPosition,
				dragging: P,
				dragHandle: S.dragHandle,
				zIndex: C.z,
				parentId: S.parentId,
				...ee
			})
		})
	});
}
var vn = U(_n), yn = (e) => ({
	nodesDraggable: e.nodesDraggable,
	nodesConnectable: e.nodesConnectable,
	nodesFocusable: e.nodesFocusable,
	elementsSelectable: e.elementsSelectable,
	onError: e.onError
});
function bn(e) {
	let { nodesDraggable: t, nodesConnectable: n, nodesFocusable: r, elementsSelectable: i, onError: a } = Q(yn, Z), o = pn(e.onlyRenderVisibleElements), s = hn();
	return Y("div", {
		className: "react-flow__nodes",
		style: Nt,
		children: o.map((o) => Y(vn, {
			id: o,
			nodeTypes: e.nodeTypes,
			nodeExtent: e.nodeExtent,
			onClick: e.onNodeClick,
			onMouseEnter: e.onNodeMouseEnter,
			onMouseMove: e.onNodeMouseMove,
			onMouseLeave: e.onNodeMouseLeave,
			onContextMenu: e.onNodeContextMenu,
			onDoubleClick: e.onNodeDoubleClick,
			noDragClassName: e.noDragClassName,
			noPanClassName: e.noPanClassName,
			rfId: e.rfId,
			disableKeyboardA11y: e.disableKeyboardA11y,
			resizeObserver: s,
			nodesDraggable: t,
			nodesConnectable: n,
			nodesFocusable: r,
			elementsSelectable: i,
			nodeClickDistance: e.nodeClickDistance,
			onError: a
		}, o))
	});
}
bn.displayName = "NodeRenderer";
var xn = U(bn);
function Sn(e) {
	return Q(W((t) => {
		if (!e) return t.edges.map((e) => e.id);
		let n = [];
		if (t.width && t.height) for (let e of t.edges) {
			let r = t.nodeLookup.get(e.source), i = t.nodeLookup.get(e.target);
			r && i && ae({
				sourceNode: r,
				targetNode: i,
				width: t.width,
				height: t.height,
				transform: t.transform
			}) && n.push(e.id);
		}
		return n;
	}, [e]), Z);
}
var Cn = ({ color: e = "none", strokeWidth: t = 1 }) => Y("polyline", {
	className: "arrow",
	style: {
		strokeWidth: t,
		...e && { stroke: e }
	},
	strokeLinecap: "round",
	fill: "none",
	strokeLinejoin: "round",
	points: "-5,-4 0,0 -5,4"
}), wn = ({ color: e = "none", strokeWidth: t = 1 }) => Y("polyline", {
	className: "arrowclosed",
	style: {
		strokeWidth: t,
		...e && {
			stroke: e,
			fill: e
		}
	},
	strokeLinecap: "round",
	strokeLinejoin: "round",
	points: "-5,-4 0,0 -5,4 -5,-4"
}), Tn = {
	[r.Arrow]: Cn,
	[r.ArrowClosed]: wn
};
function En(e) {
	let t = $();
	return K(() => Object.prototype.hasOwnProperty.call(Tn, e) ? Tn[e] : (t.getState().onError?.("009", x.error009(e)), null), [e]);
}
var Dn = ({ id: e, type: t, color: n, width: r = 12.5, height: i = 12.5, markerUnits: a = "strokeWidth", strokeWidth: o, orient: s = "auto-start-reverse" }) => {
	let c = En(t);
	return c ? Y("marker", {
		className: "react-flow__arrowhead",
		id: e,
		markerWidth: `${r}`,
		markerHeight: `${i}`,
		viewBox: "-10 -10 20 20",
		markerUnits: a,
		orient: s,
		refX: "0",
		refY: "0",
		children: Y(c, {
			color: n,
			strokeWidth: o
		})
	}) : null;
}, On = ({ defaultColor: e, rfId: t }) => {
	let n = Q((e) => e.edges), r = Q((e) => e.defaultEdgeOptions), i = K(() => _(n, {
		id: t,
		defaultColor: e,
		defaultMarkerStart: r?.markerStart,
		defaultMarkerEnd: r?.markerEnd
	}), [
		n,
		r,
		t,
		e
	]);
	return i.length ? Y("svg", {
		className: "react-flow__marker",
		"aria-hidden": "true",
		children: Y("defs", { children: i.map((e) => Y(Dn, {
			id: e.id,
			type: e.type,
			color: e.color,
			width: e.width,
			height: e.height,
			markerUnits: e.markerUnits,
			strokeWidth: e.strokeWidth,
			orient: e.orient
		}, e.id)) })
	}) : null;
};
On.displayName = "MarkerDefinitions";
var kn = U(On);
function An({ x: t, y: n, label: r, labelStyle: i, labelShowBg: a = !0, labelBgStyle: o, labelBgPadding: s = [2, 4], labelBgBorderRadius: c = 2, children: l, className: u, ...d }) {
	let [f, p] = J({
		x: 1,
		y: 0,
		width: 0,
		height: 0
	}), m = e(["react-flow__edge-textwrapper", u]), h = q(null);
	return G(() => {
		if (h.current) {
			let e = h.current.getBBox();
			p({
				x: e.x,
				y: e.y,
				width: e.width,
				height: e.height
			});
		}
	}, [r]), r ? X("g", {
		transform: `translate(${t - f.width / 2} ${n - f.height / 2})`,
		className: m,
		visibility: f.width ? "visible" : "hidden",
		...d,
		children: [
			a && Y("rect", {
				width: f.width + 2 * s[0],
				x: -s[0],
				y: -s[1],
				height: f.height + 2 * s[1],
				className: "react-flow__edge-textbg",
				style: o,
				rx: c,
				ry: c
			}),
			Y("text", {
				className: "react-flow__edge-text",
				y: f.height / 2,
				dy: "0.3em",
				ref: h,
				style: i,
				children: r
			}),
			l
		]
	}) : null;
}
An.displayName = "EdgeText";
var jn = U(An);
function Mn({ path: t, labelX: n, labelY: r, label: i, labelStyle: a, labelShowBg: o, labelBgStyle: s, labelBgPadding: c, labelBgBorderRadius: l, interactionWidth: u = 20, ...d }) {
	return X(De, { children: [
		Y("path", {
			...d,
			d: t,
			fill: "none",
			className: e(["react-flow__edge-path", d.className])
		}),
		u ? Y("path", {
			d: t,
			fill: "none",
			strokeOpacity: 0,
			strokeWidth: u,
			className: "react-flow__edge-interaction"
		}) : null,
		i && ue(n) && ue(r) ? Y(jn, {
			x: n,
			y: r,
			label: i,
			labelStyle: a,
			labelShowBg: o,
			labelBgStyle: s,
			labelBgPadding: c,
			labelBgBorderRadius: l
		}) : null
	] });
}
function Nn({ pos: e, x1: t, y1: n, x2: r, y2: i }) {
	return e === a.Left || e === a.Right ? [.5 * (t + r), n] : [t, .5 * (n + i)];
}
function Pn({ sourceX: e, sourceY: t, sourcePosition: n = a.Bottom, targetX: r, targetY: i, targetPosition: o = a.Top }) {
	let [s, c] = Nn({
		pos: n,
		x1: e,
		y1: t,
		x2: r,
		y2: i
	}), [l, u] = Nn({
		pos: o,
		x1: r,
		y1: i,
		x2: e,
		y2: t
	}), [d, f, p, m] = w({
		sourceX: e,
		sourceY: t,
		targetX: r,
		targetY: i,
		sourceControlX: s,
		sourceControlY: c,
		targetControlX: l,
		targetControlY: u
	});
	return [
		`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,
		d,
		f,
		p,
		m
	];
}
function Fn(e) {
	return U(({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: a, sourcePosition: o, targetPosition: s, label: c, labelStyle: l, labelShowBg: u, labelBgStyle: d, labelBgPadding: f, labelBgBorderRadius: p, style: m, markerEnd: h, markerStart: g, interactionWidth: _ }) => {
		let [v, y, b] = Pn({
			sourceX: n,
			sourceY: r,
			sourcePosition: o,
			targetX: i,
			targetY: a,
			targetPosition: s
		});
		return Y(Mn, {
			id: e.isInternal ? void 0 : t,
			path: v,
			labelX: y,
			labelY: b,
			label: c,
			labelStyle: l,
			labelShowBg: u,
			labelBgStyle: d,
			labelBgPadding: f,
			labelBgBorderRadius: p,
			style: m,
			markerEnd: h,
			markerStart: g,
			interactionWidth: _
		});
	});
}
var In = Fn({ isInternal: !1 }), Ln = Fn({ isInternal: !0 });
In.displayName = "SimpleBezierEdge", Ln.displayName = "SimpleBezierEdgeInternal";
function Rn(e) {
	return U(({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: o, label: s, labelStyle: c, labelShowBg: l, labelBgStyle: u, labelBgPadding: d, labelBgBorderRadius: f, style: p, sourcePosition: m = a.Bottom, targetPosition: h = a.Top, markerEnd: g, markerStart: _, pathOptions: v, interactionWidth: y }) => {
		let [b, x, S] = B({
			sourceX: n,
			sourceY: r,
			sourcePosition: m,
			targetX: i,
			targetY: o,
			targetPosition: h,
			borderRadius: v?.borderRadius,
			offset: v?.offset,
			stepPosition: v?.stepPosition
		});
		return Y(Mn, {
			id: e.isInternal ? void 0 : t,
			path: b,
			labelX: x,
			labelY: S,
			label: s,
			labelStyle: c,
			labelShowBg: l,
			labelBgStyle: u,
			labelBgPadding: d,
			labelBgBorderRadius: f,
			style: p,
			markerEnd: g,
			markerStart: _,
			interactionWidth: y
		});
	});
}
var zn = Rn({ isInternal: !1 }), Bn = Rn({ isInternal: !0 });
zn.displayName = "SmoothStepEdge", Bn.displayName = "SmoothStepEdgeInternal";
function Vn(e) {
	return U(({ id: t, ...n }) => {
		let r = e.isInternal ? void 0 : t;
		return Y(zn, {
			...n,
			id: r,
			pathOptions: K(() => ({
				borderRadius: 0,
				offset: n.pathOptions?.offset
			}), [n.pathOptions?.offset])
		});
	});
}
var Hn = Vn({ isInternal: !1 }), Un = Vn({ isInternal: !0 });
Hn.displayName = "StepEdge", Un.displayName = "StepEdgeInternal";
function Wn(e) {
	return U(({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: a, label: o, labelStyle: s, labelShowBg: c, labelBgStyle: l, labelBgPadding: u, labelBgBorderRadius: d, style: f, markerEnd: p, markerStart: m, interactionWidth: h }) => {
		let [g, _, v] = V({
			sourceX: n,
			sourceY: r,
			targetX: i,
			targetY: a
		});
		return Y(Mn, {
			id: e.isInternal ? void 0 : t,
			path: g,
			labelX: _,
			labelY: v,
			label: o,
			labelStyle: s,
			labelShowBg: c,
			labelBgStyle: l,
			labelBgPadding: u,
			labelBgBorderRadius: d,
			style: f,
			markerEnd: p,
			markerStart: m,
			interactionWidth: h
		});
	});
}
var Gn = Wn({ isInternal: !1 }), Kn = Wn({ isInternal: !0 });
Gn.displayName = "StraightEdge", Kn.displayName = "StraightEdgeInternal";
function qn(e) {
	return U(({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: o, sourcePosition: s = a.Bottom, targetPosition: c = a.Top, label: l, labelStyle: u, labelShowBg: d, labelBgStyle: f, labelBgPadding: p, labelBgBorderRadius: m, style: h, markerEnd: g, markerStart: _, pathOptions: v, interactionWidth: y }) => {
		let [b, x, S] = T({
			sourceX: n,
			sourceY: r,
			sourcePosition: s,
			targetX: i,
			targetY: o,
			targetPosition: c,
			curvature: v?.curvature
		});
		return Y(Mn, {
			id: e.isInternal ? void 0 : t,
			path: b,
			labelX: x,
			labelY: S,
			label: l,
			labelStyle: u,
			labelShowBg: d,
			labelBgStyle: f,
			labelBgPadding: p,
			labelBgBorderRadius: m,
			style: h,
			markerEnd: g,
			markerStart: _,
			interactionWidth: y
		});
	});
}
var Jn = qn({ isInternal: !1 }), Yn = qn({ isInternal: !0 });
Jn.displayName = "BezierEdge", Yn.displayName = "BezierEdgeInternal";
var Xn = {
	default: Yn,
	straight: Kn,
	step: Un,
	smoothstep: Bn,
	simplebezier: Ln
}, Zn = {
	sourceX: null,
	sourceY: null,
	targetX: null,
	targetY: null,
	sourcePosition: null,
	targetPosition: null
}, Qn = (e, t, n) => n === a.Left ? e - t : n === a.Right ? e + t : e, $n = (e, t, n) => n === a.Top ? e - t : n === a.Bottom ? e + t : e, er = "react-flow__edgeupdater";
function tr({ position: t, centerX: n, centerY: r, radius: i = 10, onMouseDown: a, onMouseEnter: o, onMouseOut: s, type: c }) {
	return Y("circle", {
		onMouseDown: a,
		onMouseEnter: o,
		onMouseOut: s,
		className: e([er, `${er}-${c}`]),
		cx: Qn(n, i, t),
		cy: $n(r, i, t),
		r: i,
		stroke: "transparent",
		fill: "transparent"
	});
}
function nr({ isReconnectable: e, reconnectRadius: t, edge: n, sourceX: r, sourceY: i, targetX: a, targetY: o, sourcePosition: s, targetPosition: c, onReconnect: u, onReconnectStart: d, onReconnectEnd: f, setReconnecting: p, setUpdateHover: m }) {
	let h = $(), g = (e, t) => {
		if (e.button !== 0) return;
		let { autoPanOnConnect: r, domNode: i, connectionMode: a, connectionRadius: o, lib: s, onConnectStart: c, cancelConnection: m, nodeLookup: g, rfId: _, panBy: v, updateConnection: y } = h.getState(), b = t.type === "target";
		l.onPointerDown(e.nativeEvent, {
			autoPanOnConnect: r,
			connectionMode: a,
			connectionRadius: o,
			domNode: i,
			handleId: t.id,
			nodeId: t.nodeId,
			nodeLookup: g,
			isTarget: b,
			edgeUpdaterType: t.type,
			lib: s,
			flowId: _,
			cancelConnection: m,
			panBy: v,
			isValidConnection: (...e) => h.getState().isValidConnection?.(...e) ?? !0,
			onConnect: (e) => u?.(n, e),
			onConnectStart: (r, i) => {
				p(!0), d?.(e, n, t.type), c?.(r, i);
			},
			onConnectEnd: (...e) => h.getState().onConnectEnd?.(...e),
			onReconnectEnd: (e, r) => {
				p(!1), f?.(e, n, t.type, r);
			},
			updateConnection: y,
			getTransform: () => h.getState().transform,
			getFromHandle: () => h.getState().connection.fromHandle,
			dragThreshold: h.getState().connectionDragThreshold,
			handleDomNode: e.currentTarget
		});
	}, _ = (e) => g(e, {
		nodeId: n.target,
		id: n.targetHandle ?? null,
		type: "target"
	}), v = (e) => g(e, {
		nodeId: n.source,
		id: n.sourceHandle ?? null,
		type: "source"
	}), y = () => m(!0), b = () => m(!1);
	return X(De, { children: [(e === !0 || e === "source") && Y(tr, {
		position: s,
		centerX: r,
		centerY: i,
		radius: t,
		onMouseDown: _,
		onMouseEnter: y,
		onMouseOut: b,
		type: "source"
	}), (e === !0 || e === "target") && Y(tr, {
		position: c,
		centerX: a,
		centerY: o,
		radius: t,
		onMouseDown: v,
		onMouseEnter: y,
		onMouseOut: b,
		type: "target"
	})] });
}
function rr({ id: t, edgesFocusable: n, edgesReconnectable: r, elementsSelectable: i, onClick: a, onDoubleClick: o, onContextMenu: s, onMouseEnter: c, onMouseMove: l, onMouseLeave: u, reconnectRadius: d, onReconnect: f, onReconnectStart: p, onReconnectEnd: m, rfId: h, edgeTypes: g, noPanClassName: _, onError: v, disableKeyboardA11y: y }) {
	let S = Q((e) => e.edgeLookup.get(t)), C = Q((e) => e.defaultEdgeOptions);
	S = C ? {
		...C,
		...S
	} : S;
	let w = S.type || "default", T = g?.[w] || Xn[w];
	T === void 0 && (v?.("011", x.error011(w)), w = "default", T = g?.default || Xn.default);
	let E = !!(S.focusable || n && S.focusable === void 0), D = f !== void 0 && (S.reconnectable || r && S.reconnectable === void 0), O = !!(S.selectable || i && S.selectable === void 0), A = q(null), [M, N] = J(!1), [P, F] = J(!1), I = $(), { zIndex: L, sourceX: R, sourceY: z, targetX: B, targetY: V, sourcePosition: H, targetPosition: te } = Q(W((e) => {
		let n = e.nodeLookup.get(S.source), r = e.nodeLookup.get(S.target);
		if (!n || !r) return {
			zIndex: S.zIndex,
			...Zn
		};
		let i = k({
			id: t,
			sourceNode: n,
			targetNode: r,
			sourceHandle: S.sourceHandle || null,
			targetHandle: S.targetHandle || null,
			connectionMode: e.connectionMode,
			onError: v
		});
		return {
			zIndex: j({
				selected: S.selected,
				zIndex: S.zIndex,
				sourceNode: n,
				targetNode: r,
				elevateOnSelect: e.elevateEdgesOnSelect,
				zIndexMode: e.zIndexMode
			}),
			...i || Zn
		};
	}, [
		S.source,
		S.target,
		S.sourceHandle,
		S.targetHandle,
		S.selected,
		S.zIndex
	]), Z), ne = K(() => S.markerStart ? `url('#${ee(S.markerStart, h)}')` : void 0, [S.markerStart, h]), re = K(() => S.markerEnd ? `url('#${ee(S.markerEnd, h)}')` : void 0, [S.markerEnd, h]);
	if (S.hidden || R === null || z === null || B === null || V === null) return null;
	let ie = (e) => {
		let { addSelectedEdges: n, unselectNodesAndEdges: r, multiSelectionActive: i } = I.getState();
		O && (I.setState({ nodesSelectionActive: !1 }), S.selected && i ? (r({
			nodes: [],
			edges: [S]
		}), A.current?.blur()) : n([t])), a && a(e, S);
	}, ae = o ? (e) => {
		o(e, { ...S });
	} : void 0, oe = s ? (e) => {
		s(e, { ...S });
	} : void 0, se = c ? (e) => {
		c(e, { ...S });
	} : void 0, ce = l ? (e) => {
		l(e, { ...S });
	} : void 0, le = u ? (e) => {
		u(e, { ...S });
	} : void 0;
	return Y("svg", {
		style: { zIndex: L },
		children: X("g", {
			className: e([
				"react-flow__edge",
				`react-flow__edge-${w}`,
				S.className,
				_,
				{
					selected: S.selected,
					animated: S.animated,
					inactive: !O && !a,
					updating: M,
					selectable: O
				}
			]),
			onClick: ie,
			onDoubleClick: ae,
			onContextMenu: oe,
			onMouseEnter: se,
			onMouseMove: ce,
			onMouseLeave: le,
			onKeyDown: E ? (e) => {
				if (!y && b.includes(e.key) && O) {
					let { unselectNodesAndEdges: n, addSelectedEdges: r } = I.getState();
					e.key === "Escape" ? (A.current?.blur(), n({ edges: [S] })) : r([t]);
				}
			} : void 0,
			tabIndex: E ? 0 : void 0,
			role: S.ariaRole ?? (E ? "group" : "img"),
			"aria-roledescription": "edge",
			"data-id": t,
			"data-testid": `rf__edge-${t}`,
			"aria-label": S.ariaLabel === null ? void 0 : S.ariaLabel || `Edge from ${S.source} to ${S.target}`,
			"aria-describedby": E ? `${Le}-${h}` : void 0,
			ref: A,
			...S.domAttributes,
			children: [!P && Y(T, {
				id: t,
				source: S.source,
				target: S.target,
				type: S.type,
				selected: S.selected,
				animated: S.animated,
				selectable: O,
				deletable: S.deletable ?? !0,
				label: S.label,
				labelStyle: S.labelStyle,
				labelShowBg: S.labelShowBg,
				labelBgStyle: S.labelBgStyle,
				labelBgPadding: S.labelBgPadding,
				labelBgBorderRadius: S.labelBgBorderRadius,
				sourceX: R,
				sourceY: z,
				targetX: B,
				targetY: V,
				sourcePosition: H,
				targetPosition: te,
				data: S.data,
				style: S.style,
				sourceHandleId: S.sourceHandle,
				targetHandleId: S.targetHandle,
				markerStart: ne,
				markerEnd: re,
				pathOptions: "pathOptions" in S ? S.pathOptions : void 0,
				interactionWidth: S.interactionWidth
			}), D && Y(nr, {
				edge: S,
				isReconnectable: D,
				reconnectRadius: d,
				onReconnect: f,
				onReconnectStart: p,
				onReconnectEnd: m,
				sourceX: R,
				sourceY: z,
				targetX: B,
				targetY: V,
				sourcePosition: H,
				targetPosition: te,
				setUpdateHover: N,
				setReconnecting: F
			})]
		})
	});
}
var ir = U(rr), ar = (e) => ({
	edgesFocusable: e.edgesFocusable,
	edgesReconnectable: e.edgesReconnectable,
	elementsSelectable: e.elementsSelectable,
	connectionMode: e.connectionMode,
	onError: e.onError
});
function or({ defaultMarkerColor: e, onlyRenderVisibleElements: t, rfId: n, edgeTypes: r, noPanClassName: i, onReconnect: a, onEdgeContextMenu: o, onEdgeMouseEnter: s, onEdgeMouseMove: c, onEdgeMouseLeave: l, onEdgeClick: u, reconnectRadius: d, onEdgeDoubleClick: f, onReconnectStart: p, onReconnectEnd: m, disableKeyboardA11y: h }) {
	let { edgesFocusable: g, edgesReconnectable: _, elementsSelectable: v, onError: y } = Q(ar, Z), b = Sn(t);
	return X("div", {
		className: "react-flow__edges",
		children: [Y(kn, {
			defaultColor: e,
			rfId: n
		}), b.map((e) => Y(ir, {
			id: e,
			edgesFocusable: g,
			edgesReconnectable: _,
			elementsSelectable: v,
			noPanClassName: i,
			onReconnect: a,
			onContextMenu: o,
			onMouseEnter: s,
			onMouseMove: c,
			onMouseLeave: l,
			onClick: u,
			reconnectRadius: d,
			onDoubleClick: f,
			onReconnectStart: p,
			onReconnectEnd: m,
			rfId: n,
			onError: y,
			edgeTypes: r,
			disableKeyboardA11y: h
		}, e))]
	});
}
or.displayName = "EdgeRenderer";
var sr = U(or), cr = (e) => `translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;
function lr({ children: e }) {
	return Y("div", {
		className: "react-flow__viewport xyflow__viewport react-flow__container",
		style: { transform: Q(cr) },
		children: e
	});
}
function ur(e) {
	let t = Ot(), n = q(!1);
	G(() => {
		!n.current && t.viewportInitialized && e && (setTimeout(() => e(t), 1), n.current = !0);
	}, [e, t.viewportInitialized]);
}
var dr = (e) => e.panZoom?.syncViewport;
function fr(e) {
	let t = Q(dr), n = $();
	return G(() => {
		e && (t?.(e), n.setState({ transform: [
			e.x,
			e.y,
			e.zoom
		] }));
	}, [e, t]), null;
}
function pr(e) {
	return e.connection.inProgress ? {
		...e.connection,
		to: ge(e.connection.to, e.transform)
	} : { ...e.connection };
}
function mr(e) {
	return e ? (t) => e(pr(t)) : pr;
}
function hr(e) {
	return Q(mr(e), Z);
}
var gr = (e) => ({
	nodesConnectable: e.nodesConnectable,
	isValid: e.connection.isValid,
	inProgress: e.connection.inProgress,
	width: e.width,
	height: e.height
});
function _r({ containerStyle: t, style: n, type: r, component: i }) {
	let { nodesConnectable: a, width: o, height: s, isValid: c, inProgress: l } = Q(gr, Z);
	return o && a && l ? Y("svg", {
		style: t,
		width: o,
		height: s,
		className: "react-flow__connectionline react-flow__container",
		children: Y("g", {
			className: e(["react-flow__connection", D(c)]),
			children: Y(vr, {
				style: n,
				type: r,
				CustomComponent: i,
				isValid: c
			})
		})
	}) : null;
}
var vr = ({ style: e, type: n = t.Bezier, CustomComponent: r, isValid: i }) => {
	let { inProgress: a, from: o, fromNode: s, fromHandle: c, fromPosition: l, to: u, toNode: d, toHandle: f, toPosition: p, pointer: m } = hr();
	if (!a) return;
	if (r) return Y(r, {
		connectionLineType: n,
		connectionLineStyle: e,
		fromNode: s,
		fromHandle: c,
		fromX: o.x,
		fromY: o.y,
		toX: u.x,
		toY: u.y,
		fromPosition: l,
		toPosition: p,
		connectionStatus: D(i),
		toNode: d,
		toHandle: f,
		pointer: m
	});
	let h = "", g = {
		sourceX: o.x,
		sourceY: o.y,
		sourcePosition: l,
		targetX: u.x,
		targetY: u.y,
		targetPosition: p
	};
	switch (n) {
		case t.Bezier:
			[h] = T(g);
			break;
		case t.SimpleBezier:
			[h] = Pn(g);
			break;
		case t.Step:
			[h] = B({
				...g,
				borderRadius: 0
			});
			break;
		case t.SmoothStep:
			[h] = B(g);
			break;
		default: [h] = V(g);
	}
	return Y("path", {
		d: h,
		fill: "none",
		className: "react-flow__connection-path",
		style: e
	});
};
vr.displayName = "ConnectionLine";
var yr = {};
function br(e = yr) {
	let t = q(e), n = $();
	G(() => {
		if (process.env.NODE_ENV === "development") {
			let r = new Set([...Object.keys(t.current), ...Object.keys(e)]);
			for (let i of r) if (t.current[i] !== e[i]) {
				n.getState().onError?.("002", x.error002());
				break;
			}
			t.current = e;
		}
	}, [e]);
}
function xr() {
	let e = $(), t = q(!1);
	G(() => {
		if (process.env.NODE_ENV === "development" && !t.current) {
			let n = document.querySelector(".react-flow__pane");
			n && window.getComputedStyle(n).zIndex !== "1" && e.getState().onError?.("013", x.error013("react")), t.current = !0;
		}
	}, []);
}
function Sr({ nodeTypes: e, edgeTypes: t, onInit: n, onNodeClick: r, onEdgeClick: i, onNodeDoubleClick: a, onEdgeDoubleClick: o, onNodeMouseEnter: s, onNodeMouseMove: c, onNodeMouseLeave: l, onNodeContextMenu: u, onSelectionContextMenu: d, onSelectionStart: f, onSelectionEnd: p, connectionLineType: m, connectionLineStyle: h, connectionLineComponent: g, connectionLineContainerStyle: _, selectionKeyCode: v, selectionOnDrag: y, selectionMode: b, multiSelectionKeyCode: x, panActivationKeyCode: S, zoomActivationKeyCode: C, deleteKeyCode: w, onlyRenderVisibleElements: T, elementsSelectable: E, defaultViewport: D, translateExtent: O, minZoom: k, maxZoom: A, preventScrolling: j, defaultMarkerColor: M, zoomOnScroll: N, zoomOnPinch: P, panOnScroll: F, panOnScrollSpeed: ee, panOnScrollMode: I, zoomOnDoubleClick: L, panOnDrag: R, onPaneClick: z, onPaneMouseEnter: B, onPaneMouseMove: V, onPaneMouseLeave: H, onPaneScroll: te, onPaneContextMenu: ne, paneClickDistance: re, nodeClickDistance: ie, onEdgeContextMenu: ae, onEdgeMouseEnter: oe, onEdgeMouseMove: se, onEdgeMouseLeave: ce, reconnectRadius: le, onReconnect: ue, onReconnectStart: de, onReconnectEnd: fe, noDragClassName: pe, noWheelClassName: me, noPanClassName: he, disableKeyboardA11y: ge, nodeExtent: _e, rfId: ve, viewport: ye, onViewportChange: be }) {
	return br(e), br(t), xr(), ur(n), fr(ye), Y(dn, {
		onPaneClick: z,
		onPaneMouseEnter: B,
		onPaneMouseMove: V,
		onPaneMouseLeave: H,
		onPaneContextMenu: ne,
		onPaneScroll: te,
		paneClickDistance: re,
		deleteKeyCode: w,
		selectionKeyCode: v,
		selectionOnDrag: y,
		selectionMode: b,
		onSelectionStart: f,
		onSelectionEnd: p,
		multiSelectionKeyCode: x,
		panActivationKeyCode: S,
		zoomActivationKeyCode: C,
		elementsSelectable: E,
		zoomOnScroll: N,
		zoomOnPinch: P,
		zoomOnDoubleClick: L,
		panOnScroll: F,
		panOnScrollSpeed: ee,
		panOnScrollMode: I,
		panOnDrag: R,
		defaultViewport: D,
		translateExtent: O,
		minZoom: k,
		maxZoom: A,
		onSelectionContextMenu: d,
		preventScrolling: j,
		noDragClassName: pe,
		noWheelClassName: me,
		noPanClassName: he,
		disableKeyboardA11y: ge,
		onViewportChange: be,
		isControlledViewport: !!ye,
		children: X(lr, { children: [
			Y(sr, {
				edgeTypes: t,
				onEdgeClick: i,
				onEdgeDoubleClick: o,
				onReconnect: ue,
				onReconnectStart: de,
				onReconnectEnd: fe,
				onlyRenderVisibleElements: T,
				onEdgeContextMenu: ae,
				onEdgeMouseEnter: oe,
				onEdgeMouseMove: se,
				onEdgeMouseLeave: ce,
				reconnectRadius: le,
				defaultMarkerColor: M,
				noPanClassName: he,
				disableKeyboardA11y: ge,
				rfId: ve
			}),
			Y(_r, {
				style: h,
				type: m,
				component: g,
				containerStyle: _
			}),
			Y("div", { className: "react-flow__edgelabel-renderer" }),
			Y(xn, {
				nodeTypes: e,
				onNodeClick: r,
				onNodeDoubleClick: a,
				onNodeMouseEnter: s,
				onNodeMouseMove: c,
				onNodeMouseLeave: l,
				onNodeContextMenu: u,
				nodeClickDistance: ie,
				onlyRenderVisibleElements: T,
				noPanClassName: he,
				noDragClassName: pe,
				disableKeyboardA11y: ge,
				nodeExtent: _e,
				rfId: ve
			}),
			Y("div", { className: "react-flow__viewport-portal" })
		] })
	});
}
Sr.displayName = "GraphView";
var Cr = U(Sr), wr = ({ nodes: e, edges: t, defaultNodes: r, defaultEdges: i, width: a, height: o, fitView: s, fitViewOptions: c, minZoom: l = .5, maxZoom: u = 2, nodeOrigin: d, nodeExtent: f, zIndexMode: p = "basic" } = {}) => {
	let h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), x = i ?? t ?? [], S = r ?? e ?? [], C = d ?? [0, 0], w = f ?? ne;
	be(_, b, x);
	let { nodesInitialized: T } = m(S, h, g, {
		nodeOrigin: C,
		nodeExtent: w,
		zIndexMode: p
	}), E = [
		0,
		0,
		1
	];
	if (s && a && o) {
		let { x: e, y: t, zoom: n } = H(F(h, { filter: (e) => !!((e.width || e.initialWidth) && (e.height || e.initialHeight)) }), a, o, l, u, c?.padding ?? .1);
		E = [
			e,
			t,
			n
		];
	}
	return {
		rfId: "1",
		width: a ?? 0,
		height: o ?? 0,
		transform: E,
		nodes: S,
		nodesInitialized: T,
		nodeLookup: h,
		parentLookup: g,
		edges: x,
		edgeLookup: b,
		connectionLookup: _,
		onNodesChange: null,
		onEdgesChange: null,
		hasDefaultNodes: r !== void 0,
		hasDefaultEdges: i !== void 0,
		panZoom: null,
		minZoom: l,
		maxZoom: u,
		translateExtent: ne,
		nodeExtent: w,
		nodesSelectionActive: !1,
		userSelectionActive: !1,
		userSelectionRect: null,
		connectionMode: n.Strict,
		domNode: null,
		paneDragging: !1,
		noPanClassName: "nopan",
		nodeOrigin: C,
		nodeDragThreshold: 1,
		connectionDragThreshold: 1,
		snapGrid: [15, 15],
		snapToGrid: !1,
		nodesDraggable: !0,
		nodesConnectable: !0,
		nodesFocusable: !0,
		edgesFocusable: !0,
		edgesReconnectable: !0,
		elementsSelectable: !0,
		elevateNodesOnSelect: !0,
		elevateEdgesOnSelect: !0,
		selectNodesOnDrag: !0,
		multiSelectionActive: !1,
		fitViewQueued: s ?? !1,
		fitViewOptions: c,
		fitViewResolver: null,
		connection: { ...re },
		connectionClickStartHandle: null,
		connectOnClick: !0,
		ariaLiveMessage: "",
		autoPanOnConnect: !0,
		autoPanOnNodeDrag: !0,
		autoPanOnNodeFocus: !0,
		autoPanSpeed: 15,
		connectionRadius: 20,
		onError: y,
		isValidConnection: void 0,
		onSelectionChangeHandlers: [],
		lib: "react",
		debug: !1,
		ariaLabelConfig: v,
		zIndexMode: p,
		onNodesChangeMiddlewareMap: /* @__PURE__ */ new Map(),
		onEdgesChangeMiddlewareMap: /* @__PURE__ */ new Map()
	};
}, Tr = ({ nodes: e, edges: t, defaultNodes: n, defaultEdges: r, width: i, height: o, fitView: s, fitViewOptions: c, minZoom: l, maxZoom: u, nodeOrigin: d, nodeExtent: f, zIndexMode: p }) => ke((h, g) => {
	async function _() {
		let { nodeLookup: e, panZoom: t, fitViewOptions: n, fitViewResolver: r, width: i, height: a, minZoom: o, maxZoom: s } = g();
		t && (await C({
			nodes: e,
			width: i,
			height: a,
			panZoom: t,
			minZoom: o,
			maxZoom: s
		}, n), r?.resolve(!0), h({ fitViewResolver: null }));
	}
	return {
		...wr({
			nodes: e,
			edges: t,
			width: i,
			height: o,
			fitView: s,
			fitViewOptions: c,
			minZoom: l,
			maxZoom: u,
			nodeOrigin: d,
			nodeExtent: f,
			defaultNodes: n,
			defaultEdges: r,
			zIndexMode: p
		}),
		setNodes: (e) => {
			let { nodeLookup: t, parentLookup: n, nodeOrigin: r, elevateNodesOnSelect: i, fitViewQueued: a, zIndexMode: o, nodesSelectionActive: s } = g(), { nodesInitialized: c, hasSelectedNodes: l } = m(e, t, n, {
				nodeOrigin: r,
				nodeExtent: f,
				elevateNodesOnSelect: i,
				checkEquality: !0,
				zIndexMode: o
			}), u = s && l;
			a && c ? (_(), h({
				nodes: e,
				nodesInitialized: c,
				fitViewQueued: !1,
				fitViewOptions: void 0,
				nodesSelectionActive: u
			})) : h({
				nodes: e,
				nodesInitialized: c,
				nodesSelectionActive: u
			});
		},
		setEdges: (e) => {
			let { connectionLookup: t, edgeLookup: n } = g();
			be(t, n, e), h({ edges: e });
		},
		setDefaultNodesAndEdges: (e, t) => {
			if (e) {
				let { setNodes: t } = g();
				t(e), h({ hasDefaultNodes: !0 });
			}
			if (t) {
				let { setEdges: e } = g();
				e(t), h({ hasDefaultEdges: !0 });
			}
		},
		updateNodeInternals: (e) => {
			let { triggerNodeChanges: t, nodeLookup: n, parentLookup: r, domNode: i, nodeOrigin: a, nodeExtent: o, debug: s, fitViewQueued: c, zIndexMode: l } = g(), { changes: u, updatedInternals: d } = xe(e, n, r, i, a, o, l);
			d && (ye(n, r, {
				nodeOrigin: a,
				nodeExtent: o,
				zIndexMode: l
			}), c ? (_(), h({
				fitViewQueued: !1,
				fitViewOptions: void 0
			})) : h({}), u?.length > 0 && (s && console.log("React Flow: trigger node changes", u), t?.(u)));
		},
		updateNodePositions: (e, t = !1) => {
			let n = [], r = [], { nodeLookup: i, triggerNodeChanges: o, connection: s, updateConnection: c, onNodesChangeMiddlewareMap: l } = g();
			for (let [o, l] of e) {
				let e = i.get(o), u = !!(e?.expandParent && e?.parentId && l?.position), d = {
					id: o,
					type: "position",
					position: u ? {
						x: Math.max(0, l.position.x),
						y: Math.max(0, l.position.y)
					} : l.position,
					dragging: t
				};
				if (e && s.inProgress && s.fromNode.id === e.id) {
					let t = N(e, s.fromHandle, a.Left, !0);
					c({
						...s,
						from: t
					});
				}
				u && e.parentId && n.push({
					id: o,
					parentId: e.parentId,
					rect: {
						...l.internals.positionAbsolute,
						width: l.measured.width ?? 0,
						height: l.measured.height ?? 0
					}
				}), r.push(d);
			}
			if (n.length > 0) {
				let { parentLookup: e, nodeOrigin: t } = g(), a = te(n, i, e, t);
				r.push(...a);
			}
			for (let e of l.values()) r = e(r);
			o(r);
		},
		triggerNodeChanges: (e) => {
			let { onNodesChange: t, setNodes: n, nodes: r, hasDefaultNodes: i, debug: a } = g();
			e?.length && (i && n(pt(e, r)), a && console.log("React Flow: trigger node changes", e), t?.(e));
		},
		triggerEdgeChanges: (e) => {
			let { onEdgesChange: t, setEdges: n, edges: r, hasDefaultEdges: i, debug: a } = g();
			e?.length && (i && n(mt(e, r)), a && console.log("React Flow: trigger edge changes", e), t?.(e));
		},
		addSelectedNodes: (e) => {
			let { multiSelectionActive: t, edgeLookup: n, nodeLookup: r, triggerNodeChanges: i, triggerEdgeChanges: a } = g();
			if (t) {
				i(e.map((e) => ht(e, !0)));
				return;
			}
			i(gt(r, new Set([...e]), !0)), a(gt(n));
		},
		addSelectedEdges: (e) => {
			let { multiSelectionActive: t, edgeLookup: n, nodeLookup: r, triggerNodeChanges: i, triggerEdgeChanges: a } = g();
			if (t) {
				a(e.map((e) => ht(e, !0)));
				return;
			}
			a(gt(n, new Set([...e]))), i(gt(r, /* @__PURE__ */ new Set(), !0));
		},
		unselectNodesAndEdges: ({ nodes: e, edges: t } = {}) => {
			let { edges: n, nodes: r, nodeLookup: i, triggerNodeChanges: a, triggerEdgeChanges: o } = g(), s = e || r, c = t || n, l = [];
			for (let e of s) {
				if (!e.selected) continue;
				let t = i.get(e.id);
				t && (t.selected = !1), l.push(ht(e.id, !1));
			}
			let u = [];
			for (let e of c) e.selected && u.push(ht(e.id, !1));
			a(l), o(u);
		},
		setMinZoom: (e) => {
			let { panZoom: t, maxZoom: n } = g();
			t?.setScaleExtent([e, n]), h({ minZoom: e });
		},
		setMaxZoom: (e) => {
			let { panZoom: t, minZoom: n } = g();
			t?.setScaleExtent([n, e]), h({ maxZoom: e });
		},
		setTranslateExtent: (e) => {
			g().panZoom?.setTranslateExtent(e), h({ translateExtent: e });
		},
		resetSelectedElements: () => {
			let { edges: e, nodes: t, triggerNodeChanges: n, triggerEdgeChanges: r, elementsSelectable: i } = g();
			if (!i) return;
			let a = t.reduce((e, t) => t.selected ? [...e, ht(t.id, !1)] : e, []), o = e.reduce((e, t) => t.selected ? [...e, ht(t.id, !1)] : e, []);
			n(a), r(o);
		},
		setNodeExtent: (e) => {
			let { nodes: t, nodeLookup: n, parentLookup: r, nodeOrigin: i, elevateNodesOnSelect: a, nodeExtent: o, zIndexMode: s } = g();
			e[0][0] === o[0][0] && e[0][1] === o[0][1] && e[1][0] === o[1][0] && e[1][1] === o[1][1] || (m(t, n, r, {
				nodeOrigin: i,
				nodeExtent: e,
				elevateNodesOnSelect: a,
				checkEquality: !1,
				zIndexMode: s
			}), h({ nodeExtent: e }));
		},
		panBy: (e) => {
			let { transform: t, width: n, height: r, panZoom: i, translateExtent: a } = g();
			return he({
				delta: e,
				panZoom: i,
				transform: t,
				translateExtent: a,
				width: n,
				height: r
			});
		},
		setCenter: async (e, t, n) => {
			let { width: r, height: i, maxZoom: a, panZoom: o } = g();
			if (!o) return Promise.resolve(!1);
			let s = n?.zoom === void 0 ? a : n.zoom;
			return await o.setViewport({
				x: r / 2 - e * s,
				y: i / 2 - t * s,
				zoom: s
			}, {
				duration: n?.duration,
				ease: n?.ease,
				interpolate: n?.interpolate
			}), Promise.resolve(!0);
		},
		cancelConnection: () => {
			h({ connection: { ...re } });
		},
		updateConnection: (e) => {
			h({ connection: e });
		},
		reset: () => h({ ...wr() })
	};
}, Object.is);
function Er({ initialNodes: e, initialEdges: t, defaultNodes: n, defaultEdges: r, initialWidth: i, initialHeight: a, initialMinZoom: o, initialMaxZoom: s, initialFitViewOptions: c, fitView: l, nodeOrigin: u, nodeExtent: d, zIndexMode: f, children: p }) {
	let [m] = J(() => Tr({
		nodes: e,
		edges: t,
		defaultNodes: n,
		defaultEdges: r,
		width: i,
		height: a,
		fitView: l,
		minZoom: o,
		maxZoom: s,
		fitViewOptions: c,
		nodeOrigin: u,
		nodeExtent: d,
		zIndexMode: f
	}));
	return Y(Me, {
		value: m,
		children: Y(Tt, { children: p })
	});
}
function Dr({ children: e, nodes: t, edges: n, defaultNodes: r, defaultEdges: i, width: a, height: o, fitView: s, fitViewOptions: c, minZoom: l, maxZoom: u, nodeOrigin: d, nodeExtent: f, zIndexMode: p }) {
	return Te(je) ? Y(De, { children: e }) : Y(Er, {
		initialNodes: t,
		initialEdges: n,
		defaultNodes: r,
		defaultEdges: i,
		initialWidth: a,
		initialHeight: o,
		fitView: s,
		initialFitViewOptions: c,
		initialMinZoom: l,
		initialMaxZoom: u,
		nodeOrigin: d,
		nodeExtent: f,
		zIndexMode: p,
		children: e
	});
}
var Or = {
	width: "100%",
	height: "100%",
	overflow: "hidden",
	position: "relative",
	zIndex: 0
};
function kr({ nodes: n, edges: r, defaultNodes: a, defaultEdges: o, className: c, nodeTypes: l, edgeTypes: u, onNodeClick: d, onEdgeClick: f, onInit: p, onMove: m, onMoveStart: h, onMoveEnd: g, onConnect: _, onConnectStart: v, onConnectEnd: y, onClickConnectStart: b, onClickConnectEnd: x, onNodeMouseEnter: S, onNodeMouseMove: C, onNodeMouseLeave: w, onNodeContextMenu: T, onNodeDoubleClick: E, onNodeDragStart: D, onNodeDrag: O, onNodeDragStop: k, onNodesDelete: A, onEdgesDelete: j, onDelete: M, onSelectionChange: N, onSelectionDragStart: P, onSelectionDrag: F, onSelectionDragStop: ee, onSelectionContextMenu: I, onSelectionStart: L, onSelectionEnd: R, onBeforeDelete: z, connectionMode: B, connectionLineType: V = t.Bezier, connectionLineStyle: H, connectionLineComponent: te, connectionLineContainerStyle: re, deleteKeyCode: ie = "Backspace", selectionKeyCode: ae = "Shift", selectionOnDrag: oe = !1, selectionMode: ce = s.Full, panActivationKeyCode: le = "Space", multiSelectionKeyCode: ue = se() ? "Meta" : "Control", zoomActivationKeyCode: de = se() ? "Meta" : "Control", snapToGrid: fe, snapGrid: pe, onlyRenderVisibleElements: me = !1, selectNodesOnDrag: he, nodesDraggable: ge, autoPanOnNodeFocus: _e, nodesConnectable: ve, nodesFocusable: ye, nodeOrigin: be = Qe, edgesFocusable: xe, edgesReconnectable: Se, elementsSelectable: Ce = !0, defaultViewport: we = $e, minZoom: U = .5, maxZoom: Te = 2, translateExtent: G = ne, preventScrolling: Ee = !0, nodeExtent: K, defaultMarkerColor: q = "#b1b1b7", zoomOnScroll: J = !0, zoomOnPinch: De = !0, panOnScroll: Oe = !1, panOnScrollSpeed: ke = .5, panOnScrollMode: Ae = i.Free, zoomOnDoubleClick: Z = !0, panOnDrag: je = !0, onPaneClick: Me, onPaneMouseEnter: Ne, onPaneMouseMove: Q, onPaneMouseLeave: $, onPaneScroll: Pe, onPaneContextMenu: Fe, paneClickDistance: Ie = 1, nodeClickDistance: Le = 0, children: Re, onReconnect: ze, onReconnectStart: Be, onReconnectEnd: Ve, onEdgeContextMenu: Ue, onEdgeDoubleClick: Ge, onEdgeMouseEnter: Ke, onEdgeMouseMove: qe, onEdgeMouseLeave: Je, reconnectRadius: Ye = 10, onNodesChange: Ze, onEdgesChange: et, noDragClassName: tt = "nodrag", noWheelClassName: nt = "nowheel", noPanClassName: it = "nopan", fitView: ot, fitViewOptions: st, connectOnClick: ct, attributionPosition: lt, proOptions: ut, defaultEdgeOptions: dt, elevateNodesOnSelect: ft = !0, elevateEdgesOnSelect: pt = !1, disableKeyboardA11y: mt = !1, autoPanOnConnect: ht, autoPanOnNodeDrag: gt, autoPanSpeed: _t, connectionRadius: vt, isValidConnection: yt, onError: bt, style: xt, id: St, nodeDragThreshold: Ct, connectionDragThreshold: wt, viewport: Tt, onViewportChange: Et, width: Dt, height: Ot, colorMode: kt = "light", debug: At, onScroll: jt, ariaLabelConfig: Mt, zIndexMode: Nt = "basic", ...Pt }, Ft) {
	let It = St || "1", Lt = at(kt), Rt = W((e) => {
		e.currentTarget.scrollTo({
			top: 0,
			left: 0,
			behavior: "instant"
		}), jt?.(e);
	}, [jt]);
	return Y("div", {
		"data-testid": "rf__wrapper",
		...Pt,
		onScroll: Rt,
		style: {
			...xt,
			...Or
		},
		ref: Ft,
		className: e([
			"react-flow",
			c,
			Lt
		]),
		id: St,
		role: "application",
		children: X(Dr, {
			nodes: n,
			edges: r,
			width: Dt,
			height: Ot,
			fitView: ot,
			fitViewOptions: st,
			minZoom: U,
			maxZoom: Te,
			nodeOrigin: be,
			nodeExtent: K,
			zIndexMode: Nt,
			children: [
				Y(rt, {
					nodes: n,
					edges: r,
					defaultNodes: a,
					defaultEdges: o,
					onConnect: _,
					onConnectStart: v,
					onConnectEnd: y,
					onClickConnectStart: b,
					onClickConnectEnd: x,
					nodesDraggable: ge,
					autoPanOnNodeFocus: _e,
					nodesConnectable: ve,
					nodesFocusable: ye,
					edgesFocusable: xe,
					edgesReconnectable: Se,
					elementsSelectable: Ce,
					elevateNodesOnSelect: ft,
					elevateEdgesOnSelect: pt,
					minZoom: U,
					maxZoom: Te,
					nodeExtent: K,
					onNodesChange: Ze,
					onEdgesChange: et,
					snapToGrid: fe,
					snapGrid: pe,
					connectionMode: B,
					translateExtent: G,
					connectOnClick: ct,
					defaultEdgeOptions: dt,
					fitView: ot,
					fitViewOptions: st,
					onNodesDelete: A,
					onEdgesDelete: j,
					onDelete: M,
					onNodeDragStart: D,
					onNodeDrag: O,
					onNodeDragStop: k,
					onSelectionDrag: F,
					onSelectionDragStart: P,
					onSelectionDragStop: ee,
					onMove: m,
					onMoveStart: h,
					onMoveEnd: g,
					noPanClassName: it,
					nodeOrigin: be,
					rfId: It,
					autoPanOnConnect: ht,
					autoPanOnNodeDrag: gt,
					autoPanSpeed: _t,
					onError: bt,
					connectionRadius: vt,
					isValidConnection: yt,
					selectNodesOnDrag: he,
					nodeDragThreshold: Ct,
					connectionDragThreshold: wt,
					onBeforeDelete: z,
					debug: At,
					ariaLabelConfig: Mt,
					zIndexMode: Nt
				}),
				Y(Cr, {
					onInit: p,
					onNodeClick: d,
					onEdgeClick: f,
					onNodeMouseEnter: S,
					onNodeMouseMove: C,
					onNodeMouseLeave: w,
					onNodeContextMenu: T,
					onNodeDoubleClick: E,
					nodeTypes: l,
					edgeTypes: u,
					connectionLineType: V,
					connectionLineStyle: H,
					connectionLineComponent: te,
					connectionLineContainerStyle: re,
					selectionKeyCode: ae,
					selectionOnDrag: oe,
					selectionMode: ce,
					deleteKeyCode: ie,
					multiSelectionKeyCode: ue,
					panActivationKeyCode: le,
					zoomActivationKeyCode: de,
					onlyRenderVisibleElements: me,
					defaultViewport: we,
					translateExtent: G,
					minZoom: U,
					maxZoom: Te,
					preventScrolling: Ee,
					zoomOnScroll: J,
					zoomOnPinch: De,
					zoomOnDoubleClick: Z,
					panOnScroll: Oe,
					panOnScrollSpeed: ke,
					panOnScrollMode: Ae,
					panOnDrag: je,
					onPaneClick: Me,
					onPaneMouseEnter: Ne,
					onPaneMouseMove: Q,
					onPaneMouseLeave: $,
					onPaneScroll: Pe,
					onPaneContextMenu: Fe,
					paneClickDistance: Ie,
					nodeClickDistance: Le,
					onSelectionContextMenu: I,
					onSelectionStart: L,
					onSelectionEnd: R,
					onReconnect: ze,
					onReconnectStart: Be,
					onReconnectEnd: Ve,
					onEdgeContextMenu: Ue,
					onEdgeDoubleClick: Ge,
					onEdgeMouseEnter: Ke,
					onEdgeMouseMove: qe,
					onEdgeMouseLeave: Je,
					reconnectRadius: Ye,
					defaultMarkerColor: q,
					noDragClassName: tt,
					noWheelClassName: nt,
					noPanClassName: it,
					rfId: It,
					disableKeyboardA11y: mt,
					nodeExtent: K,
					viewport: Tt,
					onViewportChange: Et
				}),
				Y(Xe, { onSelectionChange: N }),
				Re,
				Y(We, {
					proOptions: ut,
					position: lt
				}),
				Y(He, {
					rfId: It,
					disableKeyboardA11y: mt
				})
			]
		})
	});
}
var Ar = xt(kr), jr = (e) => e.domNode?.querySelector(".react-flow__edgelabel-renderer");
function Mr({ children: e }) {
	let t = Q(jr);
	return t ? Oe(e, t) : null;
}
function Nr(e) {
	let [t, n] = J(e);
	return [
		t,
		n,
		W((e) => n((t) => pt(e, t)), [])
	];
}
function Pr(e) {
	let [t, n] = J(e);
	return [
		t,
		n,
		W((e) => n((t) => mt(e, t)), [])
	];
}
x.error014();
function Fr({ dimensions: t, lineWidth: n, variant: r, className: i }) {
	return Y("path", {
		strokeWidth: n,
		d: `M${t[0] / 2} 0 V${t[1]} M0 ${t[1] / 2} H${t[0]}`,
		className: e([
			"react-flow__background-pattern",
			r,
			i
		])
	});
}
function Ir({ radius: t, className: n }) {
	return Y("circle", {
		cx: t,
		cy: t,
		r: t,
		className: e([
			"react-flow__background-pattern",
			"dots",
			n
		])
	});
}
var Lr;
(function(e) {
	e.Lines = "lines", e.Dots = "dots", e.Cross = "cross";
})(Lr ||= {});
var Rr = {
	[Lr.Dots]: 1,
	[Lr.Lines]: 1,
	[Lr.Cross]: 6
}, zr = (e) => ({
	transform: e.transform,
	patternId: `pattern-${e.rfId}`
});
function Br({ id: t, variant: n = Lr.Dots, gap: r = 20, size: i, lineWidth: a = 1, offset: o = 0, color: s, bgColor: c, style: l, className: u, patternClassName: d }) {
	let f = q(null), { transform: p, patternId: m } = Q(zr, Z), h = i || Rr[n], g = n === Lr.Dots, _ = n === Lr.Cross, v = Array.isArray(r) ? r : [r, r], y = [v[0] * p[2] || 1, v[1] * p[2] || 1], b = h * p[2], x = Array.isArray(o) ? o : [o, o], S = _ ? [b, b] : y, C = [x[0] * p[2] || 1 + S[0] / 2, x[1] * p[2] || 1 + S[1] / 2], w = `${m}${t || ""}`;
	return X("svg", {
		className: e(["react-flow__background", u]),
		style: {
			...l,
			...Nt,
			"--xy-background-color-props": c,
			"--xy-background-pattern-color-props": s
		},
		ref: f,
		"data-testid": "rf__background",
		children: [Y("pattern", {
			id: w,
			x: p[0] % y[0],
			y: p[1] % y[1],
			width: y[0],
			height: y[1],
			patternUnits: "userSpaceOnUse",
			patternTransform: `translate(-${C[0]},-${C[1]})`,
			children: g ? Y(Ir, {
				radius: b / 2,
				className: d
			}) : Y(Fr, {
				dimensions: S,
				lineWidth: a,
				variant: n,
				className: d
			})
		}), Y("rect", {
			x: "0",
			y: "0",
			width: "100%",
			height: "100%",
			fill: `url(#${w})`
		})]
	});
}
Br.displayName = "Background";
var Vr = U(Br);
function Hr() {
	return Y("svg", {
		xmlns: "http://www.w3.org/2000/svg",
		viewBox: "0 0 32 32",
		children: Y("path", { d: "M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z" })
	});
}
function Ur() {
	return Y("svg", {
		xmlns: "http://www.w3.org/2000/svg",
		viewBox: "0 0 32 5",
		children: Y("path", { d: "M0 0h32v4.2H0z" })
	});
}
function Wr() {
	return Y("svg", {
		xmlns: "http://www.w3.org/2000/svg",
		viewBox: "0 0 32 30",
		children: Y("path", { d: "M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z" })
	});
}
function Gr() {
	return Y("svg", {
		xmlns: "http://www.w3.org/2000/svg",
		viewBox: "0 0 25 32",
		children: Y("path", { d: "M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z" })
	});
}
function Kr() {
	return Y("svg", {
		xmlns: "http://www.w3.org/2000/svg",
		viewBox: "0 0 25 32",
		children: Y("path", { d: "M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z" })
	});
}
function qr({ children: t, className: n, ...r }) {
	return Y("button", {
		type: "button",
		className: e(["react-flow__controls-button", n]),
		...r,
		children: t
	});
}
var Jr = (e) => ({
	isInteractive: e.nodesDraggable || e.nodesConnectable || e.elementsSelectable,
	minZoomReached: e.transform[2] <= e.minZoom,
	maxZoomReached: e.transform[2] >= e.maxZoom,
	ariaLabelConfig: e.ariaLabelConfig
});
function Yr({ style: t, showZoom: n = !0, showFitView: r = !0, showInteractive: i = !0, fitViewOptions: a, onZoomIn: o, onZoomOut: s, onFitView: c, onInteractiveChange: l, className: u, children: d, position: f = "bottom-left", orientation: p = "vertical", "aria-label": m }) {
	let h = $(), { isInteractive: g, minZoomReached: _, maxZoomReached: v, ariaLabelConfig: y } = Q(Jr, Z), { zoomIn: b, zoomOut: x, fitView: S } = Ot();
	return X(Ue, {
		className: e([
			"react-flow__controls",
			p === "horizontal" ? "horizontal" : "vertical",
			u
		]),
		position: f,
		style: t,
		"data-testid": "rf__controls",
		"aria-label": m ?? y["controls.ariaLabel"],
		children: [
			n && X(De, { children: [Y(qr, {
				onClick: () => {
					b(), o?.();
				},
				className: "react-flow__controls-zoomin",
				title: y["controls.zoomIn.ariaLabel"],
				"aria-label": y["controls.zoomIn.ariaLabel"],
				disabled: v,
				children: Y(Hr, {})
			}), Y(qr, {
				onClick: () => {
					x(), s?.();
				},
				className: "react-flow__controls-zoomout",
				title: y["controls.zoomOut.ariaLabel"],
				"aria-label": y["controls.zoomOut.ariaLabel"],
				disabled: _,
				children: Y(Ur, {})
			})] }),
			r && Y(qr, {
				className: "react-flow__controls-fitview",
				onClick: () => {
					S(a), c?.();
				},
				title: y["controls.fitView.ariaLabel"],
				"aria-label": y["controls.fitView.ariaLabel"],
				children: Y(Wr, {})
			}),
			i && Y(qr, {
				className: "react-flow__controls-interactive",
				onClick: () => {
					h.setState({
						nodesDraggable: !g,
						nodesConnectable: !g,
						elementsSelectable: !g
					}), l?.(!g);
				},
				title: y["controls.interactive.ariaLabel"],
				"aria-label": y["controls.interactive.ariaLabel"],
				children: Y(g ? Kr : Gr, {})
			}),
			d
		]
	});
}
Yr.displayName = "Controls";
var Xr = U(Yr);
function Zr({ id: t, x: n, y: r, width: i, height: a, style: o, color: s, strokeColor: c, strokeWidth: l, className: u, borderRadius: d, shapeRendering: f, selected: p, onClick: m }) {
	let { background: h, backgroundColor: g } = o || {}, _ = s || h || g;
	return Y("rect", {
		className: e([
			"react-flow__minimap-node",
			{ selected: p },
			u
		]),
		x: n,
		y: r,
		rx: d,
		ry: d,
		width: i,
		height: a,
		style: {
			fill: _,
			stroke: c,
			strokeWidth: l
		},
		shapeRendering: f,
		onClick: m ? (e) => m(e, t) : void 0
	});
}
var Qr = U(Zr), $r = (e) => e.nodes.map((e) => e.id), ei = (e) => e instanceof Function ? e : () => e;
function ti({ nodeStrokeColor: e, nodeColor: t, nodeClassName: n = "", nodeBorderRadius: r = 5, nodeStrokeWidth: i, nodeComponent: a = Qr, onClick: o }) {
	let s = Q($r, Z), c = ei(t), l = ei(e), u = ei(n), d = typeof window > "u" || window.chrome ? "crispEdges" : "geometricPrecision";
	return Y(De, { children: s.map((e) => Y(ri, {
		id: e,
		nodeColorFunc: c,
		nodeStrokeColorFunc: l,
		nodeClassNameFunc: u,
		nodeBorderRadius: r,
		nodeStrokeWidth: i,
		NodeComponent: a,
		onClick: o,
		shapeRendering: d
	}, e)) });
}
function ni({ id: e, nodeColorFunc: t, nodeStrokeColorFunc: n, nodeClassNameFunc: r, nodeBorderRadius: i, nodeStrokeWidth: a, shapeRendering: o, NodeComponent: s, onClick: c }) {
	let { node: l, x: u, y: d, width: f, height: p } = Q((t) => {
		let n = t.nodeLookup.get(e);
		if (!n) return {
			node: void 0,
			x: 0,
			y: 0,
			width: 0,
			height: 0
		};
		let r = n.internals.userNode, { x: i, y: a } = n.internals.positionAbsolute, { width: o, height: s } = I(r);
		return {
			node: r,
			x: i,
			y: a,
			width: o,
			height: s
		};
	}, Z);
	return !l || l.hidden || !pe(l) ? null : Y(s, {
		x: u,
		y: d,
		width: f,
		height: p,
		style: l.style,
		selected: !!l.selected,
		className: r(l),
		color: t(l),
		borderRadius: i,
		strokeColor: n(l),
		strokeWidth: a,
		shapeRendering: o,
		onClick: c,
		id: l.id
	});
}
var ri = U(ni), ii = U(ti), ai = 200, oi = 150, si = (e) => !e.hidden, ci = (e) => {
	let t = {
		x: -e.transform[0] / e.transform[2],
		y: -e.transform[1] / e.transform[2],
		width: e.width / e.transform[2],
		height: e.height / e.transform[2]
	};
	return {
		viewBB: t,
		boundingRect: e.nodeLookup.size > 0 ? E(F(e.nodeLookup, { filter: si }), t) : t,
		rfId: e.rfId,
		panZoom: e.panZoom,
		translateExtent: e.translateExtent,
		flowWidth: e.width,
		flowHeight: e.height,
		ariaLabelConfig: e.ariaLabelConfig
	};
}, li = "react-flow__minimap-desc";
function ui({ style: t, className: n, nodeStrokeColor: r, nodeColor: i, nodeClassName: a = "", nodeBorderRadius: o = 5, nodeStrokeWidth: s, nodeComponent: c, bgColor: l, maskColor: d, maskStrokeColor: f, maskStrokeWidth: p, position: m = "bottom-right", onClick: h, onNodeClick: g, pannable: _ = !1, zoomable: v = !1, ariaLabel: y, inversePan: b, zoomStep: x = 1, offsetScale: S = 5 }) {
	let C = $(), w = q(null), { boundingRect: T, viewBB: E, rfId: D, panZoom: O, translateExtent: k, flowWidth: A, flowHeight: j, ariaLabelConfig: M } = Q(ci, Z), N = t?.width ?? ai, P = t?.height ?? oi, F = T.width / N, ee = T.height / P, I = Math.max(F, ee), L = I * N, R = I * P, z = S * I, B = T.x - (L - T.width) / 2 - z, V = T.y - (R - T.height) / 2 - z, H = L + z * 2, te = R + z * 2, ne = `${li}-${D}`, re = q(0), ie = q();
	re.current = I, G(() => {
		if (w.current && O) return ie.current = u({
			domNode: w.current,
			panZoom: O,
			getTransform: () => C.getState().transform,
			getViewScale: () => re.current
		}), () => {
			ie.current?.destroy();
		};
	}, [O]), G(() => {
		ie.current?.update({
			translateExtent: k,
			width: A,
			height: j,
			inversePan: b,
			pannable: _,
			zoomStep: x,
			zoomable: v
		});
	}, [
		_,
		v,
		b,
		x,
		k,
		A,
		j
	]);
	let ae = h ? (e) => {
		let [t, n] = ie.current?.pointer(e) || [0, 0];
		h(e, {
			x: t,
			y: n
		});
	} : void 0, oe = g ? W((e, t) => {
		let n = C.getState().nodeLookup.get(t).internals.userNode;
		g(e, n);
	}, []) : void 0, se = y ?? M["minimap.ariaLabel"];
	return Y(Ue, {
		position: m,
		style: {
			...t,
			"--xy-minimap-background-color-props": typeof l == "string" ? l : void 0,
			"--xy-minimap-mask-background-color-props": typeof d == "string" ? d : void 0,
			"--xy-minimap-mask-stroke-color-props": typeof f == "string" ? f : void 0,
			"--xy-minimap-mask-stroke-width-props": typeof p == "number" ? p * I : void 0,
			"--xy-minimap-node-background-color-props": typeof i == "string" ? i : void 0,
			"--xy-minimap-node-stroke-color-props": typeof r == "string" ? r : void 0,
			"--xy-minimap-node-stroke-width-props": typeof s == "number" ? s : void 0
		},
		className: e(["react-flow__minimap", n]),
		"data-testid": "rf__minimap",
		children: X("svg", {
			width: N,
			height: P,
			viewBox: `${B} ${V} ${H} ${te}`,
			className: "react-flow__minimap-svg",
			role: "img",
			"aria-labelledby": ne,
			ref: w,
			onClick: ae,
			children: [
				se && Y("title", {
					id: ne,
					children: se
				}),
				Y(ii, {
					onClick: oe,
					nodeColor: i,
					nodeStrokeColor: r,
					nodeBorderRadius: o,
					nodeClassName: a,
					nodeStrokeWidth: s,
					nodeComponent: c
				}),
				Y("path", {
					className: "react-flow__minimap-mask",
					d: `M${B - z},${V - z}h${H + z * 2}v${te + z * 2}h${-H - z * 2}z
        M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,
					fillRule: "evenodd",
					pointerEvents: "none"
				})
			]
		})
	});
}
ui.displayName = "MiniMap", U(ui);
var di = (e) => (t) => e ? `${Math.max(1 / t.transform[2], 1)}` : void 0, fi = {
	[o.Line]: "right",
	[o.Handle]: "bottom-right"
};
function pi({ nodeId: t, position: n, variant: r = o.Handle, className: i, style: a = void 0, children: s, color: c, minWidth: l = 10, minHeight: u = 10, maxWidth: d = Number.MAX_VALUE, maxHeight: p = Number.MAX_VALUE, keepAspectRatio: m = !1, resizeDirection: h, autoScale: g = !0, shouldResize: _, onResizeStart: v, onResize: y, onResizeEnd: b }) {
	let x = qt(), C = typeof t == "string" ? t : x, w = $(), T = q(null), E = r === o.Handle, D = Q(W(di(E && g), [E, g]), Z), O = q(null), k = n ?? fi[r];
	return G(() => {
		if (!(!T.current || !C)) return O.current ||= f({
			domNode: T.current,
			nodeId: C,
			getStoreItems: () => {
				let { nodeLookup: e, transform: t, snapGrid: n, snapToGrid: r, nodeOrigin: i, domNode: a } = w.getState();
				return {
					nodeLookup: e,
					transform: t,
					snapGrid: n,
					snapToGrid: r,
					nodeOrigin: i,
					paneDomNode: a
				};
			},
			onChange: (e, t) => {
				let { triggerNodeChanges: n, nodeLookup: r, parentLookup: i, nodeOrigin: a } = w.getState(), o = [], s = {
					x: e.x,
					y: e.y
				}, c = r.get(C);
				if (c && c.expandParent && c.parentId) {
					let t = c.origin ?? a, n = e.width ?? c.measured.width ?? 0, l = e.height ?? c.measured.height ?? 0, u = te([{
						id: c.id,
						parentId: c.parentId,
						rect: {
							width: n,
							height: l,
							...S({
								x: e.x ?? c.position.x,
								y: e.y ?? c.position.y
							}, {
								width: n,
								height: l
							}, c.parentId, r, t)
						}
					}], r, i, a);
					o.push(...u), s.x = e.x ? Math.max(t[0] * n, e.x) : void 0, s.y = e.y ? Math.max(t[1] * l, e.y) : void 0;
				}
				if (s.x !== void 0 && s.y !== void 0) {
					let e = {
						id: C,
						type: "position",
						position: { ...s }
					};
					o.push(e);
				}
				if (e.width !== void 0 && e.height !== void 0) {
					let t = {
						id: C,
						type: "dimensions",
						resizing: !0,
						setAttributes: h ? h === "horizontal" ? "width" : "height" : !0,
						dimensions: {
							width: e.width,
							height: e.height
						}
					};
					o.push(t);
				}
				for (let e of t) {
					let t = {
						...e,
						type: "position"
					};
					o.push(t);
				}
				n(o);
			},
			onEnd: ({ width: e, height: t }) => {
				let n = {
					id: C,
					type: "dimensions",
					resizing: !1,
					dimensions: {
						width: e,
						height: t
					}
				};
				w.getState().triggerNodeChanges([n]);
			}
		}), O.current.update({
			controlPosition: k,
			boundaries: {
				minWidth: l,
				minHeight: u,
				maxWidth: d,
				maxHeight: p
			},
			keepAspectRatio: m,
			resizeDirection: h,
			onResizeStart: v,
			onResize: y,
			onResizeEnd: b,
			shouldResize: _
		}), () => {
			O.current?.destroy();
		};
	}, [
		k,
		l,
		u,
		d,
		p,
		m,
		v,
		y,
		b,
		_
	]), Y("div", {
		className: e([
			"react-flow__resize-control",
			"nodrag",
			...k.split("-"),
			r,
			i
		]),
		ref: T,
		style: {
			...a,
			scale: D,
			...c && { [E ? "backgroundColor" : "borderColor"]: c }
		},
		children: s
	});
}
U(pi);
//#endregion
export { Vr as Background, Lr as BackgroundVariant, Mn as BaseEdge, Xr as Controls, Mr as EdgeLabelRenderer, Zt as Handle, Er as ReactFlowProvider, Ar as index, Pr as useEdgesState, Nr as useNodesState, Ot as useReactFlow };
