@uipath/apollo-react 4.13.0-pr556.e4e2855 → 4.13.1

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 (132) hide show
  1. package/dist/canvas/components/AddNodePanel/AddNodeManager.cjs +7 -26
  2. package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
  3. package/dist/canvas/components/AddNodePanel/AddNodeManager.js +7 -26
  4. package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +41 -0
  5. package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +3 -0
  6. package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +1 -0
  7. package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +7 -0
  8. package/dist/canvas/components/AddNodePanel/index.cjs +6 -2
  9. package/dist/canvas/components/AddNodePanel/index.d.ts +1 -0
  10. package/dist/canvas/components/AddNodePanel/index.d.ts.map +1 -1
  11. package/dist/canvas/components/AddNodePanel/index.js +2 -1
  12. package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +0 -1
  13. package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
  14. package/dist/canvas/components/BaseNode/BaseNode.cjs +20 -15
  15. package/dist/canvas/components/BaseNode/BaseNode.d.ts +1 -2
  16. package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
  17. package/dist/canvas/components/BaseNode/BaseNode.js +20 -12
  18. package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +34 -115
  19. package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +2 -4
  20. package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
  21. package/dist/canvas/components/ButtonHandle/ButtonHandle.js +36 -117
  22. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +18 -52
  23. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +0 -4
  24. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
  25. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +18 -40
  26. package/dist/canvas/components/ButtonHandle/HandleButton.cjs +9 -3
  27. package/dist/canvas/components/ButtonHandle/HandleButton.d.ts.map +1 -1
  28. package/dist/canvas/components/ButtonHandle/HandleButton.js +9 -3
  29. package/dist/canvas/components/ButtonHandle/HandleLabel.cjs +11 -4
  30. package/dist/canvas/components/ButtonHandle/HandleLabel.d.ts +4 -1
  31. package/dist/canvas/components/ButtonHandle/HandleLabel.d.ts.map +1 -1
  32. package/dist/canvas/components/ButtonHandle/HandleLabel.js +7 -3
  33. package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +2 -2
  34. package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts.map +1 -1
  35. package/dist/canvas/components/ButtonHandle/SmartHandle.js +2 -2
  36. package/dist/canvas/components/Edges/SequenceEdge.cjs +2 -3
  37. package/dist/canvas/components/Edges/SequenceEdge.d.ts +2 -11
  38. package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
  39. package/dist/canvas/components/Edges/SequenceEdge.js +3 -4
  40. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +15 -23
  41. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +0 -2
  42. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
  43. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +16 -24
  44. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +8 -11
  45. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
  46. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +8 -11
  47. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +24 -27
  48. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts +1 -2
  49. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
  50. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +25 -28
  51. package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.cjs +15 -5
  52. package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.d.ts +1 -1
  53. package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.d.ts.map +1 -1
  54. package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.js +15 -5
  55. package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.d.ts +1 -0
  56. package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.d.ts.map +1 -1
  57. package/dist/canvas/components/index.cjs +20 -27
  58. package/dist/canvas/components/index.d.ts +0 -1
  59. package/dist/canvas/components/index.d.ts.map +1 -1
  60. package/dist/canvas/components/index.js +0 -1
  61. package/dist/canvas/constants.cjs +0 -8
  62. package/dist/canvas/constants.d.ts +0 -2
  63. package/dist/canvas/constants.d.ts.map +1 -1
  64. package/dist/canvas/constants.js +1 -3
  65. package/dist/canvas/core/NodeTypeRegistry.cjs +23 -39
  66. package/dist/canvas/core/NodeTypeRegistry.d.ts +4 -8
  67. package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
  68. package/dist/canvas/core/NodeTypeRegistry.js +23 -39
  69. package/dist/canvas/core/useNodeTypeRegistry.cjs +3 -4
  70. package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -1
  71. package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
  72. package/dist/canvas/core/useNodeTypeRegistry.js +3 -4
  73. package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +3 -10
  74. package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
  75. package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +3 -10
  76. package/dist/canvas/hooks/usePreviewNode.cjs +2 -4
  77. package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
  78. package/dist/canvas/hooks/usePreviewNode.js +2 -4
  79. package/dist/canvas/schema/node-definition/handle.cjs +2 -10
  80. package/dist/canvas/schema/node-definition/handle.d.ts +0 -9
  81. package/dist/canvas/schema/node-definition/handle.d.ts.map +1 -1
  82. package/dist/canvas/schema/node-definition/handle.js +1 -6
  83. package/dist/canvas/schema/node-definition/index.cjs +1 -4
  84. package/dist/canvas/schema/node-definition/index.d.ts +3 -3
  85. package/dist/canvas/schema/node-definition/index.d.ts.map +1 -1
  86. package/dist/canvas/schema/node-definition/index.js +2 -2
  87. package/dist/canvas/schema/node-definition/node-manifest.d.ts +0 -4
  88. package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
  89. package/dist/canvas/storybook-utils/manifests/index.d.ts +0 -1
  90. package/dist/canvas/storybook-utils/manifests/index.d.ts.map +1 -1
  91. package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
  92. package/dist/canvas/styles/reactflow-reset.css +4 -0
  93. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  94. package/dist/canvas/utils/{createPreviewGraph.cjs → createPreviewNode.cjs} +41 -115
  95. package/dist/canvas/utils/createPreviewNode.d.ts +17 -0
  96. package/dist/canvas/utils/createPreviewNode.d.ts.map +1 -0
  97. package/dist/canvas/utils/{createPreviewGraph.js → createPreviewNode.js} +36 -95
  98. package/dist/canvas/utils/index.cjs +10 -10
  99. package/dist/canvas/utils/index.d.ts +2 -2
  100. package/dist/canvas/utils/index.d.ts.map +1 -1
  101. package/dist/canvas/utils/index.js +2 -2
  102. package/package.json +3 -3
  103. package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +0 -112
  104. package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +0 -6
  105. package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +0 -1
  106. package/dist/canvas/components/LoopNode/LoopCanvasNode.js +0 -78
  107. package/dist/canvas/components/LoopNode/LoopNode.cjs +0 -430
  108. package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +0 -77
  109. package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +0 -12
  110. package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +0 -1
  111. package/dist/canvas/components/LoopNode/LoopNode.constants.js +0 -13
  112. package/dist/canvas/components/LoopNode/LoopNode.d.ts +0 -5
  113. package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +0 -1
  114. package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +0 -137
  115. package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +0 -26
  116. package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +0 -1
  117. package/dist/canvas/components/LoopNode/LoopNode.helpers.js +0 -94
  118. package/dist/canvas/components/LoopNode/LoopNode.js +0 -396
  119. package/dist/canvas/components/LoopNode/LoopNode.types.cjs +0 -18
  120. package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +0 -11
  121. package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +0 -1
  122. package/dist/canvas/components/LoopNode/LoopNode.types.js +0 -0
  123. package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +0 -61
  124. package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts +0 -9
  125. package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +0 -1
  126. package/dist/canvas/components/LoopNode/LoopNodePreview.js +0 -27
  127. package/dist/canvas/components/LoopNode/index.cjs +0 -72
  128. package/dist/canvas/components/LoopNode/index.d.ts +0 -4
  129. package/dist/canvas/components/LoopNode/index.d.ts.map +0 -1
  130. package/dist/canvas/components/LoopNode/index.js +0 -3
  131. package/dist/canvas/utils/createPreviewGraph.d.ts +0 -43
  132. package/dist/canvas/utils/createPreviewGraph.d.ts.map +0 -1
@@ -28,7 +28,6 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  ButtonHandle: ()=>ButtonHandle
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
- const index_cjs_namespaceObject = require("../../layouts/index.cjs");
32
31
  const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
33
32
  const external_react_namespaceObject = require("react");
34
33
  const CanvasEventBus_cjs_namespaceObject = require("../../utils/CanvasEventBus.cjs");
@@ -38,7 +37,7 @@ const external_HandleButton_cjs_namespaceObject = require("./HandleButton.cjs");
38
37
  const external_HandleLabel_cjs_namespaceObject = require("./HandleLabel.cjs");
39
38
  const external_HandleNotch_cjs_namespaceObject = require("./HandleNotch.cjs");
40
39
  const external_useButtonHandleSizeAndPosition_cjs_namespaceObject = require("./useButtonHandleSizeAndPosition.cjs");
41
- const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = position, handleType, label, labelIcon, labelBackgroundColor = 'var(--canvas-background-secondary)', visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
40
+ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor, visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
42
41
  const handleRef = (0, external_react_namespaceObject.useRef)(null);
43
42
  const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
44
43
  const isVertical = position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
@@ -63,7 +62,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
63
62
  handleId: id,
64
63
  nodeId,
65
64
  handleType,
66
- position: connectionPosition,
65
+ position,
67
66
  originalEvent: event
68
67
  };
69
68
  onAction?.(actionEvent);
@@ -71,13 +70,13 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
71
70
  handleId: id,
72
71
  nodeId,
73
72
  handleType,
74
- position: connectionPosition
73
+ position
75
74
  });
76
75
  }, [
77
- connectionPosition,
78
76
  id,
79
77
  nodeId,
80
78
  handleType,
79
+ position,
81
80
  onAction
82
81
  ]);
83
82
  const markAsHovered = (0, external_react_namespaceObject.useCallback)(()=>setIsHovered(true), []);
@@ -88,91 +87,52 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
88
87
  numHandles: total,
89
88
  customPositionAndOffsets
90
89
  });
91
- const hasInwardLabel = Boolean(label && connectionPosition !== position);
92
- const { inwardLabelRef, rootWidth, rootHeight, rootTransform } = useInwardLabelLayout({
93
- hasInwardLabel,
94
- isVertical,
95
- position,
96
- handleType,
97
- handleWidth,
98
- handleHeight,
99
- transform
100
- });
101
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Handle, {
90
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(react_cjs_namespaceObject.Handle, {
102
91
  ref: handleRef,
103
92
  type: type,
104
- position: connectionPosition,
93
+ position: position,
105
94
  id: id,
106
95
  onMouseEnter: markAsHovered,
107
96
  onMouseLeave: unmarkAsHovered,
108
97
  onMouseDown: unmarkAsHovered,
109
98
  className: (0, CssUtil_cjs_namespaceObject.cx)('flex! items-center! justify-center! border-0! rounded-none! bg-transparent!', visible ? 'cursor-crosshair! pointer-events-auto! opacity-100' : 'cursor-default! pointer-events-none! opacity-0'),
110
99
  style: {
111
- width: rootWidth,
112
- height: rootHeight,
100
+ width: handleWidth,
101
+ height: handleHeight,
113
102
  top,
114
103
  bottom,
115
104
  left,
116
105
  right,
117
- transform: rootTransform
106
+ transform
118
107
  },
119
- children: hasInwardLabel ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
120
- children: [
121
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
122
- className: (0, CssUtil_cjs_namespaceObject.cx)('flex h-full w-full items-center', (0, external_ButtonHandleStyleUtils_cjs_namespaceObject.getInwardNotchLayout)(position)),
123
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleNotch_cjs_namespaceObject.HandleNotch, {
124
- handleType: handleType,
125
- isVertical: isVertical,
126
- selected: selected,
127
- hovered: isHovered,
128
- showNotch: showNotches
129
- })
130
- }),
131
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ButtonHandle_InwardHandleLabel, {
132
- ref: inwardLabelRef,
133
- connectionPosition: connectionPosition,
134
- label: label,
135
- labelIcon: labelIcon,
136
- backgroundColor: labelBackgroundColor
137
- }),
138
- onAction && 'source' === type && showButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
139
- visible: showButton,
140
- labelVisible: visible,
141
- position: position,
142
- onAction: handleButtonClick,
143
- handleRef: handleRef
144
- }) : null
145
- ]
146
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
147
- children: [
148
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleNotch_cjs_namespaceObject.HandleNotch, {
149
- handleType: handleType,
150
- isVertical: isVertical,
151
- selected: selected,
152
- hovered: isHovered,
153
- showNotch: showNotches
154
- }),
155
- onAction && 'source' === type && showButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
156
- visible: showButton,
157
- labelVisible: visible,
158
- position: position,
159
- onAction: handleButtonClick,
160
- handleRef: handleRef,
161
- label: label,
162
- labelIcon: labelIcon,
163
- labelBackgroundColor: labelBackgroundColor
164
- }) : label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleLabel_cjs_namespaceObject.HandleLabel, {
165
- position: position,
166
- backgroundColor: labelBackgroundColor,
167
- label: label,
168
- labelIcon: labelIcon
169
- })
170
- ]
171
- })
108
+ children: [
109
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleNotch_cjs_namespaceObject.HandleNotch, {
110
+ handleType: handleType,
111
+ isVertical: isVertical,
112
+ selected: selected,
113
+ hovered: isHovered,
114
+ showNotch: showNotches
115
+ }),
116
+ onAction && 'source' === type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
117
+ visible: showButton,
118
+ labelVisible: visible,
119
+ position: position,
120
+ onAction: handleButtonClick,
121
+ handleRef: handleRef,
122
+ label: label,
123
+ labelIcon: labelIcon,
124
+ labelBackgroundColor: labelBackgroundColor
125
+ }) : label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleLabel_cjs_namespaceObject.HandleLabel, {
126
+ position: position,
127
+ backgroundColor: labelBackgroundColor,
128
+ label: label,
129
+ labelIcon: labelIcon
130
+ })
131
+ ]
172
132
  });
173
133
  };
174
134
  const ButtonHandle = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(ButtonHandleBase);
175
- const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
135
+ const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
176
136
  const finalSelected = shouldShowAddButtonFn({
177
137
  showAddButton,
178
138
  selected,
@@ -191,7 +151,6 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
191
151
  nodeId: nodeId,
192
152
  type: handle.type,
193
153
  position: position,
194
- connectionPosition: connectionPosition,
195
154
  handleType: handle.handleType,
196
155
  label: handle.label,
197
156
  labelIcon: handle.labelIcon,
@@ -211,46 +170,6 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
211
170
  });
212
171
  };
213
172
  const ButtonHandles = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(ButtonHandlesBase);
214
- function useInwardLabelLayout({ hasInwardLabel, isVertical, position, handleType, handleWidth, handleHeight, transform }) {
215
- const inwardLabelRef = (0, external_react_namespaceObject.useRef)(null);
216
- const [inwardLabelInset, setInwardLabelInset] = (0, external_react_namespaceObject.useState)(0);
217
- (0, external_react_namespaceObject.useLayoutEffect)(()=>{
218
- if (!hasInwardLabel) return void setInwardLabelInset((current)=>0 === current ? current : 0);
219
- const rect = inwardLabelRef.current?.getBoundingClientRect();
220
- const nextInset = isVertical ? rect?.height ?? 0 : rect?.width ?? 0;
221
- setInwardLabelInset((current)=>current === nextInset ? current : nextInset);
222
- }, [
223
- hasInwardLabel,
224
- isVertical
225
- ]);
226
- const inwardHandleSize = (0, external_ButtonHandleStyleUtils_cjs_namespaceObject.getInwardHandleSize)(handleType);
227
- return {
228
- inwardLabelRef,
229
- rootWidth: hasInwardLabel && !isVertical ? inwardHandleSize : handleWidth,
230
- rootHeight: hasInwardLabel && isVertical ? inwardHandleSize : handleHeight,
231
- rootTransform: hasInwardLabel ? (0, external_ButtonHandleStyleUtils_cjs_namespaceObject.getInwardHandleTransform)(position, inwardLabelInset) : transform
232
- };
233
- }
234
- const ButtonHandle_InwardHandleLabel = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(function({ connectionPosition, label, labelIcon, backgroundColor }, ref) {
235
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
236
- ref: ref,
237
- className: (0, CssUtil_cjs_namespaceObject.cx)('pointer-events-none absolute flex h-6 items-center whitespace-nowrap rounded-full border border-border-subtle px-2.5', external_ButtonHandleStyleUtils_cjs_namespaceObject.INWARD_LABEL_POSITION[connectionPosition]),
238
- style: {
239
- backgroundColor
240
- },
241
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Row, {
242
- align: "center",
243
- gap: 3,
244
- children: [
245
- labelIcon,
246
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
247
- className: "text-xs font-medium text-foreground",
248
- children: label
249
- })
250
- ]
251
- })
252
- });
253
- });
254
173
  exports.ButtonHandle = __webpack_exports__.ButtonHandle;
255
174
  exports.ButtonHandles = __webpack_exports__.ButtonHandles;
256
175
  for(var __rspack_i in __webpack_exports__)if (-1 === [
@@ -12,7 +12,6 @@ type ButtonHandleProps = {
12
12
  nodeId: string;
13
13
  type: 'source' | 'target';
14
14
  position: Position;
15
- connectionPosition?: Position;
16
15
  handleType: 'artifact' | 'input' | 'output';
17
16
  label?: string;
18
17
  labelIcon?: React.ReactNode;
@@ -28,7 +27,7 @@ type ButtonHandleProps = {
28
27
  nodeWidth?: number;
29
28
  nodeHeight?: number;
30
29
  };
31
- export declare const ButtonHandle: import("react").MemoExoticComponent<({ id, nodeId, type, position, connectionPosition, handleType, label, labelIcon, labelBackgroundColor, visible, showButton, selected, index, total, onAction, showNotches, customPositionAndOffsets, nodeWidth, nodeHeight, }: ButtonHandleProps) => import("react/jsx-runtime").JSX.Element>;
30
+ export declare const ButtonHandle: import("react").MemoExoticComponent<({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor, visible, showButton, selected, index, total, onAction, showNotches, customPositionAndOffsets, nodeWidth, nodeHeight, }: ButtonHandleProps) => import("react/jsx-runtime").JSX.Element>;
32
31
  export interface ButtonHandleConfig {
33
32
  id: string;
34
33
  type: 'source' | 'target';
@@ -42,11 +41,10 @@ export interface ButtonHandleConfig {
42
41
  onAction?: (event: HandleActionEvent) => void;
43
42
  customPositionAndOffsets?: HandleConfigurationSpecificPosition;
44
43
  }
45
- export declare const ButtonHandles: import("react").MemoExoticComponent<({ nodeId, handles, position, connectionPosition, selected, hovered, visible, showAddButton, showNotches, customPositionAndOffsets, shouldShowAddButtonFn, nodeWidth, nodeHeight, }: {
44
+ export declare const ButtonHandles: import("react").MemoExoticComponent<({ nodeId, handles, position, selected, hovered, visible, showAddButton, showNotches, customPositionAndOffsets, shouldShowAddButtonFn, nodeWidth, nodeHeight, }: {
46
45
  nodeId: string;
47
46
  handles: ButtonHandleConfig[];
48
47
  position: Position;
49
- connectionPosition?: Position;
50
48
  selected?: boolean;
51
49
  hovered?: boolean;
52
50
  visible?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonHandle.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/ButtonHandle.tsx"],"names":[],"mappings":"AACA,OAAO,EAAU,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAE5E,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAgB/F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC;CACjC;AAYD,KAAK,iBAAiB,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IAGnB,kBAAkB,CAAC,EAAE,QAAQ,CAAC;IAC9B,UAAU,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,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E;QACD,aAAa,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;KAClB,KAAK,OAAO,CAAC;CACf,6CAyCmD,CAAC"}
@@ -1,15 +1,14 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { Row } from "../../layouts/index.js";
3
2
  import { Handle, Position } from "../../xyflow/react.js";
4
- import { forwardRef, memo, useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
3
+ import { memo, useCallback, useMemo, useRef, useState } from "react";
5
4
  import { canvasEventBus } from "../../utils/CanvasEventBus.js";
6
5
  import { cx } from "../../utils/CssUtil.js";
7
- import { INWARD_LABEL_POSITION, calculateGridAlignedHandlePositions, getInwardHandleSize, getInwardHandleTransform, getInwardNotchLayout, pixelToPercent } from "./ButtonHandleStyleUtils.js";
6
+ import { calculateGridAlignedHandlePositions, pixelToPercent } from "./ButtonHandleStyleUtils.js";
8
7
  import { HandleButton, HandleHoverBridge } from "./HandleButton.js";
9
8
  import { HandleLabel } from "./HandleLabel.js";
10
9
  import { HandleNotch } from "./HandleNotch.js";
11
10
  import { useButtonHandleSizeAndPosition } from "./useButtonHandleSizeAndPosition.js";
12
- const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = position, handleType, label, labelIcon, labelBackgroundColor = 'var(--canvas-background-secondary)', visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
11
+ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor, visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
13
12
  const handleRef = useRef(null);
14
13
  const [isHovered, setIsHovered] = useState(false);
15
14
  const isVertical = position === Position.Top || position === Position.Bottom;
@@ -34,7 +33,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
34
33
  handleId: id,
35
34
  nodeId,
36
35
  handleType,
37
- position: connectionPosition,
36
+ position,
38
37
  originalEvent: event
39
38
  };
40
39
  onAction?.(actionEvent);
@@ -42,13 +41,13 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
42
41
  handleId: id,
43
42
  nodeId,
44
43
  handleType,
45
- position: connectionPosition
44
+ position
46
45
  });
47
46
  }, [
48
- connectionPosition,
49
47
  id,
50
48
  nodeId,
51
49
  handleType,
50
+ position,
52
51
  onAction
53
52
  ]);
54
53
  const markAsHovered = useCallback(()=>setIsHovered(true), []);
@@ -59,91 +58,52 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
59
58
  numHandles: total,
60
59
  customPositionAndOffsets
61
60
  });
62
- const hasInwardLabel = Boolean(label && connectionPosition !== position);
63
- const { inwardLabelRef, rootWidth, rootHeight, rootTransform } = useInwardLabelLayout({
64
- hasInwardLabel,
65
- isVertical,
66
- position,
67
- handleType,
68
- handleWidth,
69
- handleHeight,
70
- transform
71
- });
72
- return /*#__PURE__*/ jsx(Handle, {
61
+ return /*#__PURE__*/ jsxs(Handle, {
73
62
  ref: handleRef,
74
63
  type: type,
75
- position: connectionPosition,
64
+ position: position,
76
65
  id: id,
77
66
  onMouseEnter: markAsHovered,
78
67
  onMouseLeave: unmarkAsHovered,
79
68
  onMouseDown: unmarkAsHovered,
80
69
  className: cx('flex! items-center! justify-center! border-0! rounded-none! bg-transparent!', visible ? 'cursor-crosshair! pointer-events-auto! opacity-100' : 'cursor-default! pointer-events-none! opacity-0'),
81
70
  style: {
82
- width: rootWidth,
83
- height: rootHeight,
71
+ width: handleWidth,
72
+ height: handleHeight,
84
73
  top,
85
74
  bottom,
86
75
  left,
87
76
  right,
88
- transform: rootTransform
77
+ transform
89
78
  },
90
- children: hasInwardLabel ? /*#__PURE__*/ jsxs(Fragment, {
91
- children: [
92
- /*#__PURE__*/ jsx("div", {
93
- className: cx('flex h-full w-full items-center', getInwardNotchLayout(position)),
94
- children: /*#__PURE__*/ jsx(HandleNotch, {
95
- handleType: handleType,
96
- isVertical: isVertical,
97
- selected: selected,
98
- hovered: isHovered,
99
- showNotch: showNotches
100
- })
101
- }),
102
- /*#__PURE__*/ jsx(ButtonHandle_InwardHandleLabel, {
103
- ref: inwardLabelRef,
104
- connectionPosition: connectionPosition,
105
- label: label,
106
- labelIcon: labelIcon,
107
- backgroundColor: labelBackgroundColor
108
- }),
109
- onAction && 'source' === type && showButton ? /*#__PURE__*/ jsx(HandleButton, {
110
- visible: showButton,
111
- labelVisible: visible,
112
- position: position,
113
- onAction: handleButtonClick,
114
- handleRef: handleRef
115
- }) : null
116
- ]
117
- }) : /*#__PURE__*/ jsxs(Fragment, {
118
- children: [
119
- /*#__PURE__*/ jsx(HandleNotch, {
120
- handleType: handleType,
121
- isVertical: isVertical,
122
- selected: selected,
123
- hovered: isHovered,
124
- showNotch: showNotches
125
- }),
126
- onAction && 'source' === type && showButton ? /*#__PURE__*/ jsx(HandleButton, {
127
- visible: showButton,
128
- labelVisible: visible,
129
- position: position,
130
- onAction: handleButtonClick,
131
- handleRef: handleRef,
132
- label: label,
133
- labelIcon: labelIcon,
134
- labelBackgroundColor: labelBackgroundColor
135
- }) : label && /*#__PURE__*/ jsx(HandleLabel, {
136
- position: position,
137
- backgroundColor: labelBackgroundColor,
138
- label: label,
139
- labelIcon: labelIcon
140
- })
141
- ]
142
- })
79
+ children: [
80
+ /*#__PURE__*/ jsx(HandleNotch, {
81
+ handleType: handleType,
82
+ isVertical: isVertical,
83
+ selected: selected,
84
+ hovered: isHovered,
85
+ showNotch: showNotches
86
+ }),
87
+ onAction && 'source' === type ? /*#__PURE__*/ jsx(HandleButton, {
88
+ visible: showButton,
89
+ labelVisible: visible,
90
+ position: position,
91
+ onAction: handleButtonClick,
92
+ handleRef: handleRef,
93
+ label: label,
94
+ labelIcon: labelIcon,
95
+ labelBackgroundColor: labelBackgroundColor
96
+ }) : label && /*#__PURE__*/ jsx(HandleLabel, {
97
+ position: position,
98
+ backgroundColor: labelBackgroundColor,
99
+ label: label,
100
+ labelIcon: labelIcon
101
+ })
102
+ ]
143
103
  });
144
104
  };
145
105
  const ButtonHandle = /*#__PURE__*/ memo(ButtonHandleBase);
146
- const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
106
+ const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
147
107
  const finalSelected = shouldShowAddButtonFn({
148
108
  showAddButton,
149
109
  selected,
@@ -162,7 +122,6 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
162
122
  nodeId: nodeId,
163
123
  type: handle.type,
164
124
  position: position,
165
- connectionPosition: connectionPosition,
166
125
  handleType: handle.handleType,
167
126
  label: handle.label,
168
127
  labelIcon: handle.labelIcon,
@@ -182,44 +141,4 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
182
141
  });
183
142
  };
184
143
  const ButtonHandles = /*#__PURE__*/ memo(ButtonHandlesBase);
185
- function useInwardLabelLayout({ hasInwardLabel, isVertical, position, handleType, handleWidth, handleHeight, transform }) {
186
- const inwardLabelRef = useRef(null);
187
- const [inwardLabelInset, setInwardLabelInset] = useState(0);
188
- useLayoutEffect(()=>{
189
- if (!hasInwardLabel) return void setInwardLabelInset((current)=>0 === current ? current : 0);
190
- const rect = inwardLabelRef.current?.getBoundingClientRect();
191
- const nextInset = isVertical ? rect?.height ?? 0 : rect?.width ?? 0;
192
- setInwardLabelInset((current)=>current === nextInset ? current : nextInset);
193
- }, [
194
- hasInwardLabel,
195
- isVertical
196
- ]);
197
- const inwardHandleSize = getInwardHandleSize(handleType);
198
- return {
199
- inwardLabelRef,
200
- rootWidth: hasInwardLabel && !isVertical ? inwardHandleSize : handleWidth,
201
- rootHeight: hasInwardLabel && isVertical ? inwardHandleSize : handleHeight,
202
- rootTransform: hasInwardLabel ? getInwardHandleTransform(position, inwardLabelInset) : transform
203
- };
204
- }
205
- const ButtonHandle_InwardHandleLabel = /*#__PURE__*/ forwardRef(function({ connectionPosition, label, labelIcon, backgroundColor }, ref) {
206
- return /*#__PURE__*/ jsx("div", {
207
- ref: ref,
208
- className: cx('pointer-events-none absolute flex h-6 items-center whitespace-nowrap rounded-full border border-border-subtle px-2.5', INWARD_LABEL_POSITION[connectionPosition]),
209
- style: {
210
- backgroundColor
211
- },
212
- children: /*#__PURE__*/ jsxs(Row, {
213
- align: "center",
214
- gap: 3,
215
- children: [
216
- labelIcon,
217
- /*#__PURE__*/ jsx("span", {
218
- className: "text-xs font-medium text-foreground",
219
- children: label
220
- })
221
- ]
222
- })
223
- });
224
- });
225
144
  export { ButtonHandle, ButtonHandles };
@@ -25,18 +25,14 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  leftPositionForHandle: ()=>leftPositionForHandle,
28
- getInwardHandleSize: ()=>getInwardHandleSize,
29
28
  topPositionForHandle: ()=>topPositionForHandle,
30
29
  transformForHandle: ()=>transformForHandle,
31
- getInwardNotchLayout: ()=>getInwardNotchLayout,
32
- heightForHandleWithPosition: ()=>heightForHandleWithPosition,
33
30
  snapToGrid: ()=>snapToGrid,
34
- INWARD_LABEL_POSITION: ()=>INWARD_LABEL_POSITION,
31
+ heightForHandleWithPosition: ()=>heightForHandleWithPosition,
35
32
  bottomPositionForHandle: ()=>bottomPositionForHandle,
36
33
  calculateGridAlignedHandlePositions: ()=>calculateGridAlignedHandlePositions,
37
34
  pixelToPercent: ()=>pixelToPercent,
38
35
  rightPositionForHandle: ()=>rightPositionForHandle,
39
- getInwardHandleTransform: ()=>getInwardHandleTransform,
40
36
  widthForHandleWithPosition: ()=>widthForHandleWithPosition
41
37
  });
42
38
  const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
@@ -44,14 +40,27 @@ const external_constants_cjs_namespaceObject = require("../../constants.cjs");
44
40
  const isHorizontalEdge = (position)=>position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
45
41
  const isVerticalEdge = (position)=>position === react_cjs_namespaceObject.Position.Left || position === react_cjs_namespaceObject.Position.Right;
46
42
  const snapToGrid = (value, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>Math.round(value / gridSize) * gridSize;
47
- const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING / 2)=>{
43
+ const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>{
48
44
  if (0 === numHandles) return [];
49
45
  if (nodeSize <= 0) return [];
46
+ if (1 === numHandles) return [
47
+ nodeSize / 2
48
+ ];
50
49
  const idealSpacing = nodeSize / (numHandles + 1);
50
+ if (nodeSize % gridSize !== 0) {
51
+ const positions = [];
52
+ for(let i = 0; i < numHandles; i++)positions.push(idealSpacing * (i + 1));
53
+ return positions;
54
+ }
51
55
  const roundedSpacing = Math.round(idealSpacing / gridSize) * gridSize;
52
- const gridAlignedSpacing = Math.max(gridSize, roundedSpacing);
53
- const totalSpan = (numHandles - 1) * gridAlignedSpacing;
54
- const startPosition = (nodeSize - totalSpan) / 2;
56
+ let gridAlignedSpacing = Math.max(gridSize, roundedSpacing);
57
+ let totalSpan = (numHandles - 1) * gridAlignedSpacing;
58
+ let startPosition = (nodeSize - totalSpan) / 2;
59
+ if (startPosition % gridSize !== 0 && gridAlignedSpacing > gridSize) {
60
+ gridAlignedSpacing -= gridSize;
61
+ totalSpan = (numHandles - 1) * gridAlignedSpacing;
62
+ startPosition = (nodeSize - totalSpan) / 2;
63
+ }
55
64
  const positions = [];
56
65
  for(let i = 0; i < numHandles; i++)positions.push(startPosition + i * gridAlignedSpacing);
57
66
  return positions;
@@ -125,47 +134,8 @@ const transformForHandle = ({ position, customPositionAndOffsets })=>{
125
134
  const horizontalPercent = hasCustomHorizontal ? '0%' : position === react_cjs_namespaceObject.Position.Right ? '50%' : '-50%';
126
135
  return `translate(${horizontalPercent}, ${verticalPercent})`;
127
136
  };
128
- const getInwardHandleSize = (handleType)=>{
129
- if ('input' === handleType) return '14px';
130
- if ('artifact' === handleType) return '16px';
131
- return '18px';
132
- };
133
- const getInwardHandleTransform = (position, inset)=>{
134
- switch(position){
135
- case react_cjs_namespaceObject.Position.Left:
136
- return `translate(${inset}px, -50%)`;
137
- case react_cjs_namespaceObject.Position.Right:
138
- return `translate(${-inset}px, -50%)`;
139
- case react_cjs_namespaceObject.Position.Top:
140
- return `translate(-50%, ${inset}px)`;
141
- case react_cjs_namespaceObject.Position.Bottom:
142
- return `translate(-50%, ${-inset}px)`;
143
- }
144
- };
145
- const getInwardNotchLayout = (position)=>{
146
- switch(position){
147
- case react_cjs_namespaceObject.Position.Top:
148
- return 'flex-col justify-start';
149
- case react_cjs_namespaceObject.Position.Bottom:
150
- return 'flex-col justify-end';
151
- case react_cjs_namespaceObject.Position.Left:
152
- return 'justify-start';
153
- case react_cjs_namespaceObject.Position.Right:
154
- return 'justify-end';
155
- }
156
- };
157
- const INWARD_LABEL_POSITION = {
158
- [react_cjs_namespaceObject.Position.Top]: 'top-full left-1/2 -translate-x-1/2',
159
- [react_cjs_namespaceObject.Position.Bottom]: 'bottom-full left-1/2 -translate-x-1/2',
160
- [react_cjs_namespaceObject.Position.Left]: 'left-full top-1/2 -translate-y-1/2',
161
- [react_cjs_namespaceObject.Position.Right]: 'right-full top-1/2 -translate-y-1/2'
162
- };
163
- exports.INWARD_LABEL_POSITION = __webpack_exports__.INWARD_LABEL_POSITION;
164
137
  exports.bottomPositionForHandle = __webpack_exports__.bottomPositionForHandle;
165
138
  exports.calculateGridAlignedHandlePositions = __webpack_exports__.calculateGridAlignedHandlePositions;
166
- exports.getInwardHandleSize = __webpack_exports__.getInwardHandleSize;
167
- exports.getInwardHandleTransform = __webpack_exports__.getInwardHandleTransform;
168
- exports.getInwardNotchLayout = __webpack_exports__.getInwardNotchLayout;
169
139
  exports.heightForHandleWithPosition = __webpack_exports__.heightForHandleWithPosition;
170
140
  exports.leftPositionForHandle = __webpack_exports__.leftPositionForHandle;
171
141
  exports.pixelToPercent = __webpack_exports__.pixelToPercent;
@@ -175,12 +145,8 @@ exports.topPositionForHandle = __webpack_exports__.topPositionForHandle;
175
145
  exports.transformForHandle = __webpack_exports__.transformForHandle;
176
146
  exports.widthForHandleWithPosition = __webpack_exports__.widthForHandleWithPosition;
177
147
  for(var __rspack_i in __webpack_exports__)if (-1 === [
178
- "INWARD_LABEL_POSITION",
179
148
  "bottomPositionForHandle",
180
149
  "calculateGridAlignedHandlePositions",
181
- "getInwardHandleSize",
182
- "getInwardHandleTransform",
183
- "getInwardNotchLayout",
184
150
  "heightForHandleWithPosition",
185
151
  "leftPositionForHandle",
186
152
  "pixelToPercent",
@@ -45,8 +45,4 @@ export declare const transformForHandle: ({ position, customPositionAndOffsets,
45
45
  position: Position;
46
46
  customPositionAndOffsets?: HandleConfigurationSpecificPosition;
47
47
  }) => string;
48
- export declare const getInwardHandleSize: (handleType: "artifact" | "input" | "output") => string;
49
- export declare const getInwardHandleTransform: (position: Position, inset: number) => string;
50
- export declare const getInwardNotchLayout: (position: Position) => string;
51
- export declare const INWARD_LABEL_POSITION: Record<Position, string>;
52
48
  //# sourceMappingURL=ButtonHandleStyleUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonHandleStyleUtils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAEpE,OAAO,KAAK,EAAE,mCAAmC,EAAE,M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