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I,MAAAA,GAA8CA,OAEhDrC,EAAU94B,KAAK0kC,IASfpR,QANF,WACEwF,EAAUpG,GAAG,QAAS","sources":["webpack://gatsby-starter-typescript-plus/./node_modules/@xyflow/system/dist/esm/index.js"],"sourcesContent":["import _toConsumableArray from \"/home/vsts/work/1/s/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport _objectWithoutProperties from \"/home/vsts/work/1/s/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _asyncToGenerator from \"/home/vsts/work/1/s/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/helpers/esm/asyncToGenerator\";\nimport _slicedToArray from \"/home/vsts/work/1/s/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\nimport _defineProperty from \"/home/vsts/work/1/s/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nvar _excluded = [\"id\"],\n _excluded2 = [\"inProgress\"];\n\nvar _oppositePosition, _handleDirections;\n\nimport _regeneratorRuntime from \"/home/vsts/work/1/s/node_modules/babel-preset-gatsby/node_modules/@babel/runtime/regenerator\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nimport { drag } from 'd3-drag';\nimport { select, pointer } from 'd3-selection';\nimport { zoom, zoomIdentity, zoomTransform } from 'd3-zoom';\nvar errorMessages = {\n error001: function error001() {\n return '[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001';\n },\n error002: function error002() {\n return \"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.\";\n },\n error003: function error003(nodeType) {\n return \"Node type \\\"\".concat(nodeType, \"\\\" not found. Using fallback type \\\"default\\\".\");\n },\n error004: function error004() {\n return 'The React Flow parent container needs a width and a height to render the graph.';\n },\n error005: function error005() {\n return 'Only child nodes can use a parent extent.';\n },\n error006: function error006() {\n return \"Can't create edge. An edge needs a source and a target.\";\n },\n error007: function error007(id) {\n return \"The old edge with id=\".concat(id, \" does not exist.\");\n },\n error009: function error009(type) {\n return \"Marker type \\\"\".concat(type, \"\\\" doesn't exist.\");\n },\n error008: function error008(handleType, _ref) {\n var id = _ref.id,\n sourceHandle = _ref.sourceHandle,\n targetHandle = _ref.targetHandle;\n return \"Couldn't create edge for \".concat(handleType, \" handle id: \\\"\").concat(handleType === 'source' ? sourceHandle : targetHandle, \"\\\", edge id: \").concat(id, \".\");\n },\n error010: function error010() {\n return 'Handle: No node id found. Make sure to only use a Handle inside a custom Node.';\n },\n error011: function error011(edgeType) {\n return \"Edge type \\\"\".concat(edgeType, \"\\\" not found. Using fallback type \\\"default\\\".\");\n },\n error012: function error012(id) {\n return \"Node with id \\\"\".concat(id, \"\\\" does not exist, it may have been removed. This can happen when a node is deleted before the \\\"onNodeClick\\\" handler is called.\");\n },\n error013: function error013() {\n var lib = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'react';\n return \"It seems that you haven't loaded the styles. Please import '@xyflow/\".concat(lib, \"/dist/style.css' or base.css to make sure everything is working properly.\");\n },\n error014: function error014() {\n return 'useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.';\n },\n error015: function error015() {\n return 'It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.';\n }\n};\nvar infiniteExtent = [[Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY], [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]];\nvar elementSelectionKeys = ['Enter', ' ', 'Escape'];\n/**\n * The `ConnectionMode` is used to set the mode of connection between nodes.\n * The `Strict` mode is the default one and only allows source to target edges.\n * `Loose` mode allows source to source and target to target edges as well.\n *\n * @public\n */\n\nvar ConnectionMode;\n\n(function (ConnectionMode) {\n ConnectionMode[\"Strict\"] = \"strict\";\n ConnectionMode[\"Loose\"] = \"loose\";\n})(ConnectionMode || (ConnectionMode = {}));\n/**\n * This enum is used to set the different modes of panning the viewport when the\n * user scrolls. The `Free` mode allows the user to pan in any direction by scrolling\n * with a device like a trackpad. The `Vertical` and `Horizontal` modes restrict\n * scroll panning to only the vertical or horizontal axis, respectively.\n *\n * @public\n */\n\n\nvar PanOnScrollMode;\n\n(function (PanOnScrollMode) {\n PanOnScrollMode[\"Free\"] = \"free\";\n PanOnScrollMode[\"Vertical\"] = \"vertical\";\n PanOnScrollMode[\"Horizontal\"] = \"horizontal\";\n})(PanOnScrollMode || (PanOnScrollMode = {}));\n\nvar SelectionMode;\n\n(function (SelectionMode) {\n SelectionMode[\"Partial\"] = \"partial\";\n SelectionMode[\"Full\"] = \"full\";\n})(SelectionMode || (SelectionMode = {}));\n\nvar initialConnection = {\n inProgress: false,\n isValid: null,\n from: null,\n fromHandle: null,\n fromPosition: null,\n fromNode: null,\n to: null,\n toHandle: null,\n toPosition: null,\n toNode: null\n};\n/**\n * If you set the `connectionLineType` prop on your [``](/api-reference/react-flow#connection-connectionLineType)\n *component, it will dictate the style of connection line rendered when creating\n *new edges.\n *\n * @public\n *\n * @remarks If you choose to render a custom connection line component, this value will be\n *passed to your component as part of its [`ConnectionLineComponentProps`](/api-reference/types/connection-line-component-props).\n */\n\nvar ConnectionLineType;\n\n(function (ConnectionLineType) {\n ConnectionLineType[\"Bezier\"] = \"default\";\n ConnectionLineType[\"Straight\"] = \"straight\";\n ConnectionLineType[\"Step\"] = \"step\";\n ConnectionLineType[\"SmoothStep\"] = \"smoothstep\";\n ConnectionLineType[\"SimpleBezier\"] = \"simplebezier\";\n})(ConnectionLineType || (ConnectionLineType = {}));\n/**\n * Edges may optionally have a marker on either end. The MarkerType type enumerates\n * the options available to you when configuring a given marker.\n *\n * @public\n */\n\n\nvar MarkerType;\n\n(function (MarkerType) {\n MarkerType[\"Arrow\"] = \"arrow\";\n MarkerType[\"ArrowClosed\"] = \"arrowclosed\";\n})(MarkerType || (MarkerType = {}));\n/**\n * While [`PanelPosition`](/api-reference/types/panel-position) can be used to place a\n * component in the corners of a container, the `Position` enum is less precise and used\n * primarily in relation to edges and handles.\n *\n * @public\n */\n\n\nvar Position;\n\n(function (Position) {\n Position[\"Left\"] = \"left\";\n Position[\"Top\"] = \"top\";\n Position[\"Right\"] = \"right\";\n Position[\"Bottom\"] = \"bottom\";\n})(Position || (Position = {}));\n\nvar oppositePosition = (_oppositePosition = {}, _defineProperty(_oppositePosition, Position.Left, Position.Right), _defineProperty(_oppositePosition, Position.Right, Position.Left), _defineProperty(_oppositePosition, Position.Top, Position.Bottom), _defineProperty(_oppositePosition, Position.Bottom, Position.Top), _oppositePosition);\n/**\n * @internal\n */\n\nfunction areConnectionMapsEqual(a, b) {\n if (!a && !b) {\n return true;\n }\n\n if (!a || !b || a.size !== b.size) {\n return false;\n }\n\n if (!a.size && !b.size) {\n return true;\n }\n\n var _iterator = _createForOfIteratorHelper(a.keys()),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var key = _step.value;\n\n if (!b.has(key)) {\n return false;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n return true;\n}\n/**\n * We call the callback for all connections in a that are not in b\n *\n * @internal\n */\n\n\nfunction handleConnectionChange(a, b, cb) {\n if (!cb) {\n return;\n }\n\n var diff = [];\n a.forEach(function (connection, key) {\n if (!(b !== null && b !== void 0 && b.has(key))) {\n diff.push(connection);\n }\n });\n\n if (diff.length) {\n cb(diff);\n }\n}\n\nfunction getConnectionStatus(isValid) {\n return isValid === null ? null : isValid ? 'valid' : 'invalid';\n}\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Test whether an object is useable as an Edge\n * @public\n * @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Edge if it returns true\n * @param element - The element to test\n * @returns A boolean indicating whether the element is an Edge\n */\n\n\nvar isEdgeBase = function isEdgeBase(element) {\n return 'id' in element && 'source' in element && 'target' in element;\n};\n/**\n * Test whether an object is useable as a Node\n * @public\n * @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true\n * @param element - The element to test\n * @returns A boolean indicating whether the element is an Node\n */\n\n\nvar isNodeBase = function isNodeBase(element) {\n return 'id' in element && 'position' in element && !('source' in element) && !('target' in element);\n};\n\nvar isInternalNodeBase = function isInternalNodeBase(element) {\n return 'id' in element && 'internals' in element && !('source' in element) && !('target' in element);\n};\n/**\n * This util is used to tell you what nodes, if any, are connected to the given node\n * as the _target_ of an edge.\n * @public\n * @param node - The node to get the connected nodes from\n * @param nodes - The array of all nodes\n * @param edges - The array of all edges\n * @returns An array of nodes that are connected over eges where the source is the given node\n *\n * @example\n * ```ts\n *import { getOutgoers } from '@xyflow/react';\n *\n *const nodes = [];\n *const edges = [];\n *\n *const outgoers = getOutgoers(\n * { id: '1', position: { x: 0, y: 0 }, data: { label: 'node' } },\n * nodes,\n * edges,\n *);\n *```\n */\n\n\nvar getOutgoers = function getOutgoers(node, nodes, edges) {\n if (!node.id) {\n return [];\n }\n\n var outgoerIds = new Set();\n edges.forEach(function (edge) {\n if (edge.source === node.id) {\n outgoerIds.add(edge.target);\n }\n });\n return nodes.filter(function (n) {\n return outgoerIds.has(n.id);\n });\n};\n/**\n * This util is used to tell you what nodes, if any, are connected to the given node\n * as the _source_ of an edge.\n * @public\n * @param node - The node to get the connected nodes from\n * @param nodes - The array of all nodes\n * @param edges - The array of all edges\n * @returns An array of nodes that are connected over eges where the target is the given node\n *\n * @example\n * ```ts\n *import { getIncomers } from '@xyflow/react';\n *\n *const nodes = [];\n *const edges = [];\n *\n *const incomers = getIncomers(\n * { id: '1', position: { x: 0, y: 0 }, data: { label: 'node' } },\n * nodes,\n * edges,\n *);\n *```\n */\n\n\nvar getIncomers = function getIncomers(node, nodes, edges) {\n if (!node.id) {\n return [];\n }\n\n var incomersIds = new Set();\n edges.forEach(function (edge) {\n if (edge.target === node.id) {\n incomersIds.add(edge.source);\n }\n });\n return nodes.filter(function (n) {\n return incomersIds.has(n.id);\n });\n};\n\nvar getNodePositionWithOrigin = function getNodePositionWithOrigin(node) {\n var _node$origin;\n\n var nodeOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0];\n\n var _getNodeDimensions = getNodeDimensions(node),\n width = _getNodeDimensions.width,\n height = _getNodeDimensions.height;\n\n var origin = (_node$origin = node.origin) !== null && _node$origin !== void 0 ? _node$origin : nodeOrigin;\n var offsetX = width * origin[0];\n var offsetY = height * origin[1];\n return {\n x: node.position.x - offsetX,\n y: node.position.y - offsetY\n };\n};\n/**\n * Returns the bounding box that contains all the given nodes in an array. This can\n * be useful when combined with [`getViewportForBounds`](/api-reference/utils/get-viewport-for-bounds)\n * to calculate the correct transform to fit the given nodes in a viewport.\n * @public\n * @remarks Useful when combined with {@link getViewportForBounds} to calculate the correct transform to fit the given nodes in a viewport.\n * @param nodes - Nodes to calculate the bounds for\n * @param params.nodeOrigin - Origin of the nodes: [0, 0] - top left, [0.5, 0.5] - center\n * @returns Bounding box enclosing all nodes\n *\n * @remarks This function was previously called `getRectOfNodes`\n *\n * @example\n * ```js\n *import { getNodesBounds } from '@xyflow/react';\n *\n *const nodes = [\n * {\n * id: 'a',\n * position: { x: 0, y: 0 },\n * data: { label: 'a' },\n * width: 50,\n * height: 25,\n * },\n * {\n * id: 'b',\n * position: { x: 100, y: 100 },\n * data: { label: 'b' },\n * width: 50,\n * height: 25,\n * },\n *];\n *\n *const bounds = getNodesBounds(nodes);\n *```\n */\n\n\nvar getNodesBounds = function getNodesBounds(nodes) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n nodeOrigin: [0, 0],\n nodeLookup: undefined\n };\n\n if (process.env.NODE_ENV === 'development' && !params.nodeLookup) {\n console.warn('Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows.');\n }\n\n if (nodes.length === 0) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n }\n\n var box = nodes.reduce(function (currBox, nodeOrId) {\n var isId = typeof nodeOrId === 'string';\n var currentNode = !params.nodeLookup && !isId ? nodeOrId : undefined;\n\n if (params.nodeLookup) {\n currentNode = isId ? params.nodeLookup.get(nodeOrId) : !isInternalNodeBase(nodeOrId) ? params.nodeLookup.get(nodeOrId.id) : nodeOrId;\n }\n\n var nodeBox = currentNode ? nodeToBox(currentNode, params.nodeOrigin) : {\n x: 0,\n y: 0,\n x2: 0,\n y2: 0\n };\n return getBoundsOfBoxes(currBox, nodeBox);\n }, {\n x: Infinity,\n y: Infinity,\n x2: -Infinity,\n y2: -Infinity\n });\n return boxToRect(box);\n};\n/**\n * Determines a bounding box that contains all given nodes in an array\n * @internal\n */\n\n\nvar getInternalNodesBounds = function getInternalNodesBounds(nodeLookup) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (nodeLookup.size === 0) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n }\n\n var box = {\n x: Infinity,\n y: Infinity,\n x2: -Infinity,\n y2: -Infinity\n };\n nodeLookup.forEach(function (node) {\n if (params.filter === undefined || params.filter(node)) {\n var nodeBox = nodeToBox(node);\n box = getBoundsOfBoxes(box, nodeBox);\n }\n });\n return boxToRect(box);\n};\n\nvar getNodesInside = function getNodesInside(nodes, rect) {\n var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 1],\n _ref3 = _slicedToArray(_ref2, 3),\n tx = _ref3[0],\n ty = _ref3[1],\n tScale = _ref3[2];\n\n var partially = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var excludeNonSelectableNodes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n\n var paneRect = _objectSpread(_objectSpread({}, pointToRendererPoint(rect, [tx, ty, tScale])), {}, {\n width: rect.width / tScale,\n height: rect.height / tScale\n });\n\n var visibleNodes = [];\n\n var _iterator2 = _createForOfIteratorHelper(nodes.values()),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var _ref4, _ref5, _measured$width, _ref6, _ref7, _measured$height;\n\n var node = _step2.value;\n var measured = node.measured,\n _node$selectable = node.selectable,\n selectable = _node$selectable === void 0 ? true : _node$selectable,\n _node$hidden = node.hidden,\n hidden = _node$hidden === void 0 ? false : _node$hidden;\n\n if (excludeNonSelectableNodes && !selectable || hidden) {\n continue;\n }\n\n var width = (_ref4 = (_ref5 = (_measured$width = measured.width) !== null && _measured$width !== void 0 ? _measured$width : node.width) !== null && _ref5 !== void 0 ? _ref5 : node.initialWidth) !== null && _ref4 !== void 0 ? _ref4 : null;\n var height = (_ref6 = (_ref7 = (_measured$height = measured.height) !== null && _measured$height !== void 0 ? _measured$height : node.height) !== null && _ref7 !== void 0 ? _ref7 : node.initialHeight) !== null && _ref6 !== void 0 ? _ref6 : null;\n var overlappingArea = getOverlappingArea(paneRect, nodeToRect(node));\n var area = (width !== null && width !== void 0 ? width : 0) * (height !== null && height !== void 0 ? height : 0);\n var partiallyVisible = partially && overlappingArea > 0;\n var forceInitialRender = !node.internals.handleBounds;\n var isVisible = forceInitialRender || partiallyVisible || overlappingArea >= area;\n\n if (isVisible || node.dragging) {\n visibleNodes.push(node);\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n\n return visibleNodes;\n};\n/**\n * This utility filters an array of edges, keeping only those where either the source or target\n * node is present in the given array of nodes.\n * @public\n * @param nodes - Nodes you want to get the connected edges for\n * @param edges - All edges\n * @returns Array of edges that connect any of the given nodes with each other\n *\n * @example\n * ```js\n *import { getConnectedEdges } from '@xyflow/react';\n *\n *const nodes = [\n * { id: 'a', position: { x: 0, y: 0 } },\n * { id: 'b', position: { x: 100, y: 0 } },\n *];\n *\n *const edges = [\n * { id: 'a->c', source: 'a', target: 'c' },\n * { id: 'c->d', source: 'c', target: 'd' },\n *];\n *\n *const connectedEdges = getConnectedEdges(nodes, edges);\n * // => [{ id: 'a->c', source: 'a', target: 'c' }]\n *```\n */\n\n\nvar getConnectedEdges = function getConnectedEdges(nodes, edges) {\n var nodeIds = new Set();\n nodes.forEach(function (node) {\n nodeIds.add(node.id);\n });\n return edges.filter(function (edge) {\n return nodeIds.has(edge.source) || nodeIds.has(edge.target);\n });\n};\n\nfunction getFitViewNodes(nodeLookup, options) {\n var fitViewNodes = new Map();\n var optionNodeIds = options !== null && options !== void 0 && options.nodes ? new Set(options.nodes.map(function (node) {\n return node.id;\n })) : null;\n nodeLookup.forEach(function (n) {\n var isVisible = n.measured.width && n.measured.height && ((options === null || options === void 0 ? void 0 : options.includeHiddenNodes) || !n.hidden);\n\n if (isVisible && (!optionNodeIds || optionNodeIds.has(n.id))) {\n fitViewNodes.set(n.id, n);\n }\n });\n return fitViewNodes;\n}\n\nfunction fitViewport(_x, _x2) {\n return _fitViewport.apply(this, arguments);\n}\n/**\n * This function calculates the next position of a node, taking into account the node's extent, parent node, and origin.\n *\n * @internal\n * @returns position, positionAbsolute\n */\n\n\nfunction _fitViewport() {\n _fitViewport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref8, options) {\n var _options$minZoom, _options$maxZoom, _options$padding;\n\n var nodes, width, height, panZoom, minZoom, maxZoom, nodesToFit, bounds, viewport;\n return _regeneratorRuntime.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n nodes = _ref8.nodes, width = _ref8.width, height = _ref8.height, panZoom = _ref8.panZoom, minZoom = _ref8.minZoom, maxZoom = _ref8.maxZoom;\n\n if (!(nodes.size === 0)) {\n _context4.next = 3;\n break;\n }\n\n return _context4.abrupt(\"return\", Promise.resolve(true));\n\n case 3:\n nodesToFit = getFitViewNodes(nodes, options);\n bounds = getInternalNodesBounds(nodesToFit);\n viewport = getViewportForBounds(bounds, width, height, (_options$minZoom = options === null || options === void 0 ? void 0 : options.minZoom) !== null && _options$minZoom !== void 0 ? _options$minZoom : minZoom, (_options$maxZoom = options === null || options === void 0 ? void 0 : options.maxZoom) !== null && _options$maxZoom !== void 0 ? _options$maxZoom : maxZoom, (_options$padding = options === null || options === void 0 ? void 0 : options.padding) !== null && _options$padding !== void 0 ? _options$padding : 0.1);\n _context4.next = 8;\n return panZoom.setViewport(viewport, {\n duration: options === null || options === void 0 ? void 0 : options.duration\n });\n\n case 8:\n return _context4.abrupt(\"return\", Promise.resolve(true));\n\n case 9:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4);\n }));\n return _fitViewport.apply(this, arguments);\n}\n\nfunction calculateNodePosition(_ref9) {\n var _node$origin2, _node$measured$width, _node$measured$height;\n\n var nodeId = _ref9.nodeId,\n nextPosition = _ref9.nextPosition,\n nodeLookup = _ref9.nodeLookup,\n _ref9$nodeOrigin = _ref9.nodeOrigin,\n nodeOrigin = _ref9$nodeOrigin === void 0 ? [0, 0] : _ref9$nodeOrigin,\n nodeExtent = _ref9.nodeExtent,\n onError = _ref9.onError;\n var node = nodeLookup.get(nodeId);\n var parentNode = node.parentId ? nodeLookup.get(node.parentId) : undefined;\n\n var _ref10 = parentNode ? parentNode.internals.positionAbsolute : {\n x: 0,\n y: 0\n },\n parentX = _ref10.x,\n parentY = _ref10.y;\n\n var origin = (_node$origin2 = node.origin) !== null && _node$origin2 !== void 0 ? _node$origin2 : nodeOrigin;\n var extent = nodeExtent;\n\n if (node.extent === 'parent' && !node.expandParent) {\n if (!parentNode) {\n onError === null || onError === void 0 ? void 0 : onError('005', errorMessages['error005']());\n } else {\n var parentWidth = parentNode.measured.width;\n var parentHeight = parentNode.measured.height;\n\n if (parentWidth && parentHeight) {\n extent = [[parentX, parentY], [parentX + parentWidth, parentY + parentHeight]];\n }\n }\n } else if (parentNode && isCoordinateExtent(node.extent)) {\n extent = [[node.extent[0][0] + parentX, node.extent[0][1] + parentY], [node.extent[1][0] + parentX, node.extent[1][1] + parentY]];\n }\n\n var positionAbsolute = isCoordinateExtent(extent) ? clampPosition(nextPosition, extent, node.measured) : nextPosition;\n\n if (node.measured.width === undefined || node.measured.height === undefined) {\n onError === null || onError === void 0 ? void 0 : onError('015', errorMessages['error015']());\n }\n\n return {\n position: {\n x: positionAbsolute.x - parentX + ((_node$measured$width = node.measured.width) !== null && _node$measured$width !== void 0 ? _node$measured$width : 0) * origin[0],\n y: positionAbsolute.y - parentY + ((_node$measured$height = node.measured.height) !== null && _node$measured$height !== void 0 ? _node$measured$height : 0) * origin[1]\n },\n positionAbsolute: positionAbsolute\n };\n}\n/**\n * Pass in nodes & edges to delete, get arrays of nodes and edges that actually can be deleted\n * @internal\n * @param param.nodesToRemove - The nodes to remove\n * @param param.edgesToRemove - The edges to remove\n * @param param.nodes - All nodes\n * @param param.edges - All edges\n * @param param.onBeforeDelete - Callback to check which nodes and edges can be deleted\n * @returns nodes: nodes that can be deleted, edges: edges that can be deleted\n */\n\n\nfunction getElementsToRemove(_x3) {\n return _getElementsToRemove.apply(this, arguments);\n}\n\nfunction _getElementsToRemove() {\n _getElementsToRemove = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref11) {\n var _ref11$nodesToRemove, nodesToRemove, _ref11$edgesToRemove, edgesToRemove, nodes, edges, onBeforeDelete, nodeIds, matchingNodes, _iterator18, _step18, _loop, _ret, edgeIds, deletableEdges, connectedEdges, matchingEdges, _iterator19, _step19, _loop2, onBeforeDeleteResult;\n\n return _regeneratorRuntime.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n _ref11$nodesToRemove = _ref11.nodesToRemove, nodesToRemove = _ref11$nodesToRemove === void 0 ? [] : _ref11$nodesToRemove, _ref11$edgesToRemove = _ref11.edgesToRemove, edgesToRemove = _ref11$edgesToRemove === void 0 ? [] : _ref11$edgesToRemove, nodes = _ref11.nodes, edges = _ref11.edges, onBeforeDelete = _ref11.onBeforeDelete;\n nodeIds = new Set(nodesToRemove.map(function (node) {\n return node.id;\n }));\n matchingNodes = [];\n _iterator18 = _createForOfIteratorHelper(nodes);\n _context5.prev = 4;\n\n _loop = function _loop() {\n var node = _step18.value;\n\n if (node.deletable === false) {\n return \"continue\";\n }\n\n var isIncluded = nodeIds.has(node.id);\n var parentHit = !isIncluded && node.parentId && matchingNodes.find(function (n) {\n return n.id === node.parentId;\n });\n\n if (isIncluded || parentHit) {\n matchingNodes.push(node);\n }\n };\n\n _iterator18.s();\n\n case 7:\n if ((_step18 = _iterator18.n()).done) {\n _context5.next = 13;\n break;\n }\n\n _ret = _loop();\n\n if (!(_ret === \"continue\")) {\n _context5.next = 11;\n break;\n }\n\n return _context5.abrupt(\"continue\", 11);\n\n case 11:\n _context5.next = 7;\n break;\n\n case 13:\n _context5.next = 18;\n break;\n\n case 15:\n _context5.prev = 15;\n _context5.t0 = _context5[\"catch\"](4);\n\n _iterator18.e(_context5.t0);\n\n case 18:\n _context5.prev = 18;\n\n _iterator18.f();\n\n return _context5.finish(18);\n\n case 21:\n edgeIds = new Set(edgesToRemove.map(function (edge) {\n return edge.id;\n }));\n deletableEdges = edges.filter(function (edge) {\n return edge.deletable !== false;\n });\n connectedEdges = getConnectedEdges(matchingNodes, deletableEdges);\n matchingEdges = connectedEdges;\n _iterator19 = _createForOfIteratorHelper(deletableEdges);\n\n try {\n _loop2 = function _loop2() {\n var edge = _step19.value;\n var isIncluded = edgeIds.has(edge.id);\n\n if (isIncluded && !matchingEdges.find(function (e) {\n return e.id === edge.id;\n })) {\n matchingEdges.push(edge);\n }\n };\n\n for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {\n _loop2();\n }\n } catch (err) {\n _iterator19.e(err);\n } finally {\n _iterator19.f();\n }\n\n if (onBeforeDelete) {\n _context5.next = 29;\n break;\n }\n\n return _context5.abrupt(\"return\", {\n edges: matchingEdges,\n nodes: matchingNodes\n });\n\n case 29:\n _context5.next = 31;\n return onBeforeDelete({\n nodes: matchingNodes,\n edges: matchingEdges\n });\n\n case 31:\n onBeforeDeleteResult = _context5.sent;\n\n if (!(typeof onBeforeDeleteResult === 'boolean')) {\n _context5.next = 34;\n break;\n }\n\n return _context5.abrupt(\"return\", onBeforeDeleteResult ? {\n edges: matchingEdges,\n nodes: matchingNodes\n } : {\n edges: [],\n nodes: []\n });\n\n case 34:\n return _context5.abrupt(\"return\", onBeforeDeleteResult);\n\n case 35:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, null, [[4, 15, 18, 21]]);\n }));\n return _getElementsToRemove.apply(this, arguments);\n}\n\nvar clamp = function clamp(val) {\n var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n return Math.min(Math.max(val, min), max);\n};\n\nvar clampPosition = function clampPosition() {\n var _dimensions$width, _dimensions$height;\n\n var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {\n x: 0,\n y: 0\n };\n var extent = arguments.length > 1 ? arguments[1] : undefined;\n var dimensions = arguments.length > 2 ? arguments[2] : undefined;\n return {\n x: clamp(position.x, extent[0][0], extent[1][0] - ((_dimensions$width = dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) !== null && _dimensions$width !== void 0 ? _dimensions$width : 0)),\n y: clamp(position.y, extent[0][1], extent[1][1] - ((_dimensions$height = dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) !== null && _dimensions$height !== void 0 ? _dimensions$height : 0))\n };\n};\n\nfunction clampPositionToParent(childPosition, childDimensions, parent) {\n var _getNodeDimensions2 = getNodeDimensions(parent),\n parentWidth = _getNodeDimensions2.width,\n parentHeight = _getNodeDimensions2.height;\n\n var _parent$internals$pos = parent.internals.positionAbsolute,\n parentX = _parent$internals$pos.x,\n parentY = _parent$internals$pos.y;\n return clampPosition(childPosition, [[parentX, parentY], [parentX + parentWidth, parentY + parentHeight]], childDimensions);\n}\n/**\n * Calculates the velocity of panning when the mouse is close to the edge of the canvas\n * @internal\n * @param value - One dimensional poition of the mouse (x or y)\n * @param min - Minimal position on canvas before panning starts\n * @param max - Maximal position on canvas before panning starts\n * @returns - A number between 0 and 1 that represents the velocity of panning\n */\n\n\nvar calcAutoPanVelocity = function calcAutoPanVelocity(value, min, max) {\n if (value < min) {\n return clamp(Math.abs(value - min), 1, min) / min;\n } else if (value > max) {\n return -clamp(Math.abs(value - max), 1, min) / min;\n }\n\n return 0;\n};\n\nvar calcAutoPan = function calcAutoPan(pos, bounds) {\n var speed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 15;\n var distance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 40;\n var xMovement = calcAutoPanVelocity(pos.x, distance, bounds.width - distance) * speed;\n var yMovement = calcAutoPanVelocity(pos.y, distance, bounds.height - distance) * speed;\n return [xMovement, yMovement];\n};\n\nvar getBoundsOfBoxes = function getBoundsOfBoxes(box1, box2) {\n return {\n x: Math.min(box1.x, box2.x),\n y: Math.min(box1.y, box2.y),\n x2: Math.max(box1.x2, box2.x2),\n y2: Math.max(box1.y2, box2.y2)\n };\n};\n\nvar rectToBox = function rectToBox(_ref12) {\n var x = _ref12.x,\n y = _ref12.y,\n width = _ref12.width,\n height = _ref12.height;\n return {\n x: x,\n y: y,\n x2: x + width,\n y2: y + height\n };\n};\n\nvar boxToRect = function boxToRect(_ref13) {\n var x = _ref13.x,\n y = _ref13.y,\n x2 = _ref13.x2,\n y2 = _ref13.y2;\n return {\n x: x,\n y: y,\n width: x2 - x,\n height: y2 - y\n };\n};\n\nvar nodeToRect = function nodeToRect(node) {\n var _ref15, _ref16, _node$measured$width2, _node$measured, _ref17, _ref18, _node$measured$height2, _node$measured2;\n\n var nodeOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0];\n\n var _ref14 = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin),\n x = _ref14.x,\n y = _ref14.y;\n\n return {\n x: x,\n y: y,\n width: (_ref15 = (_ref16 = (_node$measured$width2 = (_node$measured = node.measured) === null || _node$measured === void 0 ? void 0 : _node$measured.width) !== null && _node$measured$width2 !== void 0 ? _node$measured$width2 : node.width) !== null && _ref16 !== void 0 ? _ref16 : node.initialWidth) !== null && _ref15 !== void 0 ? _ref15 : 0,\n height: (_ref17 = (_ref18 = (_node$measured$height2 = (_node$measured2 = node.measured) === null || _node$measured2 === void 0 ? void 0 : _node$measured2.height) !== null && _node$measured$height2 !== void 0 ? _node$measured$height2 : node.height) !== null && _ref18 !== void 0 ? _ref18 : node.initialHeight) !== null && _ref17 !== void 0 ? _ref17 : 0\n };\n};\n\nvar nodeToBox = function nodeToBox(node) {\n var _ref20, _ref21, _node$measured$width3, _node$measured3, _ref22, _ref23, _node$measured$height3, _node$measured4;\n\n var nodeOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0];\n\n var _ref19 = isInternalNodeBase(node) ? node.internals.positionAbsolute : getNodePositionWithOrigin(node, nodeOrigin),\n x = _ref19.x,\n y = _ref19.y;\n\n return {\n x: x,\n y: y,\n x2: x + ((_ref20 = (_ref21 = (_node$measured$width3 = (_node$measured3 = node.measured) === null || _node$measured3 === void 0 ? void 0 : _node$measured3.width) !== null && _node$measured$width3 !== void 0 ? _node$measured$width3 : node.width) !== null && _ref21 !== void 0 ? _ref21 : node.initialWidth) !== null && _ref20 !== void 0 ? _ref20 : 0),\n y2: y + ((_ref22 = (_ref23 = (_node$measured$height3 = (_node$measured4 = node.measured) === null || _node$measured4 === void 0 ? void 0 : _node$measured4.height) !== null && _node$measured$height3 !== void 0 ? _node$measured$height3 : node.height) !== null && _ref23 !== void 0 ? _ref23 : node.initialHeight) !== null && _ref22 !== void 0 ? _ref22 : 0)\n };\n};\n\nvar getBoundsOfRects = function getBoundsOfRects(rect1, rect2) {\n return boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2)));\n};\n\nvar getOverlappingArea = function getOverlappingArea(rectA, rectB) {\n var xOverlap = Math.max(0, Math.min(rectA.x + rectA.width, rectB.x + rectB.width) - Math.max(rectA.x, rectB.x));\n var yOverlap = Math.max(0, Math.min(rectA.y + rectA.height, rectB.y + rectB.height) - Math.max(rectA.y, rectB.y));\n return Math.ceil(xOverlap * yOverlap);\n}; // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n\nvar isRectObject = function isRectObject(obj) {\n return isNumeric(obj.width) && isNumeric(obj.height) && isNumeric(obj.x) && isNumeric(obj.y);\n};\n/* eslint-disable-next-line @typescript-eslint/no-explicit-any */\n\n\nvar isNumeric = function isNumeric(n) {\n return !isNaN(n) && isFinite(n);\n}; // used for a11y key board controls for nodes and edges\n\n\nvar devWarn = function devWarn(id, message) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\"[React Flow]: \".concat(message, \" Help: https://reactflow.dev/error#\").concat(id));\n }\n};\n\nvar snapPosition = function snapPosition(position) {\n var snapGrid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [1, 1];\n return {\n x: snapGrid[0] * Math.round(position.x / snapGrid[0]),\n y: snapGrid[1] * Math.round(position.y / snapGrid[1])\n };\n};\n\nvar pointToRendererPoint = function pointToRendererPoint(_ref24, _ref25) {\n var x = _ref24.x,\n y = _ref24.y;\n\n var _ref26 = _slicedToArray(_ref25, 3),\n tx = _ref26[0],\n ty = _ref26[1],\n tScale = _ref26[2];\n\n var snapToGrid = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var snapGrid = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [1, 1];\n var position = {\n x: (x - tx) / tScale,\n y: (y - ty) / tScale\n };\n return snapToGrid ? snapPosition(position, snapGrid) : position;\n};\n\nvar rendererPointToPoint = function rendererPointToPoint(_ref27, _ref28) {\n var x = _ref27.x,\n y = _ref27.y;\n\n var _ref29 = _slicedToArray(_ref28, 3),\n tx = _ref29[0],\n ty = _ref29[1],\n tScale = _ref29[2];\n\n return {\n x: x * tScale + tx,\n y: y * tScale + ty\n };\n};\n/**\n * Parses a single padding value to a number\n * @internal\n * @param padding - Padding to parse\n * @param viewport - Width or height of the viewport\n * @returns The padding in pixels\n */\n\n\nfunction parsePadding(padding, viewport) {\n if (typeof padding === 'number') {\n return Math.floor(viewport - viewport / (1 + padding));\n }\n\n if (typeof padding === 'string' && padding.endsWith('px')) {\n var paddingValue = parseFloat(padding);\n\n if (!Number.isNaN(paddingValue)) {\n return Math.floor(paddingValue);\n }\n }\n\n if (typeof padding === 'string' && padding.endsWith('%')) {\n var _paddingValue = parseFloat(padding);\n\n if (!Number.isNaN(_paddingValue)) {\n return Math.floor(viewport * _paddingValue * 0.01);\n }\n }\n\n console.error(\"[React Flow] The padding value \\\"\".concat(padding, \"\\\" is invalid. Please provide a number or a string with a valid unit (px or %).\"));\n return 0;\n}\n/**\n * Parses the paddings to an object with top, right, bottom, left, x and y paddings\n * @internal\n * @param padding - Padding to parse\n * @param width - Width of the viewport\n * @param height - Height of the viewport\n * @returns An object with the paddings in pixels\n */\n\n\nfunction parsePaddings(padding, width, height) {\n if (typeof padding === 'string' || typeof padding === 'number') {\n var paddingY = parsePadding(padding, height);\n var paddingX = parsePadding(padding, width);\n return {\n top: paddingY,\n right: paddingX,\n bottom: paddingY,\n left: paddingX,\n x: paddingX * 2,\n y: paddingY * 2\n };\n }\n\n if (typeof padding === 'object') {\n var _ref30, _padding$top, _ref31, _padding$bottom, _ref32, _padding$left, _ref33, _padding$right;\n\n var top = parsePadding((_ref30 = (_padding$top = padding.top) !== null && _padding$top !== void 0 ? _padding$top : padding.y) !== null && _ref30 !== void 0 ? _ref30 : 0, height);\n var bottom = parsePadding((_ref31 = (_padding$bottom = padding.bottom) !== null && _padding$bottom !== void 0 ? _padding$bottom : padding.y) !== null && _ref31 !== void 0 ? _ref31 : 0, height);\n var left = parsePadding((_ref32 = (_padding$left = padding.left) !== null && _padding$left !== void 0 ? _padding$left : padding.x) !== null && _ref32 !== void 0 ? _ref32 : 0, width);\n var right = parsePadding((_ref33 = (_padding$right = padding.right) !== null && _padding$right !== void 0 ? _padding$right : padding.x) !== null && _ref33 !== void 0 ? _ref33 : 0, width);\n return {\n top: top,\n right: right,\n bottom: bottom,\n left: left,\n x: left + right,\n y: top + bottom\n };\n }\n\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n x: 0,\n y: 0\n };\n}\n/**\n * Calculates the resulting paddings if the new viewport is applied\n * @internal\n * @param bounds - Bounds to fit inside viewport\n * @param x - X position of the viewport\n * @param y - Y position of the viewport\n * @param zoom - Zoom level of the viewport\n * @param width - Width of the viewport\n * @param height - Height of the viewport\n * @returns An object with the minimum padding required to fit the bounds inside the viewport\n */\n\n\nfunction calculateAppliedPaddings(bounds, x, y, zoom, width, height) {\n var _rendererPointToPoint = rendererPointToPoint(bounds, [x, y, zoom]),\n left = _rendererPointToPoint.x,\n top = _rendererPointToPoint.y;\n\n var _rendererPointToPoint2 = rendererPointToPoint({\n x: bounds.x + bounds.width,\n y: bounds.y + bounds.height\n }, [x, y, zoom]),\n boundRight = _rendererPointToPoint2.x,\n boundBottom = _rendererPointToPoint2.y;\n\n var right = width - boundRight;\n var bottom = height - boundBottom;\n return {\n left: Math.floor(left),\n top: Math.floor(top),\n right: Math.floor(right),\n bottom: Math.floor(bottom)\n };\n}\n/**\n * Returns a viewport that encloses the given bounds with optional padding.\n * @public\n * @remarks You can determine bounds of nodes with {@link getNodesBounds} and {@link getBoundsOfRects}\n * @param bounds - Bounds to fit inside viewport\n * @param width - Width of the viewport\n * @param height - Height of the viewport\n * @param minZoom - Minimum zoom level of the resulting viewport\n * @param maxZoom - Maximum zoom level of the resulting viewport\n * @param padding - Optional padding around the bounds\n * @returns A transforned {@link Viewport} that encloses the given bounds which you can pass to e.g. {@link setViewport}\n * @example\n * const { x, y, zoom } = getViewportForBounds(\n * { x: 0, y: 0, width: 100, height: 100},\n * 1200, 800, 0.5, 2);\n */\n\n\nvar getViewportForBounds = function getViewportForBounds(bounds, width, height, minZoom, maxZoom, padding) {\n // First we resolve all the paddings to actual pixel values\n var p = parsePaddings(padding, width, height);\n var xZoom = (width - p.x) / bounds.width;\n var yZoom = (height - p.y) / bounds.height; // We calculate the new x, y, zoom for a centered view\n\n var zoom = Math.min(xZoom, yZoom);\n var clampedZoom = clamp(zoom, minZoom, maxZoom);\n var boundsCenterX = bounds.x + bounds.width / 2;\n var boundsCenterY = bounds.y + bounds.height / 2;\n var x = width / 2 - boundsCenterX * clampedZoom;\n var y = height / 2 - boundsCenterY * clampedZoom; // Then we calculate the minimum padding, to respect asymmetric paddings\n\n var newPadding = calculateAppliedPaddings(bounds, x, y, clampedZoom, width, height); // We only want to have an offset if the newPadding is smaller than the required padding\n\n var offset = {\n left: Math.min(newPadding.left - p.left, 0),\n top: Math.min(newPadding.top - p.top, 0),\n right: Math.min(newPadding.right - p.right, 0),\n bottom: Math.min(newPadding.bottom - p.bottom, 0)\n };\n return {\n x: x - offset.left + offset.right,\n y: y - offset.top + offset.bottom,\n zoom: clampedZoom\n };\n};\n\nvar isMacOs = function isMacOs() {\n var _navigator, _navigator$userAgent;\n\n return typeof navigator !== 'undefined' && ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$userAgent = _navigator.userAgent) === null || _navigator$userAgent === void 0 ? void 0 : _navigator$userAgent.indexOf('Mac')) >= 0;\n};\n\nfunction isCoordinateExtent(extent) {\n return extent !== undefined && extent !== 'parent';\n}\n\nfunction getNodeDimensions(node) {\n var _ref34, _ref35, _node$measured$width4, _node$measured5, _ref36, _ref37, _node$measured$height4, _node$measured6;\n\n return {\n width: (_ref34 = (_ref35 = (_node$measured$width4 = (_node$measured5 = node.measured) === null || _node$measured5 === void 0 ? void 0 : _node$measured5.width) !== null && _node$measured$width4 !== void 0 ? _node$measured$width4 : node.width) !== null && _ref35 !== void 0 ? _ref35 : node.initialWidth) !== null && _ref34 !== void 0 ? _ref34 : 0,\n height: (_ref36 = (_ref37 = (_node$measured$height4 = (_node$measured6 = node.measured) === null || _node$measured6 === void 0 ? void 0 : _node$measured6.height) !== null && _node$measured$height4 !== void 0 ? _node$measured$height4 : node.height) !== null && _ref37 !== void 0 ? _ref37 : node.initialHeight) !== null && _ref36 !== void 0 ? _ref36 : 0\n };\n}\n\nfunction nodeHasDimensions(node) {\n var _ref38, _node$measured$width5, _node$measured7, _ref39, _node$measured$height5, _node$measured8;\n\n return ((_ref38 = (_node$measured$width5 = (_node$measured7 = node.measured) === null || _node$measured7 === void 0 ? void 0 : _node$measured7.width) !== null && _node$measured$width5 !== void 0 ? _node$measured$width5 : node.width) !== null && _ref38 !== void 0 ? _ref38 : node.initialWidth) !== undefined && ((_ref39 = (_node$measured$height5 = (_node$measured8 = node.measured) === null || _node$measured8 === void 0 ? void 0 : _node$measured8.height) !== null && _node$measured$height5 !== void 0 ? _node$measured$height5 : node.height) !== null && _ref39 !== void 0 ? _ref39 : node.initialHeight) !== undefined;\n}\n/**\n * Convert child position to aboslute position\n *\n * @internal\n * @param position\n * @param parentId\n * @param nodeLookup\n * @param nodeOrigin\n * @returns an internal node with an absolute position\n */\n\n\nfunction evaluateAbsolutePosition(position) {\n var dimensions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n width: 0,\n height: 0\n };\n var parentId = arguments.length > 2 ? arguments[2] : undefined;\n var nodeLookup = arguments.length > 3 ? arguments[3] : undefined;\n var nodeOrigin = arguments.length > 4 ? arguments[4] : undefined;\n\n var positionAbsolute = _objectSpread({}, position);\n\n var parent = nodeLookup.get(parentId);\n\n if (parent) {\n var _dimensions$width2, _dimensions$height2;\n\n var origin = parent.origin || nodeOrigin;\n positionAbsolute.x += parent.internals.positionAbsolute.x - ((_dimensions$width2 = dimensions.width) !== null && _dimensions$width2 !== void 0 ? _dimensions$width2 : 0) * origin[0];\n positionAbsolute.y += parent.internals.positionAbsolute.y - ((_dimensions$height2 = dimensions.height) !== null && _dimensions$height2 !== void 0 ? _dimensions$height2 : 0) * origin[1];\n }\n\n return positionAbsolute;\n}\n\nfunction areSetsEqual(a, b) {\n if (a.size !== b.size) {\n return false;\n }\n\n var _iterator3 = _createForOfIteratorHelper(a),\n _step3;\n\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var item = _step3.value;\n\n if (!b.has(item)) {\n return false;\n }\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n\n return true;\n}\n\nfunction getPointerPosition(event, _ref40) {\n var _containerBounds$left, _containerBounds$top;\n\n var _ref40$snapGrid = _ref40.snapGrid,\n snapGrid = _ref40$snapGrid === void 0 ? [0, 0] : _ref40$snapGrid,\n _ref40$snapToGrid = _ref40.snapToGrid,\n snapToGrid = _ref40$snapToGrid === void 0 ? false : _ref40$snapToGrid,\n transform = _ref40.transform,\n containerBounds = _ref40.containerBounds;\n\n var _getEventPosition = getEventPosition(event),\n x = _getEventPosition.x,\n y = _getEventPosition.y;\n\n var pointerPos = pointToRendererPoint({\n x: x - ((_containerBounds$left = containerBounds === null || containerBounds === void 0 ? void 0 : containerBounds.left) !== null && _containerBounds$left !== void 0 ? _containerBounds$left : 0),\n y: y - ((_containerBounds$top = containerBounds === null || containerBounds === void 0 ? void 0 : containerBounds.top) !== null && _containerBounds$top !== void 0 ? _containerBounds$top : 0)\n }, transform);\n\n var _ref41 = snapToGrid ? snapPosition(pointerPos, snapGrid) : pointerPos,\n xSnapped = _ref41.x,\n ySnapped = _ref41.y; // we need the snapped position in order to be able to skip unnecessary drag events\n\n\n return _objectSpread({\n xSnapped: xSnapped,\n ySnapped: ySnapped\n }, pointerPos);\n}\n\nvar getDimensions = function getDimensions(node) {\n return {\n width: node.offsetWidth,\n height: node.offsetHeight\n };\n};\n\nvar getHostForElement = function getHostForElement(element) {\n var _element$getRootNode, _window;\n\n return (element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element)) || ((_window = window) === null || _window === void 0 ? void 0 : _window.document);\n};\n\nvar inputTags = ['INPUT', 'SELECT', 'TEXTAREA'];\n\nfunction isInputDOMNode(event) {\n var _event$composedPath, _event$composedPath$c;\n\n // using composed path for handling shadow dom\n var target = ((_event$composedPath = event.composedPath) === null || _event$composedPath === void 0 ? void 0 : (_event$composedPath$c = _event$composedPath.call(event)) === null || _event$composedPath$c === void 0 ? void 0 : _event$composedPath$c[0]) || event.target;\n if ((target === null || target === void 0 ? void 0 : target.nodeType) !== 1\n /* Node.ELEMENT_NODE */\n ) return false;\n var isInput = inputTags.includes(target.nodeName) || target.hasAttribute('contenteditable'); // when an input field is focused we don't want to trigger deletion or movement of nodes\n\n return isInput || !!target.closest('.nokey');\n}\n\nvar isMouseEvent = function isMouseEvent(event) {\n return 'clientX' in event;\n};\n\nvar getEventPosition = function getEventPosition(event, bounds) {\n var _event$touches, _event$touches2, _bounds$left, _bounds$top;\n\n var isMouse = isMouseEvent(event);\n var evtX = isMouse ? event.clientX : (_event$touches = event.touches) === null || _event$touches === void 0 ? void 0 : _event$touches[0].clientX;\n var evtY = isMouse ? event.clientY : (_event$touches2 = event.touches) === null || _event$touches2 === void 0 ? void 0 : _event$touches2[0].clientY;\n return {\n x: evtX - ((_bounds$left = bounds === null || bounds === void 0 ? void 0 : bounds.left) !== null && _bounds$left !== void 0 ? _bounds$left : 0),\n y: evtY - ((_bounds$top = bounds === null || bounds === void 0 ? void 0 : bounds.top) !== null && _bounds$top !== void 0 ? _bounds$top : 0)\n };\n};\n/*\n * The handle bounds are calculated relative to the node element.\n * We store them in the internals object of the node in order to avoid\n * unnecessary recalculations.\n */\n\n\nvar getHandleBounds = function getHandleBounds(type, nodeElement, nodeBounds, zoom, nodeId) {\n var handles = nodeElement.querySelectorAll(\".\".concat(type));\n\n if (!handles || !handles.length) {\n return null;\n }\n\n return Array.from(handles).map(function (handle) {\n var handleBounds = handle.getBoundingClientRect();\n return _objectSpread({\n id: handle.getAttribute('data-handleid'),\n type: type,\n nodeId: nodeId,\n position: handle.getAttribute('data-handlepos'),\n x: (handleBounds.left - nodeBounds.left) / zoom,\n y: (handleBounds.top - nodeBounds.top) / zoom\n }, getDimensions(handle));\n });\n};\n\nfunction getBezierEdgeCenter(_ref42) {\n var sourceX = _ref42.sourceX,\n sourceY = _ref42.sourceY,\n targetX = _ref42.targetX,\n targetY = _ref42.targetY,\n sourceControlX = _ref42.sourceControlX,\n sourceControlY = _ref42.sourceControlY,\n targetControlX = _ref42.targetControlX,\n targetControlY = _ref42.targetControlY;\n\n /*\n * cubic bezier t=0.5 mid point, not the actual mid point, but easy to calculate\n * https://stackoverflow.com/questions/67516101/how-to-find-distance-mid-point-of-bezier-curve\n */\n var centerX = sourceX * 0.125 + sourceControlX * 0.375 + targetControlX * 0.375 + targetX * 0.125;\n var centerY = sourceY * 0.125 + sourceControlY * 0.375 + targetControlY * 0.375 + targetY * 0.125;\n var offsetX = Math.abs(centerX - sourceX);\n var offsetY = Math.abs(centerY - sourceY);\n return [centerX, centerY, offsetX, offsetY];\n}\n\nfunction calculateControlOffset(distance, curvature) {\n if (distance >= 0) {\n return 0.5 * distance;\n }\n\n return curvature * 25 * Math.sqrt(-distance);\n}\n\nfunction getControlWithCurvature(_ref43) {\n var pos = _ref43.pos,\n x1 = _ref43.x1,\n y1 = _ref43.y1,\n x2 = _ref43.x2,\n y2 = _ref43.y2,\n c = _ref43.c;\n\n switch (pos) {\n case Position.Left:\n return [x1 - calculateControlOffset(x1 - x2, c), y1];\n\n case Position.Right:\n return [x1 + calculateControlOffset(x2 - x1, c), y1];\n\n case Position.Top:\n return [x1, y1 - calculateControlOffset(y1 - y2, c)];\n\n case Position.Bottom:\n return [x1, y1 + calculateControlOffset(y2 - y1, c)];\n }\n}\n/**\n * The `getBezierPath` util returns everything you need to render a bezier edge\n *between two nodes.\n * @public\n * @param params.sourceX - The x position of the source handle\n * @param params.sourceY - The y position of the source handle\n * @param params.sourcePosition - The position of the source handle (default: Position.Bottom)\n * @param params.targetX - The x position of the target handle\n * @param params.targetY - The y position of the target handle\n * @param params.targetPosition - The position of the target handle (default: Position.Top)\n * @param params.curvature - The curvature of the bezier edge\n * @returns A path string you can use in an SVG, the labelX and labelY position (center of path) and offsetX, offsetY between source handle and label\n * @example\n * ```js\n * const source = { x: 0, y: 20 };\n * const target = { x: 150, y: 100 };\n *\n * const [path, labelX, labelY, offsetX, offsetY] = getBezierPath({\n * sourceX: source.x,\n * sourceY: source.y,\n * sourcePosition: Position.Right,\n * targetX: target.x,\n * targetY: target.y,\n * targetPosition: Position.Left,\n *});\n *```\n *\n * @remarks This function returns a tuple (aka a fixed-size array) to make it easier to\n *work with multiple edge paths at once.\n */\n\n\nfunction getBezierPath(_ref44) {\n var sourceX = _ref44.sourceX,\n sourceY = _ref44.sourceY,\n _ref44$sourcePosition = _ref44.sourcePosition,\n sourcePosition = _ref44$sourcePosition === void 0 ? Position.Bottom : _ref44$sourcePosition,\n targetX = _ref44.targetX,\n targetY = _ref44.targetY,\n _ref44$targetPosition = _ref44.targetPosition,\n targetPosition = _ref44$targetPosition === void 0 ? Position.Top : _ref44$targetPosition,\n _ref44$curvature = _ref44.curvature,\n curvature = _ref44$curvature === void 0 ? 0.25 : _ref44$curvature;\n\n var _getControlWithCurvat = getControlWithCurvature({\n pos: sourcePosition,\n x1: sourceX,\n y1: sourceY,\n x2: targetX,\n y2: targetY,\n c: curvature\n }),\n _getControlWithCurvat2 = _slicedToArray(_getControlWithCurvat, 2),\n sourceControlX = _getControlWithCurvat2[0],\n sourceControlY = _getControlWithCurvat2[1];\n\n var _getControlWithCurvat3 = getControlWithCurvature({\n pos: targetPosition,\n x1: targetX,\n y1: targetY,\n x2: sourceX,\n y2: sourceY,\n c: curvature\n }),\n _getControlWithCurvat4 = _slicedToArray(_getControlWithCurvat3, 2),\n targetControlX = _getControlWithCurvat4[0],\n targetControlY = _getControlWithCurvat4[1];\n\n var _getBezierEdgeCenter = getBezierEdgeCenter({\n sourceX: sourceX,\n sourceY: sourceY,\n targetX: targetX,\n targetY: targetY,\n sourceControlX: sourceControlX,\n sourceControlY: sourceControlY,\n targetControlX: targetControlX,\n targetControlY: targetControlY\n }),\n _getBezierEdgeCenter2 = _slicedToArray(_getBezierEdgeCenter, 4),\n labelX = _getBezierEdgeCenter2[0],\n labelY = _getBezierEdgeCenter2[1],\n offsetX = _getBezierEdgeCenter2[2],\n offsetY = _getBezierEdgeCenter2[3];\n\n return [\"M\".concat(sourceX, \",\").concat(sourceY, \" C\").concat(sourceControlX, \",\").concat(sourceControlY, \" \").concat(targetControlX, \",\").concat(targetControlY, \" \").concat(targetX, \",\").concat(targetY), labelX, labelY, offsetX, offsetY];\n} // this is used for straight edges and simple smoothstep edges (LTR, RTL, BTT, TTB)\n\n\nfunction getEdgeCenter(_ref45) {\n var sourceX = _ref45.sourceX,\n sourceY = _ref45.sourceY,\n targetX = _ref45.targetX,\n targetY = _ref45.targetY;\n var xOffset = Math.abs(targetX - sourceX) / 2;\n var centerX = targetX < sourceX ? targetX + xOffset : targetX - xOffset;\n var yOffset = Math.abs(targetY - sourceY) / 2;\n var centerY = targetY < sourceY ? targetY + yOffset : targetY - yOffset;\n return [centerX, centerY, xOffset, yOffset];\n}\n\nfunction getElevatedEdgeZIndex(_ref46) {\n var sourceNode = _ref46.sourceNode,\n targetNode = _ref46.targetNode,\n _ref46$selected = _ref46.selected,\n selected = _ref46$selected === void 0 ? false : _ref46$selected,\n _ref46$zIndex = _ref46.zIndex,\n zIndex = _ref46$zIndex === void 0 ? 0 : _ref46$zIndex,\n _ref46$elevateOnSelec = _ref46.elevateOnSelect,\n elevateOnSelect = _ref46$elevateOnSelec === void 0 ? false : _ref46$elevateOnSelec;\n\n if (!elevateOnSelect) {\n return zIndex;\n }\n\n var edgeOrConnectedNodeSelected = selected || targetNode.selected || sourceNode.selected;\n var selectedZIndex = Math.max(sourceNode.internals.z || 0, targetNode.internals.z || 0, 1000);\n return zIndex + (edgeOrConnectedNodeSelected ? selectedZIndex : 0);\n}\n\nfunction isEdgeVisible(_ref47) {\n var sourceNode = _ref47.sourceNode,\n targetNode = _ref47.targetNode,\n width = _ref47.width,\n height = _ref47.height,\n transform = _ref47.transform;\n var edgeBox = getBoundsOfBoxes(nodeToBox(sourceNode), nodeToBox(targetNode));\n\n if (edgeBox.x === edgeBox.x2) {\n edgeBox.x2 += 1;\n }\n\n if (edgeBox.y === edgeBox.y2) {\n edgeBox.y2 += 1;\n }\n\n var viewRect = {\n x: -transform[0] / transform[2],\n y: -transform[1] / transform[2],\n width: width / transform[2],\n height: height / transform[2]\n };\n return getOverlappingArea(viewRect, boxToRect(edgeBox)) > 0;\n}\n\nvar getEdgeId = function getEdgeId(_ref48) {\n var source = _ref48.source,\n sourceHandle = _ref48.sourceHandle,\n target = _ref48.target,\n targetHandle = _ref48.targetHandle;\n return \"xy-edge__\".concat(source).concat(sourceHandle || '', \"-\").concat(target).concat(targetHandle || '');\n};\n\nvar connectionExists = function connectionExists(edge, edges) {\n return edges.some(function (el) {\n return el.source === edge.source && el.target === edge.target && (el.sourceHandle === edge.sourceHandle || !el.sourceHandle && !edge.sourceHandle) && (el.targetHandle === edge.targetHandle || !el.targetHandle && !edge.targetHandle);\n });\n};\n/**\n * This util is a convenience function to add a new Edge to an array of edges. It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.\n * @public\n * @param edgeParams - Either an Edge or a Connection you want to add\n * @param edges - The array of all current edges\n * @returns A new array of edges with the new edge added\n *\n * @remarks If an edge with the same `target` and `source` already exists (and the same\n *`targetHandle` and `sourceHandle` if those are set), then this util won't add\n *a new edge even if the `id` property is different.\n *\n */\n\n\nvar addEdge = function addEdge(edgeParams, edges) {\n if (!edgeParams.source || !edgeParams.target) {\n devWarn('006', errorMessages['error006']());\n return edges;\n }\n\n var edge;\n\n if (isEdgeBase(edgeParams)) {\n edge = _objectSpread({}, edgeParams);\n } else {\n edge = _objectSpread(_objectSpread({}, edgeParams), {}, {\n id: getEdgeId(edgeParams)\n });\n }\n\n if (connectionExists(edge, edges)) {\n return edges;\n }\n\n if (edge.sourceHandle === null) {\n delete edge.sourceHandle;\n }\n\n if (edge.targetHandle === null) {\n delete edge.targetHandle;\n }\n\n return edges.concat(edge);\n};\n/**\n * A handy utility to update an existing [`Edge`](/api-reference/types/edge) with new properties.\n *This searches your edge array for an edge with a matching `id` and updates its\n *properties with the connection you provide.\n * @public\n * @param oldEdge - The edge you want to update\n * @param newConnection - The new connection you want to update the edge with\n * @param edges - The array of all current edges\n * @param options.shouldReplaceId - should the id of the old edge be replaced with the new connection id\n * @returns the updated edges array\n *\n * @example\n * ```js\n *const onReconnect = useCallback(\n * (oldEdge: Edge, newConnection: Connection) => setEdges((els) => reconnectEdge(oldEdge, newConnection, els)),[]);\n *```\n */\n\n\nvar reconnectEdge = function reconnectEdge(oldEdge, newConnection, edges) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {\n shouldReplaceId: true\n };\n\n var oldEdgeId = oldEdge.id,\n rest = _objectWithoutProperties(oldEdge, _excluded);\n\n if (!newConnection.source || !newConnection.target) {\n devWarn('006', errorMessages['error006']());\n return edges;\n }\n\n var foundEdge = edges.find(function (e) {\n return e.id === oldEdge.id;\n });\n\n if (!foundEdge) {\n devWarn('007', errorMessages['error007'](oldEdgeId));\n return edges;\n } // Remove old edge and create the new edge with parameters of old edge.\n\n\n var edge = _objectSpread(_objectSpread({}, rest), {}, {\n id: options.shouldReplaceId ? getEdgeId(newConnection) : oldEdgeId,\n source: newConnection.source,\n target: newConnection.target,\n sourceHandle: newConnection.sourceHandle,\n targetHandle: newConnection.targetHandle\n });\n\n return edges.filter(function (e) {\n return e.id !== oldEdgeId;\n }).concat(edge);\n};\n/**\n * Calculates the straight line path between two points.\n * @public\n * @param params.sourceX - The x position of the source handle\n * @param params.sourceY - The y position of the source handle\n * @param params.targetX - The x position of the target handle\n * @param params.targetY - The y position of the target handle\n * @returns A path string you can use in an SVG, the labelX and labelY position (center of path) and offsetX, offsetY between source handle and label\n * @example\n * ```js\n * const source = { x: 0, y: 20 };\n * const target = { x: 150, y: 100 };\n *\n * const [path, labelX, labelY, offsetX, offsetY] = getStraightPath({\n * sourceX: source.x,\n * sourceY: source.y,\n * sourcePosition: Position.Right,\n * targetX: target.x,\n * targetY: target.y,\n * targetPosition: Position.Left,\n * });\n * ```\n * @remarks This function returns a tuple (aka a fixed-size array) to make it easier to work with multiple edge paths at once.\n */\n\n\nfunction getStraightPath(_ref49) {\n var sourceX = _ref49.sourceX,\n sourceY = _ref49.sourceY,\n targetX = _ref49.targetX,\n targetY = _ref49.targetY;\n\n var _getEdgeCenter = getEdgeCenter({\n sourceX: sourceX,\n sourceY: sourceY,\n targetX: targetX,\n targetY: targetY\n }),\n _getEdgeCenter2 = _slicedToArray(_getEdgeCenter, 4),\n labelX = _getEdgeCenter2[0],\n labelY = _getEdgeCenter2[1],\n offsetX = _getEdgeCenter2[2],\n offsetY = _getEdgeCenter2[3];\n\n return [\"M \".concat(sourceX, \",\").concat(sourceY, \"L \").concat(targetX, \",\").concat(targetY), labelX, labelY, offsetX, offsetY];\n}\n\nvar handleDirections = (_handleDirections = {}, _defineProperty(_handleDirections, Position.Left, {\n x: -1,\n y: 0\n}), _defineProperty(_handleDirections, Position.Right, {\n x: 1,\n y: 0\n}), _defineProperty(_handleDirections, Position.Top, {\n x: 0,\n y: -1\n}), _defineProperty(_handleDirections, Position.Bottom, {\n x: 0,\n y: 1\n}), _handleDirections);\n\nvar getDirection = function getDirection(_ref50) {\n var source = _ref50.source,\n _ref50$sourcePosition = _ref50.sourcePosition,\n sourcePosition = _ref50$sourcePosition === void 0 ? Position.Bottom : _ref50$sourcePosition,\n target = _ref50.target;\n\n if (sourcePosition === Position.Left || sourcePosition === Position.Right) {\n return source.x < target.x ? {\n x: 1,\n y: 0\n } : {\n x: -1,\n y: 0\n };\n }\n\n return source.y < target.y ? {\n x: 0,\n y: 1\n } : {\n x: 0,\n y: -1\n };\n};\n\nvar distance = function distance(a, b) {\n return Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));\n};\n/*\n * ith this function we try to mimic a orthogonal edge routing behaviour\n * It's not as good as a real orthogonal edge routing but it's faster and good enough as a default for step and smooth step edges\n */\n\n\nfunction getPoints(_ref51) {\n var source = _ref51.source,\n _ref51$sourcePosition = _ref51.sourcePosition,\n sourcePosition = _ref51$sourcePosition === void 0 ? Position.Bottom : _ref51$sourcePosition,\n target = _ref51.target,\n _ref51$targetPosition = _ref51.targetPosition,\n targetPosition = _ref51$targetPosition === void 0 ? Position.Top : _ref51$targetPosition,\n center = _ref51.center,\n offset = _ref51.offset;\n var sourceDir = handleDirections[sourcePosition];\n var targetDir = handleDirections[targetPosition];\n var sourceGapped = {\n x: source.x + sourceDir.x * offset,\n y: source.y + sourceDir.y * offset\n };\n var targetGapped = {\n x: target.x + targetDir.x * offset,\n y: target.y + targetDir.y * offset\n };\n var dir = getDirection({\n source: sourceGapped,\n sourcePosition: sourcePosition,\n target: targetGapped\n });\n var dirAccessor = dir.x !== 0 ? 'x' : 'y';\n var currDir = dir[dirAccessor];\n var points = [];\n var centerX, centerY;\n var sourceGapOffset = {\n x: 0,\n y: 0\n };\n var targetGapOffset = {\n x: 0,\n y: 0\n };\n\n var _getEdgeCenter3 = getEdgeCenter({\n sourceX: source.x,\n sourceY: source.y,\n targetX: target.x,\n targetY: target.y\n }),\n _getEdgeCenter4 = _slicedToArray(_getEdgeCenter3, 4),\n defaultCenterX = _getEdgeCenter4[0],\n defaultCenterY = _getEdgeCenter4[1],\n defaultOffsetX = _getEdgeCenter4[2],\n defaultOffsetY = _getEdgeCenter4[3]; // opposite handle positions, default case\n\n\n if (sourceDir[dirAccessor] * targetDir[dirAccessor] === -1) {\n var _center$x, _center$y;\n\n centerX = (_center$x = center.x) !== null && _center$x !== void 0 ? _center$x : defaultCenterX;\n centerY = (_center$y = center.y) !== null && _center$y !== void 0 ? _center$y : defaultCenterY;\n /*\n * --->\n * |\n * >---\n */\n\n var verticalSplit = [{\n x: centerX,\n y: sourceGapped.y\n }, {\n x: centerX,\n y: targetGapped.y\n }];\n /*\n * |\n * ---\n * |\n */\n\n var horizontalSplit = [{\n x: sourceGapped.x,\n y: centerY\n }, {\n x: targetGapped.x,\n y: centerY\n }];\n\n if (sourceDir[dirAccessor] === currDir) {\n points = dirAccessor === 'x' ? verticalSplit : horizontalSplit;\n } else {\n points = dirAccessor === 'x' ? horizontalSplit : verticalSplit;\n }\n } else {\n // sourceTarget means we take x from source and y from target, targetSource is the opposite\n var sourceTarget = [{\n x: sourceGapped.x,\n y: targetGapped.y\n }];\n var targetSource = [{\n x: targetGapped.x,\n y: sourceGapped.y\n }]; // this handles edges with same handle positions\n\n if (dirAccessor === 'x') {\n points = sourceDir.x === currDir ? targetSource : sourceTarget;\n } else {\n points = sourceDir.y === currDir ? sourceTarget : targetSource;\n }\n\n if (sourcePosition === targetPosition) {\n var diff = Math.abs(source[dirAccessor] - target[dirAccessor]); // if an edge goes from right to right for example (sourcePosition === targetPosition) and the distance between source.x and target.x is less than the offset, the added point and the gapped source/target will overlap. This leads to a weird edge path. To avoid this we add a gapOffset to the source/target\n\n if (diff <= offset) {\n var gapOffset = Math.min(offset - 1, offset - diff);\n\n if (sourceDir[dirAccessor] === currDir) {\n sourceGapOffset[dirAccessor] = (sourceGapped[dirAccessor] > source[dirAccessor] ? -1 : 1) * gapOffset;\n } else {\n targetGapOffset[dirAccessor] = (targetGapped[dirAccessor] > target[dirAccessor] ? -1 : 1) * gapOffset;\n }\n }\n } // these are conditions for handling mixed handle positions like Right -> Bottom for example\n\n\n if (sourcePosition !== targetPosition) {\n var dirAccessorOpposite = dirAccessor === 'x' ? 'y' : 'x';\n var isSameDir = sourceDir[dirAccessor] === targetDir[dirAccessorOpposite];\n var sourceGtTargetOppo = sourceGapped[dirAccessorOpposite] > targetGapped[dirAccessorOpposite];\n var sourceLtTargetOppo = sourceGapped[dirAccessorOpposite] < targetGapped[dirAccessorOpposite];\n var flipSourceTarget = sourceDir[dirAccessor] === 1 && (!isSameDir && sourceGtTargetOppo || isSameDir && sourceLtTargetOppo) || sourceDir[dirAccessor] !== 1 && (!isSameDir && sourceLtTargetOppo || isSameDir && sourceGtTargetOppo);\n\n if (flipSourceTarget) {\n points = dirAccessor === 'x' ? sourceTarget : targetSource;\n }\n }\n\n var sourceGapPoint = {\n x: sourceGapped.x + sourceGapOffset.x,\n y: sourceGapped.y + sourceGapOffset.y\n };\n var targetGapPoint = {\n x: targetGapped.x + targetGapOffset.x,\n y: targetGapped.y + targetGapOffset.y\n };\n var maxXDistance = Math.max(Math.abs(sourceGapPoint.x - points[0].x), Math.abs(targetGapPoint.x - points[0].x));\n var maxYDistance = Math.max(Math.abs(sourceGapPoint.y - points[0].y), Math.abs(targetGapPoint.y - points[0].y)); // we want to place the label on the longest segment of the edge\n\n if (maxXDistance >= maxYDistance) {\n centerX = (sourceGapPoint.x + targetGapPoint.x) / 2;\n centerY = points[0].y;\n } else {\n centerX = points[0].x;\n centerY = (sourceGapPoint.y + targetGapPoint.y) / 2;\n }\n }\n\n var pathPoints = [source, {\n x: sourceGapped.x + sourceGapOffset.x,\n y: sourceGapped.y + sourceGapOffset.y\n }].concat(_toConsumableArray(points), [{\n x: targetGapped.x + targetGapOffset.x,\n y: targetGapped.y + targetGapOffset.y\n }, target]);\n return [pathPoints, centerX, centerY, defaultOffsetX, defaultOffsetY];\n}\n\nfunction getBend(a, b, c, size) {\n var bendSize = Math.min(distance(a, b) / 2, distance(b, c) / 2, size);\n var x = b.x,\n y = b.y; // no bend\n\n if (a.x === x && x === c.x || a.y === y && y === c.y) {\n return \"L\".concat(x, \" \").concat(y);\n } // first segment is horizontal\n\n\n if (a.y === y) {\n var _xDir = a.x < c.x ? -1 : 1;\n\n var _yDir = a.y < c.y ? 1 : -1;\n\n return \"L \".concat(x + bendSize * _xDir, \",\").concat(y, \"Q \").concat(x, \",\").concat(y, \" \").concat(x, \",\").concat(y + bendSize * _yDir);\n }\n\n var xDir = a.x < c.x ? 1 : -1;\n var yDir = a.y < c.y ? -1 : 1;\n return \"L \".concat(x, \",\").concat(y + bendSize * yDir, \"Q \").concat(x, \",\").concat(y, \" \").concat(x + bendSize * xDir, \",\").concat(y);\n}\n/**\n * The `getSmoothStepPath` util returns everything you need to render a stepped path\n *between two nodes. The `borderRadius` property can be used to choose how rounded\n *the corners of those steps are.\n * @public\n * @param params.sourceX - The x position of the source handle\n * @param params.sourceY - The y position of the source handle\n * @param params.sourcePosition - The position of the source handle (default: Position.Bottom)\n * @param params.targetX - The x position of the target handle\n * @param params.targetY - The y position of the target handle\n * @param params.targetPosition - The position of the target handle (default: Position.Top)\n * @returns A path string you can use in an SVG, the labelX and labelY position (center of path) and offsetX, offsetY between source handle and label\n * @example\n * ```js\n * const source = { x: 0, y: 20 };\n * const target = { x: 150, y: 100 };\n *\n * const [path, labelX, labelY, offsetX, offsetY] = getSmoothStepPath({\n * sourceX: source.x,\n * sourceY: source.y,\n * sourcePosition: Position.Right,\n * targetX: target.x,\n * targetY: target.y,\n * targetPosition: Position.Left,\n * });\n * ```\n * @remarks This function returns a tuple (aka a fixed-size array) to make it easier to work with multiple edge paths at once.\n */\n\n\nfunction getSmoothStepPath(_ref52) {\n var sourceX = _ref52.sourceX,\n sourceY = _ref52.sourceY,\n _ref52$sourcePosition = _ref52.sourcePosition,\n sourcePosition = _ref52$sourcePosition === void 0 ? Position.Bottom : _ref52$sourcePosition,\n targetX = _ref52.targetX,\n targetY = _ref52.targetY,\n _ref52$targetPosition = _ref52.targetPosition,\n targetPosition = _ref52$targetPosition === void 0 ? Position.Top : _ref52$targetPosition,\n _ref52$borderRadius = _ref52.borderRadius,\n borderRadius = _ref52$borderRadius === void 0 ? 5 : _ref52$borderRadius,\n centerX = _ref52.centerX,\n centerY = _ref52.centerY,\n _ref52$offset = _ref52.offset,\n offset = _ref52$offset === void 0 ? 20 : _ref52$offset;\n\n var _getPoints = getPoints({\n source: {\n x: sourceX,\n y: sourceY\n },\n sourcePosition: sourcePosition,\n target: {\n x: targetX,\n y: targetY\n },\n targetPosition: targetPosition,\n center: {\n x: centerX,\n y: centerY\n },\n offset: offset\n }),\n _getPoints2 = _slicedToArray(_getPoints, 5),\n points = _getPoints2[0],\n labelX = _getPoints2[1],\n labelY = _getPoints2[2],\n offsetX = _getPoints2[3],\n offsetY = _getPoints2[4];\n\n var path = points.reduce(function (res, p, i) {\n var segment = '';\n\n if (i > 0 && i < points.length - 1) {\n segment = getBend(points[i - 1], p, points[i + 1], borderRadius);\n } else {\n segment = \"\".concat(i === 0 ? 'M' : 'L').concat(p.x, \" \").concat(p.y);\n }\n\n res += segment;\n return res;\n }, '');\n return [path, labelX, labelY, offsetX, offsetY];\n}\n\nfunction isNodeInitialized(node) {\n var _node$handles;\n\n return node && !!(node.internals.handleBounds || (_node$handles = node.handles) !== null && _node$handles !== void 0 && _node$handles.length) && !!(node.measured.width || node.width || node.initialWidth);\n}\n\nfunction getEdgePosition(params) {\n var _sourceHandleBounds$s, _targetHandleBounds$t, _targetHandleBounds$t2, _targetHandleBounds$s;\n\n var sourceNode = params.sourceNode,\n targetNode = params.targetNode;\n\n if (!isNodeInitialized(sourceNode) || !isNodeInitialized(targetNode)) {\n return null;\n }\n\n var sourceHandleBounds = sourceNode.internals.handleBounds || toHandleBounds(sourceNode.handles);\n var targetHandleBounds = targetNode.internals.handleBounds || toHandleBounds(targetNode.handles);\n var sourceHandle = getHandle$1((_sourceHandleBounds$s = sourceHandleBounds === null || sourceHandleBounds === void 0 ? void 0 : sourceHandleBounds.source) !== null && _sourceHandleBounds$s !== void 0 ? _sourceHandleBounds$s : [], params.sourceHandle);\n var targetHandle = getHandle$1( // when connection type is loose we can define all handles as sources and connect source -> source\n params.connectionMode === ConnectionMode.Strict ? (_targetHandleBounds$t = targetHandleBounds === null || targetHandleBounds === void 0 ? void 0 : targetHandleBounds.target) !== null && _targetHandleBounds$t !== void 0 ? _targetHandleBounds$t : [] : ((_targetHandleBounds$t2 = targetHandleBounds === null || targetHandleBounds === void 0 ? void 0 : targetHandleBounds.target) !== null && _targetHandleBounds$t2 !== void 0 ? _targetHandleBounds$t2 : []).concat((_targetHandleBounds$s = targetHandleBounds === null || targetHandleBounds === void 0 ? void 0 : targetHandleBounds.source) !== null && _targetHandleBounds$s !== void 0 ? _targetHandleBounds$s : []), params.targetHandle);\n\n if (!sourceHandle || !targetHandle) {\n var _params$onError;\n\n (_params$onError = params.onError) === null || _params$onError === void 0 ? void 0 : _params$onError.call(params, '008', errorMessages['error008'](!sourceHandle ? 'source' : 'target', {\n id: params.id,\n sourceHandle: params.sourceHandle,\n targetHandle: params.targetHandle\n }));\n return null;\n }\n\n var sourcePosition = (sourceHandle === null || sourceHandle === void 0 ? void 0 : sourceHandle.position) || Position.Bottom;\n var targetPosition = (targetHandle === null || targetHandle === void 0 ? void 0 : targetHandle.position) || Position.Top;\n var source = getHandlePosition(sourceNode, sourceHandle, sourcePosition);\n var target = getHandlePosition(targetNode, targetHandle, targetPosition);\n return {\n sourceX: source.x,\n sourceY: source.y,\n targetX: target.x,\n targetY: target.y,\n sourcePosition: sourcePosition,\n targetPosition: targetPosition\n };\n}\n\nfunction toHandleBounds(handles) {\n if (!handles) {\n return null;\n }\n\n var source = [];\n var target = [];\n\n var _iterator4 = _createForOfIteratorHelper(handles),\n _step4;\n\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var _handle$width, _handle$height;\n\n var handle = _step4.value;\n handle.width = (_handle$width = handle.width) !== null && _handle$width !== void 0 ? _handle$width : 1;\n handle.height = (_handle$height = handle.height) !== null && _handle$height !== void 0 ? _handle$height : 1;\n\n if (handle.type === 'source') {\n source.push(handle);\n } else if (handle.type === 'target') {\n target.push(handle);\n }\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n\n return {\n source: source,\n target: target\n };\n}\n\nfunction getHandlePosition(node, handle) {\n var _handle$x, _handle$y, _handle$position;\n\n var fallbackPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Position.Left;\n var center = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var x = ((_handle$x = handle === null || handle === void 0 ? void 0 : handle.x) !== null && _handle$x !== void 0 ? _handle$x : 0) + node.internals.positionAbsolute.x;\n var y = ((_handle$y = handle === null || handle === void 0 ? void 0 : handle.y) !== null && _handle$y !== void 0 ? _handle$y : 0) + node.internals.positionAbsolute.y;\n\n var _ref53 = handle !== null && handle !== void 0 ? handle : getNodeDimensions(node),\n width = _ref53.width,\n height = _ref53.height;\n\n if (center) {\n return {\n x: x + width / 2,\n y: y + height / 2\n };\n }\n\n var position = (_handle$position = handle === null || handle === void 0 ? void 0 : handle.position) !== null && _handle$position !== void 0 ? _handle$position : fallbackPosition;\n\n switch (position) {\n case Position.Top:\n return {\n x: x + width / 2,\n y: y\n };\n\n case Position.Right:\n return {\n x: x + width,\n y: y + height / 2\n };\n\n case Position.Bottom:\n return {\n x: x + width / 2,\n y: y + height\n };\n\n case Position.Left:\n return {\n x: x,\n y: y + height / 2\n };\n }\n}\n\nfunction getHandle$1(bounds, handleId) {\n if (!bounds) {\n return null;\n } // if no handleId is given, we use the first handle, otherwise we check for the id\n\n\n return (!handleId ? bounds[0] : bounds.find(function (d) {\n return d.id === handleId;\n })) || null;\n}\n\nfunction getMarkerId(marker, id) {\n if (!marker) {\n return '';\n }\n\n if (typeof marker === 'string') {\n return marker;\n }\n\n var idPrefix = id ? \"\".concat(id, \"__\") : '';\n return \"\".concat(idPrefix).concat(Object.keys(marker).sort().map(function (key) {\n return \"\".concat(key, \"=\").concat(marker[key]);\n }).join('&'));\n}\n\nfunction createMarkerIds(edges, _ref54) {\n var id = _ref54.id,\n defaultColor = _ref54.defaultColor,\n defaultMarkerStart = _ref54.defaultMarkerStart,\n defaultMarkerEnd = _ref54.defaultMarkerEnd;\n var ids = new Set();\n return edges.reduce(function (markers, edge) {\n [edge.markerStart || defaultMarkerStart, edge.markerEnd || defaultMarkerEnd].forEach(function (marker) {\n if (marker && typeof marker === 'object') {\n var markerId = getMarkerId(marker, id);\n\n if (!ids.has(markerId)) {\n markers.push(_objectSpread({\n id: markerId,\n color: marker.color || defaultColor\n }, marker));\n ids.add(markerId);\n }\n }\n });\n return markers;\n }, []).sort(function (a, b) {\n return a.id.localeCompare(b.id);\n });\n}\n\nfunction getNodeToolbarTransform(nodeRect, viewport, position, offset, align) {\n var alignmentOffset = 0.5;\n\n if (align === 'start') {\n alignmentOffset = 0;\n } else if (align === 'end') {\n alignmentOffset = 1;\n }\n /*\n * position === Position.Top\n * we set the x any y position of the toolbar based on the nodes position\n */\n\n\n var pos = [(nodeRect.x + nodeRect.width * alignmentOffset) * viewport.zoom + viewport.x, nodeRect.y * viewport.zoom + viewport.y - offset]; // and than shift it based on the alignment. The shift values are in %.\n\n var shift = [-100 * alignmentOffset, -100];\n\n switch (position) {\n case Position.Right:\n pos = [(nodeRect.x + nodeRect.width) * viewport.zoom + viewport.x + offset, (nodeRect.y + nodeRect.height * alignmentOffset) * viewport.zoom + viewport.y];\n shift = [0, -100 * alignmentOffset];\n break;\n\n case Position.Bottom:\n pos[1] = (nodeRect.y + nodeRect.height) * viewport.zoom + viewport.y + offset;\n shift[1] = 0;\n break;\n\n case Position.Left:\n pos = [nodeRect.x * viewport.zoom + viewport.x - offset, (nodeRect.y + nodeRect.height * alignmentOffset) * viewport.zoom + viewport.y];\n shift = [-100, -100 * alignmentOffset];\n break;\n }\n\n return \"translate(\".concat(pos[0], \"px, \").concat(pos[1], \"px) translate(\").concat(shift[0], \"%, \").concat(shift[1], \"%)\");\n}\n\nvar defaultOptions = {\n nodeOrigin: [0, 0],\n nodeExtent: infiniteExtent,\n elevateNodesOnSelect: true,\n defaults: {}\n};\n\nvar adoptUserNodesDefaultOptions = _objectSpread(_objectSpread({}, defaultOptions), {}, {\n checkEquality: true\n});\n\nfunction mergeObjects(base, incoming) {\n var result = _objectSpread({}, base);\n\n for (var key in incoming) {\n if (incoming[key] !== undefined) {\n // typecast is safe here, because we check for undefined\n result[key] = incoming[key];\n }\n }\n\n return result;\n}\n\nfunction updateAbsolutePositions(nodeLookup, parentLookup, options) {\n var _options = mergeObjects(defaultOptions, options);\n\n var _iterator5 = _createForOfIteratorHelper(nodeLookup.values()),\n _step5;\n\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n var node = _step5.value;\n\n if (node.parentId) {\n updateChildNode(node, nodeLookup, parentLookup, _options);\n } else {\n var positionWithOrigin = getNodePositionWithOrigin(node, _options.nodeOrigin);\n var extent = isCoordinateExtent(node.extent) ? node.extent : _options.nodeExtent;\n var clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions(node));\n node.internals.positionAbsolute = clampedPosition;\n }\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n}\n\nfunction adoptUserNodes(nodes, nodeLookup, parentLookup, options) {\n var _options = mergeObjects(adoptUserNodesDefaultOptions, options);\n\n var nodesInitialized = true;\n var tmpLookup = new Map(nodeLookup);\n var selectedNodeZ = _options !== null && _options !== void 0 && _options.elevateNodesOnSelect ? 1000 : 0;\n nodeLookup.clear();\n parentLookup.clear();\n\n var _iterator6 = _createForOfIteratorHelper(nodes),\n _step6;\n\n try {\n for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {\n var _internalNode;\n\n var userNode = _step6.value;\n var internalNode = tmpLookup.get(userNode.id);\n\n if (_options.checkEquality && userNode === ((_internalNode = internalNode) === null || _internalNode === void 0 ? void 0 : _internalNode.internals.userNode)) {\n nodeLookup.set(userNode.id, internalNode);\n } else {\n var _userNode$measured, _userNode$measured2, _internalNode2;\n\n var positionWithOrigin = getNodePositionWithOrigin(userNode, _options.nodeOrigin);\n var extent = isCoordinateExtent(userNode.extent) ? userNode.extent : _options.nodeExtent;\n var clampedPosition = clampPosition(positionWithOrigin, extent, getNodeDimensions(userNode));\n internalNode = _objectSpread(_objectSpread(_objectSpread({}, _options.defaults), userNode), {}, {\n measured: {\n width: (_userNode$measured = userNode.measured) === null || _userNode$measured === void 0 ? void 0 : _userNode$measured.width,\n height: (_userNode$measured2 = userNode.measured) === null || _userNode$measured2 === void 0 ? void 0 : _userNode$measured2.height\n },\n internals: {\n positionAbsolute: clampedPosition,\n // if user re-initializes the node or removes `measured` for whatever reason, we reset the handleBounds so that the node gets re-measured\n handleBounds: !userNode.measured ? undefined : (_internalNode2 = internalNode) === null || _internalNode2 === void 0 ? void 0 : _internalNode2.internals.handleBounds,\n z: calculateZ(userNode, selectedNodeZ),\n userNode: userNode\n }\n });\n nodeLookup.set(userNode.id, internalNode);\n }\n\n if ((!internalNode.measured || !internalNode.measured.width || !internalNode.measured.height) && !internalNode.hidden) {\n nodesInitialized = false;\n }\n\n if (userNode.parentId) {\n updateChildNode(internalNode, nodeLookup, parentLookup, options);\n }\n }\n } catch (err) {\n _iterator6.e(err);\n } finally {\n _iterator6.f();\n }\n\n return nodesInitialized;\n}\n\nfunction updateParentLookup(node, parentLookup) {\n if (!node.parentId) {\n return;\n }\n\n var childNodes = parentLookup.get(node.parentId);\n\n if (childNodes) {\n childNodes.set(node.id, node);\n } else {\n parentLookup.set(node.parentId, new Map([[node.id, node]]));\n }\n}\n/**\n * Updates positionAbsolute and zIndex of a child node and the parentLookup.\n */\n\n\nfunction updateChildNode(node, nodeLookup, parentLookup, options) {\n var _mergeObjects = mergeObjects(defaultOptions, options),\n elevateNodesOnSelect = _mergeObjects.elevateNodesOnSelect,\n nodeOrigin = _mergeObjects.nodeOrigin,\n nodeExtent = _mergeObjects.nodeExtent;\n\n var parentId = node.parentId;\n var parentNode = nodeLookup.get(parentId);\n\n if (!parentNode) {\n console.warn(\"Parent node \".concat(parentId, \" not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.\"));\n return;\n }\n\n updateParentLookup(node, parentLookup);\n var selectedNodeZ = elevateNodesOnSelect ? 1000 : 0;\n\n var _calculateChildXYZ = calculateChildXYZ(node, parentNode, nodeOrigin, nodeExtent, selectedNodeZ),\n x = _calculateChildXYZ.x,\n y = _calculateChildXYZ.y,\n z = _calculateChildXYZ.z;\n\n var positionAbsolute = node.internals.positionAbsolute;\n var positionChanged = x !== positionAbsolute.x || y !== positionAbsolute.y;\n\n if (positionChanged || z !== node.internals.z) {\n // we create a new object to mark the node as updated\n nodeLookup.set(node.id, _objectSpread(_objectSpread({}, node), {}, {\n internals: _objectSpread(_objectSpread({}, node.internals), {}, {\n positionAbsolute: positionChanged ? {\n x: x,\n y: y\n } : positionAbsolute,\n z: z\n })\n }));\n }\n}\n\nfunction calculateZ(node, selectedNodeZ) {\n return (isNumeric(node.zIndex) ? node.zIndex : 0) + (node.selected ? selectedNodeZ : 0);\n}\n\nfunction calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, selectedNodeZ) {\n var _parentNode$internals2;\n\n var _parentNode$internals = parentNode.internals.positionAbsolute,\n parentX = _parentNode$internals.x,\n parentY = _parentNode$internals.y;\n var childDimensions = getNodeDimensions(childNode);\n var positionWithOrigin = getNodePositionWithOrigin(childNode, nodeOrigin);\n var clampedPosition = isCoordinateExtent(childNode.extent) ? clampPosition(positionWithOrigin, childNode.extent, childDimensions) : positionWithOrigin;\n var absolutePosition = clampPosition({\n x: parentX + clampedPosition.x,\n y: parentY + clampedPosition.y\n }, nodeExtent, childDimensions);\n\n if (childNode.extent === 'parent') {\n absolutePosition = clampPositionToParent(absolutePosition, childDimensions, parentNode);\n }\n\n var childZ = calculateZ(childNode, selectedNodeZ);\n var parentZ = (_parentNode$internals2 = parentNode.internals.z) !== null && _parentNode$internals2 !== void 0 ? _parentNode$internals2 : 0;\n return {\n x: absolutePosition.x,\n y: absolutePosition.y,\n z: parentZ > childZ ? parentZ : childZ\n };\n}\n\nfunction handleExpandParent(children, nodeLookup, parentLookup) {\n var nodeOrigin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [0, 0];\n var changes = [];\n var parentExpansions = new Map(); // determine the expanded rectangle the child nodes would take for each parent\n\n var _iterator7 = _createForOfIteratorHelper(children),\n _step7;\n\n try {\n for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {\n var _parentExpansions$get, _parentExpansions$get2;\n\n var child = _step7.value;\n var parent = nodeLookup.get(child.parentId);\n\n if (!parent) {\n continue;\n }\n\n var parentRect = (_parentExpansions$get = (_parentExpansions$get2 = parentExpansions.get(child.parentId)) === null || _parentExpansions$get2 === void 0 ? void 0 : _parentExpansions$get2.expandedRect) !== null && _parentExpansions$get !== void 0 ? _parentExpansions$get : nodeToRect(parent);\n var expandedRect = getBoundsOfRects(parentRect, child.rect);\n parentExpansions.set(child.parentId, {\n expandedRect: expandedRect,\n parent: parent\n });\n }\n } catch (err) {\n _iterator7.e(err);\n } finally {\n _iterator7.f();\n }\n\n if (parentExpansions.size > 0) {\n parentExpansions.forEach(function (_ref55, parentId) {\n var _parent$origin;\n\n var expandedRect = _ref55.expandedRect,\n parent = _ref55.parent;\n // determine the position & dimensions of the parent\n var positionAbsolute = parent.internals.positionAbsolute;\n var dimensions = getNodeDimensions(parent);\n var origin = (_parent$origin = parent.origin) !== null && _parent$origin !== void 0 ? _parent$origin : nodeOrigin; // determine how much the parent expands in width and position\n\n var xChange = expandedRect.x < positionAbsolute.x ? Math.round(Math.abs(positionAbsolute.x - expandedRect.x)) : 0;\n var yChange = expandedRect.y < positionAbsolute.y ? Math.round(Math.abs(positionAbsolute.y - expandedRect.y)) : 0;\n var newWidth = Math.max(dimensions.width, Math.round(expandedRect.width));\n var newHeight = Math.max(dimensions.height, Math.round(expandedRect.height));\n var widthChange = (newWidth - dimensions.width) * origin[0];\n var heightChange = (newHeight - dimensions.height) * origin[1]; // We need to correct the position of the parent node if the origin is not [0,0]\n\n if (xChange > 0 || yChange > 0 || widthChange || heightChange) {\n var _parentLookup$get;\n\n changes.push({\n id: parentId,\n type: 'position',\n position: {\n x: parent.position.x - xChange + widthChange,\n y: parent.position.y - yChange + heightChange\n }\n });\n /*\n * We move all child nodes in the oppsite direction\n * so the x,y changes of the parent do not move the children\n */\n\n (_parentLookup$get = parentLookup.get(parentId)) === null || _parentLookup$get === void 0 ? void 0 : _parentLookup$get.forEach(function (childNode) {\n if (!children.some(function (child) {\n return child.id === childNode.id;\n })) {\n changes.push({\n id: childNode.id,\n type: 'position',\n position: {\n x: childNode.position.x + xChange,\n y: childNode.position.y + yChange\n }\n });\n }\n });\n } // We need to correct the dimensions of the parent node if the origin is not [0,0]\n\n\n if (dimensions.width < expandedRect.width || dimensions.height < expandedRect.height || xChange || yChange) {\n changes.push({\n id: parentId,\n type: 'dimensions',\n setAttributes: true,\n dimensions: {\n width: newWidth + (xChange ? origin[0] * xChange - widthChange : 0),\n height: newHeight + (yChange ? origin[1] * yChange - heightChange : 0)\n }\n });\n }\n });\n }\n\n return changes;\n}\n\nfunction updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin, nodeExtent) {\n var viewportNode = domNode === null || domNode === void 0 ? void 0 : domNode.querySelector('.xyflow__viewport');\n var updatedInternals = false;\n\n if (!viewportNode) {\n return {\n changes: [],\n updatedInternals: updatedInternals\n };\n }\n\n var changes = [];\n var style = window.getComputedStyle(viewportNode);\n\n var _window$DOMMatrixRead = new window.DOMMatrixReadOnly(style.transform),\n zoom = _window$DOMMatrixRead.m22; // in this array we collect nodes, that might trigger changes (like expanding parent)\n\n\n var parentExpandChildren = [];\n\n var _iterator8 = _createForOfIteratorHelper(updates.values()),\n _step8;\n\n try {\n for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {\n var update = _step8.value;\n var node = nodeLookup.get(update.id);\n\n if (!node) {\n continue;\n }\n\n if (node.hidden) {\n nodeLookup.set(node.id, _objectSpread(_objectSpread({}, node), {}, {\n internals: _objectSpread(_objectSpread({}, node.internals), {}, {\n handleBounds: undefined\n })\n }));\n updatedInternals = true;\n continue;\n }\n\n var dimensions = getDimensions(update.nodeElement);\n var dimensionChanged = node.measured.width !== dimensions.width || node.measured.height !== dimensions.height;\n var doUpdate = !!(dimensions.width && dimensions.height && (dimensionChanged || !node.internals.handleBounds || update.force));\n\n if (doUpdate) {\n var nodeBounds = update.nodeElement.getBoundingClientRect();\n var extent = isCoordinateExtent(node.extent) ? node.extent : nodeExtent;\n var positionAbsolute = node.internals.positionAbsolute;\n\n if (node.parentId && node.extent === 'parent') {\n positionAbsolute = clampPositionToParent(positionAbsolute, dimensions, nodeLookup.get(node.parentId));\n } else if (extent) {\n positionAbsolute = clampPosition(positionAbsolute, extent, dimensions);\n }\n\n var newNode = _objectSpread(_objectSpread({}, node), {}, {\n measured: dimensions,\n internals: _objectSpread(_objectSpread({}, node.internals), {}, {\n positionAbsolute: positionAbsolute,\n handleBounds: {\n source: getHandleBounds('source', update.nodeElement, nodeBounds, zoom, node.id),\n target: getHandleBounds('target', update.nodeElement, nodeBounds, zoom, node.id)\n }\n })\n });\n\n nodeLookup.set(node.id, newNode);\n\n if (node.parentId) {\n updateChildNode(newNode, nodeLookup, parentLookup, {\n nodeOrigin: nodeOrigin\n });\n }\n\n updatedInternals = true;\n\n if (dimensionChanged) {\n changes.push({\n id: node.id,\n type: 'dimensions',\n dimensions: dimensions\n });\n\n if (node.expandParent && node.parentId) {\n parentExpandChildren.push({\n id: node.id,\n parentId: node.parentId,\n rect: nodeToRect(newNode, nodeOrigin)\n });\n }\n }\n }\n }\n } catch (err) {\n _iterator8.e(err);\n } finally {\n _iterator8.f();\n }\n\n if (parentExpandChildren.length > 0) {\n var parentExpandChanges = handleExpandParent(parentExpandChildren, nodeLookup, parentLookup, nodeOrigin);\n changes.push.apply(changes, _toConsumableArray(parentExpandChanges));\n }\n\n return {\n changes: changes,\n updatedInternals: updatedInternals\n };\n}\n\nfunction panBy(_x4) {\n return _panBy.apply(this, arguments);\n}\n/**\n * this function adds the connection to the connectionLookup\n * at the following keys: nodeId-type-handleId, nodeId-type and nodeId\n * @param type type of the connection\n * @param connection connection that should be added to the lookup\n * @param connectionKey at which key the connection should be added\n * @param connectionLookup reference to the connection lookup\n * @param nodeId nodeId of the connection\n * @param handleId handleId of the conneciton\n */\n\n\nfunction _panBy() {\n _panBy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref56) {\n var delta, panZoom, transform, translateExtent, width, height, nextViewport, transformChanged;\n return _regeneratorRuntime.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n delta = _ref56.delta, panZoom = _ref56.panZoom, transform = _ref56.transform, translateExtent = _ref56.translateExtent, width = _ref56.width, height = _ref56.height;\n\n if (!(!panZoom || !delta.x && !delta.y)) {\n _context6.next = 3;\n break;\n }\n\n return _context6.abrupt(\"return\", Promise.resolve(false));\n\n case 3:\n _context6.next = 5;\n return panZoom.setViewportConstrained({\n x: transform[0] + delta.x,\n y: transform[1] + delta.y,\n zoom: transform[2]\n }, [[0, 0], [width, height]], translateExtent);\n\n case 5:\n nextViewport = _context6.sent;\n transformChanged = !!nextViewport && (nextViewport.x !== transform[0] || nextViewport.y !== transform[1] || nextViewport.k !== transform[2]);\n return _context6.abrupt(\"return\", Promise.resolve(transformChanged));\n\n case 8:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n return _panBy.apply(this, arguments);\n}\n\nfunction addConnectionToLookup(type, connection, connectionKey, connectionLookup, nodeId, handleId) {\n /*\n * We add the connection to the connectionLookup at the following keys\n * 1. nodeId, 2. nodeId-type, 3. nodeId-type-handleId\n * If the key already exists, we add the connection to the existing map\n */\n var key = nodeId;\n var nodeMap = connectionLookup.get(key) || new Map();\n connectionLookup.set(key, nodeMap.set(connectionKey, connection));\n key = \"\".concat(nodeId, \"-\").concat(type);\n var typeMap = connectionLookup.get(key) || new Map();\n connectionLookup.set(key, typeMap.set(connectionKey, connection));\n\n if (handleId) {\n key = \"\".concat(nodeId, \"-\").concat(type, \"-\").concat(handleId);\n var handleMap = connectionLookup.get(key) || new Map();\n connectionLookup.set(key, handleMap.set(connectionKey, connection));\n }\n}\n\nfunction updateConnectionLookup(connectionLookup, edgeLookup, edges) {\n connectionLookup.clear();\n edgeLookup.clear();\n\n var _iterator9 = _createForOfIteratorHelper(edges),\n _step9;\n\n try {\n for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {\n var edge = _step9.value;\n var sourceNode = edge.source,\n targetNode = edge.target,\n _edge$sourceHandle = edge.sourceHandle,\n sourceHandle = _edge$sourceHandle === void 0 ? null : _edge$sourceHandle,\n _edge$targetHandle = edge.targetHandle,\n targetHandle = _edge$targetHandle === void 0 ? null : _edge$targetHandle;\n var connection = {\n edgeId: edge.id,\n source: sourceNode,\n target: targetNode,\n sourceHandle: sourceHandle,\n targetHandle: targetHandle\n };\n var sourceKey = \"\".concat(sourceNode, \"-\").concat(sourceHandle, \"--\").concat(targetNode, \"-\").concat(targetHandle);\n var targetKey = \"\".concat(targetNode, \"-\").concat(targetHandle, \"--\").concat(sourceNode, \"-\").concat(sourceHandle);\n addConnectionToLookup('source', connection, targetKey, connectionLookup, sourceNode, sourceHandle);\n addConnectionToLookup('target', connection, sourceKey, connectionLookup, targetNode, targetHandle);\n edgeLookup.set(edge.id, edge);\n }\n } catch (err) {\n _iterator9.e(err);\n } finally {\n _iterator9.f();\n }\n}\n\nfunction shallowNodeData(a, b) {\n if (a === null || b === null) {\n return false;\n }\n\n var _a = Array.isArray(a) ? a : [a];\n\n var _b = Array.isArray(b) ? b : [b];\n\n if (_a.length !== _b.length) {\n return false;\n }\n\n for (var i = 0; i < _a.length; i++) {\n if (_a[i].id !== _b[i].id || _a[i].type !== _b[i].type || !Object.is(_a[i].data, _b[i].data)) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction isParentSelected(node, nodeLookup) {\n if (!node.parentId) {\n return false;\n }\n\n var parentNode = nodeLookup.get(node.parentId);\n\n if (!parentNode) {\n return false;\n }\n\n if (parentNode.selected) {\n return true;\n }\n\n return isParentSelected(parentNode, nodeLookup);\n}\n\nfunction hasSelector(target, selector, domNode) {\n var current = target;\n\n do {\n var _current, _current$matches, _current2;\n\n if ((_current = current) !== null && _current !== void 0 && (_current$matches = _current.matches) !== null && _current$matches !== void 0 && _current$matches.call(_current, selector)) return true;\n if (current === domNode) return false;\n current = (_current2 = current) === null || _current2 === void 0 ? void 0 : _current2.parentElement;\n } while (current);\n\n return false;\n} // looks for all selected nodes and created a NodeDragItem for each of them\n\n\nfunction getDragItems(nodeLookup, nodesDraggable, mousePos, nodeId) {\n var dragItems = new Map();\n\n var _iterator10 = _createForOfIteratorHelper(nodeLookup),\n _step10;\n\n try {\n for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {\n var _step10$value = _slicedToArray(_step10.value, 2),\n id = _step10$value[0],\n node = _step10$value[1];\n\n if ((node.selected || node.id === nodeId) && (!node.parentId || !isParentSelected(node, nodeLookup)) && (node.draggable || nodesDraggable && typeof node.draggable === 'undefined')) {\n var internalNode = nodeLookup.get(id);\n\n if (internalNode) {\n var _internalNode$measure, _internalNode$measure2;\n\n dragItems.set(id, {\n id: id,\n position: internalNode.position || {\n x: 0,\n y: 0\n },\n distance: {\n x: mousePos.x - internalNode.internals.positionAbsolute.x,\n y: mousePos.y - internalNode.internals.positionAbsolute.y\n },\n extent: internalNode.extent,\n parentId: internalNode.parentId,\n origin: internalNode.origin,\n expandParent: internalNode.expandParent,\n internals: {\n positionAbsolute: internalNode.internals.positionAbsolute || {\n x: 0,\n y: 0\n }\n },\n measured: {\n width: (_internalNode$measure = internalNode.measured.width) !== null && _internalNode$measure !== void 0 ? _internalNode$measure : 0,\n height: (_internalNode$measure2 = internalNode.measured.height) !== null && _internalNode$measure2 !== void 0 ? _internalNode$measure2 : 0\n }\n });\n }\n }\n }\n } catch (err) {\n _iterator10.e(err);\n } finally {\n _iterator10.f();\n }\n\n return dragItems;\n}\n/*\n * returns two params:\n * 1. the dragged node (or the first of the list, if we are dragging a node selection)\n * 2. array of selected nodes (for multi selections)\n */\n\n\nfunction getEventHandlerParams(_ref57) {\n var _nodeLookup$get, _dragItems$get;\n\n var nodeId = _ref57.nodeId,\n dragItems = _ref57.dragItems,\n nodeLookup = _ref57.nodeLookup,\n _ref57$dragging = _ref57.dragging,\n dragging = _ref57$dragging === void 0 ? true : _ref57$dragging;\n var nodesFromDragItems = [];\n\n var _iterator11 = _createForOfIteratorHelper(dragItems),\n _step11;\n\n try {\n for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {\n var _nodeLookup$get2;\n\n var _step11$value = _slicedToArray(_step11.value, 2),\n id = _step11$value[0],\n dragItem = _step11$value[1];\n\n var _node = (_nodeLookup$get2 = nodeLookup.get(id)) === null || _nodeLookup$get2 === void 0 ? void 0 : _nodeLookup$get2.internals.userNode;\n\n if (_node) {\n nodesFromDragItems.push(_objectSpread(_objectSpread({}, _node), {}, {\n position: dragItem.position,\n dragging: dragging\n }));\n }\n }\n } catch (err) {\n _iterator11.e(err);\n } finally {\n _iterator11.f();\n }\n\n if (!nodeId) {\n return [nodesFromDragItems[0], nodesFromDragItems];\n }\n\n var node = (_nodeLookup$get = nodeLookup.get(nodeId)) === null || _nodeLookup$get === void 0 ? void 0 : _nodeLookup$get.internals.userNode;\n return [!node ? nodesFromDragItems[0] : _objectSpread(_objectSpread({}, node), {}, {\n position: ((_dragItems$get = dragItems.get(nodeId)) === null || _dragItems$get === void 0 ? void 0 : _dragItems$get.position) || node.position,\n dragging: dragging\n }), nodesFromDragItems];\n} // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n\nfunction XYDrag(_ref58) {\n var onNodeMouseDown = _ref58.onNodeMouseDown,\n getStoreItems = _ref58.getStoreItems,\n onDragStart = _ref58.onDragStart,\n onDrag = _ref58.onDrag,\n onDragStop = _ref58.onDragStop;\n var lastPos = {\n x: null,\n y: null\n };\n var autoPanId = 0;\n var dragItems = new Map();\n var autoPanStarted = false;\n var mousePosition = {\n x: 0,\n y: 0\n };\n var containerBounds = null;\n var dragStarted = false;\n var d3Selection = null;\n var abortDrag = false; // prevents unintentional dragging on multitouch\n // public functions\n\n function update(_ref59) {\n var noDragClassName = _ref59.noDragClassName,\n handleSelector = _ref59.handleSelector,\n domNode = _ref59.domNode,\n isSelectable = _ref59.isSelectable,\n nodeId = _ref59.nodeId,\n _ref59$nodeClickDista = _ref59.nodeClickDistance,\n nodeClickDistance = _ref59$nodeClickDista === void 0 ? 0 : _ref59$nodeClickDista;\n d3Selection = select(domNode);\n\n function updateNodes(_ref60, dragEvent) {\n var x = _ref60.x,\n y = _ref60.y;\n\n var _getStoreItems = getStoreItems(),\n nodeLookup = _getStoreItems.nodeLookup,\n nodeExtent = _getStoreItems.nodeExtent,\n snapGrid = _getStoreItems.snapGrid,\n snapToGrid = _getStoreItems.snapToGrid,\n nodeOrigin = _getStoreItems.nodeOrigin,\n onNodeDrag = _getStoreItems.onNodeDrag,\n onSelectionDrag = _getStoreItems.onSelectionDrag,\n onError = _getStoreItems.onError,\n updateNodePositions = _getStoreItems.updateNodePositions;\n\n lastPos = {\n x: x,\n y: y\n };\n var hasChange = false;\n var nodesBox = {\n x: 0,\n y: 0,\n x2: 0,\n y2: 0\n };\n\n if (dragItems.size > 1 && nodeExtent) {\n var rect = getInternalNodesBounds(dragItems);\n nodesBox = rectToBox(rect);\n }\n\n var _iterator12 = _createForOfIteratorHelper(dragItems),\n _step12;\n\n try {\n for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {\n var _step12$value = _slicedToArray(_step12.value, 2),\n id = _step12$value[0],\n dragItem = _step12$value[1];\n\n if (!nodeLookup.has(id)) {\n /*\n * if the node is not in the nodeLookup anymore, it was probably deleted while dragging\n * and we don't need to update it anymore\n */\n continue;\n }\n\n var nextPosition = {\n x: x - dragItem.distance.x,\n y: y - dragItem.distance.y\n };\n\n if (snapToGrid) {\n nextPosition = snapPosition(nextPosition, snapGrid);\n }\n /*\n * if there is selection with multiple nodes and a node extent is set, we need to adjust the node extent for each node\n * based on its position so that the node stays at it's position relative to the selection.\n */\n\n\n var adjustedNodeExtent = [[nodeExtent[0][0], nodeExtent[0][1]], [nodeExtent[1][0], nodeExtent[1][1]]];\n\n if (dragItems.size > 1 && nodeExtent && !dragItem.extent) {\n var _positionAbsolute = dragItem.internals.positionAbsolute;\n var x1 = _positionAbsolute.x - nodesBox.x + nodeExtent[0][0];\n var x2 = _positionAbsolute.x + dragItem.measured.width - nodesBox.x2 + nodeExtent[1][0];\n var y1 = _positionAbsolute.y - nodesBox.y + nodeExtent[0][1];\n var y2 = _positionAbsolute.y + dragItem.measured.height - nodesBox.y2 + nodeExtent[1][1];\n adjustedNodeExtent = [[x1, y1], [x2, y2]];\n }\n\n var _calculateNodePositio = calculateNodePosition({\n nodeId: id,\n nextPosition: nextPosition,\n nodeLookup: nodeLookup,\n nodeExtent: adjustedNodeExtent,\n nodeOrigin: nodeOrigin,\n onError: onError\n }),\n position = _calculateNodePositio.position,\n positionAbsolute = _calculateNodePositio.positionAbsolute; // we want to make sure that we only fire a change event when there is a change\n\n\n hasChange = hasChange || dragItem.position.x !== position.x || dragItem.position.y !== position.y;\n dragItem.position = position;\n dragItem.internals.positionAbsolute = positionAbsolute;\n }\n } catch (err) {\n _iterator12.e(err);\n } finally {\n _iterator12.f();\n }\n\n if (!hasChange) {\n return;\n }\n\n updateNodePositions(dragItems, true);\n\n if (dragEvent && (onDrag || onNodeDrag || !nodeId && onSelectionDrag)) {\n var _getEventHandlerParam = getEventHandlerParams({\n nodeId: nodeId,\n dragItems: dragItems,\n nodeLookup: nodeLookup\n }),\n _getEventHandlerParam2 = _slicedToArray(_getEventHandlerParam, 2),\n currentNode = _getEventHandlerParam2[0],\n currentNodes = _getEventHandlerParam2[1];\n\n onDrag === null || onDrag === void 0 ? void 0 : onDrag(dragEvent, dragItems, currentNode, currentNodes);\n onNodeDrag === null || onNodeDrag === void 0 ? void 0 : onNodeDrag(dragEvent, currentNode, currentNodes);\n\n if (!nodeId) {\n onSelectionDrag === null || onSelectionDrag === void 0 ? void 0 : onSelectionDrag(dragEvent, currentNodes);\n }\n }\n }\n\n function autoPan() {\n return _autoPan.apply(this, arguments);\n }\n\n function _autoPan() {\n _autoPan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n var _getStoreItems6, transform, panBy, autoPanSpeed, autoPanOnNodeDrag, _calcAutoPan, _calcAutoPan2, xMovement, yMovement, _lastPos$x2, _lastPos$y2;\n\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (containerBounds) {\n _context.next = 2;\n break;\n }\n\n return _context.abrupt(\"return\");\n\n case 2:\n _getStoreItems6 = getStoreItems(), transform = _getStoreItems6.transform, panBy = _getStoreItems6.panBy, autoPanSpeed = _getStoreItems6.autoPanSpeed, autoPanOnNodeDrag = _getStoreItems6.autoPanOnNodeDrag;\n\n if (autoPanOnNodeDrag) {\n _context.next = 7;\n break;\n }\n\n autoPanStarted = false;\n cancelAnimationFrame(autoPanId);\n return _context.abrupt(\"return\");\n\n case 7:\n _calcAutoPan = calcAutoPan(mousePosition, containerBounds, autoPanSpeed), _calcAutoPan2 = _slicedToArray(_calcAutoPan, 2), xMovement = _calcAutoPan2[0], yMovement = _calcAutoPan2[1];\n\n if (!(xMovement !== 0 || yMovement !== 0)) {\n _context.next = 15;\n break;\n }\n\n lastPos.x = ((_lastPos$x2 = lastPos.x) !== null && _lastPos$x2 !== void 0 ? _lastPos$x2 : 0) - xMovement / transform[2];\n lastPos.y = ((_lastPos$y2 = lastPos.y) !== null && _lastPos$y2 !== void 0 ? _lastPos$y2 : 0) - yMovement / transform[2];\n _context.next = 13;\n return panBy({\n x: xMovement,\n y: yMovement\n });\n\n case 13:\n if (!_context.sent) {\n _context.next = 15;\n break;\n }\n\n updateNodes(lastPos, null);\n\n case 15:\n autoPanId = requestAnimationFrame(autoPan);\n\n case 16:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _autoPan.apply(this, arguments);\n }\n\n function startDrag(event) {\n var _getStoreItems2 = getStoreItems(),\n nodeLookup = _getStoreItems2.nodeLookup,\n multiSelectionActive = _getStoreItems2.multiSelectionActive,\n nodesDraggable = _getStoreItems2.nodesDraggable,\n transform = _getStoreItems2.transform,\n snapGrid = _getStoreItems2.snapGrid,\n snapToGrid = _getStoreItems2.snapToGrid,\n selectNodesOnDrag = _getStoreItems2.selectNodesOnDrag,\n onNodeDragStart = _getStoreItems2.onNodeDragStart,\n onSelectionDragStart = _getStoreItems2.onSelectionDragStart,\n unselectNodesAndEdges = _getStoreItems2.unselectNodesAndEdges;\n\n dragStarted = true;\n\n if ((!selectNodesOnDrag || !isSelectable) && !multiSelectionActive && nodeId) {\n var _nodeLookup$get3;\n\n if (!((_nodeLookup$get3 = nodeLookup.get(nodeId)) !== null && _nodeLookup$get3 !== void 0 && _nodeLookup$get3.selected)) {\n // we need to reset selected nodes when selectNodesOnDrag=false\n unselectNodesAndEdges();\n }\n }\n\n if (isSelectable && selectNodesOnDrag && nodeId) {\n onNodeMouseDown === null || onNodeMouseDown === void 0 ? void 0 : onNodeMouseDown(nodeId);\n }\n\n var pointerPos = getPointerPosition(event.sourceEvent, {\n transform: transform,\n snapGrid: snapGrid,\n snapToGrid: snapToGrid,\n containerBounds: containerBounds\n });\n lastPos = pointerPos;\n dragItems = getDragItems(nodeLookup, nodesDraggable, pointerPos, nodeId);\n\n if (dragItems.size > 0 && (onDragStart || onNodeDragStart || !nodeId && onSelectionDragStart)) {\n var _getEventHandlerParam3 = getEventHandlerParams({\n nodeId: nodeId,\n dragItems: dragItems,\n nodeLookup: nodeLookup\n }),\n _getEventHandlerParam4 = _slicedToArray(_getEventHandlerParam3, 2),\n currentNode = _getEventHandlerParam4[0],\n currentNodes = _getEventHandlerParam4[1];\n\n onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event.sourceEvent, dragItems, currentNode, currentNodes);\n onNodeDragStart === null || onNodeDragStart === void 0 ? void 0 : onNodeDragStart(event.sourceEvent, currentNode, currentNodes);\n\n if (!nodeId) {\n onSelectionDragStart === null || onSelectionDragStart === void 0 ? void 0 : onSelectionDragStart(event.sourceEvent, currentNodes);\n }\n }\n }\n\n var d3DragInstance = drag().clickDistance(nodeClickDistance).on('start', function (event) {\n var _getStoreItems3 = getStoreItems(),\n domNode = _getStoreItems3.domNode,\n nodeDragThreshold = _getStoreItems3.nodeDragThreshold,\n transform = _getStoreItems3.transform,\n snapGrid = _getStoreItems3.snapGrid,\n snapToGrid = _getStoreItems3.snapToGrid;\n\n containerBounds = (domNode === null || domNode === void 0 ? void 0 : domNode.getBoundingClientRect()) || null;\n abortDrag = false;\n\n if (nodeDragThreshold === 0) {\n startDrag(event);\n }\n\n var pointerPos = getPointerPosition(event.sourceEvent, {\n transform: transform,\n snapGrid: snapGrid,\n snapToGrid: snapToGrid,\n containerBounds: containerBounds\n });\n lastPos = pointerPos;\n mousePosition = getEventPosition(event.sourceEvent, containerBounds);\n }).on('drag', function (event) {\n var _getStoreItems4 = getStoreItems(),\n autoPanOnNodeDrag = _getStoreItems4.autoPanOnNodeDrag,\n transform = _getStoreItems4.transform,\n snapGrid = _getStoreItems4.snapGrid,\n snapToGrid = _getStoreItems4.snapToGrid,\n nodeDragThreshold = _getStoreItems4.nodeDragThreshold,\n nodeLookup = _getStoreItems4.nodeLookup;\n\n var pointerPos = getPointerPosition(event.sourceEvent, {\n transform: transform,\n snapGrid: snapGrid,\n snapToGrid: snapToGrid,\n containerBounds: containerBounds\n });\n\n if (event.sourceEvent.type === 'touchmove' && event.sourceEvent.touches.length > 1 || nodeId && !nodeLookup.has(nodeId)) {\n abortDrag = true;\n }\n\n if (abortDrag) {\n return;\n }\n\n if (!autoPanStarted && autoPanOnNodeDrag && dragStarted) {\n autoPanStarted = true;\n autoPan();\n }\n\n if (!dragStarted) {\n var _lastPos$x, _lastPos$y;\n\n var x = pointerPos.xSnapped - ((_lastPos$x = lastPos.x) !== null && _lastPos$x !== void 0 ? _lastPos$x : 0);\n var y = pointerPos.ySnapped - ((_lastPos$y = lastPos.y) !== null && _lastPos$y !== void 0 ? _lastPos$y : 0);\n\n var _distance = Math.sqrt(x * x + y * y);\n\n if (_distance > nodeDragThreshold) {\n startDrag(event);\n }\n } // skip events without movement\n\n\n if ((lastPos.x !== pointerPos.xSnapped || lastPos.y !== pointerPos.ySnapped) && dragItems && dragStarted) {\n // dragEvent = event.sourceEvent as MouseEvent;\n mousePosition = getEventPosition(event.sourceEvent, containerBounds);\n updateNodes(pointerPos, event.sourceEvent);\n }\n }).on('end', function (event) {\n if (!dragStarted || abortDrag) {\n return;\n }\n\n autoPanStarted = false;\n dragStarted = false;\n cancelAnimationFrame(autoPanId);\n\n if (dragItems.size > 0) {\n var _getStoreItems5 = getStoreItems(),\n nodeLookup = _getStoreItems5.nodeLookup,\n updateNodePositions = _getStoreItems5.updateNodePositions,\n onNodeDragStop = _getStoreItems5.onNodeDragStop,\n onSelectionDragStop = _getStoreItems5.onSelectionDragStop;\n\n updateNodePositions(dragItems, false);\n\n if (onDragStop || onNodeDragStop || !nodeId && onSelectionDragStop) {\n var _getEventHandlerParam5 = getEventHandlerParams({\n nodeId: nodeId,\n dragItems: dragItems,\n nodeLookup: nodeLookup,\n dragging: false\n }),\n _getEventHandlerParam6 = _slicedToArray(_getEventHandlerParam5, 2),\n currentNode = _getEventHandlerParam6[0],\n currentNodes = _getEventHandlerParam6[1];\n\n onDragStop === null || onDragStop === void 0 ? void 0 : onDragStop(event.sourceEvent, dragItems, currentNode, currentNodes);\n onNodeDragStop === null || onNodeDragStop === void 0 ? void 0 : onNodeDragStop(event.sourceEvent, currentNode, currentNodes);\n\n if (!nodeId) {\n onSelectionDragStop === null || onSelectionDragStop === void 0 ? void 0 : onSelectionDragStop(event.sourceEvent, currentNodes);\n }\n }\n }\n }).filter(function (event) {\n var target = event.target;\n var isDraggable = !event.button && (!noDragClassName || !hasSelector(target, \".\".concat(noDragClassName), domNode)) && (!handleSelector || hasSelector(target, handleSelector, domNode));\n return isDraggable;\n });\n d3Selection.call(d3DragInstance);\n }\n\n function destroy() {\n var _d3Selection;\n\n (_d3Selection = d3Selection) === null || _d3Selection === void 0 ? void 0 : _d3Selection.on('.drag', null);\n }\n\n return {\n update: update,\n destroy: destroy\n };\n}\n\nfunction getNodesWithinDistance(position, nodeLookup, distance) {\n var nodes = [];\n var rect = {\n x: position.x - distance,\n y: position.y - distance,\n width: distance * 2,\n height: distance * 2\n };\n\n var _iterator13 = _createForOfIteratorHelper(nodeLookup.values()),\n _step13;\n\n try {\n for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {\n var node = _step13.value;\n\n if (getOverlappingArea(rect, nodeToRect(node)) > 0) {\n nodes.push(node);\n }\n }\n } catch (err) {\n _iterator13.e(err);\n } finally {\n _iterator13.f();\n }\n\n return nodes;\n}\n/*\n * this distance is used for the area around the user pointer\n * while doing a connection for finding the closest nodes\n */\n\n\nvar ADDITIONAL_DISTANCE = 250;\n\nfunction getClosestHandle(position, connectionRadius, nodeLookup, fromHandle) {\n var closestHandles = [];\n var minDistance = Infinity;\n var closeNodes = getNodesWithinDistance(position, nodeLookup, connectionRadius + ADDITIONAL_DISTANCE);\n\n var _iterator14 = _createForOfIteratorHelper(closeNodes),\n _step14;\n\n try {\n for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {\n var _node$internals$handl, _node$internals$handl2, _node$internals$handl3, _node$internals$handl4;\n\n var node = _step14.value;\n var allHandles = [].concat(_toConsumableArray((_node$internals$handl = (_node$internals$handl2 = node.internals.handleBounds) === null || _node$internals$handl2 === void 0 ? void 0 : _node$internals$handl2.source) !== null && _node$internals$handl !== void 0 ? _node$internals$handl : []), _toConsumableArray((_node$internals$handl3 = (_node$internals$handl4 = node.internals.handleBounds) === null || _node$internals$handl4 === void 0 ? void 0 : _node$internals$handl4.target) !== null && _node$internals$handl3 !== void 0 ? _node$internals$handl3 : []));\n\n var _iterator15 = _createForOfIteratorHelper(allHandles),\n _step15;\n\n try {\n for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {\n var handle = _step15.value;\n\n // if the handle is the same as the fromHandle we skip it\n if (fromHandle.nodeId === handle.nodeId && fromHandle.type === handle.type && fromHandle.id === handle.id) {\n continue;\n } // determine absolute position of the handle\n\n\n var _getHandlePosition = getHandlePosition(node, handle, handle.position, true),\n x = _getHandlePosition.x,\n y = _getHandlePosition.y;\n\n var _distance2 = Math.sqrt(Math.pow(x - position.x, 2) + Math.pow(y - position.y, 2));\n\n if (_distance2 > connectionRadius) {\n continue;\n }\n\n if (_distance2 < minDistance) {\n closestHandles = [_objectSpread(_objectSpread({}, handle), {}, {\n x: x,\n y: y\n })];\n minDistance = _distance2;\n } else if (_distance2 === minDistance) {\n // when multiple handles are on the same distance we collect all of them\n closestHandles.push(_objectSpread(_objectSpread({}, handle), {}, {\n x: x,\n y: y\n }));\n }\n }\n } catch (err) {\n _iterator15.e(err);\n } finally {\n _iterator15.f();\n }\n }\n } catch (err) {\n _iterator14.e(err);\n } finally {\n _iterator14.f();\n }\n\n if (!closestHandles.length) {\n return null;\n } // when multiple handles overlay each other we prefer the opposite handle\n\n\n if (closestHandles.length > 1) {\n var _closestHandles$find;\n\n var oppositeHandleType = fromHandle.type === 'source' ? 'target' : 'source';\n return (_closestHandles$find = closestHandles.find(function (handle) {\n return handle.type === oppositeHandleType;\n })) !== null && _closestHandles$find !== void 0 ? _closestHandles$find : closestHandles[0];\n }\n\n return closestHandles[0];\n}\n\nfunction getHandle(nodeId, handleType, handleId, nodeLookup, connectionMode) {\n var _node$internals$handl5, _node$internals$handl6, _node$internals$handl7, _node$internals$handl8, _node$internals$handl9, _ref61;\n\n var withAbsolutePosition = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;\n var node = nodeLookup.get(nodeId);\n\n if (!node) {\n return null;\n }\n\n var handles = connectionMode === 'strict' ? (_node$internals$handl5 = node.internals.handleBounds) === null || _node$internals$handl5 === void 0 ? void 0 : _node$internals$handl5[handleType] : [].concat(_toConsumableArray((_node$internals$handl6 = (_node$internals$handl7 = node.internals.handleBounds) === null || _node$internals$handl7 === void 0 ? void 0 : _node$internals$handl7.source) !== null && _node$internals$handl6 !== void 0 ? _node$internals$handl6 : []), _toConsumableArray((_node$internals$handl8 = (_node$internals$handl9 = node.internals.handleBounds) === null || _node$internals$handl9 === void 0 ? void 0 : _node$internals$handl9.target) !== null && _node$internals$handl8 !== void 0 ? _node$internals$handl8 : []));\n var handle = (_ref61 = handleId ? handles === null || handles === void 0 ? void 0 : handles.find(function (h) {\n return h.id === handleId;\n }) : handles === null || handles === void 0 ? void 0 : handles[0]) !== null && _ref61 !== void 0 ? _ref61 : null;\n return handle && withAbsolutePosition ? _objectSpread(_objectSpread({}, handle), getHandlePosition(node, handle, handle.position, true)) : handle;\n}\n\nfunction getHandleType(edgeUpdaterType, handleDomNode) {\n if (edgeUpdaterType) {\n return edgeUpdaterType;\n } else if (handleDomNode !== null && handleDomNode !== void 0 && handleDomNode.classList.contains('target')) {\n return 'target';\n } else if (handleDomNode !== null && handleDomNode !== void 0 && handleDomNode.classList.contains('source')) {\n return 'source';\n }\n\n return null;\n}\n\nfunction isConnectionValid(isInsideConnectionRadius, isHandleValid) {\n var isValid = null;\n\n if (isHandleValid) {\n isValid = true;\n } else if (isInsideConnectionRadius && !isHandleValid) {\n isValid = false;\n }\n\n return isValid;\n}\n\nvar alwaysValid = function alwaysValid() {\n return true;\n};\n\nfunction onPointerDown(event, _ref62) {\n var connectionMode = _ref62.connectionMode,\n connectionRadius = _ref62.connectionRadius,\n handleId = _ref62.handleId,\n nodeId = _ref62.nodeId,\n edgeUpdaterType = _ref62.edgeUpdaterType,\n isTarget = _ref62.isTarget,\n domNode = _ref62.domNode,\n nodeLookup = _ref62.nodeLookup,\n lib = _ref62.lib,\n autoPanOnConnect = _ref62.autoPanOnConnect,\n flowId = _ref62.flowId,\n panBy = _ref62.panBy,\n cancelConnection = _ref62.cancelConnection,\n onConnectStart = _ref62.onConnectStart,\n onConnect = _ref62.onConnect,\n onConnectEnd = _ref62.onConnectEnd,\n _ref62$isValidConnect = _ref62.isValidConnection,\n isValidConnection = _ref62$isValidConnect === void 0 ? alwaysValid : _ref62$isValidConnect,\n onReconnectEnd = _ref62.onReconnectEnd,\n updateConnection = _ref62.updateConnection,\n getTransform = _ref62.getTransform,\n getFromHandle = _ref62.getFromHandle,\n autoPanSpeed = _ref62.autoPanSpeed;\n // when xyflow is used inside a shadow root we can't use document\n var doc = getHostForElement(event.target);\n var autoPanId = 0;\n var closestHandle;\n\n var _getEventPosition2 = getEventPosition(event),\n x = _getEventPosition2.x,\n y = _getEventPosition2.y;\n\n var clickedHandle = doc === null || doc === void 0 ? void 0 : doc.elementFromPoint(x, y);\n var handleType = getHandleType(edgeUpdaterType, clickedHandle);\n var containerBounds = domNode === null || domNode === void 0 ? void 0 : domNode.getBoundingClientRect();\n\n if (!containerBounds || !handleType) {\n return;\n }\n\n var fromHandleInternal = getHandle(nodeId, handleType, handleId, nodeLookup, connectionMode);\n\n if (!fromHandleInternal) {\n return;\n }\n\n var position = getEventPosition(event, containerBounds);\n var autoPanStarted = false;\n var connection = null;\n var isValid = false;\n var handleDomNode = null; // when the user is moving the mouse close to the edge of the canvas while connecting we move the canvas\n\n function autoPan() {\n if (!autoPanOnConnect || !containerBounds) {\n return;\n }\n\n var _calcAutoPan3 = calcAutoPan(position, containerBounds, autoPanSpeed),\n _calcAutoPan4 = _slicedToArray(_calcAutoPan3, 2),\n x = _calcAutoPan4[0],\n y = _calcAutoPan4[1];\n\n panBy({\n x: x,\n y: y\n });\n autoPanId = requestAnimationFrame(autoPan);\n } // Stays the same for all consecutive pointermove events\n\n\n var fromHandle = _objectSpread(_objectSpread({}, fromHandleInternal), {}, {\n nodeId: nodeId,\n type: handleType,\n position: fromHandleInternal.position\n });\n\n var fromNodeInternal = nodeLookup.get(nodeId);\n var from = getHandlePosition(fromNodeInternal, fromHandle, Position.Left, true);\n var newConnection = {\n inProgress: true,\n isValid: null,\n from: from,\n fromHandle: fromHandle,\n fromPosition: fromHandle.position,\n fromNode: fromNodeInternal,\n to: position,\n toHandle: null,\n toPosition: oppositePosition[fromHandle.position],\n toNode: null\n };\n updateConnection(newConnection);\n var previousConnection = newConnection;\n onConnectStart === null || onConnectStart === void 0 ? void 0 : onConnectStart(event, {\n nodeId: nodeId,\n handleId: handleId,\n handleType: handleType\n });\n\n function onPointerMove(event) {\n if (!getFromHandle() || !fromHandle) {\n onPointerUp(event);\n return;\n }\n\n var transform = getTransform();\n position = getEventPosition(event, containerBounds);\n closestHandle = getClosestHandle(pointToRendererPoint(position, transform, false, [1, 1]), connectionRadius, nodeLookup, fromHandle);\n\n if (!autoPanStarted) {\n autoPan();\n autoPanStarted = true;\n }\n\n var result = isValidHandle(event, {\n handle: closestHandle,\n connectionMode: connectionMode,\n fromNodeId: nodeId,\n fromHandleId: handleId,\n fromType: isTarget ? 'target' : 'source',\n isValidConnection: isValidConnection,\n doc: doc,\n lib: lib,\n flowId: flowId,\n nodeLookup: nodeLookup\n });\n handleDomNode = result.handleDomNode;\n connection = result.connection;\n isValid = isConnectionValid(!!closestHandle, result.isValid);\n\n var newConnection = _objectSpread(_objectSpread({}, previousConnection), {}, {\n isValid: isValid,\n to: closestHandle && isValid ? rendererPointToPoint({\n x: closestHandle.x,\n y: closestHandle.y\n }, transform) : position,\n toHandle: result.toHandle,\n toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position],\n toNode: result.toHandle ? nodeLookup.get(result.toHandle.nodeId) : null\n });\n /*\n * we don't want to trigger an update when the connection\n * is snapped to the same handle as before\n */\n\n\n if (isValid && closestHandle && previousConnection.toHandle && newConnection.toHandle && previousConnection.toHandle.type === newConnection.toHandle.type && previousConnection.toHandle.nodeId === newConnection.toHandle.nodeId && previousConnection.toHandle.id === newConnection.toHandle.id && previousConnection.to.x === newConnection.to.x && previousConnection.to.y === newConnection.to.y) {\n return;\n }\n\n updateConnection(newConnection);\n previousConnection = newConnection;\n }\n\n function onPointerUp(event) {\n if ((closestHandle || handleDomNode) && connection && isValid) {\n onConnect === null || onConnect === void 0 ? void 0 : onConnect(connection);\n }\n /*\n * it's important to get a fresh reference from the store here\n * in order to get the latest state of onConnectEnd\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n\n var _previousConnection = previousConnection,\n inProgress = _previousConnection.inProgress,\n connectionState = _objectWithoutProperties(_previousConnection, _excluded2);\n\n var finalConnectionState = _objectSpread(_objectSpread({}, connectionState), {}, {\n toPosition: previousConnection.toHandle ? previousConnection.toPosition : null\n });\n\n onConnectEnd === null || onConnectEnd === void 0 ? void 0 : onConnectEnd(event, finalConnectionState);\n\n if (edgeUpdaterType) {\n onReconnectEnd === null || onReconnectEnd === void 0 ? void 0 : onReconnectEnd(event, finalConnectionState);\n }\n\n cancelConnection();\n cancelAnimationFrame(autoPanId);\n autoPanStarted = false;\n isValid = false;\n connection = null;\n handleDomNode = null;\n doc.removeEventListener('mousemove', onPointerMove);\n doc.removeEventListener('mouseup', onPointerUp);\n doc.removeEventListener('touchmove', onPointerMove);\n doc.removeEventListener('touchend', onPointerUp);\n }\n\n doc.addEventListener('mousemove', onPointerMove);\n doc.addEventListener('mouseup', onPointerUp);\n doc.addEventListener('touchmove', onPointerMove);\n doc.addEventListener('touchend', onPointerUp);\n} // checks if and returns connection in fom of an object { source: 123, target: 312 }\n\n\nfunction isValidHandle(event, _ref63) {\n var handle = _ref63.handle,\n connectionMode = _ref63.connectionMode,\n fromNodeId = _ref63.fromNodeId,\n fromHandleId = _ref63.fromHandleId,\n fromType = _ref63.fromType,\n doc = _ref63.doc,\n lib = _ref63.lib,\n flowId = _ref63.flowId,\n _ref63$isValidConnect = _ref63.isValidConnection,\n isValidConnection = _ref63$isValidConnect === void 0 ? alwaysValid : _ref63$isValidConnect,\n nodeLookup = _ref63.nodeLookup;\n var isTarget = fromType === 'target';\n var handleDomNode = handle ? doc.querySelector(\".\".concat(lib, \"-flow__handle[data-id=\\\"\").concat(flowId, \"-\").concat(handle === null || handle === void 0 ? void 0 : handle.nodeId, \"-\").concat(handle === null || handle === void 0 ? void 0 : handle.id, \"-\").concat(handle === null || handle === void 0 ? void 0 : handle.type, \"\\\"]\")) : null;\n\n var _getEventPosition3 = getEventPosition(event),\n x = _getEventPosition3.x,\n y = _getEventPosition3.y;\n\n var handleBelow = doc.elementFromPoint(x, y);\n /*\n * we always want to prioritize the handle below the mouse cursor over the closest distance handle,\n * because it could be that the center of another handle is closer to the mouse pointer than the handle below the cursor\n */\n\n var handleToCheck = handleBelow !== null && handleBelow !== void 0 && handleBelow.classList.contains(\"\".concat(lib, \"-flow__handle\")) ? handleBelow : handleDomNode;\n var result = {\n handleDomNode: handleToCheck,\n isValid: false,\n connection: null,\n toHandle: null\n };\n\n if (handleToCheck) {\n var handleType = getHandleType(undefined, handleToCheck);\n var handleNodeId = handleToCheck.getAttribute('data-nodeid');\n var handleId = handleToCheck.getAttribute('data-handleid');\n var connectable = handleToCheck.classList.contains('connectable');\n var connectableEnd = handleToCheck.classList.contains('connectableend');\n\n if (!handleNodeId || !handleType) {\n return result;\n }\n\n var connection = {\n source: isTarget ? handleNodeId : fromNodeId,\n sourceHandle: isTarget ? handleId : fromHandleId,\n target: isTarget ? fromNodeId : handleNodeId,\n targetHandle: isTarget ? fromHandleId : handleId\n };\n result.connection = connection;\n var isConnectable = connectable && connectableEnd; // in strict mode we don't allow target to target or source to source connections\n\n var isValid = isConnectable && (connectionMode === ConnectionMode.Strict ? isTarget && handleType === 'source' || !isTarget && handleType === 'target' : handleNodeId !== fromNodeId || handleId !== fromHandleId);\n result.isValid = isValid && isValidConnection(connection);\n result.toHandle = getHandle(handleNodeId, handleType, handleId, nodeLookup, connectionMode, false);\n }\n\n return result;\n}\n\nvar XYHandle = {\n onPointerDown: onPointerDown,\n isValid: isValidHandle\n};\n\nfunction XYMinimap(_ref64) {\n var domNode = _ref64.domNode,\n panZoom = _ref64.panZoom,\n getTransform = _ref64.getTransform,\n getViewScale = _ref64.getViewScale;\n var selection = select(domNode);\n\n function update(_ref65) {\n var translateExtent = _ref65.translateExtent,\n width = _ref65.width,\n height = _ref65.height,\n _ref65$zoomStep = _ref65.zoomStep,\n zoomStep = _ref65$zoomStep === void 0 ? 10 : _ref65$zoomStep,\n _ref65$pannable = _ref65.pannable,\n pannable = _ref65$pannable === void 0 ? true : _ref65$pannable,\n _ref65$zoomable = _ref65.zoomable,\n zoomable = _ref65$zoomable === void 0 ? true : _ref65$zoomable,\n _ref65$inversePan = _ref65.inversePan,\n inversePan = _ref65$inversePan === void 0 ? false : _ref65$inversePan;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var zoomHandler = function zoomHandler(event) {\n var transform = getTransform();\n\n if (event.sourceEvent.type !== 'wheel' || !panZoom) {\n return;\n }\n\n var pinchDelta = -event.sourceEvent.deltaY * (event.sourceEvent.deltaMode === 1 ? 0.05 : event.sourceEvent.deltaMode ? 1 : 0.002) * zoomStep;\n var nextZoom = transform[2] * Math.pow(2, pinchDelta);\n panZoom.scaleTo(nextZoom);\n };\n\n var panStart = [0, 0]; // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n var panStartHandler = function panStartHandler(event) {\n if (event.sourceEvent.type === 'mousedown' || event.sourceEvent.type === 'touchstart') {\n var _event$sourceEvent$cl, _event$sourceEvent$cl2;\n\n panStart = [(_event$sourceEvent$cl = event.sourceEvent.clientX) !== null && _event$sourceEvent$cl !== void 0 ? _event$sourceEvent$cl : event.sourceEvent.touches[0].clientX, (_event$sourceEvent$cl2 = event.sourceEvent.clientY) !== null && _event$sourceEvent$cl2 !== void 0 ? _event$sourceEvent$cl2 : event.sourceEvent.touches[0].clientY];\n }\n }; // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n\n var panHandler = function panHandler(event) {\n var _event$sourceEvent$cl3, _event$sourceEvent$cl4;\n\n var transform = getTransform();\n\n if (event.sourceEvent.type !== 'mousemove' && event.sourceEvent.type !== 'touchmove' || !panZoom) {\n return;\n }\n\n var panCurrent = [(_event$sourceEvent$cl3 = event.sourceEvent.clientX) !== null && _event$sourceEvent$cl3 !== void 0 ? _event$sourceEvent$cl3 : event.sourceEvent.touches[0].clientX, (_event$sourceEvent$cl4 = event.sourceEvent.clientY) !== null && _event$sourceEvent$cl4 !== void 0 ? _event$sourceEvent$cl4 : event.sourceEvent.touches[0].clientY];\n var panDelta = [panCurrent[0] - panStart[0], panCurrent[1] - panStart[1]];\n panStart = panCurrent;\n var moveScale = getViewScale() * Math.max(transform[2], Math.log(transform[2])) * (inversePan ? -1 : 1);\n var position = {\n x: transform[0] - panDelta[0] * moveScale,\n y: transform[1] - panDelta[1] * moveScale\n };\n var extent = [[0, 0], [width, height]];\n panZoom.setViewportConstrained({\n x: position.x,\n y: position.y,\n zoom: transform[2]\n }, extent, translateExtent);\n };\n\n var zoomAndPanHandler = zoom().on('start', panStartHandler) // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .on('zoom', pannable ? panHandler : null) // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .on('zoom.wheel', zoomable ? zoomHandler : null);\n selection.call(zoomAndPanHandler, {});\n }\n\n function destroy() {\n selection.on('zoom', null);\n }\n\n return {\n update: update,\n destroy: destroy,\n pointer: pointer\n };\n}\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\nvar viewChanged = function viewChanged(prevViewport, eventViewport) {\n return prevViewport.x !== eventViewport.x || prevViewport.y !== eventViewport.y || prevViewport.zoom !== eventViewport.k;\n};\n\nvar transformToViewport = function transformToViewport(transform) {\n return {\n x: transform.x,\n y: transform.y,\n zoom: transform.k\n };\n};\n\nvar viewportToTransform = function viewportToTransform(_ref66) {\n var x = _ref66.x,\n y = _ref66.y,\n zoom = _ref66.zoom;\n return zoomIdentity.translate(x, y).scale(zoom);\n};\n\nvar isWrappedWithClass = function isWrappedWithClass(event, className) {\n return event.target.closest(\".\".concat(className));\n};\n\nvar isRightClickPan = function isRightClickPan(panOnDrag, usedButton) {\n return usedButton === 2 && Array.isArray(panOnDrag) && panOnDrag.includes(2);\n};\n\nvar getD3Transition = function getD3Transition(selection) {\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var onEnd = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};\n var hasDuration = typeof duration === 'number' && duration > 0;\n\n if (!hasDuration) {\n onEnd();\n }\n\n return hasDuration ? selection.transition().duration(duration).on('end', onEnd) : selection;\n};\n\nvar wheelDelta = function wheelDelta(event) {\n var factor = event.ctrlKey && isMacOs() ? 10 : 1;\n return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * factor;\n};\n\nfunction createPanOnScrollHandler(_ref67) {\n var zoomPanValues = _ref67.zoomPanValues,\n noWheelClassName = _ref67.noWheelClassName,\n d3Selection = _ref67.d3Selection,\n d3Zoom = _ref67.d3Zoom,\n panOnScrollMode = _ref67.panOnScrollMode,\n panOnScrollSpeed = _ref67.panOnScrollSpeed,\n zoomOnPinch = _ref67.zoomOnPinch,\n onPanZoomStart = _ref67.onPanZoomStart,\n onPanZoom = _ref67.onPanZoom,\n onPanZoomEnd = _ref67.onPanZoomEnd;\n return function (event) {\n if (isWrappedWithClass(event, noWheelClassName)) {\n return false;\n }\n\n event.preventDefault();\n event.stopImmediatePropagation();\n var currentZoom = d3Selection.property('__zoom').k || 1; // macos sets ctrlKey=true for pinch gesture on a trackpad\n\n if (event.ctrlKey && zoomOnPinch) {\n var point = pointer(event);\n var pinchDelta = wheelDelta(event);\n\n var _zoom = currentZoom * Math.pow(2, pinchDelta); // @ts-ignore\n\n\n d3Zoom.scaleTo(d3Selection, _zoom, point, event);\n return;\n }\n /*\n * increase scroll speed in firefox\n * firefox: deltaMode === 1; chrome: deltaMode === 0\n */\n\n\n var deltaNormalize = event.deltaMode === 1 ? 20 : 1;\n var deltaX = panOnScrollMode === PanOnScrollMode.Vertical ? 0 : event.deltaX * deltaNormalize;\n var deltaY = panOnScrollMode === PanOnScrollMode.Horizontal ? 0 : event.deltaY * deltaNormalize; // this enables vertical scrolling with shift + scroll on windows\n\n if (!isMacOs() && event.shiftKey && panOnScrollMode !== PanOnScrollMode.Vertical) {\n deltaX = event.deltaY * deltaNormalize;\n deltaY = 0;\n }\n\n d3Zoom.translateBy(d3Selection, -(deltaX / currentZoom) * panOnScrollSpeed, -(deltaY / currentZoom) * panOnScrollSpeed, // @ts-ignore\n {\n internal: true\n });\n var nextViewport = transformToViewport(d3Selection.property('__zoom'));\n clearTimeout(zoomPanValues.panScrollTimeout);\n /*\n * for pan on scroll we need to handle the event calls on our own\n * we can't use the start, zoom and end events from d3-zoom\n * because start and move gets called on every scroll event and not once at the beginning\n */\n\n if (!zoomPanValues.isPanScrolling) {\n zoomPanValues.isPanScrolling = true;\n onPanZoomStart === null || onPanZoomStart === void 0 ? void 0 : onPanZoomStart(event, nextViewport);\n }\n\n if (zoomPanValues.isPanScrolling) {\n onPanZoom === null || onPanZoom === void 0 ? void 0 : onPanZoom(event, nextViewport);\n zoomPanValues.panScrollTimeout = setTimeout(function () {\n onPanZoomEnd === null || onPanZoomEnd === void 0 ? void 0 : onPanZoomEnd(event, nextViewport);\n zoomPanValues.isPanScrolling = false;\n }, 150);\n }\n };\n}\n\nfunction createZoomOnScrollHandler(_ref68) {\n var noWheelClassName = _ref68.noWheelClassName,\n preventScrolling = _ref68.preventScrolling,\n d3ZoomHandler = _ref68.d3ZoomHandler;\n return function (event, d) {\n // we still want to enable pinch zooming even if preventScrolling is set to false\n var preventZoom = !preventScrolling && event.type === 'wheel' && !event.ctrlKey;\n\n if (preventZoom || isWrappedWithClass(event, noWheelClassName)) {\n return null;\n }\n\n event.preventDefault();\n d3ZoomHandler.call(this, event, d);\n };\n}\n\nfunction createPanZoomStartHandler(_ref69) {\n var zoomPanValues = _ref69.zoomPanValues,\n onDraggingChange = _ref69.onDraggingChange,\n onPanZoomStart = _ref69.onPanZoomStart;\n return function (event) {\n var _event$sourceEvent, _event$sourceEvent2, _event$sourceEvent3;\n\n if ((_event$sourceEvent = event.sourceEvent) !== null && _event$sourceEvent !== void 0 && _event$sourceEvent.internal) {\n return;\n }\n\n var viewport = transformToViewport(event.transform); // we need to remember it here, because it's always 0 in the \"zoom\" event\n\n zoomPanValues.mouseButton = ((_event$sourceEvent2 = event.sourceEvent) === null || _event$sourceEvent2 === void 0 ? void 0 : _event$sourceEvent2.button) || 0;\n zoomPanValues.isZoomingOrPanning = true;\n zoomPanValues.prevViewport = viewport;\n\n if (((_event$sourceEvent3 = event.sourceEvent) === null || _event$sourceEvent3 === void 0 ? void 0 : _event$sourceEvent3.type) === 'mousedown') {\n onDraggingChange(true);\n }\n\n if (onPanZoomStart) {\n onPanZoomStart === null || onPanZoomStart === void 0 ? void 0 : onPanZoomStart(event.sourceEvent, viewport);\n }\n };\n}\n\nfunction createPanZoomHandler(_ref70) {\n var zoomPanValues = _ref70.zoomPanValues,\n panOnDrag = _ref70.panOnDrag,\n onPaneContextMenu = _ref70.onPaneContextMenu,\n onTransformChange = _ref70.onTransformChange,\n onPanZoom = _ref70.onPanZoom;\n return function (event) {\n var _zoomPanValues$mouseB, _event$sourceEvent4, _event$sourceEvent5;\n\n zoomPanValues.usedRightMouseButton = !!(onPaneContextMenu && isRightClickPan(panOnDrag, (_zoomPanValues$mouseB = zoomPanValues.mouseButton) !== null && _zoomPanValues$mouseB !== void 0 ? _zoomPanValues$mouseB : 0));\n\n if (!((_event$sourceEvent4 = event.sourceEvent) !== null && _event$sourceEvent4 !== void 0 && _event$sourceEvent4.sync)) {\n onTransformChange([event.transform.x, event.transform.y, event.transform.k]);\n }\n\n if (onPanZoom && !((_event$sourceEvent5 = event.sourceEvent) !== null && _event$sourceEvent5 !== void 0 && _event$sourceEvent5.internal)) {\n onPanZoom === null || onPanZoom === void 0 ? void 0 : onPanZoom(event.sourceEvent, transformToViewport(event.transform));\n }\n };\n}\n\nfunction createPanZoomEndHandler(_ref71) {\n var zoomPanValues = _ref71.zoomPanValues,\n panOnDrag = _ref71.panOnDrag,\n panOnScroll = _ref71.panOnScroll,\n onDraggingChange = _ref71.onDraggingChange,\n onPanZoomEnd = _ref71.onPanZoomEnd,\n onPaneContextMenu = _ref71.onPaneContextMenu;\n return function (event) {\n var _event$sourceEvent6, _zoomPanValues$mouseB2;\n\n if ((_event$sourceEvent6 = event.sourceEvent) !== null && _event$sourceEvent6 !== void 0 && _event$sourceEvent6.internal) {\n return;\n }\n\n zoomPanValues.isZoomingOrPanning = false;\n\n if (onPaneContextMenu && isRightClickPan(panOnDrag, (_zoomPanValues$mouseB2 = zoomPanValues.mouseButton) !== null && _zoomPanValues$mouseB2 !== void 0 ? _zoomPanValues$mouseB2 : 0) && !zoomPanValues.usedRightMouseButton && event.sourceEvent) {\n onPaneContextMenu(event.sourceEvent);\n }\n\n zoomPanValues.usedRightMouseButton = false;\n onDraggingChange(false);\n\n if (onPanZoomEnd && viewChanged(zoomPanValues.prevViewport, event.transform)) {\n var viewport = transformToViewport(event.transform);\n zoomPanValues.prevViewport = viewport;\n clearTimeout(zoomPanValues.timerId);\n zoomPanValues.timerId = setTimeout(function () {\n onPanZoomEnd === null || onPanZoomEnd === void 0 ? void 0 : onPanZoomEnd(event.sourceEvent, viewport);\n }, // we need a setTimeout for panOnScroll to supress multiple end events fired during scroll\n panOnScroll ? 150 : 0);\n }\n };\n}\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\nfunction createFilter(_ref72) {\n var zoomActivationKeyPressed = _ref72.zoomActivationKeyPressed,\n zoomOnScroll = _ref72.zoomOnScroll,\n zoomOnPinch = _ref72.zoomOnPinch,\n panOnDrag = _ref72.panOnDrag,\n panOnScroll = _ref72.panOnScroll,\n zoomOnDoubleClick = _ref72.zoomOnDoubleClick,\n userSelectionActive = _ref72.userSelectionActive,\n noWheelClassName = _ref72.noWheelClassName,\n noPanClassName = _ref72.noPanClassName,\n lib = _ref72.lib;\n return function (event) {\n var _event$touches3;\n\n var zoomScroll = zoomActivationKeyPressed || zoomOnScroll;\n var pinchZoom = zoomOnPinch && event.ctrlKey;\n\n if (event.button === 1 && event.type === 'mousedown' && (isWrappedWithClass(event, \"\".concat(lib, \"-flow__node\")) || isWrappedWithClass(event, \"\".concat(lib, \"-flow__edge\")))) {\n return true;\n } // if all interactions are disabled, we prevent all zoom events\n\n\n if (!panOnDrag && !zoomScroll && !panOnScroll && !zoomOnDoubleClick && !zoomOnPinch) {\n return false;\n } // during a selection we prevent all other interactions\n\n\n if (userSelectionActive) {\n return false;\n } // if the target element is inside an element with the nowheel class, we prevent zooming\n\n\n if (isWrappedWithClass(event, noWheelClassName) && event.type === 'wheel') {\n return false;\n } // if the target element is inside an element with the nopan class, we prevent panning\n\n\n if (isWrappedWithClass(event, noPanClassName) && (event.type !== 'wheel' || panOnScroll && event.type === 'wheel' && !zoomActivationKeyPressed)) {\n return false;\n }\n\n if (!zoomOnPinch && event.ctrlKey && event.type === 'wheel') {\n return false;\n }\n\n if (!zoomOnPinch && event.type === 'touchstart' && ((_event$touches3 = event.touches) === null || _event$touches3 === void 0 ? void 0 : _event$touches3.length) > 1) {\n event.preventDefault(); // if you manage to start with 2 touches, we prevent native zoom\n\n return false;\n } // when there is no scroll handling enabled, we prevent all wheel events\n\n\n if (!zoomScroll && !panOnScroll && !pinchZoom && event.type === 'wheel') {\n return false;\n } // if the pane is not movable, we prevent dragging it with mousestart or touchstart\n\n\n if (!panOnDrag && (event.type === 'mousedown' || event.type === 'touchstart')) {\n return false;\n } // if the pane is only movable using allowed clicks\n\n\n if (Array.isArray(panOnDrag) && !panOnDrag.includes(event.button) && event.type === 'mousedown') {\n return false;\n } // We only allow right clicks if pan on drag is set to right click\n\n\n var buttonAllowed = Array.isArray(panOnDrag) && panOnDrag.includes(event.button) || !event.button || event.button <= 1; // default filter for d3-zoom\n\n return (!event.ctrlKey || event.type === 'wheel') && buttonAllowed;\n };\n}\n\nfunction XYPanZoom(_ref73) {\n var domNode = _ref73.domNode,\n minZoom = _ref73.minZoom,\n maxZoom = _ref73.maxZoom,\n paneClickDistance = _ref73.paneClickDistance,\n translateExtent = _ref73.translateExtent,\n viewport = _ref73.viewport,\n onPanZoom = _ref73.onPanZoom,\n onPanZoomStart = _ref73.onPanZoomStart,\n onPanZoomEnd = _ref73.onPanZoomEnd,\n onDraggingChange = _ref73.onDraggingChange;\n var zoomPanValues = {\n isZoomingOrPanning: false,\n usedRightMouseButton: false,\n prevViewport: {\n x: 0,\n y: 0,\n zoom: 0\n },\n mouseButton: 0,\n timerId: undefined,\n panScrollTimeout: undefined,\n isPanScrolling: false\n };\n var bbox = domNode.getBoundingClientRect();\n var d3ZoomInstance = zoom().clickDistance(!isNumeric(paneClickDistance) || paneClickDistance < 0 ? 0 : paneClickDistance).scaleExtent([minZoom, maxZoom]).translateExtent(translateExtent);\n var d3Selection = select(domNode).call(d3ZoomInstance);\n setViewportConstrained({\n x: viewport.x,\n y: viewport.y,\n zoom: clamp(viewport.zoom, minZoom, maxZoom)\n }, [[0, 0], [bbox.width, bbox.height]], translateExtent);\n var d3ZoomHandler = d3Selection.on('wheel.zoom');\n var d3DblClickZoomHandler = d3Selection.on('dblclick.zoom');\n d3ZoomInstance.wheelDelta(wheelDelta);\n\n function setTransform(transform, options) {\n if (d3Selection) {\n return new Promise(function (resolve) {\n d3ZoomInstance === null || d3ZoomInstance === void 0 ? void 0 : d3ZoomInstance.transform(getD3Transition(d3Selection, options === null || options === void 0 ? void 0 : options.duration, function () {\n return resolve(true);\n }), transform);\n });\n }\n\n return Promise.resolve(false);\n } // public functions\n\n\n function update(_ref74) {\n var noWheelClassName = _ref74.noWheelClassName,\n noPanClassName = _ref74.noPanClassName,\n onPaneContextMenu = _ref74.onPaneContextMenu,\n userSelectionActive = _ref74.userSelectionActive,\n panOnScroll = _ref74.panOnScroll,\n panOnDrag = _ref74.panOnDrag,\n panOnScrollMode = _ref74.panOnScrollMode,\n panOnScrollSpeed = _ref74.panOnScrollSpeed,\n preventScrolling = _ref74.preventScrolling,\n zoomOnPinch = _ref74.zoomOnPinch,\n zoomOnScroll = _ref74.zoomOnScroll,\n zoomOnDoubleClick = _ref74.zoomOnDoubleClick,\n zoomActivationKeyPressed = _ref74.zoomActivationKeyPressed,\n lib = _ref74.lib,\n onTransformChange = _ref74.onTransformChange;\n\n if (userSelectionActive && !zoomPanValues.isZoomingOrPanning) {\n destroy();\n }\n\n var isPanOnScroll = panOnScroll && !zoomActivationKeyPressed && !userSelectionActive;\n var wheelHandler = isPanOnScroll ? createPanOnScrollHandler({\n zoomPanValues: zoomPanValues,\n noWheelClassName: noWheelClassName,\n d3Selection: d3Selection,\n d3Zoom: d3ZoomInstance,\n panOnScrollMode: panOnScrollMode,\n panOnScrollSpeed: panOnScrollSpeed,\n zoomOnPinch: zoomOnPinch,\n onPanZoomStart: onPanZoomStart,\n onPanZoom: onPanZoom,\n onPanZoomEnd: onPanZoomEnd\n }) : createZoomOnScrollHandler({\n noWheelClassName: noWheelClassName,\n preventScrolling: preventScrolling,\n d3ZoomHandler: d3ZoomHandler\n });\n d3Selection.on('wheel.zoom', wheelHandler, {\n passive: false\n });\n\n if (!userSelectionActive) {\n // pan zoom start\n var startHandler = createPanZoomStartHandler({\n zoomPanValues: zoomPanValues,\n onDraggingChange: onDraggingChange,\n onPanZoomStart: onPanZoomStart\n });\n d3ZoomInstance.on('start', startHandler); // pan zoom\n\n var panZoomHandler = createPanZoomHandler({\n zoomPanValues: zoomPanValues,\n panOnDrag: panOnDrag,\n onPaneContextMenu: !!onPaneContextMenu,\n onPanZoom: onPanZoom,\n onTransformChange: onTransformChange\n });\n d3ZoomInstance.on('zoom', panZoomHandler); // pan zoom end\n\n var panZoomEndHandler = createPanZoomEndHandler({\n zoomPanValues: zoomPanValues,\n panOnDrag: panOnDrag,\n panOnScroll: panOnScroll,\n onPaneContextMenu: onPaneContextMenu,\n onPanZoomEnd: onPanZoomEnd,\n onDraggingChange: onDraggingChange\n });\n d3ZoomInstance.on('end', panZoomEndHandler);\n }\n\n var filter = createFilter({\n zoomActivationKeyPressed: zoomActivationKeyPressed,\n panOnDrag: panOnDrag,\n zoomOnScroll: zoomOnScroll,\n panOnScroll: panOnScroll,\n zoomOnDoubleClick: zoomOnDoubleClick,\n zoomOnPinch: zoomOnPinch,\n userSelectionActive: userSelectionActive,\n noPanClassName: noPanClassName,\n noWheelClassName: noWheelClassName,\n lib: lib\n });\n d3ZoomInstance.filter(filter);\n /*\n * We cannot add zoomOnDoubleClick to the filter above because\n * double tapping on touch screens circumvents the filter and\n * dblclick.zoom is fired on the selection directly\n */\n\n if (zoomOnDoubleClick) {\n d3Selection.on('dblclick.zoom', d3DblClickZoomHandler);\n } else {\n d3Selection.on('dblclick.zoom', null);\n }\n }\n\n function destroy() {\n d3ZoomInstance.on('zoom', null);\n }\n\n function setViewportConstrained(_x5, _x6, _x7) {\n return _setViewportConstrained.apply(this, arguments);\n }\n\n function _setViewportConstrained() {\n _setViewportConstrained = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(viewport, extent, translateExtent) {\n var nextTransform, contrainedTransform;\n return _regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n nextTransform = viewportToTransform(viewport);\n contrainedTransform = d3ZoomInstance === null || d3ZoomInstance === void 0 ? void 0 : d3ZoomInstance.constrain()(nextTransform, extent, translateExtent);\n\n if (!contrainedTransform) {\n _context2.next = 5;\n break;\n }\n\n _context2.next = 5;\n return setTransform(contrainedTransform);\n\n case 5:\n return _context2.abrupt(\"return\", new Promise(function (resolve) {\n return resolve(contrainedTransform);\n }));\n\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n return _setViewportConstrained.apply(this, arguments);\n }\n\n function setViewport(_x8, _x9) {\n return _setViewport.apply(this, arguments);\n }\n\n function _setViewport() {\n _setViewport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(viewport, options) {\n var nextTransform;\n return _regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n nextTransform = viewportToTransform(viewport);\n _context3.next = 3;\n return setTransform(nextTransform, options);\n\n case 3:\n return _context3.abrupt(\"return\", new Promise(function (resolve) {\n return resolve(nextTransform);\n }));\n\n case 4:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n return _setViewport.apply(this, arguments);\n }\n\n function syncViewport(viewport) {\n if (d3Selection) {\n var nextTransform = viewportToTransform(viewport);\n var currentTransform = d3Selection.property('__zoom');\n\n if (currentTransform.k !== viewport.zoom || currentTransform.x !== viewport.x || currentTransform.y !== viewport.y) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n d3ZoomInstance === null || d3ZoomInstance === void 0 ? void 0 : d3ZoomInstance.transform(d3Selection, nextTransform, null, {\n sync: true\n });\n }\n }\n }\n\n function getViewport() {\n var transform = d3Selection ? zoomTransform(d3Selection.node()) : {\n x: 0,\n y: 0,\n k: 1\n };\n return {\n x: transform.x,\n y: transform.y,\n zoom: transform.k\n };\n }\n\n function scaleTo(zoom, options) {\n if (d3Selection) {\n return new Promise(function (resolve) {\n d3ZoomInstance === null || d3ZoomInstance === void 0 ? void 0 : d3ZoomInstance.scaleTo(getD3Transition(d3Selection, options === null || options === void 0 ? void 0 : options.duration, function () {\n return resolve(true);\n }), zoom);\n });\n }\n\n return Promise.resolve(false);\n }\n\n function scaleBy(factor, options) {\n if (d3Selection) {\n return new Promise(function (resolve) {\n d3ZoomInstance === null || d3ZoomInstance === void 0 ? void 0 : d3ZoomInstance.scaleBy(getD3Transition(d3Selection, options === null || options === void 0 ? void 0 : options.duration, function () {\n return resolve(true);\n }), factor);\n });\n }\n\n return Promise.resolve(false);\n }\n\n function setScaleExtent(scaleExtent) {\n d3ZoomInstance === null || d3ZoomInstance === void 0 ? void 0 : d3ZoomInstance.scaleExtent(scaleExtent);\n }\n\n function setTranslateExtent(translateExtent) {\n d3ZoomInstance === null || d3ZoomInstance === void 0 ? void 0 : d3ZoomInstance.translateExtent(translateExtent);\n }\n\n function setClickDistance(distance) {\n var validDistance = !isNumeric(distance) || distance < 0 ? 0 : distance;\n d3ZoomInstance === null || d3ZoomInstance === void 0 ? void 0 : d3ZoomInstance.clickDistance(validDistance);\n }\n\n return {\n update: update,\n destroy: destroy,\n setViewport: setViewport,\n setViewportConstrained: setViewportConstrained,\n getViewport: getViewport,\n scaleTo: scaleTo,\n scaleBy: scaleBy,\n setScaleExtent: setScaleExtent,\n setTranslateExtent: setTranslateExtent,\n syncViewport: syncViewport,\n setClickDistance: setClickDistance\n };\n}\n/**\n * Used to determine the variant of the resize control\n *\n * @public\n */\n\n\nvar ResizeControlVariant;\n\n(function (ResizeControlVariant) {\n ResizeControlVariant[\"Line\"] = \"line\";\n ResizeControlVariant[\"Handle\"] = \"handle\";\n})(ResizeControlVariant || (ResizeControlVariant = {}));\n\nvar XY_RESIZER_HANDLE_POSITIONS = ['top-left', 'top-right', 'bottom-left', 'bottom-right'];\nvar XY_RESIZER_LINE_POSITIONS = ['top', 'right', 'bottom', 'left'];\n/**\n * Get all connecting edges for a given set of nodes\n * @param width - new width of the node\n * @param prevWidth - previous width of the node\n * @param height - new height of the node\n * @param prevHeight - previous height of the node\n * @param affectsX - whether to invert the resize direction for the x axis\n * @param affectsY - whether to invert the resize direction for the y axis\n * @returns array of two numbers representing the direction of the resize for each axis, 0 = no change, 1 = increase, -1 = decrease\n */\n\nfunction getResizeDirection(_ref75) {\n var width = _ref75.width,\n prevWidth = _ref75.prevWidth,\n height = _ref75.height,\n prevHeight = _ref75.prevHeight,\n affectsX = _ref75.affectsX,\n affectsY = _ref75.affectsY;\n var deltaWidth = width - prevWidth;\n var deltaHeight = height - prevHeight;\n var direction = [deltaWidth > 0 ? 1 : deltaWidth < 0 ? -1 : 0, deltaHeight > 0 ? 1 : deltaHeight < 0 ? -1 : 0];\n\n if (deltaWidth && affectsX) {\n direction[0] = direction[0] * -1;\n }\n\n if (deltaHeight && affectsY) {\n direction[1] = direction[1] * -1;\n }\n\n return direction;\n}\n/**\n * Parses the control position that is being dragged to dimensions that are being resized\n * @param controlPosition - position of the control that is being dragged\n * @returns isHorizontal, isVertical, affectsX, affectsY,\n */\n\n\nfunction getControlDirection(controlPosition) {\n var isHorizontal = controlPosition.includes('right') || controlPosition.includes('left');\n var isVertical = controlPosition.includes('bottom') || controlPosition.includes('top');\n var affectsX = controlPosition.includes('left');\n var affectsY = controlPosition.includes('top');\n return {\n isHorizontal: isHorizontal,\n isVertical: isVertical,\n affectsX: affectsX,\n affectsY: affectsY\n };\n}\n\nfunction getLowerExtentClamp(lowerExtent, lowerBound) {\n return Math.max(0, lowerBound - lowerExtent);\n}\n\nfunction getUpperExtentClamp(upperExtent, upperBound) {\n return Math.max(0, upperExtent - upperBound);\n}\n\nfunction getSizeClamp(size, minSize, maxSize) {\n return Math.max(0, minSize - size, size - maxSize);\n}\n\nfunction xor(a, b) {\n return a ? !b : b;\n}\n/**\n * Calculates new width & height and x & y of node after resize based on pointer position\n * @description - Buckle up, this is a chunky one... If you want to determine the new dimensions of a node after a resize,\n * you have to account for all possible restrictions: min/max width/height of the node, the maximum extent the node is allowed\n * to move in (in this case: resize into) determined by the parent node, the minimal extent determined by child nodes\n * with expandParent or extent: 'parent' set and oh yeah, these things also have to work with keepAspectRatio!\n * The way this is done is by determining how much each of these restricting actually restricts the resize and then applying the\n * strongest restriction. Because the resize affects x, y and width, height and width, height of a opposing side with keepAspectRatio,\n * the resize amount is always kept in distX & distY amount (the distance in mouse movement)\n * Instead of clamping each value, we first calculate the biggest 'clamp' (for the lack of a better name) and then apply it to all values.\n * To complicate things nodeOrigin has to be taken into account as well. This is done by offsetting the nodes as if their origin is [0, 0],\n * then calculating the restrictions as usual\n * @param startValues - starting values of resize\n * @param controlDirection - dimensions affected by the resize\n * @param pointerPosition - the current pointer position corrected for snapping\n * @param boundaries - minimum and maximum dimensions of the node\n * @param keepAspectRatio - prevent changes of asprect ratio\n * @returns x, y, width and height of the node after resize\n */\n\n\nfunction getDimensionsAfterResize(startValues, controlDirection, pointerPosition, boundaries, keepAspectRatio, nodeOrigin, extent, childExtent) {\n var affectsX = controlDirection.affectsX,\n affectsY = controlDirection.affectsY;\n var isHorizontal = controlDirection.isHorizontal,\n isVertical = controlDirection.isVertical;\n var isDiagonal = isHorizontal && isVertical;\n var xSnapped = pointerPosition.xSnapped,\n ySnapped = pointerPosition.ySnapped;\n var minWidth = boundaries.minWidth,\n maxWidth = boundaries.maxWidth,\n minHeight = boundaries.minHeight,\n maxHeight = boundaries.maxHeight;\n var startX = startValues.x,\n startY = startValues.y,\n startWidth = startValues.width,\n startHeight = startValues.height,\n aspectRatio = startValues.aspectRatio;\n var distX = Math.floor(isHorizontal ? xSnapped - startValues.pointerX : 0);\n var distY = Math.floor(isVertical ? ySnapped - startValues.pointerY : 0);\n var newWidth = startWidth + (affectsX ? -distX : distX);\n var newHeight = startHeight + (affectsY ? -distY : distY);\n var originOffsetX = -nodeOrigin[0] * startWidth;\n var originOffsetY = -nodeOrigin[1] * startHeight; // Check if maxWidth, minWWidth, maxHeight, minHeight are restricting the resize\n\n var clampX = getSizeClamp(newWidth, minWidth, maxWidth);\n var clampY = getSizeClamp(newHeight, minHeight, maxHeight); // Check if extent is restricting the resize\n\n if (extent) {\n var xExtentClamp = 0;\n var yExtentClamp = 0;\n\n if (affectsX && distX < 0) {\n xExtentClamp = getLowerExtentClamp(startX + distX + originOffsetX, extent[0][0]);\n } else if (!affectsX && distX > 0) {\n xExtentClamp = getUpperExtentClamp(startX + newWidth + originOffsetX, extent[1][0]);\n }\n\n if (affectsY && distY < 0) {\n yExtentClamp = getLowerExtentClamp(startY + distY + originOffsetY, extent[0][1]);\n } else if (!affectsY && distY > 0) {\n yExtentClamp = getUpperExtentClamp(startY + newHeight + originOffsetY, extent[1][1]);\n }\n\n clampX = Math.max(clampX, xExtentClamp);\n clampY = Math.max(clampY, yExtentClamp);\n } // Check if the child extent is restricting the resize\n\n\n if (childExtent) {\n var _xExtentClamp = 0;\n var _yExtentClamp = 0;\n\n if (affectsX && distX > 0) {\n _xExtentClamp = getUpperExtentClamp(startX + distX, childExtent[0][0]);\n } else if (!affectsX && distX < 0) {\n _xExtentClamp = getLowerExtentClamp(startX + newWidth, childExtent[1][0]);\n }\n\n if (affectsY && distY > 0) {\n _yExtentClamp = getUpperExtentClamp(startY + distY, childExtent[0][1]);\n } else if (!affectsY && distY < 0) {\n _yExtentClamp = getLowerExtentClamp(startY + newHeight, childExtent[1][1]);\n }\n\n clampX = Math.max(clampX, _xExtentClamp);\n clampY = Math.max(clampY, _yExtentClamp);\n } // Check if the aspect ratio resizing of the other side is restricting the resize\n\n\n if (keepAspectRatio) {\n if (isHorizontal) {\n // Check if the max dimensions might be restricting the resize\n var aspectHeightClamp = getSizeClamp(newWidth / aspectRatio, minHeight, maxHeight) * aspectRatio;\n clampX = Math.max(clampX, aspectHeightClamp); // Check if the extent is restricting the resize\n\n if (extent) {\n var aspectExtentClamp = 0;\n\n if (!affectsX && !affectsY || affectsX && !affectsY && isDiagonal) {\n aspectExtentClamp = getUpperExtentClamp(startY + originOffsetY + newWidth / aspectRatio, extent[1][1]) * aspectRatio;\n } else {\n aspectExtentClamp = getLowerExtentClamp(startY + originOffsetY + (affectsX ? distX : -distX) / aspectRatio, extent[0][1]) * aspectRatio;\n }\n\n clampX = Math.max(clampX, aspectExtentClamp);\n } // Check if the child extent is restricting the resize\n\n\n if (childExtent) {\n var _aspectExtentClamp = 0;\n\n if (!affectsX && !affectsY || affectsX && !affectsY && isDiagonal) {\n _aspectExtentClamp = getLowerExtentClamp(startY + newWidth / aspectRatio, childExtent[1][1]) * aspectRatio;\n } else {\n _aspectExtentClamp = getUpperExtentClamp(startY + (affectsX ? distX : -distX) / aspectRatio, childExtent[0][1]) * aspectRatio;\n }\n\n clampX = Math.max(clampX, _aspectExtentClamp);\n }\n } // Do the same thing for vertical resizing\n\n\n if (isVertical) {\n var aspectWidthClamp = getSizeClamp(newHeight * aspectRatio, minWidth, maxWidth) / aspectRatio;\n clampY = Math.max(clampY, aspectWidthClamp);\n\n if (extent) {\n var _aspectExtentClamp2 = 0;\n\n if (!affectsX && !affectsY || affectsY && !affectsX && isDiagonal) {\n _aspectExtentClamp2 = getUpperExtentClamp(startX + newHeight * aspectRatio + originOffsetX, extent[1][0]) / aspectRatio;\n } else {\n _aspectExtentClamp2 = getLowerExtentClamp(startX + (affectsY ? distY : -distY) * aspectRatio + originOffsetX, extent[0][0]) / aspectRatio;\n }\n\n clampY = Math.max(clampY, _aspectExtentClamp2);\n }\n\n if (childExtent) {\n var _aspectExtentClamp3 = 0;\n\n if (!affectsX && !affectsY || affectsY && !affectsX && isDiagonal) {\n _aspectExtentClamp3 = getLowerExtentClamp(startX + newHeight * aspectRatio, childExtent[1][0]) / aspectRatio;\n } else {\n _aspectExtentClamp3 = getUpperExtentClamp(startX + (affectsY ? distY : -distY) * aspectRatio, childExtent[0][0]) / aspectRatio;\n }\n\n clampY = Math.max(clampY, _aspectExtentClamp3);\n }\n }\n }\n\n distY = distY + (distY < 0 ? clampY : -clampY);\n distX = distX + (distX < 0 ? clampX : -clampX);\n\n if (keepAspectRatio) {\n if (isDiagonal) {\n if (newWidth > newHeight * aspectRatio) {\n distY = (xor(affectsX, affectsY) ? -distX : distX) / aspectRatio;\n } else {\n distX = (xor(affectsX, affectsY) ? -distY : distY) * aspectRatio;\n }\n } else {\n if (isHorizontal) {\n distY = distX / aspectRatio;\n affectsY = affectsX;\n } else {\n distX = distY * aspectRatio;\n affectsX = affectsY;\n }\n }\n }\n\n var x = affectsX ? startX + distX : startX;\n var y = affectsY ? startY + distY : startY;\n return {\n width: startWidth + (affectsX ? -distX : distX),\n height: startHeight + (affectsY ? -distY : distY),\n x: nodeOrigin[0] * distX * (!affectsX ? 1 : -1) + x,\n y: nodeOrigin[1] * distY * (!affectsY ? 1 : -1) + y\n };\n}\n\nvar initPrevValues = {\n width: 0,\n height: 0,\n x: 0,\n y: 0\n};\n\nvar initStartValues = _objectSpread(_objectSpread({}, initPrevValues), {}, {\n pointerX: 0,\n pointerY: 0,\n aspectRatio: 1\n});\n\nfunction nodeToParentExtent(node) {\n return [[0, 0], [node.measured.width, node.measured.height]];\n}\n\nfunction nodeToChildExtent(child, parent, nodeOrigin) {\n var _child$measured$width, _child$measured$heigh;\n\n var x = parent.position.x + child.position.x;\n var y = parent.position.y + child.position.y;\n var width = (_child$measured$width = child.measured.width) !== null && _child$measured$width !== void 0 ? _child$measured$width : 0;\n var height = (_child$measured$heigh = child.measured.height) !== null && _child$measured$heigh !== void 0 ? _child$measured$heigh : 0;\n var originOffsetX = nodeOrigin[0] * width;\n var originOffsetY = nodeOrigin[1] * height;\n return [[x - originOffsetX, y - originOffsetY], [x + width - originOffsetX, y + height - originOffsetY]];\n}\n\nfunction XYResizer(_ref76) {\n var domNode = _ref76.domNode,\n nodeId = _ref76.nodeId,\n getStoreItems = _ref76.getStoreItems,\n onChange = _ref76.onChange,\n onEnd = _ref76.onEnd;\n var selection = select(domNode);\n\n function update(_ref77) {\n var controlPosition = _ref77.controlPosition,\n boundaries = _ref77.boundaries,\n keepAspectRatio = _ref77.keepAspectRatio,\n onResizeStart = _ref77.onResizeStart,\n onResize = _ref77.onResize,\n onResizeEnd = _ref77.onResizeEnd,\n shouldResize = _ref77.shouldResize;\n\n var prevValues = _objectSpread({}, initPrevValues);\n\n var startValues = _objectSpread({}, initStartValues);\n\n var controlDirection = getControlDirection(controlPosition);\n var node = undefined;\n var containerBounds = null;\n var childNodes = [];\n var parentNode = undefined; // Needed to fix expandParent\n\n var parentExtent = undefined;\n var childExtent = undefined;\n var dragHandler = drag().on('start', function (event) {\n var _paneDomNode$getBound, _node$measured$width6, _node$measured$height6, _node$position$x, _node$position$y;\n\n var _getStoreItems7 = getStoreItems(),\n nodeLookup = _getStoreItems7.nodeLookup,\n transform = _getStoreItems7.transform,\n snapGrid = _getStoreItems7.snapGrid,\n snapToGrid = _getStoreItems7.snapToGrid,\n nodeOrigin = _getStoreItems7.nodeOrigin,\n paneDomNode = _getStoreItems7.paneDomNode;\n\n node = nodeLookup.get(nodeId);\n\n if (!node) {\n return;\n }\n\n containerBounds = (_paneDomNode$getBound = paneDomNode === null || paneDomNode === void 0 ? void 0 : paneDomNode.getBoundingClientRect()) !== null && _paneDomNode$getBound !== void 0 ? _paneDomNode$getBound : null;\n\n var _getPointerPosition = getPointerPosition(event.sourceEvent, {\n transform: transform,\n snapGrid: snapGrid,\n snapToGrid: snapToGrid,\n containerBounds: containerBounds\n }),\n xSnapped = _getPointerPosition.xSnapped,\n ySnapped = _getPointerPosition.ySnapped;\n\n prevValues = {\n width: (_node$measured$width6 = node.measured.width) !== null && _node$measured$width6 !== void 0 ? _node$measured$width6 : 0,\n height: (_node$measured$height6 = node.measured.height) !== null && _node$measured$height6 !== void 0 ? _node$measured$height6 : 0,\n x: (_node$position$x = node.position.x) !== null && _node$position$x !== void 0 ? _node$position$x : 0,\n y: (_node$position$y = node.position.y) !== null && _node$position$y !== void 0 ? _node$position$y : 0\n };\n startValues = _objectSpread(_objectSpread({}, prevValues), {}, {\n pointerX: xSnapped,\n pointerY: ySnapped,\n aspectRatio: prevValues.width / prevValues.height\n });\n parentNode = undefined;\n\n if (node.parentId && (node.extent === 'parent' || node.expandParent)) {\n parentNode = nodeLookup.get(node.parentId);\n parentExtent = parentNode && node.extent === 'parent' ? nodeToParentExtent(parentNode) : undefined;\n }\n /*\n * Collect all child nodes to correct their relative positions when top/left changes\n * Determine largest minimal extent the parent node is allowed to resize to\n */\n\n\n childNodes = [];\n childExtent = undefined;\n\n var _iterator16 = _createForOfIteratorHelper(nodeLookup),\n _step16;\n\n try {\n for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {\n var _step16$value = _slicedToArray(_step16.value, 2),\n childId = _step16$value[0],\n child = _step16$value[1];\n\n if (child.parentId === nodeId) {\n childNodes.push({\n id: childId,\n position: _objectSpread({}, child.position),\n extent: child.extent\n });\n\n if (child.extent === 'parent' || child.expandParent) {\n var _child$origin;\n\n var extent = nodeToChildExtent(child, node, (_child$origin = child.origin) !== null && _child$origin !== void 0 ? _child$origin : nodeOrigin);\n\n if (childExtent) {\n childExtent = [[Math.min(extent[0][0], childExtent[0][0]), Math.min(extent[0][1], childExtent[0][1])], [Math.max(extent[1][0], childExtent[1][0]), Math.max(extent[1][1], childExtent[1][1])]];\n } else {\n childExtent = extent;\n }\n }\n }\n }\n } catch (err) {\n _iterator16.e(err);\n } finally {\n _iterator16.f();\n }\n\n onResizeStart === null || onResizeStart === void 0 ? void 0 : onResizeStart(event, _objectSpread({}, prevValues));\n }).on('drag', function (event) {\n var _node$origin3;\n\n var _getStoreItems8 = getStoreItems(),\n transform = _getStoreItems8.transform,\n snapGrid = _getStoreItems8.snapGrid,\n snapToGrid = _getStoreItems8.snapToGrid,\n storeNodeOrigin = _getStoreItems8.nodeOrigin;\n\n var pointerPosition = getPointerPosition(event.sourceEvent, {\n transform: transform,\n snapGrid: snapGrid,\n snapToGrid: snapToGrid,\n containerBounds: containerBounds\n });\n var childChanges = [];\n\n if (!node) {\n return;\n }\n\n var _prevValues = prevValues,\n prevX = _prevValues.x,\n prevY = _prevValues.y,\n prevWidth = _prevValues.width,\n prevHeight = _prevValues.height;\n var change = {};\n var nodeOrigin = (_node$origin3 = node.origin) !== null && _node$origin3 !== void 0 ? _node$origin3 : storeNodeOrigin;\n\n var _getDimensionsAfterRe = getDimensionsAfterResize(startValues, controlDirection, pointerPosition, boundaries, keepAspectRatio, nodeOrigin, parentExtent, childExtent),\n width = _getDimensionsAfterRe.width,\n height = _getDimensionsAfterRe.height,\n x = _getDimensionsAfterRe.x,\n y = _getDimensionsAfterRe.y;\n\n var isWidthChange = width !== prevWidth;\n var isHeightChange = height !== prevHeight;\n var isXPosChange = x !== prevX && isWidthChange;\n var isYPosChange = y !== prevY && isHeightChange;\n\n if (!isXPosChange && !isYPosChange && !isWidthChange && !isHeightChange) {\n return;\n }\n\n if (isXPosChange || isYPosChange || nodeOrigin[0] === 1 || nodeOrigin[1] === 1) {\n change.x = isXPosChange ? x : prevValues.x;\n change.y = isYPosChange ? y : prevValues.y;\n prevValues.x = change.x;\n prevValues.y = change.y;\n /*\n * when top/left changes, correct the relative positions of child nodes\n * so that they stay in the same position\n */\n\n if (childNodes.length > 0) {\n var xChange = x - prevX;\n var yChange = y - prevY;\n\n var _iterator17 = _createForOfIteratorHelper(childNodes),\n _step17;\n\n try {\n for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {\n var childNode = _step17.value;\n childNode.position = {\n x: childNode.position.x - xChange + nodeOrigin[0] * (width - prevWidth),\n y: childNode.position.y - yChange + nodeOrigin[1] * (height - prevHeight)\n };\n childChanges.push(childNode);\n }\n } catch (err) {\n _iterator17.e(err);\n } finally {\n _iterator17.f();\n }\n }\n }\n\n if (isWidthChange || isHeightChange) {\n change.width = isWidthChange ? width : prevValues.width;\n change.height = isHeightChange ? height : prevValues.height;\n prevValues.width = change.width;\n prevValues.height = change.height;\n } // Fix expandParent when resizing from top/left\n\n\n if (parentNode && node.expandParent) {\n var _change$width, _change$height;\n\n var xLimit = nodeOrigin[0] * ((_change$width = change.width) !== null && _change$width !== void 0 ? _change$width : 0);\n\n if (change.x && change.x < xLimit) {\n prevValues.x = xLimit;\n startValues.x = startValues.x - (change.x - xLimit);\n }\n\n var yLimit = nodeOrigin[1] * ((_change$height = change.height) !== null && _change$height !== void 0 ? _change$height : 0);\n\n if (change.y && change.y < yLimit) {\n prevValues.y = yLimit;\n startValues.y = startValues.y - (change.y - yLimit);\n }\n }\n\n var direction = getResizeDirection({\n width: prevValues.width,\n prevWidth: prevWidth,\n height: prevValues.height,\n prevHeight: prevHeight,\n affectsX: controlDirection.affectsX,\n affectsY: controlDirection.affectsY\n });\n\n var nextValues = _objectSpread(_objectSpread({}, prevValues), {}, {\n direction: direction\n });\n\n var callResize = shouldResize === null || shouldResize === void 0 ? void 0 : shouldResize(event, nextValues);\n\n if (callResize === false) {\n return;\n }\n\n onResize === null || onResize === void 0 ? void 0 : onResize(event, nextValues);\n onChange(change, childChanges);\n }).on('end', function (event) {\n onResizeEnd === null || onResizeEnd === void 0 ? void 0 : onResizeEnd(event, _objectSpread({}, prevValues));\n onEnd === null || onEnd === void 0 ? void 0 : onEnd();\n });\n selection.call(dragHandler);\n }\n\n function destroy() {\n selection.on('.drag', null);\n }\n\n return {\n update: update,\n destroy: destroy\n };\n}\n\nexport { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserNodes, areConnectionMapsEqual, areSetsEqual, boxToRect, calcAutoPan, calculateNodePosition, clamp, clampPosition, clampPositionToParent, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHandlePosition, getHostForElement, getIncomers, getInternalNodesBounds, getMarkerId, getNodeDimensions, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, handleExpandParent, infiniteExtent, initialConnection, isCoordinateExtent, isEdgeBase, isEdgeVisible, isInputDOMNode, isInternalNodeBase, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeHasDimensions, nodeToBox, nodeToRect, oppositePosition, panBy, pointToRendererPoint, reconnectEdge, rectToBox, rendererPointToPoint, shallowNodeData, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateNodeInternals };"],"names":["_oppositePosition","_handleDirections","_excluded2","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","getOwnPropertyDescriptors","defineProperties","defineProperty","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","minLen","_arrayLikeToArray","n","prototype","toString","call","slice","constructor","name","from","test","_unsupportedIterableToArray","F","s","done","value","e","_e","f","TypeError","err","normalCompletion","didErr","step","next","_e2","return","arr","len","arr2","ConnectionMode","PanOnScrollMode","SelectionMode","errorMessages","error001","error002","error003","nodeType","concat","error004","error005","error006","error007","id","error009","type","error008","handleType","_ref","sourceHandle","targetHandle","error010","error011","edgeType","error012","error013","lib","undefined","error014","error015","infiniteExtent","Number","NEGATIVE_INFINITY","POSITIVE_INFINITY","elementSelectionKeys","ConnectionLineType","MarkerType","Position","initialConnection","inProgress","isValid","fromHandle","fromPosition","fromNode","to","toHandle","toPosition","toNode","oppositePosition","Left","Right","Top","Bottom","getConnectionStatus","isEdgeBase","element","isNodeBase","isInternalNodeBase","getNodePositionWithOrigin","node","_node$origin","nodeOrigin","_getNodeDimensions","getNodeDimensions","width","height","origin","offsetX","offsetY","x","position","y","getNodesBounds","nodes","params","nodeLookup","box","reduce","currBox","nodeOrId","isId","currentNode","get","nodeBox","nodeToBox","x2","y2","getBoundsOfBoxes","Infinity","boxToRect","getInternalNodesBounds","size","getNodesInside","rect","_step2","_ref2","_ref3","tx","ty","tScale","partially","excludeNonSelectableNodes","paneRect","pointToRendererPoint","visibleNodes","_iterator2","values","_ref4","_ref5","_measured$width","_ref6","_ref7","_measured$height","measured","_node$selectable","selectable","_node$hidden","hidden","initialWidth","initialHeight","overlappingArea","getOverlappingArea","nodeToRect","area","partiallyVisible","forceInitialRender","internals","handleBounds","isVisible","dragging","getConnectedEdges","edges","nodeIds","Set","add","edge","has","getFitViewNodes","options","fitViewNodes","Map","optionNodeIds","map","includeHiddenNodes","set","fitViewport","_x","_x2","_fitViewport","this","_callee4","_ref8","_options$minZoom","_options$maxZoom","_options$padding","panZoom","minZoom","maxZoom","nodesToFit","bounds","viewport","_context4","prev","abrupt","Promise","resolve","getViewportForBounds","padding","setViewport","duration","stop","calculateNodePosition","_ref9","_node$origin2","_node$measured$width","_node$measured$height","nodeId","nextPosition","_ref9$nodeOrigin","nodeExtent","onError","parentNode","parentId","_ref10","positionAbsolute","parentX","parentY","extent","expandParent","isCoordinateExtent","parentWidth","parentHeight","clampPosition","getElementsToRemove","_x3","_getElementsToRemove","_callee5","_ref11","_ref11$nodesToRemove","nodesToRemove","_ref11$edgesToRemove","edgesToRemove","onBeforeDelete","matchingNodes","_iterator18","_step18","_loop","edgeIds","deletableEdges","connectedEdges","matchingEdges","_iterator19","_step19","_loop2","onBeforeDeleteResult","_context5","deletable","isIncluded","parentHit","find","t0","finish","sent","clamp","val","min","max","Math","_dimensions$width","_dimensions$height","dimensions","clampPositionToParent","childPosition","childDimensions","parent","_getNodeDimensions2","_parent$internals$pos","calcAutoPanVelocity","abs","calcAutoPan","pos","speed","distance","xMovement","yMovement","box1","box2","rectToBox","_ref12","_ref13","_ref15","_ref16","_node$measured$width2","_node$measured","_ref17","_ref18","_node$measured$height2","_node$measured2","_ref14","_ref20","_ref21","_node$measured$width3","_node$measured3","_ref22","_ref23","_node$measured$height3","_node$measured4","_ref19","getBoundsOfRects","rect1","rect2","rectA","rectB","xOverlap","yOverlap","ceil","isRectObject","obj","isNumeric","isNaN","isFinite","devWarn","message","snapPosition","snapGrid","round","_ref24","_ref25","_ref26","snapToGrid","rendererPointToPoint","_ref27","_ref28","_ref29","parsePadding","floor","endsWith","paddingValue","parseFloat","_paddingValue","console","error","p","paddingY","paddingX","top","right","bottom","left","_ref30","_padding$top","_ref31","_padding$bottom","_ref32","_padding$left","_ref33","_padding$right","parsePaddings","xZoom","yZoom","zoom","clampedZoom","newPadding","_rendererPointToPoint","_rendererPointToPoint2","calculateAppliedPaddings","offset","isMacOs","_navigator","_navigator$userAgent","navigator","userAgent","indexOf","_ref34","_ref35","_node$measured$width4","_node$measured5","_ref36","_ref37","_node$measured$height4","_node$measured6","nodeHasDimensions","_ref38","_node$measured$width5","_node$measured7","_ref39","_node$measured$height5","_node$measured8","evaluateAbsolutePosition","_dimensions$width2","_dimensions$height2","areSetsEqual","a","b","_step3","_iterator3","item","getPointerPosition","event","_ref40","_containerBounds$left","_containerBounds$top","_ref40$snapGrid","_ref40$snapToGrid","transform","containerBounds","_getEventPosition","getEventPosition","pointerPos","_ref41","xSnapped","ySnapped","getDimensions","offsetWidth","offsetHeight","getHostForElement","_element$getRootNode","_window","getRootNode","window","document","inputTags","isInputDOMNode","_event$composedPath","_event$composedPath$c","composedPath","includes","nodeName","hasAttribute","closest","isMouseEvent","_event$touches","_event$touches2","_bounds$left","_bounds$top","isMouse","evtX","clientX","touches","evtY","clientY","getHandleBounds","nodeElement","nodeBounds","handles","querySelectorAll","handle","getBoundingClientRect","getAttribute","getBezierEdgeCenter","_ref42","sourceX","sourceY","targetX","targetY","sourceControlX","sourceControlY","centerX","targetControlX","centerY","targetControlY","calculateControlOffset","curvature","sqrt","getControlWithCurvature","_ref43","x1","y1","c","getBezierPath","_ref44","_ref44$sourcePosition","sourcePosition","_ref44$targetPosition","targetPosition","_ref44$curvature","_getControlWithCurvat","_getControlWithCurvat2","_getControlWithCurvat3","_getControlWithCurvat4","_getBezierEdgeCenter","_getBezierEdgeCenter2","labelX","labelY","getEdgeCenter","_ref45","xOffset","yOffset","getElevatedEdgeZIndex","_ref46","sourceNode","targetNode","_ref46$selected","selected","_ref46$zIndex","zIndex","_ref46$elevateOnSelec","elevateOnSelect","edgeOrConnectedNodeSelected","selectedZIndex","z","isEdgeVisible","_ref47","edgeBox","viewRect","getEdgeId","_ref48","addEdge","edgeParams","some","el","connectionExists","getStraightPath","_ref49","_getEdgeCenter","_getEdgeCenter2","handleDirections","pow","getPoints","_ref51","_ref51$sourcePosition","_ref51$targetPosition","center","sourceDir","targetDir","sourceGapped","targetGapped","dir","_ref50","_ref50$sourcePosition","getDirection","dirAccessor","currDir","points","sourceGapOffset","targetGapOffset","_getEdgeCenter3","_getEdgeCenter4","defaultCenterX","defaultCenterY","defaultOffsetX","defaultOffsetY","_center$x","_center$y","verticalSplit","horizontalSplit","sourceTarget","targetSource","diff","gapOffset","dirAccessorOpposite","isSameDir","sourceGtTargetOppo","sourceLtTargetOppo","sourceGapPoint","targetGapPoint","getSmoothStepPath","_ref52","_ref52$sourcePosition","_ref52$targetPosition","_ref52$borderRadius","borderRadius","_ref52$offset","_getPoints","_getPoints2","res","bendSize","_xDir","_yDir","xDir","yDir","getBend","isNodeInitialized","_node$handles","getEdgePosition","_sourceHandleBounds$s","_targetHandleBounds$t","_targetHandleBounds$t2","_targetHandleBounds$s","_params$onError","sourceHandleBounds","toHandleBounds","targetHandleBounds","getHandle$1","connectionMode","Strict","getHandlePosition","_step4","_iterator4","_handle$width","_handle$height","_handle$x","_handle$y","_handle$position","fallbackPosition","_ref53","handleId","d","getMarkerId","marker","idPrefix","sort","join","createMarkerIds","_ref54","defaultColor","defaultMarkerStart","defaultMarkerEnd","ids","markers","markerStart","markerEnd","markerId","color","localeCompare","getNodeToolbarTransform","nodeRect","align","alignmentOffset","shift","defaultOptions","elevateNodesOnSelect","defaults","adoptUserNodesDefaultOptions","checkEquality","mergeObjects","base","incoming","result","updateAbsolutePositions","parentLookup","_step5","_options","_iterator5","updateChildNode","positionWithOrigin","clampedPosition","adoptUserNodes","nodesInitialized","tmpLookup","selectedNodeZ","clear","_step6","_iterator6","_internalNode","userNode","internalNode","_userNode$measured","_userNode$measured2","_internalNode2","calculateZ","_mergeObjects","childNodes","updateParentLookup","_calculateChildXYZ","childNode","_parentNode$internals2","_parentNode$internals","absolutePosition","childZ","parentZ","calculateChildXYZ","positionChanged","warn","handleExpandParent","children","_step7","changes","parentExpansions","_iterator7","_parentExpansions$get","_parentExpansions$get2","child","parentRect","expandedRect","_ref55","_parent$origin","_parentLookup$get","xChange","yChange","newWidth","newHeight","widthChange","heightChange","setAttributes","updateNodeInternals","updates","domNode","viewportNode","querySelector","updatedInternals","_step8","style","getComputedStyle","DOMMatrixReadOnly","m22","parentExpandChildren","_iterator8","update","dimensionChanged","force","newNode","parentExpandChanges","panBy","_x4","_panBy","_callee6","_ref56","delta","translateExtent","nextViewport","transformChanged","_context6","setViewportConstrained","k","addConnectionToLookup","connection","connectionKey","connectionLookup","nodeMap","typeMap","handleMap","updateConnectionLookup","edgeLookup","_step9","_iterator9","_edge$sourceHandle","_edge$targetHandle","edgeId","sourceKey","isParentSelected","hasSelector","selector","current","_current","_current$matches","_current2","matches","parentElement","getEventHandlerParams","_ref57","_nodeLookup$get","_dragItems$get","_step11","dragItems","_ref57$dragging","nodesFromDragItems","_iterator11","_nodeLookup$get2","_step11$value","dragItem","_node","XYDrag","_ref58","onNodeMouseDown","getStoreItems","onDragStart","onDrag","onDragStop","lastPos","autoPanId","autoPanStarted","mousePosition","dragStarted","d3Selection","abortDrag","_ref59","noDragClassName","handleSelector","isSelectable","_ref59$nodeClickDista","nodeClickDistance","updateNodes","_ref60","dragEvent","_getStoreItems","onNodeDrag","onSelectionDrag","updateNodePositions","hasChange","nodesBox","_step12","_iterator12","_step12$value","adjustedNodeExtent","_positionAbsolute","_calculateNodePositio","_getEventHandlerParam","_getEventHandlerParam2","currentNodes","autoPan","_autoPan","_callee","_getStoreItems6","autoPanSpeed","_calcAutoPan","_calcAutoPan2","_lastPos$x2","_lastPos$y2","_context","autoPanOnNodeDrag","cancelAnimationFrame","requestAnimationFrame","startDrag","_nodeLookup$get3","_getStoreItems2","multiSelectionActive","nodesDraggable","selectNodesOnDrag","onNodeDragStart","onSelectionDragStart","unselectNodesAndEdges","sourceEvent","mousePos","_step10","_iterator10","_step10$value","draggable","_internalNode$measure","_internalNode$measure2","getDragItems","_getEventHandlerParam3","_getEventHandlerParam4","d3DragInstance","clickDistance","on","_getStoreItems3","nodeDragThreshold","_getStoreItems4","_lastPos$x","_lastPos$y","_getStoreItems5","onNodeDragStop","onSelectionDragStop","_getEventHandlerParam5","_getEventHandlerParam6","button","destroy","_d3Selection","getClosestHandle","connectionRadius","_step14","closestHandles","minDistance","closeNodes","_step13","_iterator13","getNodesWithinDistance","_iterator14","_node$internals$handl","_node$internals$handl2","_node$internals$handl3","_node$internals$handl4","_step15","_iterator15","_getHandlePosition","_distance2","_closestHandles$find","oppositeHandleType","getHandle","_node$internals$handl5","_node$internals$handl6","_node$internals$handl7","_node$internals$handl8","_node$internals$handl9","_ref61","withAbsolutePosition","h","getHandleType","edgeUpdaterType","handleDomNode","classList","contains","alwaysValid","isValidHandle","_ref63","fromNodeId","fromHandleId","fromType","doc","flowId","_ref63$isValidConnect","isValidConnection","isTarget","_getEventPosition3","handleBelow","elementFromPoint","handleToCheck","handleNodeId","connectable","connectableEnd","XYHandle","onPointerDown","_ref62","closestHandle","autoPanOnConnect","cancelConnection","onConnectStart","onConnect","onConnectEnd","_ref62$isValidConnect","onReconnectEnd","updateConnection","getTransform","getFromHandle","_getEventPosition2","clickedHandle","fromHandleInternal","fromNodeInternal","newConnection","previousConnection","addEventListener","onPointerMove","onPointerUp","_calcAutoPan3","_calcAutoPan4","isInsideConnectionRadius","isHandleValid","isConnectionValid","_previousConnection","finalConnectionState","removeEventListener","XYMinimap","_ref64","getViewScale","selection","_ref65","_ref65$zoomStep","zoomStep","_ref65$pannable","pannable","_ref65$zoomable","zoomable","_ref65$inversePan","inversePan","panStart","zoomAndPanHandler","_event$sourceEvent$cl","_event$sourceEvent$cl2","_event$sourceEvent$cl3","_event$sourceEvent$cl4","panCurrent","panDelta","moveScale","log","pinchDelta","deltaY","deltaMode","nextZoom","scaleTo","pointer","ResizeControlVariant","transformToViewport","viewportToTransform","_ref66","scale","isWrappedWithClass","className","isRightClickPan","panOnDrag","usedButton","getD3Transition","onEnd","hasDuration","transition","wheelDelta","factor","ctrlKey","XYPanZoom","_ref73","paneClickDistance","onPanZoom","onPanZoomStart","onPanZoomEnd","onDraggingChange","zoomPanValues","isZoomingOrPanning","usedRightMouseButton","prevViewport","mouseButton","timerId","panScrollTimeout","isPanScrolling","bbox","d3ZoomInstance","scaleExtent","d3ZoomHandler","d3DblClickZoomHandler","setTransform","_x5","_x6","_x7","_setViewportConstrained","_callee2","nextTransform","contrainedTransform","_context2","constrain","_setViewport","_callee3","_context3","_ref74","noWheelClassName","noPanClassName","onPaneContextMenu","userSelectionActive","panOnScroll","panOnScrollMode","panOnScrollSpeed","preventScrolling","zoomOnPinch","zoomOnScroll","zoomOnDoubleClick","zoomActivationKeyPressed","onTransformChange","wheelHandler","_ref67","d3Zoom","preventDefault","stopImmediatePropagation","currentZoom","property","point","_zoom","deltaNormalize","deltaX","Vertical","Horizontal","shiftKey","translateBy","internal","clearTimeout","setTimeout","createPanOnScrollHandler","_ref68","createZoomOnScrollHandler","passive","startHandler","_ref69","_event$sourceEvent","_event$sourceEvent2","_event$sourceEvent3","createPanZoomStartHandler","panZoomHandler","_ref70","_zoomPanValues$mouseB","_event$sourceEvent4","_event$sourceEvent5","sync","createPanZoomHandler","panZoomEndHandler","_ref71","_event$sourceEvent6","_zoomPanValues$mouseB2","eventViewport","createPanZoomEndHandler","_ref72","_event$touches3","zoomScroll","pinchZoom","buttonAllowed","createFilter","_x8","_x9","getViewport","scaleBy","setScaleExtent","setTranslateExtent","syncViewport","currentTransform","setClickDistance","validDistance","getLowerExtentClamp","lowerExtent","lowerBound","getUpperExtentClamp","upperExtent","upperBound","getSizeClamp","minSize","maxSize","xor","initPrevValues","initStartValues","pointerX","pointerY","aspectRatio","nodeToChildExtent","_child$measured$width","_child$measured$heigh","originOffsetX","originOffsetY","XYResizer","_ref76","onChange","_ref77","controlPosition","boundaries","keepAspectRatio","onResizeStart","onResize","onResizeEnd","shouldResize","prevValues","startValues","controlDirection","isHorizontal","isVertical","affectsX","affectsY","getControlDirection","parentExtent","childExtent","dragHandler","_paneDomNode$getBound","_node$measured$width6","_node$measured$height6","_node$position$x","_node$position$y","_getStoreItems7","paneDomNode","_getPointerPosition","nodeToParentExtent","_step16","_iterator16","_step16$value","childId","_child$origin","_node$origin3","_getStoreItems8","storeNodeOrigin","pointerPosition","childChanges","_prevValues","prevX","prevY","prevWidth","prevHeight","change","_getDimensionsAfterRe","isDiagonal","minWidth","maxWidth","minHeight","maxHeight","startX","startY","startWidth","startHeight","distX","distY","clampX","clampY","xExtentClamp","yExtentClamp","_xExtentClamp","_yExtentClamp","aspectHeightClamp","aspectExtentClamp","_aspectExtentClamp","aspectWidthClamp","_aspectExtentClamp2","_aspectExtentClamp3","getDimensionsAfterResize","isWidthChange","isHeightChange","isXPosChange","isYPosChange","_step17","_iterator17","_change$width","_change$height","xLimit","yLimit","direction","_ref75","deltaWidth","deltaHeight","getResizeDirection","nextValues"],"sourceRoot":""}