@likec4/diagram 1.36.0 → 1.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/bundle/{chunk-7MPUJFHj.js → chunk-DSORWspW.js} +1011 -983
  2. package/bundle/custom.js +64 -56
  3. package/bundle/index.js +3546 -3321
  4. package/dist/LikeC4Diagram.props.d.ts +5 -5
  5. package/dist/LikeC4Styles.js +17 -15
  6. package/dist/StaticLikeC4Diagram.d.ts +1 -1
  7. package/dist/StaticLikeC4Diagram.js +3 -0
  8. package/dist/base/BaseXYFlow.d.ts +1 -1
  9. package/dist/base/BaseXYFlow.js +25 -27
  10. package/dist/base/const.d.ts +4 -4
  11. package/dist/base/const.js +5 -4
  12. package/dist/base/primitives/MarkdownBlock.js +4 -1
  13. package/dist/base/primitives/compound/CompoundActionButton.js +27 -42
  14. package/dist/base/primitives/compound/CompoundDetailsButton.js +23 -48
  15. package/dist/base/primitives/compound/CompoundNodeContainer.js +16 -48
  16. package/dist/base/primitives/compound/CompoundTitle.js +5 -80
  17. package/dist/base/primitives/compound/actionbtns.css.js +1 -13
  18. package/dist/base/primitives/customEdge.d.ts +1 -1
  19. package/dist/base/primitives/customNode.d.ts +4 -4
  20. package/dist/base/primitives/customNode.js +7 -7
  21. package/dist/base/primitives/edge/EdgeLabel.d.ts +5 -4
  22. package/dist/base/primitives/edge/EdgeLabel.js +39 -21
  23. package/dist/base/primitives/edge/EdgeLabelContainer.js +11 -23
  24. package/dist/base/primitives/edge/edge.css.js +19 -11
  25. package/dist/base/primitives/element/ElementShape.js +38 -18
  26. package/dist/base/primitives/element/ElementTags.js +7 -4
  27. package/dist/base/primitives/element/ElementTitle.js +10 -2
  28. package/dist/base/types.d.ts +17 -21
  29. package/dist/bundle/LikeC4View.d.ts +2 -2
  30. package/dist/bundle/LikeC4View.js +4 -1
  31. package/dist/bundle/LikeC4View.props.d.ts +2 -2
  32. package/dist/bundle/ReactLikeC4.d.ts +3 -3
  33. package/dist/bundle/custom.js +2 -1
  34. package/dist/bundle/index.js +2 -1
  35. package/dist/components/Link.js +3 -2
  36. package/dist/context/ReduceGraphics.js +2 -5
  37. package/dist/context/RootContainer.js +1 -5
  38. package/dist/custom/customNodes.d.ts +32 -26
  39. package/dist/custom/customNodes.js +12 -8
  40. package/dist/custom/hooks.d.ts +2 -1
  41. package/dist/custom/index.js +2 -1
  42. package/dist/globals.css.js +1 -1
  43. package/dist/hooks/index.d.ts +1 -1
  44. package/dist/hooks/useDiagram.d.ts +18 -1
  45. package/dist/hooks/useDiagram.js +18 -2
  46. package/dist/hooks/useXYFlow.d.ts +40 -21
  47. package/dist/index.d.ts +1 -1
  48. package/dist/index.js +2 -1
  49. package/dist/likec4diagram/DiagramUI.js +7 -3
  50. package/dist/likec4diagram/DiagramXYFlow.js +9 -9
  51. package/dist/likec4diagram/custom/edges/RelationshipEdge.d.ts +3 -3
  52. package/dist/likec4diagram/custom/edges/RelationshipEdge.js +27 -44
  53. package/dist/likec4diagram/custom/index.js +3 -3
  54. package/dist/likec4diagram/custom/nodes/nodes.d.ts +8 -6
  55. package/dist/likec4diagram/custom/nodes/nodes.js +13 -14
  56. package/dist/likec4diagram/custom/nodes/toolbar/CompoundToolbar.js +3 -2
  57. package/dist/likec4diagram/custom/nodes/toolbar/_shared.d.ts +2 -2
  58. package/dist/likec4diagram/relationship-popover/RelationshipPopover.d.ts +2 -0
  59. package/dist/likec4diagram/relationship-popover/RelationshipPopover.js +441 -0
  60. package/dist/likec4diagram/relationship-popover/actor.d.ts +177 -0
  61. package/dist/likec4diagram/relationship-popover/actor.js +155 -0
  62. package/dist/likec4diagram/relationship-popover/styles.css.d.ts +2 -0
  63. package/dist/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.js → relationship-popover/styles.css.js} +4 -17
  64. package/dist/likec4diagram/ui/diagram-title/DiagramTitlePanel.js +4 -4
  65. package/dist/likec4diagram/useLayoutConstraints.js +0 -1
  66. package/dist/likec4model/LikeC4ModelContext.d.ts +2 -1
  67. package/dist/likec4model/LikeC4ModelContext.js +10 -2
  68. package/dist/likec4model/useCurrentViewModel.d.ts +1 -0
  69. package/dist/likec4model/useCurrentViewModel.js +4 -1
  70. package/dist/likec4model/useLikeC4ElementsTree.js +1 -1
  71. package/dist/likec4model/useLikeC4Project.js +15 -1
  72. package/dist/navigationpanel/NavigationPanelDropdown.js +1 -2
  73. package/dist/navigationpanel/actor.js +1 -2
  74. package/dist/navigationpanel/controls/NavigationButtons.js +1 -5
  75. package/dist/navigationpanel/controls/OpenSource.js +1 -1
  76. package/dist/navigationpanel/controls/ViewDetailsCard.js +2 -0
  77. package/dist/overlays/element-details/actor.d.ts +564 -8
  78. package/dist/overlays/overlay/Overlay.css.d.ts +1 -1
  79. package/dist/overlays/relationship-details/actor.d.ts +3 -1
  80. package/dist/overlays/relationship-details/hooks.d.ts +19 -1
  81. package/dist/overlays/relationship-details/layout-to-xyflow.js +0 -1
  82. package/dist/overlays/relationship-details/layout.js +1 -2
  83. package/dist/overlays/relationships-browser/actor.d.ts +26 -2
  84. package/dist/overlays/relationships-browser/custom/nodeTypes.d.ts +16 -0
  85. package/dist/overlays/relationships-browser/custom/nodeTypes.js +18 -8
  86. package/dist/overlays/relationships-browser/useViewToNodesEdges.js +0 -1
  87. package/dist/search/components/_shared.css.d.ts +1 -1
  88. package/dist/state/DiagramActorProvider.js +5 -23
  89. package/dist/state/assign.js +24 -10
  90. package/dist/state/diagram-machine.d.ts +149 -474
  91. package/dist/state/diagram-machine.js +94 -54
  92. package/dist/state/types.d.ts +1 -1
  93. package/dist/styles-min.css +1 -1
  94. package/dist/styles-xyflow.css +1 -1
  95. package/dist/styles.css +1 -1
  96. package/dist/styles.css2.js +1 -1
  97. package/dist/utils/index.d.ts +2 -1
  98. package/dist/utils/roundDpr.d.ts +1 -0
  99. package/dist/utils/roundDpr.js +20 -0
  100. package/dist/utils/xyflow.d.ts +0 -1
  101. package/dist/utils/xyflow.js +1 -7
  102. package/package.json +11 -10
  103. package/panda.buildinfo.json +90 -155
  104. package/src/LikeC4Diagram.props.ts +5 -5
  105. package/src/LikeC4Styles.tsx +22 -14
  106. package/src/StaticLikeC4Diagram.tsx +3 -0
  107. package/src/base/BaseXYFlow.tsx +26 -29
  108. package/src/base/const.ts +5 -4
  109. package/src/base/primitives/MarkdownBlock.tsx +6 -1
  110. package/src/base/primitives/compound/CompoundActionButton.tsx +31 -43
  111. package/src/base/primitives/compound/CompoundDetailsButton.tsx +26 -48
  112. package/src/base/primitives/compound/CompoundNodeContainer.tsx +15 -43
  113. package/src/base/primitives/compound/CompoundTitle.tsx +4 -76
  114. package/src/base/primitives/compound/actionbtns.css.ts +0 -12
  115. package/src/base/primitives/customEdge.ts +1 -1
  116. package/src/base/primitives/customNode.tsx +20 -24
  117. package/src/base/primitives/edge/EdgeLabel.tsx +23 -8
  118. package/src/base/primitives/edge/EdgeLabelContainer.tsx +9 -21
  119. package/src/base/primitives/edge/edge.css.ts +19 -11
  120. package/src/base/primitives/element/ElementShape.tsx +40 -18
  121. package/src/base/primitives/element/ElementTags.tsx +7 -4
  122. package/src/base/primitives/element/ElementTitle.tsx +23 -11
  123. package/src/base/types.ts +21 -25
  124. package/src/bundle/LikeC4View.props.ts +2 -2
  125. package/src/bundle/LikeC4View.tsx +8 -5
  126. package/src/bundle/ReactLikeC4.tsx +3 -3
  127. package/src/components/Link.tsx +3 -2
  128. package/src/context/RootContainer.tsx +1 -5
  129. package/src/context/TagStylesContext.tsx +2 -0
  130. package/src/custom/{customNodes.tsx → customNodes.ts} +58 -52
  131. package/src/custom/hooks.ts +7 -0
  132. package/src/globals.css +58 -5
  133. package/src/hooks/index.ts +1 -1
  134. package/src/hooks/useDiagram.ts +39 -5
  135. package/src/hooks/useXYFlow.ts +3 -1
  136. package/src/index.ts +1 -0
  137. package/src/likec4diagram/DiagramUI.tsx +11 -2
  138. package/src/likec4diagram/DiagramXYFlow.tsx +9 -11
  139. package/src/likec4diagram/custom/edges/RelationshipEdge.tsx +25 -49
  140. package/src/likec4diagram/custom/index.ts +5 -4
  141. package/src/likec4diagram/custom/nodes/nodes.tsx +13 -11
  142. package/src/likec4diagram/custom/nodes/toolbar/CompoundToolbar.tsx +3 -2
  143. package/src/likec4diagram/relationship-popover/RelationshipPopover.tsx +535 -0
  144. package/src/likec4diagram/relationship-popover/actor.ts +192 -0
  145. package/src/likec4diagram/{custom/edges/RelationshipsDropdownMenu.css.ts → relationship-popover/styles.css.ts} +3 -19
  146. package/src/likec4diagram/ui/diagram-title/DiagramTitlePanel.tsx +4 -5
  147. package/src/likec4diagram/useLayoutConstraints.ts +0 -1
  148. package/src/likec4model/{LikeC4ModelContext.ts → LikeC4ModelContext.tsx} +9 -1
  149. package/src/likec4model/useCurrentViewModel.ts +4 -0
  150. package/src/likec4model/useLikeC4ElementsTree.ts +1 -1
  151. package/src/navigationpanel/NavigationPanelDropdown.tsx +1 -2
  152. package/src/navigationpanel/actor.ts +2 -2
  153. package/src/navigationpanel/controls/NavigationButtons.tsx +1 -5
  154. package/src/navigationpanel/controls/OpenSource.tsx +1 -1
  155. package/src/navigationpanel/controls/ViewDetailsCard.tsx +2 -0
  156. package/src/overlays/relationship-details/layout-to-xyflow.ts +0 -1
  157. package/src/overlays/relationship-details/layout.ts +4 -3
  158. package/src/overlays/relationships-browser/custom/nodeTypes.tsx +22 -8
  159. package/src/overlays/relationships-browser/useViewToNodesEdges.ts +0 -1
  160. package/src/state/DiagramActorProvider.tsx +8 -25
  161. package/src/state/assign.ts +24 -10
  162. package/src/state/diagram-machine.ts +101 -53
  163. package/src/state/types.ts +4 -1
  164. package/src/utils/index.ts +2 -1
  165. package/src/utils/roundDpr.ts +27 -0
  166. package/src/utils/xyflow.ts +0 -7
  167. package/dist/base/primitives/compound/CompoundNodeContainer.css.d.ts +0 -35
  168. package/dist/base/primitives/compound/CompoundNodeContainer.css.js +0 -132
  169. package/dist/base/primitives/edge/EdgeLabel.css.d.ts +0 -7
  170. package/dist/base/primitives/edge/EdgeLabel.css.js +0 -57
  171. package/dist/base/primitives/element/ElementShape.css.d.ts +0 -6
  172. package/dist/base/primitives/element/ElementShape.css.js +0 -107
  173. package/dist/likec4diagram/custom/edges/NotePopover.css.js +0 -21
  174. package/dist/likec4diagram/custom/edges/NotePopover.js +0 -91
  175. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.css.d.ts +0 -5
  176. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.d.ts +0 -13
  177. package/dist/likec4diagram/custom/edges/RelationshipsDropdownMenu.js +0 -215
  178. package/dist/likec4diagram/custom/index.d.ts +0 -62
  179. package/dist/overlays/relationship-details/custom/nodeTypes.d.ts +0 -10
  180. package/src/base/primitives/compound/CompoundNodeContainer.css.ts +0 -138
  181. package/src/base/primitives/edge/EdgeLabel.css.ts +0 -64
  182. package/src/base/primitives/element/ElementShape.css.ts +0 -112
  183. package/src/likec4diagram/custom/edges/RelationshipsDropdownMenu.tsx +0 -281
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import React__default, { useState, Fragment, createContext, useContext, useRef, useEffect, useMemo, useCallback, useLayoutEffect, useId as useId$2, forwardRef, cloneElement, Children, createElement, useInsertionEffect as useInsertionEffect$1, memo as memo$1, useSyncExternalStore, createRef } from "react";
2
+ import React__default, { useState, Fragment, createContext, useContext, useRef, useEffect, useMemo, useCallback, useLayoutEffect, useId as useId$2, forwardRef, cloneElement, Children, createElement, useInsertionEffect as useInsertionEffect$1, memo as memo$1, createRef } from "react";
3
3
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
4
4
  import * as ReactDOM from "react-dom";
5
5
  import ReactDOM__default, { createPortal } from "react-dom";
@@ -790,8 +790,8 @@ var ReactRemoveScroll = React.forwardRef(function(props, ref) {
790
790
  return React.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
791
791
  });
792
792
  ReactRemoveScroll.classNames = RemoveScroll.classNames;
793
- function keys$1(object) {
794
- return Object.keys(object);
793
+ function keys$1(object2) {
794
+ return Object.keys(object2);
795
795
  }
796
796
  function isObject(item) {
797
797
  return item && typeof item == "object" && !Array.isArray(item);
@@ -848,7 +848,7 @@ function isNumberLike(value) {
848
848
  }
849
849
  return !1;
850
850
  }
851
- function isElement$1(value) {
851
+ function isElement$2(value) {
852
852
  return Array.isArray(value) || value === null ? !1 : typeof value == "object" ? value.type !== Fragment : !1;
853
853
  }
854
854
  function createSafeContext(errorMessage) {
@@ -2772,114 +2772,52 @@ const DirectionContext = createContext({
2772
2772
  function useDirection() {
2773
2773
  return useContext(DirectionContext);
2774
2774
  }
2775
- function hasWindow() {
2775
+ function hasWindow$1() {
2776
2776
  return typeof window < "u";
2777
2777
  }
2778
- function getNodeName(node) {
2779
- return isNode$1(node) ? (node.nodeName || "").toLowerCase() : "#document";
2778
+ function getNodeName$1(node) {
2779
+ return isNode$2(node) ? (node.nodeName || "").toLowerCase() : "#document";
2780
2780
  }
2781
- function getWindow(node) {
2781
+ function getWindow$1(node) {
2782
2782
  var _node$ownerDocument;
2783
2783
  return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
2784
2784
  }
2785
- function getDocumentElement(node) {
2785
+ function getDocumentElement$1(node) {
2786
2786
  var _ref;
2787
- return (_ref = (isNode$1(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
2788
- }
2789
- function isNode$1(value) {
2790
- return hasWindow() ? value instanceof Node || value instanceof getWindow(value).Node : !1;
2791
- }
2792
- function isElement(value) {
2793
- return hasWindow() ? value instanceof Element || value instanceof getWindow(value).Element : !1;
2794
- }
2795
- function isHTMLElement(value) {
2796
- return hasWindow() ? value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement : !1;
2787
+ return (_ref = (isNode$2(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
2797
2788
  }
2798
- function isShadowRoot(value) {
2799
- return !hasWindow() || typeof ShadowRoot > "u" ? !1 : value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
2800
- }
2801
- function isOverflowElement(element) {
2802
- const {
2803
- overflow,
2804
- overflowX,
2805
- overflowY,
2806
- display
2807
- } = getComputedStyle(element);
2808
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
2809
- }
2810
- function isTableElement(element) {
2811
- return ["table", "td", "th"].includes(getNodeName(element));
2789
+ function isNode$2(value) {
2790
+ return hasWindow$1() ? value instanceof Node || value instanceof getWindow$1(value).Node : !1;
2812
2791
  }
2813
- function isTopLayer(element) {
2814
- return [":popover-open", ":modal"].some((selector2) => {
2815
- try {
2816
- return element.matches(selector2);
2817
- } catch {
2818
- return !1;
2819
- }
2820
- });
2792
+ function isElement$1(value) {
2793
+ return hasWindow$1() ? value instanceof Element || value instanceof getWindow$1(value).Element : !1;
2821
2794
  }
2822
- function isContainingBlock(elementOrCss) {
2823
- const webkit = isWebKit(), css2 = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
2824
- return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css2[value] ? css2[value] !== "none" : !1) || (css2.containerType ? css2.containerType !== "normal" : !1) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : !1) || !webkit && (css2.filter ? css2.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css2.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css2.contain || "").includes(value));
2795
+ function isHTMLElement$1(value) {
2796
+ return hasWindow$1() ? value instanceof HTMLElement || value instanceof getWindow$1(value).HTMLElement : !1;
2825
2797
  }
2826
- function getContainingBlock(element) {
2827
- let currentNode = getParentNode(element);
2828
- for (; isHTMLElement(currentNode) && !isLastTraversableNode(currentNode); ) {
2829
- if (isContainingBlock(currentNode))
2830
- return currentNode;
2831
- if (isTopLayer(currentNode))
2832
- return null;
2833
- currentNode = getParentNode(currentNode);
2834
- }
2835
- return null;
2798
+ function isShadowRoot$1(value) {
2799
+ return !hasWindow$1() || typeof ShadowRoot > "u" ? !1 : value instanceof ShadowRoot || value instanceof getWindow$1(value).ShadowRoot;
2836
2800
  }
2837
- function isWebKit() {
2801
+ function isWebKit$1() {
2838
2802
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
2839
2803
  }
2840
- function isLastTraversableNode(node) {
2841
- return ["html", "body", "#document"].includes(getNodeName(node));
2842
- }
2843
- function getComputedStyle(element) {
2844
- return getWindow(element).getComputedStyle(element);
2804
+ function isLastTraversableNode$1(node) {
2805
+ return ["html", "body", "#document"].includes(getNodeName$1(node));
2845
2806
  }
2846
- function getNodeScroll(element) {
2847
- return isElement(element) ? {
2848
- scrollLeft: element.scrollLeft,
2849
- scrollTop: element.scrollTop
2850
- } : {
2851
- scrollLeft: element.scrollX,
2852
- scrollTop: element.scrollY
2853
- };
2807
+ function getComputedStyle$1(element) {
2808
+ return getWindow$1(element).getComputedStyle(element);
2854
2809
  }
2855
- function getParentNode(node) {
2856
- if (getNodeName(node) === "html")
2810
+ function getParentNode$1(node) {
2811
+ if (getNodeName$1(node) === "html")
2857
2812
  return node;
2858
2813
  const result = (
2859
2814
  // Step into the shadow DOM of the parent of a slotted node.
2860
2815
  node.assignedSlot || // DOM Element detected.
2861
2816
  node.parentNode || // ShadowRoot detected.
2862
- isShadowRoot(node) && node.host || // Fallback.
2863
- getDocumentElement(node)
2817
+ isShadowRoot$1(node) && node.host || // Fallback.
2818
+ getDocumentElement$1(node)
2864
2819
  );
2865
- return isShadowRoot(result) ? result.host : result;
2866
- }
2867
- function getNearestOverflowAncestor(node) {
2868
- const parentNode = getParentNode(node);
2869
- return isLastTraversableNode(parentNode) ? node.ownerDocument ? node.ownerDocument.body : node.body : isHTMLElement(parentNode) && isOverflowElement(parentNode) ? parentNode : getNearestOverflowAncestor(parentNode);
2870
- }
2871
- function getOverflowAncestors(node, list, traverseIframes) {
2872
- var _node$ownerDocument2;
2873
- list === void 0 && (list = []), traverseIframes === void 0 && (traverseIframes = !0);
2874
- const scrollableAncestor = getNearestOverflowAncestor(node), isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body), win2 = getWindow(scrollableAncestor);
2875
- if (isBody) {
2876
- const frameElement = getFrameElement(win2);
2877
- return list.concat(win2, win2.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
2878
- }
2879
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
2880
- }
2881
- function getFrameElement(win2) {
2882
- return win2.parent && Object.getPrototypeOf(win2.parent) ? win2.frameElement : null;
2820
+ return isShadowRoot$1(result) ? result.host : result;
2883
2821
  }
2884
2822
  function activeElement(doc) {
2885
2823
  let activeElement2 = doc.activeElement;
@@ -2895,7 +2833,7 @@ function contains(parent, child) {
2895
2833
  const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
2896
2834
  if (parent.contains(child))
2897
2835
  return !0;
2898
- if (rootNode && isShadowRoot(rootNode)) {
2836
+ if (rootNode && isShadowRoot$1(rootNode)) {
2899
2837
  let next = child;
2900
2838
  for (; next; ) {
2901
2839
  if (parent === next)
@@ -2962,9 +2900,9 @@ function getTarget(event) {
2962
2900
  }
2963
2901
  const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
2964
2902
  function isTypeableElement(element) {
2965
- return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
2903
+ return isHTMLElement$1(element) && element.matches(TYPEABLE_SELECTOR);
2966
2904
  }
2967
- const sides = ["top", "right", "bottom", "left"], min$1 = Math.min, max$1 = Math.max, round = Math.round, floor = Math.floor, createCoords = (v) => ({
2905
+ const sides = ["top", "right", "bottom", "left"], alignments = ["start", "end"], placements = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []), min$1 = Math.min, max$1 = Math.max, round = Math.round, floor = Math.floor, createCoords = (v) => ({
2968
2906
  x: v,
2969
2907
  y: v
2970
2908
  }), oppositeSideMap = {
@@ -2994,8 +2932,9 @@ function getOppositeAxis(axis) {
2994
2932
  function getAxisLength(axis) {
2995
2933
  return axis === "y" ? "height" : "width";
2996
2934
  }
2935
+ const yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
2997
2936
  function getSideAxis(placement) {
2998
- return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
2937
+ return yAxisSides.has(getSide(placement)) ? "y" : "x";
2999
2938
  }
3000
2939
  function getAlignmentAxis(placement) {
3001
2940
  return getOppositeAxis(getSideAxis(placement));
@@ -3013,15 +2952,15 @@ function getExpandedPlacements(placement) {
3013
2952
  function getOppositeAlignmentPlacement(placement) {
3014
2953
  return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
3015
2954
  }
2955
+ const lrPlacement = ["left", "right"], rlPlacement = ["right", "left"], tbPlacement = ["top", "bottom"], btPlacement = ["bottom", "top"];
3016
2956
  function getSideList(side, isStart, rtl) {
3017
- const lr = ["left", "right"], rl = ["right", "left"], tb = ["top", "bottom"], bt = ["bottom", "top"];
3018
2957
  switch (side) {
3019
2958
  case "top":
3020
2959
  case "bottom":
3021
- return rtl ? isStart ? rl : lr : isStart ? lr : rl;
2960
+ return rtl ? isStart ? rlPlacement : lrPlacement : isStart ? lrPlacement : rlPlacement;
3022
2961
  case "left":
3023
2962
  case "right":
3024
- return isStart ? tb : bt;
2963
+ return isStart ? tbPlacement : btPlacement;
3025
2964
  default:
3026
2965
  return [];
3027
2966
  }
@@ -3260,7 +3199,79 @@ const arrow$3 = (options) => ({
3260
3199
  reset: shouldAddOffset
3261
3200
  };
3262
3201
  }
3263
- }), flip$2 = function(options) {
3202
+ });
3203
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
3204
+ return (alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement)).filter((placement) => alignment ? getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : !1) : !0);
3205
+ }
3206
+ const autoPlacement$1 = function(options) {
3207
+ return options === void 0 && (options = {}), {
3208
+ name: "autoPlacement",
3209
+ options,
3210
+ async fn(state) {
3211
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
3212
+ const {
3213
+ rects,
3214
+ middlewareData,
3215
+ placement,
3216
+ platform: platform2,
3217
+ elements
3218
+ } = state, {
3219
+ crossAxis = !1,
3220
+ alignment,
3221
+ allowedPlacements = placements,
3222
+ autoAlignment = !0,
3223
+ ...detectOverflowOptions
3224
+ } = evaluate(options, state), placements$1 = alignment !== void 0 || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements, overflow = await detectOverflow(state, detectOverflowOptions), currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0, currentPlacement = placements$1[currentIndex];
3225
+ if (currentPlacement == null)
3226
+ return {};
3227
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
3228
+ if (placement !== currentPlacement)
3229
+ return {
3230
+ reset: {
3231
+ placement: placements$1[0]
3232
+ }
3233
+ };
3234
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]], allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], {
3235
+ placement: currentPlacement,
3236
+ overflows: currentOverflows
3237
+ }], nextPlacement = placements$1[currentIndex + 1];
3238
+ if (nextPlacement)
3239
+ return {
3240
+ data: {
3241
+ index: currentIndex + 1,
3242
+ overflows: allOverflows
3243
+ },
3244
+ reset: {
3245
+ placement: nextPlacement
3246
+ }
3247
+ };
3248
+ const placementsSortedByMostSpace = allOverflows.map((d2) => {
3249
+ const alignment2 = getAlignment(d2.placement);
3250
+ return [d2.placement, alignment2 && crossAxis ? (
3251
+ // Check along the mainAxis and main crossAxis side.
3252
+ d2.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0)
3253
+ ) : (
3254
+ // Check only the mainAxis.
3255
+ d2.overflows[0]
3256
+ ), d2.overflows];
3257
+ }).sort((a, b) => a[1] - b[1]), resetPlacement = ((_placementsThatFitOnE = placementsSortedByMostSpace.filter((d2) => d2[2].slice(
3258
+ 0,
3259
+ // Aligned placements should not check their opposite crossAxis
3260
+ // side.
3261
+ getAlignment(d2[0]) ? 2 : 3
3262
+ ).every((v) => v <= 0))[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
3263
+ return resetPlacement !== placement ? {
3264
+ data: {
3265
+ index: currentIndex + 1,
3266
+ overflows: allOverflows
3267
+ },
3268
+ reset: {
3269
+ placement: resetPlacement
3270
+ }
3271
+ } : {};
3272
+ }
3273
+ };
3274
+ }, flip$2 = function(options) {
3264
3275
  return options === void 0 && (options = {}), {
3265
3276
  name: "flip",
3266
3277
  options,
@@ -3286,7 +3297,7 @@ const arrow$3 = (options) => ({
3286
3297
  return {};
3287
3298
  const side = getSide(placement), initialSideAxis = getSideAxis(initialPlacement), isBasePlacement = getSide(initialPlacement) === initialPlacement, rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)), fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)), hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
3288
3299
  !specifiedFallbackPlacements && hasFallbackAxisSideDirection && fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
3289
- const placements = [initialPlacement, ...fallbackPlacements], overflow = await detectOverflow(state, detectOverflowOptions), overflows = [];
3300
+ const placements2 = [initialPlacement, ...fallbackPlacements], overflow = await detectOverflow(state, detectOverflowOptions), overflows = [];
3290
3301
  let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
3291
3302
  if (checkMainAxis && overflows.push(overflow[side]), checkCrossAxis) {
3292
3303
  const sides2 = getAlignmentSides(placement, rects, rtl);
@@ -3297,21 +3308,19 @@ const arrow$3 = (options) => ({
3297
3308
  overflows
3298
3309
  }], !overflows.every((side2) => side2 <= 0)) {
3299
3310
  var _middlewareData$flip2, _overflowsData$filter;
3300
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1, nextPlacement = placements[nextIndex];
3301
- if (nextPlacement) {
3302
- var _overflowsData$;
3303
- const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : !1, hasInitialMainAxisOverflow = ((_overflowsData$ = overflowsData[0]) == null ? void 0 : _overflowsData$.overflows[0]) > 0;
3304
- if (!ignoreCrossAxisOverflow || hasInitialMainAxisOverflow)
3305
- return {
3306
- data: {
3307
- index: nextIndex,
3308
- overflows: overflowsData
3309
- },
3310
- reset: {
3311
- placement: nextPlacement
3312
- }
3313
- };
3314
- }
3311
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1, nextPlacement = placements2[nextIndex];
3312
+ if (nextPlacement && (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : !1) || // We leave the current main axis only if every placement on that axis
3313
+ // overflows the main axis.
3314
+ overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : !0)))
3315
+ return {
3316
+ data: {
3317
+ index: nextIndex,
3318
+ overflows: overflowsData
3319
+ },
3320
+ reset: {
3321
+ placement: nextPlacement
3322
+ }
3323
+ };
3315
3324
  let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
3316
3325
  if (!resetPlacement)
3317
3326
  switch (fallbackStrategy) {
@@ -3476,13 +3485,13 @@ const inline$2 = function(options) {
3476
3485
  } : {};
3477
3486
  }
3478
3487
  };
3479
- };
3488
+ }, originSides = /* @__PURE__ */ new Set(["left", "top"]);
3480
3489
  async function convertValueToCoords(state, options) {
3481
3490
  const {
3482
3491
  placement,
3483
3492
  platform: platform2,
3484
3493
  elements
3485
- } = state, rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)), side = getSide(placement), alignment = getAlignment(placement), isVertical = getSideAxis(placement) === "y", mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1, crossAxisMulti = rtl && isVertical ? -1 : 1, rawValue = evaluate(options, state);
3494
+ } = state, rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)), side = getSide(placement), alignment = getAlignment(placement), isVertical = getSideAxis(placement) === "y", mainAxisMulti = originSides.has(side) ? -1 : 1, crossAxisMulti = rtl && isVertical ? -1 : 1, rawValue = evaluate(options, state);
3486
3495
  let {
3487
3496
  mainAxis,
3488
3497
  crossAxis,
@@ -3615,7 +3624,7 @@ const offset$3 = function(options) {
3615
3624
  }
3616
3625
  if (checkCrossAxis) {
3617
3626
  var _middlewareData$offse, _middlewareData$offse2;
3618
- const len = mainAxis === "y" ? "width" : "height", isOriginSide = ["top", "left"].includes(getSide(placement)), limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide && ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0) + (isOriginSide ? 0 : computedOffset.crossAxis), limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
3627
+ const len = mainAxis === "y" ? "width" : "height", isOriginSide = originSides.has(getSide(placement)), limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide && ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0) + (isOriginSide ? 0 : computedOffset.crossAxis), limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
3619
3628
  crossAxisCoord < limitMin ? crossAxisCoord = limitMin : crossAxisCoord > limitMax && (crossAxisCoord = limitMax);
3620
3629
  }
3621
3630
  return {
@@ -3665,6 +3674,120 @@ const offset$3 = function(options) {
3665
3674
  }
3666
3675
  };
3667
3676
  };
3677
+ function hasWindow() {
3678
+ return typeof window < "u";
3679
+ }
3680
+ function getNodeName(node) {
3681
+ return isNode$1(node) ? (node.nodeName || "").toLowerCase() : "#document";
3682
+ }
3683
+ function getWindow(node) {
3684
+ var _node$ownerDocument;
3685
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
3686
+ }
3687
+ function getDocumentElement(node) {
3688
+ var _ref;
3689
+ return (_ref = (isNode$1(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
3690
+ }
3691
+ function isNode$1(value) {
3692
+ return hasWindow() ? value instanceof Node || value instanceof getWindow(value).Node : !1;
3693
+ }
3694
+ function isElement(value) {
3695
+ return hasWindow() ? value instanceof Element || value instanceof getWindow(value).Element : !1;
3696
+ }
3697
+ function isHTMLElement(value) {
3698
+ return hasWindow() ? value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement : !1;
3699
+ }
3700
+ function isShadowRoot(value) {
3701
+ return !hasWindow() || typeof ShadowRoot > "u" ? !1 : value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
3702
+ }
3703
+ const invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
3704
+ function isOverflowElement(element) {
3705
+ const {
3706
+ overflow,
3707
+ overflowX,
3708
+ overflowY,
3709
+ display
3710
+ } = getComputedStyle(element);
3711
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
3712
+ }
3713
+ const tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
3714
+ function isTableElement(element) {
3715
+ return tableElements.has(getNodeName(element));
3716
+ }
3717
+ const topLayerSelectors = [":popover-open", ":modal"];
3718
+ function isTopLayer(element) {
3719
+ return topLayerSelectors.some((selector2) => {
3720
+ try {
3721
+ return element.matches(selector2);
3722
+ } catch {
3723
+ return !1;
3724
+ }
3725
+ });
3726
+ }
3727
+ const transformProperties = ["transform", "translate", "scale", "rotate", "perspective"], willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"], containValues = ["paint", "layout", "strict", "content"];
3728
+ function isContainingBlock(elementOrCss) {
3729
+ const webkit = isWebKit(), css2 = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
3730
+ return transformProperties.some((value) => css2[value] ? css2[value] !== "none" : !1) || (css2.containerType ? css2.containerType !== "normal" : !1) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : !1) || !webkit && (css2.filter ? css2.filter !== "none" : !1) || willChangeValues.some((value) => (css2.willChange || "").includes(value)) || containValues.some((value) => (css2.contain || "").includes(value));
3731
+ }
3732
+ function getContainingBlock(element) {
3733
+ let currentNode = getParentNode(element);
3734
+ for (; isHTMLElement(currentNode) && !isLastTraversableNode(currentNode); ) {
3735
+ if (isContainingBlock(currentNode))
3736
+ return currentNode;
3737
+ if (isTopLayer(currentNode))
3738
+ return null;
3739
+ currentNode = getParentNode(currentNode);
3740
+ }
3741
+ return null;
3742
+ }
3743
+ function isWebKit() {
3744
+ return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
3745
+ }
3746
+ const lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
3747
+ function isLastTraversableNode(node) {
3748
+ return lastTraversableNodeNames.has(getNodeName(node));
3749
+ }
3750
+ function getComputedStyle(element) {
3751
+ return getWindow(element).getComputedStyle(element);
3752
+ }
3753
+ function getNodeScroll(element) {
3754
+ return isElement(element) ? {
3755
+ scrollLeft: element.scrollLeft,
3756
+ scrollTop: element.scrollTop
3757
+ } : {
3758
+ scrollLeft: element.scrollX,
3759
+ scrollTop: element.scrollY
3760
+ };
3761
+ }
3762
+ function getParentNode(node) {
3763
+ if (getNodeName(node) === "html")
3764
+ return node;
3765
+ const result = (
3766
+ // Step into the shadow DOM of the parent of a slotted node.
3767
+ node.assignedSlot || // DOM Element detected.
3768
+ node.parentNode || // ShadowRoot detected.
3769
+ isShadowRoot(node) && node.host || // Fallback.
3770
+ getDocumentElement(node)
3771
+ );
3772
+ return isShadowRoot(result) ? result.host : result;
3773
+ }
3774
+ function getNearestOverflowAncestor(node) {
3775
+ const parentNode = getParentNode(node);
3776
+ return isLastTraversableNode(parentNode) ? node.ownerDocument ? node.ownerDocument.body : node.body : isHTMLElement(parentNode) && isOverflowElement(parentNode) ? parentNode : getNearestOverflowAncestor(parentNode);
3777
+ }
3778
+ function getOverflowAncestors(node, list, traverseIframes) {
3779
+ var _node$ownerDocument2;
3780
+ list === void 0 && (list = []), traverseIframes === void 0 && (traverseIframes = !0);
3781
+ const scrollableAncestor = getNearestOverflowAncestor(node), isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body), win2 = getWindow(scrollableAncestor);
3782
+ if (isBody) {
3783
+ const frameElement = getFrameElement(win2);
3784
+ return list.concat(win2, win2.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
3785
+ }
3786
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
3787
+ }
3788
+ function getFrameElement(win2) {
3789
+ return win2.parent && Object.getPrototypeOf(win2.parent) ? win2.frameElement : null;
3790
+ }
3668
3791
  function getCssDimensions(element) {
3669
3792
  const css2 = getComputedStyle(element);
3670
3793
  let width = parseFloat(css2.width) || 0, height = parseFloat(css2.height) || 0;
@@ -3797,6 +3920,7 @@ function getViewportRect(element, strategy) {
3797
3920
  y: y2
3798
3921
  };
3799
3922
  }
3923
+ const absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
3800
3924
  function getInnerBoundingClientRect(element, strategy) {
3801
3925
  const clientRect = getBoundingClientRect(element, !0, strategy === "fixed"), top = clientRect.top + element.clientTop, left = clientRect.left + element.clientLeft, scale2 = isHTMLElement(element) ? getScale(element) : createCoords(1), width = element.clientWidth * scale2.x, height = element.clientHeight * scale2.y, x = left * scale2.x, y2 = top * scale2.y;
3802
3926
  return {
@@ -3838,7 +3962,7 @@ function getClippingElementAncestors(element, cache) {
3838
3962
  let currentNode = elementIsFixed ? getParentNode(element) : element;
3839
3963
  for (; isElement(currentNode) && !isLastTraversableNode(currentNode); ) {
3840
3964
  const computedStyle = getComputedStyle(currentNode), currentNodeIsContaining = isContainingBlock(currentNode);
3841
- !currentNodeIsContaining && computedStyle.position === "fixed" && (currentContainingBlockComputedStyle = null), (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) ? result = result.filter((ancestor) => ancestor !== currentNode) : currentContainingBlockComputedStyle = computedStyle, currentNode = getParentNode(currentNode);
3965
+ !currentNodeIsContaining && computedStyle.position === "fixed" && (currentContainingBlockComputedStyle = null), (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) ? result = result.filter((ancestor) => ancestor !== currentNode) : currentContainingBlockComputedStyle = computedStyle, currentNode = getParentNode(currentNode);
3842
3966
  }
3843
3967
  return cache.set(element, result), result;
3844
3968
  }
@@ -4035,7 +4159,7 @@ function autoUpdate(reference, floating, update, options) {
4035
4159
  }), cleanupIo?.(), (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(), resizeObserver = null, animationFrame && cancelAnimationFrame(frameId);
4036
4160
  };
4037
4161
  }
4038
- const offset$2 = offset$3, shift$1 = shift$2, flip$1 = flip$2, size$1 = size$2, hide$1 = hide$2, arrow$2 = arrow$3, inline$1 = inline$2, limitShift$1 = limitShift$2, computePosition = (reference, floating, options) => {
4162
+ const offset$2 = offset$3, autoPlacement = autoPlacement$1, shift$1 = shift$2, flip$1 = flip$2, size$1 = size$2, hide$1 = hide$2, arrow$2 = arrow$3, inline$1 = inline$2, limitShift$1 = limitShift$2, computePosition = (reference, floating, options) => {
4039
4163
  const cache = /* @__PURE__ */ new Map(), mergedOptions = {
4040
4164
  platform,
4041
4165
  ...options
@@ -4407,7 +4531,7 @@ function useHover(context2, props) {
4407
4531
  }
4408
4532
  })(event));
4409
4533
  }
4410
- if (isElement(elements.domReference)) {
4534
+ if (isElement$1(elements.domReference)) {
4411
4535
  var _elements$floating;
4412
4536
  const ref = elements.domReference;
4413
4537
  return open && ref.addEventListener("mouseleave", onScrollMouseLeave), (_elements$floating = elements.floating) == null || _elements$floating.addEventListener("mouseleave", onScrollMouseLeave), move && ref.addEventListener("mousemove", onMouseEnter, {
@@ -4422,7 +4546,7 @@ function useHover(context2, props) {
4422
4546
  if (enabled && open && (_handleCloseRef$curre = handleCloseRef.current) != null && _handleCloseRef$curre.__options.blockPointerEvents && isHoverOpen()) {
4423
4547
  performedPointerEventsMutationRef.current = !0;
4424
4548
  const floatingEl = elements.floating;
4425
- if (isElement(elements.domReference) && floatingEl) {
4549
+ if (isElement$1(elements.domReference) && floatingEl) {
4426
4550
  var _tree$nodesRef$curren;
4427
4551
  const body2 = getDocument(elements.floating).body;
4428
4552
  body2.setAttribute(safePolygonIdentifier, "");
@@ -4638,22 +4762,22 @@ function useDismiss(context2, props) {
4638
4762
  if (endedOrStartedInsideRef.current = !1, outsidePressEvent === "click" && endedOrStartedInside || insideReactTree || typeof outsidePress == "function" && !outsidePress(event))
4639
4763
  return;
4640
4764
  const target = getTarget(event), inertSelector = "[" + createAttribute("inert") + "]", markers = getDocument(elements.floating).querySelectorAll(inertSelector);
4641
- let targetRootAncestor = isElement(target) ? target : null;
4642
- for (; targetRootAncestor && !isLastTraversableNode(targetRootAncestor); ) {
4643
- const nextParent = getParentNode(targetRootAncestor);
4644
- if (isLastTraversableNode(nextParent) || !isElement(nextParent))
4765
+ let targetRootAncestor = isElement$1(target) ? target : null;
4766
+ for (; targetRootAncestor && !isLastTraversableNode$1(targetRootAncestor); ) {
4767
+ const nextParent = getParentNode$1(targetRootAncestor);
4768
+ if (isLastTraversableNode$1(nextParent) || !isElement$1(nextParent))
4645
4769
  break;
4646
4770
  targetRootAncestor = nextParent;
4647
4771
  }
4648
- if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
4772
+ if (markers.length && isElement$1(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
4649
4773
  !contains(target, elements.floating) && // If the target root element contains none of the markers, then the
4650
4774
  // element was injected after the floating element rendered.
4651
4775
  Array.from(markers).every((marker) => !contains(targetRootAncestor, marker)))
4652
4776
  return;
4653
- if (isHTMLElement(target) && floating) {
4777
+ if (isHTMLElement$1(target) && floating) {
4654
4778
  const canScrollX = target.clientWidth > 0 && target.scrollWidth > target.clientWidth, canScrollY = target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
4655
4779
  let xCond = canScrollY && event.offsetX > target.clientWidth;
4656
- if (canScrollY && getComputedStyle(target).direction === "rtl" && (xCond = event.offsetX <= target.offsetWidth - target.clientWidth), xCond || canScrollX && event.offsetY > target.clientHeight)
4780
+ if (canScrollY && getComputedStyle$1(target).direction === "rtl" && (xCond = event.offsetX <= target.offsetWidth - target.clientWidth), xCond || canScrollX && event.offsetY > target.clientHeight)
4657
4781
  return;
4658
4782
  }
4659
4783
  const nodeId = (_dataRef$current$floa2 = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa2.nodeId, targetIsInsideChildren = tree && getChildren$1(tree.nodesRef.current, nodeId).some((node) => {
@@ -4701,13 +4825,13 @@ function useDismiss(context2, props) {
4701
4825
  },
4702
4826
  // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
4703
4827
  // Only apply to WebKit for the test to remain 0ms.
4704
- isWebKit() ? 5 : 0
4828
+ isWebKit$1() ? 5 : 0
4705
4829
  );
4706
4830
  }
4707
4831
  const doc = getDocument(elements.floating);
4708
4832
  escapeKey && (doc.addEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture), doc.addEventListener("compositionstart", handleCompositionStart), doc.addEventListener("compositionend", handleCompositionEnd)), outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
4709
4833
  let ancestors = [];
4710
- return ancestorScroll && (isElement(elements.domReference) && (ancestors = getOverflowAncestors(elements.domReference)), isElement(elements.floating) && (ancestors = ancestors.concat(getOverflowAncestors(elements.floating))), !isElement(elements.reference) && elements.reference && elements.reference.contextElement && (ancestors = ancestors.concat(getOverflowAncestors(elements.reference.contextElement)))), ancestors = ancestors.filter((ancestor) => {
4834
+ return ancestorScroll && (isElement$1(elements.domReference) && (ancestors = getOverflowAncestors(elements.domReference)), isElement$1(elements.floating) && (ancestors = ancestors.concat(getOverflowAncestors(elements.floating))), !isElement$1(elements.reference) && elements.reference && elements.reference.contextElement && (ancestors = ancestors.concat(getOverflowAncestors(elements.reference.contextElement)))), ancestors = ancestors.filter((ancestor) => {
4711
4835
  var _doc$defaultView;
4712
4836
  return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport);
4713
4837
  }), ancestors.forEach((ancestor) => {
@@ -4797,16 +4921,16 @@ function useFloating(options) {
4797
4921
  }
4798
4922
  }
4799
4923
  }), setPositionReference = React.useCallback((node) => {
4800
- const computedPositionReference = isElement(node) ? {
4924
+ const computedPositionReference = isElement$1(node) ? {
4801
4925
  getBoundingClientRect: () => node.getBoundingClientRect(),
4802
4926
  contextElement: node
4803
4927
  } : node;
4804
4928
  _setPositionReference(computedPositionReference), position.refs.setReference(computedPositionReference);
4805
4929
  }, [position.refs]), setReference = React.useCallback((node) => {
4806
- (isElement(node) || node === null) && (domReferenceRef.current = node, setDomReference(node)), (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
4930
+ (isElement$1(node) || node === null) && (domReferenceRef.current = node, setDomReference(node)), (isElement$1(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
4807
4931
  // `null` to support `positionReference` + an unstable `reference`
4808
4932
  // callback ref.
4809
- node !== null && !isElement(node)) && position.refs.setReference(node);
4933
+ node !== null && !isElement$1(node)) && position.refs.setReference(node);
4810
4934
  }, [position.refs]), refs = React.useMemo(() => ({
4811
4935
  ...position.refs,
4812
4936
  setReference,
@@ -4847,9 +4971,9 @@ function useFocus(context2, props) {
4847
4971
  } = props, blockFocusRef = React.useRef(!1), timeoutRef = React.useRef(), keyboardModalityRef = React.useRef(!0);
4848
4972
  React.useEffect(() => {
4849
4973
  if (!enabled) return;
4850
- const win2 = getWindow(elements.domReference);
4974
+ const win2 = getWindow$1(elements.domReference);
4851
4975
  function onBlur() {
4852
- !open && isHTMLElement(elements.domReference) && elements.domReference === activeElement(getDocument(elements.domReference)) && (blockFocusRef.current = !0);
4976
+ !open && isHTMLElement$1(elements.domReference) && elements.domReference === activeElement(getDocument(elements.domReference)) && (blockFocusRef.current = !0);
4853
4977
  }
4854
4978
  function onKeyDown() {
4855
4979
  keyboardModalityRef.current = !0;
@@ -4881,7 +5005,7 @@ function useFocus(context2, props) {
4881
5005
  onFocus(event) {
4882
5006
  if (blockFocusRef.current) return;
4883
5007
  const target = getTarget(event.nativeEvent);
4884
- if (visibleOnly && isElement(target))
5008
+ if (visibleOnly && isElement$1(target))
4885
5009
  try {
4886
5010
  if (isSafari() && isMac()) throw Error();
4887
5011
  if (!target.matches(":focus-visible")) return;
@@ -4893,7 +5017,7 @@ function useFocus(context2, props) {
4893
5017
  },
4894
5018
  onBlur(event) {
4895
5019
  blockFocusRef.current = !1;
4896
- const relatedTarget = event.relatedTarget, nativeEvent = event.nativeEvent, movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
5020
+ const relatedTarget = event.relatedTarget, nativeEvent = event.nativeEvent, movedToFocusGuard = isElement$1(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
4897
5021
  timeoutRef.current = window.setTimeout(() => {
4898
5022
  var _dataRef$current$floa;
4899
5023
  const activeEl = activeElement(elements.domReference ? elements.domReference.ownerDocument : document);
@@ -5575,7 +5699,7 @@ function FocusTrap({
5575
5699
  innerRef
5576
5700
  }) {
5577
5701
  const focusTrapRef = useFocusTrap(active), ref = useMergedRef(focusTrapRef, innerRef);
5578
- return isElement$1(children2) ? cloneElement(children2, { [refProp]: ref }) : children2;
5702
+ return isElement$2(children2) ? cloneElement(children2, { [refProp]: ref }) : children2;
5579
5703
  }
5580
5704
  function FocusTrapInitialFocus(props) {
5581
5705
  return /* @__PURE__ */ jsx(VisuallyHidden, { tabIndex: -1, "data-autofocus": !0, ...props });
@@ -5688,7 +5812,7 @@ const defaultProps$h = {
5688
5812
  defaultProps$h,
5689
5813
  props
5690
5814
  );
5691
- if (!isElement$1(children2))
5815
+ if (!isElement$2(children2))
5692
5816
  throw new Error(
5693
5817
  "Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
5694
5818
  );
@@ -6082,8 +6206,8 @@ Loader.displayName = "@mantine/core/Loader";
6082
6206
  var classes$c = { root: "m_8d3f4000", icon: "m_8d3afb97", loader: "m_302b9fb1", group: "m_1a0f1b21", groupSection: "m_437b6484" };
6083
6207
  const defaultProps$e = {
6084
6208
  orientation: "horizontal"
6085
- }, varsResolver$f = (_, { borderWidth: borderWidth2 }) => ({
6086
- group: { "--ai-border-width": rem(borderWidth2) }
6209
+ }, varsResolver$f = (_, { borderWidth }) => ({
6210
+ group: { "--ai-border-width": rem(borderWidth) }
6087
6211
  }), ActionIconGroup = factory((_props, ref) => {
6088
6212
  const props = useProps("ActionIconGroup", defaultProps$e, _props), {
6089
6213
  className,
@@ -6093,7 +6217,7 @@ const defaultProps$e = {
6093
6217
  unstyled,
6094
6218
  orientation,
6095
6219
  vars,
6096
- borderWidth: borderWidth2,
6220
+ borderWidth,
6097
6221
  variant,
6098
6222
  mod,
6099
6223
  attributes,
@@ -6625,8 +6749,8 @@ function CheckIcon({ size: size2, style: style2, ...others }) {
6625
6749
  var classes$7 = { root: "m_77c9d27d", inner: "m_80f1301b", label: "m_811560b9", section: "m_a74036a", loader: "m_a25b86ee", group: "m_80d6d844", groupSection: "m_70be2a01" };
6626
6750
  const defaultProps$b = {
6627
6751
  orientation: "horizontal"
6628
- }, varsResolver$9 = (_, { borderWidth: borderWidth2 }) => ({
6629
- group: { "--button-border-width": rem(borderWidth2) }
6752
+ }, varsResolver$9 = (_, { borderWidth }) => ({
6753
+ group: { "--button-border-width": rem(borderWidth) }
6630
6754
  }), ButtonGroup = factory((_props, ref) => {
6631
6755
  const props = useProps("ButtonGroup", defaultProps$b, _props), {
6632
6756
  className,
@@ -6636,7 +6760,7 @@ const defaultProps$b = {
6636
6760
  unstyled,
6637
6761
  orientation,
6638
6762
  vars,
6639
- borderWidth: borderWidth2,
6763
+ borderWidth,
6640
6764
  variant,
6641
6765
  mod,
6642
6766
  attributes,
@@ -7177,7 +7301,7 @@ const MenuSubItem = polymorphicFactory((props, ref) => {
7177
7301
  MenuSubItem.classes = classes$4;
7178
7302
  MenuSubItem.displayName = "@mantine/core/MenuSubItem";
7179
7303
  function MenuSubTarget({ children: children2, refProp }) {
7180
- if (!isElement$1(children2))
7304
+ if (!isElement$2(children2))
7181
7305
  throw new Error(
7182
7306
  "Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
7183
7307
  );
@@ -7230,7 +7354,7 @@ const defaultProps$7 = {
7230
7354
  refProp: "ref"
7231
7355
  }, MenuTarget = forwardRef((props, ref) => {
7232
7356
  const { children: children2, refProp, ...others } = useProps("MenuTarget", defaultProps$7, props);
7233
- if (!isElement$1(children2))
7357
+ if (!isElement$2(children2))
7234
7358
  throw new Error(
7235
7359
  "Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"
7236
7360
  );
@@ -7471,7 +7595,7 @@ const defaultProps$5 = {
7471
7595
  position,
7472
7596
  defaultOpened
7473
7597
  });
7474
- if (!isElement$1(children2))
7598
+ if (!isElement$2(children2))
7475
7599
  throw new Error(
7476
7600
  "[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported"
7477
7601
  );
@@ -7697,7 +7821,7 @@ const defaultProps$3 = {
7697
7821
  vars,
7698
7822
  varsResolver: varsResolver$3
7699
7823
  });
7700
- if (!target && !isElement$1(children2))
7824
+ if (!target && !isElement$2(children2))
7701
7825
  return null;
7702
7826
  if (target) {
7703
7827
  const transition2 = getTransitionProps(transitionProps, { duration: 100, transition: "fade" });
@@ -9897,12 +10021,12 @@ function* selection_iterator() {
9897
10021
  for (var group = groups[j], i2 = 0, n2 = group.length, node; i2 < n2; ++i2)
9898
10022
  (node = group[i2]) && (yield node);
9899
10023
  }
9900
- var root$1 = [null];
10024
+ var root = [null];
9901
10025
  function Selection$1(groups, parents) {
9902
10026
  this._groups = groups, this._parents = parents;
9903
10027
  }
9904
10028
  function selection() {
9905
- return new Selection$1([[document.documentElement]], root$1);
10029
+ return new Selection$1([[document.documentElement]], root);
9906
10030
  }
9907
10031
  function selection_selection() {
9908
10032
  return this;
@@ -9946,7 +10070,7 @@ Selection$1.prototype = selection.prototype = {
9946
10070
  [Symbol.iterator]: selection_iterator
9947
10071
  };
9948
10072
  function select(selector2) {
9949
- return typeof selector2 == "string" ? new Selection$1([[document.querySelector(selector2)]], [document.documentElement]) : new Selection$1([[selector2]], root$1);
10073
+ return typeof selector2 == "string" ? new Selection$1([[document.querySelector(selector2)]], [document.documentElement]) : new Selection$1([[selector2]], root);
9950
10074
  }
9951
10075
  function sourceEvent(event) {
9952
10076
  let sourceEvent2;
@@ -10458,11 +10582,47 @@ const interpolateRgb = function rgbGamma(y2) {
10458
10582
  }
10459
10583
  return rgb$1.gamma = rgbGamma, rgb$1;
10460
10584
  }(1);
10585
+ function numberArray(a, b) {
10586
+ b || (b = []);
10587
+ var n2 = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i2;
10588
+ return function(t2) {
10589
+ for (i2 = 0; i2 < n2; ++i2) c[i2] = a[i2] * (1 - t2) + b[i2] * t2;
10590
+ return c;
10591
+ };
10592
+ }
10593
+ function isNumberArray(x) {
10594
+ return ArrayBuffer.isView(x) && !(x instanceof DataView);
10595
+ }
10596
+ function genericArray(a, b) {
10597
+ var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i2;
10598
+ for (i2 = 0; i2 < na; ++i2) x[i2] = interpolate$1(a[i2], b[i2]);
10599
+ for (; i2 < nb; ++i2) c[i2] = b[i2];
10600
+ return function(t2) {
10601
+ for (i2 = 0; i2 < na; ++i2) c[i2] = x[i2](t2);
10602
+ return c;
10603
+ };
10604
+ }
10605
+ function date(a, b) {
10606
+ var d2 = /* @__PURE__ */ new Date();
10607
+ return a = +a, b = +b, function(t2) {
10608
+ return d2.setTime(a * (1 - t2) + b * t2), d2;
10609
+ };
10610
+ }
10461
10611
  function interpolateNumber(a, b) {
10462
10612
  return a = +a, b = +b, function(t2) {
10463
10613
  return a * (1 - t2) + b * t2;
10464
10614
  };
10465
10615
  }
10616
+ function object(a, b) {
10617
+ var i2 = {}, c = {}, k;
10618
+ (a === null || typeof a != "object") && (a = {}), (b === null || typeof b != "object") && (b = {});
10619
+ for (k in b)
10620
+ k in a ? i2[k] = interpolate$1(a[k], b[k]) : c[k] = b[k];
10621
+ return function(t2) {
10622
+ for (k in i2) c[k] = i2[k](t2);
10623
+ return c;
10624
+ };
10625
+ }
10466
10626
  var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g");
10467
10627
  function zero(b) {
10468
10628
  return function() {
@@ -10483,6 +10643,10 @@ function interpolateString(a, b) {
10483
10643
  return s2.join("");
10484
10644
  });
10485
10645
  }
10646
+ function interpolate$1(a, b) {
10647
+ var t2 = typeof b, c;
10648
+ return b == null || t2 === "boolean" ? constant$1(b) : (t2 === "number" ? interpolateNumber : t2 === "string" ? (c = color(b)) ? (b = c, interpolateRgb) : interpolateString : b instanceof color ? interpolateRgb : b instanceof Date ? date : isNumberArray(b) ? numberArray : Array.isArray(b) ? genericArray : typeof b.valueOf != "function" && typeof b.toString != "function" || isNaN(b) ? object : interpolateNumber)(a, b);
10649
+ }
10486
10650
  var degrees = 180 / Math.PI, identity$2 = {
10487
10651
  translateX: 0,
10488
10652
  translateY: 0,
@@ -11463,7 +11627,22 @@ const errorMessages = {
11463
11627
  }, infiniteExtent = [
11464
11628
  [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],
11465
11629
  [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]
11466
- ], elementSelectionKeys = ["Enter", " ", "Escape"];
11630
+ ], elementSelectionKeys = ["Enter", " ", "Escape"], defaultAriaLabelConfig = {
11631
+ "node.a11yDescription.default": "Press enter or space to select a node. Press delete to remove it and escape to cancel.",
11632
+ "node.a11yDescription.keyboardDisabled": "Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.",
11633
+ "node.a11yDescription.ariaLiveMessage": ({ direction, x, y: y2 }) => `Moved selected node ${direction}. New position, x: ${x}, y: ${y2}`,
11634
+ "edge.a11yDescription.default": "Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.",
11635
+ // Control elements
11636
+ "controls.ariaLabel": "Control Panel",
11637
+ "controls.zoomIn.ariaLabel": "Zoom In",
11638
+ "controls.zoomOut.ariaLabel": "Zoom Out",
11639
+ "controls.fitView.ariaLabel": "Fit View",
11640
+ "controls.interactive.ariaLabel": "Toggle Interactivity",
11641
+ // Mini map
11642
+ "minimap.ariaLabel": "Mini Map",
11643
+ // Handle
11644
+ "handle.ariaLabel": "Handle"
11645
+ };
11467
11646
  var ConnectionMode;
11468
11647
  (function(ConnectionMode2) {
11469
11648
  ConnectionMode2.Strict = "strict", ConnectionMode2.Loose = "loose";
@@ -11566,11 +11745,15 @@ async function fitViewport({ nodes, width, height, panZoom, minZoom, maxZoom },
11566
11745
  if (nodes.size === 0)
11567
11746
  return Promise.resolve(!0);
11568
11747
  const nodesToFit = getFitViewNodes(nodes, options), bounds = getInternalNodesBounds(nodesToFit), viewport = getViewportForBounds(bounds, width, height, options?.minZoom ?? minZoom, options?.maxZoom ?? maxZoom, options?.padding ?? 0.1);
11569
- return await panZoom.setViewport(viewport, { duration: options?.duration }), Promise.resolve(!0);
11748
+ return await panZoom.setViewport(viewport, {
11749
+ duration: options?.duration,
11750
+ ease: options?.ease,
11751
+ interpolate: options?.interpolate
11752
+ }), Promise.resolve(!0);
11570
11753
  }
11571
11754
  function calculateNodePosition({ nodeId, nextPosition, nodeLookup, nodeOrigin = [0, 0], nodeExtent, onError }) {
11572
11755
  const node = nodeLookup.get(nodeId), parentNode = node.parentId ? nodeLookup.get(node.parentId) : void 0, { x: parentX, y: parentY } = parentNode ? parentNode.internals.positionAbsolute : { x: 0, y: 0 }, origin = node.origin ?? nodeOrigin;
11573
- let extent = nodeExtent;
11756
+ let extent = node.extent || nodeExtent;
11574
11757
  if (node.extent === "parent" && !node.expandParent)
11575
11758
  if (!parentNode)
11576
11759
  onError?.("005", errorMessages.error005());
@@ -11767,6 +11950,9 @@ function withResolvers() {
11767
11950
  resolve = res, reject = rej;
11768
11951
  }), resolve, reject };
11769
11952
  }
11953
+ function mergeAriaLabelConfig(partial) {
11954
+ return { ...defaultAriaLabelConfig, ...partial || {} };
11955
+ }
11770
11956
  function getPointerPosition(event, { snapGrid = [0, 0], snapToGrid = !1, transform: transform2, containerBounds }) {
11771
11957
  const { x, y: y2 } = getEventPosition(event), pointerPos = pointToRendererPoint({ x: x - (containerBounds?.left ?? 0), y: y2 - (containerBounds?.top ?? 0) }, transform2), { x: xSnapped, y: ySnapped } = snapToGrid ? snapPosition(pointerPos, snapGrid) : pointerPos;
11772
11958
  return {
@@ -11860,11 +12046,11 @@ function getEdgeCenter({ sourceX, sourceY, targetX, targetY }) {
11860
12046
  const xOffset = Math.abs(targetX - sourceX) / 2, centerX = targetX < sourceX ? targetX + xOffset : targetX - xOffset, yOffset = Math.abs(targetY - sourceY) / 2, centerY = targetY < sourceY ? targetY + yOffset : targetY - yOffset;
11861
12047
  return [centerX, centerY, xOffset, yOffset];
11862
12048
  }
11863
- function getElevatedEdgeZIndex({ sourceNode, targetNode, selected: selected2 = !1, zIndex = 0, elevateOnSelect = !1 }) {
11864
- if (!elevateOnSelect)
12049
+ function getElevatedEdgeZIndex({ sourceNode, targetNode, selected: selected2 = !1, zIndex, elevateOnSelect = !1 }) {
12050
+ if (zIndex !== void 0)
11865
12051
  return zIndex;
11866
- const edgeOrConnectedNodeSelected = selected2 || targetNode.selected || sourceNode.selected, selectedZIndex = Math.max(sourceNode.internals.z || 0, targetNode.internals.z || 0, 1e3);
11867
- return zIndex + (edgeOrConnectedNodeSelected ? selectedZIndex : 0);
12052
+ const edgeZ = elevateOnSelect && selected2 ? 1e3 : 0, nodeZ = Math.max(sourceNode.parentId ? sourceNode.internals.z : 0, targetNode.parentId ? targetNode.internals.z : 0);
12053
+ return edgeZ + nodeZ;
11868
12054
  }
11869
12055
  function isEdgeVisible({ sourceNode, targetNode, width, height, transform: transform2 }) {
11870
12056
  const edgeBox = getBoundsOfBoxes(nodeToBox(sourceNode), nodeToBox(targetNode));
@@ -11901,21 +12087,21 @@ const handleDirections = {
11901
12087
  [Position.Top]: { x: 0, y: -1 },
11902
12088
  [Position.Bottom]: { x: 0, y: 1 }
11903
12089
  }, getDirection = ({ source, sourcePosition = Position.Bottom, target }) => sourcePosition === Position.Left || sourcePosition === Position.Right ? source.x < target.x ? { x: 1, y: 0 } : { x: -1, y: 0 } : source.y < target.y ? { x: 0, y: 1 } : { x: 0, y: -1 }, distance = (a, b) => Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));
11904
- function getPoints({ source, sourcePosition = Position.Bottom, target, targetPosition = Position.Top, center, offset: offset2 }) {
12090
+ function getPoints({ source, sourcePosition = Position.Bottom, target, targetPosition = Position.Top, center, offset: offset2, stepPosition }) {
11905
12091
  const sourceDir = handleDirections[sourcePosition], targetDir = handleDirections[targetPosition], sourceGapped = { x: source.x + sourceDir.x * offset2, y: source.y + sourceDir.y * offset2 }, targetGapped = { x: target.x + targetDir.x * offset2, y: target.y + targetDir.y * offset2 }, dir = getDirection({
11906
12092
  source: sourceGapped,
11907
12093
  sourcePosition,
11908
12094
  target: targetGapped
11909
12095
  }), dirAccessor = dir.x !== 0 ? "x" : "y", currDir = dir[dirAccessor];
11910
12096
  let points = [], centerX, centerY;
11911
- const sourceGapOffset = { x: 0, y: 0 }, targetGapOffset = { x: 0, y: 0 }, [defaultCenterX, defaultCenterY, defaultOffsetX, defaultOffsetY] = getEdgeCenter({
12097
+ const sourceGapOffset = { x: 0, y: 0 }, targetGapOffset = { x: 0, y: 0 }, [, , defaultOffsetX, defaultOffsetY] = getEdgeCenter({
11912
12098
  sourceX: source.x,
11913
12099
  sourceY: source.y,
11914
12100
  targetX: target.x,
11915
12101
  targetY: target.y
11916
12102
  });
11917
12103
  if (sourceDir[dirAccessor] * targetDir[dirAccessor] === -1) {
11918
- centerX = center.x ?? defaultCenterX, centerY = center.y ?? defaultCenterY;
12104
+ dirAccessor === "x" ? (centerX = center.x ?? sourceGapped.x + (targetGapped.x - sourceGapped.x) * stepPosition, centerY = center.y ?? (sourceGapped.y + targetGapped.y) / 2) : (centerX = center.x ?? (sourceGapped.x + targetGapped.x) / 2, centerY = center.y ?? sourceGapped.y + (targetGapped.y - sourceGapped.y) * stepPosition);
11919
12105
  const verticalSplit = [
11920
12106
  { x: centerX, y: sourceGapped.y },
11921
12107
  { x: centerX, y: targetGapped.y }
@@ -11959,14 +12145,15 @@ function getBend(a, b, c, size2) {
11959
12145
  const xDir = a.x < c.x ? 1 : -1, yDir = a.y < c.y ? -1 : 1;
11960
12146
  return `L ${x},${y2 + bendSize * yDir}Q ${x},${y2} ${x + bendSize * xDir},${y2}`;
11961
12147
  }
11962
- function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, borderRadius: borderRadius2 = 5, centerX, centerY, offset: offset2 = 20 }) {
12148
+ function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, borderRadius: borderRadius2 = 5, centerX, centerY, offset: offset2 = 20, stepPosition = 0.5 }) {
11963
12149
  const [points, labelX, labelY, offsetX, offsetY] = getPoints({
11964
12150
  source: { x: sourceX, y: sourceY },
11965
12151
  sourcePosition,
11966
12152
  target: { x: targetX, y: targetY },
11967
12153
  targetPosition,
11968
12154
  center: { x: centerX, y: centerY },
11969
- offset: offset2
12155
+ offset: offset2,
12156
+ stepPosition
11970
12157
  });
11971
12158
  return [points.reduce((res, p, i2) => {
11972
12159
  let segment = "";
@@ -12158,7 +12345,7 @@ function calculateChildXYZ(childNode, parentNode, nodeOrigin, nodeExtent, select
12158
12345
  return {
12159
12346
  x: absolutePosition.x,
12160
12347
  y: absolutePosition.y,
12161
- z: parentZ > childZ ? parentZ : childZ
12348
+ z: parentZ >= childZ ? parentZ + 1 : childZ
12162
12349
  };
12163
12350
  }
12164
12351
  function handleExpandParent(children2, nodeLookup, parentLookup, nodeOrigin = [0, 0]) {
@@ -12350,28 +12537,43 @@ function getEventHandlerParams({ nodeId, dragItems, nodeLookup, dragging = !0 })
12350
12537
  nodesFromDragItems
12351
12538
  ];
12352
12539
  }
12540
+ function calculateSnapOffset({ dragItems, snapGrid, x, y: y2 }) {
12541
+ const refDragItem = dragItems.values().next().value;
12542
+ if (!refDragItem)
12543
+ return null;
12544
+ const refPos = {
12545
+ x: x - refDragItem.distance.x,
12546
+ y: y2 - refDragItem.distance.y
12547
+ }, refPosSnapped = snapPosition(refPos, snapGrid);
12548
+ return {
12549
+ x: refPosSnapped.x - refPos.x,
12550
+ y: refPosSnapped.y - refPos.y
12551
+ };
12552
+ }
12353
12553
  function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragStop }) {
12354
- let lastPos = { x: null, y: null }, autoPanId = 0, dragItems = /* @__PURE__ */ new Map(), autoPanStarted = !1, mousePosition = { x: 0, y: 0 }, containerBounds = null, dragStarted = !1, d3Selection = null, abortDrag = !1;
12554
+ let lastPos = { x: null, y: null }, autoPanId = 0, dragItems = /* @__PURE__ */ new Map(), autoPanStarted = !1, mousePosition = { x: 0, y: 0 }, containerBounds = null, dragStarted = !1, d3Selection = null, abortDrag = !1, nodePositionsChanged = !1, dragEvent = null;
12355
12555
  function update({ noDragClassName, handleSelector, domNode, isSelectable, nodeId, nodeClickDistance = 0 }) {
12356
12556
  d3Selection = select(domNode);
12357
- function updateNodes({ x, y: y2 }, dragEvent) {
12557
+ function updateNodes({ x, y: y2 }) {
12358
12558
  const { nodeLookup, nodeExtent, snapGrid, snapToGrid, nodeOrigin, onNodeDrag, onSelectionDrag, onError, updateNodePositions } = getStoreItems();
12359
12559
  lastPos = { x, y: y2 };
12360
- let hasChange = !1, nodesBox = { x: 0, y: 0, x2: 0, y2: 0 };
12361
- if (dragItems.size > 1 && nodeExtent) {
12362
- const rect = getInternalNodesBounds(dragItems);
12363
- nodesBox = rectToBox(rect);
12364
- }
12560
+ let hasChange = !1;
12561
+ const isMultiDrag = dragItems.size > 1, nodesBox = isMultiDrag && nodeExtent ? rectToBox(getInternalNodesBounds(dragItems)) : null, multiDragSnapOffset = isMultiDrag && snapToGrid ? calculateSnapOffset({
12562
+ dragItems,
12563
+ snapGrid,
12564
+ x,
12565
+ y: y2
12566
+ }) : null;
12365
12567
  for (const [id2, dragItem] of dragItems) {
12366
12568
  if (!nodeLookup.has(id2))
12367
12569
  continue;
12368
12570
  let nextPosition = { x: x - dragItem.distance.x, y: y2 - dragItem.distance.y };
12369
- snapToGrid && (nextPosition = snapPosition(nextPosition, snapGrid));
12370
- let adjustedNodeExtent = [
12371
- [nodeExtent[0][0], nodeExtent[0][1]],
12372
- [nodeExtent[1][0], nodeExtent[1][1]]
12373
- ];
12374
- if (dragItems.size > 1 && nodeExtent && !dragItem.extent) {
12571
+ snapToGrid && (nextPosition = multiDragSnapOffset ? {
12572
+ x: nextPosition.x + multiDragSnapOffset.x,
12573
+ y: nextPosition.y + multiDragSnapOffset.y
12574
+ } : snapPosition(nextPosition, snapGrid));
12575
+ let adjustedNodeExtent = null;
12576
+ if (isMultiDrag && nodeExtent && !dragItem.extent && nodesBox) {
12375
12577
  const { positionAbsolute: positionAbsolute2 } = dragItem.internals, x1 = positionAbsolute2.x - nodesBox.x + nodeExtent[0][0], x2 = positionAbsolute2.x + dragItem.measured.width - nodesBox.x2 + nodeExtent[1][0], y1 = positionAbsolute2.y - nodesBox.y + nodeExtent[0][1], y22 = positionAbsolute2.y + dragItem.measured.height - nodesBox.y2 + nodeExtent[1][1];
12376
12578
  adjustedNodeExtent = [
12377
12579
  [x1, y1],
@@ -12382,13 +12584,13 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
12382
12584
  nodeId: id2,
12383
12585
  nextPosition,
12384
12586
  nodeLookup,
12385
- nodeExtent: adjustedNodeExtent,
12587
+ nodeExtent: adjustedNodeExtent || nodeExtent,
12386
12588
  nodeOrigin,
12387
12589
  onError
12388
12590
  });
12389
12591
  hasChange = hasChange || dragItem.position.x !== position.x || dragItem.position.y !== position.y, dragItem.position = position, dragItem.internals.positionAbsolute = positionAbsolute;
12390
12592
  }
12391
- if (hasChange && (updateNodePositions(dragItems, !0), dragEvent && (onDrag || onNodeDrag || !nodeId && onSelectionDrag))) {
12593
+ if (nodePositionsChanged = nodePositionsChanged || hasChange, !!hasChange && (updateNodePositions(dragItems, !0), dragEvent && (onDrag || onNodeDrag || !nodeId && onSelectionDrag))) {
12392
12594
  const [currentNode, currentNodes] = getEventHandlerParams({
12393
12595
  nodeId,
12394
12596
  dragItems,
@@ -12406,7 +12608,7 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
12406
12608
  return;
12407
12609
  }
12408
12610
  const [xMovement, yMovement] = calcAutoPan(mousePosition, containerBounds, autoPanSpeed);
12409
- (xMovement !== 0 || yMovement !== 0) && (lastPos.x = (lastPos.x ?? 0) - xMovement / transform2[2], lastPos.y = (lastPos.y ?? 0) - yMovement / transform2[2], await panBy2({ x: xMovement, y: yMovement }) && updateNodes(lastPos, null)), autoPanId = requestAnimationFrame(autoPan);
12611
+ (xMovement !== 0 || yMovement !== 0) && (lastPos.x = (lastPos.x ?? 0) - xMovement / transform2[2], lastPos.y = (lastPos.y ?? 0) - yMovement / transform2[2], await panBy2({ x: xMovement, y: yMovement }) && updateNodes(lastPos)), autoPanId = requestAnimationFrame(autoPan);
12410
12612
  }
12411
12613
  function startDrag(event) {
12412
12614
  const { nodeLookup, multiSelectionActive, nodesDraggable, transform: transform2, snapGrid, snapToGrid, selectNodesOnDrag, onNodeDragStart, onSelectionDragStart, unselectNodesAndEdges } = getStoreItems();
@@ -12423,21 +12625,21 @@ function XYDrag({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragSto
12423
12625
  }
12424
12626
  const d3DragInstance = drag().clickDistance(nodeClickDistance).on("start", (event) => {
12425
12627
  const { domNode: domNode2, nodeDragThreshold, transform: transform2, snapGrid, snapToGrid } = getStoreItems();
12426
- containerBounds = domNode2?.getBoundingClientRect() || null, abortDrag = !1, nodeDragThreshold === 0 && startDrag(event), lastPos = getPointerPosition(event.sourceEvent, { transform: transform2, snapGrid, snapToGrid, containerBounds }), mousePosition = getEventPosition(event.sourceEvent, containerBounds);
12628
+ containerBounds = domNode2?.getBoundingClientRect() || null, abortDrag = !1, nodePositionsChanged = !1, dragEvent = event.sourceEvent, nodeDragThreshold === 0 && startDrag(event), lastPos = getPointerPosition(event.sourceEvent, { transform: transform2, snapGrid, snapToGrid, containerBounds }), mousePosition = getEventPosition(event.sourceEvent, containerBounds);
12427
12629
  }).on("drag", (event) => {
12428
12630
  const { autoPanOnNodeDrag, transform: transform2, snapGrid, snapToGrid, nodeDragThreshold, nodeLookup } = getStoreItems(), pointerPos = getPointerPosition(event.sourceEvent, { transform: transform2, snapGrid, snapToGrid, containerBounds });
12429
- if ((event.sourceEvent.type === "touchmove" && event.sourceEvent.touches.length > 1 || // if user deletes a node while dragging, we need to abort the drag to prevent errors
12631
+ if (dragEvent = event.sourceEvent, (event.sourceEvent.type === "touchmove" && event.sourceEvent.touches.length > 1 || // if user deletes a node while dragging, we need to abort the drag to prevent errors
12430
12632
  nodeId && !nodeLookup.has(nodeId)) && (abortDrag = !0), !abortDrag) {
12431
12633
  if (!autoPanStarted && autoPanOnNodeDrag && dragStarted && (autoPanStarted = !0, autoPan()), !dragStarted) {
12432
12634
  const x = pointerPos.xSnapped - (lastPos.x ?? 0), y2 = pointerPos.ySnapped - (lastPos.y ?? 0);
12433
12635
  Math.sqrt(x * x + y2 * y2) > nodeDragThreshold && startDrag(event);
12434
12636
  }
12435
- (lastPos.x !== pointerPos.xSnapped || lastPos.y !== pointerPos.ySnapped) && dragItems && dragStarted && (mousePosition = getEventPosition(event.sourceEvent, containerBounds), updateNodes(pointerPos, event.sourceEvent));
12637
+ (lastPos.x !== pointerPos.xSnapped || lastPos.y !== pointerPos.ySnapped) && dragItems && dragStarted && (mousePosition = getEventPosition(event.sourceEvent, containerBounds), updateNodes(pointerPos));
12436
12638
  }
12437
12639
  }).on("end", (event) => {
12438
12640
  if (!(!dragStarted || abortDrag) && (autoPanStarted = !1, dragStarted = !1, cancelAnimationFrame(autoPanId), dragItems.size > 0)) {
12439
12641
  const { nodeLookup, updateNodePositions, onNodeDragStop, onSelectionDragStop } = getStoreItems();
12440
- if (updateNodePositions(dragItems, !1), onDragStop || onNodeDragStop || !nodeId && onSelectionDragStop) {
12642
+ if (nodePositionsChanged && (updateNodePositions(dragItems, !1), nodePositionsChanged = !1), onDragStop || onNodeDragStop || !nodeId && onSelectionDragStop) {
12441
12643
  const [currentNode, currentNodes] = getEventHandlerParams({
12442
12644
  nodeId,
12443
12645
  dragItems,
@@ -12508,16 +12710,17 @@ function isConnectionValid(isInsideConnectionRadius, isHandleValid) {
12508
12710
  return isHandleValid ? isValid = !0 : isInsideConnectionRadius && !isHandleValid && (isValid = !1), isValid;
12509
12711
  }
12510
12712
  const alwaysValid = () => !0;
12511
- function onPointerDown(event, { connectionMode, connectionRadius, handleId, nodeId, edgeUpdaterType, isTarget, domNode, nodeLookup, lib, autoPanOnConnect, flowId, panBy: panBy2, cancelConnection, onConnectStart, onConnect, onConnectEnd, isValidConnection = alwaysValid, onReconnectEnd, updateConnection, getTransform, getFromHandle, autoPanSpeed }) {
12713
+ function onPointerDown(event, { connectionMode, connectionRadius, handleId, nodeId, edgeUpdaterType, isTarget, domNode, nodeLookup, lib, autoPanOnConnect, flowId, panBy: panBy2, cancelConnection, onConnectStart, onConnect, onConnectEnd, isValidConnection = alwaysValid, onReconnectEnd, updateConnection, getTransform, getFromHandle, autoPanSpeed, dragThreshold = 1, handleDomNode }) {
12512
12714
  const doc = getHostForElement(event.target);
12513
12715
  let autoPanId = 0, closestHandle;
12514
- const { x, y: y2 } = getEventPosition(event), clickedHandle = doc?.elementFromPoint(x, y2), handleType = getHandleType(edgeUpdaterType, clickedHandle), containerBounds = domNode?.getBoundingClientRect();
12716
+ const { x, y: y2 } = getEventPosition(event), handleType = getHandleType(edgeUpdaterType, handleDomNode), containerBounds = domNode?.getBoundingClientRect();
12717
+ let connectionStarted = !1;
12515
12718
  if (!containerBounds || !handleType)
12516
12719
  return;
12517
12720
  const fromHandleInternal = getHandle(nodeId, handleType, handleId, nodeLookup, connectionMode);
12518
12721
  if (!fromHandleInternal)
12519
12722
  return;
12520
- let position = getEventPosition(event, containerBounds), autoPanStarted = !1, connection = null, isValid = !1, handleDomNode = null;
12723
+ let position = getEventPosition(event, containerBounds), autoPanStarted = !1, connection = null, isValid = !1, resultHandleDomNode = null;
12521
12724
  function autoPan() {
12522
12725
  if (!autoPanOnConnect || !containerBounds)
12523
12726
  return;
@@ -12529,7 +12732,8 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
12529
12732
  nodeId,
12530
12733
  type: handleType,
12531
12734
  position: fromHandleInternal.position
12532
- }, fromNodeInternal = nodeLookup.get(nodeId), newConnection = {
12735
+ }, fromNodeInternal = nodeLookup.get(nodeId);
12736
+ let previousConnection = {
12533
12737
  inProgress: !0,
12534
12738
  isValid: null,
12535
12739
  from: getHandlePosition(fromNodeInternal, fromHandle, Position.Left, !0),
@@ -12541,10 +12745,17 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
12541
12745
  toPosition: oppositePosition[fromHandle.position],
12542
12746
  toNode: null
12543
12747
  };
12544
- updateConnection(newConnection);
12545
- let previousConnection = newConnection;
12546
- onConnectStart?.(event, { nodeId, handleId, handleType });
12748
+ function startConnection() {
12749
+ connectionStarted = !0, updateConnection(previousConnection), onConnectStart?.(event, { nodeId, handleId, handleType });
12750
+ }
12751
+ dragThreshold === 0 && startConnection();
12547
12752
  function onPointerMove(event2) {
12753
+ if (!connectionStarted) {
12754
+ const { x: evtX, y: evtY } = getEventPosition(event2), dx = evtX - x, dy = evtY - y2;
12755
+ if (!(dx * dx + dy * dy > dragThreshold * dragThreshold))
12756
+ return;
12757
+ startConnection();
12758
+ }
12548
12759
  if (!getFromHandle() || !fromHandle) {
12549
12760
  onPointerUp(event2);
12550
12761
  return;
@@ -12563,8 +12774,8 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
12563
12774
  flowId,
12564
12775
  nodeLookup
12565
12776
  });
12566
- handleDomNode = result.handleDomNode, connection = result.connection, isValid = isConnectionValid(!!closestHandle, result.isValid);
12567
- const newConnection2 = {
12777
+ resultHandleDomNode = result.handleDomNode, connection = result.connection, isValid = isConnectionValid(!!closestHandle, result.isValid);
12778
+ const newConnection = {
12568
12779
  // from stays the same
12569
12780
  ...previousConnection,
12570
12781
  isValid,
@@ -12573,15 +12784,18 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
12573
12784
  toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position],
12574
12785
  toNode: result.toHandle ? nodeLookup.get(result.toHandle.nodeId) : null
12575
12786
  };
12576
- isValid && closestHandle && previousConnection.toHandle && newConnection2.toHandle && previousConnection.toHandle.type === newConnection2.toHandle.type && previousConnection.toHandle.nodeId === newConnection2.toHandle.nodeId && previousConnection.toHandle.id === newConnection2.toHandle.id && previousConnection.to.x === newConnection2.to.x && previousConnection.to.y === newConnection2.to.y || (updateConnection(newConnection2), previousConnection = newConnection2);
12787
+ 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 || (updateConnection(newConnection), previousConnection = newConnection);
12577
12788
  }
12578
12789
  function onPointerUp(event2) {
12579
- (closestHandle || handleDomNode) && connection && isValid && onConnect?.(connection);
12580
- const { inProgress, ...connectionState } = previousConnection, finalConnectionState = {
12581
- ...connectionState,
12582
- toPosition: previousConnection.toHandle ? previousConnection.toPosition : null
12583
- };
12584
- onConnectEnd?.(event2, finalConnectionState), edgeUpdaterType && onReconnectEnd?.(event2, finalConnectionState), cancelConnection(), cancelAnimationFrame(autoPanId), autoPanStarted = !1, isValid = !1, connection = null, handleDomNode = null, doc.removeEventListener("mousemove", onPointerMove), doc.removeEventListener("mouseup", onPointerUp), doc.removeEventListener("touchmove", onPointerMove), doc.removeEventListener("touchend", onPointerUp);
12790
+ if (connectionStarted) {
12791
+ (closestHandle || resultHandleDomNode) && connection && isValid && onConnect?.(connection);
12792
+ const { inProgress, ...connectionState } = previousConnection, finalConnectionState = {
12793
+ ...connectionState,
12794
+ toPosition: previousConnection.toHandle ? previousConnection.toPosition : null
12795
+ };
12796
+ onConnectEnd?.(event2, finalConnectionState), edgeUpdaterType && onReconnectEnd?.(event2, finalConnectionState);
12797
+ }
12798
+ cancelConnection(), cancelAnimationFrame(autoPanId), autoPanStarted = !1, isValid = !1, connection = null, resultHandleDomNode = null, doc.removeEventListener("mousemove", onPointerMove), doc.removeEventListener("mouseup", onPointerUp), doc.removeEventListener("touchmove", onPointerMove), doc.removeEventListener("touchend", onPointerUp);
12585
12799
  }
12586
12800
  doc.addEventListener("mousemove", onPointerMove), doc.addEventListener("mouseup", onPointerUp), doc.addEventListener("touchmove", onPointerMove), doc.addEventListener("touchend", onPointerUp);
12587
12801
  }
@@ -12614,12 +12828,11 @@ const XYHandle = {
12614
12828
  };
12615
12829
  function XYMinimap({ domNode, panZoom, getTransform, getViewScale }) {
12616
12830
  const selection2 = select(domNode);
12617
- function update({ translateExtent, width, height, zoomStep = 10, pannable = !0, zoomable = !0, inversePan = !1 }) {
12831
+ function update({ translateExtent, width, height, zoomStep = 1, pannable = !0, zoomable = !0, inversePan = !1 }) {
12618
12832
  const zoomHandler = (event) => {
12619
- const transform2 = getTransform();
12620
12833
  if (event.sourceEvent.type !== "wheel" || !panZoom)
12621
12834
  return;
12622
- const pinchDelta = -event.sourceEvent.deltaY * (event.sourceEvent.deltaMode === 1 ? 0.05 : event.sourceEvent.deltaMode ? 1 : 2e-3) * zoomStep, nextZoom = transform2[2] * Math.pow(2, pinchDelta);
12835
+ const transform2 = getTransform(), factor = event.sourceEvent.ctrlKey && isMacOs() ? 10 : 1, pinchDelta = -event.sourceEvent.deltaY * (event.sourceEvent.deltaMode === 1 ? 0.05 : event.sourceEvent.deltaMode ? 1 : 2e-3) * zoomStep, nextZoom = transform2[2] * Math.pow(2, pinchDelta * factor);
12623
12836
  panZoom.scaleTo(nextZoom);
12624
12837
  };
12625
12838
  let panStart = [0, 0];
@@ -12665,10 +12878,10 @@ const viewChanged = (prevViewport, eventViewport) => prevViewport.x !== eventVie
12665
12878
  x: transform2.x,
12666
12879
  y: transform2.y,
12667
12880
  zoom: transform2.k
12668
- }), viewportToTransform = ({ x, y: y2, zoom: zoom2 }) => identity$1.translate(x, y2).scale(zoom2), isWrappedWithClass = (event, className) => event.target.closest(`.${className}`), isRightClickPan = (panOnDrag, usedButton) => usedButton === 2 && Array.isArray(panOnDrag) && panOnDrag.includes(2), getD3Transition = (selection2, duration = 0, onEnd = () => {
12881
+ }), viewportToTransform = ({ x, y: y2, zoom: zoom2 }) => identity$1.translate(x, y2).scale(zoom2), isWrappedWithClass = (event, className) => event.target.closest(`.${className}`), isRightClickPan = (panOnDrag, usedButton) => usedButton === 2 && Array.isArray(panOnDrag) && panOnDrag.includes(2), defaultEase = (t2) => ((t2 *= 2) <= 1 ? t2 * t2 * t2 : (t2 -= 2) * t2 * t2 + 2) / 2, getD3Transition = (selection2, duration = 0, ease = defaultEase, onEnd = () => {
12669
12882
  }) => {
12670
12883
  const hasDuration = typeof duration == "number" && duration > 0;
12671
- return hasDuration || onEnd(), hasDuration ? selection2.transition().duration(duration).on("end", onEnd) : selection2;
12884
+ return hasDuration || onEnd(), hasDuration ? selection2.transition().duration(duration).ease(ease).on("end", onEnd) : selection2;
12672
12885
  }, wheelDelta = (event) => {
12673
12886
  const factor = event.ctrlKey && isMacOs() ? 10 : 1;
12674
12887
  return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * factor;
@@ -12771,7 +12984,7 @@ function XYPanZoom({ domNode, minZoom, maxZoom, paneClickDistance, translateExte
12771
12984
  d3ZoomInstance.wheelDelta(wheelDelta);
12772
12985
  function setTransform(transform2, options) {
12773
12986
  return d3Selection ? new Promise((resolve) => {
12774
- d3ZoomInstance?.transform(getD3Transition(d3Selection, options?.duration, () => resolve(!0)), transform2);
12987
+ d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? interpolate$1 : interpolateZoom).transform(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(!0)), transform2);
12775
12988
  }) : Promise.resolve(!1);
12776
12989
  }
12777
12990
  function update({ noWheelClassName, noPanClassName, onPaneContextMenu, userSelectionActive, panOnScroll, panOnDrag, panOnScrollMode, panOnScrollSpeed, preventScrolling, zoomOnPinch, zoomOnScroll, zoomOnDoubleClick, zoomActivationKeyPressed, lib, onTransformChange }) {
@@ -12854,12 +13067,12 @@ function XYPanZoom({ domNode, minZoom, maxZoom, paneClickDistance, translateExte
12854
13067
  }
12855
13068
  function scaleTo(zoom2, options) {
12856
13069
  return d3Selection ? new Promise((resolve) => {
12857
- d3ZoomInstance?.scaleTo(getD3Transition(d3Selection, options?.duration, () => resolve(!0)), zoom2);
13070
+ d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? interpolate$1 : interpolateZoom).scaleTo(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(!0)), zoom2);
12858
13071
  }) : Promise.resolve(!1);
12859
13072
  }
12860
13073
  function scaleBy(factor, options) {
12861
13074
  return d3Selection ? new Promise((resolve) => {
12862
- d3ZoomInstance?.scaleBy(getD3Transition(d3Selection, options?.duration, () => resolve(!0)), factor);
13075
+ d3ZoomInstance?.interpolate(options?.interpolate === "linear" ? interpolate$1 : interpolateZoom).scaleBy(getD3Transition(d3Selection, options?.duration, options?.ease, () => resolve(!0)), factor);
12863
13076
  }) : Promise.resolve(!1);
12864
13077
  }
12865
13078
  function setScaleExtent(scaleExtent) {
@@ -13145,7 +13358,7 @@ function requireWithSelector_production() {
13145
13358
  function is(x, y2) {
13146
13359
  return x === y2 && (x !== 0 || 1 / x === 1 / y2) || x !== x && y2 !== y2;
13147
13360
  }
13148
- var objectIs = typeof Object.is == "function" ? Object.is : is, useSyncExternalStore2 = shim2.useSyncExternalStore, useRef2 = React2.useRef, useEffect2 = React2.useEffect, useMemo2 = React2.useMemo, useDebugValue2 = React2.useDebugValue;
13361
+ var objectIs = typeof Object.is == "function" ? Object.is : is, useSyncExternalStore = shim2.useSyncExternalStore, useRef2 = React2.useRef, useEffect2 = React2.useEffect, useMemo2 = React2.useMemo, useDebugValue2 = React2.useDebugValue;
13149
13362
  return withSelector_production.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector2, isEqual2) {
13150
13363
  var instRef = useRef2(null);
13151
13364
  if (instRef.current === null) {
@@ -13179,7 +13392,7 @@ function requireWithSelector_production() {
13179
13392
  },
13180
13393
  [getSnapshot, getServerSnapshot, selector2, isEqual2]
13181
13394
  );
13182
- var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]);
13395
+ var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
13183
13396
  return useEffect2(
13184
13397
  function() {
13185
13398
  inst.hasValue = !0, inst.value = value;
@@ -13250,7 +13463,7 @@ function shallow$1(objA, objB) {
13250
13463
  return !0;
13251
13464
  }
13252
13465
  const StoreContext = createContext(null), Provider$1 = StoreContext.Provider, zustandErrorMessage = errorMessages.error001();
13253
- function useStore$1(selector2, equalityFn) {
13466
+ function useStore(selector2, equalityFn) {
13254
13467
  const store = useContext(StoreContext);
13255
13468
  if (store === null)
13256
13469
  throw new Error(zustandErrorMessage);
@@ -13276,17 +13489,18 @@ const style$1 = { display: "none" }, ariaLiveStyle = {
13276
13489
  overflow: "hidden",
13277
13490
  clip: "rect(0px, 0px, 0px, 0px)",
13278
13491
  clipPath: "inset(100%)"
13279
- }, ARIA_NODE_DESC_KEY = "react-flow__node-desc", ARIA_EDGE_DESC_KEY = "react-flow__edge-desc", ARIA_LIVE_MESSAGE = "react-flow__aria-live", selector$o = (s2) => s2.ariaLiveMessage;
13492
+ }, ARIA_NODE_DESC_KEY = "react-flow__node-desc", ARIA_EDGE_DESC_KEY = "react-flow__edge-desc", ARIA_LIVE_MESSAGE = "react-flow__aria-live", ariaLiveSelector = (s2) => s2.ariaLiveMessage, ariaLabelConfigSelector = (s2) => s2.ariaLabelConfig;
13280
13493
  function AriaLiveMessage({ rfId }) {
13281
- const ariaLiveMessage = useStore$1(selector$o);
13494
+ const ariaLiveMessage = useStore(ariaLiveSelector);
13282
13495
  return jsx("div", { id: `${ARIA_LIVE_MESSAGE}-${rfId}`, "aria-live": "assertive", "aria-atomic": "true", style: ariaLiveStyle, children: ariaLiveMessage });
13283
13496
  }
13284
13497
  function A11yDescriptions({ rfId, disableKeyboardA11y }) {
13285
- return jsxs(Fragment$1, { children: [jsxs("div", { id: `${ARIA_NODE_DESC_KEY}-${rfId}`, style: style$1, children: ["Press enter or space to select a node.", !disableKeyboardA11y && "You can then use the arrow keys to move the node around.", " Press delete to remove it and escape to cancel.", " "] }), jsx("div", { id: `${ARIA_EDGE_DESC_KEY}-${rfId}`, style: style$1, children: "Press enter or space to select an edge. You can then press delete to remove it or escape to cancel." }), !disableKeyboardA11y && jsx(AriaLiveMessage, { rfId })] });
13498
+ const ariaLabelConfig = useStore(ariaLabelConfigSelector);
13499
+ return jsxs(Fragment$1, { children: [jsx("div", { id: `${ARIA_NODE_DESC_KEY}-${rfId}`, style: style$1, children: disableKeyboardA11y ? ariaLabelConfig["node.a11yDescription.default"] : ariaLabelConfig["node.a11yDescription.keyboardDisabled"] }), jsx("div", { id: `${ARIA_EDGE_DESC_KEY}-${rfId}`, style: style$1, children: ariaLabelConfig["edge.a11yDescription.default"] }), !disableKeyboardA11y && jsx(AriaLiveMessage, { rfId })] });
13286
13500
  }
13287
- const selector$n = (s2) => s2.userSelectionActive ? "none" : "all", Panel = forwardRef(({ position = "top-left", children: children2, className, style: style2, ...rest }, ref) => {
13288
- const pointerEvents = useStore$1(selector$n), positionClasses = `${position}`.split("-");
13289
- return jsx("div", { className: cc(["react-flow__panel", className, ...positionClasses]), style: { ...style2, pointerEvents }, ref, ...rest, children: children2 });
13501
+ const Panel = forwardRef(({ position = "top-left", children: children2, className, style: style2, ...rest }, ref) => {
13502
+ const positionClasses = `${position}`.split("-");
13503
+ return jsx("div", { className: cc(["react-flow__panel", className, ...positionClasses]), style: style2, ref, ...rest, children: children2 });
13290
13504
  });
13291
13505
  Panel.displayName = "Panel";
13292
13506
  function Attribution({ proOptions, position = "bottom-right" }) {
@@ -13304,7 +13518,7 @@ function areEqual(a, b) {
13304
13518
  return shallow$1(a.selectedNodes.map(selectId), b.selectedNodes.map(selectId)) && shallow$1(a.selectedEdges.map(selectId), b.selectedEdges.map(selectId));
13305
13519
  }
13306
13520
  function SelectionListenerInner({ onSelectionChange }) {
13307
- const store = useStoreApi(), { selectedNodes, selectedEdges } = useStore$1(selector$m, areEqual);
13521
+ const store = useStoreApi(), { selectedNodes, selectedEdges } = useStore(selector$m, areEqual);
13308
13522
  return useEffect(() => {
13309
13523
  const params = { nodes: selectedNodes, edges: selectedEdges };
13310
13524
  onSelectionChange?.(params), store.getState().onSelectionChangeHandlers.forEach((fn) => fn(params));
@@ -13312,7 +13526,7 @@ function SelectionListenerInner({ onSelectionChange }) {
13312
13526
  }
13313
13527
  const changeSelector = (s2) => !!s2.onSelectionChangeHandlers;
13314
13528
  function SelectionListener({ onSelectionChange }) {
13315
- const storeHasSelectionChangeHandlers = useStore$1(changeSelector);
13529
+ const storeHasSelectionChangeHandlers = useStore(changeSelector);
13316
13530
  return onSelectionChange || storeHasSelectionChangeHandlers ? jsx(SelectionListenerInner, { onSelectionChange }) : null;
13317
13531
  }
13318
13532
  const defaultNodeOrigin = [0, 0], defaultViewport = { x: 0, y: 0, zoom: 1 }, reactFlowFieldsToTrack = [
@@ -13326,6 +13540,7 @@ const defaultNodeOrigin = [0, 0], defaultViewport = { x: 0, y: 0, zoom: 1 }, rea
13326
13540
  "onClickConnectStart",
13327
13541
  "onClickConnectEnd",
13328
13542
  "nodesDraggable",
13543
+ "autoPanOnNodeFocus",
13329
13544
  "nodesConnectable",
13330
13545
  "nodesFocusable",
13331
13546
  "edgesFocusable",
@@ -13367,10 +13582,12 @@ const defaultNodeOrigin = [0, 0], defaultViewport = { x: 0, y: 0, zoom: 1 }, rea
13367
13582
  "isValidConnection",
13368
13583
  "selectNodesOnDrag",
13369
13584
  "nodeDragThreshold",
13585
+ "connectionDragThreshold",
13370
13586
  "onBeforeDelete",
13371
13587
  "debug",
13372
13588
  "autoPanSpeed",
13373
- "paneClickDistance"
13589
+ "paneClickDistance",
13590
+ "ariaLabelConfig"
13374
13591
  ], fieldsToTrack = [...reactFlowFieldsToTrack, "rfId"], selector$l = (s2) => ({
13375
13592
  setNodes: s2.setNodes,
13376
13593
  setEdges: s2.setEdges,
@@ -13397,7 +13614,7 @@ const defaultNodeOrigin = [0, 0], defaultViewport = { x: 0, y: 0, zoom: 1 }, rea
13397
13614
  paneClickDistance: 0
13398
13615
  };
13399
13616
  function StoreUpdater(props) {
13400
- const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges, setPaneClickDistance } = useStore$1(selector$l, shallow$1), store = useStoreApi();
13617
+ const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges, setPaneClickDistance } = useStore(selector$l, shallow$1), store = useStoreApi();
13401
13618
  useEffect(() => (setDefaultNodesAndEdges(props.defaultNodes, props.defaultEdges), () => {
13402
13619
  previousFields.current = initPrevValues, reset();
13403
13620
  }), []);
@@ -13406,7 +13623,7 @@ function StoreUpdater(props) {
13406
13623
  () => {
13407
13624
  for (const fieldName of fieldsToTrack) {
13408
13625
  const fieldValue = props[fieldName], previousFieldValue = previousFields.current[fieldName];
13409
- fieldValue !== previousFieldValue && (typeof props[fieldName] > "u" || (fieldName === "nodes" ? setNodes(fieldValue) : fieldName === "edges" ? setEdges(fieldValue) : fieldName === "minZoom" ? setMinZoom(fieldValue) : fieldName === "maxZoom" ? setMaxZoom(fieldValue) : fieldName === "translateExtent" ? setTranslateExtent(fieldValue) : fieldName === "nodeExtent" ? setNodeExtent(fieldValue) : fieldName === "paneClickDistance" ? setPaneClickDistance(fieldValue) : fieldName === "fitView" ? store.setState({ fitViewQueued: fieldValue }) : fieldName === "fitViewOptions" ? store.setState({ fitViewOptions: fieldValue }) : store.setState({ [fieldName]: fieldValue })));
13626
+ fieldValue !== previousFieldValue && (typeof props[fieldName] > "u" || (fieldName === "nodes" ? setNodes(fieldValue) : fieldName === "edges" ? setEdges(fieldValue) : fieldName === "minZoom" ? setMinZoom(fieldValue) : fieldName === "maxZoom" ? setMaxZoom(fieldValue) : fieldName === "translateExtent" ? setTranslateExtent(fieldValue) : fieldName === "nodeExtent" ? setNodeExtent(fieldValue) : fieldName === "paneClickDistance" ? setPaneClickDistance(fieldValue) : fieldName === "ariaLabelConfig" ? store.setState({ ariaLabelConfig: mergeAriaLabelConfig(fieldValue) }) : fieldName === "fitView" ? store.setState({ fitViewQueued: fieldValue }) : fieldName === "fitViewOptions" ? store.setState({ fitViewOptions: fieldValue }) : store.setState({ [fieldName]: fieldValue })));
13410
13627
  }
13411
13628
  previousFields.current = props;
13412
13629
  },
@@ -13495,23 +13712,20 @@ const useViewportHelper = () => {
13495
13712
  x: viewport.x ?? tX,
13496
13713
  y: viewport.y ?? tY,
13497
13714
  zoom: viewport.zoom ?? tZoom
13498
- }, { duration: options?.duration }), Promise.resolve(!0)) : Promise.resolve(!1);
13715
+ }, options), Promise.resolve(!0)) : Promise.resolve(!1);
13499
13716
  },
13500
13717
  getViewport: () => {
13501
13718
  const [x, y2, zoom2] = store.getState().transform;
13502
13719
  return { x, y: y2, zoom: zoom2 };
13503
13720
  },
13504
- setCenter: async (x, y2, options) => {
13505
- const { width, height, maxZoom, panZoom } = store.getState(), nextZoom = typeof options?.zoom < "u" ? options.zoom : maxZoom, centerX = width / 2 - x * nextZoom, centerY = height / 2 - y2 * nextZoom;
13506
- return panZoom ? (await panZoom.setViewport({
13507
- x: centerX,
13508
- y: centerY,
13509
- zoom: nextZoom
13510
- }, { duration: options?.duration }), Promise.resolve(!0)) : Promise.resolve(!1);
13511
- },
13721
+ setCenter: async (x, y2, options) => store.getState().setCenter(x, y2, options),
13512
13722
  fitBounds: async (bounds, options) => {
13513
13723
  const { width, height, minZoom, maxZoom, panZoom } = store.getState(), viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
13514
- return panZoom ? (await panZoom.setViewport(viewport, { duration: options?.duration }), Promise.resolve(!0)) : Promise.resolve(!1);
13724
+ return panZoom ? (await panZoom.setViewport(viewport, {
13725
+ duration: options?.duration,
13726
+ ease: options?.ease,
13727
+ interpolate: options?.interpolate
13728
+ }), Promise.resolve(!0)) : Promise.resolve(!1);
13515
13729
  },
13516
13730
  screenToFlowPosition: (clientPosition, options = {}) => {
13517
13731
  const { transform: transform2, snapGrid, snapToGrid, domNode } = store.getState();
@@ -13680,7 +13894,7 @@ function useBatchContext() {
13680
13894
  }
13681
13895
  const selector$k = (s2) => !!s2.panZoom;
13682
13896
  function useReactFlow() {
13683
- const viewportHelper = useViewportHelper(), store = useStoreApi(), batchContext = useBatchContext(), viewportInitialized = useStore$1(selector$k), generalHelper = useMemo(() => {
13897
+ const viewportHelper = useViewportHelper(), store = useStoreApi(), batchContext = useBatchContext(), viewportInitialized = useStore(selector$k), generalHelper = useMemo(() => {
13684
13898
  const getInternalNode = (id2) => store.getState().nodeLookup.get(id2), setNodes = (payload) => {
13685
13899
  batchContext.nodeQueue.push(payload);
13686
13900
  }, setEdges = (payload) => {
@@ -13766,7 +13980,7 @@ function useReactFlow() {
13766
13980
  if (internalNode && !isRect && (n2.id === nodeOrRect.id || !internalNode.internals.positionAbsolute))
13767
13981
  return !1;
13768
13982
  const currNodeRect = nodeToRect(hasNodesOption ? n2 : internalNode), overlappingArea = getOverlappingArea(currNodeRect, nodeRect);
13769
- return partially && overlappingArea > 0 || overlappingArea >= nodeRect.width * nodeRect.height;
13983
+ return partially && overlappingArea > 0 || overlappingArea >= currNodeRect.width * currNodeRect.height || overlappingArea >= nodeRect.width * nodeRect.height;
13770
13984
  }) : [];
13771
13985
  },
13772
13986
  isNodeIntersecting: (nodeOrRect, area, partially = !0) => {
@@ -13849,7 +14063,7 @@ const containerStyle = {
13849
14063
  lib: s2.lib
13850
14064
  });
13851
14065
  function ZoomPane({ onPaneContextMenu, zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = !0, panOnDrag = !0, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = !0, children: children2, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance }) {
13852
- const store = useStoreApi(), zoomPane = useRef(null), { userSelectionActive, lib } = useStore$1(selector$j, shallow$1), zoomActivationKeyPressed = useKeyPress(zoomActivationKeyCode), panZoom = useRef();
14066
+ const store = useStoreApi(), zoomPane = useRef(null), { userSelectionActive, lib } = useStore(selector$j, shallow$1), zoomActivationKeyPressed = useKeyPress(zoomActivationKeyCode), panZoom = useRef();
13853
14067
  useResizeHandler(zoomPane);
13854
14068
  const onTransformChange = useCallback((transform2) => {
13855
14069
  onViewportChange?.({ x: transform2[0], y: transform2[1], zoom: transform2[2] }), isControlledViewport || store.setState({ transform: transform2 });
@@ -13927,7 +14141,7 @@ const selector$i = (s2) => ({
13927
14141
  userSelectionRect: s2.userSelectionRect
13928
14142
  });
13929
14143
  function UserSelection() {
13930
- const { userSelectionActive, userSelectionRect } = useStore$1(selector$i, shallow$1);
14144
+ const { userSelectionActive, userSelectionRect } = useStore(selector$i, shallow$1);
13931
14145
  return userSelectionActive && userSelectionRect ? jsx("div", { className: "react-flow__selection react-flow__container", style: {
13932
14146
  width: userSelectionRect.width,
13933
14147
  height: userSelectionRect.height,
@@ -13943,7 +14157,7 @@ const wrapHandler = (handler, containerRef) => (event) => {
13943
14157
  dragging: s2.paneDragging
13944
14158
  });
13945
14159
  function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.Full, panOnDrag, selectionOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children: children2 }) {
13946
- const store = useStoreApi(), { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore$1(selector$h, shallow$1), hasActiveSelection = elementsSelectable && (isSelecting || userSelectionActive), container2 = useRef(null), containerBounds = useRef(), selectedNodeIds = useRef(/* @__PURE__ */ new Set()), selectedEdgeIds = useRef(/* @__PURE__ */ new Set()), selectionInProgress = useRef(!1), selectionStarted = useRef(!1), onClick = (event) => {
14160
+ const store = useStoreApi(), { userSelectionActive, elementsSelectable, dragging, connectionInProgress } = useStore(selector$h, shallow$1), hasActiveSelection = elementsSelectable && (isSelecting || userSelectionActive), container2 = useRef(null), containerBounds = useRef(), selectedNodeIds = useRef(/* @__PURE__ */ new Set()), selectedEdgeIds = useRef(/* @__PURE__ */ new Set()), selectionInProgress = useRef(!1), selectionStarted = useRef(!1), onClick = (event) => {
13947
14161
  if (selectionInProgress.current || connectionInProgress) {
13948
14162
  selectionInProgress.current = !1;
13949
14163
  return;
@@ -14108,7 +14322,7 @@ const useNodeId = () => useContext(NodeIdContext), selector$g = (s2) => ({
14108
14322
  };
14109
14323
  };
14110
14324
  function HandleComponent({ type = "source", position = Position.Top, isValidConnection, isConnectable = !0, isConnectableStart = !0, isConnectableEnd = !0, id: id2, onConnect, children: children2, className, onMouseDown, onTouchStart, ...rest }, ref) {
14111
- const handleId = id2 || null, isTarget = type === "target", store = useStoreApi(), nodeId = useNodeId(), { connectOnClick, noPanClassName, rfId } = useStore$1(selector$g, shallow$1), { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, clickConnectionInProcess, valid } = useStore$1(connectingSelector(nodeId, handleId, type), shallow$1);
14325
+ const handleId = id2 || null, isTarget = type === "target", store = useStoreApi(), nodeId = useNodeId(), { connectOnClick, noPanClassName, rfId } = useStore(selector$g, shallow$1), { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, clickConnectionInProcess, valid } = useStore(connectingSelector(nodeId, handleId, type), shallow$1);
14112
14326
  nodeId || store.getState().onError?.("010", errorMessages.error010());
14113
14327
  const onConnectExtended = (params) => {
14114
14328
  const { defaultEdgeOptions, onConnect: onConnectAction, hasDefaultEdges } = store.getState(), edgeParams = {
@@ -14127,6 +14341,7 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
14127
14341
  if (isConnectableStart && (isMouseTriggered && event.button === 0 || !isMouseTriggered)) {
14128
14342
  const currentStore = store.getState();
14129
14343
  XYHandle.onPointerDown(event.nativeEvent, {
14344
+ handleDomNode: event.currentTarget,
14130
14345
  autoPanOnConnect: currentStore.autoPanOnConnect,
14131
14346
  connectionMode: currentStore.connectionMode,
14132
14347
  connectionRadius: currentStore.connectionRadius,
@@ -14146,7 +14361,8 @@ function HandleComponent({ type = "source", position = Position.Top, isValidConn
14146
14361
  isValidConnection: isValidConnection || currentStore.isValidConnection,
14147
14362
  getTransform: () => store.getState().transform,
14148
14363
  getFromHandle: () => store.getState().connection.fromHandle,
14149
- autoPanSpeed: currentStore.autoPanSpeed
14364
+ autoPanSpeed: currentStore.autoPanSpeed,
14365
+ dragThreshold: currentStore.connectionDragThreshold
14150
14366
  });
14151
14367
  }
14152
14368
  isMouseTriggered ? onMouseDown?.(event) : onTouchStart?.(event);
@@ -14247,7 +14463,7 @@ const selector$f = (s2) => {
14247
14463
  };
14248
14464
  };
14249
14465
  function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboardA11y }) {
14250
- const store = useStoreApi(), { width, height, transformString, userSelectionActive } = useStore$1(selector$f, shallow$1), moveSelectedNodes = useMoveSelectedNodes(), nodeRef = useRef(null);
14466
+ const store = useStoreApi(), { width, height, transformString, userSelectionActive } = useStore(selector$f, shallow$1), moveSelectedNodes = useMoveSelectedNodes(), nodeRef = useRef(null);
14251
14467
  if (useEffect(() => {
14252
14468
  disableKeyboardA11y || nodeRef.current?.focus({
14253
14469
  preventScroll: !0
@@ -14274,17 +14490,17 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
14274
14490
  }
14275
14491
  const win = typeof window < "u" ? window : void 0, selector$e = (s2) => ({ nodesSelectionActive: s2.nodesSelectionActive, userSelectionActive: s2.userSelectionActive });
14276
14492
  function FlowRendererComponent({ children: children2, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, paneClickDistance, deleteKeyCode, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, panOnScroll: _panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag: _panOnDrag, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, preventScrolling, onSelectionContextMenu, noWheelClassName, noPanClassName, disableKeyboardA11y, onViewportChange, isControlledViewport }) {
14277
- const { nodesSelectionActive, userSelectionActive } = useStore$1(selector$e), selectionKeyPressed = useKeyPress(selectionKeyCode, { target: win }), panActivationKeyPressed = useKeyPress(panActivationKeyCode, { target: win }), panOnDrag = panActivationKeyPressed || _panOnDrag, panOnScroll = panActivationKeyPressed || _panOnScroll, _selectionOnDrag = selectionOnDrag && panOnDrag !== !0, isSelecting = selectionKeyPressed || userSelectionActive || _selectionOnDrag;
14493
+ const { nodesSelectionActive, userSelectionActive } = useStore(selector$e), selectionKeyPressed = useKeyPress(selectionKeyCode, { target: win }), panActivationKeyPressed = useKeyPress(panActivationKeyCode, { target: win }), panOnDrag = panActivationKeyPressed || _panOnDrag, panOnScroll = panActivationKeyPressed || _panOnScroll, _selectionOnDrag = selectionOnDrag && panOnDrag !== !0, isSelecting = selectionKeyPressed || userSelectionActive || _selectionOnDrag;
14278
14494
  return useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode }), jsx(ZoomPane, { onPaneContextMenu, elementsSelectable, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport2, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, paneClickDistance, children: jsxs(Pane, { onSelectionStart, onSelectionEnd, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, panOnDrag, isSelecting: !!isSelecting, selectionMode, selectionKeyPressed, selectionOnDrag: _selectionOnDrag, children: [children2, nodesSelectionActive && jsx(NodesSelection, { onSelectionContextMenu, noPanClassName, disableKeyboardA11y })] }) });
14279
14495
  }
14280
14496
  FlowRendererComponent.displayName = "FlowRenderer";
14281
14497
  const FlowRenderer = memo$1(FlowRendererComponent), selector$d = (onlyRenderVisible) => (s2) => onlyRenderVisible ? getNodesInside(s2.nodeLookup, { x: 0, y: 0, width: s2.width, height: s2.height }, s2.transform, !0).map((node) => node.id) : Array.from(s2.nodeLookup.keys());
14282
14498
  function useVisibleNodeIds(onlyRenderVisible) {
14283
- return useStore$1(useCallback(selector$d(onlyRenderVisible), [onlyRenderVisible]), shallow$1);
14499
+ return useStore(useCallback(selector$d(onlyRenderVisible), [onlyRenderVisible]), shallow$1);
14284
14500
  }
14285
14501
  const selector$c = (s2) => s2.updateNodeInternals;
14286
14502
  function useResizeObserver() {
14287
- const updateNodeInternals2 = useStore$1(selector$c), [resizeObserver] = useState(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((entries) => {
14503
+ const updateNodeInternals2 = useStore(selector$c), [resizeObserver] = useState(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((entries) => {
14288
14504
  const updates = /* @__PURE__ */ new Map();
14289
14505
  entries.forEach((entry) => {
14290
14506
  const id2 = entry.target.getAttribute("data-id");
@@ -14313,7 +14529,7 @@ function useNodeObserver({ node, nodeType, hasDimensions, resizeObserver }) {
14313
14529
  }, [node.id, nodeType, node.sourcePosition, node.targetPosition]), nodeRef;
14314
14530
  }
14315
14531
  function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave, onContextMenu, onDoubleClick, nodesDraggable, elementsSelectable, nodesConnectable, nodesFocusable, resizeObserver, noDragClassName, noPanClassName, disableKeyboardA11y, rfId, nodeTypes, nodeClickDistance, onError }) {
14316
- const { node, internals, isParent: isParent2 } = useStore$1((s2) => {
14532
+ const { node, internals, isParent: isParent2 } = useStore((s2) => {
14317
14533
  const node2 = s2.nodeLookup.get(id2), isParent22 = s2.parentLookup.has(id2);
14318
14534
  return {
14319
14535
  node: node2,
@@ -14322,7 +14538,7 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
14322
14538
  };
14323
14539
  }, shallow$1);
14324
14540
  let nodeType = node.type || "default", NodeComponent = nodeTypes?.[nodeType] || builtinNodeTypes[nodeType];
14325
- NodeComponent === void 0 && (onError?.("003", errorMessages.error003(nodeType)), nodeType = "default", NodeComponent = builtinNodeTypes.default);
14541
+ NodeComponent === void 0 && (onError?.("003", errorMessages.error003(nodeType)), nodeType = "default", NodeComponent = nodeTypes?.default || builtinNodeTypes.default);
14326
14542
  const isDraggable = !!(node.draggable || nodesDraggable && typeof node.draggable > "u"), isSelectable = !!(node.selectable || elementsSelectable && typeof node.selectable > "u"), isConnectable = !!(node.connectable || nodesConnectable && typeof node.connectable > "u"), isFocusable = !!(node.focusable || nodesFocusable && typeof node.focusable > "u"), store = useStoreApi(), hasDimensions = nodeHasDimensions(node), nodeRef = useNodeObserver({ node, nodeType, hasDimensions, resizeObserver }), dragging = useDrag({
14327
14543
  nodeRef,
14328
14544
  disabled: node.hidden || !isDraggable,
@@ -14342,7 +14558,7 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
14342
14558
  nodeRef
14343
14559
  }), onClick && onClick(event, { ...internals.userNode });
14344
14560
  }, onKeyDown = (event) => {
14345
- if (!(isInputDOMNode(event.nativeEvent) || disableKeyboardA11y))
14561
+ if (!(isInputDOMNode(event.nativeEvent) || disableKeyboardA11y)) {
14346
14562
  if (elementSelectionKeys.includes(event.key) && isSelectable) {
14347
14563
  const unselect = event.key === "Escape";
14348
14564
  handleNodeClick({
@@ -14351,12 +14567,30 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
14351
14567
  unselect,
14352
14568
  nodeRef
14353
14569
  });
14354
- } else isDraggable && node.selected && Object.prototype.hasOwnProperty.call(arrowKeyDiffs, event.key) && (event.preventDefault(), store.setState({
14355
- ariaLiveMessage: `Moved selected node ${event.key.replace("Arrow", "").toLowerCase()}. New position, x: ${~~internals.positionAbsolute.x}, y: ${~~internals.positionAbsolute.y}`
14356
- }), moveSelectedNodes({
14357
- direction: arrowKeyDiffs[event.key],
14358
- factor: event.shiftKey ? 4 : 1
14359
- }));
14570
+ } else if (isDraggable && node.selected && Object.prototype.hasOwnProperty.call(arrowKeyDiffs, event.key)) {
14571
+ event.preventDefault();
14572
+ const { ariaLabelConfig } = store.getState();
14573
+ store.setState({
14574
+ ariaLiveMessage: ariaLabelConfig["node.a11yDescription.ariaLiveMessage"]({
14575
+ direction: event.key.replace("Arrow", "").toLowerCase(),
14576
+ x: ~~internals.positionAbsolute.x,
14577
+ y: ~~internals.positionAbsolute.y
14578
+ })
14579
+ }), moveSelectedNodes({
14580
+ direction: arrowKeyDiffs[event.key],
14581
+ factor: event.shiftKey ? 4 : 1
14582
+ });
14583
+ }
14584
+ }
14585
+ }, onFocus = () => {
14586
+ if (disableKeyboardA11y || !nodeRef.current?.matches(":focus-visible"))
14587
+ return;
14588
+ const { transform: transform2, width, height, autoPanOnNodeFocus, setCenter } = store.getState();
14589
+ if (!autoPanOnNodeFocus)
14590
+ return;
14591
+ getNodesInside(/* @__PURE__ */ new Map([[id2, node]]), { x: 0, y: 0, width, height }, transform2, !0).length > 0 || setCenter(node.position.x + nodeDimensions.width / 2, node.position.y + nodeDimensions.height / 2, {
14592
+ zoom: transform2[2]
14593
+ });
14360
14594
  };
14361
14595
  return jsx("div", { className: cc([
14362
14596
  "react-flow__node",
@@ -14380,7 +14614,7 @@ function NodeWrapper({ id: id2, onClick, onMouseEnter, onMouseMove, onMouseLeave
14380
14614
  visibility: hasDimensions ? "visible" : "hidden",
14381
14615
  ...node.style,
14382
14616
  ...inlineDimensions
14383
- }, "data-id": id2, "data-testid": `rf__node-${id2}`, onMouseEnter: onMouseEnterHandler, onMouseMove: onMouseMoveHandler, onMouseLeave: onMouseLeaveHandler, onContextMenu: onContextMenuHandler, onClick: onSelectNodeHandler, onDoubleClick: onDoubleClickHandler, onKeyDown: isFocusable ? onKeyDown : void 0, tabIndex: isFocusable ? 0 : void 0, role: isFocusable ? "button" : void 0, "aria-describedby": disableKeyboardA11y ? void 0 : `${ARIA_NODE_DESC_KEY}-${rfId}`, "aria-label": node.ariaLabel, children: jsx(Provider, { value: id2, children: jsx(NodeComponent, { id: id2, data: node.data, type: nodeType, positionAbsoluteX: internals.positionAbsolute.x, positionAbsoluteY: internals.positionAbsolute.y, selected: node.selected ?? !1, selectable: isSelectable, draggable: isDraggable, deletable: node.deletable ?? !0, isConnectable, sourcePosition: node.sourcePosition, targetPosition: node.targetPosition, dragging, dragHandle: node.dragHandle, zIndex: internals.z, parentId: node.parentId, ...nodeDimensions }) }) });
14617
+ }, "data-id": id2, "data-testid": `rf__node-${id2}`, onMouseEnter: onMouseEnterHandler, onMouseMove: onMouseMoveHandler, onMouseLeave: onMouseLeaveHandler, onContextMenu: onContextMenuHandler, onClick: onSelectNodeHandler, onDoubleClick: onDoubleClickHandler, onKeyDown: isFocusable ? onKeyDown : void 0, tabIndex: isFocusable ? 0 : void 0, onFocus: isFocusable ? onFocus : void 0, role: node.ariaRole ?? (isFocusable ? "group" : void 0), "aria-roledescription": "node", "aria-describedby": disableKeyboardA11y ? void 0 : `${ARIA_NODE_DESC_KEY}-${rfId}`, "aria-label": node.ariaLabel, ...node.domAttributes, children: jsx(Provider, { value: id2, children: jsx(NodeComponent, { id: id2, data: node.data, type: nodeType, positionAbsoluteX: internals.positionAbsolute.x, positionAbsoluteY: internals.positionAbsolute.y, selected: node.selected ?? !1, selectable: isSelectable, draggable: isDraggable, deletable: node.deletable ?? !0, isConnectable, sourcePosition: node.sourcePosition, targetPosition: node.targetPosition, dragging, dragHandle: node.dragHandle, zIndex: internals.z, parentId: node.parentId, ...nodeDimensions }) }) });
14384
14618
  }
14385
14619
  const selector$b = (s2) => ({
14386
14620
  nodesDraggable: s2.nodesDraggable,
@@ -14390,7 +14624,7 @@ const selector$b = (s2) => ({
14390
14624
  onError: s2.onError
14391
14625
  });
14392
14626
  function NodeRendererComponent(props) {
14393
- const { nodesDraggable, nodesConnectable, nodesFocusable, elementsSelectable, onError } = useStore$1(selector$b, shallow$1), nodeIds = useVisibleNodeIds(props.onlyRenderVisibleElements), resizeObserver = useResizeObserver();
14627
+ const { nodesDraggable, nodesConnectable, nodesFocusable, elementsSelectable, onError } = useStore(selector$b, shallow$1), nodeIds = useVisibleNodeIds(props.onlyRenderVisibleElements), resizeObserver = useResizeObserver();
14394
14628
  return jsx("div", { className: "react-flow__nodes", style: containerStyle, children: nodeIds.map((nodeId) => (
14395
14629
  /*
14396
14630
  * The split of responsibilities between NodeRenderer and
@@ -14423,7 +14657,7 @@ function NodeRendererComponent(props) {
14423
14657
  NodeRendererComponent.displayName = "NodeRenderer";
14424
14658
  const NodeRenderer = memo$1(NodeRendererComponent);
14425
14659
  function useVisibleEdgeIds(onlyRenderVisible) {
14426
- return useStore$1(useCallback((s2) => {
14660
+ return useStore(useCallback((s2) => {
14427
14661
  if (!onlyRenderVisible)
14428
14662
  return s2.edges.map((edge) => edge.id);
14429
14663
  const visibleEdgeIds = [];
@@ -14441,14 +14675,19 @@ function useVisibleEdgeIds(onlyRenderVisible) {
14441
14675
  return visibleEdgeIds;
14442
14676
  }, [onlyRenderVisible]), shallow$1);
14443
14677
  }
14444
- const ArrowSymbol = ({ color: color2 = "none", strokeWidth = 1 }) => jsx("polyline", { style: {
14445
- stroke: color2,
14446
- strokeWidth
14447
- }, strokeLinecap: "round", strokeLinejoin: "round", fill: "none", points: "-5,-4 0,0 -5,4" }), ArrowClosedSymbol = ({ color: color2 = "none", strokeWidth = 1 }) => jsx("polyline", { style: {
14448
- stroke: color2,
14449
- fill: color2,
14450
- strokeWidth
14451
- }, strokeLinecap: "round", strokeLinejoin: "round", points: "-5,-4 0,0 -5,4 -5,-4" }), MarkerSymbols = {
14678
+ const ArrowSymbol = ({ color: color2 = "none", strokeWidth = 1 }) => {
14679
+ const style2 = {
14680
+ strokeWidth,
14681
+ ...color2 && { stroke: color2 }
14682
+ };
14683
+ return jsx("polyline", { style: style2, strokeLinecap: "round", strokeLinejoin: "round", fill: "none", points: "-5,-4 0,0 -5,4" });
14684
+ }, ArrowClosedSymbol = ({ color: color2 = "none", strokeWidth = 1 }) => {
14685
+ const style2 = {
14686
+ strokeWidth,
14687
+ ...color2 && { stroke: color2, fill: color2 }
14688
+ };
14689
+ return jsx("polyline", { style: style2, strokeLinecap: "round", strokeLinejoin: "round", points: "-5,-4 0,0 -5,4 -5,-4" });
14690
+ }, MarkerSymbols = {
14452
14691
  [MarkerType.Arrow]: ArrowSymbol,
14453
14692
  [MarkerType.ArrowClosed]: ArrowClosedSymbol
14454
14693
  };
@@ -14460,7 +14699,7 @@ const Marker = ({ id: id2, type, color: color2, width = 12.5, height = 12.5, mar
14460
14699
  const Symbol2 = useMarkerSymbol(type);
14461
14700
  return Symbol2 ? jsx("marker", { className: "react-flow__arrowhead", id: id2, markerWidth: `${width}`, markerHeight: `${height}`, viewBox: "-10 -10 20 20", markerUnits, orient, refX: "0", refY: "0", children: jsx(Symbol2, { color: color2, strokeWidth }) }) : null;
14462
14701
  }, MarkerDefinitions = ({ defaultColor, rfId }) => {
14463
- const edges = useStore$1((s2) => s2.edges), defaultEdgeOptions = useStore$1((s2) => s2.defaultEdgeOptions), markers = useMemo(() => createMarkerIds(edges, {
14702
+ const edges = useStore((s2) => s2.edges), defaultEdgeOptions = useStore((s2) => s2.defaultEdgeOptions), markers = useMemo(() => createMarkerIds(edges, {
14464
14703
  id: rfId,
14465
14704
  defaultColor,
14466
14705
  defaultMarkerStart: defaultEdgeOptions?.markerStart,
@@ -14487,7 +14726,7 @@ function EdgeTextComponent({ x, y: y2, label, labelStyle, labelShowBg = !0, labe
14487
14726
  EdgeTextComponent.displayName = "EdgeText";
14488
14727
  const EdgeText = memo$1(EdgeTextComponent);
14489
14728
  function BaseEdge({ path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, interactionWidth = 20, ...props }) {
14490
- return jsxs(Fragment$1, { children: [jsx("path", { ...props, d: path, fill: "none", className: cc(["react-flow__edge-path", props.className]) }), interactionWidth && jsx("path", { d: path, fill: "none", strokeOpacity: 0, strokeWidth: interactionWidth, className: "react-flow__edge-interaction" }), label && isNumeric(labelX) && isNumeric(labelY) ? jsx(EdgeText, { x: labelX, y: labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius }) : null] });
14729
+ return jsxs(Fragment$1, { children: [jsx("path", { ...props, d: path, fill: "none", className: cc(["react-flow__edge-path", props.className]) }), interactionWidth ? jsx("path", { d: path, fill: "none", strokeOpacity: 0, strokeWidth: interactionWidth, className: "react-flow__edge-interaction" }) : null, label && isNumeric(labelX) && isNumeric(labelY) ? jsx(EdgeText, { x: labelX, y: labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius }) : null] });
14491
14730
  }
14492
14731
  function getControl({ pos, x1, y1, x2, y2 }) {
14493
14732
  return pos === Position.Left || pos === Position.Right ? [0.5 * (x1 + x2), y1] : [x1, 0.5 * (y1 + y2)];
@@ -14549,7 +14788,8 @@ function createSmoothStepEdge(params) {
14549
14788
  targetY,
14550
14789
  targetPosition,
14551
14790
  borderRadius: pathOptions?.borderRadius,
14552
- offset: pathOptions?.offset
14791
+ offset: pathOptions?.offset,
14792
+ stepPosition: pathOptions?.stepPosition
14553
14793
  }), _id = params.isInternal ? void 0 : id2;
14554
14794
  return jsx(BaseEdge, { id: _id, path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style: style2, markerEnd, markerStart, interactionWidth });
14555
14795
  });
@@ -14613,11 +14853,11 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
14613
14853
  const store = useStoreApi(), handleEdgeUpdater = (event, oppositeHandle) => {
14614
14854
  if (event.button !== 0)
14615
14855
  return;
14616
- const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib, onConnectStart, onConnectEnd, cancelConnection, nodeLookup, rfId: flowId, panBy: panBy2, updateConnection } = store.getState(), isTarget = oppositeHandle.type === "target";
14617
- setReconnecting(!0), onReconnectStart?.(event, edge, oppositeHandle.type);
14618
- const _onReconnectEnd = (evt, connectionState) => {
14856
+ const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib, onConnectStart, onConnectEnd, cancelConnection, nodeLookup, rfId: flowId, panBy: panBy2, updateConnection } = store.getState(), isTarget = oppositeHandle.type === "target", _onReconnectEnd = (evt, connectionState) => {
14619
14857
  setReconnecting(!1), onReconnectEnd?.(evt, edge, oppositeHandle.type, connectionState);
14620
- }, onConnectEdge = (connection) => onReconnect?.(edge, connection);
14858
+ }, onConnectEdge = (connection) => onReconnect?.(edge, connection), _onConnectStart = (_event, params) => {
14859
+ setReconnecting(!0), onReconnectStart?.(event, edge, oppositeHandle.type), onConnectStart?.(_event, params);
14860
+ };
14621
14861
  XYHandle.onPointerDown(event.nativeEvent, {
14622
14862
  autoPanOnConnect,
14623
14863
  connectionMode,
@@ -14634,23 +14874,25 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, sourceX, so
14634
14874
  panBy: panBy2,
14635
14875
  isValidConnection,
14636
14876
  onConnect: onConnectEdge,
14637
- onConnectStart,
14877
+ onConnectStart: _onConnectStart,
14638
14878
  onConnectEnd,
14639
14879
  onReconnectEnd: _onReconnectEnd,
14640
14880
  updateConnection,
14641
14881
  getTransform: () => store.getState().transform,
14642
- getFromHandle: () => store.getState().connection.fromHandle
14882
+ getFromHandle: () => store.getState().connection.fromHandle,
14883
+ dragThreshold: store.getState().connectionDragThreshold,
14884
+ handleDomNode: event.currentTarget
14643
14885
  });
14644
14886
  }, onReconnectSourceMouseDown = (event) => handleEdgeUpdater(event, { nodeId: edge.target, id: edge.targetHandle ?? null, type: "target" }), onReconnectTargetMouseDown = (event) => handleEdgeUpdater(event, { nodeId: edge.source, id: edge.sourceHandle ?? null, type: "source" }), onReconnectMouseEnter = () => setUpdateHover(!0), onReconnectMouseOut = () => setUpdateHover(!1);
14645
14887
  return jsxs(Fragment$1, { children: [(isReconnectable === !0 || isReconnectable === "source") && jsx(EdgeAnchor, { position: sourcePosition, centerX: sourceX, centerY: sourceY, radius: reconnectRadius, onMouseDown: onReconnectSourceMouseDown, onMouseEnter: onReconnectMouseEnter, onMouseOut: onReconnectMouseOut, type: "source" }), (isReconnectable === !0 || isReconnectable === "target") && jsx(EdgeAnchor, { position: targetPosition, centerX: targetX, centerY: targetY, radius: reconnectRadius, onMouseDown: onReconnectTargetMouseDown, onMouseEnter: onReconnectMouseEnter, onMouseOut: onReconnectMouseOut, type: "target" })] });
14646
14888
  }
14647
14889
  function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSelectable, onClick, onDoubleClick, onContextMenu, onMouseEnter, onMouseMove, onMouseLeave, reconnectRadius, onReconnect, onReconnectStart, onReconnectEnd, rfId, edgeTypes, noPanClassName, onError, disableKeyboardA11y }) {
14648
- let edge = useStore$1((s2) => s2.edgeLookup.get(id2));
14649
- const defaultEdgeOptions = useStore$1((s2) => s2.defaultEdgeOptions);
14890
+ let edge = useStore((s2) => s2.edgeLookup.get(id2));
14891
+ const defaultEdgeOptions = useStore((s2) => s2.defaultEdgeOptions);
14650
14892
  edge = defaultEdgeOptions ? { ...defaultEdgeOptions, ...edge } : edge;
14651
14893
  let edgeType = edge.type || "default", EdgeComponent = edgeTypes?.[edgeType] || builtinEdgeTypes[edgeType];
14652
- EdgeComponent === void 0 && (onError?.("011", errorMessages.error011(edgeType)), edgeType = "default", EdgeComponent = builtinEdgeTypes.default);
14653
- const isFocusable = !!(edge.focusable || edgesFocusable && typeof edge.focusable > "u"), isReconnectable = typeof onReconnect < "u" && (edge.reconnectable || edgesReconnectable && typeof edge.reconnectable > "u"), isSelectable = !!(edge.selectable || elementsSelectable && typeof edge.selectable > "u"), edgeRef = useRef(null), [updateHover, setUpdateHover] = useState(!1), [reconnecting, setReconnecting] = useState(!1), store = useStoreApi(), { zIndex, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition } = useStore$1(useCallback((store2) => {
14894
+ EdgeComponent === void 0 && (onError?.("011", errorMessages.error011(edgeType)), edgeType = "default", EdgeComponent = edgeTypes?.default || builtinEdgeTypes.default);
14895
+ const isFocusable = !!(edge.focusable || edgesFocusable && typeof edge.focusable > "u"), isReconnectable = typeof onReconnect < "u" && (edge.reconnectable || edgesReconnectable && typeof edge.reconnectable > "u"), isSelectable = !!(edge.selectable || elementsSelectable && typeof edge.selectable > "u"), edgeRef = useRef(null), [updateHover, setUpdateHover] = useState(!1), [reconnecting, setReconnecting] = useState(!1), store = useStoreApi(), { zIndex, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition } = useStore(useCallback((store2) => {
14654
14896
  const sourceNode = store2.nodeLookup.get(edge.source), targetNode = store2.nodeLookup.get(edge.target);
14655
14897
  if (!sourceNode || !targetNode)
14656
14898
  return {
@@ -14710,7 +14952,7 @@ function EdgeWrapper({ id: id2, edgesFocusable, edgesReconnectable, elementsSele
14710
14952
  updating: updateHover,
14711
14953
  selectable: isSelectable
14712
14954
  }
14713
- ]), onClick: onEdgeClick, onDoubleClick: onEdgeDoubleClick, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onKeyDown: isFocusable ? onKeyDown : void 0, tabIndex: isFocusable ? 0 : void 0, role: isFocusable ? "button" : "img", "data-id": id2, "data-testid": `rf__edge-${id2}`, "aria-label": edge.ariaLabel === null ? void 0 : edge.ariaLabel || `Edge from ${edge.source} to ${edge.target}`, "aria-describedby": isFocusable ? `${ARIA_EDGE_DESC_KEY}-${rfId}` : void 0, ref: edgeRef, children: [!reconnecting && jsx(EdgeComponent, { id: id2, source: edge.source, target: edge.target, type: edge.type, selected: edge.selected, animated: edge.animated, selectable: isSelectable, deletable: edge.deletable ?? !0, label: edge.label, labelStyle: edge.labelStyle, labelShowBg: edge.labelShowBg, labelBgStyle: edge.labelBgStyle, labelBgPadding: edge.labelBgPadding, labelBgBorderRadius: edge.labelBgBorderRadius, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data: edge.data, style: edge.style, sourceHandleId: edge.sourceHandle, targetHandleId: edge.targetHandle, markerStart: markerStartUrl, markerEnd: markerEndUrl, pathOptions: "pathOptions" in edge ? edge.pathOptions : void 0, interactionWidth: edge.interactionWidth }), isReconnectable && jsx(EdgeUpdateAnchors, { edge, isReconnectable, reconnectRadius, onReconnect, onReconnectStart, onReconnectEnd, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, setUpdateHover, setReconnecting })] }) });
14955
+ ]), onClick: onEdgeClick, onDoubleClick: onEdgeDoubleClick, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onKeyDown: isFocusable ? onKeyDown : void 0, tabIndex: isFocusable ? 0 : void 0, role: edge.ariaRole ?? (isFocusable ? "group" : "img"), "aria-roledescription": "edge", "data-id": id2, "data-testid": `rf__edge-${id2}`, "aria-label": edge.ariaLabel === null ? void 0 : edge.ariaLabel || `Edge from ${edge.source} to ${edge.target}`, "aria-describedby": isFocusable ? `${ARIA_EDGE_DESC_KEY}-${rfId}` : void 0, ref: edgeRef, ...edge.domAttributes, children: [!reconnecting && jsx(EdgeComponent, { id: id2, source: edge.source, target: edge.target, type: edge.type, selected: edge.selected, animated: edge.animated, selectable: isSelectable, deletable: edge.deletable ?? !0, label: edge.label, labelStyle: edge.labelStyle, labelShowBg: edge.labelShowBg, labelBgStyle: edge.labelBgStyle, labelBgPadding: edge.labelBgPadding, labelBgBorderRadius: edge.labelBgBorderRadius, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data: edge.data, style: edge.style, sourceHandleId: edge.sourceHandle, targetHandleId: edge.targetHandle, markerStart: markerStartUrl, markerEnd: markerEndUrl, pathOptions: "pathOptions" in edge ? edge.pathOptions : void 0, interactionWidth: edge.interactionWidth }), isReconnectable && jsx(EdgeUpdateAnchors, { edge, isReconnectable, reconnectRadius, onReconnect, onReconnectStart, onReconnectEnd, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, setUpdateHover, setReconnecting })] }) });
14714
14956
  }
14715
14957
  const selector$a = (s2) => ({
14716
14958
  edgesFocusable: s2.edgesFocusable,
@@ -14720,13 +14962,13 @@ const selector$a = (s2) => ({
14720
14962
  onError: s2.onError
14721
14963
  });
14722
14964
  function EdgeRendererComponent({ defaultMarkerColor, onlyRenderVisibleElements, rfId, edgeTypes, noPanClassName, onReconnect, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeClick, reconnectRadius, onEdgeDoubleClick, onReconnectStart, onReconnectEnd, disableKeyboardA11y }) {
14723
- const { edgesFocusable, edgesReconnectable, elementsSelectable, onError } = useStore$1(selector$a, shallow$1), edgeIds = useVisibleEdgeIds(onlyRenderVisibleElements);
14965
+ const { edgesFocusable, edgesReconnectable, elementsSelectable, onError } = useStore(selector$a, shallow$1), edgeIds = useVisibleEdgeIds(onlyRenderVisibleElements);
14724
14966
  return jsxs("div", { className: "react-flow__edges", children: [jsx(MarkerDefinitions$1, { defaultColor: defaultMarkerColor, rfId }), edgeIds.map((id2) => jsx(EdgeWrapper, { id: id2, edgesFocusable, edgesReconnectable, elementsSelectable, noPanClassName, onReconnect, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onClick: onEdgeClick, reconnectRadius, onDoubleClick: onEdgeDoubleClick, onReconnectStart, onReconnectEnd, rfId, onError, edgeTypes, disableKeyboardA11y }, id2))] });
14725
14967
  }
14726
14968
  EdgeRendererComponent.displayName = "EdgeRenderer";
14727
14969
  const EdgeRenderer = memo$1(EdgeRendererComponent), selector$9 = (s2) => `translate(${s2.transform[0]}px,${s2.transform[1]}px) scale(${s2.transform[2]})`;
14728
14970
  function Viewport({ children: children2 }) {
14729
- const transform2 = useStore$1(selector$9);
14971
+ const transform2 = useStore(selector$9);
14730
14972
  return jsx("div", { className: "react-flow__viewport xyflow__viewport react-flow__container", style: { transform: transform2 }, children: children2 });
14731
14973
  }
14732
14974
  function useOnInitHandler(onInit) {
@@ -14737,7 +14979,7 @@ function useOnInitHandler(onInit) {
14737
14979
  }
14738
14980
  const selector$8 = (state) => state.panZoom?.syncViewport;
14739
14981
  function useViewportSync(viewport) {
14740
- const syncViewport = useStore$1(selector$8), store = useStoreApi();
14982
+ const syncViewport = useStore(selector$8), store = useStoreApi();
14741
14983
  return useEffect(() => {
14742
14984
  viewport && (syncViewport?.(viewport), store.setState({ transform: [viewport.x, viewport.y, viewport.zoom] }));
14743
14985
  }, [viewport, syncViewport]), null;
@@ -14750,7 +14992,7 @@ function getSelector(connectionSelector) {
14750
14992
  }
14751
14993
  function useConnection(connectionSelector) {
14752
14994
  const combinedSelector = getSelector();
14753
- return useStore$1(combinedSelector, shallow$1);
14995
+ return useStore(combinedSelector, shallow$1);
14754
14996
  }
14755
14997
  const selector$7 = (s2) => ({
14756
14998
  nodesConnectable: s2.nodesConnectable,
@@ -14760,7 +15002,7 @@ const selector$7 = (s2) => ({
14760
15002
  height: s2.height
14761
15003
  });
14762
15004
  function ConnectionLineWrapper({ containerStyle: containerStyle2, style: style2, type, component }) {
14763
- const { nodesConnectable, width, height, isValid, inProgress } = useStore$1(selector$7, shallow$1);
15005
+ const { nodesConnectable, width, height, isValid, inProgress } = useStore(selector$7, shallow$1);
14764
15006
  return !(width && nodesConnectable && inProgress) ? null : jsx("svg", { style: containerStyle2, width, height, className: "react-flow__connectionline react-flow__container", children: jsx("g", { className: cc(["react-flow__connection", getConnectionStatus(isValid)]), children: jsx(ConnectionLine, { style: style2, type, CustomComponent: component, isValid }) }) });
14765
15007
  }
14766
15008
  const ConnectionLine = ({ style: style2, type = ConnectionLineType.Bezier, CustomComponent, isValid }) => {
@@ -14858,6 +15100,7 @@ const GraphView = memo$1(GraphViewComponent), getInitialState = ({ nodes, edges,
14858
15100
  noPanClassName: "nopan",
14859
15101
  nodeOrigin: storeNodeOrigin,
14860
15102
  nodeDragThreshold: 1,
15103
+ connectionDragThreshold: 1,
14861
15104
  snapGrid: [15, 15],
14862
15105
  snapToGrid: !1,
14863
15106
  nodesDraggable: !0,
@@ -14879,13 +15122,15 @@ const GraphView = memo$1(GraphViewComponent), getInitialState = ({ nodes, edges,
14879
15122
  ariaLiveMessage: "",
14880
15123
  autoPanOnConnect: !0,
14881
15124
  autoPanOnNodeDrag: !0,
15125
+ autoPanOnNodeFocus: !0,
14882
15126
  autoPanSpeed: 15,
14883
15127
  connectionRadius: 20,
14884
15128
  onError: devWarn,
14885
15129
  isValidConnection: void 0,
14886
15130
  onSelectionChangeHandlers: [],
14887
15131
  lib: "react",
14888
- debug: !1
15132
+ debug: !1,
15133
+ ariaLabelConfig: defaultAriaLabelConfig
14889
15134
  };
14890
15135
  }, createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent }) => createWithEqualityFn((set2, get2) => {
14891
15136
  async function resolveFitView() {
@@ -15053,6 +15298,17 @@ const GraphView = memo$1(GraphViewComponent), getInitialState = ({ nodes, edges,
15053
15298
  const { transform: transform2, width: width2, height: height2, panZoom, translateExtent } = get2();
15054
15299
  return panBy({ delta, panZoom, transform: transform2, translateExtent, width: width2, height: height2 });
15055
15300
  },
15301
+ setCenter: async (x, y2, options) => {
15302
+ const { width: width2, height: height2, maxZoom: maxZoom2, panZoom } = get2();
15303
+ if (!panZoom)
15304
+ return Promise.resolve(!1);
15305
+ const nextZoom = typeof options?.zoom < "u" ? options.zoom : maxZoom2;
15306
+ return await panZoom.setViewport({
15307
+ x: width2 / 2 - x * nextZoom,
15308
+ y: height2 / 2 - y2 * nextZoom,
15309
+ zoom: nextZoom
15310
+ }, { duration: options?.duration, ease: options?.ease, interpolate: options?.interpolate }), Promise.resolve(!0);
15311
+ },
15056
15312
  cancelConnection: () => {
15057
15313
  set2({
15058
15314
  connection: { ...initialConnection }
@@ -15091,20 +15347,20 @@ const wrapperStyle = {
15091
15347
  position: "relative",
15092
15348
  zIndex: 0
15093
15349
  };
15094
- function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes, edgeTypes, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = !1, selectionMode = SelectionMode.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = !1, selectNodesOnDrag, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = !0, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = !0, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = !0, panOnDrag = !0, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 0, nodeClickDistance = 0, children: children2, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = !1, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug, onScroll, ...rest }, ref) {
15350
+ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes, edgeTypes, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = "Backspace", selectionKeyCode = "Shift", selectionOnDrag = !1, selectionMode = SelectionMode.Full, panActivationKeyCode = "Space", multiSelectionKeyCode = isMacOs() ? "Meta" : "Control", zoomActivationKeyCode = isMacOs() ? "Meta" : "Control", snapToGrid, snapGrid, onlyRenderVisibleElements = !1, selectNodesOnDrag, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = !0, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = !0, nodeExtent, defaultMarkerColor = "#b1b1b7", zoomOnScroll = !0, zoomOnPinch = !0, panOnScroll = !1, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = !0, panOnDrag = !0, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 0, nodeClickDistance = 0, children: children2, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = "nodrag", noWheelClassName = "nowheel", noPanClassName = "nopan", fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = !1, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, connectionRadius, isValidConnection, onError, style: style2, id: id2, nodeDragThreshold, connectionDragThreshold, viewport, onViewportChange, width, height, colorMode = "light", debug, onScroll, ariaLabelConfig, ...rest }, ref) {
15095
15351
  const rfId = id2 || "1", colorModeClassName = useColorModeClass(colorMode), wrapperOnScroll = useCallback((e2) => {
15096
15352
  e2.currentTarget.scrollTo({ top: 0, left: 0, behavior: "instant" }), onScroll?.(e2);
15097
15353
  }, [onScroll]);
15098
- return jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, children: jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, children: [jsx(GraphView, { onInit, onNodeClick, onEdgeClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, nodeTypes, edgeTypes, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, deleteKeyCode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent, minZoom, maxZoom, preventScrolling, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noDragClassName, noWheelClassName, noPanClassName, rfId, disableKeyboardA11y, nodeExtent, viewport, onViewportChange }), jsx(StoreUpdater, { nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, nodesConnectable, nodesFocusable, edgesFocusable, edgesReconnectable, elementsSelectable, elevateNodesOnSelect, elevateEdgesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, snapToGrid, snapGrid, connectionMode, translateExtent, connectOnClick, defaultEdgeOptions, fitView, fitViewOptions, onNodesDelete, onEdgesDelete, onDelete, onNodeDragStart, onNodeDrag, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, onMove, onMoveStart, onMoveEnd, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, onError, connectionRadius, isValidConnection, selectNodesOnDrag, nodeDragThreshold, onBeforeDelete, paneClickDistance, debug }), jsx(SelectionListener, { onSelectionChange }), children2, jsx(Attribution, { proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
15354
+ return jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style2, ...wrapperStyle }, ref, className: cc(["react-flow", className, colorModeClassName]), id: id2, role: "application", children: jsxs(Wrapper, { nodes, edges, width, height, fitView, fitViewOptions, minZoom, maxZoom, nodeOrigin, nodeExtent, children: [jsx(GraphView, { onInit, onNodeClick, onEdgeClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, nodeTypes, edgeTypes, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, deleteKeyCode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent, minZoom, maxZoom, preventScrolling, zoomOnScroll, zoomOnPinch, zoomOnDoubleClick, panOnScroll, panOnScrollSpeed, panOnScrollMode, panOnDrag, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance, nodeClickDistance, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius, defaultMarkerColor, noDragClassName, noWheelClassName, noPanClassName, rfId, disableKeyboardA11y, nodeExtent, viewport, onViewportChange }), jsx(StoreUpdater, { nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, edgesFocusable, edgesReconnectable, elementsSelectable, elevateNodesOnSelect, elevateEdgesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, snapToGrid, snapGrid, connectionMode, translateExtent, connectOnClick, defaultEdgeOptions, fitView, fitViewOptions, onNodesDelete, onEdgesDelete, onDelete, onNodeDragStart, onNodeDrag, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, onMove, onMoveStart, onMoveEnd, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, onError, connectionRadius, isValidConnection, selectNodesOnDrag, nodeDragThreshold, connectionDragThreshold, onBeforeDelete, paneClickDistance, debug, ariaLabelConfig }), jsx(SelectionListener, { onSelectionChange }), children2, jsx(Attribution, { proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId, disableKeyboardA11y })] }) });
15099
15355
  }
15100
15356
  var index = fixedForwardRef(ReactFlow);
15101
15357
  const selector$6 = (s2) => s2.domNode?.querySelector(".react-flow__edgelabel-renderer");
15102
15358
  function EdgeLabelRenderer({ children: children2 }) {
15103
- const edgeLabelRenderer = useStore$1(selector$6);
15359
+ const edgeLabelRenderer = useStore(selector$6);
15104
15360
  return edgeLabelRenderer ? createPortal(children2, edgeLabelRenderer) : null;
15105
15361
  }
15106
15362
  function useInternalNode(id2) {
15107
- return useStore$1(useCallback((s2) => s2.nodeLookup.get(id2), [id2]), shallow$1);
15363
+ return useStore(useCallback((s2) => s2.nodeLookup.get(id2), [id2]), shallow$1);
15108
15364
  }
15109
15365
  function LinePattern({ dimensions, lineWidth, variant, className }) {
15110
15366
  return jsx("path", { strokeWidth: lineWidth, d: `M${dimensions[0] / 2} 0 V${dimensions[1]} M0 ${dimensions[1] / 2} H${dimensions[0]}`, className: cc(["react-flow__background-pattern", variant, className]) });
@@ -15136,7 +15392,7 @@ function BackgroundComponent({
15136
15392
  className,
15137
15393
  patternClassName
15138
15394
  }) {
15139
- const ref = useRef(null), { transform: transform2, patternId } = useStore$1(selector$3, shallow$1), patternSize = size2 || defaultSize[variant], isDots = variant === BackgroundVariant.Dots, isCross = variant === BackgroundVariant.Cross, gapXY = Array.isArray(gap) ? gap : [gap, gap], scaledGap = [gapXY[0] * transform2[2] || 1, gapXY[1] * transform2[2] || 1], scaledSize = patternSize * transform2[2], offsetXY = Array.isArray(offset2) ? offset2 : [offset2, offset2], patternDimensions = isCross ? [scaledSize, scaledSize] : scaledGap, scaledOffset = [
15395
+ const ref = useRef(null), { transform: transform2, patternId } = useStore(selector$3, shallow$1), patternSize = size2 || defaultSize[variant], isDots = variant === BackgroundVariant.Dots, isCross = variant === BackgroundVariant.Cross, gapXY = Array.isArray(gap) ? gap : [gap, gap], scaledGap = [gapXY[0] * transform2[2] || 1, gapXY[1] * transform2[2] || 1], scaledSize = patternSize * transform2[2], offsetXY = Array.isArray(offset2) ? offset2 : [offset2, offset2], patternDimensions = isCross ? [scaledSize, scaledSize] : scaledGap, scaledOffset = [
15140
15396
  offsetXY[0] * transform2[2] || 1 + patternDimensions[0] / 2,
15141
15397
  offsetXY[1] * transform2[2] || 1 + patternDimensions[1] / 2
15142
15398
  ], _patternId = `${patternId}${id2 || ""}`;
@@ -15170,10 +15426,11 @@ function ControlButton({ children: children2, className, ...rest }) {
15170
15426
  const selector$2 = (s2) => ({
15171
15427
  isInteractive: s2.nodesDraggable || s2.nodesConnectable || s2.elementsSelectable,
15172
15428
  minZoomReached: s2.transform[2] <= s2.minZoom,
15173
- maxZoomReached: s2.transform[2] >= s2.maxZoom
15429
+ maxZoomReached: s2.transform[2] >= s2.maxZoom,
15430
+ ariaLabelConfig: s2.ariaLabelConfig
15174
15431
  });
15175
- function ControlsComponent({ style: style2, showZoom = !0, showFitView = !0, showInteractive = !0, fitViewOptions, onZoomIn, onZoomOut, onFitView, onInteractiveChange, className, children: children2, position = "bottom-left", orientation = "vertical", "aria-label": ariaLabel = "React Flow controls" }) {
15176
- const store = useStoreApi(), { isInteractive, minZoomReached, maxZoomReached } = useStore$1(selector$2, shallow$1), { zoomIn, zoomOut, fitView } = useReactFlow(), onZoomInHandler = () => {
15432
+ function ControlsComponent({ style: style2, showZoom = !0, showFitView = !0, showInteractive = !0, fitViewOptions, onZoomIn, onZoomOut, onFitView, onInteractiveChange, className, children: children2, position = "bottom-left", orientation = "vertical", "aria-label": ariaLabel }) {
15433
+ const store = useStoreApi(), { isInteractive, minZoomReached, maxZoomReached, ariaLabelConfig } = useStore(selector$2, shallow$1), { zoomIn, zoomOut, fitView } = useReactFlow(), onZoomInHandler = () => {
15177
15434
  zoomIn(), onZoomIn?.();
15178
15435
  }, onZoomOutHandler = () => {
15179
15436
  zoomOut(), onZoomOut?.();
@@ -15186,7 +15443,7 @@ function ControlsComponent({ style: style2, showZoom = !0, showFitView = !0, sho
15186
15443
  elementsSelectable: !isInteractive
15187
15444
  }), onInteractiveChange?.(!isInteractive);
15188
15445
  };
15189
- return jsxs(Panel, { className: cc(["react-flow__controls", orientation === "horizontal" ? "horizontal" : "vertical", className]), position, style: style2, "data-testid": "rf__controls", "aria-label": ariaLabel, children: [showZoom && jsxs(Fragment$1, { children: [jsx(ControlButton, { onClick: onZoomInHandler, className: "react-flow__controls-zoomin", title: "zoom in", "aria-label": "zoom in", disabled: maxZoomReached, children: jsx(PlusIcon, {}) }), jsx(ControlButton, { onClick: onZoomOutHandler, className: "react-flow__controls-zoomout", title: "zoom out", "aria-label": "zoom out", disabled: minZoomReached, children: jsx(MinusIcon, {}) })] }), showFitView && jsx(ControlButton, { className: "react-flow__controls-fitview", onClick: onFitViewHandler, title: "fit view", "aria-label": "fit view", children: jsx(FitViewIcon, {}) }), showInteractive && jsx(ControlButton, { className: "react-flow__controls-interactive", onClick: onToggleInteractivity, title: "toggle interactivity", "aria-label": "toggle interactivity", children: isInteractive ? jsx(UnlockIcon, {}) : jsx(LockIcon, {}) }), children2] });
15446
+ return jsxs(Panel, { className: cc(["react-flow__controls", orientation === "horizontal" ? "horizontal" : "vertical", className]), position, style: style2, "data-testid": "rf__controls", "aria-label": ariaLabel ?? ariaLabelConfig["controls.ariaLabel"], children: [showZoom && jsxs(Fragment$1, { children: [jsx(ControlButton, { onClick: onZoomInHandler, className: "react-flow__controls-zoomin", title: ariaLabelConfig["controls.zoomIn.ariaLabel"], "aria-label": ariaLabelConfig["controls.zoomIn.ariaLabel"], disabled: maxZoomReached, children: jsx(PlusIcon, {}) }), jsx(ControlButton, { onClick: onZoomOutHandler, className: "react-flow__controls-zoomout", title: ariaLabelConfig["controls.zoomOut.ariaLabel"], "aria-label": ariaLabelConfig["controls.zoomOut.ariaLabel"], disabled: minZoomReached, children: jsx(MinusIcon, {}) })] }), showFitView && jsx(ControlButton, { className: "react-flow__controls-fitview", onClick: onFitViewHandler, title: ariaLabelConfig["controls.fitView.ariaLabel"], "aria-label": ariaLabelConfig["controls.fitView.ariaLabel"], children: jsx(FitViewIcon, {}) }), showInteractive && jsx(ControlButton, { className: "react-flow__controls-interactive", onClick: onToggleInteractivity, title: ariaLabelConfig["controls.interactive.ariaLabel"], "aria-label": ariaLabelConfig["controls.interactive.ariaLabel"], children: isInteractive ? jsx(UnlockIcon, {}) : jsx(LockIcon, {}) }), children2] });
15190
15447
  }
15191
15448
  ControlsComponent.displayName = "Controls";
15192
15449
  memo$1(ControlsComponent);
@@ -15212,7 +15469,7 @@ function MiniMapNodes({
15212
15469
  nodeComponent: NodeComponent = MiniMapNode,
15213
15470
  onClick
15214
15471
  }) {
15215
- const nodeIds = useStore$1(selectorNodeIds, shallow$1), nodeColorFunc = getAttrFunction(nodeColor), nodeStrokeColorFunc = getAttrFunction(nodeStrokeColor), nodeClassNameFunc = getAttrFunction(nodeClassName), shapeRendering = typeof window > "u" || window.chrome ? "crispEdges" : "geometricPrecision";
15472
+ const nodeIds = useStore(selectorNodeIds, shallow$1), nodeColorFunc = getAttrFunction(nodeColor), nodeStrokeColorFunc = getAttrFunction(nodeStrokeColor), nodeClassNameFunc = getAttrFunction(nodeClassName), shapeRendering = typeof window > "u" || window.chrome ? "crispEdges" : "geometricPrecision";
15216
15473
  return jsx(Fragment$1, { children: nodeIds.map((nodeId) => (
15217
15474
  /*
15218
15475
  * The split of responsibilities between MiniMapNodes and
@@ -15225,7 +15482,7 @@ function MiniMapNodes({
15225
15482
  )) });
15226
15483
  }
15227
15484
  function NodeComponentWrapperInner({ id: id2, nodeColorFunc, nodeStrokeColorFunc, nodeClassNameFunc, nodeBorderRadius, nodeStrokeWidth, shapeRendering, NodeComponent, onClick }) {
15228
- const { node, x, y: y2, width, height } = useStore$1((s2) => {
15485
+ const { node, x, y: y2, width, height } = useStore((s2) => {
15229
15486
  const { internals } = s2.nodeLookup.get(id2), node2 = internals.userNode, { x: x2, y: y22 } = internals.positionAbsolute, { width: width2, height: height2 } = getNodeDimensions(node2);
15230
15487
  return {
15231
15488
  node: node2,
@@ -15253,7 +15510,8 @@ const defaultWidth = 200, defaultHeight = 150, filterHidden = (node) => !node.hi
15253
15510
  panZoom: s2.panZoom,
15254
15511
  translateExtent: s2.translateExtent,
15255
15512
  flowWidth: s2.width,
15256
- flowHeight: s2.height
15513
+ flowHeight: s2.height,
15514
+ ariaLabelConfig: s2.ariaLabelConfig
15257
15515
  };
15258
15516
  }, ARIA_LABEL_KEY = "react-flow__minimap-desc";
15259
15517
  function MiniMapComponent({
@@ -15278,12 +15536,12 @@ function MiniMapComponent({
15278
15536
  onNodeClick,
15279
15537
  pannable = !1,
15280
15538
  zoomable = !1,
15281
- ariaLabel = "React Flow mini map",
15539
+ ariaLabel,
15282
15540
  inversePan,
15283
- zoomStep = 10,
15541
+ zoomStep = 1,
15284
15542
  offsetScale = 5
15285
15543
  }) {
15286
- const store = useStoreApi(), svg = useRef(null), { boundingRect, viewBB, rfId, panZoom, translateExtent, flowWidth, flowHeight } = useStore$1(selector$1, shallow$1), elementWidth = style2?.width ?? defaultWidth, elementHeight = style2?.height ?? defaultHeight, scaledWidth = boundingRect.width / elementWidth, scaledHeight = boundingRect.height / elementHeight, viewScale = Math.max(scaledWidth, scaledHeight), viewWidth = viewScale * elementWidth, viewHeight = viewScale * elementHeight, offset2 = offsetScale * viewScale, x = boundingRect.x - (viewWidth - boundingRect.width) / 2 - offset2, y2 = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset2, width = viewWidth + offset2 * 2, height = viewHeight + offset2 * 2, labelledBy = `${ARIA_LABEL_KEY}-${rfId}`, viewScaleRef = useRef(0), minimapInstance = useRef();
15544
+ const store = useStoreApi(), svg = useRef(null), { boundingRect, viewBB, rfId, panZoom, translateExtent, flowWidth, flowHeight, ariaLabelConfig } = useStore(selector$1, shallow$1), elementWidth = style2?.width ?? defaultWidth, elementHeight = style2?.height ?? defaultHeight, scaledWidth = boundingRect.width / elementWidth, scaledHeight = boundingRect.height / elementHeight, viewScale = Math.max(scaledWidth, scaledHeight), viewWidth = viewScale * elementWidth, viewHeight = viewScale * elementHeight, offset2 = offsetScale * viewScale, x = boundingRect.x - (viewWidth - boundingRect.width) / 2 - offset2, y2 = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset2, width = viewWidth + offset2 * 2, height = viewHeight + offset2 * 2, labelledBy = `${ARIA_LABEL_KEY}-${rfId}`, viewScaleRef = useRef(0), minimapInstance = useRef();
15287
15545
  viewScaleRef.current = viewScale, useEffect(() => {
15288
15546
  if (svg.current && panZoom)
15289
15547
  return minimapInstance.current = XYMinimap({
@@ -15311,7 +15569,7 @@ function MiniMapComponent({
15311
15569
  } : void 0, onSvgNodeClick = onNodeClick ? useCallback((event, nodeId) => {
15312
15570
  const node = store.getState().nodeLookup.get(nodeId).internals.userNode;
15313
15571
  onNodeClick(event, node);
15314
- }, []) : void 0;
15572
+ }, []) : void 0, _ariaLabel = ariaLabel ?? ariaLabelConfig["minimap.ariaLabel"];
15315
15573
  return jsx(Panel, { position, style: {
15316
15574
  ...style2,
15317
15575
  "--xy-minimap-background-color-props": typeof bgColor == "string" ? bgColor : void 0,
@@ -15321,13 +15579,17 @@ function MiniMapComponent({
15321
15579
  "--xy-minimap-node-background-color-props": typeof nodeColor == "string" ? nodeColor : void 0,
15322
15580
  "--xy-minimap-node-stroke-color-props": typeof nodeStrokeColor == "string" ? nodeStrokeColor : void 0,
15323
15581
  "--xy-minimap-node-stroke-width-props": typeof nodeStrokeWidth == "number" ? nodeStrokeWidth : void 0
15324
- }, className: cc(["react-flow__minimap", className]), "data-testid": "rf__minimap", children: jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${x} ${y2} ${width} ${height}`, className: "react-flow__minimap-svg", role: "img", "aria-labelledby": labelledBy, ref: svg, onClick: onSvgClick, children: [ariaLabel && jsx("title", { id: labelledBy, children: ariaLabel }), jsx(MiniMapNodes$1, { onClick: onSvgNodeClick, nodeColor, nodeStrokeColor, nodeBorderRadius, nodeClassName, nodeStrokeWidth, nodeComponent }), jsx("path", { className: "react-flow__minimap-mask", d: `M${x - offset2},${y2 - offset2}h${width + offset2 * 2}v${height + offset2 * 2}h${-width - offset2 * 2}z
15582
+ }, className: cc(["react-flow__minimap", className]), "data-testid": "rf__minimap", children: jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${x} ${y2} ${width} ${height}`, className: "react-flow__minimap-svg", role: "img", "aria-labelledby": labelledBy, ref: svg, onClick: onSvgClick, children: [_ariaLabel && jsx("title", { id: labelledBy, children: _ariaLabel }), jsx(MiniMapNodes$1, { onClick: onSvgNodeClick, nodeColor, nodeStrokeColor, nodeBorderRadius, nodeClassName, nodeStrokeWidth, nodeComponent }), jsx("path", { className: "react-flow__minimap-mask", d: `M${x - offset2},${y2 - offset2}h${width + offset2 * 2}v${height + offset2 * 2}h${-width - offset2 * 2}z
15325
15583
  M${viewBB.x},${viewBB.y}h${viewBB.width}v${viewBB.height}h${-viewBB.width}z`, fillRule: "evenodd", pointerEvents: "none" })] }) });
15326
15584
  }
15327
15585
  MiniMapComponent.displayName = "MiniMap";
15328
15586
  memo$1(MiniMapComponent);
15329
- function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle, className, style: style2 = {}, children: children2, color: color2, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = !1, resizeDirection, shouldResize, onResizeStart, onResize, onResizeEnd }) {
15330
- const contextNodeId = useNodeId(), id2 = typeof nodeId == "string" ? nodeId : contextNodeId, store = useStoreApi(), resizeControlRef = useRef(null), defaultPosition = variant === ResizeControlVariant.Line ? "right" : "bottom-right", controlPosition = position ?? defaultPosition, resizer = useRef(null);
15587
+ const scaleSelector = (calculateScale) => (store) => calculateScale ? `${Math.max(1 / store.transform[2], 1)}` : void 0, defaultPositions = {
15588
+ [ResizeControlVariant.Line]: "right",
15589
+ [ResizeControlVariant.Handle]: "bottom-right"
15590
+ };
15591
+ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle, className, style: style2 = void 0, children: children2, color: color2, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = !1, resizeDirection, autoScale = !0, shouldResize, onResizeStart, onResize, onResizeEnd }) {
15592
+ const contextNodeId = useNodeId(), id2 = typeof nodeId == "string" ? nodeId : contextNodeId, store = useStoreApi(), resizeControlRef = useRef(null), isHandleControl = variant === ResizeControlVariant.Handle, scale2 = useStore(useCallback(scaleSelector(isHandleControl && autoScale), [isHandleControl, autoScale]), shallow$1), resizer = useRef(null), controlPosition = position ?? defaultPositions[variant];
15331
15593
  useEffect(() => {
15332
15594
  if (!(!resizeControlRef.current || !id2))
15333
15595
  return resizer.current || (resizer.current = XYResizer({
@@ -15432,13 +15694,17 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
15432
15694
  onResizeEnd,
15433
15695
  shouldResize
15434
15696
  ]);
15435
- const positionClassNames = controlPosition.split("-"), colorStyleProp = variant === ResizeControlVariant.Line ? "borderColor" : "backgroundColor", controlStyle = color2 ? { ...style2, [colorStyleProp]: color2 } : style2;
15436
- return jsx("div", { className: cc(["react-flow__resize-control", "nodrag", ...positionClassNames, variant, className]), ref: resizeControlRef, style: controlStyle, children: children2 });
15697
+ const positionClassNames = controlPosition.split("-");
15698
+ return jsx("div", { className: cc(["react-flow__resize-control", "nodrag", ...positionClassNames, variant, className]), ref: resizeControlRef, style: {
15699
+ ...style2,
15700
+ scale: scale2,
15701
+ ...color2 && { [isHandleControl ? "backgroundColor" : "borderColor"]: color2 }
15702
+ }, children: children2 });
15437
15703
  }
15438
15704
  memo$1(ResizeControl);
15439
15705
  const selector = (state) => state.domNode?.querySelector(".react-flow__renderer");
15440
15706
  function NodeToolbarPortal({ children: children2 }) {
15441
- const wrapperRef = useStore$1(selector);
15707
+ const wrapperRef = useStore(selector);
15442
15708
  return wrapperRef ? createPortal(children2, wrapperRef) : null;
15443
15709
  }
15444
15710
  const nodeEqualityFn = (a, b) => a?.internals.positionAbsolute.x !== b?.internals.positionAbsolute.x || a?.internals.positionAbsolute.y !== b?.internals.positionAbsolute.y || a?.measured.width !== b?.measured.width || a?.measured.height !== b?.measured.height || a?.selected !== b?.selected || a?.internals.z !== b?.internals.z, nodesEqualityFn = (a, b) => {
@@ -15458,7 +15724,7 @@ function NodeToolbar({ nodeId, children: children2, className, style: style2, is
15458
15724
  const contextNodeId = useNodeId(), nodesSelector2 = useCallback((state) => (Array.isArray(nodeId) ? nodeId : [nodeId || contextNodeId || ""]).reduce((res, id2) => {
15459
15725
  const node = state.nodeLookup.get(id2);
15460
15726
  return node && res.set(node.id, node), res;
15461
- }, /* @__PURE__ */ new Map()), [nodeId, contextNodeId]), nodes = useStore$1(nodesSelector2, nodesEqualityFn), { x, y: y2, zoom: zoom2, selectedNodesCount } = useStore$1(storeSelector, shallow$1);
15727
+ }, /* @__PURE__ */ new Map()), [nodeId, contextNodeId]), nodes = useStore(nodesSelector2, nodesEqualityFn), { x, y: y2, zoom: zoom2, selectedNodesCount } = useStore(storeSelector, shallow$1);
15462
15728
  if (!(typeof isVisible == "boolean" ? isVisible : nodes.size === 1 && nodes.values().next().value?.selected && selectedNodesCount === 1) || !nodes.size)
15463
15729
  return null;
15464
15730
  const nodeRect = getInternalNodesBounds(nodes), nodesArray = Array.from(nodes.values()), zIndex = Math.max(...nodesArray.map((node) => node.internals.z + 1)), wrapperStyle2 = {
@@ -15662,11 +15928,11 @@ function createIsCircular(areItemsEqual) {
15662
15928
  return cache.delete(a), cache.delete(b), result;
15663
15929
  };
15664
15930
  }
15665
- function getStrictProperties(object) {
15666
- return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
15931
+ function getStrictProperties(object2) {
15932
+ return getOwnPropertyNames(object2).concat(getOwnPropertySymbols(object2));
15667
15933
  }
15668
- var hasOwn = Object.hasOwn || function(object, property) {
15669
- return hasOwnProperty.call(object, property);
15934
+ var hasOwn = Object.hasOwn || function(object2, property) {
15935
+ return hasOwnProperty.call(object2, property);
15670
15936
  };
15671
15937
  function sameValueZeroEqual(a, b) {
15672
15938
  return a === b || !a && !b && a !== a && b !== b;
@@ -16169,21 +16435,6 @@ let atom = (initialValue) => {
16169
16435
  };
16170
16436
  return $atom;
16171
16437
  };
16172
- function listenKeys($store, keys2, listener) {
16173
- let keysSet = new Set(keys2).add(void 0);
16174
- return $store.listen((value, oldValue, changed) => {
16175
- keysSet.has(changed) && listener(value, oldValue, changed);
16176
- });
16177
- }
16178
- let emit = (snapshotRef, onChange) => (value) => {
16179
- snapshotRef.current !== value && (snapshotRef.current = value, onChange());
16180
- };
16181
- function useStore(store, { keys: keys2, deps = [store, keys2] } = {}) {
16182
- let snapshotRef = useRef();
16183
- snapshotRef.current = store.get();
16184
- let subscribe = useCallback((onChange) => (emit(snapshotRef, onChange)(store.value), keys2?.length > 0 ? listenKeys(store, keys2, emit(snapshotRef, onChange)) : store.listen(emit(snapshotRef, onChange))), deps), get2 = () => snapshotRef.current;
16185
- return useSyncExternalStore(subscribe, get2, get2);
16186
- }
16187
16438
  const ReduceGraphicsModeCtx = createContext(null);
16188
16439
  function useIsReducedGraphics() {
16189
16440
  const isReduced = useContext(ReduceGraphicsModeCtx);
@@ -16196,10 +16447,10 @@ function ReduceGraphicsContext({ reduceGraphics, children: children2 }) {
16196
16447
  const $isPanningRef = useRef(null);
16197
16448
  return $isPanningRef.current || ($isPanningRef.current = atom(reduceGraphics)), /* @__PURE__ */ jsx(PanningAtomSafeCtx, { value: $isPanningRef.current, children: /* @__PURE__ */ jsx(ReduceGraphicsModeCtx.Provider, { value: reduceGraphics, children: children2 }) });
16198
16449
  }
16199
- function useIsPanning() {
16200
- return useStore(usePanningAtom());
16201
- }
16202
16450
  const LikeC4ModelContext = createContext(null), CurrentViewModelContext = createContext(null);
16451
+ function EnsureCurrentViewModel({ children: children2 }) {
16452
+ return useContext(CurrentViewModelContext) ? /* @__PURE__ */ jsx(Fragment$1, { children: children2 }) : null;
16453
+ }
16203
16454
  function useLikeC4Model() {
16204
16455
  const model = useContext(LikeC4ModelContext);
16205
16456
  if (!model)
@@ -16285,7 +16536,7 @@ function RootContainer({
16285
16536
  }) {
16286
16537
  const id2 = useId$1(), ref = useRef(null), $isPanning = usePanningAtom();
16287
16538
  return useEffect(() => $isPanning.listen((isPanning) => {
16288
- isPanning ? ref.current?.setAttribute("data-likec4-diagram-panning", "true") : ref.current?.removeAttribute("data-likec4-diagram-panning");
16539
+ ref.current?.setAttribute("data-likec4-diagram-panning", isPanning ? "true" : "false");
16289
16540
  }), [$isPanning]), /* @__PURE__ */ jsx(
16290
16541
  Box,
16291
16542
  {
@@ -16324,18 +16575,29 @@ function useUpdateEffect(callback, deps, equalityFn, effectHook) {
16324
16575
  }
16325
16576
  const useXYFlow = useReactFlow;
16326
16577
  function useXYStore(selector2, equalityFn) {
16327
- return useStore$1(
16578
+ return useStore(
16328
16579
  useCallbackRef(selector2),
16329
16580
  equalityFn ?? shallowEqual
16330
16581
  );
16331
16582
  }
16332
16583
  const useXYStoreApi = useStoreApi, useXYInternalNode = useInternalNode, selectCurrentZoom = (state) => Math.round(state.transform[2] * 100) / 100;
16333
16584
  function useCurrentZoom() {
16334
- return useStore$1(selectCurrentZoom);
16585
+ return useStore(selectCurrentZoom);
16335
16586
  }
16336
16587
  const selectZoom = (state) => state.transform[2] < 0.2;
16337
16588
  function useIsZoomTooSmall() {
16338
- return useStore$1(selectZoom);
16589
+ return useStore(selectZoom);
16590
+ }
16591
+ function getDevicePixelRatio() {
16592
+ const dpr = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : 1;
16593
+ return u(Math.floor(dpr), {
16594
+ min: 1,
16595
+ max: 4
16596
+ });
16597
+ }
16598
+ let knownDpr;
16599
+ function roundDpr(v) {
16600
+ return knownDpr ??= getDevicePixelRatio(), knownDpr < 2 ? Math.round(v) : Math.round(v * knownDpr) / knownDpr;
16339
16601
  }
16340
16602
  const { abs: abs$1, cos: cos$1, sin: sin$1, acos: acos$1, atan2, sqrt: sqrt$1, pow } = Math;
16341
16603
  function crt(v) {
@@ -17270,9 +17532,6 @@ class Bezier {
17270
17532
  return circles;
17271
17533
  }
17272
17534
  }
17273
- function toDomPrecision(v) {
17274
- return v === null ? 0.01 : Math.round(v * 100) / 100;
17275
- }
17276
17535
  function bezierControlPoints(diagramEdge) {
17277
17536
  let [start2, ...bezierPoints] = diagramEdge.points;
17278
17537
  invariant(start2, "start should be defined");
@@ -17681,7 +17940,11 @@ class Actor {
17681
17940
  return;
17682
17941
  const allListeners = [...listeners ? listeners.values() : [], ...wildcardListener ? wildcardListener.values() : []];
17683
17942
  for (const handler of allListeners)
17684
- handler(emittedEvent);
17943
+ try {
17944
+ handler(emittedEvent);
17945
+ } catch (err) {
17946
+ reportUnhandledError(err);
17947
+ }
17685
17948
  },
17686
17949
  actionExecutor: (action) => {
17687
17950
  const exec = () => {
@@ -19196,6 +19459,7 @@ function useDiagram() {
19196
19459
  * @warning Do not use in render phase
19197
19460
  */
19198
19461
  findDiagramNode: (xynodeId) => findDiagramNode(actor.getSnapshot().context, xynodeId),
19462
+ findEdge: (xyedgeId) => actor.getSnapshot().context.xyedges.find((e2) => e2.data.id === xyedgeId) ?? null,
19199
19463
  /**
19200
19464
  * @warning Do not use in render phase
19201
19465
  */
@@ -19231,6 +19495,17 @@ function useDiagramContext(selector2, compare = shallowEqual, deps) {
19231
19495
  const actorRef = useDiagramActorRef(), select2 = useCallback((s2) => selector2(s2.context), deps ?? []);
19232
19496
  return useSelector(actorRef, select2, compare);
19233
19497
  }
19498
+ function useOnDiagramEvent(event, callback) {
19499
+ const actorRef = useDiagramActorRef(), callbackRef = useRef(callback);
19500
+ callbackRef.current = callback, useEffect(() => {
19501
+ const subscription = actorRef.on(event, (event2) => {
19502
+ callbackRef.current(event2);
19503
+ });
19504
+ return () => {
19505
+ subscription.unsubscribe();
19506
+ };
19507
+ }, [actorRef]);
19508
+ }
19234
19509
  const createRecipe = (name, defaultVariants, compoundVariants) => {
19235
19510
  const getVariantProps2 = (variants) => ({
19236
19511
  [name]: "__ignore__",
@@ -19304,6 +19579,35 @@ const createRecipe = (name, defaultVariants, compoundVariants) => {
19304
19579
  return splitProps(props, actionBtnVariantKeys);
19305
19580
  },
19306
19581
  getVariantProps: actionBtnFn.getVariantProps
19582
+ }), compoundNodeFn = /* @__PURE__ */ createRecipe("likec4-compound-node", {}, []), compoundNodeVariantMap = {
19583
+ isTransparent: [
19584
+ "false",
19585
+ "true"
19586
+ ],
19587
+ inverseColor: [
19588
+ "true",
19589
+ "false"
19590
+ ],
19591
+ borderStyle: [
19592
+ "solid",
19593
+ "dashed",
19594
+ "dotted",
19595
+ "none"
19596
+ ]
19597
+ }, compoundNodeVariantKeys = Object.keys(compoundNodeVariantMap), compoundNode = /* @__PURE__ */ Object.assign(memo(compoundNodeFn.recipeFn), {
19598
+ __recipe__: !0,
19599
+ __name__: "compoundNode",
19600
+ __getCompoundVariantCss__: compoundNodeFn.__getCompoundVariantCss__,
19601
+ raw: (props) => props,
19602
+ variantKeys: compoundNodeVariantKeys,
19603
+ variantMap: compoundNodeVariantMap,
19604
+ merge(recipe) {
19605
+ return mergeRecipes(this, recipe);
19606
+ },
19607
+ splitVariantProps(props) {
19608
+ return splitProps(props, compoundNodeVariantKeys);
19609
+ },
19610
+ getVariantProps: compoundNodeFn.getVariantProps
19307
19611
  }), elementNodeIconFn = /* @__PURE__ */ createRecipe("likec4-element-node-icon", {}, []), elementNodeIconVariantMap = {}, elementNodeIconVariantKeys = Object.keys(elementNodeIconVariantMap), elementNodeIcon = /* @__PURE__ */ Object.assign(memo(elementNodeIconFn.recipeFn), {
19308
19612
  __recipe__: !0,
19309
19613
  __name__: "elementNodeIcon",
@@ -19318,6 +19622,25 @@ const createRecipe = (name, defaultVariants, compoundVariants) => {
19318
19622
  return splitProps(props, elementNodeIconVariantKeys);
19319
19623
  },
19320
19624
  getVariantProps: elementNodeIconFn.getVariantProps
19625
+ }), elementShapeRecipeFn = /* @__PURE__ */ createRecipe("likec4-element-shape", {}, []), elementShapeRecipeVariantMap = {
19626
+ shapetype: [
19627
+ "html",
19628
+ "svg"
19629
+ ]
19630
+ }, elementShapeRecipeVariantKeys = Object.keys(elementShapeRecipeVariantMap), elementShapeRecipe = /* @__PURE__ */ Object.assign(memo(elementShapeRecipeFn.recipeFn), {
19631
+ __recipe__: !0,
19632
+ __name__: "elementShapeRecipe",
19633
+ __getCompoundVariantCss__: elementShapeRecipeFn.__getCompoundVariantCss__,
19634
+ raw: (props) => props,
19635
+ variantKeys: elementShapeRecipeVariantKeys,
19636
+ variantMap: elementShapeRecipeVariantMap,
19637
+ merge(recipe) {
19638
+ return mergeRecipes(this, recipe);
19639
+ },
19640
+ splitVariantProps(props) {
19641
+ return splitProps(props, elementShapeRecipeVariantKeys);
19642
+ },
19643
+ getVariantProps: elementShapeRecipeFn.getVariantProps
19321
19644
  }), likec4tagFn = /* @__PURE__ */ createRecipe("likec4-tag", {
19322
19645
  autoTextColor: !1
19323
19646
  }, []), likec4tagVariantMap = {
@@ -19430,19 +19753,7 @@ function createMinimalMotionComponent(Component, options) {
19430
19753
  }
19431
19754
  const MotionButton = /* @__PURE__ */ createMinimalMotionComponent("button"), MotionDiv = /* @__PURE__ */ createMinimalMotionComponent("div"), MotionSpan = /* @__PURE__ */ createMinimalMotionComponent("span"), compoundActionBtn = cva({
19432
19755
  base: {
19433
- transitionDuration: "normal",
19434
- "[data-compound-title-inverse] &": {
19435
- _dark: {
19436
- "--actionbtn-color": "color-mix(in srgb, var(--likec4-palette-loContrast) 60%, var(--likec4-palette-fill))"
19437
- },
19438
- _light: {
19439
- "--actionbtn-color": "var(--likec4-palette-stroke)",
19440
- "--actionbtn-color-hovered": "var(--likec4-palette-stroke)",
19441
- "--actionbtn-color-hovered-btn": "var(--likec4-palette-hiContrast)",
19442
- "--actionbtn-bg-hovered": "var(--likec4-palette-fill)/50",
19443
- "--actionbtn-bg-hovered-btn": "var(--likec4-palette-fill)"
19444
- }
19445
- }
19756
+ transitionDuration: "normal"
19446
19757
  },
19447
19758
  variants: {
19448
19759
  delay: {
@@ -19465,49 +19776,35 @@ function CompoundActionButton({
19465
19776
  }) {
19466
19777
  const isHoverDebounced = useDebouncedValue(isHovered, isHovered ? 130 : 0)[0] && isHovered;
19467
19778
  return /* @__PURE__ */ jsx(
19468
- Box,
19779
+ MotionDiv,
19469
19780
  {
19470
- className: cx(
19471
- css({
19472
- position: "absolute",
19473
- top: "[5px]",
19474
- left: "[4px]",
19475
- _smallZoom: {
19476
- display: "none"
19477
- }
19478
- }),
19479
- "compound-action"
19480
- ),
19781
+ initial: !1,
19782
+ animate: {
19783
+ scale: isHoverDebounced ? 1.2 : 1,
19784
+ x: isHoverDebounced ? -1 : 0,
19785
+ y: isHoverDebounced ? -1 : 0
19786
+ },
19787
+ whileHover: {
19788
+ scale: 1.4,
19789
+ x: -3,
19790
+ y: -1
19791
+ },
19792
+ className: "likec4-compound-navigation compound-action",
19793
+ whileTap: { scale: 1 },
19794
+ onClick: stopPropagation,
19481
19795
  children: /* @__PURE__ */ jsx(
19482
- MotionDiv,
19796
+ ActionIcon,
19483
19797
  {
19484
- initial: !1,
19485
- animate: {
19486
- scale: isHoverDebounced ? 1.2 : 1,
19487
- x: isHoverDebounced ? -1 : 0,
19488
- y: isHoverDebounced ? -1 : 0
19489
- },
19490
- whileHover: {
19491
- scale: 1.4,
19492
- x: -2,
19493
- y: -2
19494
- },
19495
- whileTap: { scale: 1 },
19496
- children: /* @__PURE__ */ jsx(
19497
- ActionIcon,
19498
- {
19499
- className: cx(
19500
- "nodrag nopan",
19501
- compoundActionBtn({
19502
- delay: isHovered && !isHoverDebounced
19503
- }),
19504
- actionBtn()
19505
- ),
19506
- onClick,
19507
- onDoubleClick: stopPropagation,
19508
- children: icon ?? /* @__PURE__ */ jsx(IconZoomScan, { stroke: 2 })
19509
- }
19510
- )
19798
+ className: cx(
19799
+ "nodrag nopan",
19800
+ compoundActionBtn({
19801
+ delay: isHovered && !isHoverDebounced
19802
+ }),
19803
+ actionBtn({ variant: "transparent" })
19804
+ ),
19805
+ onClick,
19806
+ onDoubleClick: stopPropagation,
19807
+ children: icon ?? /* @__PURE__ */ jsx(IconZoomScan, { stroke: 2 })
19511
19808
  }
19512
19809
  )
19513
19810
  }
@@ -19522,180 +19819,36 @@ function CompoundDetailsButton({
19522
19819
  }) {
19523
19820
  const isHoverDebounced = useDebouncedValue(isHovered, isHovered ? 130 : 0)[0] && isHovered;
19524
19821
  return /* @__PURE__ */ jsx(
19525
- Box,
19822
+ MotionDiv,
19526
19823
  {
19527
- className: cx(
19528
- css({
19529
- position: "absolute",
19530
- top: "0.5",
19531
- right: "0.5",
19532
- _smallZoom: {
19533
- display: "none"
19534
- }
19535
- }),
19536
- "details-button"
19537
- ),
19538
- onClick: stopPropagation,
19824
+ initial: !1,
19825
+ animate: {
19826
+ scale: isHoverDebounced ? 1.2 : 1
19827
+ // opacity: isHoverDebounced ? 1 : 0.6,
19828
+ },
19829
+ whileHover: {
19830
+ scale: 1.4
19831
+ },
19832
+ whileTap: { scale: 1 },
19833
+ className: "likec4-compound-details details-button",
19539
19834
  children: /* @__PURE__ */ jsx(
19540
- MotionDiv,
19835
+ ActionIcon,
19541
19836
  {
19542
- initial: !1,
19543
- animate: {
19544
- scale: isHoverDebounced ? 1.2 : 1,
19545
- opacity: isHoverDebounced ? 1 : 0.6
19546
- },
19547
- whileHover: {
19548
- scale: 1.4
19549
- },
19550
- whileTap: { scale: 1 },
19551
- children: /* @__PURE__ */ jsx(
19552
- ActionIcon,
19553
- {
19554
- className: cx(
19555
- "nodrag nopan",
19556
- compoundActionBtn({
19557
- delay: isHovered && !isHoverDebounced
19558
- }),
19559
- css({
19560
- _whenHovered: {
19561
- opacity: 0.75
19562
- },
19563
- _hover: {
19564
- opacity: 1
19565
- }
19566
- }),
19567
- actionBtn({ variant: "transparent" })
19568
- ),
19569
- onClick,
19570
- onDoubleClick: stopPropagation,
19571
- children: icon ?? /* @__PURE__ */ jsx(IconId, { stroke: 1.8, style: { width: "75%" } })
19572
- }
19573
- )
19837
+ className: cx(
19838
+ "nodrag nopan",
19839
+ compoundActionBtn({
19840
+ delay: isHovered && !isHoverDebounced
19841
+ }),
19842
+ actionBtn({ variant: "transparent" })
19843
+ ),
19844
+ onClick,
19845
+ onDoubleClick: stopPropagation,
19846
+ children: icon ?? /* @__PURE__ */ jsx(IconId, { stroke: 1.8, style: { width: "75%" } })
19574
19847
  }
19575
19848
  )
19576
19849
  }
19577
19850
  );
19578
19851
  }
19579
- const borderWidth = {
19580
- var: "--_border-width",
19581
- ref: "var(--_border-width, 2px)"
19582
- }, borderRadius$1 = {
19583
- var: "--_border-radius",
19584
- ref: "var(--_border-radius, 4px)"
19585
- }, compoundOpacity = {
19586
- var: "--_compound-opacity",
19587
- ref: "var(--_compound-opacity, 1)"
19588
- }, borderOpacityPercent = {
19589
- var: "--_border-opacity-percent",
19590
- ref: "var(--_border-opacity-percent, 100%)"
19591
- }, root = css.raw({
19592
- position: "relative",
19593
- width: "100%",
19594
- height: "100%",
19595
- padding: "0",
19596
- margin: "0",
19597
- border: "transparent",
19598
- pointerEvents: "none",
19599
- _before: {
19600
- borderRadius: borderRadius$1.ref,
19601
- content: '" "',
19602
- position: "absolute",
19603
- top: "0",
19604
- left: "0",
19605
- width: "100%",
19606
- height: "100%",
19607
- border: "transparent",
19608
- background: "var(--likec4-palette-fill)",
19609
- backgroundClip: "padding-box",
19610
- transitionDelay: ".075ms"
19611
- },
19612
- _noReduceGraphics: {
19613
- _before: {
19614
- transition: "all {durations.slow} {easings.inOut}"
19615
- },
19616
- "&[data-likec4-hovered='true']": {
19617
- _before: {
19618
- transitionDelay: ".2s",
19619
- transitionTimingFunction: "in"
19620
- }
19621
- }
19622
- },
19623
- "&:is([data-compound-transparent])": {
19624
- _before: {
19625
- opacity: compoundOpacity.ref,
19626
- borderWidth: `calc(${borderWidth.ref} - 1px)`
19627
- }
19628
- }
19629
- }), compoundBorder = css.raw({
19630
- borderRadius: borderRadius$1.ref,
19631
- padding: "0",
19632
- margin: "0",
19633
- transition: "all 250ms {easings.inOut}",
19634
- cursor: "default",
19635
- position: "absolute",
19636
- top: "0",
19637
- left: "0",
19638
- width: "100%",
19639
- height: "100%",
19640
- pointerEvents: "none",
19641
- background: "transparent",
19642
- borderStyle: "dashed",
19643
- borderWidth: `[${borderWidth.ref}]`,
19644
- borderColor: `[color-mix(in srgb, var(--likec4-palette-stroke) ${borderOpacityPercent.ref}, transparent)]`
19645
- }), indicatorSvg = css.raw({
19646
- position: "absolute",
19647
- top: "0",
19648
- left: "0",
19649
- width: "100%",
19650
- height: "100%",
19651
- pointerEvents: "none",
19652
- overflow: "visible",
19653
- visibility: "hidden",
19654
- _whenFocused: {
19655
- visibility: "visible"
19656
- },
19657
- _whenSelected: {
19658
- visibility: "visible"
19659
- },
19660
- _whenPanning: {
19661
- display: "none"
19662
- }
19663
- }), indicatorRect = css.raw({
19664
- stroke: "[color-mix(in srgb, var(--likec4-palette-stroke) 60%, var(--likec4-palette-hiContrast))]",
19665
- strokeWidth: "4",
19666
- fill: "[none]",
19667
- animationStyle: "indicator",
19668
- _light: {
19669
- stroke: "[color-mix(in srgb, var(--likec4-palette-stroke) 80%, var(--likec4-palette-hiContrast))]"
19670
- }
19671
- }), compound = sva({
19672
- slots: ["root", "compoundBorder", "indicatorSvg", "indicatorRect"],
19673
- className: "compound-container",
19674
- base: {
19675
- root,
19676
- compoundBorder,
19677
- indicatorSvg,
19678
- indicatorRect
19679
- },
19680
- variants: {
19681
- isTransparent: {
19682
- false: {
19683
- root: {
19684
- _before: {
19685
- boxShadow: {
19686
- _noReduceGraphics: "0 4px 10px 0.5px rgba(0,0,0,0.1) , 0 2px 2px -1px rgba(0,0,0,0.4)",
19687
- _whenSelected: "none",
19688
- _whenPanning: "none !important"
19689
- }
19690
- }
19691
- }
19692
- },
19693
- true: {
19694
- root: {}
19695
- }
19696
- }
19697
- }
19698
- });
19699
19852
  function CompoundNodeContainer({
19700
19853
  nodeProps: {
19701
19854
  selected: isSelected = !1,
@@ -19710,136 +19863,46 @@ function CompoundNodeContainer({
19710
19863
  style: style2,
19711
19864
  ...rest
19712
19865
  }) {
19713
- const isReducedGraphics = useIsReducedGraphics(), isTransparent = e(data.style.opacity) && data.style.opacity < 99;
19714
- let opacity = u((data.style.opacity ?? 100) / 100, {
19866
+ let opacity = u(data.style.opacity ?? 100, {
19715
19867
  min: 0,
19716
- max: 1
19868
+ max: 100
19717
19869
  });
19718
- isTransparent && isHovered && !isReducedGraphics && (opacity = Math.min(opacity + 0.08, 1));
19719
- const MIN_OPACITY = 65, borderOpacity = MIN_OPACITY + u((100 - MIN_OPACITY) * opacity, {
19870
+ const isTransparent = opacity < 99, MIN_OPACITY = 65, borderOpacity = MIN_OPACITY + u((100 - MIN_OPACITY) * (opacity / 100), {
19720
19871
  min: 0,
19721
19872
  max: 100 - MIN_OPACITY
19722
- }), classes2 = compound({
19723
- isTransparent
19873
+ }), compoundClass = compoundNode({
19874
+ isTransparent,
19875
+ inverseColor: opacity < 60,
19876
+ borderStyle: data.style.border ?? (isTransparent ? "dashed" : "none")
19724
19877
  }), depth = u(data.depth ?? 1, {
19725
19878
  min: 1,
19726
19879
  max: 5
19727
19880
  });
19728
- return /* @__PURE__ */ jsxs(
19881
+ return /* @__PURE__ */ jsx(
19729
19882
  m.div,
19730
19883
  {
19731
19884
  className: cx(
19732
- classes2.root,
19733
- "likec4-compound-node",
19885
+ compoundClass,
19734
19886
  className
19735
19887
  ),
19736
19888
  initial: !1,
19737
19889
  "data-likec4-hovered": isHovered,
19738
19890
  "data-likec4-color": data.color,
19739
19891
  "data-compound-depth": depth,
19740
- ...isTransparent && {
19741
- "data-compound-transparent": !0,
19742
- "data-compound-title-inverse": opacity < 0.5
19743
- },
19744
19892
  ...isDimmed !== !1 && {
19745
19893
  "data-likec4-dimmed": isDimmed
19746
19894
  },
19747
19895
  style: {
19748
19896
  ...style2,
19749
19897
  // @ts-expect-error
19750
- [compoundOpacity.var]: opacity,
19751
- [borderWidth.var]: "3px",
19752
- [borderRadius$1.var]: "6px",
19753
- [borderOpacityPercent.var]: `${borderOpacity}%`
19898
+ "--_border-transparency": `${borderOpacity}%`,
19899
+ "--_compound-transparency": `${opacity}%`
19754
19900
  },
19755
19901
  ...rest,
19756
- children: [
19757
- isTransparent && data.style.border !== "none" && /* @__PURE__ */ jsx(
19758
- "div",
19759
- {
19760
- className: classes2.compoundBorder,
19761
- style: {
19762
- borderStyle: data.style.border ?? "dashed"
19763
- }
19764
- }
19765
- ),
19766
- /* @__PURE__ */ jsx("svg", { className: classes2.indicatorSvg, children: /* @__PURE__ */ jsx(
19767
- "rect",
19768
- {
19769
- className: classes2.indicatorRect,
19770
- x: 0,
19771
- y: 0,
19772
- width: "100%",
19773
- height: "100%",
19774
- rx: 6
19775
- }
19776
- ) }),
19777
- children2
19778
- ]
19902
+ children: children2
19779
19903
  }
19780
19904
  );
19781
19905
  }
19782
- const titleContainer = css({
19783
- position: "absolute",
19784
- display: "flex",
19785
- alignItems: "center",
19786
- gap: "1.5",
19787
- // 6px
19788
- left: "[14px]",
19789
- top: "[4px]",
19790
- right: "[30px]",
19791
- width: "auto",
19792
- minHeight: "30px",
19793
- ":where(.react-flow__node.draggable) &": {
19794
- pointerEvents: "all",
19795
- cursor: "grab"
19796
- },
19797
- ".likec4-compound-node:has(.compound-action) &": {
19798
- paddingLeft: "[22px]"
19799
- }
19800
- }), titleText = css({
19801
- flex: "1",
19802
- fontFamily: "likec4.compound",
19803
- fontWeight: 600,
19804
- fontSize: "15px",
19805
- textTransform: "uppercase",
19806
- letterSpacing: "0.2px",
19807
- color: "var(--likec4-palette-loContrast)",
19808
- "[data-compound-title-inverse] &": {
19809
- color: {
19810
- base: "[color-mix(in srgb, var(--likec4-palette-loContrast) 60%, var(--likec4-palette-fill))]",
19811
- _light: "var(--likec4-palette-stroke)"
19812
- }
19813
- }
19814
- }), iconSize = "20px", cssIcon = css({
19815
- flex: `0 0 ${iconSize}`,
19816
- height: `${iconSize}`,
19817
- width: `${iconSize}`,
19818
- display: "flex",
19819
- alignItems: "center",
19820
- justifyContent: "center",
19821
- mixBlendMode: {
19822
- base: "hard-light",
19823
- _reduceGraphicsOnPan: "normal"
19824
- },
19825
- "& svg, & img": {
19826
- width: "100%",
19827
- height: "auto",
19828
- maxHeight: "100%",
19829
- pointerEvents: "none",
19830
- filter: {
19831
- base: [
19832
- "drop-shadow(0 0 3px rgb(0 0 0 / 12%))",
19833
- "drop-shadow(0 1px 8px rgb(0 0 0 / 8%))",
19834
- "drop-shadow(1px 1px 16px rgb(0 0 0 / 3%))"
19835
- ],
19836
- _reduceGraphicsOnPan: "none"
19837
- }
19838
- },
19839
- "& img": {
19840
- objectFit: "contain"
19841
- }
19842
- });
19843
19906
  function CompoundTitle({ id: id2, data }) {
19844
19907
  const elementIcon = IconRenderer({
19845
19908
  element: {
@@ -19847,35 +19910,21 @@ function CompoundTitle({ id: id2, data }) {
19847
19910
  title: data.title,
19848
19911
  icon: data.icon
19849
19912
  },
19850
- className: cssIcon
19913
+ className: "likec4-compound-icon"
19851
19914
  });
19852
- return /* @__PURE__ */ jsxs(
19853
- Box,
19854
- {
19855
- className: cx(
19856
- titleContainer,
19857
- "likec4-compound-title"
19858
- ),
19859
- children: [
19860
- elementIcon,
19861
- /* @__PURE__ */ jsx(Text, { className: titleText, truncate: "end", children: data.title })
19862
- ]
19863
- }
19864
- );
19915
+ return /* @__PURE__ */ jsxs("div", { className: "likec4-compound-title-container", children: [
19916
+ elementIcon,
19917
+ /* @__PURE__ */ jsx(Text, { component: "h3", className: "likec4-compound-title", truncate: "end", children: data.title })
19918
+ ] });
19919
+ }
19920
+ function nodePropsEqual(prev, next) {
19921
+ return prev.id === next.id && deepEqual(prev.selected ?? !1, next.selected ?? !1) && deepEqual(prev.dragging ?? !1, next.dragging ?? !1) && deepEqual(prev.width ?? 0, next.width ?? 0) && deepEqual(prev.height ?? 0, next.height ?? 0) && deepEqual(prev.zIndex ?? 0, next.zIndex ?? 0) && deepEqual(prev.data, next.data);
19865
19922
  }
19866
- const style = {
19867
- top: "50%",
19868
- left: "50%",
19869
- visibility: "hidden"
19870
- }, DefaultHandles = () => /* @__PURE__ */ jsxs(Fragment$1, { children: [
19871
- /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style }),
19872
- /* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom, style })
19873
- ] }), nodePropsEqual = (prev, next) => prev.id === next.id && deepEqual(prev.selected ?? !1, next.selected ?? !1) && deepEqual(prev.dragging ?? !1, next.dragging ?? !1) && deepEqual(prev.width ?? 0, next.width ?? 0) && deepEqual(prev.height ?? 0, next.height ?? 0) && deepEqual(prev.zIndex ?? 0, next.zIndex ?? 0) && deepEqual(prev.data, next.data);
19874
19923
  function customNode(Node2) {
19875
- const NodeComponent = memo$1((props) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
19876
- /* @__PURE__ */ jsx(Node2, { ...props }),
19877
- /* @__PURE__ */ jsx(DefaultHandles, {})
19878
- ] }), nodePropsEqual);
19924
+ const NodeComponent = memo$1(
19925
+ Node2,
19926
+ (prev, next) => nodePropsEqual(prev, next)
19927
+ );
19879
19928
  return NodeComponent.displayName = "Node", NodeComponent;
19880
19929
  }
19881
19930
  const container$2 = css({
@@ -20124,107 +20173,8 @@ const ElementNodeContainer = forwardRef(({
20124
20173
  );
20125
20174
  });
20126
20175
  ElementNodeContainer.displayName = "ElementNodeContainer";
20127
- const indicator = css({
20128
- _smallZoom: {
20129
- visibility: "hidden"
20130
- },
20131
- stroke: "var(--likec4-palette-loContrast)",
20132
- fill: "[none]",
20133
- strokeWidth: 8,
20134
- strokeOpacity: 0.8,
20135
- visibility: "hidden",
20136
- pointerEvents: "none",
20137
- _light: {
20138
- stroke: "[color-mix(in srgb, var(--likec4-palette-fill) 50%,rgb(121, 121, 121))]"
20139
- },
20140
- _whenFocused: {
20141
- visibility: "visible"
20142
- },
20143
- _groupFocusVisible: {
20144
- visibility: "visible"
20145
- },
20146
- _whenSelected: {
20147
- animationStyle: "indicator",
20148
- visibility: "visible"
20149
- }
20150
- }), fillElementFill = css({
20151
- fill: "var(--likec4-palette-fill)"
20152
- });
20153
- css({
20154
- fill: "var(--likec4-palette-stroke)"
20155
- });
20156
- const fillMixStroke = css({
20157
- fill: "[color-mix(in srgb, var(--likec4-palette-stroke) 90%, var(--likec4-palette-fill))]",
20158
- ".shape-svg-multiple &": {
20159
- fill: "var(--likec4-palette-fill)"
20160
- }
20161
- }), shapeBase = css.raw({
20162
- top: "0",
20163
- left: "0",
20164
- position: "absolute",
20165
- width: "100%",
20166
- height: "100%",
20167
- pointerEvents: "none",
20168
- fill: "var(--likec4-palette-fill)",
20169
- stroke: "var(--likec4-palette-stroke)",
20170
- overflow: "visible"
20171
- // zIndex is removed to improve rendering performance
20172
- // this forces to keep shape in the same layer as the node
20173
- // zIndex: -1,
20174
- }), shapeSvgMultiple = cx(
20175
- "shape-svg-multiple",
20176
- css(shapeBase, {
20177
- transformOrigin: {
20178
- base: "50% 50%",
20179
- _shapeQueue: "75% 25%",
20180
- _shapeCylinder: "50% 100%",
20181
- _shapeStorage: "50% 100%"
20182
- },
20183
- transform: "translate(14px, 14px) perspective(300px) translateZ(-8px)",
20184
- filter: "brightness(0.65) saturate(0.8)",
20185
- stroke: "[none]",
20186
- display: {
20187
- _smallZoom: "none",
20188
- _reduceGraphicsOnPan: "none",
20189
- _whenSelected: "none",
20190
- _whenFocused: "none"
20191
- }
20192
- })
20193
- ), shapeSvg = css(shapeBase, {
20194
- transition: "fill 120ms linear, filter 130ms {easings.inOut}",
20195
- transitionDelay: "0ms",
20196
- filter: `
20197
- drop-shadow(0 2px 1px rgba(0, 0, 0, 0.21))
20198
- drop-shadow(0 1px 1px color-mix(in srgb, var(--likec4-palette-stroke) 40%, transparent))
20199
- drop-shadow(0 5px 3px rgba(0, 0, 0, 0.1))
20200
- `,
20201
- _whenHovered: {
20202
- filter: `
20203
- drop-shadow(0 2px 1px rgba(0, 0, 0, 0.25))
20204
- drop-shadow(0 8px 3px rgba(0, 0, 0, 0.1))
20205
- drop-shadow(0 10px 10px rgba(0, 0, 0, 0.05))
20206
- `
20207
- },
20208
- ":where([data-likec4-level='true']) &": {
20209
- filter: `
20210
- drop-shadow(0 2px 1px rgba(0, 0, 0, 0.25))
20211
- drop-shadow(0 8px 3px rgba(0, 0, 0, 0.1))
20212
- drop-shadow(0 10px 10px rgba(0, 0, 0, 0.05))
20213
- `
20214
- },
20215
- _whenSelected: {
20216
- filter: "none"
20217
- },
20218
- _smallZoom: {
20219
- filter: "none"
20220
- },
20221
- _whenPanning: {
20222
- transition: "none",
20223
- filter: "none"
20224
- }
20225
- });
20226
20176
  function cylinderSVGPath(diameter, height, tilt = 0.065) {
20227
- const radius = Math.round(diameter / 2), rx = radius, ry = toDomPrecision(tilt * radius), tiltAdjustedHeight = height - 2 * ry;
20177
+ const radius = Math.round(diameter / 2), rx = radius, ry = roundDpr(tilt * radius), tiltAdjustedHeight = height - 2 * ry;
20228
20178
  return {
20229
20179
  path: ` M ${diameter},${ry}
20230
20180
  a ${rx},${ry} 0,0,0 ${-diameter} 0
@@ -20238,7 +20188,7 @@ function cylinderSVGPath(diameter, height, tilt = 0.065) {
20238
20188
  };
20239
20189
  }
20240
20190
  function queueSVGPath(width, height, tilt = 0.185) {
20241
- const diameter = height, ry = Math.round(diameter / 2), rx = toDomPrecision(diameter / 2 * tilt), tiltAdjustedWidth = width - 2 * rx;
20191
+ const diameter = height, ry = Math.round(diameter / 2), rx = roundDpr(diameter / 2 * tilt), tiltAdjustedWidth = width - 2 * rx;
20242
20192
  return {
20243
20193
  path: `
20244
20194
  M ${rx},0
@@ -20255,7 +20205,7 @@ const PersonIcon = {
20255
20205
  height: 120,
20256
20206
  path: "M57.9197 0C10.9124 0 33.5766 54.75 33.5766 54.75C38.6131 62.25 45.3285 60.75 45.3285 66C45.3285 70.5 39.4526 72 33.5766 72.75C24.3431 72.75 15.9489 71.25 7.55474 84.75C2.51825 93 0 120 0 120H115C115 120 112.482 93 108.285 84.75C99.8905 70.5 91.4963 72.75 82.2628 72C76.3869 71.25 70.5109 69.75 70.5109 65.25C70.5109 60.75 77.2263 62.25 82.2628 54C82.2628 54.75 104.927 0 57.9197 0V0Z"
20257
20207
  };
20258
- function ElementShapeSvg({ shape, w, h }) {
20208
+ function ShapeSvg({ shape, w, h }) {
20259
20209
  switch (shape) {
20260
20210
  case "mobile":
20261
20211
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
@@ -20265,11 +20215,11 @@ function ElementShapeSvg({ shape, w, h }) {
20265
20215
  width: w,
20266
20216
  height: h,
20267
20217
  rx: 6,
20268
- className: fillMixStroke,
20218
+ "data-likec4-fill": "mix-stroke",
20269
20219
  strokeWidth: 0
20270
20220
  }
20271
20221
  ),
20272
- /* @__PURE__ */ jsxs("g", { className: fillElementFill, strokeWidth: 0, children: [
20222
+ /* @__PURE__ */ jsxs("g", { "data-likec4-fill": "fill", strokeWidth: 0, children: [
20273
20223
  /* @__PURE__ */ jsx("circle", { cx: 17, cy: h / 2, r: 12 }),
20274
20224
  /* @__PURE__ */ jsx("rect", { x: 33, y: 12, width: w - 44, height: h - 24, rx: 5 })
20275
20225
  ] })
@@ -20282,11 +20232,11 @@ function ElementShapeSvg({ shape, w, h }) {
20282
20232
  width: w,
20283
20233
  height: h,
20284
20234
  rx: 6,
20285
- className: fillMixStroke,
20235
+ "data-likec4-fill": "mix-stroke",
20286
20236
  strokeWidth: 0
20287
20237
  }
20288
20238
  ),
20289
- /* @__PURE__ */ jsxs("g", { className: fillElementFill, strokeWidth: 0, children: [
20239
+ /* @__PURE__ */ jsxs("g", { "data-likec4-fill": "fill", strokeWidth: 0, children: [
20290
20240
  /* @__PURE__ */ jsx("circle", { cx: 16, cy: 17, r: 7 }),
20291
20241
  /* @__PURE__ */ jsx("circle", { cx: 36, cy: 17, r: 7 }),
20292
20242
  /* @__PURE__ */ jsx("circle", { cx: 56, cy: 17, r: 7 }),
@@ -20313,7 +20263,7 @@ function ElementShapeSvg({ shape, w, h }) {
20313
20263
  width: PersonIcon.width,
20314
20264
  height: PersonIcon.height,
20315
20265
  viewBox: `0 0 ${PersonIcon.width} ${PersonIcon.height}`,
20316
- className: fillMixStroke,
20266
+ "data-likec4-fill": "mix-stroke",
20317
20267
  children: /* @__PURE__ */ jsx(
20318
20268
  "path",
20319
20269
  {
@@ -20328,7 +20278,7 @@ function ElementShapeSvg({ shape, w, h }) {
20328
20278
  const { path, rx, ry } = queueSVGPath(w, h);
20329
20279
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
20330
20280
  /* @__PURE__ */ jsx("path", { d: path, strokeWidth: 2 }),
20331
- /* @__PURE__ */ jsx("ellipse", { cx: rx, cy: ry, ry: ry - 0.75, rx, className: fillMixStroke, strokeWidth: 2 })
20281
+ /* @__PURE__ */ jsx("ellipse", { cx: rx, cy: ry, ry: ry - 0.75, rx, "data-likec4-fill": "mix-stroke", strokeWidth: 2 })
20332
20282
  ] });
20333
20283
  }
20334
20284
  case "storage":
@@ -20336,7 +20286,7 @@ function ElementShapeSvg({ shape, w, h }) {
20336
20286
  const { path, rx, ry } = cylinderSVGPath(w, h);
20337
20287
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
20338
20288
  /* @__PURE__ */ jsx("path", { d: path, strokeWidth: 2 }),
20339
- /* @__PURE__ */ jsx("ellipse", { cx: rx, cy: ry, ry, rx: rx - 0.75, className: fillMixStroke, strokeWidth: 2 })
20289
+ /* @__PURE__ */ jsx("ellipse", { cx: rx, cy: ry, ry, rx: rx - 0.75, "data-likec4-fill": "mix-stroke", strokeWidth: 2 })
20340
20290
  ] });
20341
20291
  }
20342
20292
  case "rectangle":
@@ -20353,14 +20303,33 @@ function ElementShapeSvg({ shape, w, h }) {
20353
20303
  return nonexhaustive(shape);
20354
20304
  }
20355
20305
  }
20306
+ function ShapeHtml({ multiple, withOutLine }) {
20307
+ return /* @__PURE__ */ jsxs(
20308
+ Box,
20309
+ {
20310
+ className: elementShapeRecipe({
20311
+ shapetype: "html"
20312
+ }),
20313
+ children: [
20314
+ multiple && /* @__PURE__ */ jsx("div", { className: "likec4-shape-multiple" }),
20315
+ withOutLine && /* @__PURE__ */ jsx("div", { className: "likec4-shape-outline" })
20316
+ ]
20317
+ }
20318
+ );
20319
+ }
20356
20320
  function ElementShape({ data, width, height, withSelectedIndicator = !0 }) {
20357
20321
  let w = width && width > 10 ? width : data.width, h = height && height > 10 ? height : data.height;
20358
20322
  const isMultiple = data.style?.multiple ?? !1;
20323
+ if (data.shape === "rectangle")
20324
+ return /* @__PURE__ */ jsx(ShapeHtml, { multiple: isMultiple, withOutLine: withSelectedIndicator });
20325
+ const className = elementShapeRecipe({
20326
+ shapetype: "svg"
20327
+ });
20359
20328
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
20360
- isMultiple && /* @__PURE__ */ jsx("svg", { className: cx(shapeSvgMultiple), viewBox: `0 0 ${w} ${h}`, children: /* @__PURE__ */ jsx(ElementShapeSvg, { shape: data.shape, w, h }) }),
20361
- /* @__PURE__ */ jsxs("svg", { className: shapeSvg, viewBox: `0 0 ${w} ${h}`, children: [
20329
+ isMultiple && /* @__PURE__ */ jsx("svg", { className, "data-likec4-shape-multiple": "true", viewBox: `0 0 ${w} ${h}`, children: /* @__PURE__ */ jsx(ShapeSvg, { shape: data.shape, w, h }) }),
20330
+ /* @__PURE__ */ jsxs("svg", { className, viewBox: `0 0 ${w} ${h}`, children: [
20362
20331
  withSelectedIndicator && /* @__PURE__ */ jsx(SelectedIndicator, { shape: data.shape, w, h }),
20363
- /* @__PURE__ */ jsx(ElementShapeSvg, { shape: data.shape, w, h })
20332
+ /* @__PURE__ */ jsx(ShapeSvg, { shape: data.shape, w, h })
20364
20333
  ] })
20365
20334
  ] });
20366
20335
  }
@@ -20389,10 +20358,10 @@ function SelectedIndicator({ shape, w, h }) {
20389
20358
  break;
20390
20359
  }
20391
20360
  }
20392
- return /* @__PURE__ */ jsx("g", { className: indicator, children: svg });
20361
+ return /* @__PURE__ */ jsx("g", { className: "likec4-shape-outline", children: svg });
20393
20362
  }
20394
20363
  const ElementTag = forwardRef(
20395
- ({ tag, cursor = "default", className, ...props }, ref) => {
20364
+ ({ tag, cursor, className, style: style2, ...props }, ref) => {
20396
20365
  const spec = useTagSpecification(tag);
20397
20366
  return /* @__PURE__ */ jsxs(
20398
20367
  Box,
@@ -20406,7 +20375,10 @@ const ElementTag = forwardRef(
20406
20375
  className
20407
20376
  ),
20408
20377
  ...props,
20409
- style: { cursor },
20378
+ style: {
20379
+ cursor,
20380
+ ...style2
20381
+ },
20410
20382
  children: [
20411
20383
  /* @__PURE__ */ jsx("span", { children: "#" }),
20412
20384
  /* @__PURE__ */ jsx("span", { children: tag })
@@ -20469,7 +20441,7 @@ const ElementTag = forwardRef(
20469
20441
  "data-likec4-tag": tag,
20470
20442
  className: css({
20471
20443
  layerStyle: "likec4.tag",
20472
- flex: 1,
20444
+ flex: "1",
20473
20445
  display: "flex",
20474
20446
  alignItems: "center",
20475
20447
  justifyContent: "center",
@@ -20504,9 +20476,9 @@ const ElementTag = forwardRef(
20504
20476
  ElementTag,
20505
20477
  {
20506
20478
  tag,
20479
+ cursor: "pointer",
20507
20480
  className: css({
20508
20481
  userSelect: "none",
20509
- cursor: "pointer",
20510
20482
  ...zoomIsLargeEnough && {
20511
20483
  fontSize: "lg",
20512
20484
  borderRadius: "[4px]",
@@ -20538,7 +20510,7 @@ const MarkdownBlock = forwardRef(({
20538
20510
  }, ref) => {
20539
20511
  if (value.isEmpty && hideIfEmpty)
20540
20512
  return null;
20541
- const content = value.nonEmpty ? { dangerouslySetInnerHTML: { __html: value.html } } : { children: /* @__PURE__ */ jsx(Text, { component: "span", fz: "xs", c: "dimmed", style: { userSelect: "none" }, children: emptyText }) };
20513
+ const content = value.nonEmpty ? value.isMarkdown ? { dangerouslySetInnerHTML: { __html: value.html } } : { children: /* @__PURE__ */ jsx("p", { children: value.text }) } : { children: /* @__PURE__ */ jsx(Text, { component: "span", fz: "xs", c: "dimmed", style: { userSelect: "none" }, children: emptyText }) };
20542
20514
  return /* @__PURE__ */ jsx(
20543
20515
  Box,
20544
20516
  {
@@ -20551,6 +20523,9 @@ const MarkdownBlock = forwardRef(({
20551
20523
  className
20552
20524
  ),
20553
20525
  style: {
20526
+ ...props.fontSize && {
20527
+ "--text-fz": `var(--font-sizes-${props.fontSize}, var(--font-sizes-md))`
20528
+ },
20554
20529
  // @ts-expect-error
20555
20530
  "--mantine-scale": textScale
20556
20531
  },
@@ -20559,7 +20534,7 @@ const MarkdownBlock = forwardRef(({
20559
20534
  );
20560
20535
  });
20561
20536
  MarkdownBlock.displayName = "MarkdownBlock";
20562
- function ElementTitle({ id: id2, data, iconSize: iconSize2 }) {
20537
+ function ElementTitle({ id: id2, data, iconSize }) {
20563
20538
  const elementIcon = IconRenderer({
20564
20539
  element: {
20565
20540
  id: id2,
@@ -20579,9 +20554,9 @@ function ElementTitle({ id: id2, data, iconSize: iconSize2 }) {
20579
20554
  classes2.root,
20580
20555
  "likec4-element"
20581
20556
  ),
20582
- style: e(iconSize2) ? {
20557
+ style: e(iconSize) ? {
20583
20558
  // @ts-ignore
20584
- "--likec4-icon-size": `${iconSize2}px`
20559
+ "--likec4-icon-size": `${iconSize}px`
20585
20560
  } : void 0,
20586
20561
  children: [
20587
20562
  elementIcon,
@@ -20603,7 +20578,7 @@ function ElementTitle({ id: id2, data, iconSize: iconSize2 }) {
20603
20578
  children: data.technology
20604
20579
  }
20605
20580
  ),
20606
- data.description && /* @__PURE__ */ jsx(
20581
+ data.description?.nonEmpty && (data.description.isMarkdown ? /* @__PURE__ */ jsx(
20607
20582
  MarkdownBlock,
20608
20583
  {
20609
20584
  className: cx(classes2.description, "likec4-element-description"),
@@ -20613,19 +20588,28 @@ function ElementTitle({ id: id2, data, iconSize: iconSize2 }) {
20613
20588
  maxHeight: data.description.isMarkdown ? "8rem" : void 0,
20614
20589
  lineClamp: isSmOrXs ? 3 : 5
20615
20590
  }
20616
- )
20591
+ ) : /* @__PURE__ */ jsx(
20592
+ Text,
20593
+ {
20594
+ component: "div",
20595
+ className: cx(classes2.description, "likec4-element-description"),
20596
+ lineClamp: isSmOrXs ? 3 : 5,
20597
+ children: data.description.text
20598
+ }
20599
+ ))
20617
20600
  ] })
20618
20601
  ]
20619
20602
  }
20620
20603
  );
20621
20604
  }
20622
- function useCurrentViewModel() {
20623
- const vm = useContext(CurrentViewModelContext);
20624
- if (!vm)
20625
- throw new Error("No LikeC4ViewModel in context found");
20626
- return vm;
20627
- }
20628
- const CompoundActions = (props) => {
20605
+ const style = {
20606
+ top: "50%",
20607
+ left: "50%",
20608
+ visibility: "hidden"
20609
+ }, DefaultHandles = () => /* @__PURE__ */ jsxs(Fragment$1, { children: [
20610
+ /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top, style }),
20611
+ /* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom, style })
20612
+ ] }), CompoundActions = (props) => {
20629
20613
  const { enableNavigateTo } = useEnabledFeatures(), diagram = useDiagram(), { navigateTo } = props.data;
20630
20614
  return navigateTo && enableNavigateTo ? /* @__PURE__ */ jsx(
20631
20615
  CompoundActionButton,
@@ -20975,7 +20959,7 @@ function CompoundElementToolbar(props) {
20975
20959
  style: style2,
20976
20960
  modelFqn
20977
20961
  }
20978
- } = props, { elementColor, onColorPreview, onChange } = useHandlers(modelFqn, props);
20962
+ } = props, { elementColor, onColorPreview, onChange } = useHandlers(modelFqn, props), opacity = style2?.opacity ?? 100;
20979
20963
  return /* @__PURE__ */ jsxs(
20980
20964
  Toolbar,
20981
20965
  {
@@ -20989,7 +20973,7 @@ function CompoundElementToolbar(props) {
20989
20973
  elementColor,
20990
20974
  onColorPreview,
20991
20975
  isOpacityEditable: !0,
20992
- elementOpacity: style2?.opacity,
20976
+ elementOpacity: opacity,
20993
20977
  onChange,
20994
20978
  position: "left-start"
20995
20979
  }
@@ -20997,7 +20981,7 @@ function CompoundElementToolbar(props) {
20997
20981
  /* @__PURE__ */ jsx(
20998
20982
  BorderStyleOption,
20999
20983
  {
21000
- elementBorderStyle: style2?.border,
20984
+ elementBorderStyle: style2?.border ?? (opacity < 99 ? "dashed" : "none"),
21001
20985
  onChange
21002
20986
  }
21003
20987
  ),
@@ -21234,7 +21218,7 @@ function CompoundDetailsButtonWithHandler(props) {
21234
21218
  }
21235
21219
  );
21236
21220
  }
21237
- const ElementNode = customNode((props) => {
21221
+ const ElementNode = (props) => {
21238
21222
  const { enableElementTags, enableReadOnly } = useEnabledFeatures();
21239
21223
  return /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
21240
21224
  /* @__PURE__ */ jsx(ElementShape, { ...props }),
@@ -21245,9 +21229,9 @@ const ElementNode = customNode((props) => {
21245
21229
  !enableReadOnly && /* @__PURE__ */ jsx(ElementToolbar, { ...props }),
21246
21230
  /* @__PURE__ */ jsx(DefaultHandles, {})
21247
21231
  ] });
21248
- });
21232
+ };
21249
21233
  ElementNode.displayName = "ElementNode";
21250
- const DeploymentNode = customNode((props) => {
21234
+ const DeploymentNode = (props) => {
21251
21235
  const { enableElementTags, enableReadOnly } = useEnabledFeatures();
21252
21236
  return /* @__PURE__ */ jsxs(ElementNodeContainer, { nodeProps: props, children: [
21253
21237
  /* @__PURE__ */ jsx(ElementShape, { ...props }),
@@ -21258,9 +21242,9 @@ const DeploymentNode = customNode((props) => {
21258
21242
  !enableReadOnly && /* @__PURE__ */ jsx(DeploymentElementToolbar, { ...props }),
21259
21243
  /* @__PURE__ */ jsx(DefaultHandles, {})
21260
21244
  ] });
21261
- });
21245
+ };
21262
21246
  DeploymentNode.displayName = "DeploymentNode";
21263
- const CompoundElementNode = customNode((props) => {
21247
+ const CompoundElementNode = (props) => {
21264
21248
  const { enableElementDetails, enableReadOnly } = useEnabledFeatures();
21265
21249
  return /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
21266
21250
  /* @__PURE__ */ jsx(CompoundTitle, { ...props }),
@@ -21269,9 +21253,9 @@ const CompoundElementNode = customNode((props) => {
21269
21253
  !enableReadOnly && /* @__PURE__ */ jsx(CompoundElementToolbar, { ...props }),
21270
21254
  /* @__PURE__ */ jsx(DefaultHandles, {})
21271
21255
  ] });
21272
- });
21256
+ };
21273
21257
  CompoundElementNode.displayName = "CompoundElementNode";
21274
- const CompoundDeploymentNode = customNode((props) => {
21258
+ const CompoundDeploymentNode = (props) => {
21275
21259
  const { enableElementDetails, enableReadOnly } = useEnabledFeatures();
21276
21260
  return /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
21277
21261
  /* @__PURE__ */ jsx(CompoundTitle, { ...props }),
@@ -21280,18 +21264,50 @@ const CompoundDeploymentNode = customNode((props) => {
21280
21264
  !enableReadOnly && /* @__PURE__ */ jsx(CompoundDeploymentToolbar, { ...props }),
21281
21265
  /* @__PURE__ */ jsx(DefaultHandles, {})
21282
21266
  ] });
21283
- });
21267
+ };
21284
21268
  CompoundDeploymentNode.displayName = "CompoundDeploymentNode";
21285
- const ViewGroupNode = customNode((props) => /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
21269
+ const ViewGroupNode = (props) => /* @__PURE__ */ jsxs(CompoundNodeContainer, { nodeProps: props, children: [
21286
21270
  /* @__PURE__ */ jsx(CompoundTitle, { ...props }),
21287
21271
  /* @__PURE__ */ jsx(DefaultHandles, {})
21288
- ] }));
21272
+ ] });
21289
21273
  ViewGroupNode.displayName = "ViewGroupNode";
21274
+ function useOptionalCurrentViewModel() {
21275
+ return useContext(CurrentViewModelContext);
21276
+ }
21277
+ function useCurrentViewModel() {
21278
+ const vm = useContext(CurrentViewModelContext);
21279
+ if (!vm)
21280
+ throw new Error("No LikeC4ViewModel in context found");
21281
+ return vm;
21282
+ }
21290
21283
  const selectViewId = (s2) => s2.context.view.id;
21291
21284
  function useCurrentViewId() {
21292
21285
  const actorRef = useDiagramActorRef();
21293
21286
  return useSelector(actorRef, selectViewId);
21294
21287
  }
21288
+ const LikeC4ProjectsContext = createContext(null), emptyProjects = [];
21289
+ function useLikeC4Projects() {
21290
+ const ctx = useContext(LikeC4ProjectsContext);
21291
+ return ctx ? ctx.projects : emptyProjects;
21292
+ }
21293
+ const emptyOnProjectChange = () => {
21294
+ }, emptyContext = {
21295
+ projects: emptyProjects,
21296
+ onProjectChange: emptyOnProjectChange
21297
+ };
21298
+ function useLikeC4ProjectsContext() {
21299
+ return useContext(LikeC4ProjectsContext) ?? emptyContext;
21300
+ }
21301
+ function useHasProjects() {
21302
+ const ctx = useContext(LikeC4ProjectsContext);
21303
+ return ctx ? ctx.projects.length > 1 : !1;
21304
+ }
21305
+ function useLikeC4ProjectId() {
21306
+ const ctx = useContext(LikeC4ModelContext);
21307
+ if (!ctx)
21308
+ throw new Error("No LikeC4ModelContext found");
21309
+ return ctx.projectId;
21310
+ }
21295
21311
  const backdropBlur = "--_blur", backdropOpacity = "--_opacity", level = "--_level", offset = "--_offset", inset = "--_inset", borderRadius = "--_border-radius", dialog = css.raw({
21296
21312
  boxSizing: "border-box",
21297
21313
  margin: "0",
@@ -21532,7 +21548,7 @@ export {
21532
21548
  clsx as L,
21533
21549
  MantineContext as M,
21534
21550
  getThemeColor as N,
21535
- isElement$1 as O,
21551
+ isElement$2 as O,
21536
21552
  Popover as P,
21537
21553
  getRefProp as Q,
21538
21554
  useUncontrolled as R,
@@ -21611,7 +21627,7 @@ export {
21611
21627
  loadExternalIsValidProp as ay,
21612
21628
  isMotionValue as az,
21613
21629
  useMantineTheme as b,
21614
- n$1 as b$,
21630
+ Box as b$,
21615
21631
  css as b0,
21616
21632
  getPatternStyles as b1,
21617
21633
  patternFns as b2,
@@ -21648,11 +21664,11 @@ export {
21648
21664
  deepEqual as bX,
21649
21665
  ActionIcon as bY,
21650
21666
  IconZoomScan as bZ,
21651
- Box as b_,
21667
+ MotionDiv as b_,
21652
21668
  stopPropagation as ba,
21653
21669
  cx as bb,
21654
- cva as bc,
21655
- useStore$1 as bd,
21670
+ roundDpr as bc,
21671
+ useStore as bd,
21656
21672
  useUpdateEffect as be,
21657
21673
  XSTATE_STOP as bf,
21658
21674
  cloneMachineSnapshot as bg,
@@ -21676,159 +21692,171 @@ export {
21676
21692
  getPersistedSnapshot as by,
21677
21693
  $$ACTOR_TYPE as bz,
21678
21694
  useMantineStyleNonce as c,
21679
- useCurrentViewModel as c$,
21680
- EdgeLabelRenderer as c0,
21681
- e as c1,
21682
- useDiagramContext as c2,
21683
- useDiagram as c3,
21684
- useMantinePortalProps as c4,
21685
- PopoverTarget as c5,
21686
- PopoverDropdown as c6,
21687
- Stack as c7,
21688
- Group as c8,
21689
- Button as c9,
21690
- ViewGroupNode as cA,
21691
- CompoundDeploymentNode as cB,
21692
- CompoundElementNode as cC,
21693
- DeploymentNode as cD,
21694
- ElementNode as cE,
21695
- n as cF,
21696
- MotionButton as cG,
21697
- useHover$1 as cH,
21698
- FloatingIndicator as cI,
21699
- Flex as cJ,
21700
- clampUseMovePosition as cK,
21701
- useMove as cL,
21702
- hstack as cM,
21703
- MotionDiv as cN,
21704
- shallowEqual as cO,
21705
- useSelector as cP,
21706
- useCurrentViewId as cQ,
21707
- isMacOs as cR,
21708
- IconId as cS,
21709
- HStack as cT,
21710
- ElementTag as cU,
21711
- MarkdownBlock as cV,
21712
- MotionSpan as cW,
21713
- Portal as cX,
21714
- Divider as cY,
21715
- o$1 as cZ,
21716
- useDiagramActorRef as c_,
21717
- IconCheck as ca,
21718
- useLikeC4Model as cb,
21719
- LikeC4ModelContext as cc,
21720
- findDiagramNode as cd,
21721
- findDiagramEdge as ce,
21722
- Menu as cf,
21723
- MenuTarget as cg,
21724
- MenuDropdown as ch,
21725
- MenuLabel as ci,
21726
- MenuDivider as cj,
21727
- MenuItem as ck,
21728
- useEnabledFeatures as cl,
21729
- useDiagramEventHandlers as cm,
21730
- TooltipGroup as cn,
21731
- Space as co,
21732
- Tooltip$1 as cp,
21733
- IfEnabled as cq,
21734
- IconFileSymlink as cr,
21735
- getNodeDimensions as cs,
21736
- useIsPanning as ct,
21737
- useXYFlow as cu,
21738
- useDiagramActorSnapshot as cv,
21739
- useXYInternalNode as cw,
21740
- isSamePoint as cx,
21741
- bezierControlPoints as cy,
21742
- bezierPath as cz,
21695
+ CompoundNodeContainer as c$,
21696
+ n$1 as c0,
21697
+ EdgeLabelRenderer as c1,
21698
+ e as c2,
21699
+ getNodeDimensions as c3,
21700
+ useXYFlow as c4,
21701
+ useDiagram as c5,
21702
+ useEnabledFeatures as c6,
21703
+ useXYInternalNode as c7,
21704
+ isSamePoint as c8,
21705
+ bezierControlPoints as c9,
21706
+ isMacOs as cA,
21707
+ IconCheck as cB,
21708
+ IconId as cC,
21709
+ HStack as cD,
21710
+ ElementTag as cE,
21711
+ MarkdownBlock as cF,
21712
+ cva as cG,
21713
+ Button as cH,
21714
+ MotionSpan as cI,
21715
+ Portal as cJ,
21716
+ useLikeC4ProjectsContext as cK,
21717
+ useLikeC4ProjectId as cL,
21718
+ Menu as cM,
21719
+ MenuTarget as cN,
21720
+ MenuDropdown as cO,
21721
+ MenuItem as cP,
21722
+ useLikeC4Model as cQ,
21723
+ Divider as cR,
21724
+ o$1 as cS,
21725
+ useDiagramActorRef as cT,
21726
+ useCurrentViewModel as cU,
21727
+ useActorRef as cV,
21728
+ useUpdateEffect$1 as cW,
21729
+ Group as cX,
21730
+ getBezierPath as cY,
21731
+ ElementActionButtons as cZ,
21732
+ IconTransform as c_,
21733
+ bezierPath as ca,
21734
+ ViewGroupNode as cb,
21735
+ CompoundDeploymentNode as cc,
21736
+ CompoundElementNode as cd,
21737
+ DeploymentNode as ce,
21738
+ ElementNode as cf,
21739
+ useDiagramActorSnapshot as cg,
21740
+ n as ch,
21741
+ MotionButton as ci,
21742
+ Tooltip$1 as cj,
21743
+ useDiagramEventHandlers as ck,
21744
+ useDiagramContext as cl,
21745
+ useHover$1 as cm,
21746
+ PopoverTarget as cn,
21747
+ PopoverDropdown as co,
21748
+ FloatingIndicator as cp,
21749
+ Flex as cq,
21750
+ clampUseMovePosition as cr,
21751
+ useMove as cs,
21752
+ useMantinePortalProps as ct,
21753
+ hstack as cu,
21754
+ TooltipGroup as cv,
21755
+ shallowEqual as cw,
21756
+ useSelector as cx,
21757
+ useCurrentViewId as cy,
21758
+ IconFileSymlink as cz,
21743
21759
  alpha$1 as d,
21744
- CurrentViewModelContext as d$,
21745
- useActorRef as d0,
21746
- useUpdateEffect$1 as d1,
21747
- getBezierPath as d2,
21748
- ElementActionButtons as d3,
21749
- IconTransform as d4,
21750
- customNode as d5,
21751
- CompoundNodeContainer as d6,
21752
- CompoundTitle as d7,
21753
- ElementNodeContainer as d8,
21754
- ElementShape as d9,
21755
- sva as dA,
21756
- t$2 as dB,
21757
- VisuallyHidden as dC,
21758
- IconOrShapeRenderer as dD,
21759
- FocusTrap as dE,
21760
- t$3 as dF,
21761
- ButtonGroup as dG,
21762
- useIsReducedGraphics as dH,
21763
- usePanningAtom as dI,
21764
- useTimeout as dJ,
21765
- useCustomCompareMemo as dK,
21766
- useLikeC4Specification as dL,
21767
- r as dM,
21768
- applyEdgeChanges as dN,
21769
- applyNodeChanges as dO,
21770
- getViewportForBounds as dP,
21771
- typedSystem as dQ,
21772
- centerXYInternalNode as dR,
21773
- getBoundsOfRects as dS,
21774
- boxToRect as dT,
21775
- and as dU,
21776
- AllDisabled as dV,
21777
- focusedBounds as dW,
21778
- or as dX,
21779
- nodeToRect as dY,
21780
- useCustomCompareEffect as dZ,
21781
- DiagramActorContextProvider as d_,
21782
- ElementTitle as da,
21783
- ElementTags as db,
21784
- ElementDetailsButton as dc,
21785
- Handle as dd,
21786
- Position as de,
21787
- getDefaultExportFromCjs as df,
21788
- l$1 as dg,
21789
- IconSelector as dh,
21790
- SegmentedControl as di,
21791
- ReactFlowProvider as dj,
21792
- useStoreApi as dk,
21793
- useReactFlow as dl,
21794
- Panel as dm,
21795
- m as dn,
21796
- u as dp,
21797
- useSyncedRef as dq,
21798
- IconRenderer as dr,
21799
- useTimeoutEffect as ds,
21800
- ReactRemoveScroll as dt,
21801
- ActionIconGroup as du,
21802
- DiagramFeatures as dv,
21803
- t$1 as dw,
21804
- useXYStore as dx,
21805
- useReducedMotionConfig as dy,
21806
- Overlay as dz,
21760
+ getBoundsOfRects as d$,
21761
+ CompoundTitle as d0,
21762
+ CompoundDetailsButton as d1,
21763
+ ElementNodeContainer as d2,
21764
+ ElementShape as d3,
21765
+ ElementTitle as d4,
21766
+ ElementTags as d5,
21767
+ Handle as d6,
21768
+ Position as d7,
21769
+ ElementDetailsButton as d8,
21770
+ getDefaultExportFromCjs as d9,
21771
+ IconOrShapeRenderer as dA,
21772
+ FocusTrap as dB,
21773
+ t$3 as dC,
21774
+ useOnDiagramEvent as dD,
21775
+ findDiagramEdge as dE,
21776
+ findDiagramNode as dF,
21777
+ autoUpdate as dG,
21778
+ Space as dH,
21779
+ computePosition as dI,
21780
+ offset$2 as dJ,
21781
+ autoPlacement as dK,
21782
+ size$1 as dL,
21783
+ hide$1 as dM,
21784
+ useOptionalCurrentViewModel as dN,
21785
+ ButtonGroup as dO,
21786
+ EnsureCurrentViewModel as dP,
21787
+ useIsReducedGraphics as dQ,
21788
+ usePanningAtom as dR,
21789
+ useTimeout as dS,
21790
+ useCustomCompareMemo as dT,
21791
+ useLikeC4Specification as dU,
21792
+ r as dV,
21793
+ applyEdgeChanges as dW,
21794
+ applyNodeChanges as dX,
21795
+ getViewportForBounds as dY,
21796
+ typedSystem as dZ,
21797
+ centerXYInternalNode as d_,
21798
+ l$1 as da,
21799
+ IconSelector as db,
21800
+ SegmentedControl as dc,
21801
+ ReactFlowProvider as dd,
21802
+ useStoreApi as de,
21803
+ useReactFlow as df,
21804
+ Panel as dg,
21805
+ m as dh,
21806
+ Stack as di,
21807
+ u as dj,
21808
+ useSyncedRef as dk,
21809
+ IconRenderer as dl,
21810
+ useTimeoutEffect as dm,
21811
+ ReactRemoveScroll as dn,
21812
+ ActionIconGroup as dp,
21813
+ IfEnabled as dq,
21814
+ DiagramFeatures as dr,
21815
+ t$1 as ds,
21816
+ customNode as dt,
21817
+ useXYStore as du,
21818
+ useReducedMotionConfig as dv,
21819
+ Overlay as dw,
21820
+ sva as dx,
21821
+ t$2 as dy,
21822
+ VisuallyHidden as dz,
21807
21823
  em as e,
21808
- IconRendererProvider as e0,
21809
- DiagramEventHandlers as e1,
21810
- ReduceGraphicsContext as e2,
21811
- RootContainer as e3,
21812
- useMutationObserver as e4,
21813
- shallowEqual$1 as e5,
21814
- useLikeC4ViewModel as e6,
21815
- useSetState as e7,
21816
- CompoundActionButton as e8,
21817
- CompoundDetailsButton as e9,
21818
- DefaultHandles as ea,
21819
- CompoundActions as eb,
21820
- CompoundDeploymentToolbar as ec,
21821
- CompoundDetailsButtonWithHandler as ed,
21822
- CompoundElementToolbar as ee,
21823
- DeploymentElementActions as ef,
21824
- DeploymentElementToolbar as eg,
21825
- ElementActions as eh,
21826
- ElementDetailsButtonWithHandler as ei,
21827
- ElementToolbar as ej,
21828
- Toolbar as ek,
21829
- IfNotEnabled as el,
21830
- IfNotReadOnly as em,
21831
- IfReadOnly as en,
21824
+ boxToRect as e0,
21825
+ and as e1,
21826
+ AllDisabled as e2,
21827
+ focusedBounds as e3,
21828
+ or as e4,
21829
+ nodeToRect as e5,
21830
+ useCustomCompareEffect as e6,
21831
+ DiagramActorContextProvider as e7,
21832
+ CurrentViewModelContext as e8,
21833
+ IconRendererProvider as e9,
21834
+ DiagramEventHandlers as ea,
21835
+ ReduceGraphicsContext as eb,
21836
+ RootContainer as ec,
21837
+ useMutationObserver as ed,
21838
+ shallowEqual$1 as ee,
21839
+ LikeC4ProjectsContext as ef,
21840
+ LikeC4ModelContext as eg,
21841
+ useLikeC4ViewModel as eh,
21842
+ useHasProjects as ei,
21843
+ useLikeC4Projects as ej,
21844
+ useSetState as ek,
21845
+ CompoundActionButton as el,
21846
+ DefaultHandles as em,
21847
+ CompoundActions as en,
21848
+ CompoundDeploymentToolbar as eo,
21849
+ CompoundDetailsButtonWithHandler as ep,
21850
+ CompoundElementToolbar as eq,
21851
+ DeploymentElementActions as er,
21852
+ DeploymentElementToolbar as es,
21853
+ ElementActions as et,
21854
+ ElementDetailsButtonWithHandler as eu,
21855
+ ElementToolbar as ev,
21856
+ Toolbar as ew,
21857
+ IfNotEnabled as ex,
21858
+ IfNotReadOnly as ey,
21859
+ IfReadOnly as ez,
21832
21860
  getPrimaryContrastColor as f,
21833
21861
  getPrimaryShade as g,
21834
21862
  deepMerge as h,